|
@@ -274,9 +274,10 @@ type
|
|
procedure FSaveAllClick(Sender: TObject);
|
|
procedure FSaveAllClick(Sender: TObject);
|
|
private
|
|
private
|
|
{ Private declarations }
|
|
{ Private declarations }
|
|
- FMemos: TList<TCompScintEdit>; { FMemos[0] is always the main memo }
|
|
|
|
- FMainMemo, FActiveMemo, FErrorMemo, FStepMemo: TCompScintEdit;
|
|
|
|
- FMemosStyler: TInnoSetupStyler;
|
|
|
|
|
|
+ FMemos: TList<TCompScintEdit>; { FMemos[0] is the main memo and FMemos[1] the preprocessor memo }
|
|
|
|
+ FMainMemo, FPreprocessorMemo: TCOmpScintEdit; { These don't change }
|
|
|
|
+ FActiveMemo, FErrorMemo, FStepMemo: TCompScintEdit; { These change depending on user input }
|
|
|
|
+ FMemosStyler: TInnoSetupStyler; { Single styler for all memos }
|
|
FCompilerVersion: PCompilerVersionInfo;
|
|
FCompilerVersion: PCompilerVersionInfo;
|
|
FMRUMainFilesMenuItems: array[0..MRUListMaxCount-1] of TMenuItem;
|
|
FMRUMainFilesMenuItems: array[0..MRUListMaxCount-1] of TMenuItem;
|
|
FMRUMainFilesList: TStringList;
|
|
FMRUMainFilesList: TStringList;
|
|
@@ -369,6 +370,7 @@ type
|
|
procedure InitializeFindText(Dlg: TFindDialog);
|
|
procedure InitializeFindText(Dlg: TFindDialog);
|
|
function InitializeMainMemo(const Memo: TCompScintEdit; const PopupMenu: TPopupMenu): TCompScintEdit;
|
|
function InitializeMainMemo(const Memo: TCompScintEdit; const PopupMenu: TPopupMenu): TCompScintEdit;
|
|
function InitializeMemo(const Memo: TCompScintEdit; const PopupMenu: TPopupMenu): TCompScintEdit;
|
|
function InitializeMemo(const Memo: TCompScintEdit; const PopupMenu: TPopupMenu): TCompScintEdit;
|
|
|
|
+ function InitializePreprocessedMemo(const Memo: TCompScintEdit; const PopupMenu: TPopupMenu): TCompScintEdit;
|
|
procedure InitiateAutoComplete(const Key: AnsiChar);
|
|
procedure InitiateAutoComplete(const Key: AnsiChar);
|
|
procedure InvalidateStatusPanel(const Index: Integer);
|
|
procedure InvalidateStatusPanel(const Index: Integer);
|
|
procedure LoadKnownIncludedFilesAndUpdateMemos(const AFilename: String);
|
|
procedure LoadKnownIncludedFilesAndUpdateMemos(const AFilename: String);
|
|
@@ -472,8 +474,8 @@ uses
|
|
|
|
|
|
const
|
|
const
|
|
{ Memos }
|
|
{ Memos }
|
|
- MaxMemos = 11; { Includes the main memo }
|
|
|
|
- FirstIncludedFilesMemoIndex = 1;
|
|
|
|
|
|
+ MaxMemos = 12; { Includes the main and preprocessor memo's }
|
|
|
|
+ FirstIncludedFilesMemoIndex = 2;
|
|
|
|
|
|
{ Status bar panel indexes }
|
|
{ Status bar panel indexes }
|
|
spCaretPos = 0;
|
|
spCaretPos = 0;
|
|
@@ -547,6 +549,14 @@ begin
|
|
Result := Memo;
|
|
Result := Memo;
|
|
end;
|
|
end;
|
|
|
|
|
|
|
|
+function TCompileForm.InitializePreprocessedMemo(const Memo: TCompScintEdit; const PopupMenu: TPopupMenu): TCompScintEdit;
|
|
|
|
+begin
|
|
|
|
+ InitializeMemo(Memo, PopupMenu);
|
|
|
|
+ Memo.ReadOnly := True;
|
|
|
|
+ Memo.Used := True;
|
|
|
|
+ Result := Memo;
|
|
|
|
+end;
|
|
|
|
+
|
|
constructor TCompileForm.Create(AOwner: TComponent);
|
|
constructor TCompileForm.Create(AOwner: TComponent);
|
|
|
|
|
|
procedure ReadConfig;
|
|
procedure ReadConfig;
|
|
@@ -683,7 +693,9 @@ begin
|
|
FMemos := TList<TCompScintEdit>.Create;
|
|
FMemos := TList<TCompScintEdit>.Create;
|
|
FMainMemo := InitializeMainMemo(TCompScintEdit.Create(Self), PopupMenu);
|
|
FMainMemo := InitializeMainMemo(TCompScintEdit.Create(Self), PopupMenu);
|
|
FMemos.Add(FMainMemo);
|
|
FMemos.Add(FMainMemo);
|
|
- for I := 1 to MaxMemos-1 do
|
|
|
|
|
|
+ FPreprocessorMemo := InitializePreprocessedMemo(TCompScintEdit.Create(Self), PopupMenu);
|
|
|
|
+ FMemos.Add(FPreprocessorMemo);
|
|
|
|
+ for I := FMemos.Count to MaxMemos-1 do
|
|
FMemos.Add(InitializeMemo(TCompScintEdit.Create(Self), PopupMenu));
|
|
FMemos.Add(InitializeMemo(TCompScintEdit.Create(Self), PopupMenu));
|
|
FActiveMemo := FMainMemo;
|
|
FActiveMemo := FMainMemo;
|
|
FActiveMemo.Visible := True;
|
|
FActiveMemo.Visible := True;
|
|
@@ -1486,7 +1498,8 @@ begin
|
|
FActiveMemo.SetCursorID(999); { hack to keep it from overriding Cursor }
|
|
FActiveMemo.SetCursorID(999); { hack to keep it from overriding Cursor }
|
|
CompilerOutputList.Cursor := crAppStart;
|
|
CompilerOutputList.Cursor := crAppStart;
|
|
for Memo in FMemos do
|
|
for Memo in FMemos do
|
|
- Memo.ReadOnly := True;
|
|
|
|
|
|
+ if Memo <> FPreprocessorMemo then
|
|
|
|
+ Memo.ReadOnly := True;
|
|
UpdateEditModePanel;
|
|
UpdateEditModePanel;
|
|
HideError;
|
|
HideError;
|
|
CompilerOutputList.Clear;
|
|
CompilerOutputList.Clear;
|
|
@@ -1565,6 +1578,13 @@ begin
|
|
StatusMessage(smkStartEnd, Format(SCompilerStatusFinished, [TimeToStr(Time),
|
|
StatusMessage(smkStartEnd, Format(SCompilerStatusFinished, [TimeToStr(Time),
|
|
Format('%.2u%s%.2u%s%.3u', [ElapsedSeconds div 60, {$IFDEF IS_DXE}FormatSettings.{$ENDIF}TimeSeparator,
|
|
Format('%.2u%s%.2u%s%.3u', [ElapsedSeconds div 60, {$IFDEF IS_DXE}FormatSettings.{$ENDIF}TimeSeparator,
|
|
ElapsedSeconds mod 60, {$IFDEF IS_DXE}FormatSettings.{$ENDIF}DecimalSeparator, ElapsedTime mod 1000])]));
|
|
ElapsedSeconds mod 60, {$IFDEF IS_DXE}FormatSettings.{$ENDIF}DecimalSeparator, ElapsedTime mod 1000])]));
|
|
|
|
+ FPreprocessorMemo.ReadOnly := False;
|
|
|
|
+ try
|
|
|
|
+ FPreprocessorMemo.Lines.Text := AppData.PreprocessedScript;
|
|
|
|
+ FPreprocessorMemo.ClearUndo;
|
|
|
|
+ finally
|
|
|
|
+ FPreprocessorMemo.ReadOnly := True;
|
|
|
|
+ end;
|
|
finally
|
|
finally
|
|
AppData.Lines.Free;
|
|
AppData.Lines.Free;
|
|
FCompiling := False;
|
|
FCompiling := False;
|
|
@@ -1573,7 +1593,8 @@ begin
|
|
OldActiveMemo.SetCursorID(SC_CURSORNORMAL);
|
|
OldActiveMemo.SetCursorID(SC_CURSORNORMAL);
|
|
CompilerOutputList.Cursor := crDefault;
|
|
CompilerOutputList.Cursor := crDefault;
|
|
for Memo in FMemos do
|
|
for Memo in FMemos do
|
|
- Memo.ReadOnly := False;
|
|
|
|
|
|
+ if Memo <> FPreprocessorMemo then
|
|
|
|
+ Memo.ReadOnly := False;
|
|
UpdateEditModePanel;
|
|
UpdateEditModePanel;
|
|
UpdateRunMenu;
|
|
UpdateRunMenu;
|
|
UpdateCaption;
|
|
UpdateCaption;
|
|
@@ -1644,7 +1665,9 @@ procedure TCompileForm.FMenuClick(Sender: TObject);
|
|
var
|
|
var
|
|
I: Integer;
|
|
I: Integer;
|
|
begin
|
|
begin
|
|
|
|
+ FSave.Enabled := FActiveMemo <> FPreprocessorMemo;
|
|
FSaveMainFileAs.Enabled := FActiveMemo = FMainMemo;
|
|
FSaveMainFileAs.Enabled := FActiveMemo = FMainMemo;
|
|
|
|
+ FSaveEncoding.Enabled := FSave.Enabled;
|
|
FSaveEncodingAuto.Checked := not FActiveMemo.SaveInUTF8Encoding;
|
|
FSaveEncodingAuto.Checked := not FActiveMemo.SaveInUTF8Encoding;
|
|
FSaveEncodingUTF8.Checked := FActiveMemo.SaveInUTF8Encoding;
|
|
FSaveEncodingUTF8.Checked := FActiveMemo.SaveInUTF8Encoding;
|
|
FSaveAll.Visible := FOptions.OpenIncludedFiles;
|
|
FSaveAll.Visible := FOptions.OpenIncludedFiles;
|
|
@@ -1733,21 +1756,22 @@ end;
|
|
|
|
|
|
procedure TCompileForm.EMenuClick(Sender: TObject);
|
|
procedure TCompileForm.EMenuClick(Sender: TObject);
|
|
var
|
|
var
|
|
- MemoHasFocus: Boolean;
|
|
|
|
|
|
+ MemoHasFocus, MemoIsReadOnly: Boolean;
|
|
begin
|
|
begin
|
|
MemoHasFocus := FActiveMemo.Focused;
|
|
MemoHasFocus := FActiveMemo.Focused;
|
|
|
|
+ MemoIsReadOnly := FActiveMemo.ReadOnly;
|
|
EUndo.Enabled := MemoHasFocus and FActiveMemo.CanUndo;
|
|
EUndo.Enabled := MemoHasFocus and FActiveMemo.CanUndo;
|
|
ERedo.Enabled := MemoHasFocus and FActiveMemo.CanRedo;
|
|
ERedo.Enabled := MemoHasFocus and FActiveMemo.CanRedo;
|
|
- ECut.Enabled := MemoHasFocus and FActiveMemo.SelAvail;
|
|
|
|
|
|
+ ECut.Enabled := MemoHasFocus and not MemoIsReadOnly and FActiveMemo.SelAvail;
|
|
ECopy.Enabled := MemoHasFocus and FActiveMemo.SelAvail;
|
|
ECopy.Enabled := MemoHasFocus and FActiveMemo.SelAvail;
|
|
- EPaste.Enabled := MemoHasFocus and Clipboard.HasFormat(CF_TEXT);
|
|
|
|
|
|
+ EPaste.Enabled := MemoHasFocus and not MemoIsReadOnly and Clipboard.HasFormat(CF_TEXT);
|
|
EDelete.Enabled := MemoHasFocus and FActiveMemo.SelAvail;
|
|
EDelete.Enabled := MemoHasFocus and FActiveMemo.SelAvail;
|
|
ESelectAll.Enabled := MemoHasFocus;
|
|
ESelectAll.Enabled := MemoHasFocus;
|
|
EFind.Enabled := MemoHasFocus;
|
|
EFind.Enabled := MemoHasFocus;
|
|
EFindNext.Enabled := MemoHasFocus;
|
|
EFindNext.Enabled := MemoHasFocus;
|
|
- EReplace.Enabled := MemoHasFocus;
|
|
|
|
|
|
+ EReplace.Enabled := MemoHasFocus and not MemoIsReadOnly;
|
|
EGoto.Enabled := MemoHasFocus;
|
|
EGoto.Enabled := MemoHasFocus;
|
|
- ECompleteWord.Enabled := MemoHasFocus;
|
|
|
|
|
|
+ ECompleteWord.Enabled := MemoHasFocus and not MemoIsReadOnly;
|
|
end;
|
|
end;
|
|
|
|
|
|
procedure TCompileForm.EUndoClick(Sender: TObject);
|
|
procedure TCompileForm.EUndoClick(Sender: TObject);
|
|
@@ -2567,8 +2591,10 @@ begin
|
|
try
|
|
try
|
|
NewTabs := TStringList.Create;
|
|
NewTabs := TStringList.Create;
|
|
NewTabs.Add(MemosTabSet.Tabs[0]); { 'Main Script' }
|
|
NewTabs.Add(MemosTabSet.Tabs[0]); { 'Main Script' }
|
|
|
|
+ NewTabs.Add(MemosTabSet.Tabs[1]); { 'Preprocessor Output' }
|
|
NewHints := TStringList.Create;
|
|
NewHints := TStringList.Create;
|
|
NewHints.Add(GetFileTitle(FMainMemo.Filename));
|
|
NewHints.Add(GetFileTitle(FMainMemo.Filename));
|
|
|
|
+ NewHints.Add('');
|
|
NextMemoIndex := FirstIncludedFilesMemoIndex;
|
|
NextMemoIndex := FirstIncludedFilesMemoIndex;
|
|
FLoadingIncludedFiles := True;
|
|
FLoadingIncludedFiles := True;
|
|
try
|
|
try
|
|
@@ -3528,9 +3554,10 @@ begin
|
|
RunButton.Enabled := RRun.Enabled;
|
|
RunButton.Enabled := RRun.Enabled;
|
|
RPause.Enabled := FDebugging and not FPaused;
|
|
RPause.Enabled := FDebugging and not FPaused;
|
|
PauseButton.Enabled := RPause.Enabled;
|
|
PauseButton.Enabled := RPause.Enabled;
|
|
- RRunToCursor.Enabled := RRun.Enabled;
|
|
|
|
|
|
+ RRunToCursor.Enabled := RRun.Enabled and (FActiveMemo <> FPreprocessorMemo);
|
|
RStepInto.Enabled := RRun.Enabled;
|
|
RStepInto.Enabled := RRun.Enabled;
|
|
RStepOver.Enabled := RRun.Enabled;
|
|
RStepOver.Enabled := RRun.Enabled;
|
|
|
|
+ RToggleBreakPoint.Enabled := FActiveMemo <> FPreprocessorMemo;
|
|
RTerminate.Enabled := FDebugging and (FDebugClientWnd <> 0);
|
|
RTerminate.Enabled := FDebugging and (FDebugClientWnd <> 0);
|
|
TerminateButton.Enabled := RTerminate.Enabled;
|
|
TerminateButton.Enabled := RTerminate.Enabled;
|
|
REvaluate.Enabled := FDebugging and (FDebugClientWnd <> 0);
|
|
REvaluate.Enabled := FDebugging and (FDebugClientWnd <> 0);
|
|
@@ -4240,10 +4267,15 @@ end;
|
|
procedure TCompileForm.MemoMarginClick(Sender: TObject; MarginNumber: Integer;
|
|
procedure TCompileForm.MemoMarginClick(Sender: TObject; MarginNumber: Integer;
|
|
Line: Integer);
|
|
Line: Integer);
|
|
begin
|
|
begin
|
|
- if MarginNumber = 1 then
|
|
|
|
|
|
+ if (MarginNumber = 1) and RToggleBreakPoint.Enabled then
|
|
ToggleBreakPoint(Line);
|
|
ToggleBreakPoint(Line);
|
|
end;
|
|
end;
|
|
|
|
|
|
|
|
+procedure TCompileForm.RToggleBreakPointClick(Sender: TObject);
|
|
|
|
+begin
|
|
|
|
+ ToggleBreakPoint(FActiveMemo.CaretLine);
|
|
|
|
+end;
|
|
|
|
+
|
|
procedure TCompileForm.MemoLinesInserted(Memo: TCompScintEdit; FirstLine, Count: integer);
|
|
procedure TCompileForm.MemoLinesInserted(Memo: TCompScintEdit; FirstLine, Count: integer);
|
|
var
|
|
var
|
|
I, Line: Integer;
|
|
I, Line: Integer;
|
|
@@ -4406,11 +4438,6 @@ begin
|
|
Bevel1.Visible := (FTheme.Colors[tcMarginBack] = ToolBarPanel.Color) and not MemosTabSet.Visible;
|
|
Bevel1.Visible := (FTheme.Colors[tcMarginBack] = ToolBarPanel.Color) and not MemosTabSet.Visible;
|
|
end;
|
|
end;
|
|
|
|
|
|
-procedure TCompileForm.RToggleBreakPointClick(Sender: TObject);
|
|
|
|
-begin
|
|
|
|
- ToggleBreakPoint(FActiveMemo.CaretLine);
|
|
|
|
-end;
|
|
|
|
-
|
|
|
|
function TCompileForm.ToCurrentPPI(const XY: Integer): Integer;
|
|
function TCompileForm.ToCurrentPPI(const XY: Integer): Integer;
|
|
begin
|
|
begin
|
|
Result := MulDiv(XY, CurrentPPI, 96);
|
|
Result := MulDiv(XY, CurrentPPI, 96);
|