Changeset 47


Ignore:
Timestamp:
Jul 12, 2012, 8:21:21 AM (12 years ago)
Author:
chronos
Message:
  • Added: Clipboard manipulation support in source code form.
  • Modified: Moved code which belongs to UFormSourceCode from UFormMain.
Location:
trunk
Files:
3 added
11 edited

Legend:

Unmodified
Added
Removed
  • trunk/Forms/UFormMain.lfm

    r46 r47  
    829829      Caption = 'Tools'
    830830      object MenuItem25: TMenuItem
    831         Action = AFormatSource
     831        Action = FormSourceCode.AFormatSource
    832832      end
    833833      object MenuItem27: TMenuItem
    834         Action = AShrinkSource
     834        Action = FormSourceCode.AShrinkSource
    835835      end
    836836      object MenuItem28: TMenuItem
    837         Action = AGenerateNumber
     837        Action = FormSourceCode.AGenerateNumber
    838838        Bitmap.Data = {
    839839          36040000424D3604000000000000360000002800000010000000100000000100
     
    10831083      OnExecute = AOptionsExecute
    10841084    end
    1085     object AFormatSource: TAction
    1086       Category = 'Tool'
    1087       Caption = 'Format source'
    1088       OnExecute = AFormatSourceExecute
    1089     end
    1090     object AShrinkSource: TAction
    1091       Category = 'Tool'
    1092       Caption = 'Shrink source'
    1093       OnExecute = AShrinkSourceExecute
    1094     end
    1095     object AGenerateNumber: TAction
    1096       Category = 'Tool'
    1097       Caption = 'Generate code for number'
    1098       ImageIndex = 13
    1099       OnExecute = AGenerateNumberExecute
    1100     end
    11011085    object AViewCompilers: TAction
    11021086      Category = 'View'
     
    11241108    top = 72
    11251109    Bitmap = {
    1126       4C69120000001000000010000000000000000000000000000000000000000000
     1110      4C69150000001000000010000000000000000000000000000000000000000000
    11271111      0000000000000000000000000000000000000000000000000000000000000000
    11281112      000000000000000000000000000000000000000000FF000000FF000000FF0000
     
    17001684      FF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFF
    17011685      FF00FFFFFF00FFFFFF000000ABA60000AB5B0000AA06FFFFFF00FFFFFF00FFFF
     1686      FF00FFFFFF00FFFFFF00FFFFFF00FF00FF00FF00FF00FF00FF00FF00FF00FF00
     1687      FF00FF00FF00FF00FF00FF00FF00FF00FF00FF00FF00FF00FF00FF00FF00FF00
     1688      FF00FF00FF00FF00FF00FF00FF00FF00FF00FF00FF00FF00FF00FF00FF00FF00
     1689      FF00000000FF000000FF000000FF000000FFFF00FF00FF00FF00FF00FF00FF00
     1690      FF00FF00FF00FF00FF00FF00FF00FF00FF00000000FF000000FF000000FF0000
     1691      00FF000000FF00FFFFFF00FFFFFF000000FF000000FF000000FF000000FF0000
     1692      00FFFF00FF00FF00FF00FF00FF00000000FF008484FF848484FF008484FF0000
     1693      00FF00FFFFFF000000FF000000FF00FFFFFF000000FF848484FF008484FF8484
     1694      84FF000000FFFF00FF00FF00FF00000000FF848484FF848484FF000000FFFF00
     1695      FF00FF00FF00FF00FF00FF00FF00FF00FF00FF00FF00000000FF848484FF0084
     1696      84FF000000FFFF00FF00FF00FF00000000FF008484FF848484FF000000FF0000
     1697      00FF000000FF000000FF000000FF000000FF000000FF000000FF848484FF8484
     1698      84FF000000FFFF00FF00FF00FF00000000FF848484FF008484FF848484FF0084
     1699      84FF848484FF008484FF848484FF008484FF848484FF008484FF848484FF0084
     1700      84FF000000FFFF00FF00FF00FF00000000FF008484FF848484FF008484FF8484
     1701      84FF008484FF840000FF840000FF840000FF840000FF840000FF840000FF8400
     1702      00FF000000FFFF00FF00FF00FF00000000FF848484FF008484FF848484FF0084
     1703      84FF848484FF840000FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF8400
     1704      00FF840000FFFF00FF00FF00FF00000000FF008484FF848484FF008484FF8484
     1705      84FF008484FF840000FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF8400
     1706      00FFFFFFFFFF840000FFFF00FF00000000FF848484FF008484FF848484FF0084
     1707      84FF848484FF840000FFFFFFFFFF000000FF000000FF000000FFFFFFFFFF8400
     1708      00FF840000FF840000FF840000FF000000FF008484FF848484FF008484FF8484
     1709      84FF008484FF840000FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF
     1710      FFFFFFFFFFFFFFFFFFFF840000FF000000FF848484FF008484FF848484FF0084
     1711      84FF848484FF840000FFFFFFFFFF000000FF000000FF000000FF000000FF0000
     1712      00FF000000FFFFFFFFFF840000FFFF00FF00000000FF000000FF000000FF0000
     1713      00FF000000FF840000FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF
     1714      FFFFFFFFFFFFFFFFFFFF840000FFFF00FF00FF00FF00FF00FF00FF00FF00FF00
     1715      FF00FF00FF00840000FF840000FF840000FF840000FF840000FF840000FF8400
     1716      00FF840000FF840000FF840000FFFF00FF00FF00FF00FF00FF00FF00FF00FF00
     1717      FF00FF00FF00FF00FF00FF00FF00FF00FF00FF00FF00FF00FF00FF00FF00FF00
     1718      FF00FF00FF00FF00FF00FF00FF00000000000000000000000000000000000000
     1719      0000000000000000000000000000000000000000000000000000000000000000
     1720      0000000000000000000000000000000000000000000000000000000000000000
     1721      0000000000000000000000000000000000000000000000000000000000000000
     1722      000000000000000000000000000000000000000000FF000000FF000000FF0000
     1723      00FF000000FF000000FF00000000000000000000000000000000000000000000
     1724      000000000000000000000000000000000000000000FFFFFFFFFFFFFFFFFFFFFF
     1725      FFFFFFFFFFFF000000FF000000FF000000000000000000000000000000000000
     1726      000000000000000000000000000000000000000000FFFFFFFFFFFFFFFFFFFFFF
     1727      FFFFFFFFFFFF000000FFFFFFFFFF000000FF0000000000000000000000000000
     1728      000000000000000000000000000000000000000000FFFFFFFFFF000000FF0000
     1729      00FFFFFFFFFF000000FF840000FF840000FF840000FF840000FF840000FF8400
     1730      00FF00000000000000000000000000000000000000FFFFFFFFFFFFFFFFFFFFFF
     1731      FFFFFFFFFFFFFFFFFFFF840000FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF8400
     1732      00FF840000FF000000000000000000000000000000FFFFFFFFFF000000FF0000
     1733      00FF000000FF000000FF840000FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF8400
     1734      00FFFFFFFFFF840000FF0000000000000000000000FFFFFFFFFFFFFFFFFFFFFF
     1735      FFFFFFFFFFFFFFFFFFFF840000FFFFFFFFFF000000FF000000FFFFFFFFFF8400
     1736      00FF840000FF840000FF840000FF00000000000000FFFFFFFFFF000000FF0000
     1737      00FF000000FF000000FF840000FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF
     1738      FFFFFFFFFFFFFFFFFFFF840000FF00000000000000FFFFFFFFFFFFFFFFFFFFFF
     1739      FFFFFFFFFFFFFFFFFFFF840000FFFFFFFFFF000000FF000000FF000000FF0000
     1740      00FF000000FFFFFFFFFF840000FF00000000000000FF000000FF000000FF0000
     1741      00FF000000FF000000FF840000FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF
     1742      FFFFFFFFFFFFFFFFFFFF840000FF000000000000000000000000000000000000
     1743      00000000000000000000840000FFFFFFFFFF000000FF000000FF000000FF0000
     1744      00FF000000FFFFFFFFFF840000FF000000000000000000000000000000000000
     1745      00000000000000000000840000FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF
     1746      FFFFFFFFFFFFFFFFFFFF840000FF000000000000000000000000000000000000
     1747      00000000000000000000840000FF840000FF840000FF840000FF840000FF8400
     1748      00FF840000FF840000FF840000FF000000000000000000000000000000000000
     1749      0000000000000000000000000000000000000000000000000000000000000000
     1750      0000000000000000000000000000FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFF
     1751      FF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFF
     1752      FF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFF
     1753      FF00000000FFFFFFFF00FFFFFF00FFFFFF00000000FFFFFFFF00FFFFFF00FFFF
     1754      FF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFF
     1755      FF00000000FFFFFFFF00FFFFFF00FFFFFF00000000FFFFFFFF00FFFFFF00FFFF
     1756      FF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFF
     1757      FF00000000FFFFFFFF00FFFFFF00FFFFFF00000000FFFFFFFF00FFFFFF00FFFF
     1758      FF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFF
     1759      FF00000000FF000000FFFFFFFF00000000FF000000FFFFFFFF00FFFFFF00FFFF
     1760      FF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFF
     1761      FF00FFFFFF00000000FFFFFFFF00000000FFFFFFFF00FFFFFF00FFFFFF00FFFF
     1762      FF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFF
     1763      FF00FFFFFF00000000FF000000FF000000FFFFFFFF00FFFFFF00FFFFFF00FFFF
     1764      FF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFF
     1765      FF00FFFFFF00FFFFFF00000000FFFFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFF
     1766      FF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFF
     1767      FF00FFFFFF00800000FF000000FF800000FFFFFFFF00FFFFFF00FFFFFF00FFFF
     1768      FF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFF
     1769      FF00FFFFFF00800000FFFFFFFF00800000FF800000FF800000FFFFFFFF00FFFF
     1770      FF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF008000
     1771      00FF800000FF800000FFFFFFFF00800000FFFFFFFF00FFFFFF00800000FFFFFF
     1772      FF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00800000FFFFFF
     1773      FF00FFFFFF00800000FFFFFFFF00800000FFFFFFFF00FFFFFF00800000FFFFFF
     1774      FF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00800000FFFFFF
     1775      FF00FFFFFF00800000FFFFFFFF00800000FFFFFFFF00FFFFFF00800000FFFFFF
     1776      FF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00800000FFFFFF
     1777      FF00FFFFFF00800000FFFFFFFF00FFFFFF00800000FF800000FFFFFFFF00FFFF
     1778      FF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF008000
     1779      00FF800000FFFFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFF
     1780      FF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFF
     1781      FF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFF
    17021782      FF00FFFFFF00FFFFFF00FFFFFF00
    17031783    }
  • trunk/Forms/UFormMain.lrt

    r44 r47  
    3131TMAINFORM.ABREAKPOINTTOGGLE.CAPTION=Toggle breakpoint
    3232TMAINFORM.AOPTIONS.CAPTION=Options
    33 TMAINFORM.AFORMATSOURCE.CAPTION=Format source
    34 TMAINFORM.ASHRINKSOURCE.CAPTION=Shrink source
    35 TMAINFORM.AGENERATENUMBER.CAPTION=Generate code for number
    3633TMAINFORM.AVIEWCOMPILERS.CAPTION=Compilers
    3734TMAINFORM.ASHOWTARGETPOSITION.CAPTION=Show position in target
  • trunk/Forms/UFormMain.pas

    r46 r47  
    2727    ABreakpointToggle: TAction;
    2828    AViewCompilers: TAction;
    29     AGenerateNumber: TAction;
    30     AShrinkSource: TAction;
    31     AFormatSource: TAction;
    3229    AOptions: TAction;
    3330    AProgramStepOut: TAction;
     
    119116    procedure ABreakpointToggleExecute(Sender: TObject);
    120117    procedure AExitExecute(Sender: TObject);
    121     procedure AFormatSourceExecute(Sender: TObject);
    122     procedure AGenerateNumberExecute(Sender: TObject);
    123118    procedure AOptionsExecute(Sender: TObject);
    124119    procedure AProgramCompileExecute(Sender: TObject);
     
    138133    procedure AShowSourcePositionExecute(Sender: TObject);
    139134    procedure AShowTargetPositionExecute(Sender: TObject);
    140     procedure AShrinkSourceExecute(Sender: TObject);
    141135    procedure AViewCompilersExecute(Sender: TObject);
    142136    procedure AViewInterpretterExecute(Sender: TObject);
     
    145139    procedure FormDestroy(Sender: TObject);
    146140    procedure FormShow(Sender: TObject);
    147     procedure MemoSourceChange(Sender: TObject);
    148     procedure MemoSourceKeyDown(Sender: TObject; var Key: Word;
    149       Shift: TShiftState);
    150     procedure MemoSourceKeyPress(Sender: TObject; var Key: char);
    151     procedure MemoSourceKeyUp(Sender: TObject; var Key: Word; Shift: TShiftState
    152       );
    153     procedure MemoSourceMouseDown(Sender: TObject; Button: TMouseButton;
    154       Shift: TShiftState; X, Y: Integer);
    155141    procedure TimerRefreshTimer(Sender: TObject);
    156142  private
     
    193179
    194180resourcestring
    195   SEnterNumber = 'Enter number';
    196   SNumberGeneration = 'Number generation';
    197181  SProgramExited = 'Program exited';
    198182  SProgramStarted = 'Program started';
     
    215199end;
    216200
    217 procedure TMainForm.MemoSourceChange(Sender: TObject);
    218 begin
    219   Modified := True;
    220   CurrentTarget.Compiled := False;
    221   UpdateInterface;
    222 end;
    223 
    224 procedure TMainForm.MemoSourceKeyDown(Sender: TObject; var Key: Word;
    225   Shift: TShiftState);
    226 begin
    227 end;
    228 
    229 procedure TMainForm.MemoSourceKeyPress(Sender: TObject; var Key: char);
    230 begin
    231 end;
    232 
    233 procedure TMainForm.MemoSourceKeyUp(Sender: TObject; var Key: Word;
    234   Shift: TShiftState);
    235 begin
    236   UpdateStatusBar;
    237 end;
    238 
    239 procedure TMainForm.MemoSourceMouseDown(Sender: TObject; Button: TMouseButton;
    240   Shift: TShiftState; X, Y: Integer);
    241 begin
    242   UpdateStatusBar;
    243 end;
    244 
    245201procedure TMainForm.TimerRefreshTimer(Sender: TObject);
    246202begin
     
    281237  LastOpenedList.AddItem(FileName);
    282238  ProjectFileName := FileName;
    283   UpdateInterface;
    284239  Modified := False;
    285240  CurrentTarget.Compiled := False;
     241  UpdateInterface;
    286242end;
    287243
     
    485441end;
    486442
    487 procedure TMainForm.AShrinkSourceExecute(Sender: TObject);
    488 var
    489   Source: string;
    490   Pos: Integer;
    491   I: Integer;
    492 begin
    493   Source := FormSourceCode.MemoSource.Text;
    494   Pos := 1;
    495   for I := 1 to Length(Source) do begin
    496     if Source[I] > ' ' then begin
    497       Source[Pos] := Source[I];
    498       Inc(Pos);
    499     end;
    500   end;
    501   SetLength(Source, Pos - 1);
    502   FormSourceCode.MemoSource.Text := Source;
    503 end;
    504 
    505443procedure TMainForm.AViewCompilersExecute(Sender: TObject);
    506444begin
     
    521459begin
    522460  Close;
    523 end;
    524 
    525 procedure TMainForm.AFormatSourceExecute(Sender: TObject);
    526 var
    527   Source: string;
    528   NewSource: string;
    529   Indent: Integer;
    530   I: Integer;
    531 const
    532   IndentText = '  ';
    533 begin
    534   Source := FormSourceCode.MemoSource.Text;
    535   NewSource := '';
    536   Indent := 0;
    537   for I := 1 to Length(Source) do begin
    538     if Source[I] = '[' then begin
    539       NewSource := NewSource + LineEnding + DupeString(IndentText, Indent) + Source[I] + LineEnding ;
    540       Inc(Indent);
    541       NewSource := NewSource + DupeString(IndentText, Indent);
    542     end
    543     else if Source[I] = ']' then begin
    544       Dec(Indent);
    545       NewSource := NewSource + LineEnding + DupeString(IndentText, Indent) + Source[I] + LineEnding + DupeString(IndentText, Indent);
    546     end
    547     else if Ord(Source[I]) > $20 then
    548       NewSource := NewSource + Source[I];
    549   end;
    550   FormSourceCode.MemoSource.Text := NewSource;
    551 end;
    552 
    553 procedure TMainForm.AGenerateNumberExecute(Sender: TObject);
    554 var
    555   NumberText: string;
    556   Number: Integer;
    557   I: Integer;
    558 begin
    559   NumberText := InputBox(SNumberGeneration, SEnterNumber, '1');
    560   if TryStrToInt(NumberText, Number) then begin
    561     NumberText := '';
    562     for I := 0 to Number - 1 do
    563       NumberText := NumberText + '+';
    564     FormSourceCode.MemoSource.Text := FormSourceCode.MemoSource.Text + NumberText;
    565   end;
    566461end;
    567462
     
    665560procedure TMainForm.AProjectCloseExecute(Sender: TObject);
    666561begin
     562  if Modified then AProjectSaveAs.Execute;
    667563  AProgramStop.Execute;
    668   Modified := False;
    669564  ProjectFileName := '';
    670565  FormSourceCode.MemoSource.Clear;
     566  Modified := False;
    671567  UpdateInterface;
    672568end;
     
    689585procedure TMainForm.AProjectOpenExecute(Sender: TObject);
    690586begin
     587  AProjectClose.Execute;
    691588  OpenDialog1.FileName := ProjectFileName;
    692589  if OpenDialog1.Execute then begin
  • trunk/Forms/UFormSourceCode.lfm

    r46 r47  
    11object FormSourceCode: TFormSourceCode
    2   Left = 373
     2  Left = 627
    33  Height = 240
    4   Top = 216
     4  Top = 182
    55  Width = 320
    66  Caption = 'Source code'
     
    1616    Font.Height = -12
    1717    Font.Name = 'Courier New'
     18    OnChange = MemoSourceChange
     19    OnKeyDown = MemoSourceKeyDown
     20    OnKeyPress = MemoSourceKeyPress
     21    OnKeyUp = MemoSourceKeyUp
     22    OnMouseDown = MemoSourceMouseDown
    1823    ParentFont = False
    1924    PopupMenu = PopupMenuSource
     
    2328  object PopupMenuSource: TPopupMenu
    2429    Images = MainForm.ImageList1
    25     left = 84
    26     top = 156
     30    left = 128
     31    top = 112
    2732    object MenuItem23: TMenuItem
    28       Bitmap.Data = {
    29         36040000424D3604000000000000360000002800000010000000100000000100
    30         2000000000000004000064000000640000000000000000000000FFFFFF00FFFF
    31         FF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFF
    32         FF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFF
    33         FF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFF
    34         FF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFF
    35         FF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFF
    36         FF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFF
    37         FF000000810000007500000064200000607E000060B2000060C8000060B20000
    38         607E000064200000750000008100FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFF
    39         FF00000081000000784102027DC10A0AA8E70F0FCAF81111D5FE0F0FCAF80A0A
    40         A8E702027DC10000784100008100FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFF
    41         FF0000008420030389C11515BFF31212CDFF1111CCFF1111CCFF1111CCFF1111
    42         CCFF0E0EBCF3020288C100008420FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFF
    43         FF000000897E1818AFE61414C1FF1111BFFF1111BFFF1111BFFF1111BFFF1111
    44         BFFF1111BFFF0A0AA6E60000897EFFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFF
    45         FF0000008FB23434C3F81414B2FF1111B1FF1111B1FF1111B1FF1111B1FF1111
    46         B1FF1111B1FF1414B0F800008FB2FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFF
    47         FF00000095C84848D0FE2E2EB8FF1D1DADFF1212A5FF1111A4FF1111A4FF1111
    48         A4FF1111A4FF1B1BADFE000095C8FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFF
    49         FF0000009AB24A4AD4F83737BFFF3737BFFF3131BAFF2727B0FF1C1CA6FF1616
    50         A0FF12129CFF2323AEF800009AB2FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFF
    51         FF0000009E7E3939CCE64A4AD2FF4545CDFF4545CDFF4545CDFF4545CDFF4545
    52         CDFF4848D0FF3131C3E600009E7EFFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFF
    53         FF000000A3200A0AABC15555E3F35A5AE2FF5656DEFF5656DEFF5656DEFF5959
    54         E1FF5050DEF30909AAC10000A320FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFF
    55         FF000000A4000000A6410A0AAEC13F3FD5E76060EDF86A6AF3FE6060ECF83E3E
    56         D4E70A0AADC10000A6410000A400FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFF
    57         FF000000A4000000A6000000A9200000AA7E0000AAB20000AAC80000AAB20000
    58         AA7E0000A9200000A6000000A400FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFF
    59         FF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFF
    60         FF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFF
    61         FF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFF
    62         FF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00
    63       }
     33      Action = MainForm.ABreakpointToggle
    6434    end
    6535    object MenuItem26: TMenuItem
     36      Action = AFormatSource
    6637    end
    6738    object MenuItem21: TMenuItem
     39      Action = AGenerateNumber
    6840    end
    6941    object MenuItem29: TMenuItem
     42      Action = MainForm.AShowTargetPosition
    7043      Bitmap.Data = {
    7144        36040000424D3604000000000000360000002800000010000000100000000100
     
    10679    end
    10780    object MenuItem36: TMenuItem
     81      Action = AShrinkSource
     82    end
     83    object MenuItem1: TMenuItem
     84      Caption = '-'
     85    end
     86    object MenuItem2: TMenuItem
     87      Action = ACopyToClipboard
     88    end
     89    object MenuItem3: TMenuItem
     90      Action = APasteFromClipboard
     91    end
     92    object MenuItem6: TMenuItem
     93      Action = ACutToClipboard
     94    end
     95    object MenuItem4: TMenuItem
     96      Action = AClear
     97    end
     98    object MenuItem5: TMenuItem
     99      Action = ASelectAll
     100    end
     101  end
     102  object ActionList1: TActionList
     103    Images = MainForm.ImageList1
     104    left = 128
     105    top = 56
     106    object AGenerateNumber: TAction
     107      Caption = 'Generate number'
     108      ImageIndex = 13
     109      OnExecute = AGenerateNumberExecute
     110    end
     111    object AShrinkSource: TAction
     112      Caption = 'Shrink source'
     113      Hint = 'Shrink source'
     114      OnExecute = AShrinkSourceExecute
     115    end
     116    object AFormatSource: TAction
     117      Caption = 'Format source'
     118      Hint = 'Format source'
     119      OnExecute = AFormatSourceExecute
     120    end
     121    object APasteFromClipboard: TAction
     122      Caption = 'Paste'
     123      Hint = 'Paste'
     124      ImageIndex = 18
     125      OnExecute = APasteFromClipboardExecute
     126      ShortCut = 16470
     127    end
     128    object ACopyToClipboard: TAction
     129      Caption = 'Copy'
     130      Hint = 'Copy'
     131      ImageIndex = 19
     132      OnExecute = ACopyToClipboardExecute
     133      ShortCut = 16451
     134    end
     135    object AClear: TAction
     136      Caption = 'Clear'
     137      Hint = 'Clear'
     138      ImageIndex = 4
     139      OnExecute = AClearExecute
     140    end
     141    object ASelectAll: TAction
     142      Caption = 'Select all'
     143      Hint = 'Select all'
     144      OnExecute = ASelectAllExecute
     145      ShortCut = 16449
     146    end
     147    object ACutToClipboard: TAction
     148      Caption = 'Cut'
     149      Hint = 'Cut'
     150      ImageIndex = 20
     151      OnExecute = ACutToClipboardExecute
     152      ShortCut = 16472
    108153    end
    109154  end
  • trunk/Forms/UFormSourceCode.lrt

    r46 r47  
    11TFORMSOURCECODE.CAPTION=Source code
     2TFORMSOURCECODE.MENUITEM1.CAPTION=-
     3TFORMSOURCECODE.AGENERATENUMBER.CAPTION=Generate number
     4TFORMSOURCECODE.ASHRINKSOURCE.CAPTION=Shrink source
     5TFORMSOURCECODE.ASHRINKSOURCE.HINT=Shrink source
     6TFORMSOURCECODE.AFORMATSOURCE.CAPTION=Format source
     7TFORMSOURCECODE.AFORMATSOURCE.HINT=Format source
     8TFORMSOURCECODE.APASTEFROMCLIPBOARD.CAPTION=Paste
     9TFORMSOURCECODE.APASTEFROMCLIPBOARD.HINT=Paste
     10TFORMSOURCECODE.ACOPYTOCLIPBOARD.CAPTION=Copy
     11TFORMSOURCECODE.ACOPYTOCLIPBOARD.HINT=Copy
     12TFORMSOURCECODE.ACLEAR.CAPTION=Clear
     13TFORMSOURCECODE.ACLEAR.HINT=Clear
     14TFORMSOURCECODE.ASELECTALL.CAPTION=Select all
     15TFORMSOURCECODE.ASELECTALL.HINT=Select all
     16TFORMSOURCECODE.ACUTTOCLIPBOARD.CAPTION=Cut
     17TFORMSOURCECODE.ACUTTOCLIPBOARD.HINT=Cut
  • trunk/Forms/UFormSourceCode.pas

    r46 r47  
    77uses
    88  Classes, SysUtils, FileUtil, Forms, Controls, Graphics, Dialogs, StdCtrls,
    9   Menus;
     9  Menus, ActnList, strutils;
    1010
    1111type
     
    1414
    1515  TFormSourceCode = class(TForm)
     16    ACutToClipboard: TAction;
     17    ASelectAll: TAction;
     18    APasteFromClipboard: TAction;
     19    ACopyToClipboard: TAction;
     20    AClear: TAction;
     21    AFormatSource: TAction;
     22    AShrinkSource: TAction;
     23    AGenerateNumber: TAction;
     24    ActionList1: TActionList;
    1625    MemoSource: TMemo;
     26    MenuItem1: TMenuItem;
     27    MenuItem2: TMenuItem;
    1728    MenuItem21: TMenuItem;
    1829    MenuItem23: TMenuItem;
    1930    MenuItem26: TMenuItem;
    2031    MenuItem29: TMenuItem;
     32    MenuItem3: TMenuItem;
    2133    MenuItem36: TMenuItem;
     34    MenuItem4: TMenuItem;
     35    MenuItem5: TMenuItem;
     36    MenuItem6: TMenuItem;
    2237    PopupMenuSource: TPopupMenu;
     38    procedure AClearExecute(Sender: TObject);
     39    procedure ACopyToClipboardExecute(Sender: TObject);
     40    procedure ACutToClipboardExecute(Sender: TObject);
     41    procedure AFormatSourceExecute(Sender: TObject);
     42    procedure AGenerateNumberExecute(Sender: TObject);
     43    procedure APasteFromClipboardExecute(Sender: TObject);
     44    procedure ASelectAllExecute(Sender: TObject);
     45    procedure AShrinkSourceExecute(Sender: TObject);
     46    procedure MemoSourceChange(Sender: TObject);
     47    procedure MemoSourceKeyDown(Sender: TObject; var Key: Word;
     48      Shift: TShiftState);
     49    procedure MemoSourceKeyPress(Sender: TObject; var Key: char);
     50    procedure MemoSourceKeyUp(Sender: TObject; var Key: Word; Shift: TShiftState
     51      );
     52    procedure MemoSourceMouseDown(Sender: TObject; Button: TMouseButton;
     53      Shift: TShiftState; X, Y: Integer);
    2354  private
    24     { private declarations }
    2555  public
    26     { public declarations }
     56    procedure UpdateInterface;
    2757  end;
    2858
     
    3060  FormSourceCode: TFormSourceCode;
    3161
     62
    3263implementation
     64
     65uses
     66  UFormMain;
     67
     68resourcestring
     69  SNumberGeneration = 'Number generation';
     70  SEnterNumber = 'Enter number';
     71
    3372
    3473{$R *.lfm}
    3574
     75{ TFormSourceCode }
     76
     77procedure TFormSourceCode.AGenerateNumberExecute(Sender: TObject);
     78var
     79  NumberText: string;
     80  Number: Integer;
     81  I: Integer;
     82begin
     83  NumberText := InputBox(SNumberGeneration, SEnterNumber, '1');
     84  if TryStrToInt(NumberText, Number) then begin
     85    NumberText := '';
     86    for I := 0 to Number - 1 do
     87      NumberText := NumberText + '+';
     88    MemoSource.SelText := NumberText;
     89  end;
     90end;
     91
     92procedure TFormSourceCode.APasteFromClipboardExecute(Sender: TObject);
     93begin
     94  MemoSource.PasteFromClipboard;
     95end;
     96
     97procedure TFormSourceCode.ASelectAllExecute(Sender: TObject);
     98begin
     99  MemoSource.SelectAll;
     100end;
     101
     102procedure TFormSourceCode.AFormatSourceExecute(Sender: TObject);
     103var
     104  Source: string;
     105  NewSource: string;
     106  Indent: Integer;
     107  I: Integer;
     108const
     109  IndentText = '  ';
     110begin
     111  Source := MemoSource.Text;
     112  NewSource := '';
     113  Indent := 0;
     114  for I := 1 to Length(Source) do begin
     115    if Source[I] = '[' then begin
     116      NewSource := NewSource + LineEnding + DupeString(IndentText, Indent) + Source[I] + LineEnding ;
     117      Inc(Indent);
     118      NewSource := NewSource + DupeString(IndentText, Indent);
     119    end
     120    else if Source[I] = ']' then begin
     121      Dec(Indent);
     122      NewSource := NewSource + LineEnding + DupeString(IndentText, Indent) + Source[I] + LineEnding + DupeString(IndentText, Indent);
     123    end
     124    else if Ord(Source[I]) > $20 then
     125      NewSource := NewSource + Source[I];
     126  end;
     127  MemoSource.Text := NewSource;
     128end;
     129
     130procedure TFormSourceCode.ACopyToClipboardExecute(Sender: TObject);
     131begin
     132  MemoSource.CopyToClipboard;
     133end;
     134
     135procedure TFormSourceCode.ACutToClipboardExecute(Sender: TObject);
     136begin
     137  MemoSource.CutToClipboard;
     138end;
     139
     140procedure TFormSourceCode.AClearExecute(Sender: TObject);
     141begin
     142  MemoSource.Clear;
     143end;
     144
     145procedure TFormSourceCode.AShrinkSourceExecute(Sender: TObject);
     146var
     147  Source: string;
     148  Pos: Integer;
     149  I: Integer;
     150begin
     151  Source := MemoSource.Text;
     152  Pos := 1;
     153  for I := 1 to Length(Source) do begin
     154    if Source[I] > ' ' then begin
     155      Source[Pos] := Source[I];
     156      Inc(Pos);
     157    end;
     158  end;
     159  SetLength(Source, Pos - 1);
     160  MemoSource.Text := Source;
     161end;
     162
     163procedure TFormSourceCode.UpdateInterface;
     164begin
     165
     166end;
     167
     168procedure TFormSourceCode.MemoSourceChange(Sender: TObject);
     169begin
     170  MainForm.Modified := True;
     171  MainForm.CurrentTarget.Compiled := False;
     172  MainForm.UpdateInterface;
     173end;
     174
     175procedure TFormSourceCode.MemoSourceKeyDown(Sender: TObject; var Key: Word;
     176  Shift: TShiftState);
     177begin
     178end;
     179
     180procedure TFormSourceCode.MemoSourceKeyPress(Sender: TObject; var Key: char);
     181begin
     182end;
     183
     184procedure TFormSourceCode.MemoSourceKeyUp(Sender: TObject; var Key: Word;
     185  Shift: TShiftState);
     186begin
     187  MainForm.UpdateStatusBar;
     188end;
     189
     190procedure TFormSourceCode.MemoSourceMouseDown(Sender: TObject; Button: TMouseButton;
     191  Shift: TShiftState; X, Y: Integer);
     192begin
     193  MainForm.UpdateStatusBar;
     194end;
     195
     196
    36197end.
    37198
  • trunk/Forms/UFormTargetCode.lfm

    r46 r47  
    2424    top = 100
    2525    object MenuItem20: TMenuItem
     26      Action = MainForm.AShowSourcePosition
    2627    end
    2728  end
  • trunk/Languages/LazFuckIDE.cs.po

    r46 r47  
    138138msgstr "VÃœstup:"
    139139
     140#: tformsourcecode.aclear.caption
     141msgctxt "tformsourcecode.aclear.caption"
     142msgid "Clear"
     143msgstr ""
     144
     145#: tformsourcecode.aclear.hint
     146msgctxt "tformsourcecode.aclear.hint"
     147msgid "Clear"
     148msgstr ""
     149
     150#: tformsourcecode.acopytoclipboard.caption
     151msgctxt "tformsourcecode.acopytoclipboard.caption"
     152msgid "Copy"
     153msgstr ""
     154
     155#: tformsourcecode.acopytoclipboard.hint
     156msgctxt "tformsourcecode.acopytoclipboard.hint"
     157msgid "Copy"
     158msgstr ""
     159
     160#: tformsourcecode.acuttoclipboard.caption
     161msgctxt "tformsourcecode.acuttoclipboard.caption"
     162msgid "Cut"
     163msgstr ""
     164
     165#: tformsourcecode.acuttoclipboard.hint
     166msgctxt "tformsourcecode.acuttoclipboard.hint"
     167msgid "Cut"
     168msgstr ""
     169
     170#: tformsourcecode.aformatsource.caption
     171msgctxt "tformsourcecode.aformatsource.caption"
     172msgid "Format source"
     173msgstr "Formátovat zdroj"
     174
     175#: tformsourcecode.aformatsource.hint
     176msgctxt "tformsourcecode.aformatsource.hint"
     177msgid "Format source"
     178msgstr "Formátovat zdroj"
     179
     180#: tformsourcecode.ageneratenumber.caption
     181msgid "Generate number"
     182msgstr ""
     183
     184#: tformsourcecode.apastefromclipboard.caption
     185msgctxt "tformsourcecode.apastefromclipboard.caption"
     186msgid "Paste"
     187msgstr ""
     188
     189#: tformsourcecode.apastefromclipboard.hint
     190msgctxt "tformsourcecode.apastefromclipboard.hint"
     191msgid "Paste"
     192msgstr ""
     193
     194#: tformsourcecode.aselectall.caption
     195msgctxt "tformsourcecode.aselectall.caption"
     196msgid "Select all"
     197msgstr ""
     198
     199#: tformsourcecode.aselectall.hint
     200msgctxt "tformsourcecode.aselectall.hint"
     201msgid "Select all"
     202msgstr ""
     203
     204#: tformsourcecode.ashrinksource.caption
     205msgctxt "tformsourcecode.ashrinksource.caption"
     206msgid "Shrink source"
     207msgstr "Srazit kód"
     208
     209#: tformsourcecode.ashrinksource.hint
     210msgctxt "tformsourcecode.ashrinksource.hint"
     211msgid "Shrink source"
     212msgstr "Srazit kód"
     213
    140214#: tformsourcecode.caption
    141215msgctxt "tformsourcecode.caption"
    142216msgid "Source code"
    143217msgstr "ZdrojovÜ kód"
     218
     219#: tformsourcecode.menuitem1.caption
     220msgctxt "tformsourcecode.menuitem1.caption"
     221msgid "-"
     222msgstr "-"
    144223
    145224#: tformtargetcode.caption
     
    231310msgstr "Ukončit"
    232311
    233 #: tmainform.aformatsource.caption
    234 msgid "Format source"
    235 msgstr "Formátovat zdroj"
    236 
    237 #: tmainform.ageneratenumber.caption
    238 msgid "Generate code for number"
    239 msgstr "Generovat kód z čísla"
    240 
    241312#: tmainform.ahelp.caption
    242313msgctxt "tmainform.ahelp.caption"
     
    318389msgstr "Ukaş pozici v cíli"
    319390
    320 #: tmainform.ashrinksource.caption
    321 msgid "Shrink source"
    322 msgstr "Srazit kód"
    323 
    324391#: tmainform.aviewcompilers.caption
    325392msgctxt "tmainform.aviewcompilers.caption"
     
    475542msgstr " kroků/s"
    476543
    477 #: uformmain.senternumber
    478 msgctxt "uformmain.senternumber"
    479 msgid "Enter number"
    480 msgstr "Zadejte číslo"
    481 
    482544#: uformmain.snewproject
    483545msgid "New project"
    484546msgstr "NovÜ projekt"
    485 
    486 #: uformmain.snumbergeneration
    487 msgctxt "uformmain.snumbergeneration"
    488 msgid "Number generation"
    489 msgstr "Generování čísla"
    490547
    491548#: uformmain.sprogramexited
     
    502559msgstr "Program zastaven"
    503560
     561#: uformsourcecode.senternumber
     562msgctxt "uformsourcecode.senternumber"
     563msgid "Enter number"
     564msgstr "Zadejte číslo"
     565
     566#: uformsourcecode.snumbergeneration
     567msgctxt "uformsourcecode.snumbergeneration"
     568msgid "Number generation"
     569msgstr "Generování čísla"
     570
    504571#: uformtargets.scompileroptions
    505572msgctxt "uformtargets.scompileroptions"
  • trunk/Languages/LazFuckIDE.po

    r46 r47  
    128128msgstr ""
    129129
     130#: tformsourcecode.aclear.caption
     131msgctxt "tformsourcecode.aclear.caption"
     132msgid "Clear"
     133msgstr ""
     134
     135#: tformsourcecode.aclear.hint
     136msgctxt "TFORMSOURCECODE.ACLEAR.HINT"
     137msgid "Clear"
     138msgstr ""
     139
     140#: tformsourcecode.acopytoclipboard.caption
     141msgctxt "tformsourcecode.acopytoclipboard.caption"
     142msgid "Copy"
     143msgstr ""
     144
     145#: tformsourcecode.acopytoclipboard.hint
     146msgctxt "TFORMSOURCECODE.ACOPYTOCLIPBOARD.HINT"
     147msgid "Copy"
     148msgstr ""
     149
     150#: tformsourcecode.acuttoclipboard.caption
     151msgctxt "tformsourcecode.acuttoclipboard.caption"
     152msgid "Cut"
     153msgstr ""
     154
     155#: tformsourcecode.acuttoclipboard.hint
     156msgctxt "TFORMSOURCECODE.ACUTTOCLIPBOARD.HINT"
     157msgid "Cut"
     158msgstr ""
     159
     160#: tformsourcecode.aformatsource.caption
     161msgctxt "TFORMSOURCECODE.AFORMATSOURCE.CAPTION"
     162msgid "Format source"
     163msgstr ""
     164
     165#: tformsourcecode.aformatsource.hint
     166msgctxt "TFORMSOURCECODE.AFORMATSOURCE.HINT"
     167msgid "Format source"
     168msgstr ""
     169
     170#: tformsourcecode.ageneratenumber.caption
     171msgid "Generate number"
     172msgstr ""
     173
     174#: tformsourcecode.apastefromclipboard.caption
     175msgctxt "tformsourcecode.apastefromclipboard.caption"
     176msgid "Paste"
     177msgstr ""
     178
     179#: tformsourcecode.apastefromclipboard.hint
     180msgctxt "TFORMSOURCECODE.APASTEFROMCLIPBOARD.HINT"
     181msgid "Paste"
     182msgstr ""
     183
     184#: tformsourcecode.aselectall.caption
     185msgctxt "tformsourcecode.aselectall.caption"
     186msgid "Select all"
     187msgstr ""
     188
     189#: tformsourcecode.aselectall.hint
     190msgctxt "TFORMSOURCECODE.ASELECTALL.HINT"
     191msgid "Select all"
     192msgstr ""
     193
     194#: tformsourcecode.ashrinksource.caption
     195msgctxt "TFORMSOURCECODE.ASHRINKSOURCE.CAPTION"
     196msgid "Shrink source"
     197msgstr ""
     198
     199#: tformsourcecode.ashrinksource.hint
     200msgctxt "TFORMSOURCECODE.ASHRINKSOURCE.HINT"
     201msgid "Shrink source"
     202msgstr ""
     203
    130204#: tformsourcecode.caption
    131205msgctxt "TFORMSOURCECODE.CAPTION"
     
    133207msgstr ""
    134208
     209#: tformsourcecode.menuitem1.caption
     210msgctxt "TFORMSOURCECODE.MENUITEM1.CAPTION"
     211msgid "-"
     212msgstr ""
     213
    135214#: tformtargetcode.caption
    136215msgctxt "TFORMTARGETCODE.CAPTION"
     
    220299msgstr ""
    221300
    222 #: tmainform.aformatsource.caption
    223 msgid "Format source"
    224 msgstr ""
    225 
    226 #: tmainform.ageneratenumber.caption
    227 msgid "Generate code for number"
    228 msgstr ""
    229 
    230301#: tmainform.ahelp.caption
    231302msgctxt "TMAINFORM.AHELP.CAPTION"
     
    307378msgstr ""
    308379
    309 #: tmainform.ashrinksource.caption
    310 msgid "Shrink source"
    311 msgstr ""
    312 
    313380#: tmainform.aviewcompilers.caption
    314381msgctxt "TMAINFORM.AVIEWCOMPILERS.CAPTION"
     
    464531msgstr ""
    465532
    466 #: uformmain.senternumber
    467 msgctxt "uformmain.senternumber"
    468 msgid "Enter number"
    469 msgstr ""
    470 
    471533#: uformmain.snewproject
    472534msgid "New project"
    473 msgstr ""
    474 
    475 #: uformmain.snumbergeneration
    476 msgctxt "uformmain.snumbergeneration"
    477 msgid "Number generation"
    478535msgstr ""
    479536
     
    491548msgstr ""
    492549
     550#: uformsourcecode.senternumber
     551msgctxt "uformsourcecode.senternumber"
     552msgid "Enter number"
     553msgstr ""
     554
     555#: uformsourcecode.snumbergeneration
     556msgctxt "uformsourcecode.snumbergeneration"
     557msgid "Number generation"
     558msgstr ""
     559
    493560#: uformtargets.scompileroptions
    494561msgctxt "uformtargets.scompileroptions"
  • trunk/Target/UTarget.pas

    r43 r47  
    9999    destructor Destroy; override;
    100100    procedure Reset; virtual;
    101     procedure OptimizeSource;
     101    procedure OptimizeSource; virtual;
    102102    procedure Compile; virtual;
    103103    procedure CompileToFile; virtual;
  • trunk/Target/UTargetInterpretter.pas

    r40 r47  
    6666    Input: string;
    6767    InputPosition: Integer;
     68    procedure OptimizeSource; override;
    6869    procedure Reset; override;
    6970    procedure Compile; override;
     
    345346end;
    346347
     348procedure TTargetInterpretter.OptimizeSource;
     349begin
     350  inherited OptimizeSource;
     351end;
     352
    347353procedure TTargetInterpretter.Run;
    348354begin
Note: See TracChangeset for help on using the changeset viewer.