Sparta docked form editor: Tweak code that gets OI to make it more readable.

git-svn-id: trunk@53818 -
This commit is contained in:
juha 2016-12-31 13:11:54 +00:00
parent 3fe2624774
commit 221dce6d01
2 changed files with 22 additions and 10 deletions

View File

@ -22,7 +22,7 @@ uses
{$IFDEF USE_GENERICS_COLLECTIONS} {$IFDEF USE_GENERICS_COLLECTIONS}
Generics.Defaults, Generics.Defaults,
{$ENDIF} {$ENDIF}
SrcEditorIntf; SrcEditorIntf, ObjectInspector;
type type
{ TDesignedFormImpl } { TDesignedFormImpl }
@ -718,12 +718,18 @@ begin
end; end;
procedure TDesignedFormImpl.EndUpdate(AModified: Boolean); procedure TDesignedFormImpl.EndUpdate(AModified: Boolean);
var
OI: TObjectInspectorDlg;
begin begin
TFormAccess(FOwner).SetDesigning(True, False); TFormAccess(FOwner).SetDesigning(True, False);
inherited EndUpdate(AModified); inherited EndUpdate(AModified);
if AModified and (FormEditingHook <> nil) then if AModified and (FormEditingHook <> nil)
if (FormEditingHook.GetCurrentDesigner = FOwner.Designer) and (FormEditingHook.GetCurrentObjectInspector <> nil) then and (FormEditingHook.GetCurrentDesigner = FOwner.Designer) then
FormEditingHook.GetCurrentObjectInspector.RefreshPropertyValues; begin
OI := FormEditingHook.GetCurrentObjectInspector;
if Assigned(OI) then
OI.RefreshPropertyValues;
end;
end; end;
end. end.

View File

@ -19,7 +19,7 @@ interface
uses uses
Classes, contnrs, SysUtils, FileUtil, Forms, Controls, ExtCtrls, StdCtrls, Classes, contnrs, SysUtils, FileUtil, Forms, Controls, ExtCtrls, StdCtrls,
Graphics, LCLType, lclintf, Menus, LMessages, sparta_DesignedForm, Math, Graphics, LCLType, lclintf, Menus, LMessages, sparta_DesignedForm, Math,
Types, FormEditingIntf, PropEdits, sparta_BasicResizeFrame; Types, FormEditingIntf, PropEdits, ObjectInspector, sparta_BasicResizeFrame;
type type
@ -55,29 +55,35 @@ begin
end; end;
procedure TResizerFrame.BeginFormSizeUpdate(Sender: TObject); procedure TResizerFrame.BeginFormSizeUpdate(Sender: TObject);
var
OI: TObjectInspectorDlg;
begin begin
inherited; inherited;
// when was active ActivePropertyGrid.ItemIndex for height or width during scaling // when was active ActivePropertyGrid.ItemIndex for height or width during scaling
// there was problem with values :< // there was problem with values :<
if ((Sender = pR) or (Sender = pB) or (FNodes.IndexOf(Sender) in [3,4,5])) and (FormEditingHook.GetCurrentObjectInspector <> nil) then OI := FormEditingHook.GetCurrentObjectInspector;
if ((Sender = pR) or (Sender = pB) or (FNodes.IndexOf(Sender) in [3,4,5])) and Assigned(OI) then
begin begin
FActivePropertyGridItemIndex := FormEditingHook.GetCurrentObjectInspector.GetActivePropertyGrid.ItemIndex; FActivePropertyGridItemIndex := OI.GetActivePropertyGrid.ItemIndex;
FormEditingHook.GetCurrentObjectInspector.GetActivePropertyGrid.ItemIndex := -1; OI.GetActivePropertyGrid.ItemIndex := -1;
end end
else else
FActivePropertyGridItemIndex := -1; FActivePropertyGridItemIndex := -1;
end; end;
procedure TResizerFrame.EndFormSizeUpdate(Sender: TObject); procedure TResizerFrame.EndFormSizeUpdate(Sender: TObject);
var
OI: TObjectInspectorDlg;
begin begin
inherited; inherited;
// restore last selected item in OI. // restore last selected item in OI.
if FActivePropertyGridItemIndex <> -1 then if FActivePropertyGridItemIndex <> -1 then
begin begin
if FormEditingHook.GetCurrentObjectInspector <> nil then OI := FormEditingHook.GetCurrentObjectInspector;
FormEditingHook.GetCurrentObjectInspector.GetActivePropertyGrid.ItemIndex := FActivePropertyGridItemIndex; if OI <> nil then
OI.GetActivePropertyGrid.ItemIndex := FActivePropertyGridItemIndex;
FActivePropertyGridItemIndex := -1; FActivePropertyGridItemIndex := -1;
end; end;