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

View File

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