You've already forked lazarus-ccr
manualdocker: patch from Martin Friebe to work correct with the latest source editor
git-svn-id: https://svn.code.sf.net/p/lazarus-ccr/svn@1189 8e941d3f-bd1b-0410-a28a-d453659cc2b4
This commit is contained in:
@ -35,6 +35,8 @@ type
|
|||||||
{ TManualDocker }
|
{ TManualDocker }
|
||||||
|
|
||||||
TManualDocker = class(TObject)
|
TManualDocker = class(TObject)
|
||||||
|
private
|
||||||
|
FCurrentSrcWin: TWinControl;
|
||||||
protected
|
protected
|
||||||
procedure ChangeDocking(DockingEnabled: Boolean);
|
procedure ChangeDocking(DockingEnabled: Boolean);
|
||||||
procedure LoadState(cfg: TXMLConfig; var Astate: TDockState; const StateName: string);
|
procedure LoadState(cfg: TXMLConfig; var Astate: TDockState; const StateName: string);
|
||||||
@ -43,8 +45,12 @@ type
|
|||||||
procedure SaveStates;
|
procedure SaveStates;
|
||||||
|
|
||||||
procedure AllocControls(AParent: TWinControl);
|
procedure AllocControls(AParent: TWinControl);
|
||||||
|
procedure DeallocControls;
|
||||||
procedure RealignControls;
|
procedure RealignControls;
|
||||||
procedure UpdateDockState(var astate: TDockState; wnd: TWinControl);
|
procedure UpdateDockState(var astate: TDockState; wnd: TWinControl);
|
||||||
|
|
||||||
|
procedure SourceWindowCreated(Sender: TObject);
|
||||||
|
procedure SourceWindowDestroyed(Sender: TObject);
|
||||||
public
|
public
|
||||||
ConfigPath : AnsiString;
|
ConfigPath : AnsiString;
|
||||||
split : TSplitter;
|
split : TSplitter;
|
||||||
@ -87,8 +93,10 @@ var
|
|||||||
i : Integer;
|
i : Integer;
|
||||||
begin
|
begin
|
||||||
if DockingEnabled then begin
|
if DockingEnabled then begin
|
||||||
if not Assigned(SourceEditorWindow) or not Assigned(IDEMessagesWindow) then Exit;
|
if not (Assigned(SourceEditorManagerIntf) and Assigned(SourceEditorManagerIntf.ActiveSourceWindow))
|
||||||
if not Assigned(panel) then AllocControls(SourceEditorWindow);
|
or not Assigned(IDEMessagesWindow)
|
||||||
|
then Exit;
|
||||||
|
if not Assigned(panel) then AllocControls(SourceEditorManagerIntf.ActiveSourceWindow);
|
||||||
split.visible:=true;
|
split.visible:=true;
|
||||||
panel.visible:=true;
|
panel.visible:=true;
|
||||||
with IDEMessagesWindow do
|
with IDEMessagesWindow do
|
||||||
@ -117,6 +125,7 @@ begin
|
|||||||
IDEMessagesWindow.BorderStyle := FloatBrd;
|
IDEMessagesWindow.BorderStyle := FloatBrd;
|
||||||
end;
|
end;
|
||||||
IDEMessagesWindow.TabStop := true;
|
IDEMessagesWindow.TabStop := true;
|
||||||
|
IDEMessagesWindow.Show;
|
||||||
end;
|
end;
|
||||||
MsgWnd.docked := DockingEnabled;
|
MsgWnd.docked := DockingEnabled;
|
||||||
cmd.Checked := DockingEnabled;
|
cmd.Checked := DockingEnabled;
|
||||||
@ -127,6 +136,11 @@ var
|
|||||||
pths : array [0..1] of String;
|
pths : array [0..1] of String;
|
||||||
i : Integer;
|
i : Integer;
|
||||||
begin
|
begin
|
||||||
|
if SourceEditorManagerIntf <> nil then begin
|
||||||
|
SourceEditorManagerIntf.RegisterChangeEvent(semWindowCreate, @SourceWindowCreated);
|
||||||
|
SourceEditorManagerIntf.RegisterChangeEvent(semWindowDestroy, @SourceWindowDestroyed);
|
||||||
|
end;
|
||||||
|
|
||||||
pths[0]:= LazarusIDE.GetPrimaryConfigPath;
|
pths[0]:= LazarusIDE.GetPrimaryConfigPath;
|
||||||
pths[1]:= LazarusIDE.GetSecondaryConfigPath;
|
pths[1]:= LazarusIDE.GetSecondaryConfigPath;
|
||||||
for i := 0 to length(pths)-1 do begin
|
for i := 0 to length(pths)-1 do begin
|
||||||
@ -169,6 +183,7 @@ end;
|
|||||||
|
|
||||||
procedure TManualDocker.AllocControls(AParent: TWinControl);
|
procedure TManualDocker.AllocControls(AParent: TWinControl);
|
||||||
begin
|
begin
|
||||||
|
FCurrentSrcWin := AParent;
|
||||||
panel := TPanel.Create(nil);
|
panel := TPanel.Create(nil);
|
||||||
panel.Parent := AParent;
|
panel.Parent := AParent;
|
||||||
panel.BorderStyle := bsNone;
|
panel.BorderStyle := bsNone;
|
||||||
@ -179,6 +194,12 @@ begin
|
|||||||
RealignControls;
|
RealignControls;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
procedure TManualDocker.DeallocControls;
|
||||||
|
begin
|
||||||
|
FreeAndNil(split);
|
||||||
|
FreeAndNil(panel);
|
||||||
|
end;
|
||||||
|
|
||||||
procedure TManualDocker.RealignControls;
|
procedure TManualDocker.RealignControls;
|
||||||
begin
|
begin
|
||||||
panel.Align := alClient;
|
panel.Align := alClient;
|
||||||
@ -193,6 +214,34 @@ begin
|
|||||||
astate.DockSize.cy := wnd.ClientHeight;
|
astate.DockSize.cy := wnd.ClientHeight;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
procedure TManualDocker.SourceWindowCreated(Sender: TObject);
|
||||||
|
begin
|
||||||
|
if Assigned(FCurrentSrcWin) or (SourceEditorManagerIntf.SourceWindowCount > 1) then
|
||||||
|
exit;
|
||||||
|
if MsgWnd.Docked then
|
||||||
|
ChangeDocking(true);
|
||||||
|
end;
|
||||||
|
|
||||||
|
procedure TManualDocker.SourceWindowDestroyed(Sender: TObject);
|
||||||
|
var
|
||||||
|
IsDocked: Boolean;
|
||||||
|
begin
|
||||||
|
IsDocked := MsgWnd.docked;
|
||||||
|
if FCurrentSrcWin <> Sender then exit;
|
||||||
|
if IsDocked then
|
||||||
|
ChangeDocking(False);
|
||||||
|
FCurrentSrcWin := nil;
|
||||||
|
DeallocControls;
|
||||||
|
if IsDocked then begin
|
||||||
|
if (SourceEditorManagerIntf.SourceWindowCount >= 1) then
|
||||||
|
ChangeDocking(True)
|
||||||
|
else
|
||||||
|
if Assigned(IDEMessagesWindow) then
|
||||||
|
IDEMessagesWindow.Hide;
|
||||||
|
MsgWnd.Docked := IsDocked;
|
||||||
|
end;
|
||||||
|
end;
|
||||||
|
|
||||||
procedure TManualDocker.LoadState(cfg: TXMLConfig; var Astate: TDockState;
|
procedure TManualDocker.LoadState(cfg: TXMLConfig; var Astate: TDockState;
|
||||||
const StateName: string);
|
const StateName: string);
|
||||||
begin
|
begin
|
||||||
|
Reference in New Issue
Block a user