Changeset 12 for trunk/UMainForm.pas


Ignore:
Timestamp:
Feb 11, 2012, 4:32:27 PM (12 years ago)
Author:
chronos
Message:
  • Added: Display source code caret position in statusbar.
  • Modified: Optimized jump speed using precreated direct jump table.
Location:
trunk
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk

    • Property svn:ignore
      •  

        old new  
        33LazFuckIDE.lps
        44backup
         5LazFuckIDE
  • trunk/UMainForm.pas

    r11 r12  
    1616    ACompile: TAction;
    1717    AAbout: TAction;
     18    ABreakpointSet: TAction;
     19    ABreakpointUnset: TAction;
     20    AInterpretterStepOut: TAction;
     21    AInterpretterRunToCursor: TAction;
     22    AInterpretterStopOver: TAction;
     23    AInterpretterStepInto: TAction;
    1824    AViewCompiled: TAction;
    1925    AViewInterpretter: TAction;
     
    8389    procedure FormShow(Sender: TObject);
    8490    procedure MemoSourceChange(Sender: TObject);
     91    procedure MemoSourceKeyDown(Sender: TObject; var Key: Word;
     92      Shift: TShiftState);
     93    procedure MemoSourceKeyPress(Sender: TObject; var Key: char);
     94    procedure MemoSourceKeyUp(Sender: TObject; var Key: Word; Shift: TShiftState
     95      );
     96    procedure MemoSourceMouseDown(Sender: TObject; Button: TMouseButton;
     97      Shift: TShiftState; X, Y: Integer);
    8598  private
    8699    procedure BrainFuckInterpreterChangeState(Sender: TObject);
     
    91104    BrainFuckInterpreter: TBrainFuckInterpretter;
    92105    procedure UpdateInterface;
     106    procedure UpdateStatusBar;
    93107  end;
    94108
     
    114128  Modified := True;
    115129  UpdateInterface;
     130end;
     131
     132procedure TMainForm.MemoSourceKeyDown(Sender: TObject; var Key: Word;
     133  Shift: TShiftState);
     134begin
     135end;
     136
     137procedure TMainForm.MemoSourceKeyPress(Sender: TObject; var Key: char);
     138begin
     139end;
     140
     141procedure TMainForm.MemoSourceKeyUp(Sender: TObject; var Key: Word;
     142  Shift: TShiftState);
     143begin
     144  UpdateStatusBar;
     145end;
     146
     147procedure TMainForm.MemoSourceMouseDown(Sender: TObject; Button: TMouseButton;
     148  Shift: TShiftState; X, Y: Integer);
     149begin
     150  UpdateStatusBar;
    116151end;
    117152
     
    136171  AProgramStop.Enabled := (ProjectFileName <> '') and (BrainFuckInterpreter.State <> rsStopped);
    137172  ACompile.Enabled := ProjectFileName <> '';
     173  UpdateStatusBar;
     174end;
     175
     176procedure TMainForm.UpdateStatusBar;
     177begin
     178  StatusBar1.Panels[0].Text := IntToStr(MemoSource.CaretPos.X) + ', ' + IntToStr(MemoSource.CaretPos.Y);
    138179end;
    139180
     
    152193
    153194procedure TMainForm.AProgramRunExecute(Sender: TObject);
     195var
     196  SourceText: string;
    154197begin
    155198  InterpreterForm.Show;
    156199  BrainFuckInterpreter.Input := InterpreterForm.MemoInput.Lines.Text;
    157   BrainFuckInterpreter.Source := MemoSource.Lines.Text;
     200  SourceText := MemoSource.Lines.Text;
     201  SetLength(BrainFuckInterpreter.Source, Length(SourceText));
     202  Move(Pointer(SourceText)^, Pointer(BrainFuckInterpreter.Source)^, Length(SourceText));
    158203  BrainFuckInterpreter.Run;
    159204end;
Note: See TracChangeset for help on using the changeset viewer.