mirror of
https://gitlab.com/freepascal.org/lazarus/lazarus.git
synced 2025-08-17 17:59:16 +02:00
ide: docking testing
- make Messages and CodeExplorer windows dockable - add docksites to uniteditor (disabled through EnableDocking - see ide.inc) git-svn-id: trunk@13894 -
This commit is contained in:
parent
7eef259d42
commit
e8408b475d
@ -35,6 +35,8 @@ unit CodeExplorer;
|
|||||||
|
|
||||||
interface
|
interface
|
||||||
|
|
||||||
|
{$I ide.inc}
|
||||||
|
|
||||||
uses
|
uses
|
||||||
// FCL+LCL
|
// FCL+LCL
|
||||||
Classes, SysUtils, LCLProc, LCLType, LResources, Forms, Controls, Graphics,
|
Classes, SysUtils, LCLProc, LCLType, LResources, Forms, Controls, Graphics,
|
||||||
@ -300,6 +302,10 @@ procedure TCodeExplorerView.CodeExplorerViewCREATE(Sender: TObject);
|
|||||||
var
|
var
|
||||||
B: TBitmap;
|
B: TBitmap;
|
||||||
begin
|
begin
|
||||||
|
{$ifdef EnableDocking}
|
||||||
|
DragKind := dkDock;
|
||||||
|
DragMode := dmAutomatic;
|
||||||
|
{$endif}
|
||||||
LoadCodeExplorerOptions;
|
LoadCodeExplorerOptions;
|
||||||
|
|
||||||
FMode := CodeExplorerOptions.Mode;
|
FMode := CodeExplorerOptions.Mode;
|
||||||
|
@ -34,5 +34,7 @@
|
|||||||
{$DEFINE DisableFakeMethods}
|
{$DEFINE DisableFakeMethods}
|
||||||
{$ENDIF}
|
{$ENDIF}
|
||||||
|
|
||||||
|
{.$DEFINE EnableDocking}
|
||||||
|
|
||||||
// end.
|
// end.
|
||||||
|
|
||||||
|
@ -36,6 +36,8 @@ unit MsgView;
|
|||||||
|
|
||||||
interface
|
interface
|
||||||
|
|
||||||
|
{$I ide.inc}
|
||||||
|
|
||||||
uses
|
uses
|
||||||
Classes, SysUtils, AVL_Tree,
|
Classes, SysUtils, AVL_Tree,
|
||||||
LCLProc, LResources, ClipBrd, Controls, Dialogs, FileUtil, Forms, Menus,
|
LCLProc, LResources, ClipBrd, Controls, Dialogs, FileUtil, Forms, Menus,
|
||||||
@ -277,6 +279,12 @@ constructor TMessagesView.Create(TheOwner: TComponent);
|
|||||||
begin
|
begin
|
||||||
IDEMessagesWindow:=Self;
|
IDEMessagesWindow:=Self;
|
||||||
inherited Create(TheOwner);
|
inherited Create(TheOwner);
|
||||||
|
|
||||||
|
{$ifdef EnableDocking}
|
||||||
|
DragKind := dkDock;
|
||||||
|
DragMode := dmAutomatic;
|
||||||
|
{$endif}
|
||||||
|
|
||||||
Name := NonModalIDEWindowNames[nmiwMessagesViewName];
|
Name := NonModalIDEWindowNames[nmiwMessagesViewName];
|
||||||
FItems := TFPList.Create;
|
FItems := TFPList.Create;
|
||||||
FVisibleItems := TFPList.Create;
|
FVisibleItems := TFPList.Create;
|
||||||
|
@ -61,7 +61,10 @@ uses
|
|||||||
SortSelectionDlg, EncloseSelectionDlg, DiffDialog, ConDef, InvertAssignTool,
|
SortSelectionDlg, EncloseSelectionDlg, DiffDialog, ConDef, InvertAssignTool,
|
||||||
SourceEditProcs, SourceMarks, CharacterMapDlg, SearchFrm,
|
SourceEditProcs, SourceMarks, CharacterMapDlg, SearchFrm,
|
||||||
FPDocHints, FPDocEditWindow,
|
FPDocHints, FPDocEditWindow,
|
||||||
BaseDebugManager, Debugger, MainIntf;
|
BaseDebugManager, Debugger, MainIntf
|
||||||
|
{$ifdef EnableDocking}
|
||||||
|
,LDockTree
|
||||||
|
{$endif};
|
||||||
|
|
||||||
type
|
type
|
||||||
TSourceNotebook = class;
|
TSourceNotebook = class;
|
||||||
@ -533,6 +536,18 @@ type
|
|||||||
var Abort: boolean): string;
|
var Abort: boolean): string;
|
||||||
function MacroFuncPrompt(const s:string; const Data: PtrInt;
|
function MacroFuncPrompt(const s:string; const Data: PtrInt;
|
||||||
var Abort: boolean): string;
|
var Abort: boolean): string;
|
||||||
|
private
|
||||||
|
// for docking
|
||||||
|
FDockPanels: array[TAlign] of TPanel;
|
||||||
|
FDockSplitters: array[TAlign] of TSplitter;
|
||||||
|
procedure DockPanelGetSiteInfo(Sender: TObject; DockClient: TControl;
|
||||||
|
var InfluenceRect: TRect; MousePos: TPoint; var CanDock: Boolean);
|
||||||
|
procedure DockPanelDockOver(Sender: TObject; Source: TDragDockObject; X,
|
||||||
|
Y: Integer; State: TDragState; var Accept: Boolean);
|
||||||
|
procedure DockPanelDockDrop(Sender: TObject; Source: TDragDockObject; X,
|
||||||
|
Y: Integer);
|
||||||
|
procedure DockPanelUnDock(Sender: TObject; Client: TControl;
|
||||||
|
NewTarget: TWinControl; var Allow: Boolean);
|
||||||
protected
|
protected
|
||||||
ccSelection: String;
|
ccSelection: String;
|
||||||
States: TSourceNotebookStates;
|
States: TSourceNotebookStates;
|
||||||
@ -2945,8 +2960,41 @@ end;
|
|||||||
{ TSourceNotebook }
|
{ TSourceNotebook }
|
||||||
|
|
||||||
constructor TSourceNotebook.Create(AOwner: TComponent);
|
constructor TSourceNotebook.Create(AOwner: TComponent);
|
||||||
begin
|
{$ifdef EnableDocking}
|
||||||
|
var
|
||||||
|
Al: TAlign;
|
||||||
|
{$endif}
|
||||||
|
begin
|
||||||
inherited Create(AOwner);
|
inherited Create(AOwner);
|
||||||
|
{$ifdef EnableDocking}
|
||||||
|
for Al := Low(TAlign) to High(TAlign) do
|
||||||
|
begin
|
||||||
|
if Al in [alNone, alClient] then
|
||||||
|
continue;
|
||||||
|
FDockPanels[Al] := TPanel.Create(Self);
|
||||||
|
with FDockPanels[Al] do
|
||||||
|
begin
|
||||||
|
Width := 0;
|
||||||
|
Height := 0;
|
||||||
|
Parent := Self;
|
||||||
|
Align := Al;
|
||||||
|
DockSite := True;
|
||||||
|
OnDockDrop := @DockPanelDockDrop;
|
||||||
|
OnDockOver := @DockPanelDockOver;
|
||||||
|
OnGetSiteInfo := @DockPanelGetSiteInfo;
|
||||||
|
OnUnDock := @DockPanelUnDock;
|
||||||
|
end;
|
||||||
|
FDockSplitters[Al] := TSplitter.Create(Self);
|
||||||
|
with FDockSplitters[Al] do
|
||||||
|
begin
|
||||||
|
Parent := Self;
|
||||||
|
Align := Al;
|
||||||
|
MinSize := 0;
|
||||||
|
AutoSnap := False;
|
||||||
|
Visible := False;
|
||||||
|
end;
|
||||||
|
end;
|
||||||
|
{$endif}
|
||||||
IDESearchInText:=@SearchInText;
|
IDESearchInText:=@SearchInText;
|
||||||
Visible:=false;
|
Visible:=false;
|
||||||
Name:=NonModalIDEWindowNames[nmiwSourceNoteBookName];
|
Name:=NonModalIDEWindowNames[nmiwSourceNoteBookName];
|
||||||
@ -6183,6 +6231,71 @@ begin
|
|||||||
FOnCloseClicked(Sender,GetKeyState(VK_CONTROL)<0);
|
FOnCloseClicked(Sender,GetKeyState(VK_CONTROL)<0);
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
const
|
||||||
|
DockZoneSize = 150;
|
||||||
|
|
||||||
|
procedure TSourceNotebook.DockPanelGetSiteInfo(Sender: TObject; DockClient: TControl;
|
||||||
|
var InfluenceRect: TRect; MousePos: TPoint; var CanDock: Boolean);
|
||||||
|
begin
|
||||||
|
CanDock := TWinControl(Sender).ControlCount = 0;
|
||||||
|
if CanDock then
|
||||||
|
case TWinControl(Sender).Align of
|
||||||
|
alLeft: InfluenceRect.Right := InfluenceRect.Left + DockZoneSize;
|
||||||
|
alTop: InfluenceRect.Bottom := InfluenceRect.Bottom + DockZoneSize;
|
||||||
|
alRight: InfluenceRect.Left := InfluenceRect.Right - DockZoneSize;
|
||||||
|
alBottom: InfluenceRect.Top := InfluenceRect.Top - DockZoneSize;
|
||||||
|
end;
|
||||||
|
end;
|
||||||
|
|
||||||
|
procedure TSourceNotebook.DockPanelDockOver(Sender: TObject; Source: TDragDockObject;
|
||||||
|
X, Y: Integer; State: TDragState; var Accept: Boolean);
|
||||||
|
var
|
||||||
|
ARect: TRect;
|
||||||
|
begin
|
||||||
|
Accept := TWinControl(Sender).ControlCount = 0;
|
||||||
|
if Accept then
|
||||||
|
begin
|
||||||
|
ARect := Source.DockRect;
|
||||||
|
case TWinControl(Sender).Align of
|
||||||
|
alLeft: ARect.Right := ARect.Left + DockZoneSize;
|
||||||
|
alTop: ARect.Bottom := ARect.Bottom + DockZoneSize;
|
||||||
|
alRight: ARect.Left := ARect.Right - DockZoneSize;
|
||||||
|
alBottom: ARect.Top := ARect.Top - DockZoneSize;
|
||||||
|
end;
|
||||||
|
Source.DockRect := ARect;
|
||||||
|
end;
|
||||||
|
end;
|
||||||
|
|
||||||
|
procedure TSourceNotebook.DockPanelDockDrop(Sender: TObject; Source: TDragDockObject;
|
||||||
|
X, Y: Integer);
|
||||||
|
begin
|
||||||
|
with TWinControl(Sender) do
|
||||||
|
begin
|
||||||
|
if (Align in [alLeft, alRight]) and (Width = 0) then
|
||||||
|
Width := 150
|
||||||
|
else
|
||||||
|
if (Align in [alTop, alBottom]) and (Height = 0) then
|
||||||
|
Height := 150;
|
||||||
|
if Align = alBottom then
|
||||||
|
Top := StatusBar.Top - Height;
|
||||||
|
FDockSplitters[Align].ResizeControl := TWinControl(Sender);
|
||||||
|
FDockSplitters[Align].Visible := True;
|
||||||
|
//WriteLn(FDockSplitters[Align].Left, ' ', FDockSplitters[Align].Width);
|
||||||
|
end;
|
||||||
|
end;
|
||||||
|
|
||||||
|
procedure TSourceNotebook.DockPanelUnDock(Sender: TObject; Client: TControl;
|
||||||
|
NewTarget: TWinControl; var Allow: Boolean);
|
||||||
|
begin
|
||||||
|
Allow := True;
|
||||||
|
with TWinControl(Sender) do
|
||||||
|
begin
|
||||||
|
Width := 0;
|
||||||
|
Height := 0;
|
||||||
|
FDockSplitters[Align].Visible := False;
|
||||||
|
end;
|
||||||
|
end;
|
||||||
|
|
||||||
|
|
||||||
{ GOTO DIALOG }
|
{ GOTO DIALOG }
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user