mirror of
https://gitlab.com/freepascal.org/lazarus/lazarus.git
synced 2025-06-09 22:58:17 +02:00
SynEdit: Starting Multi-View SynEdit
git-svn-id: trunk@22679 -
This commit is contained in:
parent
ce4c2a4762
commit
69f53e8c35
@ -374,6 +374,11 @@ type
|
|||||||
FTheLinesView: TSynEditStrings;
|
FTheLinesView: TSynEditStrings;
|
||||||
FLines: TSynEditStrings; // The real (un-mapped) line-buffer
|
FLines: TSynEditStrings; // The real (un-mapped) line-buffer
|
||||||
FStrings: TStrings; // External TStrings based interface to the Textbuffer
|
FStrings: TStrings; // External TStrings based interface to the Textbuffer
|
||||||
|
{$IFDEF SynDualView}
|
||||||
|
FTopLinesView: TSynEditStrings; // The linesview that holds the real line-buffer/FLines
|
||||||
|
|
||||||
|
FSharedViewSynEdit: TCustomSynEdit;
|
||||||
|
{$ENDIF}
|
||||||
|
|
||||||
fExtraCharSpacing: integer;
|
fExtraCharSpacing: integer;
|
||||||
fLinesInWindow: Integer;// MG: fully visible lines in window
|
fLinesInWindow: Integer;// MG: fully visible lines in window
|
||||||
@ -424,7 +429,7 @@ type
|
|||||||
fTSearch: TSynEditSearch;
|
fTSearch: TSynEditSearch;
|
||||||
fHookedCommandHandlers: TList;
|
fHookedCommandHandlers: TList;
|
||||||
FHookedKeyTranslationList: TSynHookedKeyTranslationList;
|
FHookedKeyTranslationList: TSynHookedKeyTranslationList;
|
||||||
fPlugins: TList;
|
FPlugins: TList;
|
||||||
fScrollTimer: TTimer;
|
fScrollTimer: TTimer;
|
||||||
fScrollDeltaX, fScrollDeltaY: Integer;
|
fScrollDeltaX, fScrollDeltaY: Integer;
|
||||||
FInMouseClickEvent: Boolean;
|
FInMouseClickEvent: Boolean;
|
||||||
@ -517,7 +522,7 @@ type
|
|||||||
procedure MoveCaretVert(DY: integer);
|
procedure MoveCaretVert(DY: integer);
|
||||||
procedure PrimarySelectionRequest(const RequestedFormatID: TClipboardFormat;
|
procedure PrimarySelectionRequest(const RequestedFormatID: TClipboardFormat;
|
||||||
Data: TStream);
|
Data: TStream);
|
||||||
function ScanFrom(var Index: integer; AtLeastTilIndex: integer = -1): integer;
|
function ScanFrom(var Index: integer; AtLeastTilIndex: integer = -1): integer; // Todo: move to line, currently scans twice or more, if SharedView is active
|
||||||
procedure DoBlockSelectionChanged(Sender: TObject);
|
procedure DoBlockSelectionChanged(Sender: TObject);
|
||||||
procedure SetBlockBegin(Value: TPoint);
|
procedure SetBlockBegin(Value: TPoint);
|
||||||
procedure SetBlockEnd(Value: TPoint);
|
procedure SetBlockEnd(Value: TPoint);
|
||||||
@ -567,6 +572,11 @@ type
|
|||||||
procedure UnlockUndo;
|
procedure UnlockUndo;
|
||||||
procedure UpdateCaret;
|
procedure UpdateCaret;
|
||||||
procedure UpdateScrollBars;
|
procedure UpdateScrollBars;
|
||||||
|
{$IFDEF SynDualView}
|
||||||
|
function GetSharedViewEdit: TCustomSynEdit;
|
||||||
|
procedure SetSharedViewEdit(const AValue: TCustomSynEdit);
|
||||||
|
procedure RemoveHandlers(ALines: TSynEditStrings = nil);
|
||||||
|
{$ENDIF}
|
||||||
protected
|
protected
|
||||||
procedure CreateHandle; override;
|
procedure CreateHandle; override;
|
||||||
procedure CreateParams(var Params: TCreateParams); override;
|
procedure CreateParams(var Params: TCreateParams); override;
|
||||||
@ -871,6 +881,9 @@ type
|
|||||||
procedure Invalidate; override;
|
procedure Invalidate; override;
|
||||||
property ChangeStamp: int64 read fChangeStamp;
|
property ChangeStamp: int64 read fChangeStamp;
|
||||||
{$ENDIF}
|
{$ENDIF}
|
||||||
|
{$IFDEF SynDualView}
|
||||||
|
property SharedViewEdit: TCustomSynEdit read GetSharedViewEdit write SetSharedViewEdit;
|
||||||
|
{$ENDIF}
|
||||||
public
|
public
|
||||||
property OnKeyDown;
|
property OnKeyDown;
|
||||||
property OnKeyPress;
|
property OnKeyPress;
|
||||||
@ -1486,9 +1499,10 @@ begin
|
|||||||
SetAncestor(True); // temp until tframe does this
|
SetAncestor(True); // temp until tframe does this
|
||||||
SetInline(True);
|
SetInline(True);
|
||||||
|
|
||||||
fBeautifier := SynDefaultBeautifier;
|
FBeautifier := SynDefaultBeautifier;
|
||||||
|
|
||||||
|
FLines := TSynEditStringList.Create;
|
||||||
|
|
||||||
fLines := TSynEditStringList.Create;
|
|
||||||
FCaret := TSynEditCaret.Create;
|
FCaret := TSynEditCaret.Create;
|
||||||
FCaret.MaxLeftChar := @FMaxLeftChar;
|
FCaret.MaxLeftChar := @FMaxLeftChar;
|
||||||
FCaret.AddChangeHandler({$IFDEF FPC}@{$ENDIF}CaretChanged);
|
FCaret.AddChangeHandler({$IFDEF FPC}@{$ENDIF}CaretChanged);
|
||||||
@ -1509,6 +1523,9 @@ begin
|
|||||||
// Pointer to the First/Lowest View
|
// Pointer to the First/Lowest View
|
||||||
// TODO: this should be Folded...
|
// TODO: this should be Folded...
|
||||||
FTheLinesView := FTabbedLinesView;
|
FTheLinesView := FTabbedLinesView;
|
||||||
|
{$IFDEF SynDualView}
|
||||||
|
FTopLinesView := FTrimmedLinesView;
|
||||||
|
{$ENDIF}
|
||||||
// External Accessor
|
// External Accessor
|
||||||
FStrings := TSynEditLines.Create(FLines, {$IFDEF FPC}@{$ENDIF}MarkTextAsSaved);
|
FStrings := TSynEditLines.Create(FLines, {$IFDEF FPC}@{$ENDIF}MarkTextAsSaved);
|
||||||
|
|
||||||
@ -1770,6 +1787,10 @@ begin
|
|||||||
TSynEditPlugin(fPlugins[i]).Editor := nil;
|
TSynEditPlugin(fPlugins[i]).Editor := nil;
|
||||||
FreeAndNil(fPlugins);
|
FreeAndNil(fPlugins);
|
||||||
end;
|
end;
|
||||||
|
{$IFDEF SynDualView}
|
||||||
|
RemoveHandlers;
|
||||||
|
{$ENDIF}
|
||||||
|
|
||||||
FreeAndNil(FHookedKeyTranslationList);
|
FreeAndNil(FHookedKeyTranslationList);
|
||||||
fHookedCommandHandlers:=nil;
|
fHookedCommandHandlers:=nil;
|
||||||
fPlugins:=nil;
|
fPlugins:=nil;
|
||||||
@ -1795,7 +1816,9 @@ begin
|
|||||||
FreeAndNil(FTabbedLinesView);
|
FreeAndNil(FTabbedLinesView);
|
||||||
FreeAndNil(FTrimmedLinesView); // has reference to caret
|
FreeAndNil(FTrimmedLinesView); // has reference to caret
|
||||||
FreeAndNil(FDoubleWidthChrLinesView);
|
FreeAndNil(FDoubleWidthChrLinesView);
|
||||||
FreeAndNil(fLines);
|
TSynEditStringList(FLines).DecRefCount;
|
||||||
|
if TSynEditStringList(FLines).RefCount = 0 then
|
||||||
|
FreeAndNil(fLines);
|
||||||
FreeAndNil(fCaret);
|
FreeAndNil(fCaret);
|
||||||
FreeAndNil(fInternalCaret);
|
FreeAndNil(fInternalCaret);
|
||||||
inherited Destroy;
|
inherited Destroy;
|
||||||
@ -4940,6 +4963,104 @@ begin
|
|||||||
FMouseSelActions.Assign(AValue);
|
FMouseSelActions.Assign(AValue);
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
{$IFDEF SynDualView}
|
||||||
|
function TCustomSynEdit.GetSharedViewEdit: TCustomSynEdit;
|
||||||
|
begin
|
||||||
|
Result := FSharedViewSynEdit;
|
||||||
|
end;
|
||||||
|
|
||||||
|
procedure TCustomSynEdit.SetSharedViewEdit(const AValue: TCustomSynEdit);
|
||||||
|
var
|
||||||
|
OldLines: TSynEditStringList;
|
||||||
|
LView: TSynEditStrings;
|
||||||
|
i: Integer;
|
||||||
|
Plugins: TList;
|
||||||
|
begin
|
||||||
|
if AValue = FSharedViewSynEdit then exit;
|
||||||
|
FSharedViewSynEdit := AValue;
|
||||||
|
|
||||||
|
// TODO: all plugins SetEditor = nil => release all flines
|
||||||
|
Plugins := TList.Create; // remmeber them
|
||||||
|
for i := 0 to FPlugins.Count - 1 do begin
|
||||||
|
Plugins.Add(FPlugins[i]);
|
||||||
|
TSynEditPlugin(FPlugins[i]).Editor := nil;
|
||||||
|
end;
|
||||||
|
|
||||||
|
OldLines := TSynEditStringList(FLines);
|
||||||
|
if AValue = nil then begin
|
||||||
|
FLines := TSynEditStringList.Create;
|
||||||
|
end else begin
|
||||||
|
FLines := AValue.FLines;
|
||||||
|
TSynEditStringList(FLines).IncRefCount;
|
||||||
|
end;
|
||||||
|
TSynEditStringsLinked(FTopLinesView).NextLines := FLines;
|
||||||
|
|
||||||
|
// Todo: copy events (have a list of all event owners)
|
||||||
|
TSynEditStringList(FLines).CopyHanlders(OldLines, self);
|
||||||
|
LView := FTheLinesView;
|
||||||
|
while (LView is TSynEditStringsLinked) and (LView <> FLines) do begin
|
||||||
|
TSynEditStringList(FLines).CopyHanlders(OldLines, LView);
|
||||||
|
LView := TSynEditStringsLinked(LView).NextLines;
|
||||||
|
end;
|
||||||
|
TSynEditStringList(FLines).CopyHanlders(OldLines, FFoldedLinesView);
|
||||||
|
TSynEditStringList(FLines).CopyHanlders(OldLines, FMarkList);
|
||||||
|
TSynEditStringList(FLines).CopyHanlders(OldLines, FCaret);
|
||||||
|
TSynEditStringList(FLines).CopyHanlders(OldLines, FInternalCaret);
|
||||||
|
TSynEditStringList(FLines).CopyHanlders(OldLines, FBlockSelection);
|
||||||
|
TSynEditStringList(FLines).CopyHanlders(OldLines, FInternalBlockSelection);
|
||||||
|
TSynEditStringList(FLines).CopyHanlders(OldLines, fMarkupManager);
|
||||||
|
for i := 0 to fMarkupManager.Count - 1 do
|
||||||
|
TSynEditStringList(FLines).CopyHanlders(OldLines, fMarkupManager.Markup[i]);
|
||||||
|
|
||||||
|
FUndoList := TSynEditStringList(fLines).UndoList;
|
||||||
|
FRedoList := TSynEditStringList(fLines).RedoList;
|
||||||
|
|
||||||
|
FreeAndNil(FStrings);
|
||||||
|
FStrings := TSynEditLines.Create(FLines, {$IFDEF FPC}@{$ENDIF}MarkTextAsSaved);
|
||||||
|
|
||||||
|
// TOdo: highlighter
|
||||||
|
|
||||||
|
for i := 0 to Plugins.Count - 1 do begin
|
||||||
|
FPlugins.Add(FPlugins[i]);
|
||||||
|
end;
|
||||||
|
Plugins.Free;
|
||||||
|
|
||||||
|
// Todo: rescan / redraw /re....
|
||||||
|
|
||||||
|
OldLines.DecRefCount;
|
||||||
|
if OldLines.RefCount = 0 then
|
||||||
|
OldLines.Free
|
||||||
|
else
|
||||||
|
RemoveHandlers(OldLines);
|
||||||
|
end;
|
||||||
|
|
||||||
|
procedure TCustomSynEdit.RemoveHandlers(ALines: TSynEditStrings = nil);
|
||||||
|
var
|
||||||
|
LView: TSynEditStrings;
|
||||||
|
i: Integer;
|
||||||
|
begin
|
||||||
|
if not assigned(ALines) then
|
||||||
|
ALines := FLines;
|
||||||
|
|
||||||
|
// Todo: aggregated objects, should be responsible themself
|
||||||
|
TSynEditStringList(ALines).RemoveHanlders(self);
|
||||||
|
LView := FTheLinesView;
|
||||||
|
while (LView is TSynEditStringsLinked) and (LView <> ALines) do begin
|
||||||
|
TSynEditStringList(ALines).RemoveHanlders(LView);
|
||||||
|
LView := TSynEditStringsLinked(LView).NextLines;
|
||||||
|
end;
|
||||||
|
TSynEditStringList(ALines).RemoveHanlders(FFoldedLinesView);
|
||||||
|
TSynEditStringList(ALines).RemoveHanlders(FMarkList);
|
||||||
|
TSynEditStringList(ALines).RemoveHanlders(FCaret);
|
||||||
|
TSynEditStringList(ALines).RemoveHanlders(FInternalCaret);
|
||||||
|
TSynEditStringList(ALines).RemoveHanlders(FBlockSelection);
|
||||||
|
TSynEditStringList(ALines).RemoveHanlders(FInternalBlockSelection);
|
||||||
|
TSynEditStringList(ALines).RemoveHanlders(fMarkupManager);
|
||||||
|
for i := 0 to fMarkupManager.Count - 1 do
|
||||||
|
TSynEditStringList(ALines).RemoveHanlders(fMarkupManager.Markup[i]);
|
||||||
|
end;
|
||||||
|
{$ENDIF}
|
||||||
|
|
||||||
procedure TCustomSynEdit.SetTextBetweenPoints(aStartPoint, aEndPoint: TPoint;
|
procedure TCustomSynEdit.SetTextBetweenPoints(aStartPoint, aEndPoint: TPoint;
|
||||||
const AValue: String);
|
const AValue: String);
|
||||||
begin
|
begin
|
||||||
@ -5249,10 +5370,8 @@ begin
|
|||||||
inherited Notification(AComponent, Operation);
|
inherited Notification(AComponent, Operation);
|
||||||
if Operation = opRemove then begin
|
if Operation = opRemove then begin
|
||||||
if AComponent = fHighlighter then begin
|
if AComponent = fHighlighter then begin
|
||||||
|
fHighlighter.DetachFromLines(FLines);
|
||||||
fHighlighter := nil;
|
fHighlighter := nil;
|
||||||
if assigned(FLines.Ranges) then
|
|
||||||
FLines.Ranges.Free;
|
|
||||||
FLines.Ranges := nil;
|
|
||||||
fMarkupHighCaret.Highlighter := nil;
|
fMarkupHighCaret.Highlighter := nil;
|
||||||
fMarkupWordGroup.Highlighter := nil;
|
fMarkupWordGroup.Highlighter := nil;
|
||||||
FFoldedLinesView.Highlighter := nil;
|
FFoldedLinesView.Highlighter := nil;
|
||||||
|
@ -61,12 +61,17 @@ type
|
|||||||
|
|
||||||
TSynHighlighterRangeList = class(TSynEditStorageMem)
|
TSynHighlighterRangeList = class(TSynEditStorageMem)
|
||||||
private
|
private
|
||||||
|
FRefCount: Integer;
|
||||||
function GetRange(Index: Integer): Pointer;
|
function GetRange(Index: Integer): Pointer;
|
||||||
procedure SetRange(Index: Integer; const AValue: Pointer);
|
procedure SetRange(Index: Integer; const AValue: Pointer);
|
||||||
protected
|
protected
|
||||||
function ItemSize: Integer; override;
|
function ItemSize: Integer; override;
|
||||||
public
|
public
|
||||||
|
constructor Create;
|
||||||
|
procedure IncRefCount;
|
||||||
|
procedure DecRefCount;
|
||||||
property Range[Index: Integer]: Pointer read GetRange write SetRange; default;
|
property Range[Index: Integer]: Pointer read GetRange write SetRange; default;
|
||||||
|
property RefCount: Integer read FRefCount;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
{ TSynHighlighterAttributes }
|
{ TSynHighlighterAttributes }
|
||||||
@ -1260,20 +1265,32 @@ begin
|
|||||||
if AValue = FCurrentLines then
|
if AValue = FCurrentLines then
|
||||||
exit;
|
exit;
|
||||||
FCurrentLines := AValue;
|
FCurrentLines := AValue;
|
||||||
FCurrentRanges := TSynHighlighterRangeList(AValue.Ranges);
|
FCurrentRanges := TSynHighlighterRangeList(AValue.Ranges[ClassType]);
|
||||||
end;
|
end;
|
||||||
|
|
||||||
procedure TSynCustomHighlighter.AttachToLines(Lines: TSynEditStrings);
|
procedure TSynCustomHighlighter.AttachToLines(Lines: TSynEditStrings);
|
||||||
|
var
|
||||||
|
r: TSynHighlighterRangeList;
|
||||||
begin
|
begin
|
||||||
Lines.Ranges := CreateRangeList;
|
r := TSynHighlighterRangeList(Lines.Ranges[ClassType]);
|
||||||
|
if assigned(r) then
|
||||||
|
r.IncRefCount
|
||||||
|
else
|
||||||
|
Lines.Ranges[ClassType] := CreateRangeList;
|
||||||
FCurrentLines := nil;
|
FCurrentLines := nil;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
procedure TSynCustomHighlighter.DetachFromLines(Lines: TSynEditStrings);
|
procedure TSynCustomHighlighter.DetachFromLines(Lines: TSynEditStrings);
|
||||||
|
var
|
||||||
|
r: TSynHighlighterRangeList;
|
||||||
begin
|
begin
|
||||||
if assigned(Lines.Ranges) then
|
r := TSynHighlighterRangeList(Lines.Ranges[ClassType]);
|
||||||
Lines.Ranges.Free;
|
if not assigned(r) then exit;
|
||||||
Lines.Ranges := nil;
|
r.DecRefCount;
|
||||||
|
if r.RefCount = 0 then begin
|
||||||
|
r.Free;
|
||||||
|
Lines.Ranges[ClassType] := nil;
|
||||||
|
end;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
procedure TSynCustomHighlighter.SetDrawDividerLevel(const AValue: Integer);
|
procedure TSynCustomHighlighter.SetDrawDividerLevel(const AValue: Integer);
|
||||||
@ -1315,6 +1332,22 @@ begin
|
|||||||
Result := SizeOf(Pointer);
|
Result := SizeOf(Pointer);
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
constructor TSynHighlighterRangeList.Create;
|
||||||
|
begin
|
||||||
|
Inherited;
|
||||||
|
FRefCount := 1;
|
||||||
|
end;
|
||||||
|
|
||||||
|
procedure TSynHighlighterRangeList.IncRefCount;
|
||||||
|
begin
|
||||||
|
inc(FRefCount);
|
||||||
|
end;
|
||||||
|
|
||||||
|
procedure TSynHighlighterRangeList.DecRefCount;
|
||||||
|
begin
|
||||||
|
dec(FRefCount);
|
||||||
|
end;
|
||||||
|
|
||||||
{ TSynDividerDrawConfig }
|
{ TSynDividerDrawConfig }
|
||||||
|
|
||||||
function TSynDividerDrawConfig.GetNestColor: TColor;
|
function TSynDividerDrawConfig.GetNestColor: TColor;
|
||||||
|
@ -348,6 +348,7 @@ type
|
|||||||
public
|
public
|
||||||
function CountByObject(const AnObject: TObject): integer;
|
function CountByObject(const AnObject: TObject): integer;
|
||||||
procedure DeleteByObject(const AnObject: TObject; Index: integer);
|
procedure DeleteByObject(const AnObject: TObject; Index: integer);
|
||||||
|
procedure AddCopyFrom(AList: TSynMethodList; AOwner: TObject = nil);
|
||||||
public
|
public
|
||||||
property ItemsByObject[AnObject: TObject; Index: integer]: TMethod
|
property ItemsByObject[AnObject: TObject; Index: integer]: TMethod
|
||||||
read GetObjectItems write SetObjectItems; default;
|
read GetObjectItems write SetObjectItems; default;
|
||||||
@ -1111,7 +1112,7 @@ begin
|
|||||||
i := 0;
|
i := 0;
|
||||||
c := Count;
|
c := Count;
|
||||||
while i < c do begin
|
while i < c do begin
|
||||||
if TObject(Items[AnIndex].Data)=AnObject then begin
|
if TObject(Items[i].Data)=AnObject then begin
|
||||||
if AnIndex = 0 then exit(i);
|
if AnIndex = 0 then exit(i);
|
||||||
dec(AnIndex);
|
dec(AnIndex);
|
||||||
end;
|
end;
|
||||||
@ -1148,5 +1149,18 @@ begin
|
|||||||
Delete(IndexToObjectIndex(AnObject, Index));
|
Delete(IndexToObjectIndex(AnObject, Index));
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
procedure TSynMethodList.AddCopyFrom(AList: TSynMethodList; AOwner: TObject = nil);
|
||||||
|
var
|
||||||
|
i: Integer;
|
||||||
|
begin
|
||||||
|
if AOwner = nil then begin
|
||||||
|
for i := 0 to AList.Count - 1 do
|
||||||
|
Add(AList.Items[i], True);
|
||||||
|
end else begin
|
||||||
|
for i := 0 to AList.CountByObject(AOwner) - 1 do
|
||||||
|
Add(AList.ItemsByObject[AOwner, i], True);
|
||||||
|
end;
|
||||||
|
end;
|
||||||
|
|
||||||
end.
|
end.
|
||||||
|
|
||||||
|
@ -919,14 +919,17 @@ procedure TSynEditSelection.DoLinesEdited(Sender: TSynEditStrings; aLinePos, aBy
|
|||||||
|
|
||||||
begin
|
begin
|
||||||
if FIsSettingText then exit;
|
if FIsSettingText then exit;
|
||||||
if FPersistent or (FPersistentLock > 0) then begin
|
if FPersistent or (FPersistentLock > 0) or
|
||||||
if FActiveSelectionMode <> smColumn then begin
|
((FCaret <> nil) and (not FCaret.Locked))
|
||||||
|
then begin
|
||||||
|
if FActiveSelectionMode <> smColumn then begin // TODO: adjust ypos, height in smColumn mode
|
||||||
AdjustStartLineBytePos(AdjustPoint(StartLineBytePos));
|
AdjustStartLineBytePos(AdjustPoint(StartLineBytePos));
|
||||||
EndLineBytePos := AdjustPoint(EndLineBytePos);
|
EndLineBytePos := AdjustPoint(EndLineBytePos);
|
||||||
end;
|
end;
|
||||||
end
|
end
|
||||||
else
|
else // Change the Selection, if change was made by owning SynEdit (Caret.Locked)
|
||||||
if (FCaret <> nil) then
|
// (InternalSelection has no Caret)
|
||||||
|
if (FCaret <> nil) and (FCaret.Locked) then
|
||||||
StartLineBytePos := FCaret.LineBytePos;
|
StartLineBytePos := FCaret.LineBytePos;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
@ -85,8 +85,8 @@ type
|
|||||||
FIsUtf8: Boolean;
|
FIsUtf8: Boolean;
|
||||||
function GetIsUtf8 : Boolean; virtual;
|
function GetIsUtf8 : Boolean; virtual;
|
||||||
procedure SetIsUtf8(const AValue : Boolean); virtual;
|
procedure SetIsUtf8(const AValue : Boolean); virtual;
|
||||||
function GetRange: TSynEditStorageMem; virtual; abstract;
|
function GetRange(Index: TClass): TSynEditStorageMem; virtual; abstract;
|
||||||
procedure PutRange(ARange: TSynEditStorageMem); virtual; abstract;
|
procedure PutRange(Index: TClass; const ARange: TSynEditStorageMem); virtual; abstract;
|
||||||
function GetAttribute(const Owner: TClass; const Index: Integer): Pointer; virtual; abstract;
|
function GetAttribute(const Owner: TClass; const Index: Integer): Pointer; virtual; abstract;
|
||||||
procedure SetAttribute(const Owner: TClass; const Index: Integer; const AValue: Pointer); virtual; abstract;
|
procedure SetAttribute(const Owner: TClass; const Index: Integer; const AValue: Pointer); virtual; abstract;
|
||||||
|
|
||||||
@ -163,7 +163,7 @@ type
|
|||||||
property ExpandedStrings[Index: integer]: string read GetExpandedString;
|
property ExpandedStrings[Index: integer]: string read GetExpandedString;
|
||||||
property LengthOfLongestLine: integer read GetLengthOfLongestLine;
|
property LengthOfLongestLine: integer read GetLengthOfLongestLine;
|
||||||
property IsUtf8: Boolean read GetIsUtf8 write SetIsUtf8;
|
property IsUtf8: Boolean read GetIsUtf8 write SetIsUtf8;
|
||||||
property Ranges: TSynEditStorageMem read GetRange write PutRange;
|
property Ranges[Index: TClass]: TSynEditStorageMem read GetRange write PutRange;
|
||||||
property TextChangeStamp: int64 read FTextChangeStamp;
|
property TextChangeStamp: int64 read FTextChangeStamp;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
@ -176,8 +176,8 @@ type
|
|||||||
function GetIsUtf8 : Boolean; override;
|
function GetIsUtf8 : Boolean; override;
|
||||||
procedure SetIsUtf8(const AValue : Boolean); override;
|
procedure SetIsUtf8(const AValue : Boolean); override;
|
||||||
|
|
||||||
function GetRange: TSynEditStorageMem; override;
|
function GetRange(Index: TClass): TSynEditStorageMem; override;
|
||||||
procedure PutRange(ARange: TSynEditStorageMem); override;
|
procedure PutRange(Index: TClass; const ARange: TSynEditStorageMem); override;
|
||||||
|
|
||||||
function GetAttribute(const Owner: TClass; const Index: Integer): Pointer; override;
|
function GetAttribute(const Owner: TClass; const Index: Integer): Pointer; override;
|
||||||
procedure SetAttribute(const Owner: TClass; const Index: Integer; const AValue: Pointer); override;
|
procedure SetAttribute(const Owner: TClass; const Index: Integer; const AValue: Pointer); override;
|
||||||
@ -230,7 +230,7 @@ type
|
|||||||
AHandler: TMethod); override;
|
AHandler: TMethod); override;
|
||||||
|
|
||||||
function GetPhysicalCharWidths(const Line: String; Index: Integer): TPhysicalCharWidths; override;
|
function GetPhysicalCharWidths(const Line: String; Index: Integer): TPhysicalCharWidths; override;
|
||||||
property NextLines: TSynEditStrings read fSynStrings;
|
property NextLines: TSynEditStrings read fSynStrings write fSynStrings;
|
||||||
public
|
public
|
||||||
// LogX, LogY are 1-based
|
// LogX, LogY are 1-based
|
||||||
procedure EditInsert(LogX, LogY: Integer; AText: String); override;
|
procedure EditInsert(LogX, LogY: Integer; AText: String); override;
|
||||||
@ -593,14 +593,14 @@ begin
|
|||||||
end;
|
end;
|
||||||
|
|
||||||
//Ranges
|
//Ranges
|
||||||
function TSynEditStringsLinked.GetRange: TSynEditStorageMem;
|
function TSynEditStringsLinked.GetRange(Index: TClass): TSynEditStorageMem;
|
||||||
begin
|
begin
|
||||||
Result:= fSynStrings.Ranges;
|
Result:= fSynStrings.Ranges[Index];
|
||||||
end;
|
end;
|
||||||
|
|
||||||
procedure TSynEditStringsLinked.PutRange(ARange: TSynEditStorageMem);
|
procedure TSynEditStringsLinked.PutRange(Index: TClass; const ARange: TSynEditStorageMem);
|
||||||
begin
|
begin
|
||||||
fSynStrings.Ranges := ARange;
|
fSynStrings.Ranges[Index] := ARange;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
function TSynEditStringsLinked.GetAttribute(const Owner: TClass; const Index: Integer): Pointer;
|
function TSynEditStringsLinked.GetAttribute(const Owner: TClass; const Index: Integer): Pointer;
|
||||||
|
@ -84,18 +84,24 @@ type
|
|||||||
|
|
||||||
{ TSynEditStringMemory }
|
{ TSynEditStringMemory }
|
||||||
|
|
||||||
|
TSynEditStringRangeEntry = record
|
||||||
|
Index: TClass;
|
||||||
|
Data: TSynEditStorageMem;
|
||||||
|
end;
|
||||||
|
|
||||||
TSynEditStringMemory = class(TSynEditStorageMem)
|
TSynEditStringMemory = class(TSynEditStorageMem)
|
||||||
private
|
private
|
||||||
FAttributeSize: Integer;
|
FAttributeSize: Integer;
|
||||||
FRangeList: TSynEditStorageMem;
|
FRangeList: Array of TSynEditStringRangeEntry;
|
||||||
function GetAttribute(Index: Integer; Pos: Integer; Size: Word): Pointer;
|
function GetAttribute(Index: Integer; Pos: Integer; Size: Word): Pointer;
|
||||||
function GetAttributeSize: Integer;
|
function GetAttributeSize: Integer;
|
||||||
function GetObject(Index: Integer): TObject;
|
function GetObject(Index: Integer): TObject;
|
||||||
|
function GetRange(Index: TClass): TSynEditStorageMem;
|
||||||
function GetString(Index: Integer): String;
|
function GetString(Index: Integer): String;
|
||||||
procedure SetAttribute(Index: Integer; Pos: Integer; Size: Word; const AValue: Pointer);
|
procedure SetAttribute(Index: Integer; Pos: Integer; Size: Word; const AValue: Pointer);
|
||||||
procedure SetAttributeSize(const AValue: Integer);
|
procedure SetAttributeSize(const AValue: Integer);
|
||||||
procedure SetObject(Index: Integer; const AValue: TObject);
|
procedure SetObject(Index: Integer; const AValue: TObject);
|
||||||
procedure SetRangeList(const AValue: TSynEditStorageMem);
|
procedure SetRange(Index: TClass; const AValue: TSynEditStorageMem);
|
||||||
procedure SetString(Index: Integer; const AValue: String);
|
procedure SetString(Index: Integer; const AValue: String);
|
||||||
protected
|
protected
|
||||||
procedure SetCount(const AValue: Integer); override;
|
procedure SetCount(const AValue: Integer); override;
|
||||||
@ -111,7 +117,7 @@ type
|
|||||||
read GetAttribute write SetAttribute;
|
read GetAttribute write SetAttribute;
|
||||||
property AttributeSize: Integer read GetAttributeSize write SetAttributeSize;
|
property AttributeSize: Integer read GetAttributeSize write SetAttributeSize;
|
||||||
|
|
||||||
property RangeList: TSynEditStorageMem read FRangeList write SetRangeList;
|
property RangeList[Index: TClass]: TSynEditStorageMem read GetRange write SetRange;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
{ TSynEditStringList }
|
{ TSynEditStringList }
|
||||||
@ -124,6 +130,7 @@ type
|
|||||||
FLineRangeNotificationList: TLineRangeNotificationList; // LineCount
|
FLineRangeNotificationList: TLineRangeNotificationList; // LineCount
|
||||||
FLineChangeNotificationList: TLineRangeNotificationList; // ContentChange (not called on add...)
|
FLineChangeNotificationList: TLineRangeNotificationList; // ContentChange (not called on add...)
|
||||||
FLineEditNotificationList: TLineEditNotificationList;
|
FLineEditNotificationList: TLineEditNotificationList;
|
||||||
|
FRefCount: integer;
|
||||||
FUndoRedoAddedNotificationList: TSynMethodList;
|
FUndoRedoAddedNotificationList: TSynMethodList;
|
||||||
FOnChangeList: TSynMethodList;
|
FOnChangeList: TSynMethodList;
|
||||||
FOnChangingList: TSynMethodList;
|
FOnChangingList: TSynMethodList;
|
||||||
@ -160,8 +167,8 @@ type
|
|||||||
procedure IgnoreSendNotification(AReason: TSynEditNotifyReason;
|
procedure IgnoreSendNotification(AReason: TSynEditNotifyReason;
|
||||||
IncIgnore: Boolean); override;
|
IncIgnore: Boolean); override;
|
||||||
|
|
||||||
function GetRange: TSynEditStorageMem; override;
|
function GetRange(Index: TClass): TSynEditStorageMem; override;
|
||||||
procedure PutRange(ARange: TSynEditStorageMem); override;
|
procedure PutRange(Index: TClass; const ARange: TSynEditStorageMem); override;
|
||||||
function GetAttribute(const Owner: TClass; const Index: Integer): Pointer; override;
|
function GetAttribute(const Owner: TClass; const Index: Integer): Pointer; override;
|
||||||
procedure SetAttribute(const Owner: TClass; const Index: Integer; const AValue: Pointer); override;
|
procedure SetAttribute(const Owner: TClass; const Index: Integer; const AValue: Pointer); override;
|
||||||
function Get(Index: integer): string; override;
|
function Get(Index: integer): string; override;
|
||||||
@ -197,6 +204,13 @@ type
|
|||||||
AHandler: TMethod); override;
|
AHandler: TMethod); override;
|
||||||
procedure RemoveGenericHandler(AReason: TSynEditNotifyReason;
|
procedure RemoveGenericHandler(AReason: TSynEditNotifyReason;
|
||||||
AHandler: TMethod); override;
|
AHandler: TMethod); override;
|
||||||
|
{$IFDEF SynDualView}
|
||||||
|
procedure CopyHanlders(OtherLines: TSynEditStringList; AOwner: TObject = nil);
|
||||||
|
procedure RemoveHanlders(AOwner: TObject);
|
||||||
|
{$ENDIF}
|
||||||
|
procedure IncRefCount;
|
||||||
|
procedure DecRefCount;
|
||||||
|
property RefCount: integer read FRefCount;
|
||||||
function GetPhysicalCharWidths(const Line: String; Index: Integer): TPhysicalCharWidths; override;
|
function GetPhysicalCharWidths(const Line: String; Index: Integer): TPhysicalCharWidths; override;
|
||||||
public
|
public
|
||||||
property DosFileFormat: boolean read fDosFileFormat write fDosFileFormat;
|
property DosFileFormat: boolean read fDosFileFormat write fDosFileFormat;
|
||||||
@ -399,6 +413,7 @@ var
|
|||||||
r: TSynEditNotifyReason;
|
r: TSynEditNotifyReason;
|
||||||
begin
|
begin
|
||||||
fList := TSynEditStringMemory.Create;
|
fList := TSynEditStringMemory.Create;
|
||||||
|
FRefCount := 1;
|
||||||
|
|
||||||
FUndoList := TSynEditUndoList.Create;
|
FUndoList := TSynEditUndoList.Create;
|
||||||
fUndoList.OnAddedUndo := {$IFDEF FPC}@{$ENDIF}UndoRedoAdded;
|
fUndoList.OnAddedUndo := {$IFDEF FPC}@{$ENDIF}UndoRedoAdded;
|
||||||
@ -671,9 +686,9 @@ begin
|
|||||||
Result := nil;
|
Result := nil;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
function TSynEditStringList.GetRange: TSynEditStorageMem;
|
function TSynEditStringList.GetRange(Index: TClass): TSynEditStorageMem;
|
||||||
begin
|
begin
|
||||||
Result := FList.RangeList;
|
Result := FList.RangeList[Index];
|
||||||
end;
|
end;
|
||||||
|
|
||||||
procedure TSynEditStringList.Grow;
|
procedure TSynEditStringList.Grow;
|
||||||
@ -778,9 +793,9 @@ begin
|
|||||||
EndUpdate;
|
EndUpdate;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
procedure TSynEditStringList.PutRange(ARange: TSynEditStorageMem);
|
procedure TSynEditStringList.PutRange(Index: TClass; const ARange: TSynEditStorageMem);
|
||||||
begin
|
begin
|
||||||
FList.RangeList := ARange;
|
FList.RangeList[Index] := ARange;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
function TSynEditStringList.GetAttribute(const Owner: TClass; const Index: Integer): Pointer;
|
function TSynEditStringList.GetAttribute(const Owner: TClass; const Index: Integer): Pointer;
|
||||||
@ -912,6 +927,40 @@ begin
|
|||||||
end;
|
end;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
{$IFDEF SynDualView}
|
||||||
|
procedure TSynEditStringList.CopyHanlders(OtherLines: TSynEditStringList; AOwner: TObject = nil);
|
||||||
|
begin
|
||||||
|
FLineRangeNotificationList.AddCopyFrom(OtherLines.FLineRangeNotificationList, AOwner);
|
||||||
|
FLineChangeNotificationList.AddCopyFrom(OtherLines.FLineChangeNotificationList, AOwner);
|
||||||
|
FLineEditNotificationList.AddCopyFrom(OtherLines.FLineEditNotificationList, AOwner);
|
||||||
|
FUndoRedoAddedNotificationList.AddCopyFrom(OtherLines.FUndoRedoAddedNotificationList, AOwner);
|
||||||
|
FOnChangeList.AddCopyFrom(OtherLines.FOnChangeList, AOwner);
|
||||||
|
FOnChangingList.AddCopyFrom(OtherLines.FOnChangingList, AOwner);
|
||||||
|
FOnClearedList.AddCopyFrom(OtherLines.FOnClearedList, AOwner);
|
||||||
|
end;
|
||||||
|
|
||||||
|
procedure TSynEditStringList.RemoveHanlders(AOwner: TObject);
|
||||||
|
begin
|
||||||
|
FLineRangeNotificationList.RemoveAllMethodsOfObject(AOwner);
|
||||||
|
FLineChangeNotificationList.RemoveAllMethodsOfObject(AOwner);
|
||||||
|
FLineEditNotificationList.RemoveAllMethodsOfObject(AOwner);
|
||||||
|
FUndoRedoAddedNotificationList.RemoveAllMethodsOfObject(AOwner);
|
||||||
|
FOnChangeList.RemoveAllMethodsOfObject(AOwner);
|
||||||
|
FOnChangingList.RemoveAllMethodsOfObject(AOwner);
|
||||||
|
FOnClearedList.RemoveAllMethodsOfObject(AOwner);
|
||||||
|
end;
|
||||||
|
{$ENDIF}
|
||||||
|
|
||||||
|
procedure TSynEditStringList.IncRefCount;
|
||||||
|
begin
|
||||||
|
inc(FRefCount);
|
||||||
|
end;
|
||||||
|
|
||||||
|
procedure TSynEditStringList.DecRefCount;
|
||||||
|
begin
|
||||||
|
dec(FRefCount);
|
||||||
|
end;
|
||||||
|
|
||||||
procedure TSynEditStringList.SetCapacity(NewCapacity: integer);
|
procedure TSynEditStringList.SetCapacity(NewCapacity: integer);
|
||||||
begin
|
begin
|
||||||
fList.SetCapacity(NewCapacity);
|
fList.SetCapacity(NewCapacity);
|
||||||
@ -1075,8 +1124,8 @@ begin
|
|||||||
for i:=ATo+Alen-Len to ATo+ALen -1 do Strings[i]:='';
|
for i:=ATo+Alen-Len to ATo+ALen -1 do Strings[i]:='';
|
||||||
end;
|
end;
|
||||||
inherited Move(AFrom, ATo, ALen);
|
inherited Move(AFrom, ATo, ALen);
|
||||||
if assigned(FRangeList) then
|
for i := 0 to length(FRangeList) - 1 do
|
||||||
FRangeList.Move(AFrom, ATo, ALen);
|
FRangeList[i].Data.Move(AFrom, ATo, ALen);
|
||||||
end;
|
end;
|
||||||
|
|
||||||
procedure TSynEditStringMemory.SetCount(const AValue: Integer);
|
procedure TSynEditStringMemory.SetCount(const AValue: Integer);
|
||||||
@ -1086,8 +1135,8 @@ begin
|
|||||||
If Count = AValue then exit;
|
If Count = AValue then exit;
|
||||||
for i:= AValue to Count-1 do Strings[i]:='';
|
for i:= AValue to Count-1 do Strings[i]:='';
|
||||||
inherited SetCount(AValue);
|
inherited SetCount(AValue);
|
||||||
if assigned(FRangeList) then
|
for i := 0 to length(FRangeList) - 1 do
|
||||||
FRangeList.Count := AValue;
|
FRangeList[i].Data.Count := AValue;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
function TSynEditStringMemory.GetAttributeSize: Integer;
|
function TSynEditStringMemory.GetAttributeSize: Integer;
|
||||||
@ -1122,10 +1171,12 @@ begin
|
|||||||
end;
|
end;
|
||||||
|
|
||||||
procedure TSynEditStringMemory.SetCapacity(const AValue: Integer);
|
procedure TSynEditStringMemory.SetCapacity(const AValue: Integer);
|
||||||
|
var
|
||||||
|
i: Integer;
|
||||||
begin
|
begin
|
||||||
inherited SetCapacity(AValue);
|
inherited SetCapacity(AValue);
|
||||||
if assigned(FRangeList) then
|
for i := 0 to length(FRangeList) - 1 do
|
||||||
FRangeList.Capacity := AValue;
|
FRangeList[i].Data.Capacity := AValue;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
function TSynEditStringMemory.GetObject(Index: Integer): TObject;
|
function TSynEditStringMemory.GetObject(Index: Integer): TObject;
|
||||||
@ -1133,17 +1184,47 @@ begin
|
|||||||
Result := (PObject(Mem + Index * FAttributeSize + SizeOf(String)))^;
|
Result := (PObject(Mem + Index * FAttributeSize + SizeOf(String)))^;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
function TSynEditStringMemory.GetRange(Index: TClass): TSynEditStorageMem;
|
||||||
|
var
|
||||||
|
i: Integer;
|
||||||
|
begin
|
||||||
|
for i := 0 to length(FRangeList) - 1 do
|
||||||
|
if FRangeList[i].Index = Index then
|
||||||
|
exit(FRangeList[i].Data);
|
||||||
|
Result := nil;
|
||||||
|
end;
|
||||||
|
|
||||||
procedure TSynEditStringMemory.SetObject(Index: Integer; const AValue: TObject);
|
procedure TSynEditStringMemory.SetObject(Index: Integer; const AValue: TObject);
|
||||||
begin
|
begin
|
||||||
(PObject(Mem + Index * FAttributeSize + SizeOf(String)))^ := AValue;
|
(PObject(Mem + Index * FAttributeSize + SizeOf(String)))^ := AValue;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
procedure TSynEditStringMemory.SetRangeList(const AValue: TSynEditStorageMem);
|
procedure TSynEditStringMemory.SetRange(Index: TClass; const AValue: TSynEditStorageMem);
|
||||||
|
var
|
||||||
|
i, j: Integer;
|
||||||
begin
|
begin
|
||||||
FRangeList := AValue;
|
i := length(FRangeList) - 1;
|
||||||
if FRangeList <> nil then begin
|
while (i >= 0) and (FRangeList[i].Index <> Index) do
|
||||||
FRangeList.Capacity := Capacity;
|
dec(i);
|
||||||
FRangeList.Count := Count;
|
|
||||||
|
if i < 0 then begin
|
||||||
|
i := length(FRangeList);
|
||||||
|
SetLength(FRangeList, i + 1);
|
||||||
|
FRangeList[i].Index := Index;
|
||||||
|
end
|
||||||
|
else
|
||||||
|
if AValue <> nil then
|
||||||
|
DebugLn(['TSynEditStringMemory.SetRange - Overwriting old range at index=', i, ' index=', dbgs(Index)]);
|
||||||
|
|
||||||
|
FRangeList[i].Data := AValue;
|
||||||
|
|
||||||
|
if AValue <> nil then begin
|
||||||
|
AValue.Capacity := Capacity;
|
||||||
|
AValue.Count := Count;
|
||||||
|
end else begin
|
||||||
|
for j := i to length(FRangeList) - 2 do
|
||||||
|
FRangeList[j] := FRangeList[j+1];
|
||||||
|
SetLength(FRangeList, length(FRangeList) - 1);
|
||||||
end;
|
end;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
@ -1929,6 +1929,9 @@ resourcestring
|
|||||||
uemProcedureJump = 'Procedure Jump';
|
uemProcedureJump = 'Procedure Jump';
|
||||||
uemClosePage = '&Close Page';
|
uemClosePage = '&Close Page';
|
||||||
uemCloseOtherPages = 'Close All &Other Pages';
|
uemCloseOtherPages = 'Close All &Other Pages';
|
||||||
|
{$IFDEF SynDualView}
|
||||||
|
uemOpenAnotherView = 'Open in another View';
|
||||||
|
{$ENDIF}
|
||||||
uemCut = 'Cut';
|
uemCut = 'Cut';
|
||||||
uemCopy = 'Copy';
|
uemCopy = 'Copy';
|
||||||
uemPaste = 'Paste';
|
uemPaste = 'Paste';
|
||||||
|
@ -153,6 +153,9 @@ type
|
|||||||
FOnKeyDown: TKeyEvent;
|
FOnKeyDown: TKeyEvent;
|
||||||
|
|
||||||
FSourceNoteBook: TSourceNotebook;
|
FSourceNoteBook: TSourceNotebook;
|
||||||
|
{$IFDEF SynDualView}
|
||||||
|
FOtherViewList: TList;
|
||||||
|
{$ENDIF}
|
||||||
|
|
||||||
procedure EditorMouseMoved(Sender: TObject; Shift: TShiftState; X,Y:Integer);
|
procedure EditorMouseMoved(Sender: TObject; Shift: TShiftState; X,Y:Integer);
|
||||||
procedure EditorMouseDown(Sender: TObject; Button: TMouseButton;
|
procedure EditorMouseDown(Sender: TObject; Button: TMouseButton;
|
||||||
@ -229,6 +232,9 @@ type
|
|||||||
procedure SetReadOnly(const NewValue: boolean); override;
|
procedure SetReadOnly(const NewValue: boolean); override;
|
||||||
|
|
||||||
property Visible: Boolean read FVisible write SetVisible default False;
|
property Visible: Boolean read FVisible write SetVisible default False;
|
||||||
|
{$IFDEF SynDualView}
|
||||||
|
property OtherViewList: Tlist read FOtherViewList;
|
||||||
|
{$ENDIF}
|
||||||
public
|
public
|
||||||
constructor Create(AOwner: TComponent; AParent: TWinControl);
|
constructor Create(AOwner: TComponent; AParent: TWinControl);
|
||||||
destructor Destroy; override;
|
destructor Destroy; override;
|
||||||
@ -520,6 +526,10 @@ type
|
|||||||
procedure SrcPopUpMenuPopup(Sender: TObject);
|
procedure SrcPopUpMenuPopup(Sender: TObject);
|
||||||
procedure ToggleLineNumbersClicked(Sender: TObject);
|
procedure ToggleLineNumbersClicked(Sender: TObject);
|
||||||
procedure InsertCharacter(const C: TUTF8Char);
|
procedure InsertCharacter(const C: TUTF8Char);
|
||||||
|
{$IFDEF SynDualView}
|
||||||
|
procedure OnOtherFormClosed(Sender: TObject; var CloseAction: TCloseAction);
|
||||||
|
procedure SrcEditMenuAnotherViewClicked(Sender: TObject);
|
||||||
|
{$ENDIF}
|
||||||
public
|
public
|
||||||
procedure BookMarkNextClicked(Sender: TObject);
|
procedure BookMarkNextClicked(Sender: TObject);
|
||||||
procedure BookMarkPrevClicked(Sender: TObject);
|
procedure BookMarkPrevClicked(Sender: TObject);
|
||||||
@ -945,6 +955,9 @@ var
|
|||||||
SrcEditMenuShowLineNumbers: TIDEMenuCommand;
|
SrcEditMenuShowLineNumbers: TIDEMenuCommand;
|
||||||
SrcEditMenuShowUnitInfo: TIDEMenuCommand;
|
SrcEditMenuShowUnitInfo: TIDEMenuCommand;
|
||||||
SrcEditMenuEditorProperties: TIDEMenuCommand;
|
SrcEditMenuEditorProperties: TIDEMenuCommand;
|
||||||
|
{$IFDEF SynDualView}
|
||||||
|
SrcEditMenuAnotherView: TIDEMenuCommand;
|
||||||
|
{$ENDIF}
|
||||||
|
|
||||||
|
|
||||||
procedure RegisterStandardSourceEditorMenuItems;
|
procedure RegisterStandardSourceEditorMenuItems;
|
||||||
@ -1137,6 +1150,11 @@ begin
|
|||||||
{$IFNDEF EnableIDEDocking}
|
{$IFNDEF EnableIDEDocking}
|
||||||
SrcEditMenuDocking.Visible:=false;
|
SrcEditMenuDocking.Visible:=false;
|
||||||
{$ENDIF}
|
{$ENDIF}
|
||||||
|
|
||||||
|
{$IFDEF SynDualView}
|
||||||
|
SrcEditMenuAnotherView := RegisterIDEMenuCommand(SrcEditMenuSectionFirstStatic,
|
||||||
|
'Open in another View', uemOpenAnotherView);
|
||||||
|
{$ENDIF}
|
||||||
end;
|
end;
|
||||||
|
|
||||||
{ TSourceEditor }
|
{ TSourceEditor }
|
||||||
@ -1153,6 +1171,9 @@ Begin
|
|||||||
else
|
else
|
||||||
FSourceNoteBook:=nil;
|
FSourceNoteBook:=nil;
|
||||||
|
|
||||||
|
{$IFDEF SynDualView}
|
||||||
|
FOtherViewList := TList.Create;
|
||||||
|
{$ENDIF}
|
||||||
FSyntaxHighlighterType:=lshNone;
|
FSyntaxHighlighterType:=lshNone;
|
||||||
FErrorLine:=-1;
|
FErrorLine:=-1;
|
||||||
FErrorColumn:=-1;
|
FErrorColumn:=-1;
|
||||||
@ -1185,6 +1206,9 @@ begin
|
|||||||
// free the synedit control after processing the events
|
// free the synedit control after processing the events
|
||||||
Application.ReleaseComponent(FEditor);
|
Application.ReleaseComponent(FEditor);
|
||||||
end;
|
end;
|
||||||
|
{$IFDEF SynDualView}
|
||||||
|
FreeAndNil(FOtherViewList);
|
||||||
|
{$ENDIF}
|
||||||
FEditor:=nil;
|
FEditor:=nil;
|
||||||
CodeBuffer := nil;
|
CodeBuffer := nil;
|
||||||
if (DebugBoss <> nil) and (DebugBoss.LineInfo <> nil) then
|
if (DebugBoss <> nil) and (DebugBoss.LineInfo <> nil) then
|
||||||
@ -2474,11 +2498,25 @@ begin
|
|||||||
end;
|
end;
|
||||||
|
|
||||||
Function TSourceEditor.RefreshEditorSettings: Boolean;
|
Function TSourceEditor.RefreshEditorSettings: Boolean;
|
||||||
|
{$IFDEF SynDualView}
|
||||||
|
var
|
||||||
|
s: TComponent;
|
||||||
|
i: Integer;
|
||||||
|
{$ENDIF}
|
||||||
Begin
|
Begin
|
||||||
Result:=true;
|
Result:=true;
|
||||||
SetSyntaxHighlighterType(fSyntaxHighlighterType);
|
SetSyntaxHighlighterType(fSyntaxHighlighterType);
|
||||||
EditorOpts.GetSynEditSettings(FEditor);
|
EditorOpts.GetSynEditSettings(FEditor);
|
||||||
SourceNotebook.UpdateActiveEditColors(FEditor);
|
SourceNotebook.UpdateActiveEditColors(FEditor);
|
||||||
|
{$IFDEF SynDualView}
|
||||||
|
for i := 0 to FOtherViewList.Count - 1 do begin
|
||||||
|
s := TForm(FOtherViewList[i]).FindComponent('s');
|
||||||
|
if s <> nil then begin
|
||||||
|
EditorOpts.GetSynEditSettings(TSynEdit(s));
|
||||||
|
TSynEdit(s).Highlighter := Highlighters[fSyntaxHighlighterType]
|
||||||
|
end;
|
||||||
|
end;
|
||||||
|
{$ENDIF}
|
||||||
end;
|
end;
|
||||||
|
|
||||||
Procedure TSourceEditor.ccAddMessage(Texts: String);
|
Procedure TSourceEditor.ccAddMessage(Texts: String);
|
||||||
@ -3426,7 +3464,16 @@ end;
|
|||||||
|
|
||||||
procedure TSourceEditor.UnbindEditor;
|
procedure TSourceEditor.UnbindEditor;
|
||||||
// disconnect all events
|
// disconnect all events
|
||||||
|
{$IFDEF SynDualView}
|
||||||
|
var
|
||||||
|
i: Integer;
|
||||||
|
{$ENDIF}
|
||||||
begin
|
begin
|
||||||
|
{$IFDEF SynDualView}
|
||||||
|
for i := 0 to FOtherViewList.Count - 1 do
|
||||||
|
TForm(FOtherViewList[i]).Free;
|
||||||
|
FOtherViewList.Clear;
|
||||||
|
{$ENDIF}
|
||||||
with EditorComponent do begin
|
with EditorComponent do begin
|
||||||
OnStatusChange := nil;
|
OnStatusChange := nil;
|
||||||
OnProcessCommand := nil;
|
OnProcessCommand := nil;
|
||||||
@ -4753,6 +4800,9 @@ begin
|
|||||||
SrcEditMenuShowLineNumbers.OnClick:=@ToggleLineNumbersClicked;
|
SrcEditMenuShowLineNumbers.OnClick:=@ToggleLineNumbersClicked;
|
||||||
SrcEditMenuShowUnitInfo.OnClick:=@ShowUnitInfo;
|
SrcEditMenuShowUnitInfo.OnClick:=@ShowUnitInfo;
|
||||||
SrcEditMenuEditorProperties.OnClick:=@EditorPropertiesClicked;
|
SrcEditMenuEditorProperties.OnClick:=@EditorPropertiesClicked;
|
||||||
|
{$IFDEF SynDualView}
|
||||||
|
SrcEditMenuAnotherView.OnClick := @SrcEditMenuAnotherViewClicked;
|
||||||
|
{$ENDIF}
|
||||||
end;
|
end;
|
||||||
|
|
||||||
function TSourceNotebook.GetNotebookPages: TStrings;
|
function TSourceNotebook.GetNotebookPages: TStrings;
|
||||||
@ -6473,6 +6523,49 @@ begin
|
|||||||
end;
|
end;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
{$IFDEF SynDualView}
|
||||||
|
procedure TSourceNotebook.OnOtherFormClosed(Sender: TObject; var CloseAction: TCloseAction);
|
||||||
|
var
|
||||||
|
ASrcEdit: TSourceEditor;
|
||||||
|
s: TSynEdit;
|
||||||
|
begin
|
||||||
|
s := TSynEdit(TForm(Sender).FindComponent('s'));
|
||||||
|
ASrcEdit := FindSourceEditorWithEditorComponent(s.SharedViewEdit);
|
||||||
|
ASrcEdit.OtherViewList.Remove(Sender);
|
||||||
|
CloseAction := caFree;
|
||||||
|
end;
|
||||||
|
|
||||||
|
procedure TSourceNotebook.SrcEditMenuAnotherViewClicked(Sender: TObject);
|
||||||
|
var
|
||||||
|
ASrcEdit: TSourceEditor;
|
||||||
|
f: TForm;
|
||||||
|
s: TSynEdit;
|
||||||
|
SyncroEdit: TSynPluginSyncroEdit;
|
||||||
|
bmp: TCustomBitmap;
|
||||||
|
begin
|
||||||
|
ASrcEdit:=GetActiveSE;
|
||||||
|
if ASrcEdit=nil then exit;
|
||||||
|
f := TForm.Create(Application);
|
||||||
|
f.OnClose := @OnOtherFormClosed;
|
||||||
|
f.Caption := ASrcEdit.FileName;
|
||||||
|
|
||||||
|
s := TSynEdit.Create(f);
|
||||||
|
s.name := 's';
|
||||||
|
s.Parent := f;
|
||||||
|
s.Align := alClient;
|
||||||
|
s.SharedViewEdit := ASrcEdit.EditorComponent;
|
||||||
|
s.Highlighter := ASrcEdit.EditorComponent.Highlighter;
|
||||||
|
SyncroEdit := TSynPluginSyncroEdit.Create(s);
|
||||||
|
bmp := CreateBitmapFromLazarusResource('tsynsyncroedit');
|
||||||
|
SyncroEdit.GutterGlyph.Assign(bmp);
|
||||||
|
bmp.Free;
|
||||||
|
EditorOpts.GetSynEditSettings(s);
|
||||||
|
|
||||||
|
f.show;
|
||||||
|
ASrcEdit.OtherViewList.Add(f);
|
||||||
|
end;
|
||||||
|
{$ENDIF}
|
||||||
|
|
||||||
procedure TSourceNotebook.InitFindDialog;
|
procedure TSourceNotebook.InitFindDialog;
|
||||||
var c: TFindDlgComponent;
|
var c: TFindDlgComponent;
|
||||||
begin
|
begin
|
||||||
|
Loading…
Reference in New Issue
Block a user