ide: improve object inspector drawing: add hightlight, hightlight font colors, draw vert line between property name and icons

git-svn-id: trunk@17380 -
This commit is contained in:
paul 2008-11-14 04:44:55 +00:00
parent 5eb4c0c00f
commit 6d680c4727
5 changed files with 236 additions and 149 deletions

View File

@ -4,8 +4,8 @@ inherited OIOptionsFrame: TOIOptionsFrame
ClientHeight = 395 ClientHeight = 395
ClientWidth = 598 ClientWidth = 598
Visible = False Visible = False
DesignLeft = 176 DesignLeft = 110
DesignTop = 232 DesignTop = 145
object ObjectInspectorColorsGroupBox: TGroupBox[0] object ObjectInspectorColorsGroupBox: TGroupBox[0]
AnchorSideLeft.Control = Owner AnchorSideLeft.Control = Owner
AnchorSideTop.Control = Owner AnchorSideTop.Control = Owner

View File

@ -3,59 +3,59 @@
LazarusResources.Add('TOIOptionsFrame','FORMDATA',[ LazarusResources.Add('TOIOptionsFrame','FORMDATA',[
'TPF0'#241#15'TOIOptionsFrame'#14'OIOptionsFrame'#6'Height'#3#139#1#5'Width'#3 'TPF0'#241#15'TOIOptionsFrame'#14'OIOptionsFrame'#6'Height'#3#139#1#5'Width'#3
+'V'#2#12'ClientHeight'#3#139#1#11'ClientWidth'#3'V'#2#7'Visible'#8#10'Design' +'V'#2#12'ClientHeight'#3#139#1#11'ClientWidth'#3'V'#2#7'Visible'#8#10'Design'
+'Left'#3#176#0#9'DesignTop'#3#232#0#0#242#2#0#9'TGroupBox'#29'ObjectInspecto' +'Left'#2'n'#9'DesignTop'#3#145#0#0#242#2#0#9'TGroupBox'#29'ObjectInspectorCo'
+'rColorsGroupBox'#22'AnchorSideLeft.Control'#7#5'Owner'#21'AnchorSideTop.Con' +'lorsGroupBox'#22'AnchorSideLeft.Control'#7#5'Owner'#21'AnchorSideTop.Contro'
+'trol'#7#5'Owner'#23'AnchorSideRight.Control'#7#5'Owner'#20'AnchorSideRight.' +'l'#7#5'Owner'#23'AnchorSideRight.Control'#7#5'Owner'#20'AnchorSideRight.Sid'
+'Side'#7#9'asrBottom'#6'Height'#3#186#0#5'Width'#3'V'#2#7'Anchors'#11#5'akTo' +'e'#7#9'asrBottom'#6'Height'#3#186#0#5'Width'#3'V'#2#7'Anchors'#11#5'akTop'#6
+'p'#6'akLeft'#7'akRight'#0#8'AutoSize'#9#7'Caption'#6#29'ObjectInspectorColo' +'akLeft'#7'akRight'#0#8'AutoSize'#9#7'Caption'#6#29'ObjectInspectorColorsGro'
+'rsGroupBox'#28'ChildSizing.LeftRightSpacing'#2#6#28'ChildSizing.TopBottomSp' +'upBox'#28'ChildSizing.LeftRightSpacing'#2#6#28'ChildSizing.TopBottomSpacing'
+'acing'#2#6#29'ChildSizing.HorizontalSpacing'#2#2#27'ChildSizing.VerticalSpa' +#2#6#29'ChildSizing.HorizontalSpacing'#2#2#27'ChildSizing.VerticalSpacing'#2
+'cing'#2#2#12'ClientHeight'#3#168#0#11'ClientWidth'#3'R'#2#8'TabOrder'#2#0#0 +#2#12'ClientHeight'#3#168#0#11'ClientWidth'#3'R'#2#8'TabOrder'#2#0#0#13'TCol'
+#13'TColorListBox'#13'ColorsListBox'#22'AnchorSideLeft.Control'#7#29'ObjectI' +'orListBox'#13'ColorsListBox'#22'AnchorSideLeft.Control'#7#29'ObjectInspecto'
+'nspectorColorsGroupBox'#21'AnchorSideTop.Control'#7#29'ObjectInspectorColor' +'rColorsGroupBox'#21'AnchorSideTop.Control'#7#29'ObjectInspectorColorsGroupB'
+'sGroupBox'#4'Left'#2#6#6'Height'#3#128#0#3'Top'#2#6#5'Width'#3#210#0#5'Styl' +'ox'#4'Left'#2#6#6'Height'#3#128#0#3'Top'#2#6#5'Width'#3#210#0#5'Style'#11#14
+'e'#11#14'cbCustomColors'#0#11'OnGetColors'#7#22'ColorsListBoxGetColors'#20 +'cbCustomColors'#0#11'OnGetColors'#7#22'ColorsListBoxGetColors'#20'BorderSpa'
+'BorderSpacing.Around'#2#6#17'OnSelectionChange'#7#28'ColorsListBoxSelection' +'cing.Around'#2#6#17'OnSelectionChange'#7#28'ColorsListBoxSelectionChange'#8
+'Change'#8'TabOrder'#2#0#0#0#9'TColorBox'#8'ColorBox'#22'AnchorSideLeft.Cont' +'TabOrder'#2#0#0#0#9'TColorBox'#8'ColorBox'#22'AnchorSideLeft.Control'#7#29
+'rol'#7#29'ObjectInspectorColorsGroupBox'#21'AnchorSideTop.Control'#7#13'Col' +'ObjectInspectorColorsGroupBox'#21'AnchorSideTop.Control'#7#13'ColorsListBox'
+'orsListBox'#18'AnchorSideTop.Side'#7#9'asrBottom'#23'AnchorSideRight.Contro' +#18'AnchorSideTop.Side'#7#9'asrBottom'#23'AnchorSideRight.Control'#7#13'Colo'
+'l'#7#13'ColorsListBox'#20'AnchorSideRight.Side'#7#9'asrBottom'#4'Left'#2#6#6 +'rsListBox'#20'AnchorSideRight.Side'#7#9'asrBottom'#4'Left'#2#6#6'Height'#2
+'Height'#2#22#3'Top'#3#140#0#5'Width'#3#210#0#5'Style'#11#16'cbStandardColor' +#22#3'Top'#3#140#0#5'Width'#3#210#0#5'Style'#11#16'cbStandardColors'#16'cbEx'
+'s'#16'cbExtendedColors'#14'cbSystemColors'#13'cbCustomColor'#13'cbPrettyNam' +'tendedColors'#14'cbSystemColors'#13'cbCustomColor'#13'cbPrettyNames'#0#20'B'
+'es'#0#20'BorderSpacing.Around'#2#6#10'ItemHeight'#2#16#8'OnChange'#7#14'Col' +'orderSpacing.Around'#2#6#10'ItemHeight'#2#16#8'OnChange'#7#14'ColorBoxChang'
+'orBoxChange'#8'TabOrder'#2#1#0#0#0#242#2#1#9'TGroupBox'#14'OIMiscGroupBox' +'e'#8'TabOrder'#2#1#0#0#0#242#2#1#9'TGroupBox'#14'OIMiscGroupBox'#22'AnchorS'
+#22'AnchorSideLeft.Control'#7#5'Owner'#21'AnchorSideTop.Control'#7#29'Object' +'ideLeft.Control'#7#5'Owner'#21'AnchorSideTop.Control'#7#29'ObjectInspectorC'
+'InspectorColorsGroupBox'#18'AnchorSideTop.Side'#7#9'asrBottom'#23'AnchorSid' +'olorsGroupBox'#18'AnchorSideTop.Side'#7#9'asrBottom'#23'AnchorSideRight.Con'
+'eRight.Control'#7#5'Owner'#20'AnchorSideRight.Side'#7#9'asrBottom'#6'Height' +'trol'#7#5'Owner'#20'AnchorSideRight.Side'#7#9'asrBottom'#6'Height'#3#184#0#3
+#3#184#0#3'Top'#3#193#0#5'Width'#3'V'#2#7'Anchors'#11#5'akTop'#6'akLeft'#7'a' +'Top'#3#193#0#5'Width'#3'V'#2#7'Anchors'#11#5'akTop'#6'akLeft'#7'akRight'#0
+'kRight'#0#17'BorderSpacing.Top'#2#7#7'Caption'#6#14'OIMiscGroupBox'#12'Clie' +#17'BorderSpacing.Top'#2#7#7'Caption'#6#14'OIMiscGroupBox'#12'ClientHeight'#3
+'ntHeight'#3#166#0#11'ClientWidth'#3'R'#2#8'TabOrder'#2#1#0#6'TLabel'#24'OID' +#166#0#11'ClientWidth'#3'R'#2#8'TabOrder'#2#1#0#6'TLabel'#24'OIDefaultItemHe'
+'efaultItemHeightLabel'#22'AnchorSideLeft.Control'#7#14'OIMiscGroupBox'#21'A' +'ightLabel'#22'AnchorSideLeft.Control'#7#14'OIMiscGroupBox'#21'AnchorSideTop'
+'nchorSideTop.Control'#7#23'OIDrawGridLinesCheckBox'#18'AnchorSideTop.Side'#7 +'.Control'#7#23'OIDrawGridLinesCheckBox'#18'AnchorSideTop.Side'#7#9'asrBotto'
+#9'asrBottom'#4'Left'#2#6#6'Height'#2#14#3'Top'#2'j'#5'Width'#3#18#2#7'Ancho' +'m'#4'Left'#2#6#6'Height'#2#14#3'Top'#2'j'#5'Width'#3#18#2#7'Anchors'#11#5'a'
+'rs'#11#5'akTop'#6'akLeft'#7'akRight'#0#18'BorderSpacing.Left'#2#6#17'Border' +'kTop'#6'akLeft'#7'akRight'#0#18'BorderSpacing.Left'#2#6#17'BorderSpacing.To'
+'Spacing.Top'#2#6#7'Caption'#6#24'OIDefaultItemHeightLabel'#11'ParentColor'#8 +'p'#2#6#7'Caption'#6#24'OIDefaultItemHeightLabel'#11'ParentColor'#8#0#0#9'TC'
+#0#0#9'TCheckBox'#18'OIShowHintCheckBox'#22'AnchorSideLeft.Control'#7#14'OIM' +'heckBox'#18'OIShowHintCheckBox'#22'AnchorSideLeft.Control'#7#14'OIMiscGroup'
+'iscGroupBox'#21'AnchorSideTop.Control'#7#14'OIMiscGroupBox'#4'Left'#2#6#6'H' +'Box'#21'AnchorSideTop.Control'#7#14'OIMiscGroupBox'#4'Left'#2#6#6'Height'#2
+'eight'#2#19#3'Top'#2#6#5'Width'#3#130#0#18'BorderSpacing.Left'#2#6#17'Borde' +#19#3'Top'#2#6#5'Width'#3#130#0#18'BorderSpacing.Left'#2#6#17'BorderSpacing.'
+'rSpacing.Top'#2#6#7'Caption'#6#18'OIShowHintCheckBox'#8'TabOrder'#2#0#0#0#9 +'Top'#2#6#7'Caption'#6#18'OIShowHintCheckBox'#8'TabOrder'#2#0#0#0#9'TSpinEdi'
+'TSpinEdit'#27'OIDefaultItemHeightSpinEdit'#22'AnchorSideLeft.Control'#7#14 +'t'#27'OIDefaultItemHeightSpinEdit'#22'AnchorSideLeft.Control'#7#14'OIMiscGr'
+'OIMiscGroupBox'#21'AnchorSideTop.Control'#7#24'OIDefaultItemHeightLabel'#18 +'oupBox'#21'AnchorSideTop.Control'#7#24'OIDefaultItemHeightLabel'#18'AnchorS'
+'AnchorSideTop.Side'#7#9'asrBottom'#4'Left'#2#6#6'Height'#2#25#3'Top'#2'~'#5 +'ideTop.Side'#7#9'asrBottom'#4'Left'#2#6#6'Height'#2#25#3'Top'#2'~'#5'Width'
+'Width'#2'E'#18'BorderSpacing.Left'#2#6#17'BorderSpacing.Top'#2#6#8'TabOrder' +#2'E'#18'BorderSpacing.Left'#2#6#17'BorderSpacing.Top'#2#6#8'TabOrder'#2#1#5
+#2#1#5'Value'#2#1#0#0#9'TCheckBox'#18'OIAutoShowCheckBox'#22'AnchorSideLeft.' +'Value'#2#1#0#0#9'TCheckBox'#18'OIAutoShowCheckBox'#22'AnchorSideLeft.Contro'
+'Control'#7#14'OIMiscGroupBox'#21'AnchorSideTop.Control'#7#18'OIShowHintChec' +'l'#7#14'OIMiscGroupBox'#21'AnchorSideTop.Control'#7#18'OIShowHintCheckBox'
+'kBox'#18'AnchorSideTop.Side'#7#9'asrBottom'#4'Left'#2#6#6'Height'#2#19#3'To' +#18'AnchorSideTop.Side'#7#9'asrBottom'#4'Left'#2#6#6'Height'#2#19#3'Top'#2#31
+'p'#2#31#5'Width'#3#134#0#18'BorderSpacing.Left'#2#6#17'BorderSpacing.Top'#2 +#5'Width'#3#134#0#18'BorderSpacing.Left'#2#6#17'BorderSpacing.Top'#2#6#7'Cap'
+#6#7'Caption'#6#18'OIAutoShowCheckBox'#8'TabOrder'#2#2#0#0#9'TCheckBox'#24'O' +'tion'#6#18'OIAutoShowCheckBox'#8'TabOrder'#2#2#0#0#9'TCheckBox'#24'OIBoldNo'
+'IBoldNonDefaultCheckBox'#22'AnchorSideLeft.Control'#7#14'OIMiscGroupBox'#21 +'nDefaultCheckBox'#22'AnchorSideLeft.Control'#7#14'OIMiscGroupBox'#21'Anchor'
+'AnchorSideTop.Control'#7#18'OIAutoShowCheckBox'#18'AnchorSideTop.Side'#7#9 +'SideTop.Control'#7#18'OIAutoShowCheckBox'#18'AnchorSideTop.Side'#7#9'asrBot'
+'asrBottom'#4'Left'#2#6#6'Height'#2#19#3'Top'#2'8'#5'Width'#3#159#0#18'Borde' +'tom'#4'Left'#2#6#6'Height'#2#19#3'Top'#2'8'#5'Width'#3#159#0#18'BorderSpaci'
+'rSpacing.Left'#2#6#17'BorderSpacing.Top'#2#6#7'Caption'#6#24'OIBoldNonDefau' +'ng.Left'#2#6#17'BorderSpacing.Top'#2#6#7'Caption'#6#24'OIBoldNonDefaultChec'
+'ltCheckBox'#8'TabOrder'#2#3#0#0#9'TCheckBox'#23'OIDrawGridLinesCheckBox'#22 +'kBox'#8'TabOrder'#2#3#0#0#9'TCheckBox'#23'OIDrawGridLinesCheckBox'#22'Ancho'
+'AnchorSideLeft.Control'#7#14'OIMiscGroupBox'#21'AnchorSideTop.Control'#7#24 +'rSideLeft.Control'#7#14'OIMiscGroupBox'#21'AnchorSideTop.Control'#7#24'OIBo'
+'OIBoldNonDefaultCheckBox'#18'AnchorSideTop.Side'#7#9'asrBottom'#4'Left'#2#6 +'ldNonDefaultCheckBox'#18'AnchorSideTop.Side'#7#9'asrBottom'#4'Left'#2#6#6'H'
+#6'Height'#2#19#3'Top'#2'Q'#5'Width'#3#153#0#18'BorderSpacing.Left'#2#6#17'B' +'eight'#2#19#3'Top'#2'Q'#5'Width'#3#153#0#18'BorderSpacing.Left'#2#6#17'Bord'
+'orderSpacing.Top'#2#6#7'Caption'#6#23'OIDrawGridLinesCheckBox'#8'TabOrder'#2 +'erSpacing.Top'#2#6#7'Caption'#6#23'OIDrawGridLinesCheckBox'#8'TabOrder'#2#4
+#4#0#0#0#0 +#0#0#0#0
]); ]);

View File

@ -81,13 +81,15 @@ begin
OIBoldNonDefaultCheckBox.Caption := lisBoldNonDefaultObjectInspector; OIBoldNonDefaultCheckBox.Caption := lisBoldNonDefaultObjectInspector;
OIDrawGridLinesCheckBox.Caption := lisDrawGridLinesObjectInspector; OIDrawGridLinesCheckBox.Caption := lisDrawGridLinesObjectInspector;
SetLength(FStoredColors, 6); SetLength(FStoredColors, 8);
FStoredColors[0].ColorName := dlgBackColor; FStoredColors[0].ColorName := dlgBackColor;
FStoredColors[1].ColorName := dlgSubPropColor; FStoredColors[1].ColorName := dlgSubPropColor;
FStoredColors[2].ColorName := dlgReferenceColor; FStoredColors[2].ColorName := dlgReferenceColor;
FStoredColors[3].ColorName := dlgValueColor; FStoredColors[3].ColorName := dlgHighlightColor;
FStoredColors[4].ColorName := dlgDefValueColor; FStoredColors[4].ColorName := dlgHighlightFontColor;
FStoredColors[5].ColorName := dlgPropNameColor; FStoredColors[5].ColorName := dlgValueColor;
FStoredColors[6].ColorName := dlgDefValueColor;
FStoredColors[7].ColorName := dlgPropNameColor;
FLoaded := False; FLoaded := False;
end; end;
@ -129,9 +131,11 @@ begin
FStoredColors[0].ColorValue := ObjectInspectorOptions.GridBackgroundColor; FStoredColors[0].ColorValue := ObjectInspectorOptions.GridBackgroundColor;
FStoredColors[1].ColorValue := ObjectInspectorOptions.SubPropertiesColor; FStoredColors[1].ColorValue := ObjectInspectorOptions.SubPropertiesColor;
FStoredColors[2].ColorValue := ObjectInspectorOptions.ReferencesColor; FStoredColors[2].ColorValue := ObjectInspectorOptions.ReferencesColor;
FStoredColors[3].ColorValue := ObjectInspectorOptions.ValueColor; FStoredColors[3].ColorValue := ObjectInspectorOptions.HighlightColor;
FStoredColors[4].ColorValue := ObjectInspectorOptions.DefaultValueColor; FStoredColors[4].ColorValue := ObjectInspectorOptions.HighlightFontColor;
FStoredColors[5].ColorValue := ObjectInspectorOptions.PropertyNameColor; FStoredColors[5].ColorValue := ObjectInspectorOptions.ValueColor;
FStoredColors[6].ColorValue := ObjectInspectorOptions.DefaultValueColor;
FStoredColors[7].ColorValue := ObjectInspectorOptions.PropertyNameColor;
OIDefaultItemHeightSpinEdit.Value:=ObjectInspectorOptions.DefaultItemHeight; OIDefaultItemHeightSpinEdit.Value:=ObjectInspectorOptions.DefaultItemHeight;
OIShowHintCheckBox.Checked := ObjectInspectorOptions.ShowHints; OIShowHintCheckBox.Checked := ObjectInspectorOptions.ShowHints;
@ -150,9 +154,11 @@ begin
ObjectInspectorOptions.GridBackgroundColor := ColorsListBox.Colors[0]; ObjectInspectorOptions.GridBackgroundColor := ColorsListBox.Colors[0];
ObjectInspectorOptions.SubPropertiesColor := ColorsListBox.Colors[1]; ObjectInspectorOptions.SubPropertiesColor := ColorsListBox.Colors[1];
ObjectInspectorOptions.ReferencesColor := ColorsListBox.Colors[2]; ObjectInspectorOptions.ReferencesColor := ColorsListBox.Colors[2];
ObjectInspectorOptions.ValueColor := ColorsListBox.Colors[3]; ObjectInspectorOptions.HighlightColor := ColorsListBox.Colors[3];
ObjectInspectorOptions.DefaultValueColor := ColorsListBox.Colors[4]; ObjectInspectorOptions.HighlightFontColor := ColorsListBox.Colors[4];
ObjectInspectorOptions.PropertyNameColor := ColorsListBox.Colors[5]; ObjectInspectorOptions.ValueColor := ColorsListBox.Colors[5];
ObjectInspectorOptions.DefaultValueColor := ColorsListBox.Colors[6];
ObjectInspectorOptions.PropertyNameColor := ColorsListBox.Colors[7];
ObjectInspectorOptions.DefaultItemHeight:= ObjectInspectorOptions.DefaultItemHeight:=
RoundToInt(OIDefaultItemHeightSpinEdit.Value); RoundToInt(OIDefaultItemHeightSpinEdit.Value);

View File

@ -1019,6 +1019,8 @@ resourcestring
dlgSubPropColor = 'SubProperties'; dlgSubPropColor = 'SubProperties';
dlgReferenceColor = 'Reference'; dlgReferenceColor = 'Reference';
dlgValueColor = 'Value'; dlgValueColor = 'Value';
dlgHighlightColor = 'Highlight';
dlgHighlightFontColor = 'Highlight Font';
liswlAdd = '&Add'; liswlAdd = '&Add';
liswlProperties = '&Properties'; liswlProperties = '&Properties';
liswlEnabled = '&Enabled'; liswlEnabled = '&Enabled';

View File

@ -170,6 +170,9 @@ type
FValueColor: TColor; FValueColor: TColor;
FReferencesColor: TColor; FReferencesColor: TColor;
FGridBackgroundColor: TColor; FGridBackgroundColor: TColor;
FHighlightColor: TColor;
FHighlightFontColor: TColor;
FShowHints: boolean; FShowHints: boolean;
FAutoShow: Boolean; FAutoShow: Boolean;
FBoldNonDefaultValues: Boolean; FBoldNonDefaultValues: Boolean;
@ -200,18 +203,15 @@ type
property ComponentTreeHeight: integer read FComponentTreeHeight property ComponentTreeHeight: integer read FComponentTreeHeight
write FComponentTreeHeight; write FComponentTreeHeight;
property GridBackgroundColor: TColor read FGridBackgroundColor property GridBackgroundColor: TColor read FGridBackgroundColor write FGridBackgroundColor;
write FGridBackgroundColor; property SubPropertiesColor: TColor read FSubPropertiesColor write FSubPropertiesColor;
property SubPropertiesColor: TColor read FSubPropertiesColor property ReferencesColor: TColor read FReferencesColor write FReferencesColor;
write FSubPropertiesColor; property ValueColor: TColor read FValueColor write FValueColor;
property ReferencesColor: TColor read FReferencesColor property DefaultValueColor: TColor read FDefaultValueColor write FDefaultValueColor;
write FReferencesColor; property PropertyNameColor: TColor read FPropertyNameColor write FPropertyNameColor;
property ValueColor: TColor read FValueColor property HighlightColor: TColor read FHighlightColor write FHighlightColor;
write FValueColor; property HighlightFontColor: TColor read FHighlightFontColor write FHighlightFontColor;
property DefaultValueColor: TColor read FDefaultValueColor
write FDefaultValueColor;
property PropertyNameColor: TColor read FPropertyNameColor
write FPropertyNameColor;
property ShowHints: boolean read FShowHints property ShowHints: boolean read FShowHints
write FShowHints; write FShowHints;
property AutoShow: boolean read FAutoShow write FAutoShow; property AutoShow: boolean read FAutoShow write FAutoShow;
@ -306,6 +306,7 @@ type
private private
FBackgroundColor: TColor; FBackgroundColor: TColor;
FColumn: TOICustomPropertyGridColumn; FColumn: TOICustomPropertyGridColumn;
FHighlightColor: TColor;
FLayout: TOILayout; FLayout: TOILayout;
FOnOIKeyDown: TKeyEvent; FOnOIKeyDown: TKeyEvent;
FReferencesColor: TColor; FReferencesColor: TColor;
@ -323,7 +324,7 @@ type
FFilter: TTypeKinds; FFilter: TTypeKinds;
FIndent: integer; FIndent: integer;
FItemIndex: integer; FItemIndex: integer;
FNameFont, FDefaultValueFont, FValueFont: TFont; FNameFont, FDefaultValueFont, FValueFont, FHighlightFont: TFont;
FNewComboBoxItems: TStringList; FNewComboBoxItems: TStringList;
FOnModified: TNotifyEvent; FOnModified: TNotifyEvent;
FPreferredSplitterX: integer; // best splitter position FPreferredSplitterX: integer; // best splitter position
@ -352,8 +353,10 @@ type
function GetCurrentEditValue: string; function GetCurrentEditValue: string;
procedure SetColumn(const AValue: TOICustomPropertyGridColumn); procedure SetColumn(const AValue: TOICustomPropertyGridColumn);
procedure SetCurrentEditValue(const NewValue: string); procedure SetCurrentEditValue(const NewValue: string);
procedure SetDrawHorzGridLines(const AValue: Boolean);
procedure SetFavourites(const AValue: TOIFavouriteProperties); procedure SetFavourites(const AValue: TOIFavouriteProperties);
procedure SetFilter(const AValue: TTypeKinds); procedure SetFilter(const AValue: TTypeKinds);
procedure SetHighlightColor(const AValue: TColor);
procedure SetItemIndex(NewIndex:integer); procedure SetItemIndex(NewIndex:integer);
function GetNameRowHeight: Integer; // temp solution untill TFont.height returns its actual value function GetNameRowHeight: Integer; // temp solution untill TFont.height returns its actual value
@ -365,11 +368,11 @@ type
procedure SetSplitterX(const NewValue:integer); procedure SetSplitterX(const NewValue:integer);
procedure SetTopY(const NewValue:integer); procedure SetTopY(const NewValue:integer);
function GetPropNameColor(ARow:TOIPropertyGridRow):TColor; function GetPropNameColor(ARow: TOIPropertyGridRow):TColor;
function GetTreeIconX(Index:integer):integer; function GetTreeIconX(Index: integer):integer;
function RowRect(ARow:integer):TRect; function RowRect(ARow: integer):TRect;
procedure PaintRow(ARow:integer); procedure PaintRow(ARow: integer);
procedure DoPaint(PaintOnlyChangedValues:boolean); procedure DoPaint(PaintOnlyChangedValues: boolean);
procedure SetSelection(const ASelection:TPersistentSelectionList); procedure SetSelection(const ASelection:TPersistentSelectionList);
procedure SetPropertyEditorHook(NewPropertyEditorHook:TPropertyEditorHook); procedure SetPropertyEditorHook(NewPropertyEditorHook:TPropertyEditorHook);
@ -476,24 +479,29 @@ type
public public
property BackgroundColor: TColor read FBackgroundColor property BackgroundColor: TColor read FBackgroundColor
write SetBackgroundColor default clBtnFace; write SetBackgroundColor default clBtnFace;
property HighlightColor: TColor read FHighlightColor write SetHighlightColor default clHighlight;
property ReferencesColor: TColor read FReferencesColor property ReferencesColor: TColor read FReferencesColor
write SetReferences default clMaroon; write SetReferences default clMaroon;
property SubPropertiesColor: TColor read FSubPropertiesColor property SubPropertiesColor: TColor read FSubPropertiesColor
write SetSubPropertiesColor default clGreen; write SetSubPropertiesColor default clGreen;
property NameFont: TFont read FNameFont write FNameFont;
property DefaultValueFont: TFont read FDefaultValueFont write FDefaultValueFont;
property ValueFont: TFont read FValueFont write FValueFont;
property HighlightFont: TFont read FHighlightFont write FHighlightFont;
property BorderStyle default bsSingle; property BorderStyle default bsSingle;
property Column: TOICustomPropertyGridColumn read FColumn write SetColumn; property Column: TOICustomPropertyGridColumn read FColumn write SetColumn;
property CurrentEditValue: string read GetCurrentEditValue property CurrentEditValue: string read GetCurrentEditValue
write SetCurrentEditValue; write SetCurrentEditValue;
property DefaultItemHeight:integer read FDefaultItemHeight property DefaultItemHeight:integer read FDefaultItemHeight
write FDefaultItemHeight default 25; write FDefaultItemHeight default 25;
property DefaultValueFont: TFont read FDefaultValueFont write FDefaultValueFont; property DrawHorzGridLines: Boolean read FDrawHorzGridLines write
property DrawHorzGridLines: Boolean read FDrawHorzGridLines write FDrawHorzGridLines; SetDrawHorzGridLines default True;
property ExpandedProperties: TStringList read FExpandedProperties property ExpandedProperties: TStringList read FExpandedProperties
write FExpandedProperties; write FExpandedProperties;
property Indent: integer read FIndent write FIndent default 9; property Indent: integer read FIndent write FIndent default 9;
property ItemIndex: integer read FItemIndex write SetItemIndex; property ItemIndex: integer read FItemIndex write SetItemIndex;
property Layout: TOILayout read FLayout write FLayout default oilHorizontal; property Layout: TOILayout read FLayout write FLayout default oilHorizontal;
property NameFont: TFont read FNameFont write FNameFont;
property OnModified: TNotifyEvent read FOnModified write FOnModified; property OnModified: TNotifyEvent read FOnModified write FOnModified;
property OnOIKeyDown: TKeyEvent read FOnOIKeyDown write FOnOIKeyDown; property OnOIKeyDown: TKeyEvent read FOnOIKeyDown write FOnOIKeyDown;
property PrefferedSplitterX: integer read FPreferredSplitterX property PrefferedSplitterX: integer read FPreferredSplitterX
@ -507,7 +515,6 @@ type
write SetSelection; write SetSelection;
property SplitterX: integer read FSplitterX write SetSplitterX default 100; property SplitterX: integer read FSplitterX write SetSplitterX default 100;
property TopY: integer read FTopY write SetTopY default 0; property TopY: integer read FTopY write SetTopY default 0;
property ValueFont: TFont read FValueFont write FValueFont;
property Favourites: TOIFavouriteProperties read FFavourites property Favourites: TOIFavouriteProperties read FFavourites
write SetFavourites; write SetFavourites;
property Filter : TTypeKinds read FFilter write SetFilter; property Filter : TTypeKinds read FFilter write SetFilter;
@ -817,15 +824,21 @@ begin
FSplitterX:=100; FSplitterX:=100;
FPreferredSplitterX:=FSplitterX; FPreferredSplitterX:=FSplitterX;
FIndent:=9; FIndent:=9;
FBackgroundColor:=clBtnFace; FBackgroundColor:=clBtnFace;
FReferencesColor:=clMaroon; FReferencesColor:=clMaroon;
FSubPropertiesColor:=clGreen; FSubPropertiesColor:=clGreen;
FHighlightColor:=clHighlight;
FNameFont:=TFont.Create; FNameFont:=TFont.Create;
FNameFont.Color:=clWindowText; FNameFont.Color:=clWindowText;
FValueFont:=TFont.Create; FValueFont:=TFont.Create;
FValueFont.Color:=clMaroon; FValueFont.Color:=clMaroon;
FDefaultValueFont:=TFont.Create; FDefaultValueFont:=TFont.Create;
FDefaultValueFont.Color:=clWindowText; FDefaultValueFont.Color:=clWindowText;
FHighlightFont:=TFont.Create;
FHighlightFont.Color:=clHighlightText;
FDrawHorzGridLines := True; FDrawHorzGridLines := True;
SetInitialBounds(0,0,200,130); SetInitialBounds(0,0,200,130);
@ -1051,6 +1064,7 @@ begin
FreeAndNil(FValueFont); FreeAndNil(FValueFont);
FreeAndNil(FDefaultValueFont); FreeAndNil(FDefaultValueFont);
FreeAndNil(FNameFont); FreeAndNil(FNameFont);
FreeAndNil(FHighlightFont);
FreeAndNil(FExpandedProperties); FreeAndNil(FExpandedProperties);
FreeAndNil(FHintTimer); FreeAndNil(FHintTimer);
FreeAndNil(FHintWindow); FreeAndNil(FHintWindow);
@ -1441,8 +1455,9 @@ begin
end; end;
procedure TOICustomPropertyGrid.SetItemIndex(NewIndex:integer); procedure TOICustomPropertyGrid.SetItemIndex(NewIndex:integer);
var NewRow:TOIPropertyGridRow; var
NewValue:string; NewRow: TOIPropertyGridRow;
NewValue: string;
EditorAttributes: TPropertyAttributes; EditorAttributes: TPropertyAttributes;
begin begin
if GridIsUpdating or (FItemIndex=NewIndex) then if GridIsUpdating or (FItemIndex=NewIndex) then
@ -2212,7 +2227,9 @@ begin
ParentRow:=ParentRow.Parent; ParentRow:=ParentRow.Parent;
end; end;
if IsObjectSubProperty then if (ItemIndex <> -1) and (Rows[ItemIndex] = ARow) then
Result := FHighlightFont.Color
else if IsObjectSubProperty then
Result := FSubPropertiesColor Result := FSubPropertiesColor
else if ARow.Editor is TPersistentPropertyEditor then else if ARow.Editor is TPersistentPropertyEditor then
Result := FReferencesColor Result := FReferencesColor
@ -2311,15 +2328,16 @@ begin
end; end;
end; end;
procedure TOICustomPropertyGrid.PaintRow(ARow:integer); procedure TOICustomPropertyGrid.PaintRow(ARow: integer);
var var
FullRect,NameRect,NameIconRect,NameTextRect,ValueRect:TRect; FullRect,NameRect,NameIconRect,NameTextRect,ValueRect, ParentRect:TRect;
IconX,IconY:integer; IconX,IconY:integer;
CurRow:TOIPropertyGridRow; CurRow:TOIPropertyGridRow;
DrawState:TPropEditDrawState; DrawState:TPropEditDrawState;
OldFont:TFont; OldFont:TFont;
Platform: TLCLPlatform; Platform: TLCLPlatform;
X, Y: Integer; X, Y: Integer;
NameBgColor: TColor;
procedure DrawTreeIcon(X, Y: Integer; Minus: Boolean); procedure DrawTreeIcon(X, Y: Integer; Minus: Boolean);
const const
@ -2367,21 +2385,31 @@ begin
IconX:=GetTreeIconX(ARow); IconX:=GetTreeIconX(ARow);
IconY:=((NameRect.Bottom-NameRect.Top-9) div 2)+NameRect.Top; IconY:=((NameRect.Bottom-NameRect.Top-9) div 2)+NameRect.Top;
NameIconRect:=NameRect; NameIconRect := NameRect;
NameIconRect.Right:=IconX+Indent; NameIconRect.Right := IconX + Indent;
NameTextRect:=NameRect; NameTextRect := NameRect;
NameTextRect.Left:=NameIconRect.Right; NameTextRect.Left := NameIconRect.Right;
if Layout = oilVertical if Layout = oilVertical then
then ValueRect.Left := NameTextRect.Left; ValueRect.Left := NameTextRect.Left
else
inc(NameTextRect.Left, 4);
DrawState:=[]; DrawState:=[];
if ARow=FItemIndex then Include(DrawState,pedsSelected); if ARow = FItemIndex then
Include(DrawState, pedsSelected);
with Canvas do with Canvas do
begin begin
// clear background in one go // clear background in one go
if FBackgroundColor <> clNone
then begin if (ARow = ItemIndex) and (FHighlightColor <> clNone) then
NameBgColor := FHighlightColor
else
NameBgColor := FBackgroundColor;
if FBackgroundColor <> clNone then
begin
Brush.Color := FBackgroundColor; Brush.Color := FBackgroundColor;
FillRect(FullRect); FillRect(FullRect);
end; end;
@ -2394,8 +2422,17 @@ begin
OldFont:=Font; OldFont:=Font;
Font:=FNameFont; Font:=FNameFont;
Font.Color := GetPropNameColor(CurRow); Font.Color := GetPropNameColor(CurRow);
CurRow.Editor.PropDrawName(Canvas,NameTextRect,DrawState); // set bg color to highlight if needed
Font:=OldFont; if (NameBgColor <> FBackgroundColor) and (NameBgColor <> clNone) then
begin
Brush.Color := NameBgColor;
FillRect(NameTextRect);
end;
CurRow.Editor.PropDrawName(Canvas, NameTextRect, DrawState);
Font := OldFont;
if (FBackgroundColor <> clNone) then // return color back to background
Brush.Color := FBackgroundColor;
// draw widgetsets // draw widgetsets
X := NameRect.Right - 2; X := NameRect.Right - 2;
@ -2432,50 +2469,64 @@ begin
// frames // frames
// ----------------- // -----------------
if Layout = oilHorizontal if Layout = oilHorizontal then
then begin begin
// Divider // Row Divider
if ARow = FItemIndex
then begin
Pen.Style := psSolid;
if FBackgroundColor <> clNone
then begin
Pen.Color := FBackgroundColor;
MoveTo(NameRect.Left,NameRect.Top-1);
LineTo(ValueRect.Right,NameRect.Top-1)
end;
//Top
Pen.Color:=cl3DShadow;
MoveTo(NameRect.Left,NameRect.Top-1);
LineTo(ValueRect.Right,NameRect.Top-1);
//Bottom
Pen.Color:=cl3DHiLight;
MoveTo(NameRect.Left,NameRect.Bottom-1);
LineTo(ValueRect.Right,NameRect.Bottom-1);
end
else
if DrawHorzGridLines then if DrawHorzGridLines then
begin begin
Pen.Style := psDot; Pen.Style := psDot;
Pen.Color:=cl3DShadow; Pen.EndCap := pecFlat;
Pen.Cosmetic := False;
Pen.Color := cl3DShadow;
if FRowSpacing <> 0 then if FRowSpacing <> 0 then
begin begin
MoveTo(NameRect.Left,NameRect.Top-1); MoveTo(NameTextRect.Left, NameRect.Top - 1);
LineTo(ValueRect.Right,NameRect.Top-1); LineTo(ValueRect.Right, NameRect.Top - 1);
end; end;
MoveTo(NameRect.Left,NameRect.Bottom-1); MoveTo(NameTextRect.Left, NameRect.Bottom - 1);
LineTo(ValueRect.Right,NameRect.Bottom-1); LineTo(ValueRect.Right, NameRect.Bottom - 1);
end; end;
// Splitter // Split lines between: icon and name, name and value
Pen.Style := psSolid; Pen.Style := psSolid;
Pen.Color:=cl3DHiLight; Pen.Cosmetic := True;
MoveTo(NameRect.Right-1,NameRect.Bottom-1); Pen.Color := cl3DHiLight;
LineTo(NameRect.Right-1,NameRect.Top-1-FRowSpacing); MoveTo(NameTextRect.Left - 1, NameRect.Bottom - 1);
Pen.Color:=cl3DShadow; LineTo(NameTextRect.Left - 1, NameRect.Top - 1 - FRowSpacing);
MoveTo(NameRect.Right-2,NameRect.Bottom-1); MoveTo(NameRect.Right - 1, NameRect.Bottom - 1);
LineTo(NameRect.Right-2,NameRect.Top-1-FRowSpacing); LineTo(NameRect.Right - 1, NameRect.Top - 1 - FRowSpacing);
Pen.Color := cl3DShadow;
MoveTo(NameTextRect.Left - 2, NameRect.Bottom - 1);
LineTo(NameTextRect.Left - 2, NameRect.Top - 1 - FRowSpacing);
MoveTo(NameRect.Right - 2, NameRect.Bottom - 1);
LineTo(NameRect.Right - 2, NameRect.Top - 1 - FRowSpacing);
if CurRow.Lvl > 0 then
begin
// draw to parent
if ARow > 0 then
begin
ParentRect := RowRect(ARow - 1);
X := ParentRect.Left + GetTreeIconX(ARow - 1) + Indent + 2;
if X <> NameTextRect.Left - 2 then
begin
MoveTo(NameTextRect.Left - 2, NameRect.Top - 1 - FRowSpacing);
LineTo(X, NameRect.Top - 1 - FRowSpacing);
end;
end;
// to to parent next sibling
if ARow < FRows.Count - 1 then
begin
ParentRect := RowRect(ARow + 1);
X := ParentRect.Left + GetTreeIconX(ARow + 1) + Indent + 2;
if X <> NameTextRect.Left - 2 then
begin
MoveTo(NameTextRect.Left - 2, NameRect.Bottom - 1);
LineTo(X, NameRect.Bottom - 1);
end;
end;
end;
end end
else begin else begin
Pen.Style := psSolid; Pen.Style := psSolid;
@ -2639,6 +2690,13 @@ begin
end; end;
end; end;
procedure TOICustomPropertyGrid.SetDrawHorzGridLines(const AValue: Boolean);
begin
if FDrawHorzGridLines = AValue then Exit;
FDrawHorzGridLines := AValue;
Invalidate;
end;
procedure TOICustomPropertyGrid.SetFavourites( procedure TOICustomPropertyGrid.SetFavourites(
const AValue: TOIFavouriteProperties); const AValue: TOIFavouriteProperties);
begin begin
@ -2650,11 +2708,18 @@ end;
procedure TOICustomPropertyGrid.SetFilter(const AValue: TTypeKinds); procedure TOICustomPropertyGrid.SetFilter(const AValue: TTypeKinds);
begin begin
If (AValue<>FFilter) then if (AValue<>FFilter) then
begin begin
FFilter:=AValue; FFilter:=AValue;
BuildPropertyList; BuildPropertyList;
end; end;
end;
procedure TOICustomPropertyGrid.SetHighlightColor(const AValue: TColor);
begin
if FHighlightColor=AValue then exit;
FHighlightColor:=AValue;
Invalidate;
end; end;
procedure TOICustomPropertyGrid.Clear; procedure TOICustomPropertyGrid.Clear;
@ -3219,12 +3284,15 @@ begin
FShowComponentTree:=true; FShowComponentTree:=true;
FComponentTreeHeight:=100; FComponentTreeHeight:=100;
FGridBackgroundColor:=clBtnFace; FGridBackgroundColor := clBtnFace;
FDefaultValueColor:=clWindowText; FDefaultValueColor := clWindowText;
FSubPropertiesColor:= clGreen; FSubPropertiesColor := clGreen;
FValueColor:=clMaroon; FValueColor := clMaroon;
FReferencesColor:= clMaroon; FReferencesColor := clMaroon;
FPropertyNameColor:=clWindowText; FPropertyNameColor := clWindowText;
FHighlightColor := clHighlight;
FHighlightFontColor := clHighlightText;
FBoldNonDefaultValues := True; FBoldNonDefaultValues := True;
FDrawGridLines := True; FDrawGridLines := True;
end; end;
@ -3283,7 +3351,10 @@ begin
Path+'Color/References',clMaroon); Path+'Color/References',clMaroon);
FPropertyNameColor:=ConfigStore.GetValue( FPropertyNameColor:=ConfigStore.GetValue(
Path+'Color/PropertyName',clWindowText); Path+'Color/PropertyName',clWindowText);
FHighlightColor:=ConfigStore.GetValue(
Path+'Color/Highlight',clHighlight);
FHighlightFontColor:=ConfigStore.GetValue(
Path+'Color/HighlightFont',clHighlightText);
FShowHints:=ConfigStore.GetValue( FShowHints:=ConfigStore.GetValue(
Path+'ShowHints',FileVersion>=3); Path+'ShowHints',FileVersion>=3);
@ -3347,6 +3418,10 @@ begin
FReferencesColor,clBackground); FReferencesColor,clBackground);
ConfigStore.SetDeleteValue(Path+'Color/PropertyName', ConfigStore.SetDeleteValue(Path+'Color/PropertyName',
FPropertyNameColor,clWindowText); FPropertyNameColor,clWindowText);
ConfigStore.SetDeleteValue(Path+'Color/Highlight',
FHighlightColor,clHighlight);
ConfigStore.SetDeleteValue(Path+'Color/HighlightFont',
FHighlightFontColor,clHighlightText);
ConfigStore.SetDeleteValue(Path+'ShowHints',FShowHints, ConfigStore.SetDeleteValue(Path+'ShowHints',FShowHints,
true); true);
@ -3383,6 +3458,8 @@ begin
FValueColor:=AnObjInspector.PropertyGrid.ValueFont.Color; FValueColor:=AnObjInspector.PropertyGrid.ValueFont.Color;
FDefaultValueColor:=AnObjInspector.PropertyGrid.DefaultValueFont.Color; FDefaultValueColor:=AnObjInspector.PropertyGrid.DefaultValueFont.Color;
FPropertyNameColor:=AnObjInspector.PropertyGrid.NameFont.Color; FPropertyNameColor:=AnObjInspector.PropertyGrid.NameFont.Color;
FHighlightColor:=AnObjInspector.PropertyGrid.HighlightColor;
FHighlightFontColor:=AnObjInspector.PropertyGrid.HighlightFont.Color;
FShowHints := AnObjInspector.PropertyGrid.ShowHint; FShowHints := AnObjInspector.PropertyGrid.ShowHint;
FAutoShow := AnObjInspector.AutoShow; FAutoShow := AnObjInspector.AutoShow;
@ -3417,6 +3494,8 @@ begin
Grid.ValueFont.Style := []; Grid.ValueFont.Style := [];
Grid.DefaultValueFont.Color := FDefaultValueColor; Grid.DefaultValueFont.Color := FDefaultValueColor;
Grid.NameFont.Color := FPropertyNameColor; Grid.NameFont.Color := FPropertyNameColor;
Grid.HighlightColor := FHighlightColor;
Grid.HighlightFont.Color := FHighlightFontColor;
Grid.ShowHint := FShowHints; Grid.ShowHint := FShowHints;
Grid.DrawHorzGridLines := FDrawGridLines; Grid.DrawHorzGridLines := FDrawGridLines;
end; end;