diff --git a/components/ideintf/ideintf.lpk b/components/ideintf/ideintf.lpk index 54129930ea..0ea41eea02 100644 --- a/components/ideintf/ideintf.lpk +++ b/components/ideintf/ideintf.lpk @@ -20,50 +20,50 @@ - + - - - - + + + + - - - - + + + + - - - - + + + + - - - - + + + + - - - - + + + + @@ -82,19 +82,19 @@ - - + + - - + + - + @@ -102,218 +102,226 @@ - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + + + + + + + + + + + + + + + + + - - - - - - - - - - - - - - - - - - + + - + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - + - - + + - - + + + + + + + + + + diff --git a/components/ideintf/ideintf.pas b/components/ideintf/ideintf.pas index 773c89a1bc..0ebd49eed4 100644 --- a/components/ideintf/ideintf.pas +++ b/components/ideintf/ideintf.pas @@ -9,17 +9,17 @@ interface uses ActionsEditor, ActionsEditorStd, BaseIDEIntf, CheckGroupEditorDlg, CheckListboxEditorDlg, CollectionPropEditForm, ColumnDlg, ComponentEditors, - ComponentReg, ComponentTreeView, DBPropEdits, fieldseditor, fieldslist, - FormEditingIntf, frmSelectProps, GraphicPropEdit, GraphPropEdits, - HeaderControlPropEdit, HelpFPDoc, IDECommands, IDEDialogs, - IDEExternToolIntf, IDEHelpIntf, IDEImagesIntf, IDEMsgIntf, IDEOptionsIntf, - IDETextConverter, IDEWindowIntf, ImageListEditor, LazIDEIntf, - LazStringGridEdit, ListViewPropEdit, MacroIntf, MaskPropEdit, MenuIntf, - newfield, NewItemIntf, ObjectInspector, ObjInspStrConsts, PackageIntf, - ProjectIntf, ProjectResourcesIntf, PropEdits, PropEditUtils, SrcEditorIntf, - StatusBarPropEdit, StringsPropEditDlg, TextTools, TreeViewPropEdit, - CompOptsIntf, OIFavoriteProperties, UnitResources, MacroDefIntf, - FileFilterPropEditor, IDEUtils, LazarusPackageIntf; + ComponentReg, ComponentTreeView, CompOptsIntf, DBPropEdits, fieldseditor, + fieldslist, FileFilterPropEditor, FormEditingIntf, frmSelectProps, + GraphicPropEdit, GraphPropEdits, HeaderControlPropEdit, HelpFPDoc, + IDECommands, IDEDialogs, IDEExternToolIntf, IDEHelpIntf, IDEImagesIntf, + IDEMsgIntf, IDEOptionsIntf, IDETextConverter, IDEUtils, IDEWindowIntf, + ImageListEditor, KeyValPropEditDlg, LazIDEIntf, LazStringGridEdit, + ListViewPropEdit, MacroDefIntf, MacroIntf, MaskPropEdit, MenuIntf, newfield, + NewItemIntf, ObjectInspector, ObjInspStrConsts, OIFavoriteProperties, + PackageIntf, ProjectIntf, ProjectResourcesIntf, PropEdits, PropEditUtils, + SrcEditorIntf, StatusBarPropEdit, StringsPropEditDlg, TextTools, + TreeViewPropEdit, UnitResources, LazarusPackageIntf; implementation diff --git a/components/ideintf/propedits.pp b/components/ideintf/propedits.pp index c8bbaf9fd7..ced8162f70 100644 --- a/components/ideintf/propedits.pp +++ b/components/ideintf/propedits.pp @@ -30,10 +30,11 @@ uses Classes, TypInfo, SysUtils, types, Forms, Controls, LCLProc, GraphType, FPCAdds, // for StrToQWord in older fpc versions StringHashList, ButtonPanel, Graphics, StdCtrls, Buttons, Menus, LCLType, - ExtCtrls, ComCtrls, LCLIntf, Dialogs, EditBtn, PropertyStorage, + ExtCtrls, ComCtrls, LCLIntf, Dialogs, EditBtn, PropertyStorage, ValEdit, FileUtil, FileCtrl, ObjInspStrConsts, PropEditUtils, // Forms with .lfm files - FrmSelectProps, StringsPropEditDlg, CollectionPropEditForm, FileFilterPropEditor; + FrmSelectProps, StringsPropEditDlg, KeyValPropEditDlg, CollectionPropEditForm, + FileFilterPropEditor; const MaxIdentLength: Byte = 63; @@ -791,7 +792,7 @@ type { TStringsPropertyEditor PropertyEditor editor for the TStrings properties. - Brings up the dialog for entering text. } + Brings up a dialog with a Memo for entering text. } TStringsPropEditorDlg = class; @@ -803,6 +804,20 @@ type end; +{ TValueListPropertyEditor + PropertyEditor editor for the TStrings property of TValueListEditor. + Brings up a dialog with a ValueListEditor for entering keys and values. } + + TKeyValPropEditorDlg = class; + + TValueListPropertyEditor = class(TClassPropertyEditor) + public + procedure Edit; override; + function CreateDlg(s: TStrings): TKeyValPropEditorDlg; virtual; + function GetAttributes: TPropertyAttributes; override; + end; + + { TCursorPropertyEditor PropertyEditor editor for the TCursor properties. Displays cursor as constant name if exists, otherwise an integer. } @@ -1464,6 +1479,11 @@ type Editor: TPropertyEditor; end; + TKeyValPropEditorDlg = class(TKeyValPropEditorFrm) + public + Editor: TPropertyEditor; + end; + { TCustomShortCutGrabBox } TCustomShortCutGrabBox = class(TCustomPanel) @@ -4997,6 +5017,34 @@ begin Result := [paMultiSelect, paDialog, paRevertable, paReadOnly]; end; +{ TValueListPropertyEditor } + +procedure TValueListPropertyEditor.Edit; +var + TheDialog: TKeyValPropEditorDlg; +begin + TheDialog := CreateDlg(TStrings(GetObjectValue)); + try + if (TheDialog.ShowModal = mrOK) then + SetPtrValue(TheDialog.ValueListEdit.Strings); + finally + TheDialog.Free; + end; +end; + +function TValueListPropertyEditor.CreateDlg(s: TStrings): TKeyValPropEditorDlg; +begin + Result := TKeyValPropEditorDlg.Create(Application); + Result.Editor := Self; + Result.ValueListEdit.Strings.Assign(s); + Result.ValueListEdit.Invalidate; +end; + +function TValueListPropertyEditor.GetAttributes: TPropertyAttributes; +begin + Result := [paMultiSelect, paDialog, paRevertable, paReadOnly]; +end; + { TStringMultilinePropertyEditor } procedure TStringMultilinePropertyEditor.Edit; @@ -6821,6 +6869,7 @@ begin RegisterPropertyEditor(TypeInfo(AnsiString), TFilterComboBox, 'Filter', TFileDlgFilterProperty); RegisterPropertyEditor(TypeInfo(AnsiString), TFileNameEdit, 'Filter', TFileDlgFilterProperty); RegisterPropertyEditor(TypeInfo(AnsiString), TCustomPropertyStorage, 'Filename', TFileNamePropertyEditor); + RegisterPropertyEditor(TypeInfo(TStrings), TValueListEditor, '', TValueListPropertyEditor); RegisterPropertyEditor(TypeInfo(TAnchorSide), TControl, 'AnchorSideLeft', THiddenPropertyEditor); RegisterPropertyEditor(TypeInfo(TAnchorSide), TControl, 'AnchorSideTop', THiddenPropertyEditor); RegisterPropertyEditor(TypeInfo(TAnchorSide), TControl, 'AnchorSideRight', THiddenPropertyEditor);