mirror of
https://gitlab.com/freepascal.org/lazarus/lazarus.git
synced 2025-09-11 00:59:52 +02:00
EditorToolbar improvements. Issue #26524, patch from G. Colla.
git-svn-id: trunk@45975 -
This commit is contained in:
parent
68dff727a5
commit
84240315c3
@ -19,7 +19,7 @@
|
|||||||
"/>
|
"/>
|
||||||
<License Value="GPL
|
<License Value="GPL
|
||||||
"/>
|
"/>
|
||||||
<Version Minor="5"/>
|
<Version Minor="5" Release="2"/>
|
||||||
<Files Count="4">
|
<Files Count="4">
|
||||||
<Item1>
|
<Item1>
|
||||||
<Filename Value="jumpto_impl.pas"/>
|
<Filename Value="jumpto_impl.pas"/>
|
||||||
|
@ -92,6 +92,7 @@ procedure Register;
|
|||||||
var
|
var
|
||||||
sToolbarPos: string;
|
sToolbarPos: string;
|
||||||
bToolBarShow: boolean;
|
bToolBarShow: boolean;
|
||||||
|
EditorMenuCommand:TIDEMenuCommand;
|
||||||
|
|
||||||
implementation
|
implementation
|
||||||
|
|
||||||
@ -130,6 +131,17 @@ begin
|
|||||||
uEditorToolbarList.ReloadAll;
|
uEditorToolbarList.ReloadAll;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
procedure ToggleToolbar (Sender:TObject);
|
||||||
|
var
|
||||||
|
ToolBarVisible: Boolean;
|
||||||
|
begin
|
||||||
|
ToolBarVisible:= not bToolBarShow;
|
||||||
|
EditorMenuCommand.Checked:= ToolBarVisible;
|
||||||
|
bToolBarShow:= ToolBarVisible;
|
||||||
|
TEdtTbConfigForm.UpdateVisible(ToolBarVisible);
|
||||||
|
uEditorToolbarList.ReloadAll;
|
||||||
|
end;
|
||||||
|
|
||||||
procedure TEditToolBarToolButton.Click;
|
procedure TEditToolBarToolButton.Click;
|
||||||
begin
|
begin
|
||||||
inherited Click;
|
inherited Click;
|
||||||
@ -194,6 +206,7 @@ begin
|
|||||||
ATB.Flat := True;
|
ATB.Flat := True;
|
||||||
ATB.Images := IDEImages.Images_16;
|
ATB.Images := IDEImages.Images_16;
|
||||||
ATB.ShowHint := True;
|
ATB.ShowHint := True;
|
||||||
|
ATB.Hint := rsHint;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
function TEditorToolbar.CreateJumpItem(AJumpType: TJumpType; O: TComponent): TMenuItem;
|
function TEditorToolbar.CreateJumpItem(AJumpType: TJumpType; O: TComponent): TMenuItem;
|
||||||
@ -348,6 +361,7 @@ begin
|
|||||||
end;
|
end;
|
||||||
sToolbarPos := cfg.GetValue('Position','Top');
|
sToolbarPos := cfg.GetValue('Position','Top');
|
||||||
bToolBarShow:= cfg.GetValue('Visible',true);
|
bToolBarShow:= cfg.GetValue('Visible',true);
|
||||||
|
EditorMenuCommand.Checked:= bToolBarShow;
|
||||||
SetTbPos;
|
SetTbPos;
|
||||||
finally
|
finally
|
||||||
cfg.Free;
|
cfg.Free;
|
||||||
@ -418,15 +432,21 @@ end;
|
|||||||
|
|
||||||
procedure Register;
|
procedure Register;
|
||||||
var
|
var
|
||||||
MenuCommand:TIDEMenuCommand;
|
|
||||||
MenuIcon: string;
|
MenuIcon: string;
|
||||||
begin
|
begin
|
||||||
MenuIcon:= 'menu_editor_options';
|
MenuIcon:= 'menu_editor_options';
|
||||||
//MenuIcon:= 'menu_editor_toolbar'; TODO!
|
//MenuIcon:= 'menu_editor_toolbar'; TODO!
|
||||||
if uEditorToolbarList = nil then begin
|
if uEditorToolbarList = nil then begin
|
||||||
TEditorToolbarList.Create;
|
TEditorToolbarList.Create;
|
||||||
MenuCommand:= RegisterIDEMenuCommand(itmViewSecondaryWindows,'EditorToolBar',rsEditorToolbar,nil,@ConfigureToolbar);
|
EditorMenuCommand:= RegisterIDEMenuCommand(itmViewSecondaryWindows,'EditorToolBar',
|
||||||
MenuCommand.ImageIndex := IDEImages.LoadImage(16, MenuIcon);
|
rsEditorToolbar,nil,@ToggleToolbar);
|
||||||
|
EditorMenuCommand.Checked:= True;
|
||||||
|
EditorMenuCommand.Enabled:= True;
|
||||||
|
//EditorMenuCommand:= RegisterIDEMenuCommand(itmViewSecondaryWindows,'EditorToolBar',rsEditorToolbar,nil,@ConfigureToolbar);
|
||||||
|
{$IFNDEF LCLGTK2}
|
||||||
|
// GTK2 Doesn't show both Icon and checkbox. Qt Does - Windows?
|
||||||
|
EditorMenuCommand.ImageIndex := IDEImages.LoadImage(16, MenuIcon);
|
||||||
|
{$ENDIF}
|
||||||
end;
|
end;
|
||||||
|
|
||||||
end;
|
end;
|
||||||
|
@ -21,6 +21,7 @@ resourcestring
|
|||||||
rsRemoveSelected = 'Remove selected item from toolbar';
|
rsRemoveSelected = 'Remove selected item from toolbar';
|
||||||
rsMoveSelectedUp = 'Move selected toolbar item up';
|
rsMoveSelectedUp = 'Move selected toolbar item up';
|
||||||
rsMoveSelectedDown = 'Move selected toolbar item down';
|
rsMoveSelectedDown = 'Move selected toolbar item down';
|
||||||
|
rsHint = 'You may add here your favorite commands';
|
||||||
rsPosition = 'Position';
|
rsPosition = 'Position';
|
||||||
rsTop = 'Top';
|
rsTop = 'Top';
|
||||||
rsBottom = 'Bottom';
|
rsBottom = 'Bottom';
|
||||||
|
@ -10,9 +10,9 @@ object EdtTbConfigForm: TEdtTbConfigForm
|
|||||||
LCLVersion = '1.3'
|
LCLVersion = '1.3'
|
||||||
object lblMenuTree: TLabel
|
object lblMenuTree: TLabel
|
||||||
Left = 16
|
Left = 16
|
||||||
Height = 20
|
Height = 17
|
||||||
Top = 14
|
Top = 14
|
||||||
Width = 83
|
Width = 81
|
||||||
Caption = 'lblMenuTree'
|
Caption = 'lblMenuTree'
|
||||||
ParentColor = False
|
ParentColor = False
|
||||||
end
|
end
|
||||||
@ -20,9 +20,9 @@ object EdtTbConfigForm: TEdtTbConfigForm
|
|||||||
AnchorSideLeft.Control = lbToolbar
|
AnchorSideLeft.Control = lbToolbar
|
||||||
AnchorSideTop.Control = lblpos
|
AnchorSideTop.Control = lblpos
|
||||||
Left = 443
|
Left = 443
|
||||||
Height = 20
|
Height = 17
|
||||||
Top = 14
|
Top = 14
|
||||||
Width = 69
|
Width = 62
|
||||||
Caption = 'lblToolbar'
|
Caption = 'lblToolbar'
|
||||||
ParentColor = False
|
ParentColor = False
|
||||||
end
|
end
|
||||||
@ -32,7 +32,7 @@ object EdtTbConfigForm: TEdtTbConfigForm
|
|||||||
AnchorSideTop.Side = asrBottom
|
AnchorSideTop.Side = asrBottom
|
||||||
Left = 415
|
Left = 415
|
||||||
Height = 26
|
Height = 26
|
||||||
Top = 126
|
Top = 120
|
||||||
Width = 22
|
Width = 22
|
||||||
BorderSpacing.Top = 1
|
BorderSpacing.Top = 1
|
||||||
Enabled = False
|
Enabled = False
|
||||||
@ -46,7 +46,7 @@ object EdtTbConfigForm: TEdtTbConfigForm
|
|||||||
AnchorSideTop.Control = TV
|
AnchorSideTop.Control = TV
|
||||||
Left = 415
|
Left = 415
|
||||||
Height = 26
|
Height = 26
|
||||||
Top = 99
|
Top = 93
|
||||||
Width = 22
|
Width = 22
|
||||||
BorderSpacing.Left = 6
|
BorderSpacing.Left = 6
|
||||||
BorderSpacing.Top = 25
|
BorderSpacing.Top = 25
|
||||||
@ -61,7 +61,7 @@ object EdtTbConfigForm: TEdtTbConfigForm
|
|||||||
AnchorSideTop.Side = asrBottom
|
AnchorSideTop.Side = asrBottom
|
||||||
Left = 415
|
Left = 415
|
||||||
Height = 26
|
Height = 26
|
||||||
Top = 177
|
Top = 171
|
||||||
Width = 22
|
Width = 22
|
||||||
BorderSpacing.Top = 25
|
BorderSpacing.Top = 25
|
||||||
Enabled = False
|
Enabled = False
|
||||||
@ -75,7 +75,7 @@ object EdtTbConfigForm: TEdtTbConfigForm
|
|||||||
AnchorSideTop.Side = asrBottom
|
AnchorSideTop.Side = asrBottom
|
||||||
Left = 415
|
Left = 415
|
||||||
Height = 26
|
Height = 26
|
||||||
Top = 204
|
Top = 198
|
||||||
Width = 22
|
Width = 22
|
||||||
BorderSpacing.Top = 1
|
BorderSpacing.Top = 1
|
||||||
Enabled = False
|
Enabled = False
|
||||||
@ -106,10 +106,10 @@ object EdtTbConfigForm: TEdtTbConfigForm
|
|||||||
AnchorSideRight.Control = btnCancel
|
AnchorSideRight.Control = btnCancel
|
||||||
AnchorSideBottom.Control = pnlButtons
|
AnchorSideBottom.Control = pnlButtons
|
||||||
AnchorSideBottom.Side = asrBottom
|
AnchorSideBottom.Side = asrBottom
|
||||||
Left = 534
|
Left = 545
|
||||||
Height = 25
|
Height = 25
|
||||||
Top = 11
|
Top = 11
|
||||||
Width = 76
|
Width = 75
|
||||||
Anchors = [akRight, akBottom]
|
Anchors = [akRight, akBottom]
|
||||||
AutoSize = True
|
AutoSize = True
|
||||||
BorderSpacing.Right = 6
|
BorderSpacing.Right = 6
|
||||||
@ -128,10 +128,10 @@ object EdtTbConfigForm: TEdtTbConfigForm
|
|||||||
AnchorSideRight.Side = asrBottom
|
AnchorSideRight.Side = asrBottom
|
||||||
AnchorSideBottom.Control = pnlButtons
|
AnchorSideBottom.Control = pnlButtons
|
||||||
AnchorSideBottom.Side = asrBottom
|
AnchorSideBottom.Side = asrBottom
|
||||||
Left = 616
|
Left = 626
|
||||||
Height = 25
|
Height = 25
|
||||||
Top = 11
|
Top = 11
|
||||||
Width = 100
|
Width = 90
|
||||||
Anchors = [akRight, akBottom]
|
Anchors = [akRight, akBottom]
|
||||||
AutoSize = True
|
AutoSize = True
|
||||||
BorderSpacing.Right = 6
|
BorderSpacing.Right = 6
|
||||||
@ -143,7 +143,6 @@ object EdtTbConfigForm: TEdtTbConfigForm
|
|||||||
Constraints.MinHeight = 25
|
Constraints.MinHeight = 25
|
||||||
Constraints.MinWidth = 75
|
Constraints.MinWidth = 75
|
||||||
ModalResult = 2
|
ModalResult = 2
|
||||||
OnClick = btnCancelClick
|
|
||||||
TabOrder = 1
|
TabOrder = 1
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
@ -153,7 +152,7 @@ object EdtTbConfigForm: TEdtTbConfigForm
|
|||||||
Left = 443
|
Left = 443
|
||||||
Height = 25
|
Height = 25
|
||||||
Top = 384
|
Top = 384
|
||||||
Width = 132
|
Width = 116
|
||||||
Anchors = [akLeft, akBottom]
|
Anchors = [akLeft, akBottom]
|
||||||
AutoSize = True
|
AutoSize = True
|
||||||
BorderSpacing.Bottom = 6
|
BorderSpacing.Bottom = 6
|
||||||
@ -171,8 +170,8 @@ object EdtTbConfigForm: TEdtTbConfigForm
|
|||||||
AnchorSideTop.Control = TV
|
AnchorSideTop.Control = TV
|
||||||
AnchorSideBottom.Control = btnAddDivider
|
AnchorSideBottom.Control = btnAddDivider
|
||||||
Left = 443
|
Left = 443
|
||||||
Height = 304
|
Height = 310
|
||||||
Top = 74
|
Top = 68
|
||||||
Width = 268
|
Width = 268
|
||||||
Anchors = [akTop, akLeft, akRight, akBottom]
|
Anchors = [akTop, akLeft, akRight, akBottom]
|
||||||
BorderSpacing.Left = 6
|
BorderSpacing.Left = 6
|
||||||
@ -188,14 +187,13 @@ object EdtTbConfigForm: TEdtTbConfigForm
|
|||||||
AnchorSideRight.Control = Splitter1
|
AnchorSideRight.Control = Splitter1
|
||||||
AnchorSideBottom.Control = pnlButtons
|
AnchorSideBottom.Control = pnlButtons
|
||||||
Left = 16
|
Left = 16
|
||||||
Height = 335
|
Height = 341
|
||||||
Top = 74
|
Top = 68
|
||||||
Width = 381
|
Width = 381
|
||||||
Anchors = [akTop, akLeft, akRight, akBottom]
|
Anchors = [akTop, akLeft, akRight, akBottom]
|
||||||
BorderSpacing.Top = 6
|
BorderSpacing.Top = 6
|
||||||
BorderSpacing.Right = 3
|
BorderSpacing.Right = 3
|
||||||
BorderSpacing.Bottom = 6
|
BorderSpacing.Bottom = 6
|
||||||
DefaultItemHeight = 22
|
|
||||||
ReadOnly = True
|
ReadOnly = True
|
||||||
ScrollBars = ssAutoBoth
|
ScrollBars = ssAutoBoth
|
||||||
TabOrder = 1
|
TabOrder = 1
|
||||||
@ -207,8 +205,8 @@ object EdtTbConfigForm: TEdtTbConfigForm
|
|||||||
AnchorSideTop.Control = lblMenuTree
|
AnchorSideTop.Control = lblMenuTree
|
||||||
AnchorSideTop.Side = asrBottom
|
AnchorSideTop.Side = asrBottom
|
||||||
Left = 16
|
Left = 16
|
||||||
Height = 28
|
Height = 25
|
||||||
Top = 40
|
Top = 37
|
||||||
Width = 192
|
Width = 192
|
||||||
UseFormActivate = True
|
UseFormActivate = True
|
||||||
ButtonWidth = 23
|
ButtonWidth = 23
|
||||||
@ -222,10 +220,10 @@ object EdtTbConfigForm: TEdtTbConfigForm
|
|||||||
end
|
end
|
||||||
object cbPos: TComboBox
|
object cbPos: TComboBox
|
||||||
Left = 293
|
Left = 293
|
||||||
Height = 28
|
Height = 25
|
||||||
Top = 10
|
Top = 10
|
||||||
Width = 100
|
Width = 100
|
||||||
ItemHeight = 20
|
ItemHeight = 0
|
||||||
ItemIndex = 0
|
ItemIndex = 0
|
||||||
Items.Strings = (
|
Items.Strings = (
|
||||||
'Top'
|
'Top'
|
||||||
@ -240,15 +238,15 @@ object EdtTbConfigForm: TEdtTbConfigForm
|
|||||||
object lblpos: TLabel
|
object lblpos: TLabel
|
||||||
AnchorSideTop.Control = lblMenuTree
|
AnchorSideTop.Control = lblMenuTree
|
||||||
Left = 232
|
Left = 232
|
||||||
Height = 20
|
Height = 17
|
||||||
Top = 14
|
Top = 14
|
||||||
Width = 41
|
Width = 38
|
||||||
Caption = 'lblpos'
|
Caption = 'lblpos'
|
||||||
ParentColor = False
|
ParentColor = False
|
||||||
end
|
end
|
||||||
object cbVisible: TCheckBox
|
object cbVisible: TCheckBox
|
||||||
Left = 316
|
Left = 316
|
||||||
Height = 24
|
Height = 21
|
||||||
Top = 45
|
Top = 45
|
||||||
Width = 68
|
Width = 68
|
||||||
Caption = 'Visible'
|
Caption = 'Visible'
|
||||||
@ -264,8 +262,8 @@ object EdtTbConfigForm: TEdtTbConfigForm
|
|||||||
AnchorSideBottom.Control = TV
|
AnchorSideBottom.Control = TV
|
||||||
AnchorSideBottom.Side = asrBottom
|
AnchorSideBottom.Side = asrBottom
|
||||||
Left = 400
|
Left = 400
|
||||||
Height = 335
|
Height = 341
|
||||||
Top = 74
|
Top = 68
|
||||||
Width = 9
|
Width = 9
|
||||||
Align = alNone
|
Align = alNone
|
||||||
Anchors = [akTop, akBottom]
|
Anchors = [akTop, akBottom]
|
||||||
|
@ -49,7 +49,6 @@ type
|
|||||||
FilterEdit: TTreeFilterEdit;
|
FilterEdit: TTreeFilterEdit;
|
||||||
Splitter1: TSplitter;
|
Splitter1: TSplitter;
|
||||||
TV: TTreeView;
|
TV: TTreeView;
|
||||||
procedure btnCancelClick(Sender: TObject);
|
|
||||||
procedure cbPosChange(Sender: TObject);
|
procedure cbPosChange(Sender: TObject);
|
||||||
procedure cbVisibleChange(Sender: TObject);
|
procedure cbVisibleChange(Sender: TObject);
|
||||||
procedure FormCreate(Sender: TObject);
|
procedure FormCreate(Sender: TObject);
|
||||||
@ -69,14 +68,17 @@ type
|
|||||||
procedure LoadSettings;
|
procedure LoadSettings;
|
||||||
procedure SaveSettings;
|
procedure SaveSettings;
|
||||||
procedure AddMenuItem(ParentNode: TTreeNode; Item: TIDEMenuItem);
|
procedure AddMenuItem(ParentNode: TTreeNode; Item: TIDEMenuItem);
|
||||||
|
procedure AddToolBarItem(Item: TIDEMenuItem);
|
||||||
public
|
public
|
||||||
class function Execute: boolean;
|
class function Execute: boolean;
|
||||||
class procedure Setup;
|
class procedure Setup;
|
||||||
|
class procedure UpdateVisible(NewStatus: Boolean);
|
||||||
end;
|
end;
|
||||||
|
|
||||||
Var
|
Var
|
||||||
sPosValues: array[0..3] of string = ('Top','Bottom','Right','Left');
|
sPosValues: array[0..3] of string = ('Top','Bottom','Right','Left');
|
||||||
sLocalizedPosValues: array[0..3] of string;
|
sLocalizedPosValues: array[0..3] of string;
|
||||||
|
sMenuView: string = 'View';
|
||||||
|
|
||||||
implementation
|
implementation
|
||||||
|
|
||||||
@ -148,10 +150,6 @@ begin
|
|||||||
end;
|
end;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
procedure TEdtTbConfigForm.btnCancelClick(Sender: TObject);
|
|
||||||
begin
|
|
||||||
end;
|
|
||||||
|
|
||||||
procedure TEdtTbConfigForm.cbVisibleChange(Sender: TObject);
|
procedure TEdtTbConfigForm.cbVisibleChange(Sender: TObject);
|
||||||
begin
|
begin
|
||||||
FToolBarShow:= cbVisible.Checked;
|
FToolBarShow:= cbVisible.Checked;
|
||||||
@ -186,14 +184,25 @@ begin
|
|||||||
lbToolbar.Items.AddObject(TIDEMenuItem(n.Data).Caption, TObject(n.Data));
|
lbToolbar.Items.AddObject(TIDEMenuItem(n.Data).Caption, TObject(n.Data));
|
||||||
lbToolbar.ItemIndex := lbToolbar.Items.Count-1;
|
lbToolbar.ItemIndex := lbToolbar.Items.Count-1;
|
||||||
lbToolbarSelectionChange(lblToolbar, False);
|
lbToolbarSelectionChange(lblToolbar, False);
|
||||||
|
TV.Selected.Visible:= False;
|
||||||
end;
|
end;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
procedure TEdtTbConfigForm.btnRemoveClick(Sender: TObject);
|
procedure TEdtTbConfigForm.btnRemoveClick(Sender: TObject);
|
||||||
|
Var
|
||||||
|
mi: TIDEMenuItem;
|
||||||
|
n: TTreeNode;
|
||||||
|
I: Integer;
|
||||||
begin
|
begin
|
||||||
if lbToolbar.ItemIndex > -1 then begin
|
I := lbToolbar.ItemIndex;
|
||||||
|
if I > -1 then begin
|
||||||
|
mi := TIDEMenuItem(lbToolbar.Items.Objects[I]);
|
||||||
lbToolbar.Items.Delete(lbToolbar.ItemIndex);
|
lbToolbar.Items.Delete(lbToolbar.ItemIndex);
|
||||||
lbToolbarSelectionChange(lbToolbar, False);
|
lbToolbarSelectionChange(lbToolbar, False);
|
||||||
|
if assigned(mi) then begin
|
||||||
|
n:= TV.Items.FindNodeWithData(mi);
|
||||||
|
n.Visible:= True;
|
||||||
|
end;
|
||||||
TVSelectionChanged(TV);
|
TVSelectionChanged(TV);
|
||||||
end;
|
end;
|
||||||
end;
|
end;
|
||||||
@ -228,7 +237,7 @@ end;
|
|||||||
procedure TEdtTbConfigForm.btnOKClick(Sender: TObject);
|
procedure TEdtTbConfigForm.btnOKClick(Sender: TObject);
|
||||||
begin
|
begin
|
||||||
SaveSettings;
|
SaveSettings;
|
||||||
if not FToolBarShow then ShowMessageFmt(rsWarning,[rsMenuView,rsEditorToolbar]);
|
if not FToolBarShow then ShowMessage(Format(rsWarning,[sMenuView,rsEditorToolbar]));
|
||||||
end;
|
end;
|
||||||
|
|
||||||
procedure TEdtTbConfigForm.SetupCaptions;
|
procedure TEdtTbConfigForm.SetupCaptions;
|
||||||
@ -274,23 +283,23 @@ var
|
|||||||
cfg: TConfigStorage;
|
cfg: TConfigStorage;
|
||||||
value: string;
|
value: string;
|
||||||
mi: TIDEMenuItem;
|
mi: TIDEMenuItem;
|
||||||
ms: TIDEMenuSection;
|
|
||||||
begin
|
begin
|
||||||
cfg := GetIDEConfigStorage(cSettingsFile, True);
|
cfg := GetIDEConfigStorage(cSettingsFile, True);
|
||||||
try
|
try
|
||||||
c := cfg.GetValue('Count', 0);
|
c := cfg.GetValue('Count', 0);
|
||||||
|
|
||||||
if c = 0 then begin
|
if c = 0 then begin
|
||||||
// Let's provide a Jump Back/Jump Forward as a starting default
|
// Let's provide a Jump Back/Jump Forward as a starting default
|
||||||
ms := itmJumpings;
|
value := 'IDEMainMenu/Search/itmJumpings/itmJumpBack';
|
||||||
mi := ms.FindByName('itmJumpBack');
|
mi := IDEMenuRoots.FindByPath(value, false);
|
||||||
if Assigned(mi) then
|
AddToolBarItem(mi);
|
||||||
lbToolbar.Items.AddObject(mi.Caption, TObject(mi));
|
{if Assigned(mi) then
|
||||||
mi := ms.FindByName('itmJumpForward');
|
lbToolbar.Items.AddObject(mi.Caption, TObject(mi));}
|
||||||
if Assigned(mi) then
|
value := 'IDEMainMenu/Search/itmJumpings/itmJumpForward';
|
||||||
lbToolbar.Items.AddObject(mi.Caption, TObject(mi));
|
mi := IDEMenuRoots.FindByPath(value, false);
|
||||||
|
AddToolBarItem(mi);
|
||||||
|
{if Assigned(mi) then
|
||||||
|
lbToolbar.Items.AddObject(mi.Caption, TObject(mi));}
|
||||||
end
|
end
|
||||||
|
|
||||||
else begin
|
else begin
|
||||||
for i := 0 to c - 1 do
|
for i := 0 to c - 1 do
|
||||||
begin
|
begin
|
||||||
@ -304,8 +313,9 @@ begin
|
|||||||
end;
|
end;
|
||||||
|
|
||||||
mi := IDEMenuRoots.FindByPath(value, false);
|
mi := IDEMenuRoots.FindByPath(value, false);
|
||||||
if Assigned(mi) then
|
AddToolBarItem(mi);
|
||||||
lbToolbar.Items.AddObject(mi.Caption, TObject(mi));
|
{if Assigned(mi) then
|
||||||
|
lbToolbar.Items.AddObject(mi.Caption, TObject(mi));}
|
||||||
end;
|
end;
|
||||||
end;
|
end;
|
||||||
end;
|
end;
|
||||||
@ -348,12 +358,15 @@ var
|
|||||||
n: TTreeNode;
|
n: TTreeNode;
|
||||||
i: integer;
|
i: integer;
|
||||||
sec: TIDEMenuSection;
|
sec: TIDEMenuSection;
|
||||||
|
ACaption: string;
|
||||||
begin
|
begin
|
||||||
n := TV.Items.AddChild(ParentNode, Format('%s', [Item.Caption]));
|
n := TV.Items.AddChild(ParentNode, Format('%s', [Item.Caption]));
|
||||||
n.ImageIndex := Item.ImageIndex;
|
n.ImageIndex := Item.ImageIndex;
|
||||||
n.SelectedIndex := Item.ImageIndex;
|
n.SelectedIndex := Item.ImageIndex;
|
||||||
if Item is TIDEMenuSection then
|
if Item is TIDEMenuSection then
|
||||||
begin
|
begin
|
||||||
|
// get the caption of the View entry for the appropriate Warning
|
||||||
|
if Item.Name = 'View' then sMenuView:= Item.Caption;
|
||||||
sec := (Item as TIDEMenuSection);
|
sec := (Item as TIDEMenuSection);
|
||||||
for i := 0 to sec.Count-1 do
|
for i := 0 to sec.Count-1 do
|
||||||
AddMenuItem(n, sec.Items[i]);
|
AddMenuItem(n, sec.Items[i]);
|
||||||
@ -362,6 +375,17 @@ begin
|
|||||||
n.Data := Item;
|
n.Data := Item;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
procedure TEdtTbConfigForm.AddToolBarItem(Item: TIDEMenuItem);
|
||||||
|
Var
|
||||||
|
n: TTreeNode;
|
||||||
|
begin
|
||||||
|
if Assigned(Item) then begin
|
||||||
|
lbToolbar.Items.AddObject(Item.Caption, TObject(Item));
|
||||||
|
n:= TV.Items.FindNodeWithData(Item);
|
||||||
|
n.Visible:= False;
|
||||||
|
end;
|
||||||
|
end;
|
||||||
|
|
||||||
class function TEdtTbConfigForm.Execute: boolean;
|
class function TEdtTbConfigForm.Execute: boolean;
|
||||||
var
|
var
|
||||||
frm: TEdtTbConfigForm;
|
frm: TEdtTbConfigForm;
|
||||||
@ -374,15 +398,26 @@ begin
|
|||||||
end;
|
end;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
{TEdtTbConfigForm.Setup - called if no user items in config. }
|
|
||||||
class procedure TEdtTbConfigForm.Setup;
|
class procedure TEdtTbConfigForm.Setup;
|
||||||
var
|
var
|
||||||
frm: TEdtTbConfigForm;
|
frm: TEdtTbConfigForm;
|
||||||
begin
|
begin
|
||||||
// Create inserts the default Items
|
|
||||||
frm := TEdtTbConfigForm.Create(nil);
|
frm := TEdtTbConfigForm.Create(nil);
|
||||||
try
|
try
|
||||||
// Must save them, less they're inserted twice
|
frm.SaveSettings;
|
||||||
|
finally
|
||||||
|
frm.Free;
|
||||||
|
end;
|
||||||
|
|
||||||
|
end;
|
||||||
|
|
||||||
|
class procedure TEdtTbConfigForm.UpdateVisible(NewStatus: Boolean);
|
||||||
|
var
|
||||||
|
frm: TEdtTbConfigForm;
|
||||||
|
begin
|
||||||
|
frm := TEdtTbConfigForm.Create(nil);
|
||||||
|
try
|
||||||
|
frm.FToolBarShow:= NewStatus;
|
||||||
frm.SaveSettings;
|
frm.SaveSettings;
|
||||||
finally
|
finally
|
||||||
frm.Free;
|
frm.Free;
|
||||||
|
Loading…
Reference in New Issue
Block a user