IDE: update Editor > Userdefined Markup options

This commit is contained in:
Martin 2025-03-24 18:29:42 +01:00
parent 8aea8f322f
commit 0cd0084798
4 changed files with 762 additions and 694 deletions

File diff suppressed because it is too large Load Diff

View File

@ -51,6 +51,10 @@ type
{ TEditorMarkupUserDefinedFrame } { TEditorMarkupUserDefinedFrame }
TEditorMarkupUserDefinedFrame = class(TAbstractIDEOptionsEditor) TEditorMarkupUserDefinedFrame = class(TAbstractIDEOptionsEditor)
btnAdd: TButton;
btnCopy: TButton;
btnDelete: TButton;
cbGroup: TComboBox;
cbCaseSense: TCheckBox; cbCaseSense: TCheckBox;
cbMatchEndBound: TCheckBox; cbMatchEndBound: TCheckBox;
cbMatchStartBound: TCheckBox; cbMatchStartBound: TCheckBox;
@ -59,11 +63,14 @@ type
cbKeyBoundEnd: TCheckBox; cbKeyBoundEnd: TCheckBox;
cbSmartSelectBound: TCheckBox; cbSmartSelectBound: TCheckBox;
cbGlobalList: TCheckBox; cbGlobalList: TCheckBox;
divEditGroup: TDividerBevel;
divKeyAdd: TDividerBevel; divKeyAdd: TDividerBevel;
divKeyRemove: TDividerBevel; divKeyRemove: TDividerBevel;
divKeyToggle: TDividerBevel; divKeyToggle: TDividerBevel;
divSelectGroup: TDividerBevel;
edListName: TEdit; edListName: TEdit;
HCenter: TLabel; HCenter: TLabel;
lbListName: TLabel;
lbWordMin: TLabel; lbWordMin: TLabel;
lbSelectMin: TLabel; lbSelectMin: TLabel;
HQuarter: TLabel; HQuarter: TLabel;
@ -76,12 +83,10 @@ type
lbKeyRemove2: TLabel; lbKeyRemove2: TLabel;
lbKeyToggle1: TLabel; lbKeyToggle1: TLabel;
lbKeyToggle2: TLabel; lbKeyToggle2: TLabel;
lbListName: TLabel; MainPanel: TScrollBox;
ListMenu: TPopupMenu; pnlKeys: TPanel;
MainPanel: TPanel; pnlMain: TPanel;
Notebook1: TNotebook; PageControl1: TPageControl;
PageMain: TPage;
PageKeys: TPage;
Panel1: TPanel; Panel1: TPanel;
btnKeyAdd: TSpeedButton; btnKeyAdd: TSpeedButton;
btnKeyRemove: TSpeedButton; btnKeyRemove: TSpeedButton;
@ -89,22 +94,17 @@ type
edWordMin: TSpinEdit; edWordMin: TSpinEdit;
edSelectMin: TSpinEdit; edSelectMin: TSpinEdit;
SynColorAttrEditor1: TSynColorAttrEditor; SynColorAttrEditor1: TSynColorAttrEditor;
ToolBar1: TToolBar; tabMain: TTabSheet;
tbSelectList: TToolButton; tabKeys: TTabSheet;
tbNewList: TToolButton;
tbDeleteList: TToolButton;
ToolButton2: TToolButton;
tbMainPage: TToolButton;
tbKeyPage: TToolButton;
WordList: TColorStringGrid; WordList: TColorStringGrid;
procedure cbGroupChange(Sender: TObject);
procedure edListNameEditingDone(Sender: TObject); procedure edListNameEditingDone(Sender: TObject);
procedure edListNameKeyPress(Sender: TObject; var Key: char); procedure edListNameKeyPress(Sender: TObject; var Key: char);
procedure KeyEditClicked(Sender: TObject); procedure KeyEditClicked(Sender: TObject);
procedure PageControl1Change(Sender: TObject);
procedure tbDeleteListClick(Sender: TObject); procedure tbDeleteListClick(Sender: TObject);
procedure tbNewListClick(Sender: TObject); procedure tbNewListClick(Sender: TObject);
procedure tbSelectListClick(Sender: TObject);
procedure GeneralCheckBoxChange(Sender: TObject); procedure GeneralCheckBoxChange(Sender: TObject);
procedure tbSelectPageClicked(Sender: TObject);
procedure WordListButtonClick(Sender: TObject; {%H-}aCol, aRow: Integer); procedure WordListButtonClick(Sender: TObject; {%H-}aCol, aRow: Integer);
procedure WordListColRowDeleted(Sender: TObject; {%H-}IsColumn: Boolean; {%H-}sIndex, procedure WordListColRowDeleted(Sender: TObject; {%H-}IsColumn: Boolean; {%H-}sIndex,
{%H-}tIndex: Integer); {%H-}tIndex: Integer);
@ -122,7 +122,6 @@ type
FSelectedRow: Integer; FSelectedRow: Integer;
FUpdatingDisplay: Integer; FUpdatingDisplay: Integer;
procedure CheckDuplicate(AnIndex: Integer); procedure CheckDuplicate(AnIndex: Integer);
procedure DoListSelected(Sender: TObject);
procedure MaybeCleanEmptyRow(aRow: Integer); procedure MaybeCleanEmptyRow(aRow: Integer);
procedure UpdateKeys; procedure UpdateKeys;
procedure UpdateTermOptions; procedure UpdateTermOptions;
@ -272,6 +271,15 @@ begin
UpdateListDropDownFull; UpdateListDropDownFull;
end; end;
procedure TEditorMarkupUserDefinedFrame.cbGroupChange(Sender: TObject);
begin
if WordList.EditorMode then
WordList.EditingDone;
FSelectedListIdx := cbGroup.ItemIndex;
UpdateListDisplay;
end;
procedure TEditorMarkupUserDefinedFrame.edListNameKeyPress(Sender: TObject; var Key: char); procedure TEditorMarkupUserDefinedFrame.edListNameKeyPress(Sender: TObject; var Key: char);
begin begin
if key in [#10,#13] then edListNameEditingDone(nil); if key in [#10,#13] then edListNameEditingDone(nil);
@ -298,6 +306,12 @@ begin
UpdateKeys; UpdateKeys;
end; end;
procedure TEditorMarkupUserDefinedFrame.PageControl1Change(Sender: TObject);
begin
if WordList.EditorMode then
WordList.EditingDone;
end;
procedure TEditorMarkupUserDefinedFrame.tbDeleteListClick(Sender: TObject); procedure TEditorMarkupUserDefinedFrame.tbDeleteListClick(Sender: TObject);
begin begin
if FUserWords = nil then exit; if FUserWords = nil then exit;
@ -330,11 +344,6 @@ begin
UpdateListDisplay; UpdateListDisplay;
end; end;
procedure TEditorMarkupUserDefinedFrame.tbSelectListClick(Sender: TObject);
begin
tbSelectList.CheckMenuDropdown;
end;
procedure TEditorMarkupUserDefinedFrame.GeneralCheckBoxChange(Sender: TObject); procedure TEditorMarkupUserDefinedFrame.GeneralCheckBoxChange(Sender: TObject);
var var
i: PtrInt; i: PtrInt;
@ -406,17 +415,6 @@ begin
end; end;
procedure TEditorMarkupUserDefinedFrame.tbSelectPageClicked(Sender: TObject);
begin
if WordList.EditorMode then
WordList.EditingDone;
if tbMainPage.Down then
Notebook1.PageIndex := 0
else
Notebook1.PageIndex := 1;
end;
procedure TEditorMarkupUserDefinedFrame.WordListButtonClick(Sender: TObject; procedure TEditorMarkupUserDefinedFrame.WordListButtonClick(Sender: TObject;
aCol, aRow: Integer); aCol, aRow: Integer);
var var
@ -554,15 +552,6 @@ begin
UpdateDupErrors; UpdateDupErrors;
end; end;
procedure TEditorMarkupUserDefinedFrame.DoListSelected(Sender: TObject);
begin
if WordList.EditorMode then
WordList.EditingDone;
FSelectedListIdx := TMenuItem(Sender).Tag;
UpdateListDisplay;
end;
procedure TEditorMarkupUserDefinedFrame.MaybeCleanEmptyRow(aRow: Integer); procedure TEditorMarkupUserDefinedFrame.MaybeCleanEmptyRow(aRow: Integer);
var var
i: PtrInt; i: PtrInt;
@ -645,34 +634,27 @@ end;
procedure TEditorMarkupUserDefinedFrame.UpdateListDropDownFull; procedure TEditorMarkupUserDefinedFrame.UpdateListDropDownFull;
var var
m: TMenuItem;
i: Integer; i: Integer;
begin begin
ListMenu.Items.Clear; cbGroup.Clear;
if FUserWordsList.Count > 0 then begin for i := 0 to FUserWordsList.Count - 1 do
for i := 0 to FUserWordsList.Count - 1 do begin cbGroup.Items.Add(FUserWordsList.Lists[i].Name);
m := TMenuItem.Create(ListMenu);
m.Caption := FUserWordsList.Lists[i].Name;
m.Tag := i;
m.OnClick := @DoListSelected;
ListMenu.Items.Add(m);
end;
end;
UpdateListDropDownCaption; UpdateListDropDownCaption;
end; end;
procedure TEditorMarkupUserDefinedFrame.UpdateListDropDownCaption; procedure TEditorMarkupUserDefinedFrame.UpdateListDropDownCaption;
begin begin
if FUserWordsList.Count = 0 then begin if FUserWordsList.Count = 0 then begin
tbSelectList.Enabled := False; cbGroup.Enabled := False;
tbSelectList.Caption := dlgMarkupUserDefinedNoLists; cbGroup.Caption := dlgMarkupUserDefinedNoLists;
end end
else begin else begin
tbSelectList.Enabled := True; cbGroup.Enabled := True;
if (FSelectedListIdx >= 0) and (FSelectedListIdx < FUserWordsList.Count) then if (FSelectedListIdx >= 0) and (FSelectedListIdx < FUserWordsList.Count) then
tbSelectList.Caption := FUserWordsList.Lists[FSelectedListIdx].Name cbGroup.ItemIndex := FSelectedListIdx
//cbGroup.Caption := FUserWordsList.Lists[FSelectedListIdx].Name
else else
tbSelectList.Caption := dlgMarkupUserDefinedNoListsSel; cbGroup.Caption := dlgMarkupUserDefinedNoListsSel;
end; end;
end; end;
@ -753,11 +735,13 @@ procedure TEditorMarkupUserDefinedFrame.Setup(ADialog: TAbstractOptionsEditorDia
begin begin
SynColorAttrEditor1.Setup; SynColorAttrEditor1.Setup;
SynColorAttrEditor1.ShowPrior := True; SynColorAttrEditor1.ShowPrior := True;
tbNewList.Caption := dlgMarkupUserDefinedListNew; divSelectGroup.Caption := dlgMarkupUserDefinedDivSelect;
tbDeleteList.Caption := dlgMarkupUserDefinedListDel; divEditGroup.Caption := dlgMarkupUserDefinedDivEdit;
btnAdd.Caption := dlgMarkupUserDefinedListNew;
btnDelete.Caption := dlgMarkupUserDefinedListDel;
lbListName.Caption := dlgMarkupUserDefinedListName; lbListName.Caption := dlgMarkupUserDefinedListName;
tbMainPage.Caption := dlgMarkupUserDefinedPageMain; tabMain.Caption := dlgMarkupUserDefinedPageMain;
tbKeyPage.Caption := dlgMarkupUserDefinedPageKeys; tabKeys.Caption := dlgMarkupUserDefinedPageKeys;
cbCaseSense.Caption := dlgMarkupUserDefinedMatchCase; cbCaseSense.Caption := dlgMarkupUserDefinedMatchCase;
cbMatchStartBound.Caption := dlgMarkupUserDefinedMatchStartBound; cbMatchStartBound.Caption := dlgMarkupUserDefinedMatchStartBound;
cbMatchEndBound.Caption := dlgMarkupUserDefinedMatchEndBound; cbMatchEndBound.Caption := dlgMarkupUserDefinedMatchEndBound;
@ -791,7 +775,7 @@ begin
FSelectedListIdx := 0; FSelectedListIdx := 0;
UpdateListDropDownFull; UpdateListDropDownFull;
UpdateListDisplay; UpdateListDisplay;
tbDeleteList.Enabled := FUserWordsList.Count > 0; cbGroup.Enabled := FUserWordsList.Count > 0;
FGlobalColors := nil; FGlobalColors := nil;
UpdateKeys; UpdateKeys;
end; end;

View File

@ -2021,6 +2021,8 @@ resourcestring
dlgIncludeCodeTemplatesToIdentCompl = 'Include code templates'; dlgIncludeCodeTemplatesToIdentCompl = 'Include code templates';
dlgMarkupUserDefined = 'User defined markup'; dlgMarkupUserDefined = 'User defined markup';
dlgMarkupUserDefinedDivSelect = 'Create or Select list';
dlgMarkupUserDefinedDivEdit = 'Edit list';
dlgMarkupUserDefinedNoLists = 'No lists'; dlgMarkupUserDefinedNoLists = 'No lists';
dlgMarkupUserDefinedNoListsSel = 'Select ...'; dlgMarkupUserDefinedNoListsSel = 'Select ...';
dlgMarkupUserDefinedNewName = 'New list'; dlgMarkupUserDefinedNewName = 'New list';

View File

@ -570,12 +570,21 @@ procedure TSynColorAttrEditor.UpdateAll;
(FCurrentColorScheme.AttributeByEnum[aha] <> nil) and (FCurrentColorScheme.AttributeByEnum[aha] <> nil) and
(Element.StoredName = FCurrentColorScheme.AttributeByEnum[aha].StoredName); (Element.StoredName = FCurrentColorScheme.AttributeByEnum[aha].StoredName);
end; end;
var
UsingTempAttr: Boolean;
begin begin
if (FCurHighlightElement = nil) or UpdatingColor then if UpdatingColor then
Exit; exit;
UpdatingColor := True; UpdatingColor := True;
DisableAlign; DisableAlign;
try try
UsingTempAttr := FCurHighlightElement = nil;
if UsingTempAttr then begin
FCurHighlightElement := TColorSchemeAttribute.Create(nil, nil, '');
FCurHighlightElement.Clear;
end;
// Adjust color captions // Adjust color captions
ForeGroundUseDefaultCheckBox.Caption := dlgForecolor; ForeGroundUseDefaultCheckBox.Caption := dlgForecolor;
BackGroundUseDefaultCheckBox.Caption := dlgBackColor; BackGroundUseDefaultCheckBox.Caption := dlgBackColor;
@ -804,6 +813,8 @@ begin
UpdatingColor := False; UpdatingColor := False;
finally finally
if UsingTempAttr then
FreeAndNil(FCurHighlightElement);
EnableAlign; EnableAlign;
end; end;
pnlElementAttributesResize(nil); pnlElementAttributesResize(nil);