IDE, PropEdits: use GetVerbCount, GetVerb and ExecuteVerb for OI popup menu actions

git-svn-id: trunk@39487 -
This commit is contained in:
juha 2012-12-09 14:08:11 +00:00
parent 966565bfbd
commit c09fb28755
24 changed files with 369 additions and 188 deletions

View File

@ -12277,7 +12277,7 @@ begin
ObjectInspector1.ShowFavorites:=True;
ObjectInspector1.ShowRestricted:=True;
ObjectInspector1.Favorites:=LoadOIFavoriteProperties;
ObjectInspector1.FindDeclarationPopupmenuItem.Visible:=true;
// ObjectInspector1.FindDeclarationPopupmenuItem.Visible:=true;
ObjectInspector1.OnAddToFavorites:=@OIOnAddToFavorites;
ObjectInspector1.OnFindDeclarationOfProperty:=@OIOnFindDeclarationOfProperty;
ObjectInspector1.OnUpdateRestricted := @OIOnUpdateRestricted;

View File

@ -708,17 +708,25 @@ msgstr "تحديد"
msgid "Set MaxHeight=%d, MaxWidth=%d"
msgstr ""
#: objinspstrconsts.oissetmaxconstraintshint
msgid "Use current size as Max Contraints"
msgstr ""
#: objinspstrconsts.oissetminconstraints
msgid "Set MinHeight=%d, MinWidth=%d"
msgstr ""
#: objinspstrconsts.oissetminconstraintshint
msgid "Use current size as Min Contraints"
msgstr ""
#: objinspstrconsts.oissettodefault
msgid "Set to default: %s"
msgstr "تحديد للإفتراضي: %s"
#: objinspstrconsts.oissettodefaultvalue
msgid "Set to default value"
msgstr "تحديد للقيمة الافتراضية"
#: objinspstrconsts.oissettodefaulthint
msgid "Set property value to Default"
msgstr ""
#: objinspstrconsts.oisshowcomponenttree
msgid "Show Component Tree"

View File

@ -728,17 +728,25 @@ msgstr "Fica"
msgid "Set MaxHeight=%d, MaxWidth=%d"
msgstr ""
#: objinspstrconsts.oissetmaxconstraintshint
msgid "Use current size as Max Contraints"
msgstr ""
#: objinspstrconsts.oissetminconstraints
msgid "Set MinHeight=%d, MinWidth=%d"
msgstr ""
#: objinspstrconsts.oissetminconstraintshint
msgid "Use current size as Min Contraints"
msgstr ""
#: objinspstrconsts.oissettodefault
msgid "Set to default: %s"
msgstr "Fica a predeterminat: %s"
#: objinspstrconsts.oissettodefaultvalue
msgid "Set to default value"
msgstr "Fica a valor predeterminat"
#: objinspstrconsts.oissettodefaulthint
msgid "Set property value to Default"
msgstr ""
#: objinspstrconsts.oisshowcomponenttree
msgid "Show Component Tree"

View File

@ -727,17 +727,25 @@ msgstr "Množina"
msgid "Set MaxHeight=%d, MaxWidth=%d"
msgstr ""
#: objinspstrconsts.oissetmaxconstraintshint
msgid "Use current size as Max Contraints"
msgstr ""
#: objinspstrconsts.oissetminconstraints
msgid "Set MinHeight=%d, MinWidth=%d"
msgstr ""
#: objinspstrconsts.oissetminconstraintshint
msgid "Use current size as Min Contraints"
msgstr ""
#: objinspstrconsts.oissettodefault
msgid "Set to default: %s"
msgstr "Nastavit na výchozí: %s"
#: objinspstrconsts.oissettodefaultvalue
msgid "Set to default value"
msgstr "Nastavit na výchozí hodnotu"
#: objinspstrconsts.oissettodefaulthint
msgid "Set property value to Default"
msgstr ""
#: objinspstrconsts.oisshowcomponenttree
msgid "Show Component Tree"

View File

@ -740,17 +740,25 @@ msgstr "Set"
msgid "Set MaxHeight=%d, MaxWidth=%d"
msgstr ""
#: objinspstrconsts.oissetmaxconstraintshint
msgid "Use current size as Max Contraints"
msgstr ""
#: objinspstrconsts.oissetminconstraints
msgid "Set MinHeight=%d, MinWidth=%d"
msgstr ""
#: objinspstrconsts.oissetminconstraintshint
msgid "Use current size as Min Contraints"
msgstr ""
#: objinspstrconsts.oissettodefault
msgid "Set to default: %s"
msgstr "Auf Voreinstellung %s setzen"
#: objinspstrconsts.oissettodefaultvalue
msgid "Set to default value"
msgstr "Auf die Voreinstellung setzen"
#: objinspstrconsts.oissettodefaulthint
msgid "Set property value to Default"
msgstr ""
#: objinspstrconsts.oisshowcomponenttree
msgid "Show Component Tree"

View File

@ -731,17 +731,25 @@ msgstr "Conjunto"
msgid "Set MaxHeight=%d, MaxWidth=%d"
msgstr ""
#: objinspstrconsts.oissetmaxconstraintshint
msgid "Use current size as Max Contraints"
msgstr ""
#: objinspstrconsts.oissetminconstraints
msgid "Set MinHeight=%d, MinWidth=%d"
msgstr ""
#: objinspstrconsts.oissetminconstraintshint
msgid "Use current size as Min Contraints"
msgstr ""
#: objinspstrconsts.oissettodefault
msgid "Set to default: %s"
msgstr "Establecer por defecto: %s"
#: objinspstrconsts.oissettodefaultvalue
msgid "Set to default value"
msgstr "Establecer valor por defecto"
#: objinspstrconsts.oissettodefaulthint
msgid "Set property value to Default"
msgstr ""
#: objinspstrconsts.oisshowcomponenttree
msgid "Show Component Tree"

View File

@ -723,17 +723,25 @@ msgstr "Aseta"
msgid "Set MaxHeight=%d, MaxWidth=%d"
msgstr ""
#: objinspstrconsts.oissetmaxconstraintshint
msgid "Use current size as Max Contraints"
msgstr ""
#: objinspstrconsts.oissetminconstraints
msgid "Set MinHeight=%d, MinWidth=%d"
msgstr ""
#: objinspstrconsts.oissetminconstraintshint
msgid "Use current size as Min Contraints"
msgstr ""
#: objinspstrconsts.oissettodefault
msgid "Set to default: %s"
msgstr "Aseta oletusarvo: %s"
#: objinspstrconsts.oissettodefaultvalue
msgid "Set to default value"
msgstr "Aseta oletusarvoonsa"
#: objinspstrconsts.oissettodefaulthint
msgid "Set property value to Default"
msgstr ""
#: objinspstrconsts.oisshowcomponenttree
msgid "Show Component Tree"

View File

@ -737,17 +737,25 @@ msgstr "Ensemble"
msgid "Set MaxHeight=%d, MaxWidth=%d"
msgstr ""
#: objinspstrconsts.oissetmaxconstraintshint
msgid "Use current size as Max Contraints"
msgstr ""
#: objinspstrconsts.oissetminconstraints
msgid "Set MinHeight=%d, MinWidth=%d"
msgstr ""
#: objinspstrconsts.oissetminconstraintshint
msgid "Use current size as Min Contraints"
msgstr ""
#: objinspstrconsts.oissettodefault
msgid "Set to default: %s"
msgstr "Mis à  la valeur par défaut: %s"
#: objinspstrconsts.oissettodefaultvalue
msgid "Set to default value"
msgstr "Mis à  la valeur par défaut"
#: objinspstrconsts.oissettodefaulthint
msgid "Set property value to Default"
msgstr ""
#: objinspstrconsts.oisshowcomponenttree
msgid "Show Component Tree"

View File

@ -724,17 +724,25 @@ msgstr "קבע"
msgid "Set MaxHeight=%d, MaxWidth=%d"
msgstr ""
#: objinspstrconsts.oissetmaxconstraintshint
msgid "Use current size as Max Contraints"
msgstr ""
#: objinspstrconsts.oissetminconstraints
msgid "Set MinHeight=%d, MinWidth=%d"
msgstr ""
#: objinspstrconsts.oissetminconstraintshint
msgid "Use current size as Min Contraints"
msgstr ""
#: objinspstrconsts.oissettodefault
msgid "Set to default: %s"
msgstr "קבע כברירת מחדל: s%"
#: objinspstrconsts.oissettodefaultvalue
msgid "Set to default value"
msgstr "קבע כערך ברירת מחדל"
#: objinspstrconsts.oissettodefaulthint
msgid "Set property value to Default"
msgstr ""
#: objinspstrconsts.oisshowcomponenttree
msgid "Show Component Tree"

View File

@ -730,17 +730,25 @@ msgstr "Set"
msgid "Set MaxHeight=%d, MaxWidth=%d"
msgstr ""
#: objinspstrconsts.oissetmaxconstraintshint
msgid "Use current size as Max Contraints"
msgstr ""
#: objinspstrconsts.oissetminconstraints
msgid "Set MinHeight=%d, MinWidth=%d"
msgstr ""
#: objinspstrconsts.oissetminconstraintshint
msgid "Use current size as Min Contraints"
msgstr ""
#: objinspstrconsts.oissettodefault
msgid "Set to default: %s"
msgstr "Set ke default: %s"
#: objinspstrconsts.oissettodefaultvalue
msgid "Set to default value"
msgstr "Set ke nilai default"
#: objinspstrconsts.oissettodefaulthint
msgid "Set property value to Default"
msgstr ""
#: objinspstrconsts.oisshowcomponenttree
msgid "Show Component Tree"

View File

@ -738,17 +738,25 @@ msgstr "Imposta"
msgid "Set MaxHeight=%d, MaxWidth=%d"
msgstr ""
#: objinspstrconsts.oissetmaxconstraintshint
msgid "Use current size as Max Contraints"
msgstr ""
#: objinspstrconsts.oissetminconstraints
msgid "Set MinHeight=%d, MinWidth=%d"
msgstr ""
#: objinspstrconsts.oissetminconstraintshint
msgid "Use current size as Min Contraints"
msgstr ""
#: objinspstrconsts.oissettodefault
msgid "Set to default: %s"
msgstr "Imposta al valore predefinito: %s"
#: objinspstrconsts.oissettodefaultvalue
msgid "Set to default value"
msgstr "Imposta al valore predefinito"
#: objinspstrconsts.oissettodefaulthint
msgid "Set property value to Default"
msgstr ""
#: objinspstrconsts.oisshowcomponenttree
msgid "Show Component Tree"

View File

@ -734,17 +734,25 @@ msgstr "設定"
msgid "Set MaxHeight=%d, MaxWidth=%d"
msgstr ""
#: objinspstrconsts.oissetmaxconstraintshint
msgid "Use current size as Max Contraints"
msgstr ""
#: objinspstrconsts.oissetminconstraints
msgid "Set MinHeight=%d, MinWidth=%d"
msgstr ""
#: objinspstrconsts.oissetminconstraintshint
msgid "Use current size as Min Contraints"
msgstr ""
#: objinspstrconsts.oissettodefault
msgid "Set to default: %s"
msgstr "デフォルトに設定: %s"
#: objinspstrconsts.oissettodefaultvalue
msgid "Set to default value"
msgstr "既定値に設定"
#: objinspstrconsts.oissettodefaulthint
msgid "Set property value to Default"
msgstr ""
#: objinspstrconsts.oisshowcomponenttree
msgid "Show Component Tree"

View File

@ -723,17 +723,25 @@ msgstr "Aibė"
msgid "Set MaxHeight=%d, MaxWidth=%d"
msgstr ""
#: objinspstrconsts.oissetmaxconstraintshint
msgid "Use current size as Max Contraints"
msgstr ""
#: objinspstrconsts.oissetminconstraints
msgid "Set MinHeight=%d, MinWidth=%d"
msgstr ""
#: objinspstrconsts.oissetminconstraintshint
msgid "Use current size as Min Contraints"
msgstr ""
#: objinspstrconsts.oissettodefault
msgid "Set to default: %s"
msgstr "Keisti į numatytą: %s"
#: objinspstrconsts.oissettodefaultvalue
msgid "Set to default value"
msgstr "Keisti į numatytą reikšmę"
#: objinspstrconsts.oissettodefaulthint
msgid "Set property value to Default"
msgstr ""
#: objinspstrconsts.oisshowcomponenttree
msgid "Show Component Tree"

View File

@ -717,17 +717,25 @@ msgstr "Set"
msgid "Set MaxHeight=%d, MaxWidth=%d"
msgstr ""
#: objinspstrconsts.oissetmaxconstraintshint
msgid "Use current size as Max Contraints"
msgstr ""
#: objinspstrconsts.oissetminconstraints
msgid "Set MinHeight=%d, MinWidth=%d"
msgstr ""
#: objinspstrconsts.oissetminconstraintshint
msgid "Use current size as Min Contraints"
msgstr ""
#: objinspstrconsts.oissettodefault
msgid "Set to default: %s"
msgstr "Zet naar standaardinstelling: %s"
#: objinspstrconsts.oissettodefaultvalue
msgid "Set to default value"
msgstr "Zet naar standaardwaarde"
#: objinspstrconsts.oissettodefaulthint
msgid "Set property value to Default"
msgstr ""
#: objinspstrconsts.oisshowcomponenttree
msgid "Show Component Tree"

View File

@ -731,17 +731,25 @@ msgstr "Set"
msgid "Set MaxHeight=%d, MaxWidth=%d"
msgstr ""
#: objinspstrconsts.oissetmaxconstraintshint
msgid "Use current size as Max Contraints"
msgstr ""
#: objinspstrconsts.oissetminconstraints
msgid "Set MinHeight=%d, MinWidth=%d"
msgstr ""
#: objinspstrconsts.oissetminconstraintshint
msgid "Use current size as Min Contraints"
msgstr ""
#: objinspstrconsts.oissettodefault
msgid "Set to default: %s"
msgstr "Ustaw domyślną wartość: %s"
#: objinspstrconsts.oissettodefaultvalue
msgid "Set to default value"
msgstr "Ustaw domyślną wartość"
#: objinspstrconsts.oissettodefaulthint
msgid "Set property value to Default"
msgstr ""
#: objinspstrconsts.oisshowcomponenttree
msgid "Show Component Tree"

View File

@ -699,16 +699,24 @@ msgstr ""
msgid "Set MaxHeight=%d, MaxWidth=%d"
msgstr ""
#: objinspstrconsts.oissetmaxconstraintshint
msgid "Use current size as Max Contraints"
msgstr ""
#: objinspstrconsts.oissetminconstraints
msgid "Set MinHeight=%d, MinWidth=%d"
msgstr ""
#: objinspstrconsts.oissetminconstraintshint
msgid "Use current size as Min Contraints"
msgstr ""
#: objinspstrconsts.oissettodefault
msgid "Set to default: %s"
msgstr ""
#: objinspstrconsts.oissettodefaultvalue
msgid "Set to default value"
#: objinspstrconsts.oissettodefaulthint
msgid "Set property value to Default"
msgstr ""
#: objinspstrconsts.oisshowcomponenttree

View File

@ -721,17 +721,25 @@ msgstr "Definir"
msgid "Set MaxHeight=%d, MaxWidth=%d"
msgstr ""
#: objinspstrconsts.oissetmaxconstraintshint
msgid "Use current size as Max Contraints"
msgstr ""
#: objinspstrconsts.oissetminconstraints
msgid "Set MinHeight=%d, MinWidth=%d"
msgstr ""
#: objinspstrconsts.oissetminconstraintshint
msgid "Use current size as Min Contraints"
msgstr ""
#: objinspstrconsts.oissettodefault
msgid "Set to default: %s"
msgstr "Definir para padrão: %s"
#: objinspstrconsts.oissettodefaultvalue
msgid "Set to default value"
msgstr "Definir para valor padrão"
#: objinspstrconsts.oissettodefaulthint
msgid "Set property value to Default"
msgstr ""
#: objinspstrconsts.oisshowcomponenttree
msgid "Show Component Tree"

View File

@ -725,17 +725,25 @@ msgstr "Set"
msgid "Set MaxHeight=%d, MaxWidth=%d"
msgstr "Установить MaxHeight=%d, MaxWidth=%d"
#: objinspstrconsts.oissetmaxconstraintshint
msgid "Use current size as Max Contraints"
msgstr ""
#: objinspstrconsts.oissetminconstraints
msgid "Set MinHeight=%d, MinWidth=%d"
msgstr "Установить MinHeight=%d, MinWidth=%d"
#: objinspstrconsts.oissetminconstraintshint
msgid "Use current size as Min Contraints"
msgstr ""
#: objinspstrconsts.oissettodefault
msgid "Set to default: %s"
msgstr "Установить по умолчанию: %s"
#: objinspstrconsts.oissettodefaultvalue
msgid "Set to default value"
msgstr "Установить в значение по умолчанию"
#: objinspstrconsts.oissettodefaulthint
msgid "Set property value to Default"
msgstr ""
#: objinspstrconsts.oisshowcomponenttree
msgid "Show Component Tree"

View File

@ -736,17 +736,25 @@ msgstr "Množina"
msgid "Set MaxHeight=%d, MaxWidth=%d"
msgstr ""
#: objinspstrconsts.oissetmaxconstraintshint
msgid "Use current size as Max Contraints"
msgstr ""
#: objinspstrconsts.oissetminconstraints
msgid "Set MinHeight=%d, MinWidth=%d"
msgstr ""
#: objinspstrconsts.oissetminconstraintshint
msgid "Use current size as Min Contraints"
msgstr ""
#: objinspstrconsts.oissettodefault
msgid "Set to default: %s"
msgstr "Nastaviť na predvolené: %s"
#: objinspstrconsts.oissettodefaultvalue
msgid "Set to default value"
msgstr "Nastaviť na predvolenú hodnotu"
#: objinspstrconsts.oissettodefaulthint
msgid "Set property value to Default"
msgstr ""
#: objinspstrconsts.oisshowcomponenttree
msgid "Show Component Tree"

View File

@ -717,17 +717,25 @@ msgstr "Встановити"
msgid "Set MaxHeight=%d, MaxWidth=%d"
msgstr ""
#: objinspstrconsts.oissetmaxconstraintshint
msgid "Use current size as Max Contraints"
msgstr ""
#: objinspstrconsts.oissetminconstraints
msgid "Set MinHeight=%d, MinWidth=%d"
msgstr ""
#: objinspstrconsts.oissetminconstraintshint
msgid "Use current size as Min Contraints"
msgstr ""
#: objinspstrconsts.oissettodefault
msgid "Set to default: %s"
msgstr "Встановити за замовчуванням: %s"
#: objinspstrconsts.oissettodefaultvalue
msgid "Set to default value"
msgstr "Встановити величину за замовчуванням"
#: objinspstrconsts.oissettodefaulthint
msgid "Set property value to Default"
msgstr ""
#: objinspstrconsts.oisshowcomponenttree
msgid "Show Component Tree"

View File

@ -737,17 +737,25 @@ msgstr "Set"
msgid "Set MaxHeight=%d, MaxWidth=%d"
msgstr ""
#: objinspstrconsts.oissetmaxconstraintshint
msgid "Use current size as Max Contraints"
msgstr ""
#: objinspstrconsts.oissetminconstraints
msgid "Set MinHeight=%d, MinWidth=%d"
msgstr ""
#: objinspstrconsts.oissetminconstraintshint
msgid "Use current size as Min Contraints"
msgstr ""
#: objinspstrconsts.oissettodefault
msgid "Set to default: %s"
msgstr "设为默认: %s"
#: objinspstrconsts.oissettodefaultvalue
msgid "Set to default value"
msgstr "设为默认值"
#: objinspstrconsts.oissettodefaulthint
msgid "Set property value to Default"
msgstr ""
#: objinspstrconsts.oisshowcomponenttree
msgid "Show Component Tree"

View File

@ -47,6 +47,7 @@ uses
const
OIOptionsFileVersion = 3;
EditorPopupMax = 2; // Number of popup menu items created for PropEditors
DefBackgroundColor = clBtnFace;
DefReferencesColor = clMaroon;
@ -563,8 +564,7 @@ type
//============================================================================
{ TObjectInspectorDlg }
TPropEditPopupMenuItems = array[0..EditorPopupMax-1] of TMenuItem;
TOnAddAvailablePersistent = procedure(APersistent: TPersistent;
var Allowed: boolean) of object;
@ -577,17 +577,27 @@ type
{ TObjectInspectorDlg }
TObjectInspectorDlg = class(TForm)
AddToFavoritesPopupMenuItem: TMenuItem;
ComponentPanel: TPanel;
FilterLabel: TLabel;
CompFilterEdit: TTreeFilterEdit;
ComponentTree: TComponentTreeView;
// Menu items are created in constructor at run-time, not design time
AddToFavoritesPopupMenuItem: TMenuItem;
ViewRestrictedPropertiesPopupMenuItem: TMenuItem;
AvailPersistentComboBox: TComboBox;
InfoPanel: TPanel;
CopyPopupmenuItem: TMenuItem;
CutPopupmenuItem: TMenuItem;
DeletePopupmenuItem: TMenuItem;
FindDeclarationPopupmenuItem: TMenuItem;
OptionsSeparatorMenuItem: TMenuItem;
OptionsSeparatorMenuItem2: TMenuItem;
PastePopupmenuItem: TMenuItem;
RemoveFromFavoritesPopupMenuItem: TMenuItem;
ShowComponentTreePopupMenuItem: TMenuItem;
ShowHintsPopupMenuItem: TMenuItem;
ShowOptionsPopupMenuItem: TMenuItem;
UndoPropertyPopupMenuItem: TMenuItem;
AvailPersistentComboBox: TComboBox;
InfoPanel: TPanel;
EventGrid: TOICustomPropertyGrid;
FavoriteGrid: TOICustomPropertyGrid;
RestrictedGrid: TOICustomPropertyGrid;
@ -597,34 +607,20 @@ type
WidgetSetsRestrictedBox: TPaintBox;
ComponentRestrictedLabel: TLabel;
ComponentRestrictedBox: TPaintBox;
FindDeclarationPopupmenuItem: TMenuItem;
OptionsSeparatorMenuItem: TMenuItem;
MainPopupMenu: TPopupMenu;
NoteBook: TPageControl;
OptionsSeparatorMenuItem2: TMenuItem;
PastePopupmenuItem: TMenuItem;
PropertyGrid: TOICustomPropertyGrid;
RemoveFromFavoritesPopupMenuItem: TMenuItem;
SetDefault1PopupMenuItem: TMenuItem;
SetDefault2PopupMenuItem: TMenuItem;
ShowComponentTreePopupMenuItem: TMenuItem;
ShowHintsPopupMenuItem: TMenuItem;
ShowOptionsPopupMenuItem: TMenuItem;
Splitter1: TSplitter;
Splitter2: TSplitter;
StatusBar: TStatusBar;
UndoPropertyPopupMenuItem: TMenuItem;
procedure AvailComboBoxCloseUp(Sender: TObject);
procedure ComponentTreeDblClick(Sender: TObject);
procedure ComponentTreeKeyDown(Sender: TObject; var Key: Word;
Shift: TShiftState);
procedure ComponentTreeKeyDown(Sender: TObject; var Key: Word; Shift: TShiftState);
procedure ComponentTreeSelectionChanged(Sender: TObject);
procedure OnGridKeyDown(Sender: TObject; var Key: Word; Shift: TShiftState);
procedure OnGridKeyUp(Sender: TObject; var Key: Word; Shift: TShiftState);
procedure OnGridDblClick(Sender: TObject);
procedure OnSetDefaultPopupmenuItemClick(Sender: TObject);
procedure OnSetMaxContraintsPopupmenuItemClick(Sender: TObject);
procedure OnSetMinContraintsPopupmenuItemClick(Sender: TObject);
procedure OnPropEditPopupClick(Sender: TObject);
procedure OnAddToFavoritesPopupmenuItemClick(Sender: TObject);
procedure OnRemoveFromFavoritesPopupmenuItemClick(Sender: TObject);
procedure OnViewRestrictionsPopupmenuItemClick(Sender: TObject);
@ -675,6 +671,7 @@ type
FUpdateLock: integer;
FUpdatingAvailComboBox: boolean;
FComponentEditor: TBaseComponentEditor;
FPropEditPopupMenuItems: TPropEditPopupMenuItems; // Popup menu items for PropEdits
function GetGridControl(Page: TObjectInspectorPage): TOICustomPropertyGrid;
procedure SetComponentEditor(const AValue: TBaseComponentEditor);
procedure SetFavorites(const AValue: TOIFavoriteProperties);
@ -3866,7 +3863,6 @@ end;
//==============================================================================
{ TObjectInspectorDlg }
constructor TObjectInspectorDlg.Create(AnOwner: TComponent);
@ -3909,6 +3905,9 @@ constructor TObjectInspectorDlg.Create(AnOwner: TComponent);
MainPopupMenu.Items.Add(Result);
end;
var
i: Integer;
s: String;
begin
inherited Create(AnOwner);
FEnableHookGetSelection:= true;
@ -3918,7 +3917,7 @@ begin
FAutoShow := True;
FUpdatingAvailComboBox:=false;
FDefaultItemHeight := 22;
FComponentTreeHeight:=160;
FComponentTreeHeight := 160;
FShowComponentTree := True;
FShowFavorites := False;
FShowRestricted := False;
@ -3929,17 +3928,18 @@ begin
Caption := oisObjectInspector;
StatusBar.SimpleText := oisAll;
FilterLabel.Caption := oisComponents;
MainPopupMenu.Images := IDEImages.Images_16;
AddPopupMenuItem(SetDefault1PopupMenuItem,nil,'SetDefault1PopupMenuItem',
'Set to Default value','Set property value to Default', '',
@OnSetDefaultPopupmenuItemClick,false,true,true);
AddPopupMenuItem(SetDefault2PopupMenuItem,nil,'SetDefault2PopupMenuItem',
'Use current size as Min Contraints','Use current size as Min Contraints', '',
@OnSetMinContraintsPopupmenuItemClick,false,true,true);
// "EditorPopupMax" menu items are created for PropEditors already here.
// If more of them must be created, adjust EditorPopupMax accordingly.
for i := 0 to EditorPopupMax-1 do
begin
s := 'PropEditPopupMenuItem'+IntToStr(i);
AddPopupMenuItem(FPropEditPopupMenuItems[i],nil,s,s,'','',@OnPropEditPopupClick,false,true,true);
FPropEditPopupMenuItems[i].Tag := i;
DebugLn(['Created menu item "', s, '"']);
end;
AddPopupMenuItem(AddToFavoritesPopupMenuItem,nil,'AddToFavoritePopupMenuItem',
oisAddtofavorites,'Add property to favorites properties', '',
@OnAddToFavoritesPopupmenuItemClick,false,true,true);
@ -4534,44 +4534,20 @@ begin
//
end;
procedure TObjectInspectorDlg.OnSetDefaultPopupmenuItemClick(Sender: TObject);
procedure TObjectInspectorDlg.OnPropEditPopupClick(Sender: TObject);
var
CurGrid: TOICustomPropertyGrid;
DefaultStr: string;
CurRow: TOIPropertyGridRow;
s: String;
begin
if not GetCurRowDefaultValue(DefaultStr) then exit;
CurGrid:=GetActivePropertyGrid;
if CurGrid=nil then exit;
CurGrid.SetCurrentRowValue(DefaultStr);
RefreshPropertyValues;
end;
procedure TObjectInspectorDlg.OnSetMaxContraintsPopupmenuItemClick(Sender: TObject);
var
Persistent: TPersistent;
c: TControl;
begin
Persistent := GetSelectedPersistent;
Assert(Persistent is TControl,'TObjectInspectorDlg.OnSetMinContraintsPopupmenuItemClick:'
+' Persistent is not TControl');
c := TControl(Persistent);
c.Constraints.MaxHeight := c.Height;
c.Constraints.MaxWidth := c.Width;
RefreshPropertyValues;
end;
procedure TObjectInspectorDlg.OnSetMinContraintsPopupmenuItemClick(Sender: TObject);
var
Persistent: TPersistent;
c: TControl;
begin
Persistent := GetSelectedPersistent;
Assert(Persistent is TControl,'TObjectInspectorDlg.OnSetMinContraintsPopupmenuItemClick:'
+' Persistent is not TControl');
c := TControl(Persistent);
c.Constraints.MinHeight := c.Height;
c.Constraints.MinWidth := c.Width;
CurRow := GetActivePropertyRow;
CurRow.Editor.ExecuteVerb((Sender as TMenuItem).Tag);
s := CurRow.Editor.GetVisualValue;
CurGrid.CurrentEditValue := s;
RefreshPropertyValues;
Invalidate;
DebugLn(['Executed verb number ', (Sender as TMenuItem).Tag, ', VisualValue: ', s, ', CurRow: ', CurRow]);
end;
procedure TObjectInspectorDlg.OnAddToFavoritesPopupmenuItemClick(Sender: TObject);
@ -5169,12 +5145,11 @@ var
end;
var
s: String;
sHint, Capt: String;
i: Integer;
b, AtLeastOneComponent, CanBeDeleted: Boolean;
CurRow: TOIPropertyGridRow;
Persistent: TPersistent;
c: TControl;
b, AtLeastOneComponent, CanBeDeleted: Boolean;
DefaultType: TPropEditDefaultValueType;
begin
RemoveComponentEditorMenuItems;
ShowHintsPopupMenuItem.Checked := PropertyGrid.ShowHint;
@ -5215,48 +5190,21 @@ begin
OptionsSeparatorMenuItem2.Visible := False;
end;
// The editors can do menu actions, for example set defaults and constraints
CurRow := GetActivePropertyRow;
// let use restore default values and set constraints
if (MainPopupMenu.PopupComponent is TOICustomPropertyGrid) then
begin
DefaultType:=pesdDefaultValue;
if Assigned(CurRow) then
DefaultType:=CurRow.Editor.GetDefaultValueType;
case DefaultType of
// Currently this means every editor except Constraints
pesdDefaultValue: begin
SetDefault1PopupMenuItem.Visible := Assigned(CurRow)
and (paHasDefaultValue in CurRow.Editor.GetAttributes);
if SetDefault1PopupMenuItem.Visible then begin
SetDefault1PopupMenuItem.Enabled := CurRow.Editor.IsNotDefaultValue;
SetDefault1PopupMenuItem.Caption := Format(oisSetToDefault,
[CurRow.Editor.GetDefaultValue]);
SetDefault1PopupMenuItem.OnClick := @OnSetDefaultPopupmenuItemClick;
end;
SetDefault2PopupMenuItem.Visible := False;
end;
// Constraints editor
pesdConstraints: begin
Assert(Persistent is TControl,'TObjectInspectorDlg.OnMainPopupMenuPopup: Persistent is not TControl');
c := TControl(Persistent);
// Max Constraints
SetDefault1PopupMenuItem.Visible := True;
SetDefault1PopupMenuItem.Enabled := (c.Constraints.MaxHeight<>c.Height)
or (c.Constraints.MaxWidth<>c.Width);
SetDefault1PopupMenuItem.Caption := Format(oisSetMaxConstraints,[c.Height, c.Width]);
SetDefault1PopupMenuItem.OnClick := @OnSetMaxContraintsPopupmenuItemClick;
// Min Constraints
SetDefault2PopupMenuItem.Visible := True;
SetDefault2PopupMenuItem.Enabled := (c.Constraints.MinHeight<>c.Height)
or (c.Constraints.MinWidth<>c.Width);
SetDefault2PopupMenuItem.Caption := Format(oisSetMinConstraints,[c.Height, c.Width]);
SetDefault2PopupMenuItem.OnClick := @OnSetMinContraintsPopupmenuItemClick;
end;
else begin
WriteStr(s, DefaultType);
raise Exception.Create('TObjectInspectorDlg.OnMainPopupMenuPopup:'
+' Unsupported TPropEditSetDefaultType'+s);
for i := 0 to EditorPopupMax-1 do
begin
Capt := '';
if Assigned(CurRow) and (i < CurRow.Editor.GetVerbCount) then
Capt := CurRow.Editor.GetVerb(i, sHint);
FPropEditPopupMenuItems[i].Visible := Capt<>'';
if FPropEditPopupMenuItems[i].Visible then
begin
FPropEditPopupMenuItems[i].Caption := Capt;
FPropEditPopupMenuItems[i].Hint := sHint;
FPropEditPopupMenuItems[i].Enabled := CurRow.Editor.GetVerbEnabled(i);
end;
end;
@ -5283,8 +5231,8 @@ begin
end
else
begin
SetDefault1PopupMenuItem.Visible := False;
SetDefault2PopupMenuItem.Visible := False;
for i := 0 to EditorPopupMax-1 do
FPropEditPopupMenuItems[i].Visible := False;
AddToFavoritesPopupMenuItem.Visible := False;
RemoveFromFavoritesPopupMenuItem.Visible := False;
UndoPropertyPopupMenuItem.Visible := False;

View File

@ -65,9 +65,11 @@ resourcestring
oisOrderForwardOne = 'Forward One';
oisOrderBackOne = 'Back One';
oisSetToDefault = 'Set to default: %s';
oisSetToDefaultValue = 'Set to default value';
oisSetMinConstraints = 'Set MinHeight=%d, MinWidth=%d';
oisSetToDefaultHint = 'Set property value to Default';
oisSetMaxConstraints = 'Set MaxHeight=%d, MaxWidth=%d';
oisSetMinConstraints = 'Set MinHeight=%d, MinWidth=%d';
oisSetMaxConstraintsHint = 'Use current size as Max Contraints';
oisSetMinConstraintsHint = 'Use current size as Min Contraints';
oisAddToFavorites = 'Add to Favorites';
oisViewRestrictedProperties = 'View restricted properties';
oisRemoveFromFavorites = 'Remove from Favorites';

View File

@ -283,9 +283,6 @@ type
pehEditButton
);
// Used for setting default value from OI popup menu
TPropEditDefaultValueType = (pesdDefaultValue, pesdConstraints);
TPropertyEditorHook = class;
{ TPropertyEditor }
@ -339,7 +336,6 @@ type
function GetWideStrValueAt(Index: Integer): WideString;
function GetValue: ansistring; virtual;
function GetHint(HintType: TPropEditHint; x, y: integer): string; virtual;
function GetDefaultValueType: TPropEditDefaultValueType; virtual;
function GetDefaultValue: ansistring; virtual;
function GetVisualValue: ansistring;
procedure GetValues(Proc: TGetStrProc); virtual;
@ -375,6 +371,12 @@ type
function SubPropertiesNeedsUpdate: boolean; virtual;
function IsDefaultValue: boolean; virtual;
function IsNotDefaultValue: boolean; virtual;
// These are used for the popup menu in OI
function GetVerbCount: Integer; virtual;
function GetVerb(Index: Integer; out AHint: string): string; virtual;
function GetVerbEnabled(Index: Integer): Boolean; virtual;
procedure ExecuteVerb(Index: Integer); virtual;
public
property PropertyHook: TPropertyEditorHook read FPropertyHook;
property PrivateDirectory: ansistring read GetPrivateDirectory;
property PropCount:Integer read FPropCount;
@ -870,7 +872,11 @@ type
TConstraintsPropertyEditor = class(TClassPropertyEditor)
public
function GetDefaultValueType: TPropEditDefaultValueType; override;
// These are used for the popup menu in OI
function GetVerbCount: Integer; override;
function GetVerb(Index: Integer; out AHint: string): string; override;
function GetVerbEnabled(Index: Integer): Boolean; override;
procedure ExecuteVerb(Index: Integer); override;
end;
@ -2562,13 +2568,6 @@ begin
Result:=Result+LineEnding+TypeHint;
end;
function TPropertyEditor.GetDefaultValueType: TPropEditDefaultValueType;
// ToDo: refactor the code so that popup menu in OI gets all info from PropertyEditor
// virtual methods. Now there is a case..of based on this return value.
begin
Result:=pesdDefaultValue;
end;
function TPropertyEditor.GetDefaultValue: ansistring;
begin
if not (paHasDefaultValue in GetAttributes) then
@ -2909,7 +2908,31 @@ end;
function TPropertyEditor.IsNotDefaultValue: boolean;
begin
Result:=(paHasDefaultValue in GetAttributes)
and (GetDefaultValue<>GetVisualValue);
and (GetDefaultValue<>GetVisualValue);
end;
function TPropertyEditor.GetVerbCount: Integer;
begin
if paHasDefaultValue in GetAttributes then
Result := 1 // Show a menu item for default value only if there is default value
else
Result := 0;
end;
function TPropertyEditor.GetVerb(Index: Integer; out AHint: string): string;
begin
Result := Format(oisSetToDefault, [GetDefaultValue]);
AHint := oisSetToDefaultHint;
end;
function TPropertyEditor.GetVerbEnabled(Index: Integer): Boolean;
begin
Result := IsNotDefaultValue;
end;
procedure TPropertyEditor.ExecuteVerb(Index: Integer);
begin
SetValue(GetDefaultValue);
end;
{ TOrdinalPropertyEditor }
@ -2958,8 +2981,7 @@ end;
{ TIntegerPropertyEditor }
function TIntegerPropertyEditor.OrdValueToVisualValue(OrdValue: longint
): string;
function TIntegerPropertyEditor.OrdValueToVisualValue(OrdValue: longint): string;
begin
with GetTypeData(GetPropType)^ do begin
{debugln('TIntegerPropertyEditor.OrdValueToVisualValue ',GetName,' ',dbgs(ord(OrdType)),' ',dbgs(OrdValue));
@ -5104,9 +5126,58 @@ end;
{ TConstraintsPropertyEditor }
function TConstraintsPropertyEditor.GetDefaultValueType: TPropEditDefaultValueType;
function TConstraintsPropertyEditor.GetVerbCount: Integer;
begin
Result:=pesdConstraints;
Result:=2;
end;
function TConstraintsPropertyEditor.GetVerb(Index: Integer; out AHint: string): string;
var
s: String;
c: TControl;
begin
case Index of
0: begin
s := oisSetMaxConstraints;
AHint := oisSetMaxConstraintsHint;
end;
1: begin
s := oisSetMinConstraints;
AHint := oisSetMinConstraintsHint;
end;
end;
c := GetComponent(0) as TControl;
Result := Format(s, [c.Height, c.Width]);
end;
function TConstraintsPropertyEditor.GetVerbEnabled(Index: Integer): Boolean;
var
c: TControl;
begin
c := GetComponent(0) as TControl;
case Index of
0: Result := (c.Constraints.MaxHeight<>c.Height)
or (c.Constraints.MaxWidth<>c.Width);
1: Result := (c.Constraints.MinHeight<>c.Height)
or (c.Constraints.MinWidth<>c.Width);
end;
end;
procedure TConstraintsPropertyEditor.ExecuteVerb(Index: Integer);
var
c: TControl;
begin
c := GetComponent(0) as TControl;
case Index of
0: begin
c.Constraints.MaxHeight := c.Height;
c.Constraints.MaxWidth := c.Width;
end;
1: begin
c.Constraints.MinHeight := c.Height;
c.Constraints.MinWidth := c.Width;
end;
end;
end;
//==============================================================================