mirror of
https://gitlab.com/freepascal.org/lazarus/lazarus.git
synced 2025-08-28 15:20:49 +02:00
IDEIntf: started TIDEWindowDefaultLayout
git-svn-id: trunk@25573 -
This commit is contained in:
parent
c40afe0734
commit
d18d9a1205
@ -85,7 +85,7 @@ end;
|
||||
*)
|
||||
procedure TDebuggerDlg.DoClose(var CloseAction: TCloseAction);
|
||||
var
|
||||
Layout: TIDEWindowLayout;
|
||||
Layout: TSimpleWindowLayout;
|
||||
begin
|
||||
CloseAction := caFree; // we default to free
|
||||
inherited DoClose(CloseAction);
|
||||
|
@ -64,6 +64,8 @@ type
|
||||
{$IFDEF new}
|
||||
function GetFloatingDockSiteClass: TWinControlClass; override;
|
||||
{$ENDIF}
|
||||
procedure DoStartDrag(var DragObject: TDragObject); override;
|
||||
procedure DoStartDock(var DragObject: TDragObject); override;
|
||||
public
|
||||
constructor Create(TheOwner: TComponent); override;
|
||||
function OpenFile(const AName: string): boolean; //virtual;
|
||||
@ -109,6 +111,18 @@ begin
|
||||
CloseAction := caFree;
|
||||
end;
|
||||
|
||||
procedure TEditBook.DoStartDrag(var DragObject: TDragObject);
|
||||
begin
|
||||
inherited DoStartDrag(DragObject);
|
||||
end;
|
||||
|
||||
procedure TEditBook.DoStartDock(var DragObject: TDragObject);
|
||||
begin
|
||||
inherited DoStartDock(DragObject);
|
||||
UndockWidth:=Width;
|
||||
UndockHeight:=Height;
|
||||
end;
|
||||
|
||||
constructor TEditBook.Create(TheOwner: TComponent);
|
||||
begin
|
||||
inherited Create(TheOwner);
|
||||
|
@ -261,7 +261,8 @@ Options (to come or to be removed)
|
||||
//Result.Invalidate; - doesn't help
|
||||
end;
|
||||
|
||||
function TDockMaster.MakeDockable(AForm: TWinControl; fWrap, fVisible: boolean): TForm;
|
||||
function TDockMaster.MakeDockable(AForm: TWinControl; fWrap: boolean;
|
||||
fVisible: boolean): TForm;
|
||||
var
|
||||
Site: TFloatingSite absolute Result;
|
||||
Res: TWinControlAccess absolute AForm;
|
||||
|
@ -150,7 +150,7 @@ type
|
||||
FXMLCfg: TXMLConfig;
|
||||
FConfigStore: TXMLOptionsStorage;
|
||||
|
||||
FOnApplyWindowLayout: TOnApplyIDEWindowLayout;
|
||||
FOnApplyWindowLayout: TOnApplySimpleWindowLayout;
|
||||
|
||||
// auto save
|
||||
FAutoSaveEditorFiles: boolean;
|
||||
@ -159,7 +159,7 @@ type
|
||||
FLastSavedProjectFile: string;
|
||||
|
||||
// window layout
|
||||
FIDEWindowLayoutList: TIDEWindowLayoutList;
|
||||
FIDEWindowLayoutList: TSimpleWindowLayoutList;
|
||||
FIDEDialogLayoutList: TIDEDialogLayoutList;
|
||||
FSingleTaskBarButton: boolean;
|
||||
FHideIDEOnRun: boolean;
|
||||
@ -279,10 +279,10 @@ type
|
||||
procedure SetDebuggerFilename(const AValue: string);
|
||||
procedure SetFPCSourceDirectory(const AValue: string);
|
||||
procedure SetLazarusDirectory(const AValue: string);
|
||||
procedure SetOnApplyWindowLayout(const AValue: TOnApplyIDEWindowLayout);
|
||||
procedure SetOnApplyWindowLayout(const AValue: TOnApplySimpleWindowLayout);
|
||||
|
||||
procedure InitLayoutList;
|
||||
procedure InternOnApplyWindowLayout(ALayout: TIDEWindowLayout);
|
||||
procedure InternOnApplyWindowLayout(ALayout: TSimpleWindowLayout);
|
||||
procedure SetFileName(const NewFilename: string);
|
||||
function FileHasChangedOnDisk: boolean;
|
||||
function GetXMLCfg(CleanConfig: boolean): TXMLConfig;
|
||||
@ -325,7 +325,7 @@ type
|
||||
var Abort: boolean): string;
|
||||
|
||||
// event
|
||||
property OnApplyWindowLayout: TOnApplyIDEWindowLayout
|
||||
property OnApplyWindowLayout: TOnApplySimpleWindowLayout
|
||||
read FOnApplyWindowLayout write SetOnApplyWindowLayout;
|
||||
|
||||
// auto save
|
||||
@ -337,7 +337,7 @@ type
|
||||
write FAutoSaveIntervalInSecs;
|
||||
|
||||
// window layouts
|
||||
property IDEWindowLayoutList: TIDEWindowLayoutList
|
||||
property IDEWindowLayoutList: TSimpleWindowLayoutList
|
||||
read FIDEWindowLayoutList write FIDEWindowLayoutList;
|
||||
property IDEDialogLayoutList: TIDEDialogLayoutList
|
||||
read FIDEDialogLayoutList write FIDEDialogLayoutList;
|
||||
@ -1459,7 +1459,7 @@ procedure TEnvironmentOptions.InitLayoutList;
|
||||
var
|
||||
l: TNonModalIDEWindow;
|
||||
begin
|
||||
fIDEWindowLayoutList:=TIDEWindowLayoutList.Create;
|
||||
fIDEWindowLayoutList:=TSimpleWindowLayoutList.Create;
|
||||
|
||||
for l:=Low(TNonModalIDEWindow) to High(TNonModalIDEWindow) do
|
||||
if l<>nmiwNone then
|
||||
@ -1468,20 +1468,20 @@ begin
|
||||
end;
|
||||
|
||||
procedure TEnvironmentOptions.InternOnApplyWindowLayout(
|
||||
ALayout: TIDEWindowLayout);
|
||||
ALayout: TSimpleWindowLayout);
|
||||
begin
|
||||
if Assigned(OnApplyWindowLayout) then OnApplyWindowLayout(ALayout);
|
||||
end;
|
||||
|
||||
procedure TEnvironmentOptions.CreateWindowLayout(const TheFormID: string);
|
||||
var
|
||||
NewLayout: TIDEWindowLayout;
|
||||
NewLayout: TSimpleWindowLayout;
|
||||
begin
|
||||
if TheFormID='' then
|
||||
RaiseException('TEnvironmentOptions.CreateWindowLayout TheFormID empty');
|
||||
if IDEWindowLayoutList.ItemByFormID(TheFormID)<>nil then
|
||||
RaiseException('TEnvironmentOptions.CreateWindowLayout TheFormID exists');
|
||||
NewLayout:=TIDEWindowLayout.Create;
|
||||
NewLayout:=TSimpleWindowLayout.Create;
|
||||
with NewLayout do begin
|
||||
FormID:=TheFormID;
|
||||
WindowPlacementsAllowed:=[iwpRestoreWindowGeometry,iwpDefault,
|
||||
@ -1625,7 +1625,7 @@ begin
|
||||
end;
|
||||
|
||||
procedure TEnvironmentOptions.SetOnApplyWindowLayout(
|
||||
const AValue: TOnApplyIDEWindowLayout);
|
||||
const AValue: TOnApplySimpleWindowLayout);
|
||||
begin
|
||||
FOnApplyWindowLayout:=AValue;
|
||||
end;
|
||||
|
@ -62,14 +62,14 @@ type
|
||||
procedure GetWindowPositionButtonClick(Sender: TObject);
|
||||
procedure WindowPositionsListBoxSelectionChange(Sender: TObject; User: boolean);
|
||||
private
|
||||
FLayouts: TIDEWindowLayoutList;
|
||||
FLayout: TIDEWindowLayout;
|
||||
FLayouts: TSimpleWindowLayoutList;
|
||||
FLayout: TSimpleWindowLayout;
|
||||
function GetPlacementRadioButtons(APlacement: TIDEWindowPlacement): TRadioButton;
|
||||
procedure SetLayout(const AValue: TIDEWindowLayout);
|
||||
procedure SetLayout(const AValue: TSimpleWindowLayout);
|
||||
procedure SetWindowPositionsItem(Index: integer);
|
||||
procedure SaveLayout;
|
||||
function GetCaptionFor(AWindow: TNonModalIDEWindow): String;
|
||||
property Layout: TIDEWindowLayout read FLayout write SetLayout;
|
||||
property Layout: TSimpleWindowLayout read FLayout write SetLayout;
|
||||
public
|
||||
function GetTitle: String; override;
|
||||
procedure Setup(ADialog: TAbstractOptionsEditorDialog); override;
|
||||
@ -179,7 +179,7 @@ begin
|
||||
end;
|
||||
end;
|
||||
|
||||
procedure TWindowOptionsFrame.SetLayout(const AValue: TIDEWindowLayout);
|
||||
procedure TWindowOptionsFrame.SetLayout(const AValue: TSimpleWindowLayout);
|
||||
var
|
||||
APlacement: TIDEWindowPlacement;
|
||||
RadioButton: TRadioButton;
|
||||
|
@ -167,14 +167,14 @@ type
|
||||
TIDEWindowState = (iwsNormal, iwsMaximized, iwsMinimized, iwsHidden);
|
||||
TIDEWindowStates = set of TIDEWindowState;
|
||||
|
||||
TIDEWindowLayout = class;
|
||||
TOnGetDefaultIDEWindowPos = procedure(Sender: TIDEWindowLayout;
|
||||
TSimpleWindowLayout = class;
|
||||
TOnGetDefaultIDEWindowPos = procedure(Sender: TSimpleWindowLayout;
|
||||
var Bounds: TRect) of object;
|
||||
TOnApplyIDEWindowLayout = procedure(Layout: TIDEWindowLayout) of object;
|
||||
TOnApplySimpleWindowLayout = procedure(Layout: TSimpleWindowLayout) of object;
|
||||
|
||||
{ TIDEWindowLayout }
|
||||
{ TSimpleWindowLayout }
|
||||
|
||||
TIDEWindowLayout = class
|
||||
TSimpleWindowLayout = class
|
||||
private
|
||||
FFormCaption: string;
|
||||
FVisible: boolean;
|
||||
@ -193,7 +193,7 @@ type
|
||||
fDockModesAllowed: TIDEWindowDockModes;
|
||||
fFormID: string;
|
||||
fOnGetDefaultIDEWindowPos: TOnGetDefaultIDEWindowPos;
|
||||
fOnApply: TOnApplyIDEWindowLayout;
|
||||
fOnApply: TOnApplySimpleWindowLayout;
|
||||
fDefaultWindowPlacement: TIDEWindowPlacement;
|
||||
function GetFormID: string;
|
||||
function GetXMLFormID: string;
|
||||
@ -218,7 +218,7 @@ type
|
||||
procedure Clear;
|
||||
procedure Apply;
|
||||
procedure GetCurrentPosition;
|
||||
procedure Assign(Layout: TIDEWindowLayout);
|
||||
procedure Assign(Layout: TSimpleWindowLayout);
|
||||
procedure ReadCurrentCoordinates;
|
||||
procedure ReadCurrentState;
|
||||
procedure LoadFromXMLConfig(XMLConfig: TXMLConfig; const Path: string);
|
||||
@ -253,32 +253,32 @@ type
|
||||
property Visible: boolean read FVisible write SetVisible;
|
||||
property OnGetDefaultIDEWindowPos: TOnGetDefaultIDEWindowPos
|
||||
read fOnGetDefaultIDEWindowPos write SetOnGetDefaultIDEWindowPos;
|
||||
property OnApply: TOnApplyIDEWindowLayout read fOnApply write fOnApply;
|
||||
property OnApply: TOnApplySimpleWindowLayout read fOnApply write fOnApply;
|
||||
end;
|
||||
|
||||
{ TIDEWindowLayoutList }
|
||||
{ TSimpleWindowLayoutList }
|
||||
|
||||
TIDEWindowLayoutList = class(TList)
|
||||
TSimpleWindowLayoutList = class(TList)
|
||||
private
|
||||
function GetItems(Index: Integer): TIDEWindowLayout;
|
||||
procedure SetItems(Index: Integer; const AValue: TIDEWindowLayout);
|
||||
function GetItems(Index: Integer): TSimpleWindowLayout;
|
||||
procedure SetItems(Index: Integer; const AValue: TSimpleWindowLayout);
|
||||
public
|
||||
procedure Clear; override;
|
||||
procedure Delete(Index: Integer);
|
||||
procedure ApplyAll;
|
||||
procedure Apply(AForm: TCustomForm; const ID: string);
|
||||
procedure StoreWindowPositions;
|
||||
procedure Assign(SrcList: TIDEWindowLayoutList);
|
||||
procedure Assign(SrcList: TSimpleWindowLayoutList);
|
||||
function IndexOf(const FormID: string): integer;
|
||||
function ItemByForm(AForm: TCustomForm): TIDEWindowLayout;
|
||||
function ItemByFormID(const FormID: string): TIDEWindowLayout;
|
||||
function ItemByFormCaption(const aFormCaption: string): TIDEWindowLayout;
|
||||
function ItemByEnum(ID: TNonModalIDEWindow): TIDEWindowLayout;
|
||||
function ItemByForm(AForm: TCustomForm): TSimpleWindowLayout;
|
||||
function ItemByFormID(const FormID: string): TSimpleWindowLayout;
|
||||
function ItemByFormCaption(const aFormCaption: string): TSimpleWindowLayout;
|
||||
function ItemByEnum(ID: TNonModalIDEWindow): TSimpleWindowLayout;
|
||||
procedure CloseForm(AForm: TCustomForm);
|
||||
procedure LoadFromXMLConfig(XMLConfig: TXMLConfig; const Path: string);
|
||||
procedure SaveToXMLConfig(XMLConfig: TXMLConfig; const Path: string);
|
||||
public
|
||||
property Items[Index: Integer]: TIDEWindowLayout
|
||||
property Items[Index: Integer]: TSimpleWindowLayout
|
||||
read GetItems write SetItems; default;
|
||||
end;
|
||||
|
||||
@ -414,9 +414,9 @@ begin
|
||||
Result:=TXMLOptionsStorage.Create(ConfigFilename,LoadFromDisk);
|
||||
end;
|
||||
|
||||
{ TIDEWindowLayout }
|
||||
{ TSimpleWindowLayout }
|
||||
|
||||
constructor TIDEWindowLayout.Create;
|
||||
constructor TSimpleWindowLayout.Create;
|
||||
begin
|
||||
inherited Create;
|
||||
fDockChilds:=TStringList.Create;
|
||||
@ -428,7 +428,7 @@ begin
|
||||
fDockModesAllowed:=[Low(TIDEWindowDockMode)..High(TIDEWindowDockMode)];
|
||||
end;
|
||||
|
||||
procedure TIDEWindowLayout.LoadFromXMLConfig(XMLConfig: TXMLConfig;
|
||||
procedure TSimpleWindowLayout.LoadFromXMLConfig(XMLConfig: TXMLConfig;
|
||||
const Path: string);
|
||||
var
|
||||
P, DockChild: string;
|
||||
@ -467,7 +467,7 @@ begin
|
||||
FVisible:=XMLConfig.GetValue(P+'Visible/Value',false);
|
||||
end;
|
||||
|
||||
procedure TIDEWindowLayout.SaveToXMLConfig(XMLConfig: TXMLConfig;
|
||||
procedure TSimpleWindowLayout.SaveToXMLConfig(XMLConfig: TXMLConfig;
|
||||
const Path: string);
|
||||
var
|
||||
P: string;
|
||||
@ -499,49 +499,49 @@ begin
|
||||
XMLConfig.SetDeleteValue(P+'Visible/Value',FVisible,false);
|
||||
end;
|
||||
|
||||
procedure TIDEWindowLayout.SetWindowPlacement(
|
||||
procedure TSimpleWindowLayout.SetWindowPlacement(
|
||||
const AValue: TIDEWindowPlacement);
|
||||
begin
|
||||
fWindowPlacement:=AValue;
|
||||
end;
|
||||
|
||||
procedure TIDEWindowLayout.SetHeight(const AValue: integer);
|
||||
procedure TSimpleWindowLayout.SetHeight(const AValue: integer);
|
||||
begin
|
||||
fHeight:=AValue;
|
||||
end;
|
||||
|
||||
procedure TIDEWindowLayout.SetLeft(const AValue: integer);
|
||||
procedure TSimpleWindowLayout.SetLeft(const AValue: integer);
|
||||
begin
|
||||
fLeft:=AValue;
|
||||
end;
|
||||
|
||||
procedure TIDEWindowLayout.SetTop(const AValue: integer);
|
||||
procedure TSimpleWindowLayout.SetTop(const AValue: integer);
|
||||
begin
|
||||
fTop:=AValue;
|
||||
end;
|
||||
|
||||
procedure TIDEWindowLayout.SetWidth(const AValue: integer);
|
||||
procedure TSimpleWindowLayout.SetWidth(const AValue: integer);
|
||||
begin
|
||||
fWidth:=AValue;
|
||||
end;
|
||||
|
||||
procedure TIDEWindowLayout.SetWindowState(const AValue: TIDEWindowState);
|
||||
procedure TSimpleWindowLayout.SetWindowState(const AValue: TIDEWindowState);
|
||||
begin
|
||||
fWindowState:=AValue;
|
||||
end;
|
||||
|
||||
function TIDEWindowLayout.CustomCoordinatesAreValid: boolean;
|
||||
function TSimpleWindowLayout.CustomCoordinatesAreValid: boolean;
|
||||
begin
|
||||
Result:=(Width>0) and (Height>0) and (Left>10-Width) and (Top>10-Height);
|
||||
end;
|
||||
|
||||
procedure TIDEWindowLayout.CloseForm;
|
||||
procedure TSimpleWindowLayout.CloseForm;
|
||||
begin
|
||||
GetCurrentPosition;
|
||||
Form:=nil;
|
||||
end;
|
||||
|
||||
function TIDEWindowLayout.FormBaseID(out SubIndex: Integer): String;
|
||||
function TSimpleWindowLayout.FormBaseID(out SubIndex: Integer): String;
|
||||
var
|
||||
i: Integer;
|
||||
begin
|
||||
@ -556,7 +556,7 @@ begin
|
||||
Result := copy(Result, 1, i);
|
||||
end;
|
||||
|
||||
procedure TIDEWindowLayout.SetForm(const AValue: TCustomForm);
|
||||
procedure TSimpleWindowLayout.SetForm(const AValue: TCustomForm);
|
||||
begin
|
||||
if fForm=AValue then exit;
|
||||
fForm:=AValue;
|
||||
@ -566,7 +566,7 @@ begin
|
||||
end;
|
||||
end;
|
||||
|
||||
function TIDEWindowLayout.GetFormID: string;
|
||||
function TSimpleWindowLayout.GetFormID: string;
|
||||
begin
|
||||
if FForm=nil then
|
||||
Result:=fFormID
|
||||
@ -574,7 +574,7 @@ begin
|
||||
Result:=FForm.Name;
|
||||
end;
|
||||
|
||||
function TIDEWindowLayout.GetXMLFormID: string;
|
||||
function TSimpleWindowLayout.GetXMLFormID: string;
|
||||
var
|
||||
i: integer;
|
||||
begin
|
||||
@ -586,53 +586,53 @@ begin
|
||||
Result[i]:='_';
|
||||
end;
|
||||
|
||||
procedure TIDEWindowLayout.SetDockParent(const AValue: string);
|
||||
procedure TSimpleWindowLayout.SetDockParent(const AValue: string);
|
||||
begin
|
||||
fDockParent:=AValue;
|
||||
end;
|
||||
|
||||
destructor TIDEWindowLayout.Destroy;
|
||||
destructor TSimpleWindowLayout.Destroy;
|
||||
begin
|
||||
fDockChilds.Free;
|
||||
inherited Destroy;
|
||||
end;
|
||||
|
||||
procedure TIDEWindowLayout.SetDockMode(const AValue: TIDEWindowDockMode);
|
||||
procedure TSimpleWindowLayout.SetDockMode(const AValue: TIDEWindowDockMode);
|
||||
begin
|
||||
fDockMode:=AValue;
|
||||
end;
|
||||
|
||||
procedure TIDEWindowLayout.SetWindowStatesAllowed(
|
||||
procedure TSimpleWindowLayout.SetWindowStatesAllowed(
|
||||
const AValue: TIDEWindowStates);
|
||||
begin
|
||||
fWindowStatesAllowed:=AValue;
|
||||
end;
|
||||
|
||||
procedure TIDEWindowLayout.SetWindowPlacementsAllowed(
|
||||
procedure TSimpleWindowLayout.SetWindowPlacementsAllowed(
|
||||
const AValue: TIDEWindowPlacements);
|
||||
begin
|
||||
fWindowPlacementsAllowed:=AValue;
|
||||
end;
|
||||
|
||||
procedure TIDEWindowLayout.SetDockModesAllowed(
|
||||
procedure TSimpleWindowLayout.SetDockModesAllowed(
|
||||
const AValue: TIDEWindowDockModes);
|
||||
begin
|
||||
fDockModesAllowed:=AValue;
|
||||
end;
|
||||
|
||||
procedure TIDEWindowLayout.SetVisible(const AValue: boolean);
|
||||
procedure TSimpleWindowLayout.SetVisible(const AValue: boolean);
|
||||
begin
|
||||
if FVisible=AValue then exit;
|
||||
FVisible:=AValue;
|
||||
end;
|
||||
|
||||
procedure TIDEWindowLayout.SetOnGetDefaultIDEWindowPos(
|
||||
procedure TSimpleWindowLayout.SetOnGetDefaultIDEWindowPos(
|
||||
const AValue: TOnGetDefaultIDEWindowPos);
|
||||
begin
|
||||
fOnGetDefaultIDEWindowPos:=AValue;
|
||||
end;
|
||||
|
||||
procedure TIDEWindowLayout.Clear;
|
||||
procedure TSimpleWindowLayout.Clear;
|
||||
begin
|
||||
fWindowPlacement:=fDefaultWindowPlacement;
|
||||
fLeft:=0;
|
||||
@ -645,18 +645,18 @@ begin
|
||||
fDockMode:=iwdmDefault;
|
||||
end;
|
||||
|
||||
procedure TIDEWindowLayout.SetFormID(const AValue: string);
|
||||
procedure TSimpleWindowLayout.SetFormID(const AValue: string);
|
||||
begin
|
||||
if Form=nil then
|
||||
fFormID:=AValue;
|
||||
end;
|
||||
|
||||
procedure TIDEWindowLayout.Apply;
|
||||
procedure TSimpleWindowLayout.Apply;
|
||||
begin
|
||||
if Assigned(OnApply) then OnApply(Self);
|
||||
end;
|
||||
|
||||
procedure TIDEWindowLayout.ReadCurrentCoordinates;
|
||||
procedure TSimpleWindowLayout.ReadCurrentCoordinates;
|
||||
begin
|
||||
if (Form<>nil) and (Form.WindowState=wsNormal) then begin
|
||||
Left:=Form.Left;
|
||||
@ -666,7 +666,7 @@ begin
|
||||
end;
|
||||
end;
|
||||
|
||||
procedure TIDEWindowLayout.ReadCurrentState;
|
||||
procedure TSimpleWindowLayout.ReadCurrentState;
|
||||
begin
|
||||
Visible:=(Form<>nil) and Form.Visible;
|
||||
if Form<>nil then begin
|
||||
@ -679,7 +679,7 @@ begin
|
||||
end;
|
||||
end;
|
||||
|
||||
procedure TIDEWindowLayout.Assign(Layout: TIDEWindowLayout);
|
||||
procedure TSimpleWindowLayout.Assign(Layout: TSimpleWindowLayout);
|
||||
begin
|
||||
Clear;
|
||||
fWindowPlacement:=Layout.fWindowPlacement;
|
||||
@ -701,51 +701,51 @@ begin
|
||||
fDefaultWindowPlacement:=Layout.fDefaultWindowPlacement;
|
||||
end;
|
||||
|
||||
procedure TIDEWindowLayout.GetCurrentPosition;
|
||||
procedure TSimpleWindowLayout.GetCurrentPosition;
|
||||
begin
|
||||
//debugln('TIDEWindowLayout.GetCurrentPosition ',DbgSName(Self),' ',FormID,' ',IDEWindowPlacementNames[WindowPlacement]);
|
||||
//debugln('TSimpleWindowLayout.GetCurrentPosition ',DbgSName(Self),' ',FormID,' ',IDEWindowPlacementNames[WindowPlacement]);
|
||||
case WindowPlacement of
|
||||
iwpRestoreWindowGeometry, iwpRestoreWindowSize:
|
||||
ReadCurrentCoordinates;
|
||||
|
||||
end;
|
||||
ReadCurrentState;
|
||||
//debugln('TIDEWindowLayout.GetCurrentPosition ',DbgSName(Self),' ',FormID,' Width=',dbgs(Width));
|
||||
//debugln('TSimpleWindowLayout.GetCurrentPosition ',DbgSName(Self),' ',FormID,' Width=',dbgs(Width));
|
||||
end;
|
||||
|
||||
{ TIDEWindowLayoutList }
|
||||
{ TSimpleWindowLayoutList }
|
||||
|
||||
procedure TIDEWindowLayoutList.Clear;
|
||||
procedure TSimpleWindowLayoutList.Clear;
|
||||
var i: integer;
|
||||
begin
|
||||
for i:=0 to Count-1 do Items[i].Free;
|
||||
inherited Clear;
|
||||
end;
|
||||
|
||||
procedure TIDEWindowLayoutList.Delete(Index: Integer);
|
||||
procedure TSimpleWindowLayoutList.Delete(Index: Integer);
|
||||
begin
|
||||
Items[Index].Free;
|
||||
inherited Delete(Index);
|
||||
end;
|
||||
|
||||
function TIDEWindowLayoutList.GetItems(Index: Integer): TIDEWindowLayout;
|
||||
function TSimpleWindowLayoutList.GetItems(Index: Integer): TSimpleWindowLayout;
|
||||
begin
|
||||
Result:=TIDEWindowLayout(inherited Items[Index]);
|
||||
Result:=TSimpleWindowLayout(inherited Items[Index]);
|
||||
end;
|
||||
|
||||
procedure TIDEWindowLayoutList.SetItems(Index: Integer;
|
||||
const AValue: TIDEWindowLayout);
|
||||
procedure TSimpleWindowLayoutList.SetItems(Index: Integer;
|
||||
const AValue: TSimpleWindowLayout);
|
||||
begin
|
||||
Items[Index]:=AValue;
|
||||
end;
|
||||
|
||||
function TIDEWindowLayoutList.IndexOf(const FormID: string): integer;
|
||||
function TSimpleWindowLayoutList.IndexOf(const FormID: string): integer;
|
||||
begin
|
||||
Result:=Count-1;
|
||||
while (Result>=0) and (FormID<>Items[Result].GetFormID) do dec(Result);
|
||||
end;
|
||||
|
||||
procedure TIDEWindowLayoutList.LoadFromXMLConfig(XMLConfig: TXMLConfig;
|
||||
procedure TSimpleWindowLayoutList.LoadFromXMLConfig(XMLConfig: TXMLConfig;
|
||||
const Path: string);
|
||||
var i: integer;
|
||||
begin
|
||||
@ -753,7 +753,7 @@ begin
|
||||
Items[i].LoadFromXMLConfig(XMLConfig,Path);
|
||||
end;
|
||||
|
||||
procedure TIDEWindowLayoutList.SaveToXMLConfig(XMLConfig: TXMLConfig;
|
||||
procedure TSimpleWindowLayoutList.SaveToXMLConfig(XMLConfig: TXMLConfig;
|
||||
const Path: string);
|
||||
var i: integer;
|
||||
begin
|
||||
@ -764,7 +764,7 @@ begin
|
||||
end
|
||||
end;
|
||||
|
||||
function TIDEWindowLayoutList.ItemByForm(AForm: TCustomForm): TIDEWindowLayout;
|
||||
function TSimpleWindowLayoutList.ItemByForm(AForm: TCustomForm): TSimpleWindowLayout;
|
||||
var i: integer;
|
||||
begin
|
||||
i:=Count-1;
|
||||
@ -776,8 +776,8 @@ begin
|
||||
Result:=nil;
|
||||
end;
|
||||
|
||||
function TIDEWindowLayoutList.ItemByFormID(const FormID: string
|
||||
): TIDEWindowLayout;
|
||||
function TSimpleWindowLayoutList.ItemByFormID(const FormID: string
|
||||
): TSimpleWindowLayout;
|
||||
var i: integer;
|
||||
begin
|
||||
i:=IndexOf(FormID);
|
||||
@ -787,8 +787,8 @@ begin
|
||||
Result:=nil;
|
||||
end;
|
||||
|
||||
function TIDEWindowLayoutList.ItemByFormCaption(const aFormCaption: string
|
||||
): TIDEWindowLayout;
|
||||
function TSimpleWindowLayoutList.ItemByFormCaption(const aFormCaption: string
|
||||
): TSimpleWindowLayout;
|
||||
var i: integer;
|
||||
begin
|
||||
i := Count - 1;
|
||||
@ -801,30 +801,30 @@ begin
|
||||
Result:=nil;
|
||||
end;
|
||||
|
||||
function TIDEWindowLayoutList.ItemByEnum(ID: TNonModalIDEWindow
|
||||
): TIDEWindowLayout;
|
||||
function TSimpleWindowLayoutList.ItemByEnum(ID: TNonModalIDEWindow
|
||||
): TSimpleWindowLayout;
|
||||
begin
|
||||
Result:=ItemByFormID(NonModalIDEWindowNames[ID]);
|
||||
end;
|
||||
|
||||
procedure TIDEWindowLayoutList.CloseForm(AForm: TCustomForm);
|
||||
procedure TSimpleWindowLayoutList.CloseForm(AForm: TCustomForm);
|
||||
var
|
||||
ALayout: TIDEWindowLayout;
|
||||
ALayout: TSimpleWindowLayout;
|
||||
begin
|
||||
ALayout:=ItemByForm(AForm);
|
||||
if ALayout<>nil then
|
||||
ALayout.CloseForm;
|
||||
end;
|
||||
|
||||
procedure TIDEWindowLayoutList.ApplyAll;
|
||||
procedure TSimpleWindowLayoutList.ApplyAll;
|
||||
var i: integer;
|
||||
begin
|
||||
for i:=0 to Count-1 do
|
||||
Items[i].Apply;
|
||||
end;
|
||||
|
||||
procedure TIDEWindowLayoutList.Apply(AForm: TCustomForm; const ID: string);
|
||||
var ALayout: TIDEWindowLayout;
|
||||
procedure TSimpleWindowLayoutList.Apply(AForm: TCustomForm; const ID: string);
|
||||
var ALayout: TSimpleWindowLayout;
|
||||
begin
|
||||
ALayout:=ItemByFormID(ID);
|
||||
if ALayout=nil then
|
||||
@ -833,21 +833,21 @@ begin
|
||||
ALayout.Apply;
|
||||
end;
|
||||
|
||||
procedure TIDEWindowLayoutList.StoreWindowPositions;
|
||||
procedure TSimpleWindowLayoutList.StoreWindowPositions;
|
||||
var i: integer;
|
||||
begin
|
||||
for i:=0 to Count-1 do
|
||||
Items[i].GetCurrentPosition;
|
||||
end;
|
||||
|
||||
procedure TIDEWindowLayoutList.Assign(SrcList: TIDEWindowLayoutList);
|
||||
procedure TSimpleWindowLayoutList.Assign(SrcList: TSimpleWindowLayoutList);
|
||||
var i: integer;
|
||||
NewLayout: TIDEWindowLayout;
|
||||
NewLayout: TSimpleWindowLayout;
|
||||
begin
|
||||
Clear;
|
||||
if SrcList=nil then exit;
|
||||
for i:=0 to SrcList.Count-1 do begin
|
||||
NewLayout:=TIDEWindowLayout.Create;
|
||||
NewLayout:=TSimpleWindowLayout.Create;
|
||||
NewLayout.Assign(SrcList[i]);
|
||||
Add(NewLayout);
|
||||
end;
|
||||
|
@ -72,7 +72,7 @@ const
|
||||
|
||||
procedure TJumpHistoryViewWin.FormCreate(Sender : TObject);
|
||||
var
|
||||
ALayout: TIDEWindowLayout;
|
||||
ALayout: TSimpleWindowLayout;
|
||||
begin
|
||||
Caption := lisJHJumpHistory;
|
||||
Name := NonModalIDEWindowNames[nmiwJumpHistory];
|
||||
|
70
ide/main.pp
70
ide/main.pp
@ -71,7 +71,7 @@ uses
|
||||
SynEditKeyCmds, SynBeautifier, SynEditMarks,
|
||||
// IDE interface
|
||||
AllIDEIntf, BaseIDEIntf, ObjectInspector, PropEdits, PropEditUtils,
|
||||
MacroIntf, IDECommands,
|
||||
MacroIntf, IDECommands, IDEWindowIntf,
|
||||
SrcEditorIntf, NewItemIntf, IDEExternToolIntf, IDEMsgIntf,
|
||||
PackageIntf, ProjectIntf, MenuIntf, LazIDEIntf, IDEDialogs,
|
||||
IDEOptionsIntf, IDEImagesIntf,
|
||||
@ -599,7 +599,7 @@ type
|
||||
procedure Notification(AComponent: TComponent;
|
||||
Operation: TOperation); override;
|
||||
|
||||
procedure OnApplyWindowLayout(ALayout: TIDEWindowLayout);
|
||||
procedure OnApplyWindowLayout(ALayout: TSimpleWindowLayout);
|
||||
procedure AddRecentProjectFileToEnvironment(const AFilename: string);
|
||||
|
||||
// methods for start
|
||||
@ -1256,7 +1256,7 @@ end;
|
||||
|
||||
constructor TMainIDE.Create(TheOwner: TComponent);
|
||||
var
|
||||
Layout: TIDEWindowLayout;
|
||||
Layout: TSimpleWindowLayout;
|
||||
begin
|
||||
{$IFDEF IDE_MEM_CHECK}CheckHeapWrtMemCnt('TMainIDE.Create START');{$ENDIF}
|
||||
inherited Create(TheOwner);
|
||||
@ -1347,6 +1347,7 @@ begin
|
||||
{$IFDEF IDE_MEM_CHECK}CheckHeapWrtMemCnt('TMainIDE.Create IDE COMPONENTS');{$ENDIF}
|
||||
|
||||
// Main IDE bar created and setup completed -> Show it
|
||||
MakeIDEWindowDockSite(MainIDEBar);
|
||||
MainIDEBar.Show;
|
||||
|
||||
// load installed packages
|
||||
@ -1900,6 +1901,7 @@ begin
|
||||
ObjectInspector1.OnSelectionChange:=@OIOnSelectionChange;
|
||||
ObjectInspector1.OnPropertyHint:=@OIOnPropertyHint;
|
||||
ObjectInspector1.OnDestroy:=@OIOnDestroy;
|
||||
MakeIDEWindowDockable(ObjectInspector1);
|
||||
|
||||
IDECmdScopeObjectInspectorOnly.AddWindowClass(TObjectInspectorDlg);
|
||||
|
||||
@ -2173,7 +2175,7 @@ end;
|
||||
procedure TMainIDE.ReOpenIDEWindows;
|
||||
var
|
||||
i: Integer;
|
||||
ALayout: TIDEWindowLayout;
|
||||
ALayout: TSimpleWindowLayout;
|
||||
FormEnum: TNonModalIDEWindow;
|
||||
begin
|
||||
for i:=0 to EnvironmentOptions.IDEWindowLayoutList.Count-1 do begin
|
||||
@ -8877,7 +8879,7 @@ end;
|
||||
procedure TMainIDE.DoViewUnitDependencies;
|
||||
var
|
||||
WasVisible: boolean;
|
||||
ALayout: TIDEWindowLayout;
|
||||
ALayout: TSimpleWindowLayout;
|
||||
begin
|
||||
if UnitDependenciesView=nil then begin
|
||||
UnitDependenciesView:=TUnitDependenciesView.Create(OwningComponent);
|
||||
@ -12620,7 +12622,7 @@ end;
|
||||
procedure TMainIDE.DoShowMessagesView;
|
||||
var
|
||||
WasVisible: boolean;
|
||||
ALayout: TIDEWindowLayout;
|
||||
ALayout: TSimpleWindowLayout;
|
||||
begin
|
||||
//debugln('TMainIDE.DoShowMessagesView');
|
||||
if EnvironmentOptions.HideMessagesIcons then
|
||||
@ -12650,7 +12652,7 @@ end;
|
||||
procedure TMainIDE.DoShowSearchResultsView;
|
||||
var
|
||||
WasVisible: boolean;
|
||||
ALayout: TIDEWindowLayout;
|
||||
ALayout: TSimpleWindowLayout;
|
||||
begin
|
||||
WasVisible := SearchResultsView.Visible;
|
||||
SearchResultsView.Visible:=true;
|
||||
@ -17022,31 +17024,32 @@ begin
|
||||
Result:=mrOk;
|
||||
end;
|
||||
|
||||
procedure TMainIDE.OnApplyWindowLayout(ALayout: TIDEWindowLayout);
|
||||
procedure TMainIDE.OnApplyWindowLayout(ALayout: TSimpleWindowLayout);
|
||||
var
|
||||
WindowType: TNonModalIDEWindow;
|
||||
BarBottom: Integer;
|
||||
DockingAllowed: Boolean;
|
||||
NewHeight: Integer;
|
||||
NewBounds: TRect;
|
||||
SrcNoteBook: TSourceNotebook;
|
||||
SubIndex: Integer;
|
||||
AForm: TCustomForm;
|
||||
begin
|
||||
if (ALayout=nil) or (ALayout.Form=nil) then exit;
|
||||
// debugln('TMainIDE.OnApplyWindowLayout ',ALayout.Form.Name,' ',ALayout.Form.Classname,' ',IDEWindowPlacementNames[ALayout.WindowPlacement],' ',ALayout.CustomCoordinatesAreValid,' ',ALayout.Left,' ',ALayout.Top,' ',ALayout.Width,' ',ALayout.Height);
|
||||
DockingAllowed:={$IFDEF IDEDocking}true{$ELSE}false{$ENDIF};
|
||||
if DockingAllowed then begin
|
||||
ALayout.Form.Constraints.MaxHeight:=0;
|
||||
end;
|
||||
ALayout.Form.Constraints.MaxHeight:=0;
|
||||
if ALayout.Form<>MainIDEBar then
|
||||
MakeIDEWindowDockable(ALayout.Form);
|
||||
|
||||
WindowType:=NonModalIDEFormIDToEnum(ALayout.FormID);
|
||||
SubIndex := -1;
|
||||
if WindowType = nmiwNone then begin
|
||||
WindowType:=NonModalIDEFormIDToEnum(ALayout.FormBaseID(SubIndex));
|
||||
end;
|
||||
if DockingAllowed then begin
|
||||
if WindowType in [nmiwSourceNoteBookName] then
|
||||
ALayout.WindowPlacement:=iwpDocked;
|
||||
|
||||
AForm:=ALayout.Form;
|
||||
if AForm.Parent<>nil then begin
|
||||
// form is docked
|
||||
|
||||
end;
|
||||
|
||||
case ALayout.WindowPlacement of
|
||||
@ -17054,8 +17057,8 @@ begin
|
||||
begin
|
||||
//DebugLn(['TMainIDE.OnApplyWindowLayout ',IDEWindowStateNames[ALayout.WindowState]]);
|
||||
case ALayout.WindowState of
|
||||
iwsMinimized: ALayout.Form.WindowState:=wsMinimized;
|
||||
iwsMaximized: ALayout.Form.WindowState:=wsMaximized;
|
||||
iwsMinimized: AForm.WindowState:=wsMinimized;
|
||||
iwsMaximized: AForm.WindowState:=wsMaximized;
|
||||
end;
|
||||
|
||||
if (ALayout.CustomCoordinatesAreValid) then begin
|
||||
@ -17076,7 +17079,7 @@ begin
|
||||
if NewBounds.Top>Screen.DesktopHeight-20 then
|
||||
OffsetRect(NewBounds,NewBounds.Top-(Screen.DesktopHeight-20),0);
|
||||
// set bounds (do not use SetRestoredBounds - that flickers with the current LCL implementation)
|
||||
ALayout.Form.SetBounds(
|
||||
AForm.SetBounds(
|
||||
NewBounds.Left,NewBounds.Top,
|
||||
NewBounds.Right-NewBounds.Left,NewBounds.Bottom-NewBounds.Top);
|
||||
exit;
|
||||
@ -17102,50 +17105,43 @@ begin
|
||||
and (MainIDEBar.ComponentNotebook.ActivePageComponent<>nil) then begin
|
||||
dec(NewHeight,MainIDEBar.ComponentNotebook.ActivePageComponent.ClientHeight-25);
|
||||
end;
|
||||
ALayout.Form.SetBounds(0,0,Screen.Width-10,NewHeight);
|
||||
if DockingAllowed then begin
|
||||
ALayout.Form.Align:=alTop;
|
||||
end;
|
||||
AForm.SetBounds(0,0,Screen.Width-10,NewHeight);
|
||||
end;
|
||||
nmiwSourceNoteBookName:
|
||||
begin
|
||||
if SubIndex < 0 then SubIndex := 0;
|
||||
SubIndex := SubIndex * 30;
|
||||
ALayout.Form.SetBounds(250 + SubIndex, BarBottom + 30 + SubIndex,
|
||||
AForm.SetBounds(250 + SubIndex, BarBottom + 30 + SubIndex,
|
||||
Max(50,Screen.Width-300-SubIndex), Max(50,Screen.Height-200-BarBottom-SubIndex));
|
||||
if DockingAllowed then begin
|
||||
debugln('TMainIDE.OnApplyWindowLayout ',dbgsName(ALayout.Form));
|
||||
ALayout.Form.ManualDock(MainIDEBar,nil,alBottom,false);
|
||||
end;
|
||||
end;
|
||||
nmiwUnitDependenciesName:
|
||||
ALayout.Form.SetBounds(200,200,400,300);
|
||||
AForm.SetBounds(200,200,400,300);
|
||||
nmiwCodeExplorerName:
|
||||
begin
|
||||
ALayout.Form.SetBounds(Screen.Width-200,130,170,Max(50,Screen.Height-230));
|
||||
AForm.SetBounds(Screen.Width-200,130,170,Max(50,Screen.Height-230));
|
||||
end;
|
||||
nmiwCodeBrowser:
|
||||
begin
|
||||
ALayout.Form.SetBounds(200,100,650,500);
|
||||
AForm.SetBounds(200,100,650,500);
|
||||
end;
|
||||
nmiwClipbrdHistoryName:
|
||||
ALayout.Form.SetBounds(250,Screen.Height-400,400,300);
|
||||
AForm.SetBounds(250,Screen.Height-400,400,300);
|
||||
nmiwPkgGraphExplorer:
|
||||
ALayout.Form.SetBounds(250,150,500,350);
|
||||
AForm.SetBounds(250,150,500,350);
|
||||
nmiwProjectInspector:
|
||||
ALayout.Form.SetBounds(200,150,400,300);
|
||||
AForm.SetBounds(200,150,400,300);
|
||||
nmiwMessagesViewName:
|
||||
begin
|
||||
if SourceEditorManager.SourceWindowCount > 0 then begin
|
||||
SrcNoteBook := SourceEditorManager.SourceWindows[0];
|
||||
ALayout.Form.SetBounds(250,SrcNoteBook.Top+SrcNoteBook.Height+30,
|
||||
AForm.SetBounds(250,SrcNoteBook.Top+SrcNoteBook.Height+30,
|
||||
Max(50,Screen.Width-300),80);
|
||||
end else
|
||||
ALayout.Form.SetBounds(250,Screen.Height - 110, Max(50,Screen.Width-300),80);
|
||||
AForm.SetBounds(250,Screen.Height - 110, Max(50,Screen.Width-300),80);
|
||||
end;
|
||||
else
|
||||
if ALayout.FormID=DefaultObjectInspectorName then begin
|
||||
ALayout.Form.SetBounds(
|
||||
AForm.SetBounds(
|
||||
MainIDEBar.Left,BarBottom+30,230,Max(Screen.Height-BarBottom-120,50));
|
||||
end;
|
||||
end;
|
||||
|
@ -267,7 +267,7 @@ end;
|
||||
|
||||
procedure TSearchResultsView.Form1Create(Sender: TObject);
|
||||
var
|
||||
ALayout: TIDEWindowLayout;
|
||||
ALayout: TSimpleWindowLayout;
|
||||
begin
|
||||
FMaxItems:=50000;
|
||||
|
||||
|
@ -53,7 +53,7 @@ uses
|
||||
SynPluginSyncronizedEditBase, SourceSynEditor,
|
||||
// Intf
|
||||
SrcEditorIntf, MenuIntf, LazIDEIntf, PackageIntf, IDEHelpIntf, IDEImagesIntf,
|
||||
ProjectIntf,
|
||||
IDEWindowIntf, ProjectIntf,
|
||||
// IDE units
|
||||
IDEDialogs, LazarusIDEStrConsts, IDECommands, EditorOptions,
|
||||
WordCompletion, FindReplaceDialog, IDEProcs, IDEOptionDefs,
|
||||
@ -2646,14 +2646,20 @@ end;
|
||||
Procedure TSourceEditor.FocusEditor;
|
||||
Begin
|
||||
{$IFDEF VerboseFocus}
|
||||
writeln('TSourceEditor.FocusEditor A ',PageName,' ',FEditor.Name);
|
||||
debugln('TSourceEditor.FocusEditor A ',PageName,' ',FEditor.Name);
|
||||
{$ENDIF}
|
||||
if SourceNotebook<>nil then SourceNotebook.Visible:=true;
|
||||
FEditor.SetFocus;
|
||||
FSharedValues.SetActiveSharedEditor(Self);
|
||||
if SourceNotebook.IsVisible then begin
|
||||
FEditor.SetFocus;
|
||||
FSharedValues.SetActiveSharedEditor(Self);
|
||||
end else begin
|
||||
{$IFDEF VerboseFocus}
|
||||
debugln('TSourceEditor.FocusEditor not IsVisible: ',PageName,' ',FEditor.Name);
|
||||
{$ENDIF}
|
||||
end;
|
||||
//DebugLn('TSourceEditor.FocusEditor ',dbgsName(FindOwnerControl(GetFocus)),' ',dbgs(GetFocus));
|
||||
{$IFDEF VerboseFocus}
|
||||
writeln('TSourceEditor.FocusEditor END ',PageName,' ',FEditor.Name);
|
||||
debugln('TSourceEditor.FocusEditor END ',PageName,' ',FEditor.Name);
|
||||
{$ENDIF}
|
||||
end;
|
||||
|
||||
@ -4849,6 +4855,8 @@ begin
|
||||
FUpdateTabAndPageTimer.OnTimer := @UpdateTabsAndPageTimeReached;
|
||||
|
||||
CreateNotebook;
|
||||
|
||||
MakeIDEWindowDockable(Self);
|
||||
Application.AddOnUserInputHandler(@OnApplicationUserInput,true);
|
||||
end;
|
||||
|
||||
|
@ -102,11 +102,97 @@ type
|
||||
|
||||
var
|
||||
IDEDialogLayoutList: TIDEDialogLayoutList = nil;// set by the IDE
|
||||
|
||||
|
||||
type
|
||||
TIWDLState = (
|
||||
iwdlsHidden,
|
||||
iwdlsIconified,
|
||||
iwdlsNormal,
|
||||
iwdlsDocked
|
||||
);
|
||||
|
||||
{ TIDEWindowDefaultLayout }
|
||||
|
||||
TIDEWindowDefaultLayout = class
|
||||
private
|
||||
FDockAlign: TAlign;
|
||||
FDockSibling: string;
|
||||
FFormName: string;
|
||||
FHeight: string;
|
||||
FLeft: string;
|
||||
FState: TIWDLState;
|
||||
FTop: string;
|
||||
FWidth: string;
|
||||
procedure SetHeight(const AValue: string);
|
||||
procedure SetLeft(const AValue: string);
|
||||
procedure SetTop(const AValue: string);
|
||||
procedure SetWidth(const AValue: string);
|
||||
public
|
||||
property FormName: string read FFormName;
|
||||
property State: TIWDLState read FState write FState;
|
||||
property Left: string read FLeft write SetLeft; // '12' for 12 pixel, '10%' for 10 percent of screen.width
|
||||
property Top: string read FTop write SetTop; // '12' for 12 pixel, '10%' for 10 percent of screen.height
|
||||
property Width: string read FWidth write SetWidth; // '12' for 12 pixel, '10%' for 10 percent of screen.width
|
||||
property Height: string read FHeight write SetHeight; // '12' for 12 pixel, '10%' for 10 percent of screen.height
|
||||
property DockSibling: string read FDockSibling write FDockSibling; // another form name
|
||||
property DockAlign: TAlign read FDockAlign write FDockAlign;
|
||||
procedure CheckBoundValue(s: string);
|
||||
constructor Create(aFormName: string); overload;
|
||||
constructor Create(aFormName: string; aLeft, aTop, aWidth, aHeight: integer;
|
||||
aUnit: string = ''; aDockSibling : string = '';
|
||||
aDockAlign: TAlign = alNone); overload;
|
||||
end;
|
||||
|
||||
{ TIDEWindowDefaultLayoutList }
|
||||
|
||||
TIDEWindowDefaultLayoutList = class
|
||||
private
|
||||
fItems: TFPList; // list of TIDEWindowDefaultLayout
|
||||
function GetItems(Index: integer): TIDEWindowDefaultLayout;
|
||||
public
|
||||
constructor Create;
|
||||
destructor Destroy; override;
|
||||
procedure Clear;
|
||||
function Count: integer;
|
||||
property Items[Index: integer]: TIDEWindowDefaultLayout read GetItems;
|
||||
function Add(aLayout: TIDEWindowDefaultLayout): integer;
|
||||
procedure Delete(Index: integer);
|
||||
function IndexOfName(FormName: string): integer;
|
||||
function FindLayoutWithName(FormName: string): TIDEWindowDefaultLayout;
|
||||
end;
|
||||
|
||||
type
|
||||
|
||||
{ TIDEDockMaster }
|
||||
|
||||
TIDEDockMaster = class
|
||||
public
|
||||
procedure MakeIDEWindowDockable(AControl: TWinControl); virtual; abstract;
|
||||
procedure MakeIDEWindowDockSite(AForm: TCustomForm); virtual; abstract;
|
||||
end;
|
||||
|
||||
var
|
||||
IDEDockMaster: TIDEDockMaster = nil; // can be set by a package
|
||||
|
||||
procedure MakeIDEWindowDockable(AControl: TWinControl);
|
||||
procedure MakeIDEWindowDockSite(AForm: TCustomForm);
|
||||
|
||||
procedure Register;
|
||||
|
||||
implementation
|
||||
|
||||
procedure MakeIDEWindowDockable(AControl: TWinControl);
|
||||
begin
|
||||
if Assigned(IDEDockMaster) then
|
||||
IDEDockMaster.MakeIDEWindowDockable(AControl);
|
||||
end;
|
||||
|
||||
procedure MakeIDEWindowDockSite(AForm: TCustomForm);
|
||||
begin
|
||||
if Assigned(IDEDockMaster) then
|
||||
IDEDockMaster.MakeIDEWindowDockSite(AForm);
|
||||
end;
|
||||
|
||||
procedure Register;
|
||||
begin
|
||||
RegisterComponents('Misc',[TIDEDialogLayoutStorage]);
|
||||
@ -346,5 +432,134 @@ begin
|
||||
inherited Destroy;
|
||||
end;
|
||||
|
||||
{ TIDEWindowDefaultLayout }
|
||||
|
||||
procedure TIDEWindowDefaultLayout.SetHeight(const AValue: string);
|
||||
begin
|
||||
CheckBoundValue(AValue);
|
||||
if FHeight=AValue then exit;
|
||||
FHeight:=AValue;
|
||||
end;
|
||||
|
||||
procedure TIDEWindowDefaultLayout.SetLeft(const AValue: string);
|
||||
begin
|
||||
CheckBoundValue(AValue);
|
||||
if FLeft=AValue then exit;
|
||||
FLeft:=AValue;
|
||||
end;
|
||||
|
||||
procedure TIDEWindowDefaultLayout.SetTop(const AValue: string);
|
||||
begin
|
||||
CheckBoundValue(AValue);
|
||||
if FTop=AValue then exit;
|
||||
FTop:=AValue;
|
||||
end;
|
||||
|
||||
procedure TIDEWindowDefaultLayout.SetWidth(const AValue: string);
|
||||
begin
|
||||
CheckBoundValue(AValue);
|
||||
if FWidth=AValue then exit;
|
||||
FWidth:=AValue;
|
||||
end;
|
||||
|
||||
procedure TIDEWindowDefaultLayout.CheckBoundValue(s: string);
|
||||
var
|
||||
p: Integer;
|
||||
begin
|
||||
if s='' then exit;
|
||||
p:=1;
|
||||
while (p<=length(s)) and (s[p] in ['0'..'9']) do inc(p);
|
||||
if p<=1 then
|
||||
raise Exception.Create('TIDEWindowDefaultLayout.CheckBoundValue: expected number, but '+s+' found');
|
||||
// check for percent
|
||||
if (p<=length(s)) and (s[p]='%') then inc(p);
|
||||
if p<=length(s) then
|
||||
raise Exception.Create('TIDEWindowDefaultLayout.CheckBoundValue: expected number, but '+s+' found');
|
||||
end;
|
||||
|
||||
constructor TIDEWindowDefaultLayout.Create(aFormName: string);
|
||||
begin
|
||||
FFormName:=aFormName;
|
||||
end;
|
||||
|
||||
constructor TIDEWindowDefaultLayout.Create(aFormName: string; aLeft, aTop,
|
||||
aWidth, aHeight: integer; aUnit: string; aDockSibling: string;
|
||||
aDockAlign: TAlign);
|
||||
begin
|
||||
Create(aFormName);
|
||||
Left:=IntToStr(aLeft)+aUnit;
|
||||
Top:=IntToStr(aTop)+aUnit;
|
||||
Width:=IntToStr(aWidth)+aUnit;
|
||||
Height:=IntToStr(aHeight)+aUnit;
|
||||
DockSibling:=aDockSibling;
|
||||
DockAlign:=aDockAlign;
|
||||
end;
|
||||
|
||||
{ TIDEWindowDefaultLayoutList }
|
||||
|
||||
function TIDEWindowDefaultLayoutList.GetItems(Index: integer
|
||||
): TIDEWindowDefaultLayout;
|
||||
begin
|
||||
Result:=TIDEWindowDefaultLayout(fItems[Index]);
|
||||
end;
|
||||
|
||||
constructor TIDEWindowDefaultLayoutList.Create;
|
||||
begin
|
||||
fItems:=TFPList.Create;
|
||||
end;
|
||||
|
||||
destructor TIDEWindowDefaultLayoutList.Destroy;
|
||||
begin
|
||||
Clear;
|
||||
FreeAndNil(fItems);
|
||||
inherited Destroy;
|
||||
end;
|
||||
|
||||
procedure TIDEWindowDefaultLayoutList.Clear;
|
||||
var
|
||||
i: Integer;
|
||||
begin
|
||||
for i:=0 to fItems.Count-1 do
|
||||
TObject(fItems[i]).Free;
|
||||
end;
|
||||
|
||||
function TIDEWindowDefaultLayoutList.Count: integer;
|
||||
begin
|
||||
Result:=fItems.Count;
|
||||
end;
|
||||
|
||||
function TIDEWindowDefaultLayoutList.Add(aLayout: TIDEWindowDefaultLayout
|
||||
): integer;
|
||||
begin
|
||||
if IndexOfName(aLayout.FormName)>=0 then
|
||||
raise Exception.Create('TIDEWindowDefaultLayoutList.Add: form name already exists');
|
||||
Result:=fItems.Add(aLayout);
|
||||
end;
|
||||
|
||||
procedure TIDEWindowDefaultLayoutList.Delete(Index: integer);
|
||||
begin
|
||||
TObject(fItems[Index]).Free;
|
||||
fItems.Delete(Index);
|
||||
end;
|
||||
|
||||
function TIDEWindowDefaultLayoutList.IndexOfName(FormName: string): integer;
|
||||
begin
|
||||
Result:=Count-1;
|
||||
while (Result>=0) and (SysUtils.CompareText(FormName,Items[Result].FormName)<>0) do
|
||||
dec(Result);
|
||||
end;
|
||||
|
||||
function TIDEWindowDefaultLayoutList.FindLayoutWithName(FormName: string
|
||||
): TIDEWindowDefaultLayout;
|
||||
var
|
||||
i: LongInt;
|
||||
begin
|
||||
i:=IndexOfName(FormName);
|
||||
if i>=0 then
|
||||
Result:=Items[i]
|
||||
else
|
||||
Result:=nil;
|
||||
end;
|
||||
|
||||
end.
|
||||
|
||||
|
@ -164,6 +164,7 @@ begin
|
||||
|
||||
//store result
|
||||
DockRect := r;
|
||||
debugln(['TDockTree.PositionDockRect ',dbgs(DockRect)]);
|
||||
end;
|
||||
|
||||
procedure TDockTree.RemoveControl(AControl: TControl);
|
||||
|
@ -380,7 +380,7 @@ end;
|
||||
|
||||
constructor TPkgGraphExplorerDlg.Create(TheOwner: TComponent);
|
||||
var
|
||||
ALayout: TIDEWindowLayout;
|
||||
ALayout: TSimpleWindowLayout;
|
||||
begin
|
||||
inherited Create(TheOwner);
|
||||
FUpdateLock:=PackageGraph.UpdateLock;
|
||||
|
Loading…
Reference in New Issue
Block a user