Changeset 48 for trunk/Target


Ignore:
Timestamp:
Jul 12, 2012, 9:15:02 AM (12 years ago)
Author:
chronos
Message:
  • Added: Tool button with drop down menu of available targets.
  • Added Target list have icons.
Location:
trunk/Target
Files:
6 edited

Legend:

Unmodified
Added
Removed
  • trunk/Target/UTarget.pas

    r47 r48  
    77uses
    88  Classes, SysUtils, StrUtils, Registry, URegistry, SpecializedList, Dialogs,
    9   FileUtil, Process;
     9  FileUtil, Process, Menus;
    1010
    1111type
     
    8686    Name: string;
    8787    ProgramName: string;
     88    ImageIndex: Integer;
    8889    Optimization: TCompilerOptimization;
    8990    CompilerPath: string;
     
    126127    procedure SaveToRegistry(Root: HKEY; Key: string);
    127128    function FindByName(Name: string): TTarget;
     129    procedure LoadToMenuItem(MenuItem: TMenuItem; Action: TNotifyEvent;
     130      CurrentTarget: TTarget);
    128131  end;
    129132
     
    286289  if I < Count then Result := TTarget(Items[I])
    287290    else Result := nil;
     291end;
     292
     293procedure TTargetList.LoadToMenuItem(MenuItem: TMenuItem; Action: TNotifyEvent
     294  ; CurrentTarget: TTarget);
     295var
     296  NewMenuItem: TMenuItem;
     297  I: Integer;
     298begin
     299  if Assigned(MenuItem) then begin
     300    MenuItem.Clear;
     301    for I := 0 to Count - 1 do begin
     302      NewMenuItem := TMenuItem.Create(MenuItem);
     303      NewMenuItem.Caption := TTarget(Items[I]).Name;
     304      NewMenuItem.OnClick := Action;
     305      NewMenuItem.ImageIndex := TTarget(Items[I]).ImageIndex;
     306      if TTarget(Items[I]) = CurrentTarget then NewMenuItem.Checked := True;
     307      MenuItem.Add(NewMenuItem);
     308    end;
     309  end;
    288310end;
    289311
  • trunk/Target/UTargetC.pas

    r41 r48  
    3232  SourceExtension := '.c';
    3333  CompiledExtension := '.exe';
     34  ImageIndex := 23;
    3435  Capabilities := [tcCompile, tcRun];
    3536  {$IFDEF Windows}
  • trunk/Target/UTargetDelphi.pas

    r41 r48  
    2929  Name := 'Delphi';
    3030  SourceExtension := '.pas';
     31  ImageIndex := 22;
    3132  CompiledExtension := '.exe';
    3233  Capabilities := [tcCompile, tcRun];
     
    4950    Inc(I)
    5051  end;
     52end;
     53
     54function CheckClear: Boolean;
     55begin
     56  Result := (FSourceCode[I] = '[') and (Length(FSourceCode) >= I + 2) and
     57    (FSourceCode[I + 1] = '-') and (FSourceCode[I + 2] = ']');
    5158end;
    5259
     
    8996      ',': AddLine('Read(ReadChar); Memory[Pos] := Ord(ReadChar);');
    9097      '[': begin
    91         AddLine('while Memory[Pos] <> 0 do begin');
    92         Inc(Indent);
     98        if CheckClear then begin
     99          AddLine('Memory[Pos] := 0;');
     100          Inc(I, 2);
     101        end else begin
     102          AddLine('while Memory[Pos] <> 0 do begin');
     103          Inc(Indent);
     104        end;
    93105      end;
    94106      ']': begin
  • trunk/Target/UTargetInterpretter.pas

    r47 r48  
    447447  inherited;
    448448  Name := 'Interpretter';
     449  ImageIndex := 25;
    449450  Capabilities := [tcRun, tcPause, tcStop, tcCompile, tcStepOut, tcStepInto,
    450451    tcStepOver, tcRunToCursor];
  • trunk/Target/UTargetJava.pas

    r41 r48  
    3131  SourceExtension := '.java';
    3232  CompiledExtension := '.class';
     33  ImageIndex := 24;
    3334  Capabilities := [tcCompile, tcRun];
    3435  {$IFDEF Windows}
  • trunk/Target/UTargetPHP.pas

    r42 r48  
    3030  Name := 'PHP';
    3131  SourceExtension := '.php';
     32  ImageIndex := 21;
    3233  Capabilities := [tcCompile, tcRun];
    3334  {$IFDEF Windows}
Note: See TracChangeset for help on using the changeset viewer.