mirror of
https://gitlab.com/freepascal.org/lazarus/lazarus.git
synced 2025-06-02 12:32:55 +02:00

sparta: initial commit of "compilable" new sparta package - smart form editor. !NOTE: not for daily usage. ........ sparta: Initial conception for package for MDI: sparta_MDI. Base for sparta_DockedFormEditor package. ........ sparta: Generics.Collections library ( sync with https://github.com/dathox/generics.collections SHA fda586932bd80ef58c08f8ebf5a24316ca4ccca5) ........ sparta: smart form editor adjustment for new sparta_MDI ........ sparta: new class "TFormImpl" for MDI solution (created from TDesignedFormImpl). ........ sparta: -MDI form container "TFormContainer" -New IResizeFrame interface to handle MDI form moving -New frame TfrFormBackgroundForMDI ........ sparta: sparta_MDI package modifications: -new class TMultiplyResizer to menage MDI desktop -more generic resizer: TAbstractResizer. Base for IDE resizer and TMultiplyResizer -more advanced IResizeFrame interface ........ sparta: -DockedFormEditor adjustment for latest changes in mdi package -small changes in mdi (visibility of methods). -OnModified method for IResizeFrame ........ sparta: MDI -simulate MDI forms order for TMultiplyResizer -property DesignedForm: IDesignedForm for IResizeFrame ........ sparta: -IMPORTANT! pixel perfect form resizing (fix for problems for controls with align alLeft, alRight etc on design form). -Fix problem for windows: wrong design design window width (a little bigger than designed size) TFormImpl.SetRealBounds -> AdjustSize ........ sparta: mdi bug fix for AV in TMultiplyResizer ........ Fix compilation for FPC 3.0 (TRect changes in FPC 3.1 trunk) ........ sparta: Cannot resize the docked form designer, issue #29380 patch from Anthony Walter. Thanks! ........ sparta ToolsAPI: Delphi compatible ToolsAPI/DesignIDE interface at XE2 level (proxy for IDEIntf). Initial commit (no functionality yet), just interfaces and classes without implementation: designeditors.pas: -TComponentEditor designintf.pas: -Interfaces: IEventInfo, IClass, IActivatable, IDesignObject, IDesignPersistent, IDesignerSelections, IDesigner60, IDesigner70, IDesigner80, IDesigner100, IDesigner, IComponentEditor -TBaseComponentEditor -RegisterComponentEditor designmenus.pas: -Interfaces: IMenuItems, IMenu, IMainMenu, IPopupMenu, IMenuItem ........ when form is removed we need to remove all handlers located in collections FFormsStack and FForms. Necessary to avoid AV. ........ sparta: more correct and simpler calculation of form border for Windows ........ sparta: * Fix for loop error for resize. Highly visible problem for docked forms/frames with Align=alClient. * New THookFrame class as new meta class for Frames. ........ updated lpl ........ git-svn-id: trunk@52728 -
135 lines
3.1 KiB
ObjectPascal
135 lines
3.1 KiB
ObjectPascal
unit sparta_FormBackgroundForMDI;
|
|
|
|
{$mode objfpc}{$H+}
|
|
|
|
interface
|
|
|
|
uses
|
|
Classes, SysUtils, FileUtil, Forms, Controls, StdCtrls, ExtCtrls,
|
|
sparta_InterfacesMDI, sparta_BasicResizeFrame;
|
|
|
|
type
|
|
|
|
{ TfrFormBackgroundForMDI }
|
|
|
|
TfrFormBackgroundForMDI = class(TFrame, IDesignedFormBackground)
|
|
Panel1: TPanel;
|
|
procedure Panel1MouseDown(Sender: TObject; Button: TMouseButton;
|
|
Shift: TShiftState; X, Y: Integer);
|
|
procedure Panel1MouseMove(Sender: TObject; Shift: TShiftState; X, Y: Integer
|
|
);
|
|
procedure Panel1MouseUp(Sender: TObject; Button: TMouseButton;
|
|
Shift: TShiftState; X, Y: Integer);
|
|
private
|
|
FDesignedForm: IDesignedForm;
|
|
FResizeFrame: IResizeFrame;
|
|
FDelta: TPoint;
|
|
FDown: Boolean;
|
|
|
|
function GetMargin(const AIndex: Integer): Integer;
|
|
protected
|
|
function GetParent: TWinControl; virtual;
|
|
procedure SetParent(AParent: TWinControl); override;
|
|
function GetResizeFrame: IResizeFrame;
|
|
procedure SetResizeFrame(AValue: IResizeFrame);
|
|
|
|
function GetDesignedForm: IDesignedForm;
|
|
public
|
|
{ public declarations }
|
|
constructor Create(const ADesignedForm: IDesignedForm); virtual; reintroduce;
|
|
|
|
procedure RefreshValues;
|
|
end;
|
|
|
|
implementation
|
|
|
|
{$R *.lfm}
|
|
|
|
{ TfrFormBackgroundForMDI }
|
|
|
|
procedure TfrFormBackgroundForMDI.Panel1MouseDown(Sender: TObject;
|
|
Button: TMouseButton; Shift: TShiftState; X, Y: Integer);
|
|
var
|
|
LCtrlPoint: TPoint;
|
|
begin
|
|
LCtrlPoint := Panel1.ScreenToClient(Mouse.CursorPos);
|
|
FDelta.x := -LCtrlPoint.X;
|
|
FDelta.y := -LCtrlPoint.Y;
|
|
FDown := True;
|
|
end;
|
|
|
|
procedure TfrFormBackgroundForMDI.Panel1MouseMove(Sender: TObject;
|
|
Shift: TShiftState; X, Y: Integer);
|
|
var
|
|
frmPoint: TPoint;
|
|
LFrame: TCustomFrame;
|
|
begin
|
|
if (not FDown) or (FResizeFrame = nil) then
|
|
Exit;
|
|
|
|
frmPoint := Self.ScreenToClient(Mouse.CursorPos);
|
|
LFrame := FResizeFrame.Frame;
|
|
LFrame.Left := LFrame.Left + (frmPoint.x + FDelta.x);
|
|
LFrame.Top := LFrame.Top + (frmPoint.y + FDelta.y);
|
|
end;
|
|
|
|
procedure TfrFormBackgroundForMDI.Panel1MouseUp(Sender: TObject;
|
|
Button: TMouseButton; Shift: TShiftState; X, Y: Integer);
|
|
begin
|
|
FDown := False;
|
|
end;
|
|
|
|
function TfrFormBackgroundForMDI.GetMargin(const AIndex: Integer): Integer;
|
|
begin
|
|
case AIndex of
|
|
0: // left
|
|
Result := 5;
|
|
1: // Top
|
|
Result := 30;
|
|
2: // Right
|
|
Result := 5;
|
|
3: // Bottom
|
|
Result := 5;
|
|
end;
|
|
end;
|
|
|
|
function TfrFormBackgroundForMDI.GetParent: TWinControl;
|
|
begin
|
|
Result := inherited Parent;
|
|
end;
|
|
|
|
procedure TfrFormBackgroundForMDI.SetParent(AParent: TWinControl);
|
|
begin
|
|
inherited SetParent(AParent);
|
|
end;
|
|
|
|
function TfrFormBackgroundForMDI.GetResizeFrame: IResizeFrame;
|
|
begin
|
|
Result := FResizeFrame;
|
|
end;
|
|
|
|
procedure TfrFormBackgroundForMDI.SetResizeFrame(AValue: IResizeFrame);
|
|
begin
|
|
FResizeFrame := AValue;
|
|
end;
|
|
|
|
function TfrFormBackgroundForMDI.GetDesignedForm: IDesignedForm;
|
|
begin
|
|
Result := FDesignedForm as IDesignedForm;
|
|
end;
|
|
|
|
constructor TfrFormBackgroundForMDI.Create(const ADesignedForm: IDesignedForm);
|
|
begin
|
|
inherited Create(nil);
|
|
FDesignedForm := ADesignedForm;
|
|
RefreshValues;
|
|
end;
|
|
|
|
procedure TfrFormBackgroundForMDI.RefreshValues;
|
|
begin
|
|
|
|
end;
|
|
|
|
end.
|
|
|