diff --git a/.gitattributes b/.gitattributes index f12180c876..5e6f69ce10 100644 --- a/.gitattributes +++ b/.gitattributes @@ -67,6 +67,7 @@ designer/abstracteditor.pp svneol=native#text/pascal designer/abstractfilesystem.pp svneol=native#text/pascal designer/abstractformeditor.pp svneol=native#text/pascal designer/aligncompsdlg.pp svneol=native#text/pascal +designer/columndlg.pp svneol=native#text/pascal designer/controlselection.pp svneol=native#text/pascal designer/customeditor.pp svneol=native#text/pascal designer/designer.pp svneol=native#text/pascal @@ -104,7 +105,6 @@ examples/toolbar.pp svneol=native#text/pascal examples/trackbar.pp svneol=native#text/pascal ide/breakpointsdlg.pp svneol=native#text/pascal ide/codetemplatedialog.pp svneol=native#text/pascal -ide/columndlg.pp svneol=native#text/pascal ide/compiler.pp svneol=native#text/pascal ide/compileroptions.pp svneol=native#text/pascal ide/compreg.pp svneol=native#text/pascal diff --git a/ide/columndlg.pp b/designer/columndlg.pp similarity index 99% rename from ide/columndlg.pp rename to designer/columndlg.pp index ae8edc62e6..dde3dc16ae 100644 --- a/ide/columndlg.pp +++ b/designer/columndlg.pp @@ -1,4 +1,4 @@ -unit columndlg; +unit ColumnDlg; {$mode objfpc}{$H+} @@ -41,7 +41,6 @@ type { public declarations } constructor Create(AOwner : TComponent); override; property Items : TList read FItems write FItems; - end; var diff --git a/designer/propedits.pp b/designer/propedits.pp index 2053b4238f..cdf7a1246e 100644 --- a/designer/propedits.pp +++ b/designer/propedits.pp @@ -9,13 +9,10 @@ unit propedits; For more information see the big comment part below. ToDo: - -filter double properties -digits for floattypes -> I hope, I have guessed right -TIntegerSet missing -> taking my own -Save ColorDialog settings - -ColorToString missing -> taking my own - -StringToColor missing -> taking my own - -System.TypeInfo(Type) missing -> exists already in the developer version + -System.TypeInfo(Type) missing -> exists already in the fpc 1.1 version but because I want it now with the stable version I will use my workaround -StrToInt64 has a bug. It prints infinitly "something happened" @@ -30,7 +27,9 @@ unit propedits; interface -uses Classes, TypInfo, SysUtils, Forms, Controls, Graphics, StdCtrls, Buttons; +uses + Classes, TypInfo, SysUtils, Forms, Controls, Graphics, StdCtrls, Buttons, + ComCtrls; const MaxIdentLength: Byte = 63; @@ -185,7 +184,7 @@ type and their values don't match this procedure will be passed an empty value. - Properties and methods useful in creating a new TPropertyEditor classes: + Properties and methods useful in creating new TPropertyEditor classes: Name property Returns the name of the property returned by GetName @@ -245,7 +244,6 @@ type procedure SetPropEntry(Index:Integer; AInstance:TPersistent; APropInfo:PPropInfo); protected - // XXX these functions could be transfered to the TComponentInterface function GetPropInfo:PPropInfo; function GetFloatValue:Extended; function GetFloatValueAt(Index:Integer):Extended; @@ -577,7 +575,7 @@ type end; { TStringsPropertyEditor - PropertyEditor editor for the TStrings property. + PropertyEditor editor for the TStrings properties. Brings up the dialog for entering test. } TStringsPropertyEditor = class(TClassPropertyEditor) @@ -586,6 +584,16 @@ type function GetAttributes: TPropertyAttributes; override; end; +{ TViewColumnsPropertyEditor + PropertyEditor editor for the TViewColumns properties. + Brings up the dialog for entering test. } + + TViewColumnsPropertyEditor = class(TClassPropertyEditor) + public + procedure Edit; override; + function GetAttributes: TPropertyAttributes; override; + end; + //============================================================================== { RegisterPropertyEditor @@ -805,6 +813,7 @@ type FTabOrder:integer; FCaption:TCaption; FLines:TStrings; + FColumns: TViewColumns; FModalResult:TModalResult; function PTypeInfos(const PropName:shortstring):PTypeInfo; constructor Create; @@ -819,6 +828,7 @@ type property TabOrder:integer read FTabOrder; property Caption:TCaption read FCaption; property Lines:TStrings read FLines; + property Columns:TViewColumns; property ModalResult:TModalResult read FModalResult write FModalResult; end; @@ -826,7 +836,7 @@ type implementation -uses Dialogs, Math; +uses Dialogs, Math, ColumnDlg; const @@ -2504,19 +2514,21 @@ end; { TFontPropertyEditor } procedure TFontPropertyEditor.Edit; -var - FontDialog: TFontDialog; +//var FontDialog: TFontDialog; begin + { + !!! TFontDialog in the gtk-interface is currently not fully compatible to TFont + FontDialog := TFontDialog.Create(Application); try - //FontDialog.Font := TFont(GetOrdValue); - //FontDialog.HelpContext := hcDFontEditor; - //FontDialog.Options := FontDialog.Options + [fdShowHelp, fdForceFontExist]; - //if FontDialog.Execute then - //SetOrdValue(Longint(FontDialog.Font)); + FontDialog.Font := TFont(GetOrdValue); + FontDialog.HelpContext := hcDFontEditor; + FontDialog.Options := FontDialog.Options + [fdShowHelp, fdForceFontExist]; + if FontDialog.Execute then + SetOrdValue(Longint(FontDialog.Font)); finally FontDialog.Free; - end; + end;} end; function TFontPropertyEditor.GetAttributes: TPropertyAttributes; @@ -2622,6 +2634,36 @@ begin Result := [paMultiSelect, paDialog, paRevertable, paReadOnly]; end; +{ TViewColumnsPropertyEditor } + +procedure TViewColumnsPropertyEditor.Edit; +var ColumnDlg: TColumnDlg1; +begin + ColumnDlg:=TColumnDlg1.Create(Application); + try + { + For Shane: + Every property of type TViewColumns can be edited by this proc. + The current TViewColumns instance can be found in + + TViewColumns(GetOrdValue) + + You must somehow assign its values to the ColumnDlg and assign it back + on mrOk. Or u can simply work with it, so that changes are shown at once. + } + + ColumnDlg.ShowModal; + finally + ColumnDlg.Free; + end; +end; + +function TViewColumnsPropertyEditor.GetAttributes: TPropertyAttributes; +begin + Result := [paMultiSelect, paDialog, paRevertable, paReadOnly]; +end; + + //============================================================================== @@ -2936,6 +2978,8 @@ begin nil,'',TCaptionPropertyEditor); RegisterPropertyEditor(DummyClassForPropTypes.PTypeInfos('TStrings'), nil,'',TStringsPropertyEditor); + RegisterPropertyEditor(DummyClassForPropTypes.PTypeInfos('TViewColumns'), + nil,'',TViewColumnsPropertyEditor); RegisterPropertyEditor(DummyClassForPropTypes.PTypeInfos('TModalResult'), nil,'ModalResult',TModalResultPropertyEditor); end;