mirror of
https://gitlab.com/freepascal.org/lazarus/lazarus.git
synced 2025-09-07 12:00:44 +02:00
TAChart: Use toolbar instead of menu in subcomponent editor to improve interface in Macs
git-svn-id: trunk@26963 -
This commit is contained in:
parent
be52fd6bf5
commit
c7b5612c6c
@ -4,17 +4,17 @@ object ComponentListEditorForm: TComponentListEditorForm
|
|||||||
Top = 283
|
Top = 283
|
||||||
Width = 320
|
Width = 320
|
||||||
Caption = 'ComponentListEditorForm'
|
Caption = 'ComponentListEditorForm'
|
||||||
ClientHeight = 221
|
ClientHeight = 240
|
||||||
ClientWidth = 320
|
ClientWidth = 320
|
||||||
Menu = MainMenu1
|
|
||||||
OnClose = FormClose
|
OnClose = FormClose
|
||||||
|
OnCreate = FormCreate
|
||||||
OnDestroy = FormDestroy
|
OnDestroy = FormDestroy
|
||||||
Position = poScreenCenter
|
Position = poScreenCenter
|
||||||
LCLVersion = '0.9.29'
|
LCLVersion = '0.9.29'
|
||||||
object ChildrenListBox: TListBox
|
object ChildrenListBox: TListBox
|
||||||
Left = 0
|
Left = 0
|
||||||
Height = 221
|
Height = 198
|
||||||
Top = 0
|
Top = 42
|
||||||
Width = 320
|
Width = 320
|
||||||
Align = alClient
|
Align = alClient
|
||||||
ItemHeight = 0
|
ItemHeight = 0
|
||||||
@ -22,23 +22,43 @@ object ComponentListEditorForm: TComponentListEditorForm
|
|||||||
OnClick = ChildrenListBoxClick
|
OnClick = ChildrenListBoxClick
|
||||||
TabOrder = 0
|
TabOrder = 0
|
||||||
end
|
end
|
||||||
object MainMenu1: TMainMenu
|
object tbCommands: TToolBar
|
||||||
left = 88
|
Left = 0
|
||||||
top = 160
|
Height = 42
|
||||||
object miAdd: TMenuItem
|
Top = 0
|
||||||
|
Width = 320
|
||||||
|
AutoSize = True
|
||||||
|
ButtonHeight = 40
|
||||||
|
ButtonWidth = 44
|
||||||
|
ShowCaptions = True
|
||||||
|
TabOrder = 1
|
||||||
|
object tbAdd: TToolButton
|
||||||
|
Left = 1
|
||||||
|
Top = 2
|
||||||
Caption = 'Add'
|
Caption = 'Add'
|
||||||
|
DropdownMenu = menuAddItem
|
||||||
end
|
end
|
||||||
object miDelete: TMenuItem
|
object tbDelete: TToolButton
|
||||||
|
Left = 45
|
||||||
|
Top = 2
|
||||||
Caption = 'Delete'
|
Caption = 'Delete'
|
||||||
OnClick = miDeleteClick
|
OnClick = tbDeleteClick
|
||||||
end
|
end
|
||||||
object miMoveUp: TMenuItem
|
object tbMoveUp: TToolButton
|
||||||
Caption = 'Move up'
|
Left = 89
|
||||||
OnClick = miMoveUpClick
|
Top = 2
|
||||||
|
Caption = 'Up'
|
||||||
|
OnClick = tbMoveUpClick
|
||||||
end
|
end
|
||||||
object miMoveDown: TMenuItem
|
object tbMoveDown: TToolButton
|
||||||
Caption = 'Move down'
|
Left = 133
|
||||||
OnClick = miMoveDownClick
|
Top = 2
|
||||||
|
Caption = 'Down'
|
||||||
|
OnClick = tbMoveDownClick
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
object menuAddItem: TPopupMenu
|
||||||
|
left = 88
|
||||||
|
top = 96
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
@ -20,7 +20,7 @@ unit TASubcomponentsEditor;
|
|||||||
interface
|
interface
|
||||||
|
|
||||||
uses
|
uses
|
||||||
Classes, ComponentEditors, Forms, Menus, PropEdits, StdCtrls;
|
Classes, ComCtrls, ComponentEditors, Forms, Menus, PropEdits, StdCtrls;
|
||||||
|
|
||||||
type
|
type
|
||||||
|
|
||||||
@ -56,18 +56,20 @@ type
|
|||||||
|
|
||||||
TComponentListEditorForm = class(TForm)
|
TComponentListEditorForm = class(TForm)
|
||||||
ChildrenListBox: TListBox;
|
ChildrenListBox: TListBox;
|
||||||
MainMenu1: TMainMenu;
|
menuAddItem: TPopupMenu;
|
||||||
miMoveUp: TMenuItem;
|
tbCommands: TToolBar;
|
||||||
miMoveDown: TMenuItem;
|
tbAdd: TToolButton;
|
||||||
miAdd: TMenuItem;
|
tbDelete: TToolButton;
|
||||||
miDelete: TMenuItem;
|
tbMoveUp: TToolButton;
|
||||||
|
tbMoveDown: TToolButton;
|
||||||
procedure ChildrenListBoxClick(Sender: TObject);
|
procedure ChildrenListBoxClick(Sender: TObject);
|
||||||
procedure FormClose(Sender: TObject; var CloseAction: TCloseAction);
|
procedure FormClose(Sender: TObject; var CloseAction: TCloseAction);
|
||||||
|
procedure FormCreate(Sender: TObject);
|
||||||
procedure FormDestroy(Sender: TObject);
|
procedure FormDestroy(Sender: TObject);
|
||||||
procedure miAddClick(Sender: TObject);
|
procedure miAddClick(Sender: TObject);
|
||||||
procedure miDeleteClick(Sender: TObject);
|
procedure tbDeleteClick(Sender: TObject);
|
||||||
procedure miMoveDownClick(Sender: TObject);
|
procedure tbMoveDownClick(Sender: TObject);
|
||||||
procedure miMoveUpClick(Sender: TObject);
|
procedure tbMoveUpClick(Sender: TObject);
|
||||||
private
|
private
|
||||||
FComponentEditor: TSubComponentListEditor;
|
FComponentEditor: TSubComponentListEditor;
|
||||||
FDesigner: TComponentEditorDesigner;
|
FDesigner: TComponentEditorDesigner;
|
||||||
@ -101,7 +103,7 @@ type
|
|||||||
implementation
|
implementation
|
||||||
|
|
||||||
uses
|
uses
|
||||||
Math, SysUtils, TAChartUtils;
|
IDEImagesIntf, Math, SysUtils, TAChartUtils;
|
||||||
|
|
||||||
{$R *.lfm}
|
{$R *.lfm}
|
||||||
|
|
||||||
@ -173,7 +175,7 @@ begin
|
|||||||
mi.OnClick := @miAddClick;
|
mi.OnClick := @miAddClick;
|
||||||
mi.Caption := ACaption;
|
mi.Caption := ACaption;
|
||||||
mi.Tag := ATag;
|
mi.Tag := ATag;
|
||||||
miAdd.Add(mi);
|
menuAddItem.Items.Add(mi);
|
||||||
end;
|
end;
|
||||||
|
|
||||||
procedure TComponentListEditorForm.ChildrenListBoxClick(Sender: TObject);
|
procedure TComponentListEditorForm.ChildrenListBoxClick(Sender: TObject);
|
||||||
@ -223,6 +225,15 @@ begin
|
|||||||
CloseAction := caFree;
|
CloseAction := caFree;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
procedure TComponentListEditorForm.FormCreate(Sender: TObject);
|
||||||
|
begin
|
||||||
|
tbCommands.Images := IDEImages.Images_16;
|
||||||
|
tbAdd.ImageIndex := IDEImages.LoadImage(16, 'laz_add');
|
||||||
|
tbDelete.ImageIndex := IDEImages.LoadImage(16, 'laz_delete');
|
||||||
|
tbMoveDown.ImageIndex := IDEImages.LoadImage(16, 'arrow_down');
|
||||||
|
tbMoveUp.ImageIndex := IDEImages.LoadImage(16, 'arrow_up');
|
||||||
|
end;
|
||||||
|
|
||||||
procedure TComponentListEditorForm.FormDestroy(Sender: TObject);
|
procedure TComponentListEditorForm.FormDestroy(Sender: TObject);
|
||||||
begin
|
begin
|
||||||
if FComponentEditor <> nil then begin
|
if FComponentEditor <> nil then begin
|
||||||
@ -258,33 +269,6 @@ begin
|
|||||||
end;
|
end;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
procedure TComponentListEditorForm.miDeleteClick(Sender: TObject);
|
|
||||||
var
|
|
||||||
i: Integer;
|
|
||||||
s: TComponent;
|
|
||||||
begin
|
|
||||||
if ChildrenListBox.SelCount = 0 then exit;
|
|
||||||
for i := ChildrenListBox.Items.Count - 1 downto 0 do
|
|
||||||
if ChildrenListBox.Selected[i] then begin
|
|
||||||
s := TComponent(ChildrenListBox.Items.Objects[i]);
|
|
||||||
ChildrenListBox.Items.Delete(i);
|
|
||||||
FDesigner.PropertyEditorHook.PersistentDeleting(s);
|
|
||||||
s.Free;
|
|
||||||
end;
|
|
||||||
FDesigner.Modified;
|
|
||||||
SelectionChanged;
|
|
||||||
end;
|
|
||||||
|
|
||||||
procedure TComponentListEditorForm.miMoveDownClick(Sender: TObject);
|
|
||||||
begin
|
|
||||||
MoveSelection(ChildrenListBox.Count - 1, 1);
|
|
||||||
end;
|
|
||||||
|
|
||||||
procedure TComponentListEditorForm.miMoveUpClick(Sender: TObject);
|
|
||||||
begin
|
|
||||||
MoveSelection(0, -1);
|
|
||||||
end;
|
|
||||||
|
|
||||||
procedure TComponentListEditorForm.MoveSelection(AStart, ADir: Integer);
|
procedure TComponentListEditorForm.MoveSelection(AStart, ADir: Integer);
|
||||||
var
|
var
|
||||||
i: Integer;
|
i: Integer;
|
||||||
@ -399,5 +383,32 @@ begin
|
|||||||
end;
|
end;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
procedure TComponentListEditorForm.tbDeleteClick(Sender: TObject);
|
||||||
|
var
|
||||||
|
i: Integer;
|
||||||
|
s: TComponent;
|
||||||
|
begin
|
||||||
|
if ChildrenListBox.SelCount = 0 then exit;
|
||||||
|
for i := ChildrenListBox.Items.Count - 1 downto 0 do
|
||||||
|
if ChildrenListBox.Selected[i] then begin
|
||||||
|
s := TComponent(ChildrenListBox.Items.Objects[i]);
|
||||||
|
ChildrenListBox.Items.Delete(i);
|
||||||
|
FDesigner.PropertyEditorHook.PersistentDeleting(s);
|
||||||
|
s.Free;
|
||||||
|
end;
|
||||||
|
FDesigner.Modified;
|
||||||
|
SelectionChanged;
|
||||||
|
end;
|
||||||
|
|
||||||
|
procedure TComponentListEditorForm.tbMoveDownClick(Sender: TObject);
|
||||||
|
begin
|
||||||
|
MoveSelection(ChildrenListBox.Count - 1, 1);
|
||||||
|
end;
|
||||||
|
|
||||||
|
procedure TComponentListEditorForm.tbMoveUpClick(Sender: TObject);
|
||||||
|
begin
|
||||||
|
MoveSelection(0, -1);
|
||||||
|
end;
|
||||||
|
|
||||||
end.
|
end.
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user