mirror of
https://gitlab.com/freepascal.org/lazarus/lazarus.git
synced 2025-04-20 12:19:31 +02:00
IDE, Opitons: markup opts for other xml and lfm
git-svn-id: trunk@52197 -
This commit is contained in:
parent
dde6bc8194
commit
294d29a4b9
@ -416,6 +416,7 @@ type
|
||||
|
||||
TEditorOptionsFoldRecord = record
|
||||
Count: Integer;
|
||||
HasMarkup: Boolean;
|
||||
Info: PEditorOptionsFoldInfoList;
|
||||
end;
|
||||
|
||||
@ -588,26 +589,26 @@ const
|
||||
(* When adding new entries, ensure that resourcestrings are re-assigned in InitLocale *)
|
||||
EditorOptionsFoldDefaults: array[TLazSyntaxHighlighter] of
|
||||
TEditorOptionsFoldRecord =
|
||||
( (Count: 0; Info: nil), // none
|
||||
(Count: 0; Info: nil), // text
|
||||
(Count: 27; Info: @EditorOptionsFoldInfoPas[0]), // Freepas
|
||||
(Count: 27; Info: @EditorOptionsFoldInfoPas[0]), // pas
|
||||
(Count: 3; Info: @EditorOptionsFoldInfoLFM[0]), // lfm
|
||||
(Count: 5; Info: @EditorOptionsFoldInfoXML[0]), // xml
|
||||
(Count: 3; Info: @EditorOptionsFoldInfoHTML[0]), // html
|
||||
(Count: 0; Info: nil), // cpp
|
||||
(Count: 0; Info: nil), // perl
|
||||
(Count: 0; Info: nil), // java
|
||||
(Count: 0; Info: nil), // shell
|
||||
(Count: 0; Info: nil), // python
|
||||
(Count: 0; Info: nil), // php
|
||||
(Count: 0; Info: nil), // sql
|
||||
(Count: 0; Info: nil), // jscript
|
||||
(Count: 3; Info: @EditorOptionsFoldInfoDiff[0]), // Diff
|
||||
(Count: 0; Info: nil), // Bat
|
||||
(Count: 0; Info: nil), // Ini
|
||||
(Count: 0; Info: nil), // PO
|
||||
(Count: 0; Info: nil) // Pike
|
||||
( (Count: 0; HasMarkup: False; Info: nil), // none
|
||||
(Count: 0; HasMarkup: False; Info: nil), // text
|
||||
(Count: 27; HasMarkup: True; Info: @EditorOptionsFoldInfoPas[0]), // Freepas
|
||||
(Count: 27; HasMarkup: True; Info: @EditorOptionsFoldInfoPas[0]), // pas
|
||||
(Count: 3; HasMarkup: True; Info: @EditorOptionsFoldInfoLFM[0]), // lfm
|
||||
(Count: 5; HasMarkup: True; Info: @EditorOptionsFoldInfoXML[0]), // xml
|
||||
(Count: 3; HasMarkup: True; Info: @EditorOptionsFoldInfoHTML[0]), // html
|
||||
(Count: 0; HasMarkup: False; Info: nil), // cpp
|
||||
(Count: 0; HasMarkup: False; Info: nil), // perl
|
||||
(Count: 0; HasMarkup: False; Info: nil), // java
|
||||
(Count: 0; HasMarkup: False; Info: nil), // shell
|
||||
(Count: 0; HasMarkup: False; Info: nil), // python
|
||||
(Count: 0; HasMarkup: False; Info: nil), // php
|
||||
(Count: 0; HasMarkup: False; Info: nil), // sql
|
||||
(Count: 0; HasMarkup: False; Info: nil), // jscript
|
||||
(Count: 3; HasMarkup: False; Info: @EditorOptionsFoldInfoDiff[0]), // Diff
|
||||
(Count: 0; HasMarkup: False; Info: nil), // Bat
|
||||
(Count: 0; HasMarkup: False; Info: nil), // Ini
|
||||
(Count: 0; HasMarkup: False; Info: nil), // PO
|
||||
(Count: 0; HasMarkup: False; Info: nil) // Pike
|
||||
);
|
||||
|
||||
const
|
||||
|
@ -3,8 +3,8 @@ object EditorMarkupOptionsFrame: TEditorMarkupOptionsFrame
|
||||
Height = 492
|
||||
Top = 0
|
||||
Width = 634
|
||||
HorzScrollBar.Page = 634
|
||||
VertScrollBar.Page = 492
|
||||
HorzScrollBar.Page = 1
|
||||
VertScrollBar.Page = 1
|
||||
AutoScroll = True
|
||||
ClientHeight = 492
|
||||
ClientWidth = 634
|
||||
@ -312,13 +312,13 @@ object EditorMarkupOptionsFrame: TEditorMarkupOptionsFrame
|
||||
end
|
||||
object chkKWGroups: TCheckListBox
|
||||
AnchorSideLeft.Control = Owner
|
||||
AnchorSideTop.Control = divKeyWordGroups
|
||||
AnchorSideTop.Control = LanguageComboBox
|
||||
AnchorSideTop.Side = asrBottom
|
||||
AnchorSideBottom.Control = Owner
|
||||
AnchorSideBottom.Side = asrBottom
|
||||
Left = 6
|
||||
Height = 185
|
||||
Top = 301
|
||||
Height = 156
|
||||
Top = 330
|
||||
Width = 220
|
||||
Anchors = [akTop, akLeft, akBottom]
|
||||
BorderSpacing.Around = 6
|
||||
@ -329,4 +329,34 @@ object EditorMarkupOptionsFrame: TEditorMarkupOptionsFrame
|
||||
OnKeyUp = chkKWGroupsKeyUp
|
||||
TabOrder = 8
|
||||
end
|
||||
object LanguageComboBox: TComboBox
|
||||
AnchorSideLeft.Control = Owner
|
||||
AnchorSideTop.Control = divKeyWordGroups
|
||||
AnchorSideTop.Side = asrBottom
|
||||
Left = 6
|
||||
Height = 23
|
||||
Top = 301
|
||||
Width = 200
|
||||
BorderSpacing.Left = 6
|
||||
BorderSpacing.Top = 6
|
||||
ItemHeight = 15
|
||||
OnChange = LanguageComboBoxChange
|
||||
OnExit = LanguageComboBoxExit
|
||||
OnKeyDown = LanguageComboBoxKeyDown
|
||||
Style = csDropDownList
|
||||
TabOrder = 9
|
||||
end
|
||||
object LanguageLabel: TLabel
|
||||
AnchorSideLeft.Control = LanguageComboBox
|
||||
AnchorSideLeft.Side = asrBottom
|
||||
AnchorSideTop.Control = LanguageComboBox
|
||||
AnchorSideTop.Side = asrCenter
|
||||
Left = 212
|
||||
Height = 15
|
||||
Top = 305
|
||||
Width = 80
|
||||
BorderSpacing.Left = 6
|
||||
Caption = 'LanguageLabel'
|
||||
ParentColor = False
|
||||
end
|
||||
end
|
||||
|
@ -45,6 +45,8 @@ type
|
||||
divKeywords: TDividerBevel;
|
||||
divMatchingBrackets: TDividerBevel;
|
||||
divWordGroup: TDividerBevel;
|
||||
LanguageComboBox: TComboBox;
|
||||
LanguageLabel: TLabel;
|
||||
lblPasStringKeywords: TLabel;
|
||||
MarkupColorLink: TLabel;
|
||||
MarkupKeyLink: TLabel;
|
||||
@ -68,12 +70,20 @@ type
|
||||
procedure dropPasStringKeywordsChange(Sender: TObject);
|
||||
function GeneralPage: TEditorGeneralOptionsFrame; inline;
|
||||
function FoldPage: TEditorCodefoldingOptionsFrame; inline;
|
||||
procedure LanguageComboBoxChange(Sender: TObject);
|
||||
procedure LanguageComboBoxExit(Sender: TObject);
|
||||
procedure LanguageComboBoxKeyDown(Sender: TObject; var Key: Word;
|
||||
Shift: TShiftState);
|
||||
procedure MarkupColorLinkClick(Sender: TObject);
|
||||
procedure MarkupKeyLinkClick(Sender: TObject);
|
||||
private
|
||||
{ private declarations }
|
||||
FDialog: TAbstractOptionsEditorDialog;
|
||||
FKWMathHighLighter: TSynCustomFoldHighlighter;
|
||||
FCurHighlighter: TSrcIDEHighlighter;
|
||||
FCurFoldInfo: TEditorOptionsFoldRecord;
|
||||
function GetHighlighter(SynType: TLazSyntaxHighlighter;
|
||||
CreateIfNotExists: Boolean): TSrcIDEHighlighter;
|
||||
|
||||
public
|
||||
function GetTitle: String; override;
|
||||
procedure Setup(ADialog: TAbstractOptionsEditorDialog); override;
|
||||
@ -156,17 +166,20 @@ end;
|
||||
procedure TEditorMarkupOptionsFrame.chkKWGroupsClickCheck(Sender: TObject);
|
||||
var
|
||||
i, j, idx: Integer;
|
||||
CurFoldInfo: TEditorOptionsFoldRecord;
|
||||
Hl: TSynCustomFoldHighlighter;
|
||||
begin
|
||||
if not (assigned(FCurHighlighter) and
|
||||
(FCurHighlighter is TSynCustomFoldHighlighter)) then exit;
|
||||
Hl := TSynCustomFoldHighlighter(FCurHighlighter);
|
||||
|
||||
j := 0;
|
||||
CurFoldInfo := EditorOptionsFoldDefaults[lshFreePascal];
|
||||
for i := 0 to CurFoldInfo.Count - 1 do begin
|
||||
idx := CurFoldInfo.Info^[i].Index;
|
||||
if fmMarkup in FKWMathHighLighter.FoldConfig[idx].SupportedModes then begin
|
||||
for i := 0 to FCurFoldInfo.Count - 1 do begin
|
||||
idx := FCurFoldInfo.Info^[i].Index;
|
||||
if fmMarkup in Hl.FoldConfig[idx].SupportedModes then begin
|
||||
if chkKWGroups.Checked[j] then
|
||||
FKWMathHighLighter.FoldConfig[idx].Modes := FKWMathHighLighter.FoldConfig[idx].Modes + [fmMarkup]
|
||||
Hl.FoldConfig[idx].Modes := Hl.FoldConfig[idx].Modes + [fmMarkup]
|
||||
else
|
||||
FKWMathHighLighter.FoldConfig[idx].Modes := FKWMathHighLighter.FoldConfig[idx].Modes - [fmMarkup];
|
||||
Hl.FoldConfig[idx].Modes := Hl.FoldConfig[idx].Modes - [fmMarkup];
|
||||
inc(j);
|
||||
end;
|
||||
end;
|
||||
@ -194,6 +207,48 @@ begin
|
||||
Result := TEditorCodefoldingOptionsFrame(FDialog.FindEditor(TEditorCodefoldingOptionsFrame));
|
||||
end;
|
||||
|
||||
procedure TEditorMarkupOptionsFrame.LanguageComboBoxChange(Sender: TObject);
|
||||
var
|
||||
ComboBox: TComboBox absolute Sender;
|
||||
begin
|
||||
if ComboBox.Items.IndexOf(ComboBox.Text) >= 0 then
|
||||
LanguageComboBoxExit(Sender);
|
||||
end;
|
||||
|
||||
procedure TEditorMarkupOptionsFrame.LanguageComboBoxExit(Sender: TObject);
|
||||
var
|
||||
ComboBox: TComboBox absolute Sender;
|
||||
tp: TLazSyntaxHighlighter;
|
||||
i, j: Integer;
|
||||
Hl: TSynCustomFoldHighlighter;
|
||||
begin
|
||||
tp := EditorOpts.HighlighterList
|
||||
[EditorOpts.HighlighterList.FindByName(ComboBox.Text)].TheType;
|
||||
FCurHighlighter := GetHighlighter(tp, True);
|
||||
FCurFoldInfo := EditorOptionsFoldDefaults[tp];
|
||||
|
||||
chkKWGroups.Clear;
|
||||
if not (assigned(FCurHighlighter) and
|
||||
(FCurHighlighter is TSynCustomFoldHighlighter)) then exit;
|
||||
Hl := TSynCustomFoldHighlighter(FCurHighlighter);
|
||||
|
||||
for i := 0 to FCurFoldInfo.Count - 1 do begin
|
||||
if Hl.FoldConfig[FCurFoldInfo.Info^[i].Index].SupportedModes * [fmMarkup{, fmOutline}] <> [] then begin
|
||||
j := chkKWGroups.Items.Add(FCurFoldInfo.Info^[i].Name);
|
||||
chkKWGroups.Checked[j] :=
|
||||
(Hl.FoldConfig[FCurFoldInfo.Info^[i].Index].Modes * [fmMarkup{, fmOutline}] <> []);
|
||||
chkKWGroups.Items.Objects[j] := TObject({%H-}Pointer(PtrUInt(i)));
|
||||
end;
|
||||
end;
|
||||
end;
|
||||
|
||||
procedure TEditorMarkupOptionsFrame.LanguageComboBoxKeyDown(Sender: TObject;
|
||||
var Key: Word; Shift: TShiftState);
|
||||
begin
|
||||
if (ssCtrl in Shift) and (Key = VK_S) then
|
||||
LanguageComboBoxExit(Sender);
|
||||
end;
|
||||
|
||||
procedure TEditorMarkupOptionsFrame.MarkupColorLinkClick(Sender: TObject);
|
||||
var
|
||||
col: TEditorColorOptionsFrame;
|
||||
@ -214,12 +269,22 @@ begin
|
||||
col.SelectByIdeCommand(EcToggleMarkupWord);
|
||||
end;
|
||||
|
||||
function TEditorMarkupOptionsFrame.GetHighlighter(
|
||||
SynType: TLazSyntaxHighlighter; CreateIfNotExists: Boolean
|
||||
): TSrcIDEHighlighter;
|
||||
begin
|
||||
Result := FoldPage.GetHighlighter(SynType, CreateIfNotExists);
|
||||
end;
|
||||
|
||||
function TEditorMarkupOptionsFrame.GetTitle: String;
|
||||
begin
|
||||
Result := lisAutoMarkup;
|
||||
end;
|
||||
|
||||
procedure TEditorMarkupOptionsFrame.Setup(ADialog: TAbstractOptionsEditorDialog);
|
||||
var
|
||||
i: Integer;
|
||||
rf: TEditorOptionsFoldRecord;
|
||||
begin
|
||||
FDialog := ADialog;
|
||||
|
||||
@ -247,11 +312,20 @@ begin
|
||||
dropPasStringKeywords.Items.Add(dlgPasStringKeywordsOptNone);
|
||||
|
||||
divKeyWordGroups.Caption := dlgPasKeywordsMatches;
|
||||
|
||||
with LanguageComboBox.Items do begin
|
||||
BeginUpdate;
|
||||
for i := 0 to EditorOpts.HighlighterList.Count - 1 do begin
|
||||
rf := EditorOptionsFoldDefaults[EditorOpts.HighlighterList[i].TheType];
|
||||
if (rf.Count > 0) and (rf.HasMarkup) then
|
||||
Add(EditorOpts.HighlighterList[i].SynClass.GetLanguageName);
|
||||
end;
|
||||
EndUpdate;
|
||||
end;
|
||||
end;
|
||||
|
||||
procedure TEditorMarkupOptionsFrame.ReadSettings(AOptions: TAbstractIDEOptions);
|
||||
var
|
||||
CurFoldInfo: TEditorOptionsFoldRecord;
|
||||
i, j, idx: Integer;
|
||||
begin
|
||||
with AOptions as TEditorOptions do
|
||||
@ -272,16 +346,8 @@ begin
|
||||
end;
|
||||
AutoDelayTrackBarChange(nil);
|
||||
|
||||
FKWMathHighLighter := TSynCustomFoldHighlighter(FoldPage.GetHighlighter(lshFreePascal, True));
|
||||
CurFoldInfo := EditorOptionsFoldDefaults[lshFreePascal];
|
||||
for i := 0 to CurFoldInfo.Count - 1 do begin
|
||||
idx := CurFoldInfo.Info^[i].Index;
|
||||
if fmMarkup in FKWMathHighLighter.FoldConfig[idx].SupportedModes then begin
|
||||
j := chkKWGroups.Items.Add(CurFoldInfo.Info^[i].Name);
|
||||
chkKWGroups.Checked[j] := fmMarkup in FKWMathHighLighter.FoldConfig[idx].Modes;
|
||||
end;
|
||||
end;
|
||||
|
||||
LanguageComboBox.ItemIndex := 0;
|
||||
LanguageComboBoxExit(LanguageComboBox);
|
||||
end;
|
||||
|
||||
procedure TEditorMarkupOptionsFrame.WriteSettings(AOptions: TAbstractIDEOptions);
|
||||
|
Loading…
Reference in New Issue
Block a user