mirror of
https://gitlab.com/freepascal.org/lazarus/lazarus.git
synced 2025-11-01 18:19:31 +01:00
sparta: don't use fake design instances for TForm, TDataModule and TFrame. A little clean-up is needed but functionality should be ok. Fix for issues #29615, #29582, #30525, #31127, #31414, #31620
git-svn-id: trunk@55524 -
This commit is contained in:
parent
8e31460dbb
commit
dce9f97030
@ -27,7 +27,7 @@ uses
|
|||||||
type
|
type
|
||||||
{ TDesignedFormImpl }
|
{ TDesignedFormImpl }
|
||||||
|
|
||||||
TDesignedFormImpl = class(TFormImpl, IDesignedRealFormHelper, IDesignedForm, IDesignedFormIDE)
|
TDesignedFormImpl = class(TFormImpl, IDesignedRealForm, IDesignedRealFormHelper, IDesignedForm, IDesignedFormIDE)
|
||||||
private
|
private
|
||||||
FLastActiveSourceWindow: TSourceEditorWindowInterface;
|
FLastActiveSourceWindow: TSourceEditorWindowInterface;
|
||||||
protected
|
protected
|
||||||
@ -181,7 +181,7 @@ var
|
|||||||
LMediator: TDesignerMediator;
|
LMediator: TDesignerMediator;
|
||||||
LLookupRoot: TComponent;
|
LLookupRoot: TComponent;
|
||||||
begin
|
begin
|
||||||
LLookupRoot := (FOwner as TNonFormProxyDesignerForm).LookupRoot;
|
LLookupRoot := (FForm as TNonFormProxyDesignerForm).LookupRoot;
|
||||||
if LLookupRoot is TDataModule then
|
if LLookupRoot is TDataModule then
|
||||||
with TDataModule(LLookupRoot) do
|
with TDataModule(LLookupRoot) do
|
||||||
case AIndex of
|
case AIndex of
|
||||||
@ -192,7 +192,7 @@ begin
|
|||||||
end
|
end
|
||||||
else
|
else
|
||||||
begin
|
begin
|
||||||
LMediator := (FOwner as TNonControlProxyDesignerForm).Mediator;
|
LMediator := (FForm as TNonControlProxyDesignerForm).Mediator;
|
||||||
if (LLookupRoot <> nil) and (LMediator <> nil) then
|
if (LLookupRoot <> nil) and (LMediator <> nil) then
|
||||||
begin
|
begin
|
||||||
LMediator.GetFormBounds(LLookupRoot, LBounds, LClientRect);
|
LMediator.GetFormBounds(LLookupRoot, LBounds, LClientRect);
|
||||||
@ -217,7 +217,7 @@ var
|
|||||||
LMediator: TDesignerMediator;
|
LMediator: TDesignerMediator;
|
||||||
LLookupRoot: TComponent;
|
LLookupRoot: TComponent;
|
||||||
begin
|
begin
|
||||||
LLookupRoot := (FOwner as TNonFormProxyDesignerForm).LookupRoot;
|
LLookupRoot := (FForm as TNonFormProxyDesignerForm).LookupRoot;
|
||||||
if LLookupRoot is TDataModule then
|
if LLookupRoot is TDataModule then
|
||||||
with TDataModule(LLookupRoot) do
|
with TDataModule(LLookupRoot) do
|
||||||
case AIndex of
|
case AIndex of
|
||||||
@ -228,7 +228,7 @@ begin
|
|||||||
end
|
end
|
||||||
else
|
else
|
||||||
begin
|
begin
|
||||||
LMediator := (FOwner as TNonControlProxyDesignerForm).Mediator;
|
LMediator := (FForm as TNonControlProxyDesignerForm).Mediator;
|
||||||
if (LLookupRoot <> nil) and (LMediator <> nil) then
|
if (LLookupRoot <> nil) and (LMediator <> nil) then
|
||||||
begin
|
begin
|
||||||
LMediator.GetFormBounds(LLookupRoot, LBounds, LClientRect);
|
LMediator.GetFormBounds(LLookupRoot, LBounds, LClientRect);
|
||||||
@ -254,8 +254,8 @@ end;
|
|||||||
|
|
||||||
function TDesignedFrameFormImpl.GetPublishedBounds(AIndex: Integer): Integer;
|
function TDesignedFrameFormImpl.GetPublishedBounds(AIndex: Integer): Integer;
|
||||||
begin
|
begin
|
||||||
if (FOwner as TNonFormProxyDesignerForm).LookupRoot <> nil then
|
if (FForm as TNonFormProxyDesignerForm).LookupRoot <> nil then
|
||||||
with (TNonFormProxyDesignerForm(FOwner).LookupRoot as TFrame) do
|
with (TNonFormProxyDesignerForm(FForm).LookupRoot as TFrame) do
|
||||||
case AIndex of
|
case AIndex of
|
||||||
0: Result := Left;
|
0: Result := Left;
|
||||||
1: Result := Top;
|
1: Result := Top;
|
||||||
@ -269,8 +269,8 @@ end;
|
|||||||
procedure TDesignedFrameFormImpl.SetPublishedBounds(AIndex: Integer;
|
procedure TDesignedFrameFormImpl.SetPublishedBounds(AIndex: Integer;
|
||||||
AValue: Integer);
|
AValue: Integer);
|
||||||
begin
|
begin
|
||||||
if (FOwner as TNonFormProxyDesignerForm).LookupRoot <> nil then
|
if (FForm as TNonFormProxyDesignerForm).LookupRoot <> nil then
|
||||||
with (TNonFormProxyDesignerForm(FOwner).LookupRoot as TControl) do
|
with (TNonFormProxyDesignerForm(FForm).LookupRoot as TControl) do
|
||||||
case AIndex of
|
case AIndex of
|
||||||
0: Left := AValue;
|
0: Left := AValue;
|
||||||
1: Top := AValue;
|
1: Top := AValue;
|
||||||
@ -287,7 +287,7 @@ end;
|
|||||||
function TFakeCustomFrame.GetDesignedForm: TDesignedFormImpl;
|
function TFakeCustomFrame.GetDesignedForm: TDesignedFormImpl;
|
||||||
begin
|
begin
|
||||||
if not Assigned(FDesignedForm) then
|
if not Assigned(FDesignedForm) then
|
||||||
FDesignedForm := TDesignedFrameFormImpl.Create(Self);
|
FDesignedForm := TDesignedFrameFormImpl.Create(Self,Self);
|
||||||
|
|
||||||
Result := FDesignedForm;
|
Result := FDesignedForm;
|
||||||
end;
|
end;
|
||||||
@ -314,7 +314,16 @@ end;
|
|||||||
|
|
||||||
procedure TFakeCustomFrame.SetPublishedBounds(AIndex: Integer; AValue: Integer);
|
procedure TFakeCustomFrame.SetPublishedBounds(AIndex: Integer; AValue: Integer);
|
||||||
begin
|
begin
|
||||||
DesignedForm.SetPublishedBounds(AIndex, AValue);
|
//DesignedForm.SetPublishedBounds(AIndex, AValue);
|
||||||
|
|
||||||
|
if LookupRoot <> nil then
|
||||||
|
with LookupRoot as TControl do
|
||||||
|
case AIndex of
|
||||||
|
0: Left := AValue;
|
||||||
|
1: Top := AValue;
|
||||||
|
2: Width := AValue;
|
||||||
|
3: Height := AValue;
|
||||||
|
end;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
constructor TFakeCustomFrame.Create(AOwner: TComponent;
|
constructor TFakeCustomFrame.Create(AOwner: TComponent;
|
||||||
@ -417,7 +426,7 @@ end;
|
|||||||
function TFakeCustomNonControl.GetDesignedForm: TDesignedFormImpl;
|
function TFakeCustomNonControl.GetDesignedForm: TDesignedFormImpl;
|
||||||
begin
|
begin
|
||||||
if not Assigned(FDesignedForm) then
|
if not Assigned(FDesignedForm) then
|
||||||
FDesignedForm := TDesignedNonControlFormImpl.Create(Self);
|
FDesignedForm := TDesignedNonControlFormImpl.Create(Self,Self);
|
||||||
|
|
||||||
Result := FDesignedForm;
|
Result := FDesignedForm;
|
||||||
end;
|
end;
|
||||||
@ -582,7 +591,7 @@ end;
|
|||||||
function TFakeCustomForm.GetDesignedForm: TDesignedFormImpl;
|
function TFakeCustomForm.GetDesignedForm: TDesignedFormImpl;
|
||||||
begin
|
begin
|
||||||
if not Assigned(FDesignedForm) then
|
if not Assigned(FDesignedForm) then
|
||||||
FDesignedForm := TDesignedFormImpl.Create(Self);
|
FDesignedForm := TDesignedFormImpl.Create(Self,Self);
|
||||||
|
|
||||||
Result := FDesignedForm;
|
Result := FDesignedForm;
|
||||||
end;
|
end;
|
||||||
@ -713,7 +722,7 @@ end;
|
|||||||
|
|
||||||
procedure TDesignedFormImpl.BeginUpdate;
|
procedure TDesignedFormImpl.BeginUpdate;
|
||||||
begin
|
begin
|
||||||
TFormAccess(FOwner).SetDesigning(False, False);
|
TFormAccess(FForm).SetDesigning(False, False);
|
||||||
inherited BeginUpdate;
|
inherited BeginUpdate;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
@ -721,10 +730,10 @@ procedure TDesignedFormImpl.EndUpdate(AModified: Boolean);
|
|||||||
var
|
var
|
||||||
OI: TObjectInspectorDlg;
|
OI: TObjectInspectorDlg;
|
||||||
begin
|
begin
|
||||||
TFormAccess(FOwner).SetDesigning(True, False);
|
TFormAccess(FForm).SetDesigning(True, False);
|
||||||
inherited EndUpdate(AModified);
|
inherited EndUpdate(AModified);
|
||||||
if AModified and (FormEditingHook <> nil)
|
if AModified and (FormEditingHook <> nil)
|
||||||
and (FormEditingHook.GetCurrentDesigner = FOwner.Designer) then
|
and (FormEditingHook.GetCurrentDesigner = FForm.Designer) then
|
||||||
begin
|
begin
|
||||||
OI := FormEditingHook.GetCurrentObjectInspector;
|
OI := FormEditingHook.GetCurrentObjectInspector;
|
||||||
if Assigned(OI) then
|
if Assigned(OI) then
|
||||||
|
|||||||
@ -25,7 +25,8 @@ uses
|
|||||||
{$ELSE}
|
{$ELSE}
|
||||||
ghashmap, sparta_HashUtils, gvector,
|
ghashmap, sparta_HashUtils, gvector,
|
||||||
{$ENDIF}
|
{$ENDIF}
|
||||||
TypInfo, LCLIntf, LCLType, LMessages, sparta_FakeForm, sparta_FakeFrame, SpartaAPI, sparta_strconsts;
|
TypInfo, LCLIntf, LCLType, LMessages, sparta_FakeForm, sparta_FakeFrame,
|
||||||
|
SpartaAPI, sparta_strconsts, sparta_FakeCustom;
|
||||||
|
|
||||||
const
|
const
|
||||||
WM_SETNOFRAME = WM_USER;
|
WM_SETNOFRAME = WM_USER;
|
||||||
@ -52,6 +53,7 @@ type
|
|||||||
|
|
||||||
procedure SetPopupParent(AVal: TSourceEditorWindowInterface);
|
procedure SetPopupParent(AVal: TSourceEditorWindowInterface);
|
||||||
procedure DoAddForm;
|
procedure DoAddForm;
|
||||||
|
procedure FormChangeBounds(Sender: TObject);
|
||||||
public
|
public
|
||||||
{$IFDEF USE_GENERICS_COLLECTIONS}
|
{$IFDEF USE_GENERICS_COLLECTIONS}
|
||||||
class var AddFormEvents: TList<TNotifyEvent>;
|
class var AddFormEvents: TList<TNotifyEvent>;
|
||||||
@ -120,6 +122,7 @@ type
|
|||||||
constructor Create(AForm: TSourceEditorWindowInterface);
|
constructor Create(AForm: TSourceEditorWindowInterface);
|
||||||
destructor Destroy; override;
|
destructor Destroy; override;
|
||||||
property ActiveDesignFormData: TDesignFormData read FActiveDesignFormData write SetActiveDesignFormData;
|
property ActiveDesignFormData: TDesignFormData read FActiveDesignFormData write SetActiveDesignFormData;
|
||||||
|
procedure BoundToDesignTabSheet;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
{ TDTXTabMaster }
|
{ TDTXTabMaster }
|
||||||
@ -472,7 +475,7 @@ begin
|
|||||||
// during docking, form position was in wrong place... we need to delay changing position :)
|
// during docking, form position was in wrong place... we need to delay changing position :)
|
||||||
if TheMessage.msg = WM_BoundToDesignTabSheet then
|
if TheMessage.msg = WM_BoundToDesignTabSheet then
|
||||||
if Form.LastActiveSourceWindow <> nil then
|
if Form.LastActiveSourceWindow <> nil then
|
||||||
SourceEditorWindows[Form.LastActiveSourceWindow].OnChangeBounds(nil);
|
SourceEditorWindows[Form.LastActiveSourceWindow].BoundToDesignTabSheet;
|
||||||
|
|
||||||
// we need to correct ActiveEditor to right form
|
// we need to correct ActiveEditor to right form
|
||||||
// this code works correctly on Windows platform
|
// this code works correctly on Windows platform
|
||||||
@ -554,9 +557,17 @@ begin
|
|||||||
|
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
procedure TDesignFormData.FormChangeBounds(Sender: TObject);
|
||||||
|
begin
|
||||||
|
if not FForm.Update then
|
||||||
|
PostMessage(FForm.Form.Handle, WM_BoundToDesignTabSheet, 0, 0);
|
||||||
|
end;
|
||||||
|
|
||||||
constructor TDesignFormData.Create(AForm: TCustomForm);
|
constructor TDesignFormData.Create(AForm: TCustomForm);
|
||||||
begin
|
begin
|
||||||
FForm := AForm as IDesignedFormIDE;
|
FForm := TDesignedFormImpl.Create(Self, AForm);
|
||||||
|
|
||||||
|
AForm.AddHandlerOnChangeBounds(FormChangeBounds);
|
||||||
|
|
||||||
FLastScreenshot := TBitmap.Create;
|
FLastScreenshot := TBitmap.Create;
|
||||||
FWndMethod := FForm.Form.WindowProc;
|
FWndMethod := FForm.Form.WindowProc;
|
||||||
@ -670,14 +681,14 @@ begin
|
|||||||
if (AValue <> nil) then
|
if (AValue <> nil) then
|
||||||
begin
|
begin
|
||||||
with AValue as IDesignedForm do
|
with AValue as IDesignedForm do
|
||||||
if not AValue.FHiding and (RealBorderStyle <> bsNone) then
|
{if not AValue.FHiding and (RealBorderStyle <> bsNone) then
|
||||||
begin
|
begin
|
||||||
BeginUpdate;
|
//BeginUpdate;
|
||||||
//RealBorderIcons := [];
|
//RealBorderIcons := [];
|
||||||
//RealBorderStyle := bsNone;
|
//RealBorderStyle := bsNone;
|
||||||
Form.Show;
|
//Form.Show;
|
||||||
EndUpdate;
|
//EndUpdate;
|
||||||
end;
|
end;}
|
||||||
// important when we want back to tab where was oppened form :<
|
// important when we want back to tab where was oppened form :<
|
||||||
LazarusIDE.DoShowDesignerFormOfSrc(FForm.ActiveEditor);
|
LazarusIDE.DoShowDesignerFormOfSrc(FForm.ActiveEditor);
|
||||||
end;
|
end;
|
||||||
@ -715,13 +726,22 @@ begin
|
|||||||
inherited Destroy;
|
inherited Destroy;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
procedure TSourceEditorWindowData.OnChangeBounds(Sender: TObject);
|
procedure TSourceEditorWindowData.BoundToDesignTabSheet;
|
||||||
var
|
var
|
||||||
LPageCtrl: TModulePageControl;
|
LPageCtrl: TModulePageControl;
|
||||||
begin
|
begin
|
||||||
LPageCtrl := FindModulePageControl(FForm);
|
LPageCtrl := FindModulePageControl(FForm);
|
||||||
if LPageCtrl <> nil then
|
if LPageCtrl <> nil then
|
||||||
//LPageCtrl.BoundToDesignTabSheet;
|
LPageCtrl.BoundToDesignTabSheet;
|
||||||
|
end;
|
||||||
|
|
||||||
|
procedure TSourceEditorWindowData.OnChangeBounds(Sender: TObject);
|
||||||
|
//var
|
||||||
|
// LPageCtrl: TModulePageControl;
|
||||||
|
begin
|
||||||
|
// LPageCtrl := FindModulePageControl(FForm);
|
||||||
|
// if LPageCtrl <> nil then
|
||||||
|
// LPageCtrl.BoundToDesignTabSheet;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
procedure TSourceEditorWindowData.AddPageCtrl(ASrcEditor: TSourceEditorInterface; APage: TModulePageControl);
|
procedure TSourceEditorWindowData.AddPageCtrl(ASrcEditor: TSourceEditorInterface; APage: TModulePageControl);
|
||||||
@ -1205,13 +1225,13 @@ begin
|
|||||||
|
|
||||||
// for lfm edition...
|
// for lfm edition...
|
||||||
with LDesignFormData as IDesignedForm do
|
with LDesignFormData as IDesignedForm do
|
||||||
if not LDesignFormData.FHiding and (RealBorderStyle <> bsNone) then
|
if not LDesignFormData.FHiding {and (RealBorderStyle <> bsNone)} then
|
||||||
begin
|
begin
|
||||||
BeginUpdate;
|
//BeginUpdate;
|
||||||
//RealBorderIcons := [];
|
//RealBorderIcons := [];
|
||||||
//RealBorderStyle := bsNone;
|
//RealBorderStyle := bsNone;
|
||||||
Form.Show;
|
//Form.Show;
|
||||||
EndUpdate;
|
//EndUpdate;
|
||||||
LPageCtrl.BoundToDesignTabSheet;
|
LPageCtrl.BoundToDesignTabSheet;
|
||||||
|
|
||||||
PostMessage(Form.Handle, WM_BoundToDesignTabSheet, 0, 0);
|
PostMessage(Form.Handle, WM_BoundToDesignTabSheet, 0, 0);
|
||||||
@ -1484,7 +1504,7 @@ begin
|
|||||||
//PostMessage(LWindow.Handle, WM_BoundToDesignTabSheet, 0, 0);
|
//PostMessage(LWindow.Handle, WM_BoundToDesignTabSheet, 0, 0);
|
||||||
if LDesignForm <> nil then
|
if LDesignForm <> nil then
|
||||||
begin
|
begin
|
||||||
LDesignForm.Form.Form.Parent := FindModulePageControl(LWindow).Resizer.ActiveResizeFrame.ClientPanel;
|
LDesignForm.Form.Form.Parent := FindModulePageControl(LWindow).Resizer.ActiveResizeFrame.FormHandler;
|
||||||
PostMessage(LDesignForm.Form.Form.Handle, WM_BoundToDesignTabSheet, 0, 0);
|
PostMessage(LDesignForm.Form.Form.Handle, WM_BoundToDesignTabSheet, 0, 0);
|
||||||
end;
|
end;
|
||||||
end;
|
end;
|
||||||
|
|||||||
@ -28,11 +28,11 @@ implementation
|
|||||||
|
|
||||||
procedure Register;
|
procedure Register;
|
||||||
begin
|
begin
|
||||||
FormEditingHook.StandardDesignerBaseClasses[DesignerBaseClassId_TForm] := TFakeForm;
|
//FormEditingHook.StandardDesignerBaseClasses[DesignerBaseClassId_TForm] := TFakeForm;
|
||||||
FormEditingHook.StandardDesignerBaseClasses[DesignerBaseClassId_TFrame] := THookFrame;
|
//FormEditingHook.StandardDesignerBaseClasses[DesignerBaseClassId_TFrame] := THookFrame;
|
||||||
|
|
||||||
FormEditingHook.NonFormProxyDesignerForm[NonControlProxyDesignerFormId] := TFakeNonControl;
|
//FormEditingHook.NonFormProxyDesignerForm[NonControlProxyDesignerFormId] := TFakeNonControl;
|
||||||
FormEditingHook.NonFormProxyDesignerForm[FrameProxyDesignerFormId] := TFakeFrame;
|
//FormEditingHook.NonFormProxyDesignerForm[FrameProxyDesignerFormId] := TFakeFrame;
|
||||||
|
|
||||||
Screen.AddHandlerFormAdded(TSpartaMainIDE.Screen_FormAdded);
|
Screen.AddHandlerFormAdded(TSpartaMainIDE.Screen_FormAdded);
|
||||||
Screen.AddHandlerRemoveForm(TSpartaMainIDE.Screen_FormDel);
|
Screen.AddHandlerRemoveForm(TSpartaMainIDE.Screen_FormDel);
|
||||||
|
|||||||
@ -210,7 +210,7 @@ var
|
|||||||
LForm: IDesignedForm;
|
LForm: IDesignedForm;
|
||||||
LFrame: IResizeFrame;
|
LFrame: IResizeFrame;
|
||||||
|
|
||||||
procedure Positioning;
|
(*procedure Positioning;
|
||||||
var
|
var
|
||||||
LHiddenHeight, LNewHeight: Integer;
|
LHiddenHeight, LNewHeight: Integer;
|
||||||
LHiddenWidth, LNewWidth: Integer;
|
LHiddenWidth, LNewWidth: Integer;
|
||||||
@ -225,7 +225,7 @@ var
|
|||||||
|
|
||||||
// TODO - better handling of min width - same in TDesignedFormImpl.SetPublishedBounds (sparta_FakeCustom.pas)
|
// TODO - better handling of min width - same in TDesignedFormImpl.SetPublishedBounds (sparta_FakeCustom.pas)
|
||||||
|
|
||||||
LNewWidth := LFrame.ClientPanel.Width + LHiddenWidth;
|
LNewWidth := LFrame.NewSize.X + LHiddenWidth;
|
||||||
LForm.Width := LNewWidth;
|
LForm.Width := LNewWidth;
|
||||||
LForm.RealWidth := LNewWidth;
|
LForm.RealWidth := LNewWidth;
|
||||||
|
|
||||||
@ -244,7 +244,7 @@ var
|
|||||||
if LHiddenHeight > LFrame.DesignedHeightToScroll then
|
if LHiddenHeight > LFrame.DesignedHeightToScroll then
|
||||||
LHiddenHeight := LFrame.DesignedHeightToScroll;
|
LHiddenHeight := LFrame.DesignedHeightToScroll;
|
||||||
|
|
||||||
LNewHeight := LFrame.ClientPanel.Height + LHiddenHeight;
|
LNewHeight := LFrame.NewSize.Y+ LHiddenHeight;
|
||||||
LForm.Height := LNewHeight;
|
LForm.Height := LNewHeight;
|
||||||
LForm.RealHeight := LNewHeight;
|
LForm.RealHeight := LNewHeight;
|
||||||
|
|
||||||
@ -258,11 +258,27 @@ var
|
|||||||
end;
|
end;
|
||||||
|
|
||||||
LForm.EndUpdate;
|
LForm.EndUpdate;
|
||||||
end;
|
end;*)
|
||||||
|
|
||||||
procedure PositioningEnd;
|
procedure PositioningEnd;
|
||||||
|
var
|
||||||
|
LHiddenHeight, LNewHeight: Integer;
|
||||||
|
LHiddenWidth, LNewWidth: Integer;
|
||||||
begin
|
begin
|
||||||
TryBoundSizerToDesignedForm(nil);
|
LHiddenWidth := sbH.Position;
|
||||||
|
if LHiddenWidth > LFrame.DesignedWidthToScroll then
|
||||||
|
LHiddenWidth := LFrame.DesignedWidthToScroll;
|
||||||
|
|
||||||
|
LNewWidth := LFrame.NewSize.X + LHiddenWidth;
|
||||||
|
|
||||||
|
LHiddenHeight := sbV.Position;
|
||||||
|
if LHiddenHeight > LFrame.DesignedHeightToScroll then
|
||||||
|
LHiddenHeight := LFrame.DesignedHeightToScroll;
|
||||||
|
|
||||||
|
LNewHeight := LFrame.NewSize.Y + LHiddenHeight;
|
||||||
|
|
||||||
|
LForm.Form.Width := LNewWidth;
|
||||||
|
LForm.Form.Height := LNewHeight;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
begin
|
begin
|
||||||
@ -271,7 +287,7 @@ begin
|
|||||||
|
|
||||||
case PositioningCode of
|
case PositioningCode of
|
||||||
pcPositioningEnd: PositioningEnd;
|
pcPositioningEnd: PositioningEnd;
|
||||||
pcPositioning: Positioning;
|
//pcPositioning: Positioning;
|
||||||
end;
|
end;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
|||||||
@ -9,6 +9,9 @@ uses
|
|||||||
LCLType, sparta_FormBackgroundForMDI;
|
LCLType, sparta_FormBackgroundForMDI;
|
||||||
|
|
||||||
type
|
type
|
||||||
|
|
||||||
|
{ TFormImpl }
|
||||||
|
|
||||||
TFormImpl = class(TComponent, IDesignedRealFormHelper, IDesignedForm)
|
TFormImpl = class(TComponent, IDesignedRealFormHelper, IDesignedForm)
|
||||||
private
|
private
|
||||||
FDesignedRealForm: IDesignedRealForm;
|
FDesignedRealForm: IDesignedRealForm;
|
||||||
@ -24,7 +27,7 @@ type
|
|||||||
function GetOnChangeHackedBounds: TNotifyEvent;
|
function GetOnChangeHackedBounds: TNotifyEvent;
|
||||||
function PositionDelta: TPoint;
|
function PositionDelta: TPoint;
|
||||||
protected
|
protected
|
||||||
FOwner: TCustomForm;
|
FForm: TCustomForm;
|
||||||
FUpdate: boolean;
|
FUpdate: boolean;
|
||||||
protected
|
protected
|
||||||
function GetRealBounds(AIndex: Integer): Integer; virtual;
|
function GetRealBounds(AIndex: Integer): Integer; virtual;
|
||||||
@ -66,7 +69,7 @@ type
|
|||||||
property RealBorderIcons: TBorderIcons read GetRealBorderIcons write SetRealBorderIcons;
|
property RealBorderIcons: TBorderIcons read GetRealBorderIcons write SetRealBorderIcons;
|
||||||
property RealFormStyle: TFormStyle read GetRealFormStyle write SetRealFormStyle;
|
property RealFormStyle: TFormStyle read GetRealFormStyle write SetRealFormStyle;
|
||||||
|
|
||||||
constructor Create(AOwner: TCustomForm); virtual;
|
constructor Create(AOwner: TComponent; AForm: TCustomForm); virtual; reintroduce;
|
||||||
destructor Destroy; override;
|
destructor Destroy; override;
|
||||||
|
|
||||||
procedure BeginUpdate; virtual;
|
procedure BeginUpdate; virtual;
|
||||||
@ -141,11 +144,17 @@ type
|
|||||||
function TFormImpl.GetPublishedBounds(AIndex: Integer): Integer;
|
function TFormImpl.GetPublishedBounds(AIndex: Integer): Integer;
|
||||||
begin
|
begin
|
||||||
case AIndex of
|
case AIndex of
|
||||||
0: Result := FHackLeft;
|
0: Result := FForm.Left;
|
||||||
1: Result := FHackTop;
|
1: Result := FForm.Top;
|
||||||
2: Result := FHackWidth;
|
2: Result := FForm.Width;
|
||||||
3: Result := FHackHeight;
|
3: Result := FForm.Height;
|
||||||
end;
|
end;
|
||||||
|
//case AIndex of
|
||||||
|
// 0: Result := FHackLeft;
|
||||||
|
// 1: Result := FHackTop;
|
||||||
|
// 2: Result := FHackWidth;
|
||||||
|
// 3: Result := FHackHeight;
|
||||||
|
//end;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
procedure TFormImpl.SetPublishedBounds(AIndex: Integer; AValue: Integer);
|
procedure TFormImpl.SetPublishedBounds(AIndex: Integer; AValue: Integer);
|
||||||
@ -177,7 +186,15 @@ end;
|
|||||||
|
|
||||||
function TFormImpl.GetRealBounds(AIndex: Integer): Integer;
|
function TFormImpl.GetRealBounds(AIndex: Integer): Integer;
|
||||||
begin
|
begin
|
||||||
Result := FDesignedRealForm.GetRealBounds(AIndex);
|
case AIndex of
|
||||||
|
0: Result := FForm.Left;
|
||||||
|
1: Result := FForm.Top;
|
||||||
|
2: Result := FForm.Width;
|
||||||
|
3: Result := FForm.Height;
|
||||||
|
end;
|
||||||
|
|
||||||
|
//FForm.;
|
||||||
|
//Result := 0;// FDesignedRealForm.GetRealBounds(AIndex);
|
||||||
end;
|
end;
|
||||||
|
|
||||||
procedure TFormImpl.SetRealBounds(AIndex: Integer; AValue: Integer);
|
procedure TFormImpl.SetRealBounds(AIndex: Integer; AValue: Integer);
|
||||||
@ -206,67 +223,67 @@ procedure TFormImpl.SetRealBounds(AIndex: Integer; AValue: Integer);
|
|||||||
end;
|
end;
|
||||||
|
|
||||||
begin
|
begin
|
||||||
FDesignedRealForm.SetRealBounds(AIndex, AValue);
|
{FDesignedRealForm.SetRealBounds(AIndex, AValue);
|
||||||
|
|
||||||
if AIndex = 2 then
|
if AIndex = 2 then
|
||||||
AdjustSize;
|
AdjustSize;}
|
||||||
end;
|
end;
|
||||||
|
|
||||||
procedure TFormImpl.SetRealBorderStyle(AVal: TFormBorderStyle);
|
procedure TFormImpl.SetRealBorderStyle(AVal: TFormBorderStyle);
|
||||||
begin
|
begin
|
||||||
FDesignedRealForm.SetRealBorderStyle(AVal);
|
//FDesignedRealForm.SetRealBorderStyle(AVal);
|
||||||
end;
|
end;
|
||||||
|
|
||||||
procedure TFormImpl.SetRealBorderIcons(AVal: TBorderIcons);
|
procedure TFormImpl.SetRealBorderIcons(AVal: TBorderIcons);
|
||||||
begin
|
begin
|
||||||
FDesignedRealForm.SetRealBorderIcons(AVal);
|
//FDesignedRealForm.SetRealBorderIcons(AVal);
|
||||||
end;
|
end;
|
||||||
|
|
||||||
procedure TFormImpl.SetRealFormStyle(AVal: TFormStyle);
|
procedure TFormImpl.SetRealFormStyle(AVal: TFormStyle);
|
||||||
begin
|
begin
|
||||||
FDesignedRealForm.SetRealFormStyle(AVal);
|
//FDesignedRealForm.SetRealFormStyle(AVal);
|
||||||
end;
|
end;
|
||||||
|
|
||||||
procedure TFormImpl.SetRealPopupMode(AVal: TPopupMode);
|
procedure TFormImpl.SetRealPopupMode(AVal: TPopupMode);
|
||||||
begin
|
begin
|
||||||
FDesignedRealForm.SetRealPopupMode(AVal);
|
//FDesignedRealForm.SetRealPopupMode(AVal);
|
||||||
end;
|
end;
|
||||||
|
|
||||||
procedure TFormImpl.SetRealPopupParent(AVal: TCustomForm);
|
procedure TFormImpl.SetRealPopupParent(AVal: TCustomForm);
|
||||||
begin
|
begin
|
||||||
FDesignedRealForm.SetRealPopupParent(AVal);
|
//FDesignedRealForm.SetRealPopupParent(AVal);
|
||||||
end;
|
end;
|
||||||
|
|
||||||
function TFormImpl.GetRealBorderStyle: TFormBorderStyle;
|
function TFormImpl.GetRealBorderStyle: TFormBorderStyle;
|
||||||
begin
|
begin
|
||||||
Result := FDesignedRealForm.GetRealBorderStyle;
|
Result := bsNone;//FDesignedRealForm.GetRealBorderStyle;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
function TFormImpl.GetRealBorderIcons: TBorderIcons;
|
function TFormImpl.GetRealBorderIcons: TBorderIcons;
|
||||||
begin
|
begin
|
||||||
Result := FDesignedRealForm.GetRealBorderIcons;
|
Result := [];//FDesignedRealForm.GetRealBorderIcons;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
function TFormImpl.GetRealFormStyle: TFormStyle;
|
function TFormImpl.GetRealFormStyle: TFormStyle;
|
||||||
begin
|
begin
|
||||||
Result := FDesignedRealForm.GetRealFormStyle;
|
Result := fsNormal;//FDesignedRealForm.GetRealFormStyle;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
function TFormImpl.GetRealPopupMode: TPopupMode;
|
function TFormImpl.GetRealPopupMode: TPopupMode;
|
||||||
begin
|
begin
|
||||||
Result := FDesignedRealForm.GetRealPopupMode;
|
Result := pmNone//FDesignedRealForm.GetRealPopupMode;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
function TFormImpl.GetRealPopupParent: TCustomForm;
|
function TFormImpl.GetRealPopupParent: TCustomForm;
|
||||||
begin
|
begin
|
||||||
Result := FDesignedRealForm.GetRealPopupParent;
|
Result := nil//FDesignedRealForm.GetRealPopupParent;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
//////
|
//////
|
||||||
|
|
||||||
function TFormImpl.GetForm: TCustomForm;
|
function TFormImpl.GetForm: TCustomForm;
|
||||||
begin
|
begin
|
||||||
Result := FOwner;
|
Result := FForm;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
function TFormImpl.GetUpdate: Boolean;
|
function TFormImpl.GetUpdate: Boolean;
|
||||||
@ -319,12 +336,12 @@ end;
|
|||||||
|
|
||||||
function TFormImpl.GetHorzScrollPosition: Integer;
|
function TFormImpl.GetHorzScrollPosition: Integer;
|
||||||
begin
|
begin
|
||||||
Result := -(RealLeft + PositionDelta.x);
|
Result := -(RealLeft {+ PositionDelta.x});
|
||||||
end;
|
end;
|
||||||
|
|
||||||
function TFormImpl.GetVertScrollPosition: Integer;
|
function TFormImpl.GetVertScrollPosition: Integer;
|
||||||
begin
|
begin
|
||||||
Result := -(RealTop + PositionDelta.y);
|
Result := -(RealTop {+ PositionDelta.y});
|
||||||
end;
|
end;
|
||||||
|
|
||||||
procedure TFormImpl.BeginUpdate;
|
procedure TFormImpl.BeginUpdate;
|
||||||
@ -339,14 +356,14 @@ end;
|
|||||||
|
|
||||||
procedure TFormImpl.ShowWindow;
|
procedure TFormImpl.ShowWindow;
|
||||||
begin
|
begin
|
||||||
if FOwner.Parent = nil then
|
if FForm.Parent = nil then
|
||||||
LCLIntf.ShowWindow(FOwner.Handle, SW_SHOW);
|
LCLIntf.ShowWindow(FForm.Handle, SW_SHOW);
|
||||||
end;
|
end;
|
||||||
|
|
||||||
procedure TFormImpl.HideWindow;
|
procedure TFormImpl.HideWindow;
|
||||||
begin
|
begin
|
||||||
if FOwner.Parent = nil then
|
if FForm.Parent = nil then
|
||||||
LCLIntf.ShowWindow(FOwner.Handle, SW_HIDE);
|
LCLIntf.ShowWindow(FForm.Handle, SW_HIDE);
|
||||||
end;
|
end;
|
||||||
|
|
||||||
function TFormImpl.QueryInterface(constref IID: TGUID; out Obj
|
function TFormImpl.QueryInterface(constref IID: TGUID; out Obj
|
||||||
@ -354,13 +371,13 @@ function TFormImpl.QueryInterface(constref IID: TGUID; out Obj
|
|||||||
begin
|
begin
|
||||||
Result := inherited QueryInterface(IID, Obj);
|
Result := inherited QueryInterface(IID, Obj);
|
||||||
if Result <> S_OK then
|
if Result <> S_OK then
|
||||||
Result := TFormAccess(FOwner).QueryInterface(IID, Obj);
|
Result := TFormAccess(FForm).QueryInterface(IID, Obj);
|
||||||
end;
|
end;
|
||||||
|
|
||||||
procedure TFormImpl.DoChangeHackedBounds;
|
procedure TFormImpl.DoChangeHackedBounds;
|
||||||
begin
|
begin
|
||||||
if not FUpdate and Assigned(FOnChangeHackedBounds) then
|
if not FUpdate and Assigned(FOnChangeHackedBounds) then
|
||||||
FOnChangeHackedBounds(FOwner);
|
FOnChangeHackedBounds(FForm);
|
||||||
end;
|
end;
|
||||||
|
|
||||||
function TFormImpl.GetLogicalClientRect(ALogicalClientRect: TRect): TRect;
|
function TFormImpl.GetLogicalClientRect(ALogicalClientRect: TRect): TRect;
|
||||||
@ -368,10 +385,11 @@ begin
|
|||||||
Result:=ALogicalClientRect;
|
Result:=ALogicalClientRect;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
constructor TFormImpl.Create(AOwner: TCustomForm);
|
constructor TFormImpl.Create(AOwner: TComponent; AForm: TCustomForm);
|
||||||
begin
|
begin
|
||||||
FOwner := AOwner;
|
inherited Create(AOwner);
|
||||||
FDesignedRealForm := FOwner as IDesignedRealForm;
|
FForm := AForm;
|
||||||
|
FDesignedRealForm := Self as IDesignedRealForm;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
destructor TFormImpl.Destroy;
|
destructor TFormImpl.Destroy;
|
||||||
@ -385,7 +403,7 @@ end;
|
|||||||
function TFormContainer.GetDesignedForm: TFormImpl;
|
function TFormContainer.GetDesignedForm: TFormImpl;
|
||||||
begin
|
begin
|
||||||
if not Assigned(FDesignedForm) then
|
if not Assigned(FDesignedForm) then
|
||||||
FDesignedForm := TFormImpl.Create(Self);
|
FDesignedForm := TFormImpl.Create(Self, Self);
|
||||||
|
|
||||||
Result := FDesignedForm;
|
Result := FDesignedForm;
|
||||||
end;
|
end;
|
||||||
|
|||||||
@ -1,24 +1,28 @@
|
|||||||
object BasicResizeFrame: TBasicResizeFrame
|
object BasicResizeFrame: TBasicResizeFrame
|
||||||
Left = 0
|
Left = 0
|
||||||
Height = 460
|
Height = 690
|
||||||
Top = 0
|
Top = 0
|
||||||
Width = 320
|
Width = 480
|
||||||
ClientHeight = 460
|
ClientHeight = 690
|
||||||
ClientWidth = 320
|
ClientWidth = 480
|
||||||
Color = clDefault
|
Color = clDefault
|
||||||
ParentColor = True
|
ParentColor = True
|
||||||
|
DesignTimePPI = 144
|
||||||
|
ParentFont = False
|
||||||
TabOrder = 0
|
TabOrder = 0
|
||||||
|
DesignLeft = 789
|
||||||
|
DesignTop = 488
|
||||||
object pR: TPanel
|
object pR: TPanel
|
||||||
AnchorSideTop.Control = Owner
|
AnchorSideTop.Control = Owner
|
||||||
Cursor = crSizeWE
|
Cursor = crSizeWE
|
||||||
Left = 295
|
Left = 446
|
||||||
Height = 443
|
Height = 664
|
||||||
Top = 0
|
Top = 166
|
||||||
Width = 8
|
Width = 12
|
||||||
Anchors = []
|
Anchors = []
|
||||||
BevelOuter = bvNone
|
BevelOuter = bvNone
|
||||||
ClientHeight = 443
|
ClientHeight = 664
|
||||||
ClientWidth = 8
|
ClientWidth = 12
|
||||||
Color = clNone
|
Color = clNone
|
||||||
ParentColor = False
|
ParentColor = False
|
||||||
TabOrder = 0
|
TabOrder = 0
|
||||||
@ -28,12 +32,12 @@ object BasicResizeFrame: TBasicResizeFrame
|
|||||||
AnchorSideBottom.Control = pR
|
AnchorSideBottom.Control = pR
|
||||||
AnchorSideBottom.Side = asrBottom
|
AnchorSideBottom.Side = asrBottom
|
||||||
Left = 0
|
Left = 0
|
||||||
Height = 429
|
Height = 644
|
||||||
Top = 7
|
Top = 10
|
||||||
Width = 1
|
Width = 2
|
||||||
Anchors = [akTop, akLeft, akBottom]
|
Anchors = [akTop, akLeft, akBottom]
|
||||||
BorderSpacing.Top = 7
|
BorderSpacing.Top = 10
|
||||||
BorderSpacing.Bottom = 7
|
BorderSpacing.Bottom = 10
|
||||||
BevelOuter = bvNone
|
BevelOuter = bvNone
|
||||||
Color = clWhite
|
Color = clWhite
|
||||||
ParentColor = False
|
ParentColor = False
|
||||||
@ -44,13 +48,13 @@ object BasicResizeFrame: TBasicResizeFrame
|
|||||||
AnchorSideLeft.Control = Owner
|
AnchorSideLeft.Control = Owner
|
||||||
Cursor = crSizeNS
|
Cursor = crSizeNS
|
||||||
Left = 0
|
Left = 0
|
||||||
Height = 8
|
Height = 12
|
||||||
Top = 435
|
Top = 656
|
||||||
Width = 303
|
Width = 454
|
||||||
Anchors = [akLeft, akRight]
|
Anchors = [akLeft, akRight]
|
||||||
BevelOuter = bvNone
|
BevelOuter = bvNone
|
||||||
ClientHeight = 8
|
ClientHeight = 12
|
||||||
ClientWidth = 303
|
ClientWidth = 454
|
||||||
Color = clNone
|
Color = clNone
|
||||||
ParentColor = False
|
ParentColor = False
|
||||||
TabOrder = 1
|
TabOrder = 1
|
||||||
@ -59,27 +63,27 @@ object BasicResizeFrame: TBasicResizeFrame
|
|||||||
AnchorSideTop.Control = pB
|
AnchorSideTop.Control = pB
|
||||||
AnchorSideRight.Control = pB
|
AnchorSideRight.Control = pB
|
||||||
AnchorSideRight.Side = asrBottom
|
AnchorSideRight.Side = asrBottom
|
||||||
Left = 7
|
Left = 10
|
||||||
Height = 1
|
Height = 2
|
||||||
Top = 0
|
Top = 0
|
||||||
Width = 289
|
Width = 434
|
||||||
Anchors = [akTop, akLeft, akRight]
|
Anchors = [akTop, akLeft, akRight]
|
||||||
BorderSpacing.Left = 7
|
BorderSpacing.Left = 10
|
||||||
BorderSpacing.Right = 7
|
BorderSpacing.Right = 10
|
||||||
TabOrder = 0
|
TabOrder = 0
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
object pL: TPanel
|
object pL: TPanel
|
||||||
AnchorSideLeft.Control = Owner
|
AnchorSideLeft.Control = Owner
|
||||||
AnchorSideTop.Control = Owner
|
AnchorSideTop.Control = Owner
|
||||||
Left = 0
|
Left = 3
|
||||||
Height = 443
|
Height = 664
|
||||||
Top = 0
|
Top = 166
|
||||||
Width = 8
|
Width = 12
|
||||||
Anchors = []
|
Anchors = []
|
||||||
BevelOuter = bvNone
|
BevelOuter = bvNone
|
||||||
ClientHeight = 443
|
ClientHeight = 664
|
||||||
ClientWidth = 8
|
ClientWidth = 12
|
||||||
Color = clNone
|
Color = clNone
|
||||||
ParentColor = False
|
ParentColor = False
|
||||||
TabOrder = 2
|
TabOrder = 2
|
||||||
@ -89,13 +93,13 @@ object BasicResizeFrame: TBasicResizeFrame
|
|||||||
AnchorSideRight.Side = asrBottom
|
AnchorSideRight.Side = asrBottom
|
||||||
AnchorSideBottom.Control = pL
|
AnchorSideBottom.Control = pL
|
||||||
AnchorSideBottom.Side = asrBottom
|
AnchorSideBottom.Side = asrBottom
|
||||||
Left = 7
|
Left = 10
|
||||||
Height = 429
|
Height = 644
|
||||||
Top = 7
|
Top = 10
|
||||||
Width = 1
|
Width = 2
|
||||||
Anchors = [akTop, akRight, akBottom]
|
Anchors = [akTop, akRight, akBottom]
|
||||||
BorderSpacing.Top = 7
|
BorderSpacing.Top = 10
|
||||||
BorderSpacing.Bottom = 7
|
BorderSpacing.Bottom = 10
|
||||||
BevelOuter = bvNone
|
BevelOuter = bvNone
|
||||||
Color = clWhite
|
Color = clWhite
|
||||||
ParentColor = False
|
ParentColor = False
|
||||||
@ -106,13 +110,13 @@ object BasicResizeFrame: TBasicResizeFrame
|
|||||||
AnchorSideLeft.Control = Owner
|
AnchorSideLeft.Control = Owner
|
||||||
AnchorSideTop.Control = Owner
|
AnchorSideTop.Control = Owner
|
||||||
Left = 0
|
Left = 0
|
||||||
Height = 8
|
Height = 12
|
||||||
Top = 0
|
Top = 3
|
||||||
Width = 303
|
Width = 454
|
||||||
Anchors = [akLeft, akRight]
|
Anchors = [akLeft, akRight]
|
||||||
BevelOuter = bvNone
|
BevelOuter = bvNone
|
||||||
ClientHeight = 8
|
ClientHeight = 12
|
||||||
ClientWidth = 303
|
ClientWidth = 454
|
||||||
Color = clNone
|
Color = clNone
|
||||||
ParentColor = False
|
ParentColor = False
|
||||||
TabOrder = 3
|
TabOrder = 3
|
||||||
@ -122,13 +126,13 @@ object BasicResizeFrame: TBasicResizeFrame
|
|||||||
AnchorSideRight.Side = asrBottom
|
AnchorSideRight.Side = asrBottom
|
||||||
AnchorSideBottom.Control = pT
|
AnchorSideBottom.Control = pT
|
||||||
AnchorSideBottom.Side = asrBottom
|
AnchorSideBottom.Side = asrBottom
|
||||||
Left = 7
|
Left = 10
|
||||||
Height = 1
|
Height = 2
|
||||||
Top = 7
|
Top = 10
|
||||||
Width = 289
|
Width = 434
|
||||||
Anchors = [akLeft, akRight, akBottom]
|
Anchors = [akLeft, akRight, akBottom]
|
||||||
BorderSpacing.Left = 7
|
BorderSpacing.Left = 10
|
||||||
BorderSpacing.Right = 7
|
BorderSpacing.Right = 10
|
||||||
BevelOuter = bvNone
|
BevelOuter = bvNone
|
||||||
Color = clWhite
|
Color = clWhite
|
||||||
ParentColor = False
|
ParentColor = False
|
||||||
@ -136,9 +140,9 @@ object BasicResizeFrame: TBasicResizeFrame
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
object iResizerLineImg: TImage
|
object iResizerLineImg: TImage
|
||||||
Left = 216
|
Left = 324
|
||||||
Height = 6
|
Height = 6
|
||||||
Top = 32
|
Top = 48
|
||||||
Width = 6
|
Width = 6
|
||||||
AutoSize = True
|
AutoSize = True
|
||||||
Picture.Data = {
|
Picture.Data = {
|
||||||
@ -158,16 +162,14 @@ object BasicResizeFrame: TBasicResizeFrame
|
|||||||
AnchorSideTop.Side = asrBottom
|
AnchorSideTop.Side = asrBottom
|
||||||
AnchorSideRight.Control = pR
|
AnchorSideRight.Control = pR
|
||||||
AnchorSideBottom.Control = pB
|
AnchorSideBottom.Control = pB
|
||||||
Left = 8
|
Left = 15
|
||||||
Height = 427
|
Height = 641
|
||||||
Top = 8
|
Top = 15
|
||||||
Width = 287
|
Width = 431
|
||||||
Anchors = [akTop, akLeft, akRight, akBottom]
|
Anchors = [akTop, akLeft, akRight, akBottom]
|
||||||
BevelOuter = bvNone
|
BevelOuter = bvNone
|
||||||
ClientHeight = 427
|
ClientHeight = 641
|
||||||
ClientWidth = 287
|
ClientWidth = 431
|
||||||
Color = clDefault
|
|
||||||
ParentColor = True
|
|
||||||
TabOrder = 4
|
TabOrder = 4
|
||||||
object pFakeMenu: TPanel
|
object pFakeMenu: TPanel
|
||||||
AnchorSideLeft.Control = pBG
|
AnchorSideLeft.Control = pBG
|
||||||
@ -175,9 +177,9 @@ object BasicResizeFrame: TBasicResizeFrame
|
|||||||
AnchorSideRight.Control = pBG
|
AnchorSideRight.Control = pBG
|
||||||
AnchorSideRight.Side = asrBottom
|
AnchorSideRight.Side = asrBottom
|
||||||
Left = 0
|
Left = 0
|
||||||
Height = 50
|
Height = 75
|
||||||
Top = 0
|
Top = 0
|
||||||
Width = 287
|
Width = 431
|
||||||
Anchors = [akTop, akLeft, akRight]
|
Anchors = [akTop, akLeft, akRight]
|
||||||
BevelOuter = bvNone
|
BevelOuter = bvNone
|
||||||
TabOrder = 0
|
TabOrder = 0
|
||||||
@ -192,14 +194,26 @@ object BasicResizeFrame: TBasicResizeFrame
|
|||||||
AnchorSideTop.Side = asrBottom
|
AnchorSideTop.Side = asrBottom
|
||||||
AnchorSideRight.Control = pR
|
AnchorSideRight.Control = pR
|
||||||
AnchorSideBottom.Control = pB
|
AnchorSideBottom.Control = pB
|
||||||
Left = 0
|
Left = 57
|
||||||
Height = 152
|
Height = 228
|
||||||
Top = 0
|
Top = 57
|
||||||
Width = 152
|
Width = 228
|
||||||
Anchors = []
|
Anchors = []
|
||||||
BevelOuter = bvNone
|
BevelOuter = bvNone
|
||||||
Color = clDefault
|
ClientHeight = 228
|
||||||
ParentColor = True
|
ClientWidth = 228
|
||||||
|
Color = clGreen
|
||||||
|
ParentColor = False
|
||||||
TabOrder = 5
|
TabOrder = 5
|
||||||
|
object pFormHandler: TPanel
|
||||||
|
Left = 32
|
||||||
|
Height = 50
|
||||||
|
Top = 112
|
||||||
|
Width = 170
|
||||||
|
BevelOuter = bvNone
|
||||||
|
Color = clDefault
|
||||||
|
ParentColor = False
|
||||||
|
TabOrder = 0
|
||||||
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|||||||
@ -18,6 +18,7 @@ type
|
|||||||
TResizerFrameClass = class of TBasicResizeFrame;
|
TResizerFrameClass = class of TBasicResizeFrame;
|
||||||
TBasicResizeFrame = class(TFrame, IResizeFrame)
|
TBasicResizeFrame = class(TFrame, IResizeFrame)
|
||||||
iResizerLineImg: TImage;
|
iResizerLineImg: TImage;
|
||||||
|
pFormHandler: TPanel;
|
||||||
pFakeMenu: TPanel;
|
pFakeMenu: TPanel;
|
||||||
pBG: TPanel;
|
pBG: TPanel;
|
||||||
pB: TPanel;
|
pB: TPanel;
|
||||||
@ -59,6 +60,7 @@ type
|
|||||||
FPositioningKind: TPositioningKind;
|
FPositioningKind: TPositioningKind;
|
||||||
FMaxWidth, FMaxHeight: Integer;
|
FMaxWidth, FMaxHeight: Integer;
|
||||||
FLastClientWidth, FLastClientHeight: Integer;
|
FLastClientWidth, FLastClientHeight: Integer;
|
||||||
|
FLastDesignedWidthToScroll, FLastDesignedHeightToScroll: Integer;
|
||||||
FOldHasMainMenu: Boolean;
|
FOldHasMainMenu: Boolean;
|
||||||
FDesignerModified: Boolean;
|
FDesignerModified: Boolean;
|
||||||
FSizerLineWidth: Integer;
|
FSizerLineWidth: Integer;
|
||||||
@ -92,6 +94,8 @@ type
|
|||||||
function LeftSizerLineWidth: Integer;
|
function LeftSizerLineWidth: Integer;
|
||||||
function HorizontalSizerLineLength: Integer;
|
function HorizontalSizerLineLength: Integer;
|
||||||
|
|
||||||
|
procedure AdjustFormHandler;
|
||||||
|
|
||||||
function GetMenuHeight: Integer;
|
function GetMenuHeight: Integer;
|
||||||
protected
|
protected
|
||||||
FNodes: TObjectList;
|
FNodes: TObjectList;
|
||||||
@ -116,7 +120,8 @@ type
|
|||||||
function GetBackgroundPanel: TPanel;
|
function GetBackgroundPanel: TPanel;
|
||||||
function GetBackgroundMargin(const AIndex: Integer): Integer;
|
function GetBackgroundMargin(const AIndex: Integer): Integer;
|
||||||
|
|
||||||
function GetClientPanel: TPanel;
|
function GetNewSize: TPoint;
|
||||||
|
function GetFormHandler: TPanel;
|
||||||
function GetNodePositioning: Boolean;
|
function GetNodePositioning: Boolean;
|
||||||
function GetDesignedForm: IDesignedForm;
|
function GetDesignedForm: IDesignedForm;
|
||||||
procedure SetDesignedForm(const AValue: IDesignedForm);
|
procedure SetDesignedForm(const AValue: IDesignedForm);
|
||||||
@ -436,6 +441,7 @@ begin
|
|||||||
if (Enabled) and (Sender is TWinControl) then
|
if (Enabled) and (Sender is TWinControl) then
|
||||||
begin
|
begin
|
||||||
FNodePositioning:=True;
|
FNodePositioning:=True;
|
||||||
|
BeginFormSizeUpdate(Sender);
|
||||||
|
|
||||||
// when we start resizing the rules do not apply to us :)
|
// when we start resizing the rules do not apply to us :)
|
||||||
FMaxWidth := Constraints.MaxWidth;
|
FMaxWidth := Constraints.MaxWidth;
|
||||||
@ -459,7 +465,6 @@ begin
|
|||||||
BorderSpacing.Bottom := Max(Self.Height - (pB.Top - BgBottomMargin), 0);
|
BorderSpacing.Bottom := Max(Self.Height - (pB.Top - BgBottomMargin), 0);
|
||||||
end;
|
end;
|
||||||
|
|
||||||
BeginFormSizeUpdate(Sender);
|
|
||||||
|
|
||||||
{$IF Defined(LCLWin32) or Defined(LCLWin64)}
|
{$IF Defined(LCLWin32) or Defined(LCLWin64)}
|
||||||
SetCapture(TWinControl(Sender).Handle);
|
SetCapture(TWinControl(Sender).Handle);
|
||||||
@ -619,6 +624,7 @@ begin
|
|||||||
if Assigned(OnNodePositioning) then
|
if Assigned(OnNodePositioning) then
|
||||||
OnNodePositioning(Sender, FPositioningKind, pcPositioningEnd);
|
OnNodePositioning(Sender, FPositioningKind, pcPositioningEnd);
|
||||||
FPositioningKind := [];
|
FPositioningKind := [];
|
||||||
|
FNodePositioning := False;
|
||||||
|
|
||||||
pClient.Align := alNone;
|
pClient.Align := alNone;
|
||||||
BorderSpacing.Left := 0;
|
BorderSpacing.Left := 0;
|
||||||
@ -632,6 +638,10 @@ begin
|
|||||||
// after resizing, TFrame is frozen in Windows OS
|
// after resizing, TFrame is frozen in Windows OS
|
||||||
// this is trick to workaraund IDE bug. Also for proper size for normal form
|
// this is trick to workaraund IDE bug. Also for proper size for normal form
|
||||||
TryBoundDesignedForm;
|
TryBoundDesignedForm;
|
||||||
|
// for small resizes, designed form is moved on the top and on the bottom
|
||||||
|
// is showed white block - to stop this we need to move pClient to right position
|
||||||
|
PositionNodes;
|
||||||
|
ShowSizeControls;
|
||||||
end;
|
end;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
@ -725,6 +735,14 @@ begin
|
|||||||
Result := Width - RightMargin;
|
Result := Width - RightMargin;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
procedure TBasicResizeFrame.AdjustFormHandler;
|
||||||
|
begin
|
||||||
|
pFormHandler.Left:=(-FDesignedForm.Form.Left)-(FDesignedForm.PositionDelta.x+ifthen(FHorizontalScrollPos-SizerLineWidth>0,FHorizontalScrollPos-SizerLineWidth,0));
|
||||||
|
pFormHandler.Top:=(-FDesignedForm.Form.Top)-(FDesignedForm.PositionDelta.y+ifthen(FVerticalScrollPos-SizerLineWidth>0,FVerticalScrollPos-SizerLineWidth,0));
|
||||||
|
pFormHandler.Width:=(FDesignedForm.Form.Width+abs(FDesignedForm.Form.Left)+FDesignedForm.PositionDelta.x);;
|
||||||
|
pFormHandler.Height:=(FDesignedForm.Form.Height+abs(FDesignedForm.Form.Top)+FDesignedForm.PositionDelta.y);
|
||||||
|
end;
|
||||||
|
|
||||||
function TBasicResizeFrame.GetBackgroundMargin(const AIndex: Integer): Integer;
|
function TBasicResizeFrame.GetBackgroundMargin(const AIndex: Integer): Integer;
|
||||||
begin
|
begin
|
||||||
if FBackground = nil then
|
if FBackground = nil then
|
||||||
@ -736,9 +754,14 @@ begin
|
|||||||
Result := Result + GetMenuHeight;
|
Result := Result + GetMenuHeight;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
function TBasicResizeFrame.GetClientPanel: TPanel;
|
function TBasicResizeFrame.GetNewSize: TPoint;
|
||||||
begin
|
begin
|
||||||
Result := pClient;
|
Result := TPoint.Create(FLastClientWidth,FLastClientHeight);
|
||||||
|
end;
|
||||||
|
|
||||||
|
function TBasicResizeFrame.GetFormHandler: TPanel;
|
||||||
|
begin
|
||||||
|
Result := pFormHandler;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
function TBasicResizeFrame.GetNodePositioning: Boolean;
|
function TBasicResizeFrame.GetNodePositioning: Boolean;
|
||||||
@ -795,9 +818,9 @@ begin
|
|||||||
|
|
||||||
// for GTK2 resizing form (pClient is hidden under pBG)
|
// for GTK2 resizing form (pClient is hidden under pBG)
|
||||||
{$IF DEFINED(LCLGtk2) OR DEFINED(LCLQt) OR DEFINED(LCLQt5)}
|
{$IF DEFINED(LCLGtk2) OR DEFINED(LCLQt) OR DEFINED(LCLQt5)}
|
||||||
pClient.SendToBack; // <--- this is a must.
|
pFormHandler.SendToBack; // <--- this is a must.
|
||||||
{$ENDIF}
|
{$ENDIF}
|
||||||
pClient.BringToFront;
|
pFormHandler.BringToFront;
|
||||||
|
|
||||||
pFakeMenu.Visible := HasMainMenu;
|
pFakeMenu.Visible := HasMainMenu;
|
||||||
if pFakeMenu.Visible then
|
if pFakeMenu.Visible then
|
||||||
@ -812,6 +835,8 @@ end;
|
|||||||
|
|
||||||
procedure TBasicResizeFrame.BeginFormSizeUpdate(Sender: TObject);
|
procedure TBasicResizeFrame.BeginFormSizeUpdate(Sender: TObject);
|
||||||
begin
|
begin
|
||||||
|
FLastDesignedWidthToScroll:=DesignedWidthToScroll;
|
||||||
|
FLastDesignedHeightToScroll:=DesignedHeightToScroll;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
procedure TBasicResizeFrame.EndFormSizeUpdate(Sender: TObject);
|
procedure TBasicResizeFrame.EndFormSizeUpdate(Sender: TObject);
|
||||||
@ -862,8 +887,10 @@ function TBasicResizeFrame.DesignedWidthToScroll: Integer;
|
|||||||
begin
|
begin
|
||||||
if DesignedForm = nil then
|
if DesignedForm = nil then
|
||||||
Exit(0);
|
Exit(0);
|
||||||
|
if FNodePositioning then
|
||||||
Result := DesignedForm.Width - FLastClientWidth;
|
Result := FLastDesignedWidthToScroll
|
||||||
|
else
|
||||||
|
Result := abs(DesignedForm.Width - FLastClientWidth);
|
||||||
//Result := DesignedForm.Width - DesignedForm.RealWidth;
|
//Result := DesignedForm.Width - DesignedForm.RealWidth;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
@ -878,7 +905,10 @@ begin
|
|||||||
if DesignedForm = nil then
|
if DesignedForm = nil then
|
||||||
Exit(0);
|
Exit(0);
|
||||||
|
|
||||||
Result := DesignedForm.Height - FLastClientHeight;
|
if FNodePositioning then
|
||||||
|
Result := FLastDesignedHeightToScroll
|
||||||
|
else
|
||||||
|
Result := abs(DesignedForm.Height - FLastClientHeight);
|
||||||
//Result := DesignedForm.Height - DesignedForm.RealHeight;
|
//Result := DesignedForm.Height - DesignedForm.RealHeight;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
@ -1035,6 +1065,8 @@ begin
|
|||||||
pClient.Width := Width - pClient.Left - Max(Width - (pR.Left - BgRightMargin), 0);
|
pClient.Width := Width - pClient.Left - Max(Width - (pR.Left - BgRightMargin), 0);
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
AdjustFormHandler;
|
||||||
|
|
||||||
for Node := 0 to 7 do
|
for Node := 0 to 7 do
|
||||||
begin
|
begin
|
||||||
with AroundControl do
|
with AroundControl do
|
||||||
|
|||||||
@ -55,7 +55,7 @@ begin
|
|||||||
begin
|
begin
|
||||||
FDesignedForm.BeginUpdate;
|
FDesignedForm.BeginUpdate;
|
||||||
|
|
||||||
FDesignedForm.Form.Parent := FResizerFrame.pClient;
|
FDesignedForm.Form.Parent := FResizerFrame.pFormHandler;
|
||||||
{$IFNDEF WINDOWS}
|
{$IFNDEF WINDOWS}
|
||||||
FDesignedForm.Form.BorderStyle := bsNone;
|
FDesignedForm.Form.BorderStyle := bsNone;
|
||||||
{$ENDIF}
|
{$ENDIF}
|
||||||
|
|||||||
@ -52,6 +52,7 @@ type
|
|||||||
|
|
||||||
procedure ShowWindow;
|
procedure ShowWindow;
|
||||||
procedure HideWindow;
|
procedure HideWindow;
|
||||||
|
function PositionDelta: TPoint;
|
||||||
|
|
||||||
// hacked values
|
// hacked values
|
||||||
function GetPublishedBounds(AIndex: Integer): Integer;
|
function GetPublishedBounds(AIndex: Integer): Integer;
|
||||||
@ -102,7 +103,8 @@ type
|
|||||||
procedure SetHorizontalScrollPos(AValue: Integer);
|
procedure SetHorizontalScrollPos(AValue: Integer);
|
||||||
function GetBackgroundPanel: TPanel;
|
function GetBackgroundPanel: TPanel;
|
||||||
function GetBackgroundMargin(const AIndex: Integer): Integer;
|
function GetBackgroundMargin(const AIndex: Integer): Integer;
|
||||||
function GetClientPanel: TPanel;
|
function GetNewSize: TPoint;
|
||||||
|
function GetFormHandler: TPanel;
|
||||||
function GetNodePositioning: Boolean;
|
function GetNodePositioning: Boolean;
|
||||||
function GetDesignedForm: IDesignedForm;
|
function GetDesignedForm: IDesignedForm;
|
||||||
procedure SetDesignedForm(const AValue: IDesignedForm);
|
procedure SetDesignedForm(const AValue: IDesignedForm);
|
||||||
@ -120,7 +122,8 @@ type
|
|||||||
property BgRightMargin: Integer index 2 read GetBackgroundMargin;
|
property BgRightMargin: Integer index 2 read GetBackgroundMargin;
|
||||||
property BgBottomMargin: Integer index 3 read GetBackgroundMargin;
|
property BgBottomMargin: Integer index 3 read GetBackgroundMargin;
|
||||||
|
|
||||||
property ClientPanel: TPanel read GetClientPanel;
|
property NewSize: TPoint read GetNewSize;
|
||||||
|
property FormHandler: TPanel read GetFormHandler;
|
||||||
property NodePositioning: Boolean read GetNodePositioning;
|
property NodePositioning: Boolean read GetNodePositioning;
|
||||||
property DesignedForm: IDesignedForm read GetDesignedForm write SetDesignedForm;
|
property DesignedForm: IDesignedForm read GetDesignedForm write SetDesignedForm;
|
||||||
|
|
||||||
|
|||||||
@ -37,7 +37,7 @@ var
|
|||||||
|
|
||||||
procedure Register;
|
procedure Register;
|
||||||
begin
|
begin
|
||||||
FormEditingHook.StandardDesignerBaseClasses[DesignerBaseClassId_TForm] := TFakeFormBG;
|
//FormEditingHook.StandardDesignerBaseClasses[DesignerBaseClassId_TForm] := TFakeFormBG;
|
||||||
Manager := TStarterDesignTimeUtilsManager.Create;
|
Manager := TStarterDesignTimeUtilsManager.Create;
|
||||||
DTUManager := Manager;
|
DTUManager := Manager;
|
||||||
end;
|
end;
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user