mirror of
https://gitlab.com/freepascal.org/lazarus/lazarus.git
synced 2025-05-20 03:43:12 +02:00
implemented sourcemarks
git-svn-id: trunk@3113 -
This commit is contained in:
parent
f73d9c2830
commit
1d4c51ec32
@ -54,26 +54,11 @@ uses
|
|||||||
WordCompletion, FindInFilesDlg, IDEProcs, IDEOptionDefs, MsgView,
|
WordCompletion, FindInFilesDlg, IDEProcs, IDEOptionDefs, MsgView,
|
||||||
InputHistory, LazarusIDEStrConsts, BaseDebugManager, Debugger,
|
InputHistory, LazarusIDEStrConsts, BaseDebugManager, Debugger,
|
||||||
TypInfo, LResources, LazConf, EnvironmentOpts, Compiler,
|
TypInfo, LResources, LazConf, EnvironmentOpts, Compiler,
|
||||||
SourceEditProcs, SortSelectionDlg, ClipBoardHistory, DiffDialog;
|
SortSelectionDlg, ClipBoardHistory, DiffDialog,
|
||||||
|
SourceEditProcs, SourceMarks;
|
||||||
|
|
||||||
type
|
type
|
||||||
TSourceNoteBook = class;
|
TSourceNoteBook = class;
|
||||||
// --------------------------------------------------------------------------
|
|
||||||
|
|
||||||
TSrcEditMarkerType = (
|
|
||||||
semActiveBreakPoint,
|
|
||||||
semInactiveBreakPoint,
|
|
||||||
semInvalidBreakPoint,
|
|
||||||
semUnknownBreakpoint,
|
|
||||||
semMultiActiveBreakPoint,
|
|
||||||
semMultiInactiveBreakPoint,
|
|
||||||
semMultiInvalidBreakPoint,
|
|
||||||
semMultiUnknownBreakPoint,
|
|
||||||
semMultiMixedBreakPoint
|
|
||||||
);
|
|
||||||
TSrcEditMarkerTypes = set of TSrcEditMarkerType;
|
|
||||||
|
|
||||||
// --------------------------------------------------------------------------
|
|
||||||
|
|
||||||
TNotifyFileEvent = procedure(Sender: TObject; Filename : AnsiString) of object;
|
TNotifyFileEvent = procedure(Sender: TObject; Filename : AnsiString) of object;
|
||||||
|
|
||||||
@ -233,12 +218,12 @@ type
|
|||||||
procedure ActivateHint(ClientPos: TPoint; const TheHint: string);
|
procedure ActivateHint(ClientPos: TPoint; const TheHint: string);
|
||||||
|
|
||||||
// gutter
|
// gutter
|
||||||
procedure CreateBreakPoint(const ALine: Integer);
|
//procedure CreateBreakPoint(const ALine: Integer);
|
||||||
procedure SetBreakPointMark(const ALine: Integer; const AType: TSrcEditMarkerType);
|
//procedure SetBreakPointMark(const ALine: Integer; const AType: TSrcEditMarkerType);
|
||||||
function GetBreakPointMark(const ALine: Integer): TSynEditMark;
|
//function GetBreakPointMark(const ALine: Integer): TSynEditMark;
|
||||||
function IsBreakPointMark(const AMark: TSynEditMark): Boolean;
|
//function IsBreakPointMark(const AMark: TSynEditMark): Boolean;
|
||||||
procedure RemoveBreakPoint(const ALine: Integer); overload;
|
//procedure RemoveBreakPoint(const ALine: Integer); overload;
|
||||||
procedure RemoveBreakPoint(const ABreakPointMark: TSynEditMark); overload;
|
//procedure RemoveBreakPoint(const ABreakPointMark: TSynEditMark); overload;
|
||||||
|
|
||||||
// selections
|
// selections
|
||||||
function SelectionAvailable: boolean;
|
function SelectionAvailable: boolean;
|
||||||
@ -318,6 +303,8 @@ type
|
|||||||
|
|
||||||
//============================================================================
|
//============================================================================
|
||||||
|
|
||||||
|
{ TSourceNotebook }
|
||||||
|
|
||||||
TJumpHistoryAction = (jhaBack, jhaForward);
|
TJumpHistoryAction = (jhaBack, jhaForward);
|
||||||
|
|
||||||
TOnJumpToHistoryPoint = procedure(var NewCaretXY: TPoint;
|
TOnJumpToHistoryPoint = procedure(var NewCaretXY: TPoint;
|
||||||
@ -356,6 +343,7 @@ type
|
|||||||
procedure MoveEditorLeftClicked(Sender: TObject);
|
procedure MoveEditorLeftClicked(Sender: TObject);
|
||||||
procedure MoveEditorRightClicked(Sender: TObject);
|
procedure MoveEditorRightClicked(Sender: TObject);
|
||||||
procedure EditorPropertiesClicked(Sender: TObject);
|
procedure EditorPropertiesClicked(Sender: TObject);
|
||||||
|
Procedure NotebookPageChanged(Sender : TObject);
|
||||||
private
|
private
|
||||||
FCodeTemplateModul: TSynEditAutoComplete;
|
FCodeTemplateModul: TSynEditAutoComplete;
|
||||||
FFormEditor : TFormEditor;
|
FFormEditor : TFormEditor;
|
||||||
@ -411,8 +399,7 @@ type
|
|||||||
procedure UpdateActiveEditColors;
|
procedure UpdateActiveEditColors;
|
||||||
procedure SetIncrementalSearchStr(const AValue: string);
|
procedure SetIncrementalSearchStr(const AValue: string);
|
||||||
protected
|
protected
|
||||||
ccSelection : String;
|
ccSelection: String;
|
||||||
MarksImgList : TImageList;
|
|
||||||
States: TSourceNotebookStates;
|
States: TSourceNotebookStates;
|
||||||
|
|
||||||
Function CreateNotebook : Boolean;
|
Function CreateNotebook : Boolean;
|
||||||
@ -455,8 +442,13 @@ type
|
|||||||
Procedure ParentCommandProcessed(Sender: TObject;
|
Procedure ParentCommandProcessed(Sender: TObject;
|
||||||
var Command: TSynEditorCommand; var AChar: char; Data: pointer;
|
var Command: TSynEditorCommand; var AChar: char; Data: pointer;
|
||||||
var Handled: boolean);
|
var Handled: boolean);
|
||||||
|
|
||||||
|
// marks
|
||||||
function FindBookmark(BookmarkID: integer): TSourceEditor;
|
function FindBookmark(BookmarkID: integer): TSourceEditor;
|
||||||
function GetEditors(Index:integer):TSourceEditor;
|
function OnSourceMarksGetSourceEditor(ASynEdit: TCustomSynEdit): TObject;
|
||||||
|
function OnSourceMarksGetFilename(ASourceEditor: TObject): string;
|
||||||
|
|
||||||
|
function GetEditors(Index:integer): TSourceEditor;
|
||||||
|
|
||||||
procedure KeyDown(var Key: Word; Shift: TShiftState); override;
|
procedure KeyDown(var Key: Word; Shift: TShiftState); override;
|
||||||
|
|
||||||
@ -466,24 +458,26 @@ type
|
|||||||
FindReplaceDlgHistoryIndex: array[TFindDlgComponent] of integer;
|
FindReplaceDlgHistoryIndex: array[TFindDlgComponent] of integer;
|
||||||
FindReplaceDlgUserText: array[TFindDlgComponent] of string;
|
FindReplaceDlgUserText: array[TFindDlgComponent] of string;
|
||||||
|
|
||||||
Procedure NotebookPageChanged(Sender : TObject);
|
constructor Create(AOwner: TComponent); override;
|
||||||
|
destructor Destroy; override;
|
||||||
|
|
||||||
property Editors[Index:integer]:TSourceEditor read GetEditors;
|
property Editors[Index:integer]:TSourceEditor read GetEditors;
|
||||||
function EditorCount:integer;
|
function EditorCount:integer;
|
||||||
|
|
||||||
function FindSourceEditorWithPageIndex(PageIndex:integer):TSourceEditor;
|
function FindSourceEditorWithPageIndex(PageIndex:integer):TSourceEditor;
|
||||||
function FindPageWithEditor(ASourceEditor: TSourceEditor):integer;
|
function FindPageWithEditor(ASourceEditor: TSourceEditor):integer;
|
||||||
function FindSourceEditorWithEditorComponent(
|
function FindSourceEditorWithEditorComponent(
|
||||||
EditorComp: TComponent): TSourceEditor;
|
EditorComp: TComponent): TSourceEditor;
|
||||||
|
function FindSourceEditorWithFilename(const Filename: string): TSourceEditor;
|
||||||
Function GetActiveSE : TSourceEditor;
|
Function GetActiveSE : TSourceEditor;
|
||||||
procedure SetActiveSE(SrcEdit: TSourceEditor);
|
procedure SetActiveSE(SrcEdit: TSourceEditor);
|
||||||
|
|
||||||
procedure LockAllEditorsInSourceChangeCache;
|
procedure LockAllEditorsInSourceChangeCache;
|
||||||
procedure UnlockAllEditorsInSourceChangeCache;
|
procedure UnlockAllEditorsInSourceChangeCache;
|
||||||
function GetDiffFiles: TDiffFiles;
|
function GetDiffFiles: TDiffFiles;
|
||||||
procedure GetSourceText(PageIndex: integer; OnlySelection: boolean;
|
procedure GetSourceText(PageIndex: integer; OnlySelection: boolean;
|
||||||
var Source: string);
|
var Source: string);
|
||||||
|
|
||||||
constructor Create(AOwner: TComponent); override;
|
|
||||||
destructor Destroy; override;
|
|
||||||
Function ActiveFileName : AnsiString;
|
Function ActiveFileName : AnsiString;
|
||||||
Function FindUniquePageName(FileName:string; IgnorePageIndex:integer):string;
|
Function FindUniquePageName(FileName:string; IgnorePageIndex:integer):string;
|
||||||
function SomethingModified: boolean;
|
function SomethingModified: boolean;
|
||||||
@ -626,7 +620,7 @@ type
|
|||||||
implementation
|
implementation
|
||||||
|
|
||||||
|
|
||||||
const
|
{const OldDebug
|
||||||
SrcEditMarkerImgIndex: array[TSrcEditMarkerType] of integer = (
|
SrcEditMarkerImgIndex: array[TSrcEditMarkerType] of integer = (
|
||||||
10, // active breakpoint
|
10, // active breakpoint
|
||||||
11, // inactive breakpoint
|
11, // inactive breakpoint
|
||||||
@ -637,7 +631,7 @@ const
|
|||||||
14, // multi invalid breakpoint
|
14, // multi invalid breakpoint
|
||||||
14, // multi unknown breakpoint
|
14, // multi unknown breakpoint
|
||||||
14 // multi mixed breakpoint
|
14 // multi mixed breakpoint
|
||||||
);
|
);}
|
||||||
|
|
||||||
var
|
var
|
||||||
Highlighters: array[TLazSyntaxHighlighter] of TSynCustomHighlighter;
|
Highlighters: array[TLazSyntaxHighlighter] of TSynCustomHighlighter;
|
||||||
@ -692,6 +686,8 @@ begin
|
|||||||
if (FAOwner<>nil) and (FEditor<>nil) then begin
|
if (FAOwner<>nil) and (FEditor<>nil) then begin
|
||||||
FEditor.Visible:=false;
|
FEditor.Visible:=false;
|
||||||
FEditor.Parent:=nil;
|
FEditor.Parent:=nil;
|
||||||
|
if SourceEditorMarks<>nil then
|
||||||
|
SourceEditorMarks.DeleteAllForEditor(FEditor);
|
||||||
TSourceNoteBook(FAOwner).FSourceEditorList.Remove(Self);
|
TSourceNoteBook(FAOwner).FSourceEditorList.Remove(Self);
|
||||||
TSourceNoteBook(FAOwner).FUnUsedEditorComponents.Add(FEditor);
|
TSourceNoteBook(FAOwner).FUnUsedEditorComponents.Add(FEditor);
|
||||||
end;
|
end;
|
||||||
@ -1158,6 +1154,8 @@ Begin
|
|||||||
UpdatePageName;
|
UpdatePageName;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
{ OldDebug
|
||||||
|
|
||||||
function TSourceEditor.IsBreakPointMark(
|
function TSourceEditor.IsBreakPointMark(
|
||||||
const AMark: TSynEditMark): Boolean;
|
const AMark: TSynEditMark): Boolean;
|
||||||
begin
|
begin
|
||||||
@ -1190,9 +1188,9 @@ begin
|
|||||||
Result := nil;
|
Result := nil;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
procedure TSourceEditor.CreateBreakPoint (const ALine: Integer);
|
procedure TSourceEditor.CreateBreakPoint(const ALine: Integer);
|
||||||
begin
|
begin
|
||||||
SetBreakPointMark(Aline, semUnknownBreakpoint);
|
//SetBreakPointMark(ALine, semUnknownBreakpoint);
|
||||||
DebugBoss.DoCreateBreakPoint(FileName, ALine);
|
DebugBoss.DoCreateBreakPoint(FileName, ALine);
|
||||||
end;
|
end;
|
||||||
|
|
||||||
@ -1227,7 +1225,7 @@ begin
|
|||||||
ABreakPointMark.Free;
|
ABreakPointMark.Free;
|
||||||
DebugBoss.DoDeleteBreakPoint(FileName, OldLine);
|
DebugBoss.DoDeleteBreakPoint(FileName, OldLine);
|
||||||
FModified:=true;
|
FModified:=true;
|
||||||
end;
|
end;}
|
||||||
|
|
||||||
function TSourceEditor.SelectionAvailable: boolean;
|
function TSourceEditor.SelectionAvailable: boolean;
|
||||||
begin
|
begin
|
||||||
@ -1431,23 +1429,27 @@ end;
|
|||||||
procedure TSourceEditor.OnGutterClick(Sender: TObject; X, Y, Line: integer;
|
procedure TSourceEditor.OnGutterClick(Sender: TObject; X, Y, Line: integer;
|
||||||
mark: TSynEditMark);
|
mark: TSynEditMark);
|
||||||
var
|
var
|
||||||
BreakPtMark: TSynEditMark;
|
BreakPtMark: TSourceMark;
|
||||||
begin
|
begin
|
||||||
// create or delete breakpoint
|
// create or delete breakpoint
|
||||||
// find breakpoint mark at line
|
// find breakpoint mark at line
|
||||||
BreakPtMark := GetBreakPointMark(Line);
|
BreakPtMark := SourceEditorMarks.FindBreakPointMark(FEditor,Line);
|
||||||
if BreakPtMark = nil
|
writeln('TSourceEditor.OnGutterClick A ',BreakPtMark<>nil);
|
||||||
then CreateBreakPoint(Line)
|
if BreakPtMark = nil then
|
||||||
else RemoveBreakPoint(BreakPtMark);
|
DebugBoss.DoCreateBreakPoint(Filename,Line)
|
||||||
|
else
|
||||||
|
DebugBoss.DoDeleteBreakPointAtMark(BreakPtMark);
|
||||||
end;
|
end;
|
||||||
|
|
||||||
procedure TSourceEditor.OnEditorSpecialLineColor(Sender: TObject; Line: integer;
|
procedure TSourceEditor.OnEditorSpecialLineColor(Sender: TObject; Line: integer;
|
||||||
var Special: boolean; var FG, BG: TColor);
|
var Special: boolean; var FG, BG: TColor);
|
||||||
var
|
var
|
||||||
i:integer;
|
i:integer;
|
||||||
AllMarks: TSynEditMarks;
|
|
||||||
aha: TAdditionalHilightAttribute;
|
aha: TAdditionalHilightAttribute;
|
||||||
ImgIndex: Integer;
|
CurMarks: PSourceMark;
|
||||||
|
CurMarkCount: integer;
|
||||||
|
CurFG: TColor;
|
||||||
|
CurBG: TColor;
|
||||||
begin
|
begin
|
||||||
aha := ahaNone;
|
aha := ahaNone;
|
||||||
|
|
||||||
@ -1460,35 +1462,25 @@ begin
|
|||||||
aha := ahaExecutionPoint;
|
aha := ahaExecutionPoint;
|
||||||
end
|
end
|
||||||
else begin
|
else begin
|
||||||
fEditor.Marks.GetMarksForLine(Line, AllMarks);
|
SourceEditorMarks.GetMarksForLine(FEditor,Line,CurMarks,CurMarkCount);
|
||||||
for i := 1 to maxMarks do
|
if CurMarkCount>0 then begin
|
||||||
begin
|
for i := 0 to CurMarkCount-1 do begin
|
||||||
if (AllMarks[i] <> nil)
|
// check highlight attribute
|
||||||
then begin
|
aha := CurMarks[i].LineColorAttrib;
|
||||||
ImgIndex:=AllMarks[i].ImageIndex;
|
if aha<>ahaNone then break;
|
||||||
if (ImgIndex = SrcEditMarkerImgIndex[semActiveBreakPoint])
|
|
||||||
or (ImgIndex = SrcEditMarkerImgIndex[semMultiActiveBreakPoint])
|
// check custom colors
|
||||||
then
|
CurFG:=CurMarks[i].LineColorForeGround;
|
||||||
aha := ahaEnabledBreakpoint
|
CurBG:=CurMarks[i].LineColorBackGround;
|
||||||
else if (ImgIndex = SrcEditMarkerImgIndex[semInactiveBreakPoint])
|
if (CurFG<>clNone) or (CurBG<>clNone) then begin
|
||||||
or (ImgIndex = SrcEditMarkerImgIndex[semMultiInactiveBreakPoint])
|
FG:=CurFG;
|
||||||
then
|
BG:=CurBG;
|
||||||
aha := ahaDisabledBreakpoint
|
Special:=true;
|
||||||
else if (ImgIndex = SrcEditMarkerImgIndex[semInvalidBreakPoint])
|
break;
|
||||||
or (ImgIndex = SrcEditMarkerImgIndex[semMultiInvalidBreakPoint])
|
end;
|
||||||
then
|
|
||||||
aha := ahaInvalidBreakpoint
|
|
||||||
else if (ImgIndex = SrcEditMarkerImgIndex[semUnknownBreakPoint])
|
|
||||||
or (ImgIndex = SrcEditMarkerImgIndex[semMultiUnknownBreakPoint])
|
|
||||||
then
|
|
||||||
aha := ahaUnknownBreakpoint
|
|
||||||
else if (ImgIndex = SrcEditMarkerImgIndex[semMultiMixedBreakPoint])
|
|
||||||
then
|
|
||||||
aha := ahaEnabledBreakpoint
|
|
||||||
else
|
|
||||||
Continue;
|
|
||||||
Break;
|
|
||||||
end;
|
end;
|
||||||
|
// clean up
|
||||||
|
FreeMem(CurMarks);
|
||||||
end;
|
end;
|
||||||
end;
|
end;
|
||||||
if aha <> ahaNone
|
if aha <> ahaNone
|
||||||
@ -1576,6 +1568,7 @@ Begin
|
|||||||
Parent := AParent;
|
Parent := AParent;
|
||||||
Align := alClient;
|
Align := alClient;
|
||||||
BookMarkOptions.EnableKeys := false;
|
BookMarkOptions.EnableKeys := false;
|
||||||
|
BookMarkOptions.LeftMargin:=1;
|
||||||
OnStatusChange := @EditorStatusChanged;
|
OnStatusChange := @EditorStatusChanged;
|
||||||
OnProcessCommand := @ProcessCommand;
|
OnProcessCommand := @ProcessCommand;
|
||||||
OnProcessUserCommand := @ProcessUserCommand;
|
OnProcessUserCommand := @ProcessUserCommand;
|
||||||
@ -1839,6 +1832,7 @@ Begin
|
|||||||
|
|
||||||
Visible := False;
|
Visible := False;
|
||||||
aCompletion.RemoveEditor(FEditor);
|
aCompletion.RemoveEditor(FEditor);
|
||||||
|
SourceEditorMarks.DeleteAllForEditor(FEditor);
|
||||||
FEditor.Parent:=nil;
|
FEditor.Parent:=nil;
|
||||||
CodeBuffer := nil;
|
CodeBuffer := nil;
|
||||||
If Assigned(FOnAfterClose) then FOnAfterClose(Self);
|
If Assigned(FOnAfterClose) then FOnAfterClose(Self);
|
||||||
@ -2037,25 +2031,21 @@ end;
|
|||||||
{ TSourceNotebook }
|
{ TSourceNotebook }
|
||||||
|
|
||||||
constructor TSourceNotebook.Create(AOwner: TComponent);
|
constructor TSourceNotebook.Create(AOwner: TComponent);
|
||||||
var
|
|
||||||
Pixmap1 : TPixmap;
|
|
||||||
I : Integer;
|
|
||||||
ALayout: TIDEWindowLayout;
|
|
||||||
begin
|
begin
|
||||||
inherited Create(AOwner);
|
inherited Create(AOwner);
|
||||||
Visible:=false;
|
Visible:=false;
|
||||||
Name:=NonModalIDEWindowNames[nmiwSourceNoteBookName];
|
Name:=NonModalIDEWindowNames[nmiwSourceNoteBookName];
|
||||||
Caption := locwndSrcEditor;
|
Caption := locWndSrcEditor;
|
||||||
FProcessingCommand := false;
|
FProcessingCommand := false;
|
||||||
|
|
||||||
FMainIDE := AOwner;
|
FMainIDE := AOwner;
|
||||||
|
|
||||||
ALayout:=EnvironmentOptions.IDEWindowLayoutList.ItemByFormID(Name);
|
EnvironmentOptions.IDEWindowLayoutList.Apply(Self,Name);
|
||||||
ALayout.Form:=TForm(Self);
|
|
||||||
ALayout.Apply;
|
|
||||||
|
|
||||||
FSourceEditorList := TList.Create;
|
FSourceEditorList := TList.Create;
|
||||||
FUnUsedEditorComponents := TList.Create;
|
FUnUsedEditorComponents := TList.Create;
|
||||||
|
|
||||||
|
// code templates
|
||||||
FCodeTemplateModul:=TSynEditAutoComplete.Create(Self);
|
FCodeTemplateModul:=TSynEditAutoComplete.Create(Self);
|
||||||
with FCodeTemplateModul do begin
|
with FCodeTemplateModul do begin
|
||||||
if FileExists(EditorOpts.CodeTemplateFilename) then
|
if FileExists(EditorOpts.CodeTemplateFilename) then
|
||||||
@ -2067,6 +2057,8 @@ begin
|
|||||||
OnTokenNotFound:=@OnCodeTemplateTokenNotFound;
|
OnTokenNotFound:=@OnCodeTemplateTokenNotFound;
|
||||||
EndOfTokenChr:=' ()[]{},.;:"+-*^@$\<>=''';
|
EndOfTokenChr:=' ()[]{},.;:"+-*^@$\<>=''';
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
// word completion
|
||||||
if aWordCompletion=nil then begin
|
if aWordCompletion=nil then begin
|
||||||
aWordCompletion:=TWordCompletion.Create;
|
aWordCompletion:=TWordCompletion.Create;
|
||||||
with AWordCompletion do begin
|
with AWordCompletion do begin
|
||||||
@ -2074,49 +2066,25 @@ begin
|
|||||||
OnGetSource:=@OnWordCompletionGetSource;
|
OnGetSource:=@OnWordCompletionGetSource;
|
||||||
end;
|
end;
|
||||||
end;
|
end;
|
||||||
BuildPopupMenu;
|
|
||||||
|
|
||||||
|
// identifier completion
|
||||||
|
IdentCompletionTimer := TTimer.Create(self);
|
||||||
|
IdentCompletionTimer.Enabled := False;
|
||||||
|
IdentCompletionTimer.Interval := 500;
|
||||||
|
|
||||||
MarksImgList := TImageList.Create(AOwner);
|
// marks
|
||||||
MarksImgList.Width:=11;
|
SourceEditorMarks:=TSourceMarks.Create(Self);
|
||||||
MarksImgList.Height:=11;
|
SourceEditorMarks.OnGetSourceEditor:=@OnSourceMarksGetSourceEditor;
|
||||||
|
SourceEditorMarks.OnGetFilename:=@OnSourceMarksGetFilename;
|
||||||
// load 10 bookmark images
|
|
||||||
for I := 0 to 9 do Begin
|
|
||||||
Pixmap1:=TPixMap.Create;
|
|
||||||
Pixmap1.TransparentColor:=clBtnFace;
|
|
||||||
Pixmap1.LoadFromLazarusResource('bookmark'+IntToStr(i));
|
|
||||||
MarksImgList.Add(Pixmap1,nil);
|
|
||||||
end;
|
|
||||||
// load active breakpoint image
|
|
||||||
Pixmap1:=TPixMap.Create;
|
|
||||||
Pixmap1.TransparentColor:=clBtnFace;
|
|
||||||
Pixmap1.LoadFromLazarusResource('ActiveBreakPoint');
|
|
||||||
MarksImgList.Add(Pixmap1,nil);
|
|
||||||
// load inactive breakpoint image
|
|
||||||
Pixmap1:=TPixMap.Create;
|
|
||||||
Pixmap1.TransparentColor:=clBtnFace;
|
|
||||||
Pixmap1.LoadFromLazarusResource('InactiveBreakPoint');
|
|
||||||
MarksImgList.Add(Pixmap1,nil);
|
|
||||||
// load invalid breakpoint image
|
|
||||||
Pixmap1:=TPixMap.Create;
|
|
||||||
Pixmap1.TransparentColor:=clBtnFace;
|
|
||||||
Pixmap1.LoadFromLazarusResource('InvalidBreakPoint');
|
|
||||||
MarksImgList.Add(Pixmap1,nil);
|
|
||||||
// load unknown breakpoint image
|
|
||||||
Pixmap1:=TPixMap.Create;
|
|
||||||
Pixmap1.TransparentColor:=clBtnFace;
|
|
||||||
Pixmap1.LoadFromLazarusResource('UnknownBreakPoint');
|
|
||||||
MarksImgList.Add(Pixmap1,nil);
|
|
||||||
// load multi mixed breakpoint image
|
|
||||||
Pixmap1:=TPixMap.Create;
|
|
||||||
Pixmap1.TransparentColor:=clBtnFace;
|
|
||||||
Pixmap1.LoadFromLazarusResource('MultiBreakPoint');
|
|
||||||
MarksImgList.Add(Pixmap1,nil);
|
|
||||||
|
|
||||||
|
// key mapping
|
||||||
FKeyStrokes:=TSynEditKeyStrokes.Create(Self);
|
FKeyStrokes:=TSynEditKeyStrokes.Create(Self);
|
||||||
EditorOpts.KeyMap.AssignTo(FKeyStrokes,[caSourceEditor]);
|
EditorOpts.KeyMap.AssignTo(FKeyStrokes,[caSourceEditor]);
|
||||||
|
|
||||||
|
// popup menu
|
||||||
|
BuildPopupMenu;
|
||||||
|
|
||||||
|
// completion form
|
||||||
aCompletion := TSynCompletion.Create(AOwner);
|
aCompletion := TSynCompletion.Create(AOwner);
|
||||||
with aCompletion do
|
with aCompletion do
|
||||||
Begin
|
Begin
|
||||||
@ -2130,7 +2098,7 @@ begin
|
|||||||
ShortCut:=Menus.ShortCut(VK_UNKNOWN,[]);
|
ShortCut:=Menus.ShortCut(VK_UNKNOWN,[]);
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
// statusbar
|
||||||
StatusBar := TStatusBar.Create(self);
|
StatusBar := TStatusBar.Create(self);
|
||||||
with Statusbar do
|
with Statusbar do
|
||||||
begin
|
begin
|
||||||
@ -2157,12 +2125,9 @@ begin
|
|||||||
SimplePanel := False;
|
SimplePanel := False;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
// goto dialog
|
||||||
GotoDialog := TfrmGoto.Create(self);
|
GotoDialog := TfrmGoto.Create(self);
|
||||||
|
|
||||||
IdentCompletionTimer := TTimer.Create(self);
|
|
||||||
IdentCompletionTimer.Enabled := False;
|
|
||||||
IdentCompletionTimer.Interval := 500;
|
|
||||||
|
|
||||||
// HintTimer
|
// HintTimer
|
||||||
FHintTimer := TTimer.Create(nil);
|
FHintTimer := TTimer.Create(nil);
|
||||||
with FHintTimer do begin
|
with FHintTimer do begin
|
||||||
@ -2805,6 +2770,20 @@ begin
|
|||||||
end;
|
end;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
function TSourceNotebook.OnSourceMarksGetFilename(ASourceEditor: TObject
|
||||||
|
): string;
|
||||||
|
begin
|
||||||
|
if (ASourceEditor=nil) or (not (ASourceEditor is TSourceEditor)) then
|
||||||
|
RaiseException('TSourceNotebook.OnSourceMarksGetFilename');
|
||||||
|
Result:=TSourceEditor(ASourceEditor).Filename;
|
||||||
|
end;
|
||||||
|
|
||||||
|
function TSourceNotebook.OnSourceMarksGetSourceEditor(ASynEdit: TCustomSynEdit
|
||||||
|
): TObject;
|
||||||
|
begin
|
||||||
|
Result:=FindSourceEditorWithEditorComponent(ASynEdit);
|
||||||
|
end;
|
||||||
|
|
||||||
Procedure TSourceNotebook.BuildPopupMenu;
|
Procedure TSourceNotebook.BuildPopupMenu;
|
||||||
|
|
||||||
Function Seperator : TMenuItem;
|
Function Seperator : TMenuItem;
|
||||||
@ -2986,7 +2965,8 @@ Begin
|
|||||||
Result.CodeTemplates:=CodeTemplateModul;
|
Result.CodeTemplates:=CodeTemplateModul;
|
||||||
Notebook.PageIndex := Pagenum;
|
Notebook.PageIndex := Pagenum;
|
||||||
Result.FPageName:=NoteBook.Pages[Pagenum];
|
Result.FPageName:=NoteBook.Pages[Pagenum];
|
||||||
Result.EditorComponent.BookMarkOptions.BookmarkImages := MarksImgList;
|
Result.EditorComponent.BookMarkOptions.BookmarkImages :=
|
||||||
|
SourceEditorMarks.ImgList;
|
||||||
Result.PopupMenu:=SrcPopupMenu;
|
Result.PopupMenu:=SrcPopupMenu;
|
||||||
Result.OnEditorChange := @EditorChanged;
|
Result.OnEditorChange := @EditorChanged;
|
||||||
Result.OnMouseMove := @EditorMouseMove;
|
Result.OnMouseMove := @EditorMouseMove;
|
||||||
@ -3783,10 +3763,19 @@ function TSourceNotebook.FindSourceEditorWithEditorComponent(
|
|||||||
var i: integer;
|
var i: integer;
|
||||||
begin
|
begin
|
||||||
for i:=0 to EditorCount-1 do begin
|
for i:=0 to EditorCount-1 do begin
|
||||||
if Editors[i].EditorComponent=EditorComp then begin
|
Result:=Editors[i];
|
||||||
Result:=Editors[i];
|
if Result.EditorComponent=EditorComp then exit;
|
||||||
exit;
|
end;
|
||||||
end;
|
Result:=nil;
|
||||||
|
end;
|
||||||
|
|
||||||
|
function TSourceNotebook.FindSourceEditorWithFilename(const Filename: string
|
||||||
|
): TSourceEditor;
|
||||||
|
var i: integer;
|
||||||
|
begin
|
||||||
|
for i:=0 to EditorCount-1 do begin
|
||||||
|
Result:=Editors[i];
|
||||||
|
if CompareFilenames(Result.Filename,Filename)=0 then exit;
|
||||||
end;
|
end;
|
||||||
Result:=nil;
|
Result:=nil;
|
||||||
end;
|
end;
|
||||||
|
Loading…
Reference in New Issue
Block a user