mirror of
https://gitlab.com/freepascal.org/lazarus/lazarus.git
synced 2025-08-18 03:59:13 +02:00
implemented breakpoints hints for source editor
git-svn-id: trunk@4232 -
This commit is contained in:
parent
12839a8385
commit
80d74a8fe7
@ -109,9 +109,44 @@ type
|
|||||||
property BreakPoints: TIDEBreakPoints read FBreakPoints write SetBreakPoints;
|
property BreakPoints: TIDEBreakPoints read FBreakPoints write SetBreakPoints;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
function GetBreakPointStateDescription(ABreakpoint: TBaseBreakpoint): string;
|
||||||
|
function GetBreakPointActionsDescription(ABreakpoint: TBaseBreakpoint): string;
|
||||||
|
|
||||||
|
|
||||||
implementation
|
implementation
|
||||||
|
|
||||||
|
function GetBreakPointStateDescription(ABreakpoint: TBaseBreakpoint): string;
|
||||||
|
const
|
||||||
|
// enabled valid
|
||||||
|
DEBUG_STATE: array[Boolean, TValidState] of String = (
|
||||||
|
{vsUnknown, vsValid, vsInvalid}
|
||||||
|
{Disabled} ('? (Off)','Disabled','Invalid (Off)'),
|
||||||
|
{Endabled} ('? (On)', 'Enabled', 'Invalid (On)'));
|
||||||
|
begin
|
||||||
|
Result:=DEBUG_STATE[ABreakpoint.Enabled,ABreakpoint.Valid];
|
||||||
|
end;
|
||||||
|
|
||||||
|
function GetBreakPointActionsDescription(ABreakpoint: TBaseBreakpoint): string;
|
||||||
|
const
|
||||||
|
DEBUG_ACTION: array[TIDEBreakPointAction] of string =
|
||||||
|
('Break', 'Enable Group', 'Disable Group');
|
||||||
|
|
||||||
|
var
|
||||||
|
CurBreakPoint: TIDEBreakPoint;
|
||||||
|
Action: TIDEBreakPointAction;
|
||||||
|
begin
|
||||||
|
Result := '';
|
||||||
|
if ABreakpoint is TIDEBreakPoint then begin
|
||||||
|
CurBreakPoint:=TIDEBreakPoint(ABreakpoint);
|
||||||
|
for Action := Low(Action) to High(Action) do
|
||||||
|
if Action in CurBreakpoint.Actions
|
||||||
|
then begin
|
||||||
|
if Result <> '' then Result := Result + ', ';
|
||||||
|
Result := Result + DEBUG_ACTION[Action]
|
||||||
|
end;
|
||||||
|
end;
|
||||||
|
end;
|
||||||
|
|
||||||
procedure TBreakPointsDlg.BreakPointAdd(const ASender: TIDEBreakPoints;
|
procedure TBreakPointsDlg.BreakPointAdd(const ASender: TIDEBreakPoints;
|
||||||
const ABreakpoint: TIDEBreakPoint);
|
const ABreakpoint: TIDEBreakPoint);
|
||||||
var
|
var
|
||||||
@ -408,18 +443,7 @@ end;
|
|||||||
|
|
||||||
procedure TBreakPointsDlg.UpdateItem(const AnItem: TListItem;
|
procedure TBreakPointsDlg.UpdateItem(const AnItem: TListItem;
|
||||||
const ABreakpoint: TIDEBreakPoint);
|
const ABreakpoint: TIDEBreakPoint);
|
||||||
const
|
|
||||||
DEBUG_ACTION: array[TIDEBreakPointAction] of string =
|
|
||||||
('Break', 'Enable Group', 'Disable Group');
|
|
||||||
|
|
||||||
// enabled valid
|
|
||||||
DEBUG_STATE: array[Boolean, TValidState] of String = (
|
|
||||||
{vsUnknown, vsValid, vsInvalid}
|
|
||||||
{Disabled} ('? (Off)','Disabled','Invalid (Off)'),
|
|
||||||
{Endabled} ('? (On)', 'Enabled', 'Invalid (On)'));
|
|
||||||
var
|
var
|
||||||
Action: TIDEBreakPointAction;
|
|
||||||
S: String;
|
|
||||||
Filename: String;
|
Filename: String;
|
||||||
begin
|
begin
|
||||||
// Filename/Address
|
// Filename/Address
|
||||||
@ -430,7 +454,7 @@ begin
|
|||||||
// Group
|
// Group
|
||||||
|
|
||||||
// state
|
// state
|
||||||
AnItem.Caption := DEBUG_STATE[ABreakpoint.Enabled, ABreakpoint.Valid];
|
AnItem.Caption := GetBreakPointStateDescription(ABreakpoint);
|
||||||
|
|
||||||
// filename
|
// filename
|
||||||
Filename:=ABreakpoint.Source;
|
Filename:=ABreakpoint.Source;
|
||||||
@ -447,14 +471,7 @@ begin
|
|||||||
AnItem.SubItems[2] := ABreakpoint.Expression;
|
AnItem.SubItems[2] := ABreakpoint.Expression;
|
||||||
|
|
||||||
// actions
|
// actions
|
||||||
S := '';
|
AnItem.SubItems[3] := GetBreakPointActionsDescription(ABreakpoint);
|
||||||
for Action := Low(Action) to High(Action) do
|
|
||||||
if Action in ABreakpoint.Actions
|
|
||||||
then begin
|
|
||||||
if S <> '' then s := S + ', ';
|
|
||||||
S := S + DEBUG_ACTION[Action]
|
|
||||||
end;
|
|
||||||
AnItem.SubItems[3] := S;
|
|
||||||
|
|
||||||
// hitcount
|
// hitcount
|
||||||
AnItem.SubItems[4] := IntToStr(ABreakpoint.HitCount);
|
AnItem.SubItems[4] := IntToStr(ABreakpoint.HitCount);
|
||||||
@ -489,6 +506,9 @@ end.
|
|||||||
|
|
||||||
{ =============================================================================
|
{ =============================================================================
|
||||||
$Log$
|
$Log$
|
||||||
|
Revision 1.20 2003/06/04 13:34:58 mattias
|
||||||
|
implemented breakpoints hints for source editor
|
||||||
|
|
||||||
Revision 1.19 2003/06/03 11:20:12 mattias
|
Revision 1.19 2003/06/03 11:20:12 mattias
|
||||||
implemented enable/disable/delete breakpoints in same source
|
implemented enable/disable/delete breakpoints in same source
|
||||||
|
|
||||||
|
@ -171,6 +171,7 @@ type
|
|||||||
procedure SetSourceMark(const AValue: TSourceMark);
|
procedure SetSourceMark(const AValue: TSourceMark);
|
||||||
procedure OnSourceMarkPositionChanged(Sender: TObject);
|
procedure OnSourceMarkPositionChanged(Sender: TObject);
|
||||||
procedure OnSourceMarkBeforeFree(Sender: TObject);
|
procedure OnSourceMarkBeforeFree(Sender: TObject);
|
||||||
|
procedure OnSourceMarkGetHint(SenderMark: TSourceMark; var Hint: string);
|
||||||
protected
|
protected
|
||||||
procedure AssignTo(Dest: TPersistent); override;
|
procedure AssignTo(Dest: TPersistent); override;
|
||||||
procedure DoChanged; override;
|
procedure DoChanged; override;
|
||||||
@ -249,6 +250,7 @@ begin
|
|||||||
FSourceMark.IsBreakPoint:=true;
|
FSourceMark.IsBreakPoint:=true;
|
||||||
FSourceMark.Line:=Line;
|
FSourceMark.Line:=Line;
|
||||||
FSourceMark.Visible:=true;
|
FSourceMark.Visible:=true;
|
||||||
|
FSourceMark.AddGetHintHandler(@OnSourceMarkGetHint);
|
||||||
UpdateSourceMark;
|
UpdateSourceMark;
|
||||||
end;
|
end;
|
||||||
end;
|
end;
|
||||||
@ -263,6 +265,15 @@ begin
|
|||||||
SourceMark:=nil;
|
SourceMark:=nil;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
procedure TManagedBreakPoint.OnSourceMarkGetHint(SenderMark: TSourceMark;
|
||||||
|
var Hint: string);
|
||||||
|
begin
|
||||||
|
Hint:=GetBreakPointStateDescription(Self)+EndOfLine
|
||||||
|
+'Hitcount: '+IntToStr(Hitcount)+EndOfLine
|
||||||
|
+'Action: '+GetBreakPointActionsDescription(Self)+EndOfLine
|
||||||
|
+'Condition: '+Expression;
|
||||||
|
end;
|
||||||
|
|
||||||
procedure TManagedBreakPoint.AssignTo(Dest: TPersistent);
|
procedure TManagedBreakPoint.AssignTo(Dest: TPersistent);
|
||||||
begin
|
begin
|
||||||
inherited AssignTo(Dest);
|
inherited AssignTo(Dest);
|
||||||
@ -1364,6 +1375,9 @@ end.
|
|||||||
|
|
||||||
{ =============================================================================
|
{ =============================================================================
|
||||||
$Log$
|
$Log$
|
||||||
|
Revision 1.46 2003/06/04 13:34:58 mattias
|
||||||
|
implemented breakpoints hints for source editor
|
||||||
|
|
||||||
Revision 1.45 2003/06/04 12:44:55 mattias
|
Revision 1.45 2003/06/04 12:44:55 mattias
|
||||||
implemented setting breakpoint while compiling
|
implemented setting breakpoint while compiling
|
||||||
|
|
||||||
|
@ -161,6 +161,7 @@ type
|
|||||||
fUndoAfterSave:boolean;
|
fUndoAfterSave:boolean;
|
||||||
fUseSyntaxHighlight:boolean;
|
fUseSyntaxHighlight:boolean;
|
||||||
FCopyWordAtCursorOnCopyNone: boolean;
|
FCopyWordAtCursorOnCopyNone: boolean;
|
||||||
|
FShowGutterHints: boolean;
|
||||||
fBlockIndent:integer;
|
fBlockIndent:integer;
|
||||||
fUndoLimit:integer;
|
fUndoLimit:integer;
|
||||||
fTabWidth:integer;
|
fTabWidth:integer;
|
||||||
@ -192,7 +193,6 @@ type
|
|||||||
fAutoDelayInMSec:integer;
|
fAutoDelayInMSec:integer;
|
||||||
fCodeTemplateFileName:Ansistring;
|
fCodeTemplateFileName:Ansistring;
|
||||||
fCTemplIndentToTokenStart: boolean;
|
fCTemplIndentToTokenStart: boolean;
|
||||||
procedure SetCopyWordAtCursorOnCopyNone(const AValue: boolean);
|
|
||||||
public
|
public
|
||||||
constructor Create;
|
constructor Create;
|
||||||
destructor Destroy; override;
|
destructor Destroy; override;
|
||||||
@ -235,7 +235,8 @@ type
|
|||||||
property UseSyntaxHighlight:boolean
|
property UseSyntaxHighlight:boolean
|
||||||
read fUseSyntaxHighlight write fUseSyntaxHighlight default true;
|
read fUseSyntaxHighlight write fUseSyntaxHighlight default true;
|
||||||
property CopyWordAtCursorOnCopyNone: boolean read FCopyWordAtCursorOnCopyNone
|
property CopyWordAtCursorOnCopyNone: boolean read FCopyWordAtCursorOnCopyNone
|
||||||
write SetCopyWordAtCursorOnCopyNone;
|
write FCopyWordAtCursorOnCopyNone;
|
||||||
|
property ShowGutterHints: boolean read FShowGutterHints write FShowGutterHints;
|
||||||
property BlockIndent:integer read fBlockIndent write fBlockIndent default 2;
|
property BlockIndent:integer read fBlockIndent write fBlockIndent default 2;
|
||||||
property UndoLimit:integer read fUndoLimit write fUndoLimit default 32767;
|
property UndoLimit:integer read fUndoLimit write fUndoLimit default 32767;
|
||||||
property TabWidth:integer read fTabWidth write fTabWidth default 8;
|
property TabWidth:integer read fTabWidth write fTabWidth default 8;
|
||||||
@ -333,6 +334,7 @@ type
|
|||||||
FindTextAtCursorCheckBox:TCheckBox;
|
FindTextAtCursorCheckBox:TCheckBox;
|
||||||
UseSyntaxHighlightCheckBox:TCheckBox;
|
UseSyntaxHighlightCheckBox:TCheckBox;
|
||||||
CopyWordAtCursorOnCopyNoneCheckBox:TCheckBox;
|
CopyWordAtCursorOnCopyNoneCheckBox:TCheckBox;
|
||||||
|
ShowGutterHintsCheckBox:TCheckBox;
|
||||||
MouseLinksCheckBox: TCheckBox;
|
MouseLinksCheckBox: TCheckBox;
|
||||||
BlockIndentComboBox:TComboBox;
|
BlockIndentComboBox:TComboBox;
|
||||||
BlockIndentLabel:TLabel;
|
BlockIndentLabel:TLabel;
|
||||||
@ -1041,12 +1043,6 @@ end;
|
|||||||
|
|
||||||
{ TEditorOptions }
|
{ TEditorOptions }
|
||||||
|
|
||||||
procedure TEditorOptions.SetCopyWordAtCursorOnCopyNone(const AValue: boolean);
|
|
||||||
begin
|
|
||||||
if FCopyWordAtCursorOnCopyNone=AValue then exit;
|
|
||||||
FCopyWordAtCursorOnCopyNone:=AValue;
|
|
||||||
end;
|
|
||||||
|
|
||||||
constructor TEditorOptions.Create;
|
constructor TEditorOptions.Create;
|
||||||
var ConfFileName: string;
|
var ConfFileName: string;
|
||||||
fs:TFileStream;
|
fs:TFileStream;
|
||||||
@ -1073,6 +1069,7 @@ begin
|
|||||||
fCtrlMouseLinks:=true;
|
fCtrlMouseLinks:=true;
|
||||||
fShowTabCloseButtons:=true;
|
fShowTabCloseButtons:=true;
|
||||||
FCopyWordAtCursorOnCopyNone:=true;
|
FCopyWordAtCursorOnCopyNone:=true;
|
||||||
|
FShowGutterHints:=true;
|
||||||
fBlockIndent:=2;
|
fBlockIndent:=2;
|
||||||
fUndoLimit:=32767;
|
fUndoLimit:=32767;
|
||||||
fTabWidth:=8;
|
fTabWidth:=8;
|
||||||
@ -1162,6 +1159,8 @@ begin
|
|||||||
XMLConfig.GetValue('EditorOptions/General/Editor/ShowTabCloseButtons',true);
|
XMLConfig.GetValue('EditorOptions/General/Editor/ShowTabCloseButtons',true);
|
||||||
FCopyWordAtCursorOnCopyNone:=
|
FCopyWordAtCursorOnCopyNone:=
|
||||||
XMLConfig.GetValue('EditorOptions/General/Editor/CopyWordAtCursorOnCopyNone',true);
|
XMLConfig.GetValue('EditorOptions/General/Editor/CopyWordAtCursorOnCopyNone',true);
|
||||||
|
FShowGutterHints:=
|
||||||
|
XMLConfig.GetValue('EditorOptions/General/Editor/ShowGutterHints',true);
|
||||||
fUndoAfterSave:=
|
fUndoAfterSave:=
|
||||||
XMLConfig.GetValue('EditorOptions/General/Editor/UndoAfterSave',true);
|
XMLConfig.GetValue('EditorOptions/General/Editor/UndoAfterSave',true);
|
||||||
fFindTextAtCursor:=
|
fFindTextAtCursor:=
|
||||||
@ -1282,6 +1281,9 @@ begin
|
|||||||
XMLConfig.SetDeleteValue(
|
XMLConfig.SetDeleteValue(
|
||||||
'EditorOptions/General/Editor/CopyWordAtCursorOnCopyNone',
|
'EditorOptions/General/Editor/CopyWordAtCursorOnCopyNone',
|
||||||
FCopyWordAtCursorOnCopyNone,true);
|
FCopyWordAtCursorOnCopyNone,true);
|
||||||
|
XMLConfig.SetDeleteValue(
|
||||||
|
'EditorOptions/General/Editor/ShowGutterHints',
|
||||||
|
FShowGutterHints,true);
|
||||||
XMLConfig.SetDeleteValue('EditorOptions/General/Editor/UndoAfterSave'
|
XMLConfig.SetDeleteValue('EditorOptions/General/Editor/UndoAfterSave'
|
||||||
,fUndoAfterSave,true);
|
,fUndoAfterSave,true);
|
||||||
XMLConfig.SetDeleteValue('EditorOptions/General/Editor/FindTextAtCursor'
|
XMLConfig.SetDeleteValue('EditorOptions/General/Editor/FindTextAtCursor'
|
||||||
@ -3204,7 +3206,7 @@ begin
|
|||||||
Top:=5;
|
Top:=5;
|
||||||
Left:=5;
|
Left:=5;
|
||||||
Width:=MaxX-10;
|
Width:=MaxX-10;
|
||||||
Height:=24*11; // 24 pixels per line
|
Height:=24*12; // 24 pixels per line
|
||||||
Caption:=lismenueditoroptions;
|
Caption:=lismenueditoroptions;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
@ -3354,6 +3356,18 @@ begin
|
|||||||
Checked:=EditorOpts.CtrlMouseLinks;
|
Checked:=EditorOpts.CtrlMouseLinks;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
ShowGutterHintsCheckBox:=TCheckBox.Create(Self);
|
||||||
|
with ShowGutterHintsCheckBox do begin
|
||||||
|
Name:='ShowGutterHintsCheckBox';
|
||||||
|
Parent:=EditorOptionsGroupBox;
|
||||||
|
Top:=MouseLinksCheckBox.Top+MouseLinksCheckBox.Height+5;
|
||||||
|
Left:=MouseLinksCheckBox.Left;
|
||||||
|
Width:=ChkBoxW;
|
||||||
|
Height:=AltSetsColumnModeCheckBox.Height;
|
||||||
|
Caption:=dlgShowGutterHints;
|
||||||
|
Checked:=EditorOpts.ShowGutterHints;
|
||||||
|
end;
|
||||||
|
|
||||||
// right side
|
// right side
|
||||||
ScrollPastEoLCheckBox:=TCheckBox.Create(Self);
|
ScrollPastEoLCheckBox:=TCheckBox.Create(Self);
|
||||||
with ScrollPastEoLCheckBox do begin
|
with ScrollPastEoLCheckBox do begin
|
||||||
@ -3598,7 +3612,7 @@ begin
|
|||||||
Top:=5;
|
Top:=5;
|
||||||
Left:=5;
|
Left:=5;
|
||||||
Width:=MaxX-10;
|
Width:=MaxX-10;
|
||||||
Height:=24*11; // 24 pixels per option
|
Height:=21*12+31; // 21 pixels per option
|
||||||
end;
|
end;
|
||||||
|
|
||||||
// many, many checkboxes ...
|
// many, many checkboxes ...
|
||||||
@ -3680,6 +3694,13 @@ begin
|
|||||||
Height:=AltSetsColumnModeCheckBox.Height;
|
Height:=AltSetsColumnModeCheckBox.Height;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
with ShowGutterHintsCheckBox do begin
|
||||||
|
Top:=MouseLinksCheckBox.Top+MouseLinksCheckBox.Height+5;
|
||||||
|
Left:=AltSetsColumnModeCheckBox.Left;
|
||||||
|
Width:=ChkBoxW;
|
||||||
|
Height:=AltSetsColumnModeCheckBox.Height;
|
||||||
|
end;
|
||||||
|
|
||||||
// right side
|
// right side
|
||||||
|
|
||||||
with ScrollPastEoLCheckBox do begin
|
with ScrollPastEoLCheckBox do begin
|
||||||
@ -3774,20 +3795,8 @@ begin
|
|||||||
Width:=BlockIndentComboBox.Left-2-Left;
|
Width:=BlockIndentComboBox.Left-2-Left;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
with UndoLimitComboBox do begin
|
|
||||||
Top:=BlockIndentComboBox.Top+BlockIndentComboBox.Height+5;
|
|
||||||
Left:=BlockIndentComboBox.Left;
|
|
||||||
Width:=70;
|
|
||||||
end;
|
|
||||||
|
|
||||||
with UndoLimitLabel do begin
|
|
||||||
Top:=UndoLimitComboBox.Top+2;
|
|
||||||
Left:=EditorOptionsGroupBox.Left+2;
|
|
||||||
Width:=UndoLimitComboBox.Left-Left-2;
|
|
||||||
end;
|
|
||||||
|
|
||||||
with TabWidthsComboBox do begin
|
with TabWidthsComboBox do begin
|
||||||
Top:=UndoLimitComboBox.Top+UndoLimitComboBox.Height+5;
|
Top:=BlockIndentComboBox.Top+BlockIndentComboBox.Height+5;
|
||||||
Left:=BlockIndentComboBox.Left;
|
Left:=BlockIndentComboBox.Left;
|
||||||
Width:=70;
|
Width:=70;
|
||||||
end;
|
end;
|
||||||
@ -3797,6 +3806,18 @@ begin
|
|||||||
Left:=EditorOptionsGroupBox.Left+2;
|
Left:=EditorOptionsGroupBox.Left+2;
|
||||||
Width:=TabWidthsComboBox.Left-Left-2;
|
Width:=TabWidthsComboBox.Left-Left-2;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
with UndoLimitComboBox do begin
|
||||||
|
Top:=BlockIndentComboBox.Top;
|
||||||
|
Left:=BlockIndentComboBox.Left+BlockIndentComboBox.Width+50+70;
|
||||||
|
Width:=70;
|
||||||
|
end;
|
||||||
|
|
||||||
|
with UndoLimitLabel do begin
|
||||||
|
Top:=UndoLimitComboBox.Top+2;
|
||||||
|
Left:=UndoLimitComboBox.Left-70+2;
|
||||||
|
Width:=UndoLimitComboBox.Left-Left-2;
|
||||||
|
end;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
procedure TEditorOptionsForm.SetupDisplayPage;
|
procedure TEditorOptionsForm.SetupDisplayPage;
|
||||||
@ -5245,6 +5266,7 @@ begin
|
|||||||
EditorOpts.UndoAfterSave:=UndoAfterSaveCheckBox.Checked;
|
EditorOpts.UndoAfterSave:=UndoAfterSaveCheckBox.Checked;
|
||||||
EditorOpts.CopyWordAtCursorOnCopyNone:=
|
EditorOpts.CopyWordAtCursorOnCopyNone:=
|
||||||
CopyWordAtCursorOnCopyNoneCheckBox.Checked;
|
CopyWordAtCursorOnCopyNoneCheckBox.Checked;
|
||||||
|
EditorOpts.ShowGutterHints:=ShowGutterHintsCheckBox.Checked;
|
||||||
EditorOpts.FindTextAtCursor:=FindTextAtCursorCheckBox.Checked;
|
EditorOpts.FindTextAtCursor:=FindTextAtCursorCheckBox.Checked;
|
||||||
EditorOpts.UseSyntaxHighlight:=UseSyntaxHighlightCheckBox.Checked;
|
EditorOpts.UseSyntaxHighlight:=UseSyntaxHighlightCheckBox.Checked;
|
||||||
EditorOpts.CtrlMouseLinks:=MouseLinksCheckBox.Checked;
|
EditorOpts.CtrlMouseLinks:=MouseLinksCheckBox.Checked;
|
||||||
|
@ -651,6 +651,7 @@ resourcestring
|
|||||||
dlgCloseButtonsNotebook = 'Show Close Buttons in notebook';
|
dlgCloseButtonsNotebook = 'Show Close Buttons in notebook';
|
||||||
dlgShowScrollHint = 'Show Scroll Hint';
|
dlgShowScrollHint = 'Show Scroll Hint';
|
||||||
dlgMouseLinks = 'Mouse links';
|
dlgMouseLinks = 'Mouse links';
|
||||||
|
dlgShowGutterHints = 'Show Gutter Hints';
|
||||||
dlgSmartTabs = 'Smart Tabs';
|
dlgSmartTabs = 'Smart Tabs';
|
||||||
dlgTabsToSpaces = 'Tabs To Spaces';
|
dlgTabsToSpaces = 'Tabs To Spaces';
|
||||||
dlgTrimTrailingSpaces = 'Trim Trailing Spaces';
|
dlgTrimTrailingSpaces = 'Trim Trailing Spaces';
|
||||||
|
@ -43,13 +43,17 @@ uses
|
|||||||
|
|
||||||
type
|
type
|
||||||
TSourceMarks = class;
|
TSourceMarks = class;
|
||||||
|
TSourceMark = class;
|
||||||
|
|
||||||
{ TSourceMark }
|
{ TSourceMark }
|
||||||
|
|
||||||
|
TGetSourceMarkHintEvent =
|
||||||
|
procedure(SenderMark: TSourceMark; var Hint: string) of object;
|
||||||
|
|
||||||
TSourceMarkHandler = (
|
TSourceMarkHandler = (
|
||||||
smhPositionChanged,
|
smhPositionChanged,
|
||||||
smhBeforeFree
|
smhBeforeFree,
|
||||||
|
smhGetHint
|
||||||
);
|
);
|
||||||
|
|
||||||
TSourceMark = class(TSynEditMark)
|
TSourceMark = class(TSynEditMark)
|
||||||
@ -86,6 +90,7 @@ type
|
|||||||
function CompareEditorAndLine(ASynEdit: TCustomSynEdit;
|
function CompareEditorAndLine(ASynEdit: TCustomSynEdit;
|
||||||
ALine: integer): integer;
|
ALine: integer): integer;
|
||||||
function GetFilename: string;
|
function GetFilename: string;
|
||||||
|
function GetHint: string; virtual;
|
||||||
public
|
public
|
||||||
// handlers
|
// handlers
|
||||||
procedure RemoveAllHandlersForObject(HandlerObject: TObject);
|
procedure RemoveAllHandlersForObject(HandlerObject: TObject);
|
||||||
@ -93,6 +98,8 @@ type
|
|||||||
procedure RemovePositionChangedHandler(OnPositionChanged: TNotifyEvent);
|
procedure RemovePositionChangedHandler(OnPositionChanged: TNotifyEvent);
|
||||||
procedure AddBeforeFreeHandler(OnBeforeFree: TNotifyEvent);
|
procedure AddBeforeFreeHandler(OnBeforeFree: TNotifyEvent);
|
||||||
procedure RemoveBeforeFreeHandler(OnBeforeFree: TNotifyEvent);
|
procedure RemoveBeforeFreeHandler(OnBeforeFree: TNotifyEvent);
|
||||||
|
procedure AddGetHintHandler(OnGetHint: TGetSourceMarkHintEvent);
|
||||||
|
procedure RemoveGetHintHandler(OnGetHint: TGetSourceMarkHintEvent);
|
||||||
public
|
public
|
||||||
// properties
|
// properties
|
||||||
property Data: TObject read FData write SetData;
|
property Data: TObject read FData write SetData;
|
||||||
@ -363,6 +370,16 @@ begin
|
|||||||
Result:=FSourceMarks.GetFilename(Self);
|
Result:=FSourceMarks.GetFilename(Self);
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
function TSourceMark.GetHint: string;
|
||||||
|
var
|
||||||
|
i: Integer;
|
||||||
|
begin
|
||||||
|
Result:='';
|
||||||
|
i:=FHandlers[smhGetHint].Count;
|
||||||
|
while FHandlers[smhGetHint].NextDownIndex(i) do
|
||||||
|
TGetSourceMarkHintEvent(FHandlers[smhGetHint][i])(Self,Result);
|
||||||
|
end;
|
||||||
|
|
||||||
procedure TSourceMark.RemoveAllHandlersForObject(HandlerObject: TObject);
|
procedure TSourceMark.RemoveAllHandlersForObject(HandlerObject: TObject);
|
||||||
var
|
var
|
||||||
HandlerType: TSourceMarkHandler;
|
HandlerType: TSourceMarkHandler;
|
||||||
@ -394,6 +411,16 @@ begin
|
|||||||
FHandlers[smhBeforeFree].Remove(TMethod(OnBeforeFree));
|
FHandlers[smhBeforeFree].Remove(TMethod(OnBeforeFree));
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
procedure TSourceMark.AddGetHintHandler(OnGetHint: TGetSourceMarkHintEvent);
|
||||||
|
begin
|
||||||
|
AddHandler(smhGetHint,TMethod(OnGetHint));
|
||||||
|
end;
|
||||||
|
|
||||||
|
procedure TSourceMark.RemoveGetHintHandler(OnGetHint: TGetSourceMarkHintEvent);
|
||||||
|
begin
|
||||||
|
FHandlers[smhGetHint].Remove(TMethod(OnGetHint));
|
||||||
|
end;
|
||||||
|
|
||||||
{ TSourceMarks }
|
{ TSourceMarks }
|
||||||
|
|
||||||
function TSourceMarks.GetItems(Index: integer): TSourceMark;
|
function TSourceMarks.GetItems(Index: integer): TSourceMark;
|
||||||
|
Loading…
Reference in New Issue
Block a user