* patch from Luca Minuti

git-svn-id: trunk@7043 -
This commit is contained in:
marc 2005-03-30 22:51:26 +00:00
parent 28cf256e02
commit 3d07b12402
3 changed files with 203 additions and 103 deletions

View File

@ -471,6 +471,18 @@ type
ObjectInspectorColorsGroupBox: TGroupBox; ObjectInspectorColorsGroupBox: TGroupBox;
OIBackgroundColorLabel: TLabel; OIBackgroundColorLabel: TLabel;
OIBackgroundColorButton: TColorButton; OIBackgroundColorButton: TColorButton;
OISubPropsColorLabel: TLabel;
OISubPropsColorButton: TColorButton;
OIReferencesColorLabel: TLabel;
OIReferencesColorButton: TColorButton;
OIValueColorLabel: TLabel;
OIValueColorButton: TColorButton;
OIDefaultValueColorLabel: TLabel;
OIDefaultValueColorButton: TColorButton;
OIPropNameColorLabel: TLabel;
OIPropNameColorButton: TColorButton;
OIMiscGroupBox: TGroupBox; OIMiscGroupBox: TGroupBox;
OIDefaultItemHeightSpinEdit: TSpinEdit; OIDefaultItemHeightSpinEdit: TSpinEdit;
OIDefaultItemHeightLabel: TLabel; OIDefaultItemHeightLabel: TLabel;
@ -538,8 +550,6 @@ type
procedure GridGroupBoxResize(Sender: TObject); procedure GridGroupBoxResize(Sender: TObject);
procedure GuideLinesGroupBoxResize(Sender: TObject); procedure GuideLinesGroupBoxResize(Sender: TObject);
procedure LazarusDirGroupBoxResize(Sender: TObject); procedure LazarusDirGroupBoxResize(Sender: TObject);
procedure OIMiscGroupBoxResize(Sender: TObject);
procedure ObjectInspectorColorsGroupBoxResize(Sender: TObject);
procedure OkButtonClick(Sender: TObject); procedure OkButtonClick(Sender: TObject);
procedure CancelButtonClick(Sender: TObject); procedure CancelButtonClick(Sender: TObject);
procedure OnBackupPageResize(Sender: TObject); procedure OnBackupPageResize(Sender: TObject);
@ -566,6 +576,8 @@ type
FOldFPCSourceDir: string; FOldFPCSourceDir: string;
FOldMakeFilename: string; FOldMakeFilename: string;
FOldTestDir: string; FOldTestDir: string;
function CreateColorItem(ATop:Integer; AParent:TWinControl;ACaption:String):TColorButton;
procedure SetCategoryPage(const AValue: TEnvOptsDialogPage); procedure SetCategoryPage(const AValue: TEnvOptsDialogPage);
procedure SetupFilesPage(Page: integer); procedure SetupFilesPage(Page: integer);
procedure SetupDesktopPage(Page: integer); procedure SetupDesktopPage(Page: integer);
@ -2897,19 +2909,22 @@ begin
end; end;
procedure TEnvironmentOptionsDialog.ResizeObjectInspectorPage; procedure TEnvironmentOptionsDialog.ResizeObjectInspectorPage;
var
HalfWidth:integer;
begin begin
HalfWidth:=ClientWidth div 2;
// object inspector // object inspector
with ObjectInspectorColorsGroupBox do begin with ObjectInspectorColorsGroupBox do begin
Left:=6; Left:=5;
Top:=2; Top:=2;
Width:=200; Width:= HalfWidth-15;
Height:=55; Height:=180;
end; end;
with OIMiscGroupBox do begin with OIMiscGroupBox do begin
Left:=ObjectInspectorColorsGroupBox.Left; Left:=HalfWidth+5;
Top:=ObjectInspectorColorsGroupBox.Top+ObjectInspectorColorsGroupBox.Height+5; Top:=ObjectInspectorColorsGroupBox.Top;
Width:=200; Width:=HalfWidth-15;
Height:=77; Height:=77;
end; end;
end; end;
@ -3421,39 +3436,6 @@ begin
SetBounds(x+1,0,w-2-x-1,LazarusDirComboBox.Height); SetBounds(x+1,0,w-2-x-1,LazarusDirComboBox.Height);
end; end;
procedure TEnvironmentOptionsDialog.OIMiscGroupBoxResize(Sender: TObject);
begin
with OIDefaultItemHeightSpinEdit do begin
Left:=6;
Top:=4;
Width:=50;
end;
with OIDefaultItemHeightLabel do begin
Left:=OIDefaultItemHeightSpinEdit.Left+OIDefaultItemHeightSpinEdit.Width+5;
Top:=OIDefaultItemHeightSpinEdit.Top+2;
Width:=OIMiscGroupBox.ClientWidth-Left-5;
end;
end;
procedure TEnvironmentOptionsDialog.ObjectInspectorColorsGroupBoxResize(
Sender: TObject);
begin
with OIBackgroundColorButton do begin
Left:=6;
Top:=6;
Width:=50;
Height:=25;
end;
with OIBackgroundColorLabel do begin
Left:=OIBackgroundColorButton.Left+OIBackgroundColorButton.Width+5;
Top:=OIBackgroundColorButton.Top;
Width:=Max(ObjectInspectorColorsGroupBox.ClientWidth-Left-5,10);
Height:=23;
end;
end;
procedure TEnvironmentOptionsDialog.OkButtonClick(Sender: TObject); procedure TEnvironmentOptionsDialog.OkButtonClick(Sender: TObject);
begin begin
if not CheckValues then exit; if not CheckValues then exit;
@ -3612,6 +3594,17 @@ begin
// object inspector // object inspector
OIBackgroundColorButton.ButtonColor:= OIBackgroundColorButton.ButtonColor:=
ObjectInspectorOptions.GridBackgroundColor; ObjectInspectorOptions.GridBackgroundColor;
OISubPropsColorButton.ButtonColor:=
ObjectInspectorOptions.SubPropertiesColor;
OIReferencesColorButton.ButtonColor:=
ObjectInspectorOptions.ReferencesColor;
OIValueColorButton.ButtonColor:=
ObjectInspectorOptions.ValueColor;
OIDefaultValueColorButton.ButtonColor:=
ObjectInspectorOptions.DefaultValueColor;
OIPropNameColorButton.ButtonColor:=
ObjectInspectorOptions.PropertyNameColor;
OIDefaultItemHeightSpinEdit.Value:= OIDefaultItemHeightSpinEdit.Value:=
ObjectInspectorOptions.DefaultItemHeight; ObjectInspectorOptions.DefaultItemHeight;
OIShowHintCheckBox.Checked := OIShowHintCheckBox.Checked :=
@ -3747,6 +3740,17 @@ begin
// object inspector // object inspector
ObjectInspectorOptions.GridBackgroundColor:= ObjectInspectorOptions.GridBackgroundColor:=
OIBackgroundColorButton.ButtonColor; OIBackgroundColorButton.ButtonColor;
ObjectInspectorOptions.SubPropertiesColor:=
OISubPropsColorButton.ButtonColor;
ObjectInspectorOptions.ReferencesColor:=
OIReferencesColorButton.ButtonColor;
ObjectInspectorOptions.ValueColor:=
OIValueColorButton.ButtonColor;
ObjectInspectorOptions.DefaultValueColor:=
OIDefaultValueColorButton.ButtonColor;
ObjectInspectorOptions.PropertyNameColor:=
OIPropNameColorButton.ButtonColor;
ObjectInspectorOptions.DefaultItemHeight:= ObjectInspectorOptions.DefaultItemHeight:=
RoundToInt(OIDefaultItemHeightSpinEdit.Value); RoundToInt(OIDefaultItemHeightSpinEdit.Value);
ObjectInspectorOptions.ShowHints := ObjectInspectorOptions.ShowHints :=
@ -3855,57 +3859,70 @@ begin
end; end;
end; end;
function TEnvironmentOptionsDialog.CreateColorItem(
ATop:Integer; AParent:TWinControl;ACaption:String):TColorButton;
var
ColorButton:TColorButton;
ColorLabel:TLabel;
begin
ColorButton:=TColorButton.Create(Self);
with ColorButton do begin
Name:='ColorButton'+IntToStr(ATop);
Left:=6;
Top:=ATop;
Width:=50;
Height:=25;
Parent:=AParent;
end;
ColorLabel:=TLabel.Create(Self);
with ColorLabel do begin
Name:='ColorLabel'+IntToStr(ATop);
Left:=ColorButton.Left+ColorButton.Width+5;
Top:=ColorButton.Top+2;
Width:=AParent.ClientWidth-Left-5;
Height:=23;
Parent:=AParent;
Caption:=ACaption;//dlgBackColor;
end;
Result:=ColorButton;
end;
procedure TEnvironmentOptionsDialog.SetupObjectInspectorPage(Page: integer); procedure TEnvironmentOptionsDialog.SetupObjectInspectorPage(Page: integer);
var MaxX: integer; var HalfWidth: integer;
begin begin
NoteBook.Page[Page].OnResize:=@OnObjectInspectorPageResize; NoteBook.Page[Page].OnResize:=@OnObjectInspectorPageResize;
MaxX:=ClientWidth-5; HalfWidth:=ClientWidth div 2;
// object inspector // object inspector
ObjectInspectorColorsGroupBox:=TGroupBox.Create(Self); ObjectInspectorColorsGroupBox:=TGroupBox.Create(Self);
with ObjectInspectorColorsGroupBox do begin with ObjectInspectorColorsGroupBox do begin
Name:='ObjectInspectorColorsGroupBox'; Name:='ObjectInspectorColorsGroupBox';
Left:=6; Left:=5;
Top:=2; Top:=2;
Width:=(MaxX div 2) - 15; Width:= HalfWidth-15;
Height:=55; Height:=180;
Parent:=NoteBook.Page[Page]; Parent:=NoteBook.Page[Page];
Caption:=dlgEnvColors; Caption:=dlgEnvColors;
OnResize:=@ObjectInspectorColorsGroupBoxResize;
end; end;
OIBackgroundColorButton:=TColorButton.Create(Self); OIBackgroundColorButton:=CreateColorItem(5, ObjectInspectorColorsGroupBox, dlgBackColor);
with OIBackgroundColorButton do begin OISubPropsColorButton:=CreateColorItem(30, ObjectInspectorColorsGroupBox, dlgSubPropkColor);
Name:='OIBackgroundColorButton'; OIReferencesColorButton:=CreateColorItem(55, ObjectInspectorColorsGroupBox, dlgReferenceColor);
Left:=6; OIValueColorButton:=CreateColorItem(80, ObjectInspectorColorsGroupBox, dlgValueColor);
Top:=6; OIDefaultValueColorButton:=CreateColorItem(105, ObjectInspectorColorsGroupBox, dlgDefValueColor);
Width:=50; OIPropNameColorButton:=CreateColorItem(130, ObjectInspectorColorsGroupBox, dlgPropNameColor);
Height:=25;
Parent:=ObjectInspectorColorsGroupBox;
end;
OIBackgroundColorLabel:=TLabel.Create(Self);
with OIBackgroundColorLabel do begin
Name:='OIBackgroundColorLabel';
Left:=OIBackgroundColorButton.Left+OIBackgroundColorButton.Width+5;
Top:=OIBackgroundColorButton.Top+2;
Width:=ObjectInspectorColorsGroupBox.ClientWidth-Left-5;
Height:=23;
Parent:=ObjectInspectorColorsGroupBox;
Caption:=dlgBackColor;
end;
OIMiscGroupBox:=TGroupBox.Create(Self); OIMiscGroupBox:=TGroupBox.Create(Self);
with OIMiscGroupBox do begin with OIMiscGroupBox do begin
Name:='OIMiscGroupBox'; Name:='OIMiscGroupBox';
Left:=ObjectInspectorColorsGroupBox.Left; Left:=HalfWidth+5;
Top:=ObjectInspectorColorsGroupBox.Top+ObjectInspectorColorsGroupBox.Height+5; Top:=ObjectInspectorColorsGroupBox.Top;
Width:=200; Width:=HalfWidth-15;
Height:=77; Height:=77;
Parent:=NoteBook.Page[Page]; Parent:=NoteBook.Page[Page];
Caption:=dlgOIMiscellaneous; Caption:=dlgOIMiscellaneous;
OnResize:=@OIMiscGroupBoxResize;
end; end;
OIDefaultItemHeightSpinEdit:=TSpinEdit.Create(Self); OIDefaultItemHeightSpinEdit:=TSpinEdit.Create(Self);

View File

@ -718,7 +718,13 @@ resourcestring
dlgnoAutomaticRenaming = 'no automatic renaming'; dlgnoAutomaticRenaming = 'no automatic renaming';
dlgAmbigWarn = 'Warn on compile'; dlgAmbigWarn = 'Warn on compile';
dlgIgnoreVerb = 'Ignore'; dlgIgnoreVerb = 'Ignore';
dlgBackColor = 'Background color'; dlgBackColor = 'Background';
dlgSubPropkColor = 'Subpropertes';
dlgReferenceColor = 'Reference';
dlgValueColor = 'Value';
dlgDefValueColor = 'Default value';
dlgPropNameColor = 'Property name';
dlgOIMiscellaneous = 'Miscellaneous'; dlgOIMiscellaneous = 'Miscellaneous';
dlgOIItemHeight = 'Item height'; dlgOIItemHeight = 'Item height';
dlgEnvColors = 'Colors'; dlgEnvColors = 'Colors';

View File

@ -1,3 +1,4 @@
{ $Id$}
{ {
***************************************************************************** *****************************************************************************
* * * *
@ -116,6 +117,11 @@ type
FHeight: integer; FHeight: integer;
FGridSplitterX: array[TObjectInspectorPage] of integer; FGridSplitterX: array[TObjectInspectorPage] of integer;
FPropertyNameColor: TColor;
FDefaultValueColor: TColor;
FSubPropertiesColor: TColor;
FValueColor: TColor;
FReferencesColor: TColor;
FGridBackgroundColor: TColor; FGridBackgroundColor: TColor;
FShowHints: boolean; FShowHints: boolean;
function FPropertyGridSplitterX(Page: TObjectInspectorPage): integer; function FPropertyGridSplitterX(Page: TObjectInspectorPage): integer;
@ -146,6 +152,16 @@ type
property GridBackgroundColor: TColor read FGridBackgroundColor property GridBackgroundColor: TColor read FGridBackgroundColor
write FGridBackgroundColor; write FGridBackgroundColor;
property SubPropertiesColor: TColor read FSubPropertiesColor
write FSubPropertiesColor;
property ReferencesColor: TColor read FReferencesColor
write FReferencesColor;
property ValueColor: TColor read FValueColor
write FValueColor;
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;
end; end;
@ -211,6 +227,8 @@ type
TOICustomPropertyGrid = class(TCustomControl) TOICustomPropertyGrid = class(TCustomControl)
private private
FBackgroundColor:TColor; FBackgroundColor:TColor;
FReferencesColor: TColor;
FSubPropertiesColor: TColor;
FChangeStep: integer; FChangeStep: integer;
FCurrentButton: TWinControl; // nil or ValueButton FCurrentButton: TWinControl; // nil or ValueButton
FCurrentEdit: TWinControl; // nil or ValueEdit or ValueComboBox FCurrentEdit: TWinControl; // nil or ValueEdit or ValueComboBox
@ -257,6 +275,7 @@ 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 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);
@ -293,6 +312,8 @@ type
procedure WMVScroll(var Msg: TWMScroll); message WM_VSCROLL; procedure WMVScroll(var Msg: TWMScroll); message WM_VSCROLL;
procedure SetBackgroundColor(const AValue: TColor); procedure SetBackgroundColor(const AValue: TColor);
procedure SetReferences(const AValue: TColor);
procedure SetSubPropertiesColor(const AValue: TColor);
procedure UpdateScrollBar; procedure UpdateScrollBar;
procedure FillComboboxItems; procedure FillComboboxItems;
protected protected
@ -342,6 +363,10 @@ type
public public
property BackgroundColor: TColor read FBackgroundColor property BackgroundColor: TColor read FBackgroundColor
write SetBackgroundColor default clBtnFace; write SetBackgroundColor default clBtnFace;
property ReferencesColor: TColor read FReferencesColor
write SetReferences default clMaroon;
property SubPropertiesColor: TColor read FSubPropertiesColor
write SetSubPropertiesColor default clGreen;
property BorderStyle default bsSingle; property BorderStyle default bsSingle;
property CurrentEditValue: string read GetCurrentEditValue property CurrentEditValue: string read GetCurrentEditValue
write SetCurrentEditValue; write SetCurrentEditValue;
@ -451,12 +476,10 @@ type
FavouriteGrid: TOICustomPropertyGrid; FavouriteGrid: TOICustomPropertyGrid;
StatusBar: TStatusBar; StatusBar: TStatusBar;
MainPopupMenu: TPopupMenu; MainPopupMenu: TPopupMenu;
ColorsPopupMenuItem: TMenuItem;
SetDefaultPopupMenuItem: TMenuItem; SetDefaultPopupMenuItem: TMenuItem;
AddToFavouritesPopupMenuItem: TMenuItem; AddToFavouritesPopupMenuItem: TMenuItem;
RemoveFromFavouritesPopupMenuItem: TMenuItem; RemoveFromFavouritesPopupMenuItem: TMenuItem;
UndoPropertyPopupMenuItem: TMenuItem; UndoPropertyPopupMenuItem: TMenuItem;
BackgroundColPopupMenuItem: TMenuItem;
ShowHintsPopupMenuItem: TMenuItem; ShowHintsPopupMenuItem: TMenuItem;
ShowComponentTreePopupMenuItem: TMenuItem; ShowComponentTreePopupMenuItem: TMenuItem;
ShowOptionsPopupMenuItem: TMenuItem; ShowOptionsPopupMenuItem: TMenuItem;
@ -468,7 +491,6 @@ type
procedure OnAddToFavouritesPopupmenuItemClick(Sender: TObject); procedure OnAddToFavouritesPopupmenuItemClick(Sender: TObject);
procedure OnRemoveFromFavouritesPopupmenuItemClick(Sender: TObject); procedure OnRemoveFromFavouritesPopupmenuItemClick(Sender: TObject);
procedure OnUndoPopupmenuItemClick(Sender: TObject); procedure OnUndoPopupmenuItemClick(Sender: TObject);
procedure OnBackgroundColPopupMenuItemClick(Sender: TObject);
procedure OnShowHintPopupMenuItemClick(Sender: TObject); procedure OnShowHintPopupMenuItemClick(Sender: TObject);
procedure OnShowOptionsPopupMenuItemClick(Sender: TObject); procedure OnShowOptionsPopupMenuItemClick(Sender: TObject);
procedure OnShowComponentTreePopupMenuItemClick(Sender: TObject); procedure OnShowComponentTreePopupMenuItemClick(Sender: TObject);
@ -617,6 +639,8 @@ begin
FPreferredSplitterX:=FSplitterX; FPreferredSplitterX:=FSplitterX;
FIndent:=9; FIndent:=9;
FBackgroundColor:=clBtnFace; FBackgroundColor:=clBtnFace;
FReferencesColor:=clMaroon;
FSubPropertiesColor:=clGreen;
FNameFont:=TFont.Create; FNameFont:=TFont.Create;
FNameFont.Color:=clWindowText; FNameFont.Color:=clWindowText;
FValueFont:=TFont.Create; FValueFont:=TFont.Create;
@ -1643,6 +1667,30 @@ begin
end; end;
end; end;
function TOICustomPropertyGrid.GetPropNameColor(ARow:TOIPropertyGridRow):TColor;
var
ParentRow:TOIPropertyGridRow;
IsObjectSubProperty:Boolean;
begin
// Try to guest if ARow, or one of its parents, is a subproperty
// of an object (and not an item of a set)
IsObjectSubProperty:=false;
ParentRow:=ARow.Parent;
while Assigned(ParentRow) do
begin
if ParentRow.Editor is TPersistentPropertyEditor then
IsObjectSubProperty:=true;
ParentRow:=ParentRow.Parent;
end;
if IsObjectSubProperty then
Result := FSubPropertiesColor
else if ARow.Editor is TPersistentPropertyEditor then
Result := FReferencesColor
else
Result := FNameFont.Color;
end;
procedure TOICustomPropertyGrid.SetBounds(aLeft,aTop,aWidth,aHeight:integer); procedure TOICustomPropertyGrid.SetBounds(aLeft,aTop,aWidth,aHeight:integer);
begin begin
//writeln('[TOICustomPropertyGrid.SetBounds] ',Name,' ',aLeft,',',aTop,',',aWidth,',',aHeight,' Visible=',Visible); //writeln('[TOICustomPropertyGrid.SetBounds] ',Name,' ',aLeft,',',aTop,',',aWidth,',',aHeight,' Visible=',Visible);
@ -1770,6 +1818,7 @@ begin
// draw name // draw name
OldFont:=Font; OldFont:=Font;
Font:=FNameFont; Font:=FNameFont;
Font.Color := GetPropNameColor(CurRow);
CurRow.Editor.PropDrawName(Canvas,NameTextRect,DrawState); CurRow.Editor.PropDrawName(Canvas,NameTextRect,DrawState);
Font:=OldFont; Font:=OldFont;
// draw frame for name // draw frame for name
@ -2156,6 +2205,20 @@ begin
Invalidate; Invalidate;
end; end;
procedure TOICustomPropertyGrid.SetReferences(const AValue: TColor);
begin
if FReferencesColor=AValue then exit;
FReferencesColor:=AValue;
Invalidate;
end;
procedure TOICustomPropertyGrid.SetSubPropertiesColor(const AValue: TColor);
begin
if FSubPropertiesColor=AValue then exit;
FSubPropertiesColor:=AValue;
Invalidate;
end;
//------------------------------------------------------------------------------ //------------------------------------------------------------------------------
{ TOIPropertyGridRow } { TOIPropertyGridRow }
@ -2372,6 +2435,11 @@ begin
FComponentTreeHeight:=100; FComponentTreeHeight:=100;
FGridBackgroundColor:=clBtnFace; FGridBackgroundColor:=clBtnFace;
FDefaultValueColor:=clWindowText;
FSubPropertiesColor:= clGreen;
FValueColor:=clMaroon;
FReferencesColor:= clMaroon;
FPropertyNameColor:=clWindowText;
end; end;
function TOIOptions.Load: boolean; function TOIOptions.Load: boolean;
@ -2417,7 +2485,18 @@ begin
Path+'ComponentTree/Height/Value',100); Path+'ComponentTree/Height/Value',100);
FGridBackgroundColor:=ConfigStore.GetValue( FGridBackgroundColor:=ConfigStore.GetValue(
Path+'GridBackgroundColor',clBtnFace); Path+'Color/GridBackground',clBtnFace);
FDefaultValueColor:=ConfigStore.GetValue(
Path+'Color/DefaultValue', clWindowText);
FSubPropertiesColor:=ConfigStore.GetValue(
Path+'Color/SubProperties', clGreen);
FValueColor:=ConfigStore.GetValue(
Path+'Color/Value', clMaroon);
FReferencesColor:=ConfigStore.GetValue(
Path+'Color/References',clMaroon);
FPropertyNameColor:=ConfigStore.GetValue(
Path+'Color/PropertyName',clWindowText);
FShowHints:=ConfigStore.GetValue( FShowHints:=ConfigStore.GetValue(
Path+'ShowHints',false); Path+'ShowHints',false);
except except
@ -2462,8 +2541,19 @@ begin
ConfigStore.SetDeleteValue(Path+'ComponentTree/Height/Value', ConfigStore.SetDeleteValue(Path+'ComponentTree/Height/Value',
FComponentTreeHeight,100); FComponentTreeHeight,100);
ConfigStore.SetDeleteValue(Path+'GridBackgroundColor', ConfigStore.SetDeleteValue(Path+'Color/GridBackground',
FGridBackgroundColor,clBackground); FGridBackgroundColor,clBackground);
ConfigStore.SetDeleteValue(Path+'Color/DefaultValue',
FDefaultValueColor,clBackground);
ConfigStore.SetDeleteValue(Path+'Color/SubProperties',
FSubPropertiesColor,clBackground);
ConfigStore.SetDeleteValue(Path+'Color/Value',
FValueColor,clBackground);
ConfigStore.SetDeleteValue(Path+'Color/References',
FReferencesColor,clBackground);
ConfigStore.SetDeleteValue(Path+'Color/PropertyName',
FPropertyNameColor,clWindowText);
ConfigStore.SetDeleteValue(Path+'ShowHints',FShowHints, ConfigStore.SetDeleteValue(Path+'ShowHints',FShowHints,
false); false);
except except
@ -2489,7 +2579,14 @@ begin
FDefaultItemHeight:=AnObjInspector.DefaultItemHeight; FDefaultItemHeight:=AnObjInspector.DefaultItemHeight;
FShowComponentTree:=AnObjInspector.ShowComponentTree; FShowComponentTree:=AnObjInspector.ShowComponentTree;
FComponentTreeHeight:=AnObjInspector.ComponentTreeHeight; FComponentTreeHeight:=AnObjInspector.ComponentTreeHeight;
FGridBackgroundColor:=AnObjInspector.PropertyGrid.BackgroundColor; FGridBackgroundColor:=AnObjInspector.PropertyGrid.BackgroundColor;
FSubPropertiesColor:=AnObjInspector.PropertyGrid.SubPropertiesColor;
FReferencesColor:=AnObjInspector.PropertyGrid.ReferencesColor;
FValueColor:=AnObjInspector.PropertyGrid.ValueFont.Color;
FDefaultValueColor:=AnObjInspector.PropertyGrid.DefaultValueFont.Color;
FPropertyNameColor:=AnObjInspector.PropertyGrid.NameFont.Color;
FShowHints:=AnObjInspector.PropertyGrid.ShowHint; FShowHints:=AnObjInspector.PropertyGrid.ShowHint;
end; end;
@ -2507,6 +2604,11 @@ begin
Grid.PrefferedSplitterX:=FGridSplitterX[Page]; Grid.PrefferedSplitterX:=FGridSplitterX[Page];
Grid.SplitterX:=FGridSplitterX[Page]; Grid.SplitterX:=FGridSplitterX[Page];
Grid.BackgroundColor:=FGridBackgroundColor; Grid.BackgroundColor:=FGridBackgroundColor;
Grid.SubPropertiesColor:=FSubPropertiesColor;
Grid.ReferencesColor:=FReferencesColor;
Grid.ValueFont.Color:=FValueColor;
Grid.DefaultValueFont.Color:=FDefaultValueColor;
Grid.NameFont.Color:=FPropertyNameColor;
Grid.ShowHint:=FShowHints; Grid.ShowHint:=FShowHints;
end; end;
AnObjInspector.DefaultItemHeight:=FDefaultItemHeight; AnObjInspector.DefaultItemHeight:=FDefaultItemHeight;
@ -2604,11 +2706,6 @@ begin
'Undo','Set property value to last valid value', 'Undo','Set property value to last valid value',
@OnUndoPopupmenuItemClick,false,true,true); @OnUndoPopupmenuItemClick,false,true,true);
AddSeparatorMenuItem(nil,'OptionsSeparatorMenuItem',true); AddSeparatorMenuItem(nil,'OptionsSeparatorMenuItem',true);
AddPopupMenuItem(ColorsPopupmenuItem,nil,'ColorsPopupMenuItem','Set Colors',''
,nil,false,true,true);
AddPopupMenuItem(BackgroundColPopupMenuItem,ColorsPopupMenuItem
,'BackgroundColPopupMenuItem','Background','Grid background color'
,@OnBackgroundColPopupMenuItemClick,false,true,true);
AddPopupMenuItem(ShowHintsPopupMenuItem,nil AddPopupMenuItem(ShowHintsPopupMenuItem,nil
,'ShowHintPopupMenuItem','Show Hints','Grid hints' ,'ShowHintPopupMenuItem','Show Hints','Grid hints'
,@OnShowHintPopupMenuItemClick,false,true,true); ,@OnShowHintPopupMenuItemClick,false,true,true);
@ -3009,26 +3106,6 @@ begin
CurGrid.CurrentEditValue:=CurRow.Editor.GetVisualValue; CurGrid.CurrentEditValue:=CurRow.Editor.GetVisualValue;
end; end;
procedure TObjectInspector.OnBackgroundColPopupMenuItemClick(Sender :TObject);
var
ColorDialog:TColorDialog;
Page: TObjectInspectorPage;
begin
ColorDialog:=TColorDialog.Create(nil);
try
with ColorDialog do begin
Color:=PropertyGrid.BackgroundColor;
if Execute then begin
for Page:=Low(TObjectInspectorPage) to High(TObjectInspectorPage) do
if GridControl[Page]<>nil then
GridControl[Page].BackgroundColor:=Color;
end;
end;
finally
ColorDialog.Free;
end;
end;
procedure TObjectInspector.OnGridModified(Sender: TObject); procedure TObjectInspector.OnGridModified(Sender: TObject);
begin begin
if Assigned(FOnModified) then FOnModified(Self); if Assigned(FOnModified) then FOnModified(Self);