mirror of
https://gitlab.com/freepascal.org/lazarus/lazarus.git
synced 2025-04-08 22:58:50 +02:00
Sparta docked form editor: Tweak code that gets OI to make it more readable.
git-svn-id: trunk@53818 -
This commit is contained in:
parent
3fe2624774
commit
221dce6d01
@ -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.
|
||||
|
@ -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;
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user