mirror of
https://gitlab.com/freepascal.org/lazarus/lazarus.git
synced 2025-08-26 20:40:36 +02:00
SynEdit: SharedTextBuffer can share Bookmarks too
git-svn-id: trunk@27814 -
This commit is contained in:
parent
87f28a9497
commit
3812c5bc84
@ -236,6 +236,12 @@ type
|
||||
);
|
||||
TSynEditorOptions2 = set of TSynEditorOption2;
|
||||
|
||||
// options for textbuffersharing
|
||||
TSynEditorShareOption = (
|
||||
eosShareMarks // Shared Editors use the same list of marks
|
||||
);
|
||||
TSynEditorShareOptions = set of TSynEditorShareOption;
|
||||
|
||||
const
|
||||
// MouseAction related options will have no effect (as default), unless they
|
||||
// are also updated in the Constructor of the MouseAction-class
|
||||
@ -262,6 +268,10 @@ const
|
||||
eoSpacesToTabs // Converts space characters to tabs and spaces
|
||||
];
|
||||
|
||||
SYNEDIT_DEFAULT_SHARE_OPTIONS = [
|
||||
eosShareMarks
|
||||
];
|
||||
|
||||
{$IFDEF SYN_LAZARUS}
|
||||
SYNEDIT_DEFAULT_OPTIONS2 = [
|
||||
eoFoldedCopyPaste,
|
||||
@ -360,6 +370,7 @@ type
|
||||
FBeautifyStartLineIdx, FBeautifyEndLineIdx: Integer;
|
||||
|
||||
FFoldedLinesView: TSynEditFoldedView;
|
||||
FShareOptions: TSynEditorShareOptions;
|
||||
FTrimmedLinesView: TSynEditStringTrimmingList;
|
||||
FDoubleWidthChrLinesView: SynEditStringDoubleWidthChars;
|
||||
FTabbedLinesView: TSynEditStringTabExpander;
|
||||
@ -402,7 +413,7 @@ type
|
||||
FMouseActions, FMouseSelActions: TSynEditMouseActions;
|
||||
FMouseActionSearchHandlerList: TSynEditMouseActionSearchList;
|
||||
FMouseActionExecHandlerList: TSynEditMouseActionExecList;
|
||||
fMarkList: TSynEditMarkList;
|
||||
FMarkList: TSynEditMarkList;
|
||||
fExtraLineSpacing: integer;
|
||||
FUseUTF8: boolean;
|
||||
fWantTabs: boolean;
|
||||
@ -458,6 +469,7 @@ type
|
||||
procedure SetMouseActions(const AValue: TSynEditMouseActions);
|
||||
procedure SetMouseSelActions(const AValue: TSynEditMouseActions);
|
||||
procedure SetPaintLockOwner(const AValue: TSynEditBase);
|
||||
procedure SetShareOptions(const AValue: TSynEditorShareOptions);
|
||||
procedure SetTextBetweenPoints(aStartPoint, aEndPoint: TPoint; const AValue: String);
|
||||
procedure SetTextBetweenPointsEx(aStartPoint, aEndPoint: TPoint;
|
||||
aCaretMode: TSynCaretAdjustMode; const AValue: String);
|
||||
@ -572,6 +584,9 @@ type
|
||||
procedure UpdateCaret(IgnorePaintLock: Boolean = False);
|
||||
procedure UpdateScrollBars;
|
||||
procedure ChangeTextBuffer(NewBuffer: TSynEditStringList);
|
||||
function IsMarkListShared: Boolean;
|
||||
procedure RecreateMarkList;
|
||||
procedure DestroyMarkList;
|
||||
procedure RemoveHandlers(ALines: TSynEditStrings = nil);
|
||||
procedure ExtraLineCharsChanged(Sender: TObject);
|
||||
protected
|
||||
@ -921,6 +936,8 @@ type
|
||||
default SYNEDIT_DEFAULT_OPTIONS;
|
||||
property Options2: TSynEditorOptions2 read fOptions2 write SetOptions2
|
||||
default SYNEDIT_DEFAULT_OPTIONS2;
|
||||
property ShareOptions: TSynEditorShareOptions read FShareOptions write SetShareOptions
|
||||
default SYNEDIT_DEFAULT_SHARE_OPTIONS; experimental;
|
||||
property OverwriteCaret: TSynEditCaretType read FOverwriteCaret
|
||||
write SetOverwriteCaret default ctBlock;
|
||||
property RightEdge: Integer read fRightEdge write SetRightEdge default 80;
|
||||
@ -980,6 +997,8 @@ type
|
||||
end;
|
||||
|
||||
TSynEdit = class(TCustomSynEdit)
|
||||
public
|
||||
property ShareOptions;
|
||||
published
|
||||
// inherited properties
|
||||
property Align;
|
||||
@ -1109,13 +1128,23 @@ procedure Register;
|
||||
|
||||
implementation
|
||||
|
||||
// { $R SynEdit.res}
|
||||
|
||||
const
|
||||
GutterTextDist = 2; //Pixel
|
||||
|
||||
type
|
||||
|
||||
{ TSynEditMarkListInternal }
|
||||
|
||||
TSynEditMarkListInternal = class(TSynEditMarkList)
|
||||
private
|
||||
function GetLinesView: TSynEditStrings;
|
||||
procedure SetLinesView(const AValue: TSynEditStrings);
|
||||
protected
|
||||
procedure AddOwnerEdit(AEdit: TSynEditBase);
|
||||
procedure RemoveOwnerEdit(AEdit: TSynEditBase);
|
||||
property LinesView: TSynEditStrings read GetLinesView write SetLinesView;
|
||||
end;
|
||||
|
||||
TSynStatusChangedHandlerList = Class(TSynFilteredMethodList)
|
||||
public
|
||||
procedure Add(AHandler: TStatusChangeEvent; Changes: TSynStatusChanges);
|
||||
@ -1633,9 +1662,7 @@ begin
|
||||
|
||||
FWordBreaker := TSynWordBreaker.Create;
|
||||
|
||||
fMarkList := TSynEditMarkList.Create(self, FTheLinesView);
|
||||
fMarkList.RegisterChangeHandler({$IFDEF FPC}@{$ENDIF}MarkListChange,
|
||||
[low(TSynEditMarkChangeReason)..high(TSynEditMarkChangeReason)]);
|
||||
RecreateMarkList;
|
||||
|
||||
{$IFDEF SYN_COMPILER_4_UP}
|
||||
{$IFNDEF SYN_LAZARUS}
|
||||
@ -1748,8 +1775,9 @@ begin
|
||||
FFoldedLinesView.TopLine := 1;
|
||||
// find / replace
|
||||
fTSearch := TSynEditSearch.Create;
|
||||
fOptions := SYNEDIT_DEFAULT_OPTIONS;
|
||||
fOptions2 := SYNEDIT_DEFAULT_OPTIONS2;
|
||||
FOptions := SYNEDIT_DEFAULT_OPTIONS;
|
||||
FOptions2 := SYNEDIT_DEFAULT_OPTIONS2;
|
||||
FShareOptions := SYNEDIT_DEFAULT_SHARE_OPTIONS;
|
||||
UpdateOptions;
|
||||
UpdateOptions2;
|
||||
fScrollTimer := TTimer.Create(Self);
|
||||
@ -1943,7 +1971,7 @@ begin
|
||||
FreeAndNil(FPaintLineColor2);
|
||||
FreeAndNil(fTextDrawer);
|
||||
FreeAndNil(fFontDummy);
|
||||
FreeAndNil(fMarkList);
|
||||
DestroyMarkList;
|
||||
FreeAndNil(FWordBreaker);
|
||||
FreeAndNil(FFoldedLinesView); // has reference to caret
|
||||
FreeAndNil(FInternalBlockSelection);
|
||||
@ -5156,6 +5184,40 @@ begin
|
||||
TSynEditStringList(FLines).PaintLockOwner := AValue;
|
||||
end;
|
||||
|
||||
procedure TCustomSynEdit.SetShareOptions(const AValue: TSynEditorShareOptions);
|
||||
var
|
||||
ChangedOptions: TSynEditorShareOptions;
|
||||
OldMarkList: TSynEditMarkList;
|
||||
it: TSynEditMarkIterator;
|
||||
MListShared: Boolean;
|
||||
begin
|
||||
if FShareOptions = AValue then exit;
|
||||
|
||||
ChangedOptions:=(FShareOptions - AValue) + (AValue - FShareOptions);
|
||||
FShareOptions := AValue;
|
||||
|
||||
if (eosShareMarks in ChangedOptions) then begin
|
||||
MListShared := IsMarkListShared;
|
||||
if ( (FShareOptions * [eosShareMarks] = []) and MListShared ) or
|
||||
( (eosShareMarks in FShareOptions) and (not MListShared) and
|
||||
(TSynEditStringList(FLines).AttachedSynEditCount > 1) )
|
||||
then begin
|
||||
OldMarkList := FMarkList;
|
||||
FMarkList := nil;
|
||||
RecreateMarkList;
|
||||
it := TSynEditMarkIterator.Create(OldMarkList);
|
||||
it.GotoBOL;
|
||||
while it.Next do begin
|
||||
// Todo: prevent notifications
|
||||
if it.Mark.OwnerEdit = Self then
|
||||
FMarkList.Add(it.Mark);
|
||||
end;
|
||||
it.Free;
|
||||
FreeAndNil(FMarkList);
|
||||
end;
|
||||
end;
|
||||
end;
|
||||
|
||||
procedure TCustomSynEdit.ChangeTextBuffer(NewBuffer: TSynEditStringList);
|
||||
var
|
||||
OldBuffer: TSynEditStringList;
|
||||
@ -5216,6 +5278,76 @@ begin
|
||||
OldBuffer.SendNotification(senrTextBufferChanged, OldBuffer); // Send the old buffer
|
||||
end;
|
||||
|
||||
function TCustomSynEdit.IsMarkListShared: Boolean;
|
||||
var
|
||||
i, j: Integer;
|
||||
begin
|
||||
j := 0;
|
||||
i := TSynEditStringList(FLines).AttachedSynEditCount - 1;
|
||||
while (i >= 0) and (j <= 1) do begin
|
||||
if TSynEdit(TSynEditStringList(FLines).AttachedSynEdits[i]).FMarkList = FMarkList then
|
||||
inc(j);
|
||||
dec(i);
|
||||
end;
|
||||
Result := j > 1;
|
||||
end;
|
||||
|
||||
procedure TCustomSynEdit.RecreateMarkList;
|
||||
var
|
||||
s: TSynEditBase;
|
||||
begin
|
||||
DestroyMarkList;
|
||||
|
||||
if (TSynEditStringList(FLines).AttachedSynEditCount > 1) and
|
||||
(eosShareMarks in FShareOptions)
|
||||
then begin
|
||||
s := TSynEditStringList(FLines).AttachedSynEdits[0];
|
||||
if s = Self then
|
||||
s := TSynEditStringList(FLines).AttachedSynEdits[1];
|
||||
FMarkList := TSynEdit(s).FMarkList;
|
||||
TSynEditMarkListInternal(fMarkList).AddOwnerEdit(Self);
|
||||
end
|
||||
else
|
||||
FMarkList := TSynEditMarkListInternal.Create(self, FTheLinesView);
|
||||
|
||||
FMarkList.RegisterChangeHandler({$IFDEF FPC}@{$ENDIF}MarkListChange,
|
||||
[low(TSynEditMarkChangeReason)..high(TSynEditMarkChangeReason)]);
|
||||
end;
|
||||
|
||||
procedure TCustomSynEdit.DestroyMarkList;
|
||||
var
|
||||
it: TSynEditMarkIterator;
|
||||
s: TSynEditBase;
|
||||
begin
|
||||
if FMarkList = nil then
|
||||
exit;
|
||||
|
||||
TSynEditMarkListInternal(fMarkList).RemoveOwnerEdit(Self);
|
||||
|
||||
if IsMarkListShared then begin
|
||||
s := TSynEditStringList(FLines).AttachedSynEdits[0];
|
||||
if s = Self then
|
||||
s := TSynEditStringList(FLines).AttachedSynEdits[1];
|
||||
|
||||
if TSynEditMarkListInternal(FMarkList).LinesView = FTheLinesView then
|
||||
TSynEditMarkListInternal(FMarkList).LinesView := TSynEdit(s).FTheLinesView;
|
||||
|
||||
FMarkList.UnRegisterChangeHandler({$IFDEF FPC}@{$ENDIF}MarkListChange);
|
||||
|
||||
it := TSynEditMarkIterator.Create(FMarkList);
|
||||
it.GotoBOL;
|
||||
while it.Next do begin
|
||||
// Todo: prevent notifications
|
||||
if it.Mark.OwnerEdit = Self then
|
||||
it.Mark.OwnerEdit := s;
|
||||
end;
|
||||
it.Free;
|
||||
FMarkList := nil;
|
||||
end
|
||||
else
|
||||
FreeAndNil(FMarkList);
|
||||
end;
|
||||
|
||||
procedure TCustomSynEdit.ShareTextBufferFrom(AShareEditor: TCustomSynEdit);
|
||||
var
|
||||
OldBuffer: TSynEditStringList;
|
||||
@ -5226,6 +5358,9 @@ begin
|
||||
ChangeTextBuffer(TSynEditStringList(AShareEditor.FLines));
|
||||
TSynEditStringList(FLines).AttachSynEdit(Self);
|
||||
|
||||
// lost the textbuffer, all marks are invalidate
|
||||
RecreateMarkList;
|
||||
|
||||
OldBuffer.DetachSynEdit(Self);
|
||||
if OldBuffer.AttachedSynEditCount = 0 then
|
||||
OldBuffer.Free;
|
||||
@ -5239,6 +5374,9 @@ begin
|
||||
|
||||
TSynEditStringList(FLines).DetachSynEdit(Self);
|
||||
ChangeTextBuffer(TSynEditStringList.Create);
|
||||
|
||||
// got a new empty textbuffer, all marks are invalidate
|
||||
RecreateMarkList;
|
||||
end;
|
||||
|
||||
procedure TCustomSynEdit.RemoveHandlers(ALines: TSynEditStrings = nil);
|
||||
@ -5325,7 +5463,6 @@ begin
|
||||
if (BookMark in [0..9]) and assigned(fBookMarks[BookMark]) then begin
|
||||
FMarkList.Remove(fBookMarks[Bookmark]);
|
||||
fBookMarks[BookMark].Free;
|
||||
fBookMarks[BookMark] := nil;
|
||||
end
|
||||
end;
|
||||
|
||||
@ -5375,8 +5512,7 @@ begin
|
||||
ClearBookmark(i);
|
||||
if assigned(fBookMarks[BookMark]) then
|
||||
ClearBookmark(BookMark);
|
||||
fBookMarks[BookMark] := mark;
|
||||
FMarkList.Add(fBookMarks[BookMark]);
|
||||
FMarkList.Add(mark);
|
||||
end;
|
||||
end;
|
||||
|
||||
@ -6513,10 +6649,14 @@ end;
|
||||
|
||||
procedure TCustomSynEdit.MarkListChange(Sender: TSynEditMark; Changes: TSynEditMarkChangeReasons);
|
||||
begin
|
||||
if (smcrAdded in Changes) and Sender.IsBookmark and Assigned(FOnPlaceMark) then
|
||||
if (smcrAdded in Changes) and Sender.IsBookmark and Assigned(FOnPlaceMark) then begin
|
||||
fBookMarks[Sender.BookmarkNumber] := Sender;
|
||||
FOnPlaceMark(Self, Sender);
|
||||
if (smcrRemoved in Changes) and Sender.IsBookmark and Assigned(fOnClearMark) then
|
||||
end;
|
||||
if (smcrRemoved in Changes) and Sender.IsBookmark and Assigned(fOnClearMark) then begin
|
||||
fBookMarks[Sender.BookmarkNumber] := nil;
|
||||
FOnClearMark(Self, Sender);
|
||||
end;
|
||||
|
||||
if (not Sender.Visible) and (not (smcrVisible in Changes)) then
|
||||
exit;
|
||||
@ -8687,6 +8827,28 @@ begin
|
||||
TStatusChangeEvent(FItems[i].FHandler)(Sender, Changes);
|
||||
end;
|
||||
|
||||
{ TSynEditMarkListInternal }
|
||||
|
||||
function TSynEditMarkListInternal.GetLinesView: TSynEditStrings;
|
||||
begin
|
||||
Result := FLines;
|
||||
end;
|
||||
|
||||
procedure TSynEditMarkListInternal.SetLinesView(const AValue: TSynEditStrings);
|
||||
begin
|
||||
FLines := AValue;
|
||||
end;
|
||||
|
||||
procedure TSynEditMarkListInternal.AddOwnerEdit(AEdit: TSynEditBase);
|
||||
begin
|
||||
FOwnerList.Add(AEdit);
|
||||
end;
|
||||
|
||||
procedure TSynEditMarkListInternal.RemoveOwnerEdit(AEdit: TSynEditBase);
|
||||
begin
|
||||
FOwnerList.Remove(AEdit);
|
||||
end;
|
||||
|
||||
initialization
|
||||
InitSynDefaultFont;
|
||||
SynDefaultBeautifier := TSynBeautifier.Create(Application);
|
||||
|
@ -10,7 +10,7 @@ uses
|
||||
const
|
||||
// Max number of book/gutter marks returned from GetEditMarksForLine - that
|
||||
// really should be enough.
|
||||
maxMarks = 16 deprecated;
|
||||
maxMarks = 16;// deprecated;
|
||||
|
||||
type
|
||||
|
||||
@ -49,9 +49,11 @@ type
|
||||
FMarkList: TSynEditMarkList;
|
||||
FLine: Integer; // Only valid, if not part of a TSynEditMarkLine
|
||||
FOldLine: integer;
|
||||
FOwnerEdit: TSynEditBase;
|
||||
function GetLine: integer;
|
||||
procedure SetMarkLine(const AValue: TSynEditMarkLine);
|
||||
procedure SetMarkList(const AValue: TSynEditMarkList);
|
||||
procedure SetOwnerEdit(const AValue: TSynEditBase);
|
||||
protected
|
||||
FColumn, FImage, FPriority: Integer;
|
||||
FVisible: boolean;
|
||||
@ -78,6 +80,7 @@ type
|
||||
constructor Create(ASynEdit: TSynEditBase);
|
||||
destructor Destroy; override;
|
||||
|
||||
property OwnerEdit: TSynEditBase read FOwnerEdit write SetOwnerEdit;
|
||||
property Line: integer read GetLine write SetLine;
|
||||
property OldLine: integer read FOldLine;
|
||||
property Column: integer read FColumn write SetColumn;
|
||||
@ -213,6 +216,7 @@ type
|
||||
function GetMarkLine(LineNum: Integer): TSynEditMarkLine;
|
||||
protected
|
||||
FLines: TSynEditStrings;
|
||||
FOwnerList: TFPList;
|
||||
FMarkLines: TSynEditMarkLineList;
|
||||
fOnChange: TNotifyEvent;
|
||||
FChangeHandlers: TSynEditMarkChangedHandlerList;
|
||||
@ -223,6 +227,7 @@ type
|
||||
procedure Put(Index: Integer; Item: TSynEditMark);
|
||||
procedure DoLinesEdited(Sender: TSynEditStrings; aLinePos, aBytePos, aCount,
|
||||
aLineBrkCnt: Integer; aText: String);
|
||||
function HasOwnerEdit(AEdit: TSynEditBase): Boolean;
|
||||
public
|
||||
constructor Create(AOwner: TSynEditBase; ALines: TSynEditStrings);
|
||||
destructor Destroy; override;
|
||||
@ -243,7 +248,7 @@ type
|
||||
procedure Place(Mark: TSynEditMark); deprecated {$IFDEF VER2_5}'use add instead / to be removed after 0.9.30'{$ENDIF};
|
||||
|
||||
procedure GetMarksForLine(line: integer; BookmarksFirst: Boolean; var Marks: TSynEditMarks);
|
||||
deprecated {$IFDEF VER2_5}'need replacment'{$ENDIF};
|
||||
deprecated {$IFDEF VER2_5}'use property Line'{$ENDIF};
|
||||
procedure ClearLine(line: integer);
|
||||
|
||||
procedure RegisterChangeHandler(Handler: TSynEditMarkChangeEvent; Filter: TSynEditMarkChangeReasons);
|
||||
@ -344,6 +349,16 @@ begin
|
||||
DoChange([smcrAdded]);
|
||||
end;
|
||||
|
||||
procedure TSynEditMark.SetOwnerEdit(const AValue: TSynEditBase);
|
||||
begin
|
||||
if FOwnerEdit = AValue then exit;
|
||||
if (AValue = nil) or (FMarkList = nil) or
|
||||
(not FMarkList.HasOwnerEdit(AValue))
|
||||
then
|
||||
raise Exception.Create('Invalid Owner');
|
||||
FOwnerEdit := AValue;
|
||||
end;
|
||||
|
||||
function TSynEditMark.GetLine: integer;
|
||||
begin
|
||||
if FMarkLine <> nil then
|
||||
@ -434,6 +449,7 @@ end;
|
||||
constructor TSynEditMark.Create(ASynEdit: TSynEditBase);
|
||||
begin
|
||||
inherited Create;
|
||||
FOwnerEdit := ASynEdit;
|
||||
FBookmarkNum := -1;
|
||||
FPriority := 0;
|
||||
end;
|
||||
@ -442,8 +458,11 @@ destructor TSynEditMark.Destroy;
|
||||
begin
|
||||
if FMarkList <> nil then begin
|
||||
DoChange([smcrRemoved]);
|
||||
FMarkList.Remove(self);
|
||||
end;
|
||||
FMarkList.Remove(self); // includes MarkLine
|
||||
end
|
||||
else
|
||||
if FMarkLine <> nil then
|
||||
FMarkLine.Remove(Self);
|
||||
inherited Destroy;
|
||||
end;
|
||||
|
||||
@ -627,7 +646,7 @@ end;
|
||||
|
||||
procedure TSynEditMarkLine.Delete(Index: Integer);
|
||||
begin
|
||||
Items[Index].MarkLine := Self;
|
||||
Items[Index].MarkLine := nil;
|
||||
FMarks.Delete(Index);
|
||||
ChangeSize;
|
||||
end;
|
||||
@ -646,10 +665,11 @@ begin
|
||||
while Count > 0 do begin
|
||||
if FreeMarks then begin
|
||||
Items[0].MarkList := nil; // stop destroy from removing item from list
|
||||
Items[0].FMarkLine := nil; // stop destroy from removing item from self
|
||||
Items[0].Free
|
||||
end else
|
||||
Items[0].MarkLine := nil;
|
||||
Delete(0);
|
||||
FMarks.Delete(0);
|
||||
end;
|
||||
finally
|
||||
dec(FLockChangeSize);
|
||||
@ -967,6 +987,8 @@ end;
|
||||
|
||||
constructor TSynEditMarkList.Create(AOwner: TSynEditBase; ALines: TSynEditStrings);
|
||||
begin
|
||||
FOwnerList := TFPList.Create;
|
||||
FOwnerList.Add(AOwner);
|
||||
FMarkLines := TSynEditMarkLineList.Create(Self);
|
||||
FChangeHandlers := TSynEditMarkChangedHandlerList.Create;
|
||||
inherited Create;
|
||||
@ -983,6 +1005,7 @@ begin
|
||||
FreeAndNil(FMarkLines); // will free all Marks
|
||||
FreeAndNil(FChangeHandlers);
|
||||
FreeAndNil(FInternalIterator);
|
||||
FreeAndNil(FOwnerList);
|
||||
end;
|
||||
|
||||
{$IFDEF SynDebug}
|
||||
@ -1153,6 +1176,11 @@ begin
|
||||
|
||||
end;
|
||||
|
||||
function TSynEditMarkList.HasOwnerEdit(AEdit: TSynEditBase): Boolean;
|
||||
begin
|
||||
Result := FOwnerList.IndexOf(AEdit) >= 0;
|
||||
end;
|
||||
|
||||
function TSynEditMarkList.Remove(Item: TSynEditMark): Integer;
|
||||
begin
|
||||
Item.MarkList := nil;
|
||||
@ -1266,6 +1294,7 @@ begin
|
||||
FCurrentIndex := 0;
|
||||
FBOL := FCurrentItem = nil;
|
||||
FEOL := FCurrentItem = nil;
|
||||
Result := FCurrentItem <> nil;
|
||||
end;
|
||||
|
||||
function TSynEditMarkIterator.Last: Boolean;
|
||||
@ -1280,6 +1309,7 @@ begin
|
||||
FCurrentIndex := -1;
|
||||
FBOL := FCurrentItem = nil;
|
||||
FEOL := FCurrentItem = nil;
|
||||
Result := FCurrentItem <> nil;
|
||||
end;
|
||||
|
||||
function TSynEditMarkIterator.Next: Boolean;
|
||||
|
@ -59,8 +59,7 @@ uses
|
||||
// IDE units
|
||||
IDEDialogs, LazarusIDEStrConsts, IDECommands, EditorOptions,
|
||||
WordCompletion, FindReplaceDialog, IDEProcs, IDEOptionDefs,
|
||||
MacroPromptDlg, TransferMacros, CodeContextForm, SrcEditHintFrm,
|
||||
EnvironmentOpts, MsgView, InputHistory, CodeMacroPrompt,
|
||||
MacroPromptDlg, TransferMacros, CodeContextForm, SrcEditHintFrm, MsgView, InputHistory, CodeMacroPrompt,
|
||||
CodeTemplatesDlg, CodeToolsOptions,
|
||||
SortSelectionDlg, EncloseSelectionDlg, ConDef, InvertAssignTool,
|
||||
SourceEditProcs, SourceMarks, CharacterMapDlg, SearchFrm,
|
||||
@ -150,17 +149,19 @@ type
|
||||
|
||||
{ TSourceEditorSharedValues }
|
||||
|
||||
TSourceEditorSharedValues = class
|
||||
TSourceEditorSharedValues = class(TSourceEditorSharedValuesBase)
|
||||
private
|
||||
FSharedEditorList: TFPList; // list of TSourceEditor sharing one TSynEdit
|
||||
function GetOtherSharedEditors(Caller: TSourceEditor; Index: Integer): TSourceEditor;
|
||||
function GetSharedEditors(Index: Integer): TSourceEditor;
|
||||
function SynEditor: TIDESynEditor;
|
||||
protected
|
||||
function GetSharedEditorsBase(Index: Integer): TSourceEditorBase; override;
|
||||
public
|
||||
procedure AddSharedEditor(AnEditor: TSourceEditor);
|
||||
procedure RemoveSharedEditor(AnEditor: TSourceEditor);
|
||||
procedure SetActiveSharedEditor(AnEditor: TSourceEditor);
|
||||
function SharedEditorCount: Integer;
|
||||
function SharedEditorCount: Integer; override;
|
||||
function OtherSharedEditorCount: Integer;
|
||||
property SharedEditors[Index: Integer]: TSourceEditor read GetSharedEditors;
|
||||
property OtherSharedEditors[Caller: TSourceEditor; Index: Integer]: TSourceEditor
|
||||
@ -197,8 +198,6 @@ type
|
||||
function NeedsUpdateCodeBuffer: boolean;
|
||||
procedure UpdateCodeBuffer;
|
||||
property CodeBuffer: TCodeBuffer read FCodeBuffer write SetCodeBuffer;
|
||||
protected
|
||||
BookmarkEventLock: Integer;
|
||||
public
|
||||
constructor Create;
|
||||
destructor Destroy; override;
|
||||
@ -208,7 +207,7 @@ type
|
||||
TSourceEditor is the class that controls access for a single source editor,
|
||||
which is part of TSourceNotebook. }
|
||||
|
||||
TSourceEditor = class(TSourceEditorInterface)
|
||||
TSourceEditor = class(TSourceEditorBase)
|
||||
private
|
||||
//FAOwner is normally a TSourceNotebook. This is set in the Create constructor.
|
||||
FAOwner: TComponent;
|
||||
@ -321,6 +320,7 @@ type
|
||||
|
||||
function Manager: TSourceEditorManager;
|
||||
property Visible: Boolean read FVisible write SetVisible default False;
|
||||
function GetSharedValues: TSourceEditorSharedValuesBase; override;
|
||||
function IsSharedWith(AnOtherEditor: TSourceEditor): Boolean;
|
||||
procedure BeforeCodeBufferReplace;
|
||||
procedure AfterCodeBufferReplace;
|
||||
@ -1024,7 +1024,6 @@ type
|
||||
procedure OnWordCompletionGetSource(var Source: TStrings; SourceIndex: integer);
|
||||
procedure OnSourceCompletionTimer(Sender: TObject);
|
||||
// marks
|
||||
function OnSourceMarksGetSourceEditorID(ASrcEdit: TSourceEditorInterface): TObject;
|
||||
function OnSourceMarksGetFilename(ASourceEditor: TObject): string;
|
||||
procedure OnSourceMarksAction(AMark: TSourceMark; AAction: TMarksAction);
|
||||
property CodeTemplateModul: TSynEditAutoComplete
|
||||
@ -1994,6 +1993,11 @@ begin
|
||||
Result := SharedEditors[0].FEditor;
|
||||
end;
|
||||
|
||||
function TSourceEditorSharedValues.GetSharedEditorsBase(Index: Integer): TSourceEditorBase;
|
||||
begin
|
||||
Result := TSourceEditorBase(FSharedEditorList[Index]);
|
||||
end;
|
||||
|
||||
procedure TSourceEditorSharedValues.SetCodeBuffer(const AValue: TCodeBuffer);
|
||||
var
|
||||
i: Integer;
|
||||
@ -2275,7 +2279,6 @@ end;
|
||||
constructor TSourceEditorSharedValues.Create;
|
||||
begin
|
||||
FSharedEditorList := TFPList.Create;
|
||||
BookmarkEventLock := 0;
|
||||
FExecutionLine:=-1;
|
||||
FExecutionMark := nil;
|
||||
FMarksRequested := False;
|
||||
@ -2284,10 +2287,11 @@ end;
|
||||
|
||||
destructor TSourceEditorSharedValues.Destroy;
|
||||
begin
|
||||
SourceEditorMarks.DeleteAllForEditorID(Self);
|
||||
CodeBuffer := nil;
|
||||
FreeAndNil(FSharedEditorList);
|
||||
// no need to care about ExecutionMark, it was removed in EditorClose
|
||||
// via: SourceEditorMarks.DeleteAllForEditor(Self);
|
||||
// no need to care about ExecutionMark, it is removed with all other marks,
|
||||
// if the last SynEdit is destroyed (TSynEditMark.Destroy will free the SourceMark)
|
||||
inherited Destroy;
|
||||
end;
|
||||
|
||||
@ -2298,8 +2302,6 @@ end;
|
||||
and the AParent is usually a page of a @link(TPageControl) }
|
||||
constructor TSourceEditor.Create(AOwner: TComponent; AParent: TWinControl;
|
||||
ASharedEditor: TSourceEditor = nil);
|
||||
var
|
||||
i: Integer;
|
||||
Begin
|
||||
if ASharedEditor = nil then
|
||||
FSharedValues := TSourceEditorSharedValues.Create
|
||||
@ -2328,20 +2330,6 @@ Begin
|
||||
PageName := ASharedEditor.PageName;
|
||||
FEditor.ShareTextBufferFrom(ASharedEditor.EditorComponent);
|
||||
FEditor.Highlighter := ASharedEditor.EditorComponent.Highlighter;
|
||||
|
||||
// bookmakrs
|
||||
inc(FSharedValues.BookmarkEventLock);
|
||||
try
|
||||
for i := 0 to ASharedEditor.FEditor.Marks.Count - 1 do
|
||||
if ASharedEditor.FEditor.Marks[i].IsBookmark then
|
||||
FEditor.SetBookMark(ASharedEditor.FEditor.Marks[i].BookmarkNumber,
|
||||
ASharedEditor.FEditor.Marks[i].Column,
|
||||
ASharedEditor.FEditor.Marks[i].Line);
|
||||
finally
|
||||
dec(FSharedValues.BookmarkEventLock);
|
||||
end;
|
||||
|
||||
SourceEditorMarks.AddSourceEditor(Self, ASharedEditor);
|
||||
end;
|
||||
|
||||
FEditPlugin := TSynEditPlugin1.Create(FEditor);
|
||||
@ -2356,8 +2344,6 @@ begin
|
||||
UnbindEditor;
|
||||
FEditor.Visible:=false;
|
||||
FEditor.Parent:=nil;
|
||||
if SourceEditorMarks<>nil then
|
||||
SourceEditorMarks.DeleteAllForEditor(Self);
|
||||
TSourceNotebook(FAOwner).ReleaseEditor(self);
|
||||
// free the synedit control after processing the events
|
||||
Application.ReleaseComponent(FEditor);
|
||||
@ -2715,6 +2701,11 @@ begin
|
||||
Result := nil;
|
||||
end;
|
||||
|
||||
function TSourceEditor.GetSharedValues: TSourceEditorSharedValuesBase;
|
||||
begin
|
||||
Result := FSharedValues;
|
||||
end;
|
||||
|
||||
function TSourceEditor.IsSharedWith(AnOtherEditor: TSourceEditor): Boolean;
|
||||
begin
|
||||
Result := (AnOtherEditor <> nil) and
|
||||
@ -4167,7 +4158,6 @@ Begin
|
||||
Result := True;
|
||||
Visible := False;
|
||||
Manager.EditorRemoved(Self);
|
||||
SourceEditorMarks.DeleteAllForEditor(Self);
|
||||
UnbindEditor;
|
||||
FEditor.Parent:=nil;
|
||||
if FSharedValues.SharedEditorCount = 1 then
|
||||
@ -4283,35 +4273,14 @@ end;
|
||||
|
||||
procedure TSourceEditor.EditorPlaceBookmark(Sender: TObject;
|
||||
var Mark: TSynEditMark);
|
||||
var
|
||||
i: Integer;
|
||||
begin
|
||||
if FSharedValues.BookmarkEventLock > 0 then exit;
|
||||
inc(FSharedValues.BookmarkEventLock);
|
||||
try
|
||||
for i := 0 to FSharedValues.OtherSharedEditorCount -1 do
|
||||
FSharedValues.OtherSharedEditors[Self, i].EditorComponent.SetBookMark
|
||||
(Mark.BookmarkNumber, Mark.Column, Mark.Line);
|
||||
finally
|
||||
dec(FSharedValues.BookmarkEventLock);
|
||||
end;
|
||||
if Assigned(Manager) and Assigned(Manager.OnPlaceBookmark) then
|
||||
Manager.OnPlaceBookmark(Self, Mark);
|
||||
end;
|
||||
|
||||
procedure TSourceEditor.EditorClearBookmark(Sender: TObject;
|
||||
var Mark: TSynEditMark);
|
||||
var
|
||||
i: Integer;
|
||||
begin
|
||||
if FSharedValues.BookmarkEventLock > 0 then exit;
|
||||
inc(FSharedValues.BookmarkEventLock);
|
||||
try
|
||||
for i := 0 to FSharedValues.OtherSharedEditorCount -1 do
|
||||
FSharedValues.OtherSharedEditors[Self, i].EditorComponent.ClearBookMark(Mark.BookmarkNumber);
|
||||
finally
|
||||
dec(FSharedValues.BookmarkEventLock);
|
||||
end;
|
||||
if Assigned(Manager) and Assigned(Manager.OnClearBookmark) then
|
||||
Manager.OnClearBookmark(Self, Mark);
|
||||
end;
|
||||
@ -4884,6 +4853,12 @@ begin
|
||||
Manager.RemoveWindow(Self);
|
||||
DisableAutoSizing{$IFDEF DebugDisableAutoSizing}('TSourceNotebook.Destroy'){$ENDIF};
|
||||
FProcessingCommand:=false;
|
||||
|
||||
SourceEditorMarks.OnGetFilename := nil;
|
||||
SourceEditorMarks.OnAction := nil;
|
||||
// aWordCompletion is released in InternalFinal
|
||||
aWordCompletion.OnGetSource := nil;
|
||||
|
||||
for i:=FSourceEditorList.Count-1 downto 0 do
|
||||
Editors[i].Free;
|
||||
FKeyStrokes.Free;
|
||||
@ -8892,12 +8867,6 @@ begin
|
||||
end;
|
||||
end;
|
||||
|
||||
function TSourceEditorManager.OnSourceMarksGetSourceEditorID(
|
||||
ASrcEdit: TSourceEditorInterface): TObject;
|
||||
begin
|
||||
Result := TSourceEditor(ASrcEdit).FSharedValues;
|
||||
end;
|
||||
|
||||
function TSourceEditorManager.OnSourceMarksGetFilename(ASourceEditor: TObject
|
||||
): string;
|
||||
begin
|
||||
@ -8910,18 +8879,11 @@ procedure TSourceEditorManager.OnSourceMarksAction(AMark: TSourceMark;
|
||||
AAction: TMarksAction);
|
||||
var
|
||||
Editor: TSourceEditor;
|
||||
i: Integer;
|
||||
begin
|
||||
Editor := TSourceEditor(AMark.SourceEditor);
|
||||
if Editor = nil then
|
||||
Exit;
|
||||
|
||||
if AAction = maAdded then begin
|
||||
for i := 0 to Editor.FSharedValues.SharedEditorCount - 1 do
|
||||
if not AMark.HasSourceEditor(Editor.FSharedValues.SharedEditors[i]) then
|
||||
AMark.AddSourceEditor(Editor.FSharedValues.SharedEditors[i]);
|
||||
end;
|
||||
|
||||
if ( AMark.IsBreakPoint and (Editor.FSharedValues.ExecutionMark <> nil) and
|
||||
(AMark.Line = Editor.ExecutionLine)
|
||||
) or (AMark = Editor.FSharedValues.ExecutionMark)
|
||||
@ -8962,7 +8924,6 @@ begin
|
||||
|
||||
// marks
|
||||
SourceEditorMarks:=TSourceMarks.Create(Self);
|
||||
SourceEditorMarks.OnGetSourceEditorID := @OnSourceMarksGetSourceEditorID;
|
||||
SourceEditorMarks.OnGetFilename:=@OnSourceMarksGetFilename;
|
||||
SourceEditorMarks.OnAction:=@OnSourceMarksAction;
|
||||
|
||||
|
@ -38,79 +38,37 @@ unit SourceMarks;
|
||||
interface
|
||||
|
||||
uses
|
||||
Classes, SysUtils, LCLProc, LResources, Graphics, GraphType, Controls, Menus,
|
||||
AVL_Tree, FileProcs, SynEdit, SynEditMarks,
|
||||
MenuIntf, SrcEditorIntf,
|
||||
IDEProcs, EditorOptions;
|
||||
Classes, SysUtils, Graphics, Controls, MenuIntf, LCLProc,
|
||||
AVL_Tree, SrcEditorIntf, SynEdit, SynEditMarks, EditorOptions;
|
||||
|
||||
type
|
||||
|
||||
TSourceEditorBase = class;
|
||||
|
||||
{ TSourceEditorSharedValuesBase }
|
||||
|
||||
TSourceEditorSharedValuesBase = class
|
||||
protected
|
||||
function GetSharedEditorsBase(Index: Integer): TSourceEditorBase; virtual abstract;
|
||||
function SharedEditorCount: Integer; virtual; abstract;
|
||||
end;
|
||||
|
||||
{ TSourceEditorBase }
|
||||
|
||||
TSourceEditorBase = class(TSourceEditorInterface)
|
||||
protected
|
||||
function GetSharedValues: TSourceEditorSharedValuesBase; virtual; abstract;
|
||||
end;
|
||||
|
||||
TSourceMarks = class;
|
||||
TSourceMark = class;
|
||||
|
||||
{ TSourceSynMark }
|
||||
|
||||
TSourceSynMark = class(TSynEditMark)
|
||||
private
|
||||
FSourceEditor: TSourceEditorInterface;
|
||||
FSourceMark: TSourceMark;
|
||||
FSynEdit: TSynEdit;
|
||||
FOnChange: TNotifyEvent;
|
||||
FChangeLock2: Integer;
|
||||
protected
|
||||
procedure DoChange(AChanges: TSynEditMarkChangeReasons); override;
|
||||
property OnChange: TNotifyEvent read FOnChange write FOnChange;
|
||||
procedure Assign(Src: TSourceSynMark);
|
||||
public
|
||||
constructor Create(AOwner: TSourceMark; AEditor: TSourceEditorInterface);
|
||||
destructor Destroy; override;
|
||||
function GetEdit: TSynEdit;
|
||||
property SourceMark: TSourceMark read FSourceMark write FSourceMark;
|
||||
end;
|
||||
|
||||
{ TSourceSynMarkList }
|
||||
|
||||
TSourceSynMarkList = class(TFPList)
|
||||
private
|
||||
FOnChange: TNotifyEvent;
|
||||
function GetColumn: integer;
|
||||
function GetImageIndex: integer;
|
||||
function GetLine: integer;
|
||||
function GetPriority: integer;
|
||||
function GetSM(Index: Integer): TSourceSynMark;
|
||||
function GetVisible: boolean;
|
||||
procedure PutSM(Index: Integer; const AValue: TSourceSynMark);
|
||||
procedure SetColumn(const AValue: integer);
|
||||
procedure SetImageIndex(const AValue: integer);
|
||||
procedure SetLine(const AValue: integer);
|
||||
procedure SetPriority(const AValue: integer);
|
||||
procedure SetVisible(const AValue: boolean);
|
||||
public
|
||||
function Add(Item: TSourceSynMark): Integer;
|
||||
property Items[Index: Integer]: TSourceSynMark read GetSM write PutSM; default;
|
||||
property OnChange: TNotifyEvent read FOnChange write FOnChange;
|
||||
procedure DoChange(AChanges: TSynEditMarkChangeReasons);
|
||||
procedure DeleteWithSourceEditor(ASrcEditor: TSourceEditorInterface);
|
||||
function IndexOfSourceEditor(AEditor: TSourceEditorInterface): Integer;
|
||||
procedure IncChangeLock;
|
||||
procedure DecChangeLock;
|
||||
public
|
||||
property Line: integer read GetLine write SetLine;
|
||||
property Column: integer read GetColumn write SetColumn;
|
||||
property Priority: integer read GetPriority write SetPriority;
|
||||
property ImageIndex: integer read GetImageIndex write SetImageIndex;
|
||||
property Visible: boolean read GetVisible write SetVisible;
|
||||
//property BookmarkNumber: integer read FBookmarkNum write fBookmarkNum;
|
||||
//property InternalImage: boolean read FInternalImage write SetInternalImage;
|
||||
//property IsBookmark: boolean read GetIsBookmark;
|
||||
end;
|
||||
|
||||
{ TSourceMark }
|
||||
|
||||
TGetSourceMarkHintEvent =
|
||||
procedure(SenderMark: TSourceMark; var Hint: string) of object;
|
||||
TCreateSourceMarkPopupMenuEvent =
|
||||
procedure(SenderMark: TSourceMark;
|
||||
const AddMenuItem: TAddMenuItemProc) of object;
|
||||
TGetFilenameEvent = function(ASourceEditor: TObject): string of object;
|
||||
|
||||
TSourceMarkHandler = (
|
||||
smhPositionChanged,
|
||||
@ -118,15 +76,42 @@ type
|
||||
smhGetHint,
|
||||
smhCreatePopupMenu
|
||||
);
|
||||
|
||||
|
||||
TMarksAction = (maAdded, maRemoved, maChanged);
|
||||
TMarksActionEvent = procedure(AMark: TSourceMark; Action: TMarksAction) of object;
|
||||
|
||||
|
||||
{ TSourceSynMark }
|
||||
|
||||
TSourceSynMark = class(TSynEditMark)
|
||||
private
|
||||
FOnChange: TNotifyEvent;
|
||||
protected
|
||||
FSourceMark: TSourceMark;
|
||||
IsDestroying: Boolean;
|
||||
procedure DoChange(AChanges: TSynEditMarkChangeReasons); override;
|
||||
property OnChange: TNotifyEvent read FOnChange write FOnChange;
|
||||
public
|
||||
constructor Create(AOwner: TSourceMark; ASynEditor: TSynEdit);
|
||||
destructor Destroy; override;
|
||||
property SourceMark: TSourceMark read FSourceMark write FSourceMark;
|
||||
end;
|
||||
|
||||
{ TSourceMark }
|
||||
|
||||
TSourceMark = class
|
||||
private
|
||||
FSourceMarks: TSourceMarks;
|
||||
FSourceEditorID: TObject;
|
||||
FSynMarks: TSourceSynMarkList;
|
||||
FSynMarkLock: Integer;
|
||||
FSynMark: TSourceSynMark;
|
||||
FData: TObject;
|
||||
FSourceMarks: TSourceMarks;
|
||||
FSourceEditorID: TSourceEditorSharedValuesBase;
|
||||
FHandlers: array[TSourceMarkHandler] of TMethodList;
|
||||
FSynMarkLock: Integer;
|
||||
function GetSourceEditor: TSourceEditorBase;
|
||||
procedure SetSourceMarks(const AValue: TSourceMarks);
|
||||
procedure Changed;
|
||||
procedure SynMarkChanged(Sender: TObject);
|
||||
private
|
||||
FLine: integer;
|
||||
FColumn: integer;
|
||||
FImage: integer;
|
||||
@ -136,29 +121,23 @@ type
|
||||
FLineColorAttrib: TAdditionalHilightAttribute;
|
||||
FLineColorBackGround: TColor;
|
||||
FLineColorForeGround: TColor;
|
||||
function GetSourceEditor: TSourceEditorInterface;
|
||||
function GetSourceEditorID: TObject;
|
||||
procedure SetPriority(const AValue: integer);
|
||||
procedure SetSourceMarks(const AValue: TSourceMarks);
|
||||
procedure Changed;
|
||||
procedure SynMarkChanged(Sender: TObject);
|
||||
protected
|
||||
procedure AddHandler(HandlerType: TSourceMarkHandler;
|
||||
const Handler: TMethod);
|
||||
procedure DoPositionChanged; virtual;
|
||||
procedure DoLineUpdate(Force: Boolean = False); virtual;
|
||||
function EditorUpdateRequired: Boolean; virtual; // called to check if we need to update the editor if a property is changed
|
||||
procedure SetColumn(const Value: Integer); //override;
|
||||
procedure SetPriority(const AValue: integer);
|
||||
procedure SetColumn(const Value: Integer);
|
||||
procedure SetData(const AValue: TObject); virtual;
|
||||
procedure SetImage(const Value: Integer); //override;
|
||||
procedure SetImage(const Value: Integer);
|
||||
procedure SetIsBreakPoint(const AValue: boolean); virtual;
|
||||
procedure SetLine(const Value: Integer); //override;
|
||||
procedure SetLine(const Value: Integer);
|
||||
procedure SetLineColorAttrib(const AValue: TAdditionalHilightAttribute); virtual;
|
||||
procedure SetLineColorBackGround(const AValue: TColor); virtual;
|
||||
procedure SetLineColorForeGround(const AValue: TColor); virtual;
|
||||
procedure SetVisible(const AValue: boolean); //override;
|
||||
procedure SetVisible(const AValue: boolean);
|
||||
public
|
||||
constructor Create(TheOwner: TSourceEditorInterface; TheData: TObject);
|
||||
constructor Create(TheOwner: TSourceEditorBase; TheData: TObject);
|
||||
destructor Destroy; override;
|
||||
function Compare(OtherMark: TSourceMark): integer;
|
||||
function CompareEditorAndLine(ASrcEditID: TObject;
|
||||
@ -184,10 +163,8 @@ type
|
||||
// properties
|
||||
property Data: TObject read FData write SetData;
|
||||
property SourceMarks: TSourceMarks read FSourceMarks write SetSourceMarks;
|
||||
property SourceEditor: TSourceEditorInterface read GetSourceEditor;
|
||||
property SourceEditorID: TObject read GetSourceEditorID;
|
||||
function HasSourceEditor(AEditor: TSourceEditorInterface): Boolean;
|
||||
procedure AddSourceEditor(AEditor: TSourceEditorInterface);
|
||||
property SourceEditor: TSourceEditorBase read GetSourceEditor;
|
||||
property SourceEditorID: TSourceEditorSharedValuesBase read FSourceEditorID;
|
||||
public
|
||||
property LineColorAttrib: TAdditionalHilightAttribute read FLineColorAttrib
|
||||
write SetLineColorAttrib;
|
||||
@ -213,19 +190,12 @@ type
|
||||
|
||||
{ TSourceMarks }
|
||||
|
||||
//TGetSourceEditorEvent = function(ASynEdit: TCustomSynEdit): TSourceEditorInterface of object;
|
||||
TGetSourceEditorIDEvent = function(ASrcEdit: TSourceEditorInterface): TObject of object;
|
||||
TGetFilenameEvent = function(ASourceEditor: TObject): string of object;
|
||||
TMarksAction = (maAdded, maRemoved, maChanged);
|
||||
TMarksActionEvent = procedure(AMark: TSourceMark; Action: TMarksAction) of object;
|
||||
|
||||
TSourceMarks = class(TComponent)
|
||||
private
|
||||
fActiveBreakPointImg: Integer;
|
||||
FCurrentLineBreakPointImg: Integer;
|
||||
FCurrentLineImg: Integer;
|
||||
FCurrentLineDisabledBreakPointImg: Integer;
|
||||
FOnGetSourceEditorID: TGetSourceEditorIDEvent;
|
||||
FSourceLineImg: Integer;
|
||||
FImgList: TImageList;
|
||||
fInactiveBreakPointImg: Integer;
|
||||
@ -247,21 +217,21 @@ type
|
||||
destructor Destroy; override;
|
||||
function Count: integer;
|
||||
function Add(AMark: TSourceMark): integer;
|
||||
function Add(ASrcEdit: TSourceEditorInterface; ALine: integer): TSourceMark;
|
||||
function AddCustomMark(TheOwner: TSourceEditorInterface; Data: TObject;
|
||||
function Add(ASrcEdit: TSourceEditorBase; ALine: integer): TSourceMark;
|
||||
function AddCustomMark(TheOwner: TSourceEditorBase; Data: TObject;
|
||||
MarkClass: TSourceMarkClass): TSourceMark;
|
||||
function AddImage(const ResName: string): integer;
|
||||
function GetFilename(AMark: TSourceMark): string;
|
||||
procedure Clear;
|
||||
procedure Delete(Index: integer);
|
||||
procedure Remove(AMark: TSourceMark);
|
||||
procedure AddSourceEditor(ANewEditor, AExistingEditor: TSourceEditorInterface);
|
||||
procedure DeleteAllForEditor(ASrcEdit: TSourceEditorInterface);
|
||||
function FindFirstMark(ASrcEdit: TSourceEditorInterface;
|
||||
procedure DeleteAllForEditor(ASrcEdit: TSourceEditorBase);
|
||||
procedure DeleteAllForEditorID(ASrcEditID: TSourceEditorSharedValuesBase);
|
||||
function FindFirstMark(ASrcEdit: TSourceEditorBase;
|
||||
ALine: integer): TSourceMark;
|
||||
function FindBreakPointMark(ASrcEdit: TSourceEditorInterface;
|
||||
function FindBreakPointMark(ASrcEdit: TSourceEditorBase;
|
||||
ALine: integer): TSourceMark;
|
||||
procedure GetMarksForLine(ASrcEdit: TSourceEditorInterface; ALine: integer;
|
||||
procedure GetMarksForLine(ASrcEdit: TSourceEditorBase; ALine: integer;
|
||||
var Marks: PSourceMark; var MarkCount: integer);
|
||||
public
|
||||
property ImgList: TImageList read FImgList write FImgList;
|
||||
@ -269,8 +239,6 @@ type
|
||||
property OnGetFilename: TGetFilenameEvent read FOnGetFilename
|
||||
write FOnGetFilename;
|
||||
property OnAction: TMarksActionEvent read FOnAction write FOnAction;
|
||||
property OnGetSourceEditorID: TGetSourceEditorIDEvent
|
||||
read FOnGetSourceEditorID write FOnGetSourceEditorID;
|
||||
public
|
||||
// icon index
|
||||
property ActiveBreakPointImg: Integer read fActiveBreakPointImg;
|
||||
@ -289,8 +257,6 @@ type
|
||||
var
|
||||
SourceEditorMarks: TSourceMarks;
|
||||
|
||||
function CompareSourceMarks(Data1, Data2: Pointer): integer;
|
||||
|
||||
implementation
|
||||
|
||||
type
|
||||
@ -316,204 +282,31 @@ begin
|
||||
Result := -AMark.CompareEditorAndLine(EditorAndLine^.EditorID, EditorAndLine^.Line);
|
||||
end;
|
||||
|
||||
{ TSourceSynMark }
|
||||
|
||||
procedure TSourceSynMark.DoChange(AChanges: TSynEditMarkChangeReasons);
|
||||
begin
|
||||
inherited DoChange(AChanges);
|
||||
if FChangeLock2 > 0 then exit;
|
||||
if FChangeLock > 0 then exit;
|
||||
if assigned(FOnChange) then
|
||||
FOnChange(Self);
|
||||
end;
|
||||
|
||||
procedure TSourceSynMark.Assign(Src: TSourceSynMark);
|
||||
begin
|
||||
inc(FChangeLock2);
|
||||
IncChangeLock;
|
||||
try
|
||||
Line := Src.Line;
|
||||
Column := Src.Column;
|
||||
ImageIndex := Src.ImageIndex;
|
||||
Priority := Src.Priority;
|
||||
Visible := Src.Visible;
|
||||
InternalImage := Src.InternalImage;
|
||||
BookmarkNumber := Src.BookmarkNumber;
|
||||
finally
|
||||
DecChangeLock;
|
||||
dec(FChangeLock2);
|
||||
end;
|
||||
end;
|
||||
|
||||
constructor TSourceSynMark.Create(AOwner: TSourceMark; AEditor: TSourceEditorInterface);
|
||||
constructor TSourceSynMark.Create(AOwner: TSourceMark; ASynEditor: TSynEdit);
|
||||
begin
|
||||
FSourceMark := AOwner;
|
||||
FSourceEditor := AEditor;
|
||||
FSynEdit := TSynEdit(FSourceEditor.EditorControl);
|
||||
Inherited Create(FSynEdit);
|
||||
FChangeLock2 := 0;
|
||||
if FSynEdit <> nil then
|
||||
FSynEdit.Marks.Add(Self);
|
||||
Inherited Create(ASynEditor);
|
||||
if OwnerEdit <> nil then
|
||||
TSynEdit(OwnerEdit).Marks.Add(Self);
|
||||
end;
|
||||
|
||||
destructor TSourceSynMark.Destroy;
|
||||
begin
|
||||
if FSynEdit<>nil then
|
||||
FSynEdit.Marks.Remove(Self);
|
||||
IsDestroying := True;
|
||||
FreeAndNil(FSourceMark);
|
||||
inherited Destroy;
|
||||
end;
|
||||
|
||||
{ TSourceSynMarkList }
|
||||
|
||||
function TSourceSynMarkList.GetSM(Index: Integer): TSourceSynMark;
|
||||
begin
|
||||
Result := TSourceSynMark(Get(Index));
|
||||
end;
|
||||
|
||||
function TSourceSynMarkList.GetColumn: integer;
|
||||
begin
|
||||
if Count = 0 then
|
||||
Result := -1
|
||||
else
|
||||
Result := Items[0].Column;
|
||||
end;
|
||||
|
||||
function TSourceSynMarkList.GetImageIndex: integer;
|
||||
begin
|
||||
if Count = 0 then
|
||||
Result := -1
|
||||
else
|
||||
Result := Items[0].ImageIndex;
|
||||
end;
|
||||
|
||||
function TSourceSynMarkList.GetLine: integer;
|
||||
begin
|
||||
if Count = 0 then
|
||||
Result := -1
|
||||
else
|
||||
Result := Items[0].Line;
|
||||
end;
|
||||
|
||||
function TSourceSynMarkList.GetPriority: integer;
|
||||
begin
|
||||
if Count = 0 then
|
||||
Result := -1
|
||||
else
|
||||
Result := Items[0].Priority;
|
||||
end;
|
||||
|
||||
function TSourceSynMarkList.GetVisible: boolean;
|
||||
begin
|
||||
if Count = 0 then
|
||||
Result := False
|
||||
else
|
||||
Result := Items[0].Visible;
|
||||
end;
|
||||
|
||||
procedure TSourceSynMarkList.PutSM(Index: Integer; const AValue: TSourceSynMark
|
||||
);
|
||||
begin
|
||||
AValue.OnChange := FOnChange;
|
||||
Put(Index, AValue);
|
||||
end;
|
||||
|
||||
procedure TSourceSynMarkList.SetColumn(const AValue: integer);
|
||||
var
|
||||
i: Integer;
|
||||
begin
|
||||
for i := 0 to Count - 1 do
|
||||
Items[i].Column := AValue;
|
||||
end;
|
||||
|
||||
procedure TSourceSynMarkList.SetImageIndex(const AValue: integer);
|
||||
var
|
||||
i: Integer;
|
||||
begin
|
||||
for i := 0 to Count - 1 do
|
||||
Items[i].ImageIndex := AValue;
|
||||
end;
|
||||
|
||||
procedure TSourceSynMarkList.SetLine(const AValue: integer);
|
||||
var
|
||||
i: Integer;
|
||||
begin
|
||||
for i := 0 to Count - 1 do
|
||||
Items[i].Line := AValue;
|
||||
end;
|
||||
|
||||
procedure TSourceSynMarkList.SetPriority(const AValue: integer);
|
||||
var
|
||||
i: Integer;
|
||||
begin
|
||||
for i := 0 to Count - 1 do
|
||||
Items[i].Priority := AValue;
|
||||
end;
|
||||
|
||||
procedure TSourceSynMarkList.SetVisible(const AValue: boolean);
|
||||
var
|
||||
i: Integer;
|
||||
begin
|
||||
for i := 0 to Count - 1 do
|
||||
Items[i].Visible := AValue;
|
||||
end;
|
||||
|
||||
function TSourceSynMarkList.Add(Item: TSourceSynMark): Integer;
|
||||
begin
|
||||
Item.OnChange := FOnChange;
|
||||
Result := inherited Add(Item);
|
||||
end;
|
||||
|
||||
procedure TSourceSynMarkList.DoChange(AChanges: TSynEditMarkChangeReasons);
|
||||
var
|
||||
i: Integer;
|
||||
begin
|
||||
for i := 0 to Count - 1 do
|
||||
Items[i].DoChange(AChanges);
|
||||
end;
|
||||
|
||||
procedure TSourceSynMarkList.DeleteWithSourceEditor(
|
||||
ASrcEditor: TSourceEditorInterface);
|
||||
var
|
||||
i: Integer;
|
||||
begin
|
||||
i := Count - 1;
|
||||
while i >= 0 do begin
|
||||
if Items[i].FSourceEditor = ASrcEditor then begin
|
||||
Items[i].Free;
|
||||
Delete(i);
|
||||
end;
|
||||
dec(i);
|
||||
end;
|
||||
end;
|
||||
|
||||
function TSourceSynMarkList.IndexOfSourceEditor(AEditor: TSourceEditorInterface
|
||||
): Integer;
|
||||
begin
|
||||
Result := Count - 1;
|
||||
while (Result >= 0) and (Items[Result].FSourceEditor <> AEditor) do
|
||||
dec(Result);
|
||||
end;
|
||||
|
||||
procedure TSourceSynMarkList.IncChangeLock;
|
||||
var
|
||||
i: Integer;
|
||||
begin
|
||||
for i := 0 to Count - 1 do
|
||||
Items[i].IncChangeLock;
|
||||
end;
|
||||
|
||||
procedure TSourceSynMarkList.DecChangeLock;
|
||||
var
|
||||
i: Integer;
|
||||
begin
|
||||
for i := 0 to Count - 1 do
|
||||
Items[i].DecChangeLock;
|
||||
end;
|
||||
|
||||
{ TSourceSynMark }
|
||||
|
||||
function TSourceSynMark.GetEdit: TSynEdit;
|
||||
begin
|
||||
Result := FSynEdit;
|
||||
end;
|
||||
|
||||
{ TSourceMark }
|
||||
|
||||
procedure TSourceMark.SetSourceMarks(const AValue: TSourceMarks);
|
||||
@ -521,7 +314,6 @@ begin
|
||||
if FSourceMarks=AValue then exit;
|
||||
if FSourceMarks<>nil then
|
||||
FSourceMarks.Remove(Self);
|
||||
FSourceEditorID := nil;
|
||||
FSourceMarks := AValue;
|
||||
if AValue<>nil then
|
||||
AValue.Add(Self);
|
||||
@ -532,24 +324,15 @@ begin
|
||||
if FPriority = AValue then exit;
|
||||
FPriority := AValue;
|
||||
if FSynMarkLock = 0 then
|
||||
FSynMarks.Priority := AValue;
|
||||
FSynMark.Priority := AValue;
|
||||
end;
|
||||
|
||||
function TSourceMark.GetSourceEditorID: TObject;
|
||||
function TSourceMark.GetSourceEditor: TSourceEditorBase;
|
||||
begin
|
||||
if (FSourceEditorID = nil ) and (FSourceMarks <> nil) and
|
||||
(SourceEditor <> nil) and Assigned(FSourceMarks.OnGetSourceEditorID)
|
||||
then
|
||||
FSourceEditorID := FSourceMarks.OnGetSourceEditorID(SourceEditor);
|
||||
Result := FSourceEditorID;
|
||||
end;
|
||||
|
||||
function TSourceMark.GetSourceEditor: TSourceEditorInterface;
|
||||
begin
|
||||
if FSynMarks.Count = 0 then
|
||||
Result := nil
|
||||
if (FSourceEditorID <> nil) and (FSourceEditorID.SharedEditorCount > 0) then
|
||||
Result := FSourceEditorID.GetSharedEditorsBase(0)
|
||||
else
|
||||
Result := FSynMarks[0].FSourceEditor;
|
||||
Result := nil;
|
||||
end;
|
||||
|
||||
procedure TSourceMark.Changed;
|
||||
@ -608,7 +391,7 @@ begin
|
||||
if Visible = AValue then Exit;
|
||||
FVisible := AValue;
|
||||
if FSynMarkLock = 0 then
|
||||
FSynMarks.Visible := AValue;
|
||||
FSynMark.Visible := AValue;
|
||||
Changed;
|
||||
end;
|
||||
|
||||
@ -625,7 +408,7 @@ procedure TSourceMark.DoLineUpdate(Force: Boolean = False);
|
||||
begin
|
||||
if Line <= 0 then Exit;
|
||||
if Visible or Force then
|
||||
FSynMarks.DoChange([smcrChanged]);
|
||||
FSynMark.DoChange([smcrChanged]);
|
||||
end;
|
||||
|
||||
procedure TSourceMark.SetData(const AValue: TObject);
|
||||
@ -634,13 +417,6 @@ begin
|
||||
FData:=AValue;
|
||||
end;
|
||||
|
||||
function TSourceMark.EditorUpdateRequired: Boolean;
|
||||
begin
|
||||
Result := (FLineColorAttrib <> ahaNone)
|
||||
or (FLineColorBackGround <> clNone)
|
||||
or (FLineColorForeGround <> clNone);
|
||||
end;
|
||||
|
||||
procedure TSourceMark.AddHandler(HandlerType: TSourceMarkHandler;
|
||||
const Handler: TMethod);
|
||||
begin
|
||||
@ -656,7 +432,7 @@ begin
|
||||
if FSourceMarks<>nil then FSourceMarks.fSortedItems.Remove(Self);
|
||||
FColumn := Value;
|
||||
if FSynMarkLock = 0 then
|
||||
FSynMarks.Column := Value;
|
||||
FSynMark.Column := Value;
|
||||
if FSourceMarks<>nil then FSourceMarks.fSortedItems.Add(Self);
|
||||
DoPositionChanged;
|
||||
end;
|
||||
@ -666,7 +442,7 @@ begin
|
||||
if ImageIndex=Value then exit;
|
||||
FImage := Value;
|
||||
if FSynMarkLock = 0 then
|
||||
FSynMarks.ImageIndex := Value;
|
||||
FSynMark.ImageIndex := Value;
|
||||
Changed;
|
||||
end;
|
||||
|
||||
@ -676,18 +452,18 @@ begin
|
||||
if FSourceMarks<>nil then FSourceMarks.fSortedItems.Remove(Self);
|
||||
FLine := Value;
|
||||
if FSynMarkLock = 0 then
|
||||
FSynMarks.Line := Value;
|
||||
FSynMark.Line := Value;
|
||||
if FSourceMarks<>nil then FSourceMarks.fSortedItems.Add(Self);
|
||||
DoPositionChanged;
|
||||
Changed;
|
||||
end;
|
||||
|
||||
constructor TSourceMark.Create(TheOwner: TSourceEditorInterface; TheData: TObject);
|
||||
constructor TSourceMark.Create(TheOwner: TSourceEditorBase; TheData: TObject);
|
||||
begin
|
||||
FSourceEditorID := TheOwner.GetSharedValues;
|
||||
FSynMarkLock := 0;
|
||||
FSynMarks := TSourceSynMarkList.Create;
|
||||
FSynMarks.OnChange := @SynMarkChanged;
|
||||
FSynMarks.Add(TSourceSynMark.Create(Self, TheOwner));
|
||||
FSynMark := TSourceSynMark.Create(Self, TSynEdit(TheOwner.EditorControl));
|
||||
FSynMark.OnChange := @SynMarkChanged;
|
||||
FData:=TheData;
|
||||
FLineColorAttrib:=ahaNone;
|
||||
FLineColorBackGround:=clNone;
|
||||
@ -704,11 +480,12 @@ begin
|
||||
while FHandlers[smhBeforeFree].NextDownIndex(i) do
|
||||
TNotifyEvent(FHandlers[smhBeforeFree][i])(Self);
|
||||
// remove from source marks
|
||||
SourceMarks:=nil;
|
||||
// remove from editor component
|
||||
for i := 0 to FSynMarks.Count - 1 do
|
||||
FSynMarks[i].Free;
|
||||
FreeAndNil(FSynMarks);
|
||||
SourceMarks := nil;
|
||||
FSourceEditorID := nil;
|
||||
FSynMark.FSourceMark := nil;
|
||||
FSynMark.OnChange := nil;
|
||||
if not FSynMark.IsDestroying then
|
||||
FreeAndNil(FSynMark);
|
||||
|
||||
// free handler lists
|
||||
for HandlerType:=Low(TSourceMarkHandler) to high(TSourceMarkHandler) do
|
||||
@ -768,12 +545,12 @@ end;
|
||||
|
||||
procedure TSourceMark.IncChangeLock;
|
||||
begin
|
||||
FSynMarks.IncChangeLock;
|
||||
FSynMark.IncChangeLock;
|
||||
end;
|
||||
|
||||
procedure TSourceMark.DecChangeLock;
|
||||
begin
|
||||
FSynMarks.DecChangeLock;
|
||||
FSynMark.DecChangeLock;
|
||||
end;
|
||||
|
||||
procedure TSourceMark.RemoveAllHandlersForObject(HandlerObject: TObject);
|
||||
@ -829,21 +606,6 @@ begin
|
||||
FHandlers[smhCreatePopupMenu].Remove(TMethod(OnCreatePopupMenu));
|
||||
end;
|
||||
|
||||
function TSourceMark.HasSourceEditor(AEditor: TSourceEditorInterface): Boolean;
|
||||
begin
|
||||
Result := FSynMarks.IndexOfSourceEditor(AEditor) >= 0;
|
||||
end;
|
||||
|
||||
procedure TSourceMark.AddSourceEditor(AEditor: TSourceEditorInterface);
|
||||
var
|
||||
NewSynMark: TSourceSynMark;
|
||||
begin
|
||||
NewSynMark := TSourceSynMark.Create(Self, AEditor);
|
||||
if FSynMarks.Count > 0 then
|
||||
NewSynMark.Assign(FSynMarks[0]);
|
||||
FSynMarks.Add(NewSynMark);
|
||||
end;
|
||||
|
||||
{ TSourceMarks }
|
||||
|
||||
function TSourceMarks.GetItems(Index: integer): TSourceMark;
|
||||
@ -942,14 +704,14 @@ begin
|
||||
FOnAction(AMark, maAdded);
|
||||
end;
|
||||
|
||||
function TSourceMarks.Add(ASrcEdit: TSourceEditorInterface; ALine: integer): TSourceMark;
|
||||
function TSourceMarks.Add(ASrcEdit: TSourceEditorBase; ALine: integer): TSourceMark;
|
||||
begin
|
||||
Result:=TSourceMark.Create(ASrcEdit, nil);
|
||||
Result.Line := ALine;
|
||||
Add(Result);
|
||||
end;
|
||||
|
||||
function TSourceMarks.AddCustomMark(TheOwner: TSourceEditorInterface; Data: TObject;
|
||||
function TSourceMarks.AddCustomMark(TheOwner: TSourceEditorBase; Data: TObject;
|
||||
MarkClass: TSourceMarkClass): TSourceMark;
|
||||
begin
|
||||
if MarkClass=nil then MarkClass:=TSourceMark;
|
||||
@ -984,69 +746,53 @@ begin
|
||||
FOnAction(AMark, maRemoved);
|
||||
end;
|
||||
|
||||
procedure TSourceMarks.AddSourceEditor(ANewEditor,
|
||||
AExistingEditor: TSourceEditorInterface);
|
||||
procedure TSourceMarks.DeleteAllForEditor(ASrcEdit: TSourceEditorBase);
|
||||
begin
|
||||
DeleteAllForEditorID(ASrcEdit.GetSharedValues);
|
||||
end;
|
||||
|
||||
procedure TSourceMarks.DeleteAllForEditorID(ASrcEditID: TSourceEditorSharedValuesBase);
|
||||
var
|
||||
i: Integer;
|
||||
CurMark: TSourceMark;
|
||||
SrcEditorID: TObject;
|
||||
begin
|
||||
if not Assigned(OnGetSourceEditorID) then exit;
|
||||
SrcEditorID := OnGetSourceEditorID(ANewEditor);
|
||||
if ASrcEditID = nil then
|
||||
exit;
|
||||
i:=fItems.Count-1;
|
||||
while i>=0 do begin
|
||||
CurMark:=Items[i];
|
||||
if (CurMark.SourceEditorID = SrcEditorID) and
|
||||
(not CurMark.HasSourceEditor(ANewEditor))
|
||||
then
|
||||
CurMark.AddSourceEditor(ANewEditor);
|
||||
if Items[i].SourceEditorID = ASrcEditID then
|
||||
Delete(i);
|
||||
dec(i);
|
||||
end;
|
||||
end;
|
||||
|
||||
procedure TSourceMarks.DeleteAllForEditor(ASrcEdit: TSourceEditorInterface);
|
||||
var
|
||||
i: Integer;
|
||||
CurMark: TSourceMark;
|
||||
SrcEditorID: TObject;
|
||||
begin
|
||||
if not Assigned(OnGetSourceEditorID) then exit;
|
||||
SrcEditorID := OnGetSourceEditorID(ASrcEdit);
|
||||
i:=fItems.Count-1;
|
||||
while i>=0 do begin
|
||||
CurMark:=Items[i];
|
||||
if CurMark.SourceEditorID = SrcEditorID then begin
|
||||
CurMark.FSynMarks.DeleteWithSourceEditor(ASrcEdit);
|
||||
if CurMark.FSynMarks.Count = 0 then
|
||||
Delete(i);
|
||||
end;
|
||||
dec(i);
|
||||
end;
|
||||
end;
|
||||
|
||||
function TSourceMarks.FindFirstMark(ASrcEdit: TSourceEditorInterface; ALine: integer
|
||||
): TSourceMark;
|
||||
function TSourceMarks.FindFirstMark(ASrcEdit: TSourceEditorBase; ALine: integer): TSourceMark;
|
||||
var
|
||||
AVLNode: TAVLTreeNode;
|
||||
SrcEditorID: TSourceEditorSharedValuesBase;
|
||||
begin
|
||||
if not Assigned(OnGetSourceEditorID) then exit(nil);
|
||||
AVLNode:=FindFirstMarkNode(OnGetSourceEditorID(ASrcEdit), ALine);
|
||||
Result := nil;
|
||||
SrcEditorID := ASrcEdit.GetSharedValues;
|
||||
if SrcEditorID = nil then
|
||||
exit;
|
||||
AVLNode:=FindFirstMarkNode(SrcEditorID, ALine);
|
||||
if AVLNode<>nil then
|
||||
Result:=TSourceMark(AVLNode.Data)
|
||||
else
|
||||
Result:=nil;
|
||||
Result:=TSourceMark(AVLNode.Data);
|
||||
end;
|
||||
|
||||
function TSourceMarks.FindBreakPointMark(ASrcEdit: TSourceEditorInterface;
|
||||
function TSourceMarks.FindBreakPointMark(ASrcEdit: TSourceEditorBase;
|
||||
ALine: integer): TSourceMark;
|
||||
var
|
||||
AVLNode: TAVLTreeNode;
|
||||
EditorIDAndLine: TEditorIDAndLine;
|
||||
CurMark: TSourceMark;
|
||||
SrcEditorID: TSourceEditorSharedValuesBase;
|
||||
begin
|
||||
Result := nil;
|
||||
if not Assigned(OnGetSourceEditorID) then exit;
|
||||
EditorIDAndLine.EditorID := OnGetSourceEditorID(ASrcEdit);
|
||||
SrcEditorID := ASrcEdit.GetSharedValues;
|
||||
if SrcEditorID = nil then
|
||||
exit;
|
||||
|
||||
EditorIDAndLine.EditorID := SrcEditorID;
|
||||
EditorIDAndLine.Line := ALine;
|
||||
AVLNode := FindFirstMarkNode(EditorIDAndLine.EditorID, ALine);
|
||||
while (AVLNode <> nil) do
|
||||
@ -1062,7 +808,7 @@ begin
|
||||
end;
|
||||
end;
|
||||
|
||||
procedure TSourceMarks.GetMarksForLine(ASrcEdit: TSourceEditorInterface;
|
||||
procedure TSourceMarks.GetMarksForLine(ASrcEdit: TSourceEditorBase;
|
||||
ALine: integer; var Marks: PSourceMark; var MarkCount: integer);
|
||||
var
|
||||
i, Capacity: integer;
|
||||
@ -1070,12 +816,16 @@ var
|
||||
EditorIDAndLine: TEditorIDAndLine;
|
||||
CurMark: TSourceMark;
|
||||
HasChange: Boolean;
|
||||
SrcEditorID: TSourceEditorSharedValuesBase;
|
||||
begin
|
||||
SrcEditorID := ASrcEdit.GetSharedValues;
|
||||
if SrcEditorID = nil then
|
||||
exit;
|
||||
|
||||
Capacity := 0;
|
||||
MarkCount := 0;
|
||||
Marks := nil;
|
||||
if not Assigned(OnGetSourceEditorID) then exit;
|
||||
EditorIDAndLine.EditorID := OnGetSourceEditorID(ASrcEdit);
|
||||
EditorIDAndLine.EditorID := SrcEditorID;
|
||||
EditorIDAndLine.Line := ALine;
|
||||
AVLNode := FindFirstMarkNode(EditorIDAndLine.EditorID, ALine);
|
||||
while (AVLNode <> nil) do
|
||||
|
Loading…
Reference in New Issue
Block a user