mirror of
https://gitlab.com/freepascal.org/lazarus/lazarus.git
synced 2025-04-08 06:18:21 +02:00
IDE, SourceEditor: store highlighter-class in project settings, if changed by user. Issue #0035181
git-svn-id: trunk@60588 -
This commit is contained in:
parent
217529a77e
commit
68e772e2c7
@ -76,7 +76,7 @@ type
|
||||
|
||||
TSrcEditReplaceAction = (seraCancel, seraSkip, seraReplace, seraReplaceAll);
|
||||
|
||||
TSrcEditProjectUpdateNeeded = (sepuNewShared);
|
||||
TSrcEditProjectUpdateNeeded = (sepuNewShared, sepuChangedHighlighter);
|
||||
TSrcEditProjectUpdatesNeeded = set of TSrcEditProjectUpdateNeeded;
|
||||
|
||||
{ TSourceEditorInterface }
|
||||
|
38
ide/main.pp
38
ide/main.pp
@ -11069,23 +11069,29 @@ var
|
||||
begin
|
||||
SrcEdit := TSourceEditor(Sender);
|
||||
p :=Project1.EditorInfoWithEditorComponent(SrcEdit);
|
||||
if p <> nil then begin
|
||||
p.PageIndex := SrcEdit.PageIndex;
|
||||
p.WindowID := SrcEdit.SourceNotebook.WindowID;
|
||||
//SourceEditorManager.IndexOfSourceWindow(SrcEdit.SourceNotebook);
|
||||
p.IsLocked := SrcEdit.IsLocked;
|
||||
end
|
||||
else if sepuNewShared in AnUpdates then begin
|
||||
// attach to UnitInfo
|
||||
i := 0;
|
||||
while (i < SrcEdit.SharedEditorCount) and (SrcEdit.SharedEditors[i] = SrcEdit) do
|
||||
inc(i);
|
||||
p := Project1.EditorInfoWithEditorComponent(SrcEdit.SharedEditors[i]);
|
||||
p := p.UnitInfo.GetClosedOrNewEditorInfo;
|
||||
p.EditorComponent := SrcEdit;
|
||||
p.SyntaxHighlighter := SrcEdit.SyntaxHighlighterType;
|
||||
p.CustomHighlighter := p.SyntaxHighlighter <> p.UnitInfo.DefaultSyntaxHighlighter;
|
||||
if (p = nil) then begin
|
||||
if (sepuNewShared in AnUpdates) then begin
|
||||
// attach to UnitInfo
|
||||
i := 0;
|
||||
while (i < SrcEdit.SharedEditorCount) and (SrcEdit.SharedEditors[i] = SrcEdit) do
|
||||
inc(i);
|
||||
p := Project1.EditorInfoWithEditorComponent(SrcEdit.SharedEditors[i]);
|
||||
p := p.UnitInfo.GetClosedOrNewEditorInfo;
|
||||
p.EditorComponent := SrcEdit;
|
||||
end
|
||||
else
|
||||
exit;
|
||||
end;
|
||||
|
||||
if AnUpdates * [sepuNewShared, sepuChangedHighlighter] <> [] then begin
|
||||
p.SyntaxHighlighter := SrcEdit.SyntaxHighlighterType;
|
||||
end;
|
||||
|
||||
p.PageIndex := SrcEdit.PageIndex;
|
||||
p.WindowID := SrcEdit.SourceNotebook.WindowID;
|
||||
//SourceEditorManager.IndexOfSourceWindow(SrcEdit.SourceNotebook);
|
||||
p.IsLocked := SrcEdit.IsLocked;
|
||||
|
||||
end;
|
||||
|
||||
procedure TMainIDE.SrcNotebookEditorCreated(Sender: TObject);
|
||||
|
@ -189,6 +189,7 @@ type
|
||||
procedure SetFoldState(AValue: String);
|
||||
procedure SetPageIndex(const AValue: Integer);
|
||||
procedure SetIsVisibleTab(const AValue: Boolean);
|
||||
procedure SetSyntaxHighlighter(AValue: TLazSyntaxHighlighter);
|
||||
procedure SetWindowIndex(const AValue: Integer);
|
||||
protected
|
||||
procedure Clear;
|
||||
@ -209,7 +210,7 @@ type
|
||||
property FoldState: String read FFoldState write SetFoldState;
|
||||
property IsLocked: Boolean read FIsLocked write FIsLocked;
|
||||
property CustomHighlighter: Boolean read FCustomHighlighter write FCustomHighlighter; // SetCustomHighlighter
|
||||
property SyntaxHighlighter: TLazSyntaxHighlighter read FSyntaxHighlighter write FSyntaxHighlighter; // SetSyntaxHighlighter
|
||||
property SyntaxHighlighter: TLazSyntaxHighlighter read FSyntaxHighlighter write SetSyntaxHighlighter; // SetSyntaxHighlighter
|
||||
end;
|
||||
|
||||
{ TUnitEditorInfoList }
|
||||
@ -1250,6 +1251,14 @@ begin
|
||||
FUnitInfo.SessionModified := True;
|
||||
end;
|
||||
|
||||
procedure TUnitEditorInfo.SetSyntaxHighlighter(AValue: TLazSyntaxHighlighter);
|
||||
begin
|
||||
if FSyntaxHighlighter = AValue then Exit;
|
||||
FSyntaxHighlighter := AValue;
|
||||
FCustomHighlighter := FSyntaxHighlighter <> FUnitInfo.DefaultSyntaxHighlighter;
|
||||
FUnitInfo.SessionModified := True;
|
||||
end;
|
||||
|
||||
procedure TUnitEditorInfo.SetWindowIndex(const AValue: Integer);
|
||||
begin
|
||||
if FWindowID = AValue then exit;
|
||||
|
@ -6705,6 +6705,7 @@ begin
|
||||
and (i<=ord(High(TLazSyntaxHighlighter))) then begin
|
||||
h:=TLazSyntaxHighlighter(i);
|
||||
SrcEdit.SyntaxHighlighterType:=h;
|
||||
SrcEdit.UpdateProjectFile([sepuChangedHighlighter]);
|
||||
end;
|
||||
end;
|
||||
end;
|
||||
|
Loading…
Reference in New Issue
Block a user