mirror of
https://gitlab.com/freepascal.org/lazarus/lazarus.git
synced 2025-08-17 07:29:21 +02:00
ideintf: add Z-Order menu section to the component treeview
git-svn-id: trunk@23202 -
This commit is contained in:
parent
40f7e80de6
commit
2ec1f7c029
@ -519,7 +519,7 @@ begin
|
|||||||
DesignerMenuSize:=RegisterIDEMenuCommand(DesignerMenuSectionAlign,
|
DesignerMenuSize:=RegisterIDEMenuCommand(DesignerMenuSectionAlign,
|
||||||
'Size',fdmSizeWord, nil, nil, nil, 'size');
|
'Size',fdmSizeWord, nil, nil, nil, 'size');
|
||||||
|
|
||||||
// register tab and order section
|
// register tab and z-order section
|
||||||
DesignerMenuSectionOrder:=RegisterIDEMenuSection(DesignerMenuRoot,
|
DesignerMenuSectionOrder:=RegisterIDEMenuSection(DesignerMenuRoot,
|
||||||
'Order section');
|
'Order section');
|
||||||
DesignerMenuTabOrder:=RegisterIDEMenuCommand(DesignerMenuSectionOrder,
|
DesignerMenuTabOrder:=RegisterIDEMenuCommand(DesignerMenuSectionOrder,
|
||||||
|
@ -686,6 +686,7 @@ type
|
|||||||
ABox: TPaintBox; const ARestrictions: TWidgetSetRestrictionsArray);
|
ABox: TPaintBox; const ARestrictions: TWidgetSetRestrictionsArray);
|
||||||
procedure DoComponentEditorVerbMenuItemClick(Sender: TObject);
|
procedure DoComponentEditorVerbMenuItemClick(Sender: TObject);
|
||||||
procedure DoCollectionAddItem(Sender: TObject);
|
procedure DoCollectionAddItem(Sender: TObject);
|
||||||
|
procedure DoZOrderItemClick(Sender: TObject);
|
||||||
protected
|
protected
|
||||||
function PersistentToString(APersistent: TPersistent): string;
|
function PersistentToString(APersistent: TPersistent): string;
|
||||||
procedure AddPersistentToList(APersistent: TPersistent; List: TStrings);
|
procedure AddPersistentToList(APersistent: TPersistent; List: TStrings);
|
||||||
@ -4903,6 +4904,8 @@ begin
|
|||||||
end;
|
end;
|
||||||
|
|
||||||
procedure TObjectInspectorDlg.OnMainPopupMenuPopup(Sender: TObject);
|
procedure TObjectInspectorDlg.OnMainPopupMenuPopup(Sender: TObject);
|
||||||
|
var
|
||||||
|
EditorVerbSeparator: TMenuItem;
|
||||||
|
|
||||||
procedure RemoveComponentEditorMenuItems;
|
procedure RemoveComponentEditorMenuItems;
|
||||||
var
|
var
|
||||||
@ -4929,9 +4932,9 @@ procedure TObjectInspectorDlg.OnMainPopupMenuPopup(Sender: TObject);
|
|||||||
// insert the separator
|
// insert the separator
|
||||||
if VerbCount > 0 then
|
if VerbCount > 0 then
|
||||||
begin
|
begin
|
||||||
Item := NewLine;
|
EditorVerbSeparator := NewLine;
|
||||||
Item.Name := 'ComponentEditorVerbMenuItem' + IntToStr(VerbCount);
|
EditorVerbSeparator.Name := 'ComponentEditorVerbMenuItem' + IntToStr(VerbCount);
|
||||||
MainPopupMenu.Items.Insert(VerbCount, Item);
|
MainPopupMenu.Items.Insert(VerbCount, EditorVerbSeparator);
|
||||||
end;
|
end;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
@ -4942,9 +4945,39 @@ procedure TObjectInspectorDlg.OnMainPopupMenuPopup(Sender: TObject);
|
|||||||
Item := NewItem(oisAddCollectionItem, 0, False, True,
|
Item := NewItem(oisAddCollectionItem, 0, False, True,
|
||||||
@DoCollectionAddItem, 0, 'ComponentEditorVerbMenuItem0');
|
@DoCollectionAddItem, 0, 'ComponentEditorVerbMenuItem0');
|
||||||
MainPopupMenu.Items.Insert(0, Item);
|
MainPopupMenu.Items.Insert(0, Item);
|
||||||
|
EditorVerbSeparator := NewLine;
|
||||||
|
EditorVerbSeparator.Name := 'ComponentEditorVerbMenuItem1';
|
||||||
|
MainPopupMenu.Items.Insert(1, EditorVerbSeparator);
|
||||||
|
end;
|
||||||
|
|
||||||
|
procedure AddZOrderMenuItems;
|
||||||
|
var
|
||||||
|
ZItem, Item: TMenuItem;
|
||||||
|
begin
|
||||||
|
ZItem := NewSubMenu(oisZOrder, 0, 'ComponentEditorVerbMenuItemZOrder', [], True);
|
||||||
|
Item := NewItem(oisOrderMoveToFront, 0, True, True, @DoZOrderItemClick, 0, '');
|
||||||
|
Item.ImageIndex := IDEImages.LoadImage(16, 'Order_move_front');
|
||||||
|
Item.Tag := 0;
|
||||||
|
ZItem.Add(Item);
|
||||||
|
Item := NewItem(oisOrderMoveToBack, 0, True, True, @DoZOrderItemClick, 0, '');
|
||||||
|
Item.ImageIndex := IDEImages.LoadImage(16, 'Order_move_back');
|
||||||
|
Item.Tag := 1;
|
||||||
|
ZItem.Add(Item);
|
||||||
|
Item := NewItem(oisOrderForwardOne, 0, True, True, @DoZOrderItemClick, 0, '');
|
||||||
|
Item.ImageIndex := IDEImages.LoadImage(16, 'Order_forward_one');
|
||||||
|
Item.Tag := 2;
|
||||||
|
ZItem.Add(Item);
|
||||||
|
Item := NewItem(oisOrderBackOne, 0, True, True, @DoZOrderItemClick, 0, '');
|
||||||
|
Item.ImageIndex := IDEImages.LoadImage(16, 'Order_back_one');
|
||||||
|
Item.Tag := 3;
|
||||||
|
ZItem.Add(Item);
|
||||||
|
if EditorVerbSeparator <> nil then
|
||||||
|
MainPopupMenu.Items.Insert(EditorVerbSeparator.MenuIndex + 1, ZItem)
|
||||||
|
else
|
||||||
|
MainPopupMenu.Items.Insert(0, ZItem);
|
||||||
Item := NewLine;
|
Item := NewLine;
|
||||||
Item.Name := 'ComponentEditorVerbMenuItem1';
|
Item.Name := 'ComponentEditorVerbMenuItemZOrderSeparator';
|
||||||
MainPopupMenu.Items.Insert(1, Item);
|
MainPopupMenu.Items.Insert(ZItem.MenuIndex + 1, Item);
|
||||||
end;
|
end;
|
||||||
|
|
||||||
var
|
var
|
||||||
@ -4957,6 +4990,7 @@ begin
|
|||||||
// show component editors only for component treeview
|
// show component editors only for component treeview
|
||||||
if MainPopupMenu.PopupComponent = ComponentTree then
|
if MainPopupMenu.PopupComponent = ComponentTree then
|
||||||
begin
|
begin
|
||||||
|
EditorVerbSeparator := nil;
|
||||||
ComponentEditor := GetComponentEditorForSelection;
|
ComponentEditor := GetComponentEditorForSelection;
|
||||||
if ComponentEditor <> nil then
|
if ComponentEditor <> nil then
|
||||||
AddComponentEditorMenuItems
|
AddComponentEditorMenuItems
|
||||||
@ -4971,6 +5005,11 @@ begin
|
|||||||
AddCollectionEditorMenuItems(TCollectionItem(Persistent).Collection);
|
AddCollectionEditorMenuItems(TCollectionItem(Persistent).Collection);
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
// add Z-Order menu
|
||||||
|
|
||||||
|
if (Selection.Count = 1) and (Selection[0] is TControl) then
|
||||||
|
AddZOrderMenuItems;
|
||||||
|
|
||||||
CutPopupMenuItem.Visible := (Selection.Count > 0) and (Selection[0] is TComponent);
|
CutPopupMenuItem.Visible := (Selection.Count > 0) and (Selection[0] is TComponent);
|
||||||
CopyPopupMenuItem.Visible := (Selection.Count > 0) and (Selection[0] is TComponent);
|
CopyPopupMenuItem.Visible := (Selection.Count > 0) and (Selection[0] is TComponent);
|
||||||
PastePopupMenuItem.Visible := (Selection.Count > 0) and (Selection[0] is TComponent);
|
PastePopupMenuItem.Visible := (Selection.Count > 0) and (Selection[0] is TComponent);
|
||||||
@ -5078,6 +5117,25 @@ begin
|
|||||||
end;
|
end;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
procedure TObjectInspectorDlg.DoZOrderItemClick(Sender: TObject);
|
||||||
|
var
|
||||||
|
Control: TControl;
|
||||||
|
begin
|
||||||
|
if not (Sender is TMenuItem) then Exit;
|
||||||
|
if (Selection.Count <> 1) or
|
||||||
|
not (Selection[0] is TControl) then Exit;
|
||||||
|
Control := TControl(Selection[0]);
|
||||||
|
if Control.Parent = nil then Exit;
|
||||||
|
|
||||||
|
case TMenuItem(Sender).Tag of
|
||||||
|
0: Control.BringToFront;
|
||||||
|
1: Control.SendToBack;
|
||||||
|
2: Control.Parent.SetControlIndex(Control, Control.Parent.GetControlIndex(Control) + 1);
|
||||||
|
3: Control.Parent.SetControlIndex(Control, Control.Parent.GetControlIndex(Control) - 1);
|
||||||
|
end;
|
||||||
|
DoModified(Self);
|
||||||
|
end;
|
||||||
|
|
||||||
procedure TObjectInspectorDlg.HookRefreshPropertyValues;
|
procedure TObjectInspectorDlg.HookRefreshPropertyValues;
|
||||||
begin
|
begin
|
||||||
RefreshPropertyValues;
|
RefreshPropertyValues;
|
||||||
|
@ -59,6 +59,11 @@ resourcestring
|
|||||||
|
|
||||||
|
|
||||||
//Object Inspector Popup Menu
|
//Object Inspector Popup Menu
|
||||||
|
oisZOrder = 'Z-order';
|
||||||
|
oisOrderMoveToFront = 'Move to Front';
|
||||||
|
oisOrderMoveToBack = 'Move to Back';
|
||||||
|
oisOrderForwardOne = 'Forward One';
|
||||||
|
oisOrderBackOne = 'Back One';
|
||||||
oisSetToDefault = 'Set to default: %s';
|
oisSetToDefault = 'Set to default: %s';
|
||||||
oisSetToDefaultValue = 'Set to default value';
|
oisSetToDefaultValue = 'Set to default value';
|
||||||
oisAddToFavorites = 'Add to Favorites';
|
oisAddToFavorites = 'Add to Favorites';
|
||||||
|
Loading…
Reference in New Issue
Block a user