Merged revision(s) 51337-51338 #c0b1fba604-#c0b1fba604, 51345-51347 #68cf5f1d72-#68cf5f1d72, 51360 #5771737dee, 51362 #579a1526dc from trunk:

IDE: fix WM_SIZE loop when restoring maximized IDE and using AnchorDocking. Issue #28096
........
IDEIntf, AnchorDocking: make ResetSplitters public and use it in TMainIDEBar.InitPaletteAndCoolBar. Related to issue #28096
........
anchordocking: check HostDockSite in TAnchorDockMaster.CloseUnneededControls
........
IDE: fix InitPaletteAndCoolBar for non-docked IDE. Regression from r51338 #64d6d494f8. Issue #28096
........
anchordocking: really find MainIDE site in AdjustMainIDEWindowHeight.
........
IDE: fixed crash when IDE is closing
........
IDE: Prevent component selection on startup in ComponentList. Issue #29454, patch from Balázs Székely.
........

git-svn-id: branches/fixes_1_6@51516 -
This commit is contained in:
maxim 2016-02-06 14:12:55 +00:00
parent 314291368a
commit 0ff9fdd2be
6 changed files with 61 additions and 29 deletions

View File

@ -526,7 +526,6 @@ type
procedure MapTreeToControls(Tree: TAnchorDockLayoutTree);
function RestoreLayout(Tree: TAnchorDockLayoutTree; Scale: boolean): boolean;
procedure EnableAllAutoSizing;
procedure ResetSplitters;
procedure ClearLayoutProperties(AControl: TControl; NewAlign: TAlign = alClient);
procedure PopupMenuPopup(Sender: TObject);
procedure ChangeLockButtonClick(Sender: TObject);
@ -614,6 +613,7 @@ type
procedure LoadSettings(Settings: TAnchorDockSettings);
procedure SaveSettings(Settings: TAnchorDockSettings);
function SettingsAreEqual(Settings: TAnchorDockSettings): boolean;
procedure ResetSplitters;
// manual docking
procedure ManualFloat(AControl: TControl);
@ -1476,13 +1476,16 @@ begin
DisableControlAutoSizing(AControl);
// AControl is currently on a visible site, but not in the Tree
// => close site
debugln(['TAnchorDockMaster.CloseUnneededControls Control=',DbgSName(AControl),' Site=',AControl.HostDockSite.Name]);
if AControl.HostDockSite is TAnchorDockHostSite then begin
if not TAnchorDockHostSite(AControl.HostDockSite).CloseSite then begin
if FControls.IndexOf(AControl)<0 then
AControl:=nil;
debugln(['TAnchorDockMaster.CloseUnneededControls CloseSite failed Control=',DbgSName(AControl)]);
exit(false);
if AControl.HostDockSite <> nil then
begin
debugln(['TAnchorDockMaster.CloseUnneededControls Control=',DbgSName(AControl),' Site=',AControl.HostDockSite.Name]);
if AControl.HostDockSite is TAnchorDockHostSite then begin
if not TAnchorDockHostSite(AControl.HostDockSite).CloseSite then begin
if FControls.IndexOf(AControl)<0 then
AControl:=nil;
debugln(['TAnchorDockMaster.CloseUnneededControls CloseSite failed Control=',DbgSName(AControl)]);
exit(false);
end;
end;
end;
if FControls.IndexOf(AControl)>=0 then begin

View File

@ -42,7 +42,7 @@ uses
// LazUtils
LazFileCache, LazFileUtils,
// IdeIntf
LCLIntf, IDEWindowIntf, IDEOptionsIntf,
LCLIntf, IDEWindowIntf, IDEOptionsIntf, LazIDEIntf,
// AnchorDocking
AnchorDockStr, AnchorDocking, AnchorDesktopOptions, AnchorDockOptionsDlg;
@ -82,6 +82,7 @@ type
procedure AdjustMainIDEWindowHeight(const AIDEWindow: TCustomForm;
const AAdjustHeight: Boolean; const ANewHeight: Integer); override;
procedure CloseAll; override;
procedure ResetSplitters; override;
end;
{ TAnchorDockIDEFrame }
@ -232,6 +233,11 @@ begin
end;
end;
procedure TIDEAnchorDockMaster.ResetSplitters;
begin
DockMaster.ResetSplitters;
end;
procedure TIDEAnchorDockMaster.MakeIDEWindowDockable(AControl: TWinControl);
begin
{$IFDEF VerboseAnchorDocking}
@ -260,13 +266,16 @@ begin
Site := nil;
for I := 0 to AIDEWindow.ControlCount-1 do
if AIDEWindow.Controls[I] is TAnchorDockHostSite then
begin
Site := TAnchorDockHostSite(AIDEWindow.Controls[I]);
Break;
end;
if AIDEWindow.Controls[I] is TAnchorDockHostSite then
begin
Site := TAnchorDockHostSite(AIDEWindow.Controls[I]);
if (Site.Parent<>nil) and (Site.Parent=LazarusIDE.GetMainBar) then
Break // found
else
Site := nil;
end;
if not Assigned(Site) then
if (Site=nil) or (Site.BoundSplitter=nil) then
Exit;
Site.BoundSplitter.Enabled := not AAdjustHeight;

View File

@ -476,6 +476,7 @@ type
procedure AdjustMainIDEWindowHeight(const {%H-}AIDEWindow: TCustomForm;
const {%H-}AAdjustHeight: Boolean; const {%H-}ANewHeight: Integer); virtual;
procedure CloseAll; virtual; // close all forms, called after IDE has saved all and shuts down
procedure ResetSplitters; virtual; abstract; // if the dock site has been resized after loading, you have to reset (percentual) splitters
function DockedDesktopOptClass: TAbstractDesktopDockingOptClass; virtual; abstract;
property HideSimpleLayoutOptions: boolean read FHideSimpleLayoutOptions;
end;

View File

@ -84,6 +84,7 @@ type
// List for Component inheritence view
FClassList: TStringList;
FKeepSelected: Boolean;
FFirstTimeAnchored: Boolean;
procedure ClearSelection;
procedure SelectionWasChanged;
procedure ComponentWasAdded({%H-}ALookupRoot, {%H-}AComponent: TComponent;
@ -163,9 +164,13 @@ begin
UpdateButtonState;
end
else
begin
PageControl.AnchorSideBottom.Side := asrBottom;
// Only with AnchorDocking. This is a temporary solution, many usability issues remain.
FFirstTimeAnchored := True;
end;
if not Assigned(Parent) then//only in undocked IDE
if not Assigned(Parent) then //only in undocked IDE
begin
if TreeFilterEd.CanFocus then
TreeFilterEd.SetFocus;
@ -386,10 +391,21 @@ procedure TComponentListForm.ComponentsChange(Sender: TObject; Node: TTreeNode);
var
AComponent: TRegisteredComponent;
begin
AComponent:=GetSelectedComponent;
if AComponent<>nil then
IDEComponentPalette.SetSelectedComp(AComponent, ssShift in GetKeyShiftState);
UpdateButtonState;
if FFirstTimeAnchored then
begin
// Only run once when the anchored IDE starts.
FFirstTimeAnchored := False;
IDEComponentPalette.SetSelectedComp(nil, False);
ListTree.Selected := Nil;
PalletteTree.Selected := Nil;
InheritanceTree.Selected := Nil;
end
else begin
AComponent:=GetSelectedComponent;
if AComponent<>nil then
IDEComponentPalette.SetSelectedComp(AComponent, ssShift in GetKeyShiftState);
UpdateButtonState;
end;
end;
procedure TComponentListForm.TreeKeyPress(Sender: TObject; var Key: char);

View File

@ -1575,6 +1575,7 @@ begin
MainIDEBar.SetupHints;
SetupIDEWindowsLayout;
RestoreIDEWindows;
MainIDEBar.InitPaletteAndCoolBar;
IDEWindowCreators.AddLayoutChangedHandler(@HandleLayoutChanged);
// make sure the main IDE bar is always shown
IDEWindowCreators.ShowForm(MainIDEBar,false);
@ -3537,7 +3538,7 @@ begin
inherited SetToolStatus(AValue);
if DebugBoss <> nil then
DebugBoss.UpdateButtonsAndMenuItems;
if Assigned(MainIDEBar) then
if Assigned(MainIDEBar) and not IDEIsClosing then
MainIDEBar.AllowCompilation(ToolStatus <> itBuilder); // Disable some GUI controls while compiling.
if FWaitForClose and (ToolStatus = itNone) then
begin

View File

@ -58,7 +58,6 @@ type
function CalcNonClientHeight: Integer;
protected
procedure DoActive;
procedure DoShow; override;
procedure WndProc(var Message: TLMessage); override;
procedure Resizing(State: TWindowState); override;
public
@ -386,6 +385,7 @@ type
procedure DoSetMainIDEHeight(const AIDEIsMaximized: Boolean; ANewHeight: Integer = 0);
procedure DoSetViewComponentPalette(aVisible: Boolean);
procedure AllowCompilation(aAllow: Boolean);
procedure InitPaletteAndCoolBar;
end;
var
@ -445,13 +445,6 @@ begin
end;
end;
procedure TMainIDEBar.DoShow;
begin
inherited DoShow;
RefreshCoolbar;
ComponentPageControl.OnChange(Self);//refresh component palette with button reposition
end;
function TMainIDEBar.CalcNonClientHeight: Integer;
{$IF DEFINED(LCLWin32) OR DEFINED(LCLGtk2) OR DEFINED(LCLQt)}
var
@ -674,6 +667,15 @@ begin
SetupHints;
end;
procedure TMainIDEBar.InitPaletteAndCoolBar;
begin
RefreshCoolbar;
ComponentPageControl.OnChange(Self);//refresh component palette with button reposition
SetMainIDEHeight;
if IDEDockMaster<>nil then
IDEDockMaster.ResetSplitters;
end;
procedure TMainIDEBar.RefreshCoolbar;
var
I: Integer;