implemented highlighting non default values in OI

git-svn-id: trunk@5041 -
This commit is contained in:
mattias 2004-01-10 02:36:16 +00:00
parent 9c2965f234
commit 85edd4a3f8
2 changed files with 28 additions and 4 deletions

View File

@ -181,7 +181,7 @@ type
FPreferredSplitterX: integer; // best splitter position
FIndent:integer;
FBackgroundColor:TColor;
FNameFont,FValueFont:TFont;
FNameFont,FDefaultValueFont,FValueFont:TFont;
FCurrentEdit:TWinControl; // nil or ValueEdit or ValueComboBox
FCurrentButton:TWinControl; // nil or ValueButton
FCurrentEditorLookupRoot: TPersistent;
@ -232,7 +232,7 @@ type
procedure RefreshValueEdit;
Procedure ValueEditDblClick(Sender : TObject);
procedure ValueEditMouseDown(Sender: TObject; Button:TMouseButton;
Shift:TShiftState; X,Y:integer);
Shift: TShiftState; X,Y:integer);
procedure ValueEditKeyDown(Sender: TObject; var Key: Word; Shift: TShiftState);
procedure ValueEditExit(Sender: TObject);
procedure ValueEditChange(Sender: TObject);
@ -290,6 +290,7 @@ type
read FBackgroundColor write SetBackgroundColor default clBtnFace;
property NameFont:TFont read FNameFont write FNameFont;
property ValueFont:TFont read FValueFont write FValueFont;
property DefaultValueFont:TFont read FDefaultValueFont write FDefaultValueFont;
property BorderStyle: TBorderStyle read FBorderStyle write SetBorderStyle
default bsSingle;
property ItemIndex:integer read FItemIndex write SetItemIndex;
@ -470,7 +471,9 @@ begin
FNameFont:=TFont.Create;
FNameFont.Color:=clWindowText;
FValueFont:=TFont.Create;
FValueFont.Color:=clActiveCaption;
FValueFont.Color:=clMaroon;
FDefaultValueFont:=TFont.Create;
FDefaultValueFont.Color:=clActiveCaption;
fBorderStyle := bsSingle;
// create sub components
@ -616,6 +619,7 @@ begin
FreeAndNil(FRows);
FreeAndNil(FSelection);
FreeAndNil(FValueFont);
FreeAndNil(FDefaultValueFont);
FreeAndNil(FNameFont);
FreeAndNil(FExpandedProperties);
FreeAndNil(FHintTimer);
@ -1487,7 +1491,10 @@ begin
// draw value
if ARow<>ItemIndex then begin
OldFont:=Font;
Font:=FValueFont;
if CurRow.Editor.IsNotDefaultValue then
Font:=FValueFont
else
Font:=FDefaultValueFont;
CurRow.Editor.PropDrawValue(Canvas,ValueRect,DrawState);
Font:=OldFont;
end;

View File

@ -34,6 +34,9 @@ unit PropEdits;
{$mode objfpc}{$H+}
// This unit contains a lot of base type conversions. Disable range checking.
{$R-}
interface
{$DEFINE NewListPropEdit}
@ -344,6 +347,8 @@ type
AState:TPropEditDrawState); dynamic;
procedure UpdateSubProperties; virtual;
function SubPropertiesNeedsUpdate: boolean; virtual;
function IsDefaultValue: boolean; virtual;
function IsNotDefaultValue: boolean; virtual;
property PropertyHook:TPropertyEditorHook read FPropertyHook;
property PrivateDirectory:ansistring read GetPrivateDirectory;
property PropCount:Integer read FPropCount;
@ -2372,6 +2377,18 @@ begin
Result:=false;
end;
function TPropertyEditor.IsDefaultValue: boolean;
begin
Result:=(paHasDefaultValue in GetAttributes)
and (GetDefaultValue=GetVisualValue);
end;
function TPropertyEditor.IsNotDefaultValue: boolean;
begin
Result:=(paHasDefaultValue in GetAttributes)
and (GetDefaultValue<>GetVisualValue);
end;
{ TOrdinalPropertyEditor }
function TOrdinalPropertyEditor.AllEqual: Boolean;