ideintf: store component tree and information box height, don't reset their height on resize (bug #0018182)

git-svn-id: trunk@29134 -
This commit is contained in:
paul 2011-01-20 08:57:49 +00:00
parent c5100d475a
commit 49445bf7fd
2 changed files with 47 additions and 22 deletions

View File

@ -8,8 +8,7 @@ object ObjectInspectorDlg: TObjectInspectorDlg
ClientHeight = 669 ClientHeight = 669
ClientWidth = 275 ClientWidth = 275
KeyPreview = True KeyPreview = True
OnResize = ObjectInspectorResize LCLVersion = '0.9.31'
LCLVersion = '0.9.29'
object StatusBar: TStatusBar object StatusBar: TStatusBar
Left = 0 Left = 0
Height = 23 Height = 23
@ -26,11 +25,11 @@ object ObjectInspectorDlg: TObjectInspectorDlg
end end
object AvailPersistentComboBox: TComboBox object AvailPersistentComboBox: TComboBox
Left = 0 Left = 0
Height = 21 Height = 23
Top = 0 Top = 0
Width = 275 Width = 275
Align = alTop Align = alTop
ItemHeight = 13 ItemHeight = 15
OnCloseUp = AvailComboBoxCloseUp OnCloseUp = AvailComboBoxCloseUp
Style = csDropDownList Style = csDropDownList
TabOrder = 0 TabOrder = 0

View File

@ -92,6 +92,7 @@ type
FLeft: integer; FLeft: integer;
FShowGutter: boolean; FShowGutter: boolean;
FShowInfoBox: boolean; FShowInfoBox: boolean;
FInfoBoxHeight: integer;
FShowStatusBar: boolean; FShowStatusBar: boolean;
FTop: integer; FTop: integer;
FWidth: integer; FWidth: integer;
@ -159,6 +160,7 @@ type
property ShowGutter: boolean read FShowGutter write FShowGutter; property ShowGutter: boolean read FShowGutter write FShowGutter;
property ShowStatusBar: boolean read FShowStatusBar write FShowStatusBar; property ShowStatusBar: boolean read FShowStatusBar write FShowStatusBar;
property ShowInfoBox: boolean read FShowInfoBox write FShowInfoBox; property ShowInfoBox: boolean read FShowInfoBox write FShowInfoBox;
property InfoBoxHeight: integer read FInfoBoxHeight write FInfoBoxHeight;
end; end;
{ TOIPropertyGridRow } { TOIPropertyGridRow }
@ -611,7 +613,6 @@ type
procedure ComponentTreeKeyDown(Sender: TObject; var Key: Word; procedure ComponentTreeKeyDown(Sender: TObject; var Key: Word;
Shift: TShiftState); Shift: TShiftState);
procedure ComponentTreeSelectionChanged(Sender: TObject); procedure ComponentTreeSelectionChanged(Sender: TObject);
procedure ObjectInspectorResize(Sender: TObject);
procedure OnGridKeyDown(Sender: TObject; var Key: Word; Shift: TShiftState); procedure OnGridKeyDown(Sender: TObject; var Key: Word; Shift: TShiftState);
procedure OnGridKeyUp(Sender: TObject; var Key: Word; Shift: TShiftState); procedure OnGridKeyUp(Sender: TObject; var Key: Word; Shift: TShiftState);
procedure OnGridDblClick(Sender: TObject); procedure OnGridDblClick(Sender: TObject);
@ -690,6 +691,8 @@ type
private private
FInSelection: Boolean; FInSelection: Boolean;
FOnAutoShow: TNotifyEvent; FOnAutoShow: TNotifyEvent;
function GetComponentTreeHeight: integer;
function GetInfoBoxHeight: integer;
protected protected
function PersistentToString(APersistent: TPersistent): string; function PersistentToString(APersistent: TPersistent): string;
procedure AddPersistentToList(APersistent: TPersistent; List: TStrings); procedure AddPersistentToList(APersistent: TPersistent; List: TStrings);
@ -755,9 +758,9 @@ type
write SetShowComponentTree; write SetShowComponentTree;
property ShowFavorites: Boolean read FShowFavorites write SetShowFavorites; property ShowFavorites: Boolean read FShowFavorites write SetShowFavorites;
property ShowRestricted: Boolean read FShowRestricted write SetShowRestricted; property ShowRestricted: Boolean read FShowRestricted write SetShowRestricted;
property ComponentTreeHeight: integer read FComponentTreeHeight property ComponentTreeHeight: integer read GetComponentTreeHeight
write SetComponentTreeHeight; write SetComponentTreeHeight;
property InfoBoxHeight: integer read FInfoBoxHeight write SetInfoBoxHeight; property InfoBoxHeight: integer read GetInfoBoxHeight write SetInfoBoxHeight;
property ShowStatusBar: Boolean read FShowStatusBar write SetShowStatusBar; property ShowStatusBar: Boolean read FShowStatusBar write SetShowStatusBar;
property ShowInfoBox: Boolean read FShowInfoBox write SetShowInfoBox; property ShowInfoBox: Boolean read FShowInfoBox write SetShowInfoBox;
property GridControl[Page: TObjectInspectorPage]: TOICustomPropertyGrid property GridControl[Page: TObjectInspectorPage]: TOICustomPropertyGrid
@ -3520,6 +3523,7 @@ begin
FDefaultItemHeight:=20; FDefaultItemHeight:=20;
FShowComponentTree:=true; FShowComponentTree:=true;
FComponentTreeHeight:=100; FComponentTreeHeight:=100;
FInfoBoxHeight:=80;
FGridBackgroundColor := DefBackgroundColor; FGridBackgroundColor := DefBackgroundColor;
FDefaultValueColor := DefDefaultValueColor; FDefaultValueColor := DefDefaultValueColor;
@ -3619,6 +3623,8 @@ begin
Path+'ShowStatusBar',true); Path+'ShowStatusBar',true);
FShowInfoBox := ConfigStore.GetValue( FShowInfoBox := ConfigStore.GetValue(
Path+'ShowInfoBox',false); Path+'ShowInfoBox',false);
FInfoBoxHeight := ConfigStore.GetValue(
Path+'InfoBoxHeight',80);
except except
on E: Exception do begin on E: Exception do begin
DebugLn('ERROR: TOIOptions.Load: ',E.Message); DebugLn('ERROR: TOIOptions.Load: ',E.Message);
@ -3691,6 +3697,7 @@ begin
ConfigStore.SetDeleteValue(Path+'ShowGutter',FShowGutter, True); ConfigStore.SetDeleteValue(Path+'ShowGutter',FShowGutter, True);
ConfigStore.SetDeleteValue(Path+'ShowStatusBar',FShowStatusBar, True); ConfigStore.SetDeleteValue(Path+'ShowStatusBar',FShowStatusBar, True);
ConfigStore.SetDeleteValue(Path+'ShowInfoBox',FShowInfoBox, False); ConfigStore.SetDeleteValue(Path+'ShowInfoBox',FShowInfoBox, False);
ConfigStore.SetDeleteValue(Path+'InfoBoxHeight',FInfoBoxHeight,80);
except except
on E: Exception do begin on E: Exception do begin
DebugLn('ERROR: TOIOptions.Save: ',E.Message); DebugLn('ERROR: TOIOptions.Save: ',E.Message);
@ -3734,6 +3741,7 @@ begin
FShowGutter := AnObjInspector.PropertyGrid.ShowGutter; FShowGutter := AnObjInspector.PropertyGrid.ShowGutter;
FShowStatusBar := AnObjInspector.ShowStatusBar; FShowStatusBar := AnObjInspector.ShowStatusBar;
FShowInfoBox := AnObjInspector.ShowInfoBox; FShowInfoBox := AnObjInspector.ShowInfoBox;
FInfoBoxHeight := AnObjInspector.InfoBoxHeight;
end; end;
procedure TOIOptions.AssignTo(AnObjInspector: TObjectInspectorDlg); procedure TOIOptions.AssignTo(AnObjInspector: TObjectInspectorDlg);
@ -3755,10 +3763,11 @@ begin
Grid.SplitterX := FGridSplitterX[Page]; Grid.SplitterX := FGridSplitterX[Page];
AssignTo(Grid); AssignTo(Grid);
end; end;
AnObjInspector.DefaultItemHeight := FDefaultItemHeight; AnObjInspector.DefaultItemHeight := DefaultItemHeight;
AnObjInspector.ShowComponentTree := FShowComponentTree; AnObjInspector.ShowComponentTree := ShowComponentTree;
AnObjInspector.ShowInfoBox := FShowInfoBox; AnObjInspector.ShowInfoBox := ShowInfoBox;
AnObjInspector.ComponentTreeHeight := FComponentTreeHeight; AnObjInspector.ComponentTreeHeight := ComponentTreeHeight;
AnObjInspector.InfoBoxHeight := InfoBoxHeight;
AnObjInspector.AutoShow := AutoShow; AnObjInspector.AutoShow := AutoShow;
AnObjInspector.ShowStatusBar := ShowStatusBar; AnObjInspector.ShowStatusBar := ShowStatusBar;
end; end;
@ -3996,8 +4005,12 @@ end;
procedure TObjectInspectorDlg.SetComponentTreeHeight(const AValue: integer); procedure TObjectInspectorDlg.SetComponentTreeHeight(const AValue: integer);
begin begin
if FComponentTreeHeight=AValue then exit; if FComponentTreeHeight <> AValue then
FComponentTreeHeight:=AValue; begin
FComponentTreeHeight := AValue;
if Assigned(ComponentTree) then
ComponentTree.Height := AValue;
end;
end; end;
procedure TObjectInspectorDlg.SetDefaultItemHeight(const AValue: integer); procedure TObjectInspectorDlg.SetDefaultItemHeight(const AValue: integer);
@ -4023,8 +4036,12 @@ end;
procedure TObjectInspectorDlg.SetInfoBoxHeight(const AValue: integer); procedure TObjectInspectorDlg.SetInfoBoxHeight(const AValue: integer);
begin begin
if FInfoBoxHeight=AValue then exit; if FInfoBoxHeight <> AValue then
FInfoBoxHeight:=AValue; begin
FInfoBoxHeight := AValue;
if Assigned(InfoPanel) then
InfoPanel.Height := AValue;
end;
end; end;
procedure TObjectInspectorDlg.SetRestricted(const AValue: TOIRestrictedProperties); procedure TObjectInspectorDlg.SetRestricted(const AValue: TOIRestrictedProperties);
@ -4344,13 +4361,6 @@ begin
FOnSelectPersistentsInOI(Self); FOnSelectPersistentsInOI(Self);
end; end;
procedure TObjectInspectorDlg.ObjectInspectorResize(Sender: TObject);
begin
if (ComponentTree<>nil) and (ComponentTree.Visible)
and (ComponentTree.Parent=Self) then
ComponentTree.Height:=ClientHeight div 4;
end;
procedure TObjectInspectorDlg.OnGridKeyDown(Sender: TObject; var Key: Word; procedure TObjectInspectorDlg.OnGridKeyDown(Sender: TObject; var Key: Word;
Shift: TShiftState); Shift: TShiftState);
var var
@ -5189,6 +5199,22 @@ begin
DoModified(Self); DoModified(Self);
end; end;
function TObjectInspectorDlg.GetComponentTreeHeight: integer;
begin
if Assigned(ComponentTree) then
Result := ComponentTree.Height
else
Result := FComponentTreeHeight;
end;
function TObjectInspectorDlg.GetInfoBoxHeight: integer;
begin
if Assigned(InfoPanel) then
Result := InfoPanel.Height
else
Result := FInfoBoxHeight;
end;
procedure TObjectInspectorDlg.HookRefreshPropertyValues; procedure TObjectInspectorDlg.HookRefreshPropertyValues;
begin begin
RefreshPropertyValues; RefreshPropertyValues;