Changeset 47 for trunk/Forms


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/Forms
Files:
7 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
Note: See TracChangeset for help on using the changeset viewer.