View Issue Details

IDProjectCategoryView StatusLast Update
0027940PatchesIDEpublic2015-05-10 19:04
ReporterOndrej Pokorny Assigned ToJuha Manninen  
PrioritynormalSeverityminorReproducibilityalways
Status closedResolutionfixed 
PlatformWindowsOSWindows 7 
Product Version1.5 (SVN) 
Summary0027940: Lazarus IDE has an unnecessary MaxHeight-constraint
DescriptionLazarus IDE main form has a MaxHeight-constraint that does not allow to set a proper height when the main form width is shrunk to toolbar size and the component palette is hidden.

As a result, the toolbars go away from the main form.

I propose to remove the constraint - it is an unnecessary limitation.
Steps To ReproduceHide the component palette and set the width of Lazarus IDE main form according to the image. The debug toolbar is hidden by more than 50%. You cannot adjust the height of the main form because of the constraint.
TagsNo tags attached.
Fixed in Revisionr48925, r48937, r48959, r48977
LazTarget-
WidgetsetWin32/Win64
Attached Files

Relationships

related to 0028036 confirmed Lazarus Form ClientHeight ignores main menu height 
related to 0028033 new Lazarus Form height constraint ignores main menu height 
related to 0028034 resolvedZeljan Rikalo Lazarus GetSystemMetrics(SM_CYMENU) delivers wrong result 
related to 0028063 closedJuha Manninen Lazarus IDE main window height calculation does not work with QT on Linux 

Activities

Ondrej Pokorny

2015-04-23 12:26

developer  

laz-ide-height.png (23,090 bytes)   
laz-ide-height.png (23,090 bytes)   

Juha Manninen

2015-04-23 17:34

developer   ~0083143

Yes, it is even a bigger problem with the new configurable IDE Coolbar. A third Toolbar below the 2 default Toolbars is never visible.
Why is the constraint there? Does something else break if it is removed?

Bart Broersma

2015-04-23 21:08

developer   ~0083147

What happens if you remove the constraint and then maximize the main window (I have it maximized always)?

Ondrej Pokorny

2015-04-23 21:14

developer   ~0083148

@Bart - yes, that may be the reason! So there should be a function that sets the constraint according to the toolbar dimension - that should satisfy everybody.

(It shouldn't be a big problem to write it - you just have to check for the toolbars height in OnResize and change the constraint).

Ondrej Pokorny

2015-04-23 21:15

developer   ~0083149

+ of course taking the component palette height into consideration as well, if it is shown.

Balázs Székely

2015-05-03 10:40

developer   ~0083422

I attached a possible solution. MainIDEBar will resize itself according to Coolbar or/and ComponentPalette height.

https://youtu.be/wTE4DfE1BAg

Balázs Székely

2015-05-03 10:41

developer  

MainIDEBar_Heigth.patch (5,715 bytes)   
Index: ide/main.pp
===================================================================
--- ide/main.pp	(revision 48922)
+++ ide/main.pp	(working copy)
@@ -1466,12 +1466,12 @@
     // 2. components palette buttons = 32
     // 3. menu height provided by widgetset (varies , depends on theme)
     // so we set 22 + 32 + (borders * 2).
-    MainIDEBar.Constraints.MaxHeight := AMenuHeight +
-      22 {cmd speedbtns} + 32 {component buttons} +
+    MainIDEBar.NonClientHeight := AMenuHeight +
+      //22 {cmd speedbtns} + 32 {component buttons} +
       LCLIntf.GetSystemMetrics(SM_CYSIZEFRAME) +
       (LCLIntf.GetSystemMetrics(SM_CYBORDER) * 2) {borders};
   end else
-    MainIDEBar.Constraints.MaxHeight:=85;
+    MainIDEBar.NonClientHeight :=85;
 
   MainIDEBar.Name := NonModalIDEWindowNames[nmiwMainIDEName];
   FormCreator:=IDEWindowCreators.Add(MainIDEBar.Name);
@@ -2021,6 +2021,11 @@
   MainIDEBar.MainSplitter.MinSize := 50;
   MainIDEBar.MainSplitter.OnMoved := @MainIDEBar.MainSplitterMoved;
 
+  MainIDEBar.tmIDEHeigth := TTimer.Create(OwningComponent);
+  MainIDEBar.tmIDEHeigth.Interval := 100;
+  MainIDEBar.tmIDEHeigth.Enabled := False;
+  MainIDEBar.tmIDEHeigth.OnTimer := @MainIDEBar.OnTimer;
+
   MainIDEBar.CoolBar := TCoolBar.Create(OwningComponent);
   MainIDEBar.CoolBar.Parent := MainIDEBar;
   if EnvironmentOptions.ComponentPaletteVisible then
@@ -3721,6 +3726,7 @@
     MainIDEBar.CoolBar.Align := alClient;
   MainIDEBar.MainSplitter.Visible := MainIDEBar.Coolbar.Visible and
                                      MainIDEBar.ComponentPageControl.Visible;
+  MainIDEBar.SetMainIDEHeigth;
 end;
 
 procedure TMainIDE.DoToggleViewIDESpeedButtons;
@@ -3734,6 +3740,7 @@
   EnvironmentOptions.IDECoolBarOptions.IDECoolBarVisible := SpeedButtonsVisible;
   MainIDEBar.MainSplitter.Visible := MainIDEBar.Coolbar.Visible and
                                      MainIDEBar.ComponentPageControl.Visible;
+  MainIDEBar.SetMainIDEHeigth;
 end;
 
 procedure TMainIDE.AllowCompilation(aAllow: Boolean);
Index: ide/mainbar.pas
===================================================================
--- ide/mainbar.pas	(revision 48922)
+++ ide/mainbar.pas	(working copy)
@@ -44,6 +44,7 @@
   ProjectIntf, NewItemIntf, MenuIntf, LazIDEIntf, LazFileCache,
   EnvironmentOpts, LazarusIDEStrConsts, IDEImagesIntf, ToolbarData;
 
+
 type
   { TMainIDEBar }
 
@@ -52,6 +53,7 @@
     //Coolbar and PopUpMenus
     CoolBar: TCoolBar;
     pmOptions: TPopupMenu;
+    tmIDEHeigth: TTimer;
     miOptions: TMenuItem;
     OpenFilePopUpMenu: TPopupMenu;
     SetBuildModePopupMenu: TPopupMenu;
@@ -362,9 +364,11 @@
       const FileNames: array of String);
     procedure CoolBarOnChange(Sender: TObject);
     procedure MainSplitterMoved(Sender: TObject);
+    procedure OnTimer(Sender: TObject);
   private
     FOldWindowState: TWindowState;
     FOnActive: TNotifyEvent;
+    FNonClientHeight: Integer;
     procedure NewUFDefaultClick(Sender: TObject);
     procedure NewUnitFormPopupMenuPopup(Sender: TObject);
   protected
@@ -378,8 +382,12 @@
     property OnActive: TNotifyEvent read FOnActive write FOnActive;
     procedure UpdateDockCaption({%H-}Exclude: TControl); override;
     procedure RefreshCoolbar;
+    procedure SetMainIDEHeigth;
+  public
+    property NonClientHeight: Integer read FNonClientHeight write FNonClientHeight;
   end;
 
+
 var
   MainIDEBar: TMainIDEBar = nil;
 
@@ -575,13 +583,16 @@
   MainSplitter.Align := alLeft;
   MainSplitter.Visible := MainIDEBar.Coolbar.Visible and
                           MainIDEBar.ComponentPageControl.Visible;
+  MainIDEBar.SetMainIDEHeigth;
 end;
 
 procedure TMainIDEBar.MainSplitterMoved(Sender: TObject);
 begin
   EnvironmentOptions.IDECoolBarOptions.IDECoolBarWidth := CoolBar.Width;
+  SetMainIDEHeigth
 end;
 
+
 procedure TMainIDEBar.CoolBarOnChange(Sender: TObject);
 var
   I, J: Integer;
@@ -601,8 +612,56 @@
   end;
   IDECoolBar.Sort;
   IDECoolBar.CopyToOptions(EnvironmentOptions.IDECoolBarOptions);
+  SetMainIDEHeigth;
 end;
 
+procedure TMainIDEBar.SetMainIDEHeigth;
+begin
+  if tmIDEHeigth.Enabled then
+    Exit;
+  tmIDEHeigth.Enabled := True;
+end;
 
+procedure TMainIDEBar.OnTimer(Sender: TObject);
+var
+  CoolBarVisible: Boolean;
+  ComponentsVisible: Boolean;
+  CoolBarHeigth: Integer;
+  CoolBarDefHeight: Integer;
+  ClientHeigth: Integer;
+begin
+  CoolBarVisible := EnvironmentOptions.IDECoolBarOptions.IDECoolBarVisible;
+  ComponentsVisible := EnvironmentOptions.ComponentPaletteVisible;
+  CoolBarDefHeight := CoolBar.Bands.Items[0].Height; //there is at least one band
+  CoolBarHeigth := CoolBar.Bands.Items[CoolBar.Bands.Count - 1].Top +
+                   CoolBar.Bands.Items[CoolBar.Bands.Count - 1].Height;
+
+  //only the menu is visible
+  if (not CoolBarVisible) and (not ComponentsVisible) then
+    ClientHeigth := 0
+  //only the coolbar is visible
+  else if (CoolBarVisible) and (not ComponentsVisible) then
+    ClientHeigth := CoolBarHeigth
+  //only the component palette is visible
+  else if (not CoolBarVisible) and (ComponentsVisible) then
+    ClientHeigth := 2*CoolBarDefHeight
+  //both coolbar and component palette is visible
+  else if (CoolBarVisible) and (ComponentsVisible) then
+  begin
+    if CoolBarHeigth > 2*CoolBarDefHeight then
+      ClientHeigth := CoolBarHeigth
+    else
+      ClientHeigth := 2*CoolBarHeigth;
+  end;
+
+  MainIDEBar.Constraints.MaxHeight := 0;
+  MainIDEBar.Constraints.MinHeight := 0;
+  MainIDEBar.ClientHeight := ClientHeigth;
+  MainIDEBar.Constraints.MaxHeight := NonClientHeight + ClientHeigth;
+ // MainIDEBar.Constraints.MinHeight := NonClientHeight + ClientHeigth;
+  tmIDEHeigth.Enabled := False;
+end;
+
+
 end.
 
MainIDEBar_Heigth.patch (5,715 bytes)   

Juha Manninen

2015-05-03 12:03

developer   ~0083424

Applied, thanks. Very nice solution. :)

Balázs Székely

2015-05-03 12:52

developer   ~0083427

Unfortunately there is a problem: when AnchorDocking is installed, setting the ClientHeight(MainBar.pas, line 659) will lead to undesired look.
Although MainIDEBar.ClientHeight := ClientHeigth(MainBar.pas, line 659) it's very useful if the IDE is undocked, I think we should comment out that line. Or maybe it's a better way to detect if AnchorDocking is installed?
I also made a few typo's(Heigth instead of Height). I will wait for feedback(s) then create a new patch if necessary.

Péter Gábor

2015-05-03 16:13

reporter   ~0083430

Last edited: 2015-05-03 16:19

View 2 revisions

I can confirm the conflict with AnchorDocking: Main window looks
different (it is a bar as without AnchorDocking) and cannot be restored/resized as it was before...

I already sent a mail to the Lazarus mailing list, but it can be ignored there.

Balázs Székely

2015-05-03 18:27

developer  

MainIDEBar_Heigth1.patch (6,551 bytes)   
Index: ide/main.pp
===================================================================
--- ide/main.pp	(revision 48925)
+++ ide/main.pp	(working copy)
@@ -2019,15 +2019,17 @@
   MainIDEBar.MainSplitter.Parent := MainIDEBar;
   MainIDEBar.MainSplitter.Align := alLeft;
   MainIDEBar.MainSplitter.MinSize := 50;
+  MainIDEBar.MainSplitter.Tag := 112;
   MainIDEBar.MainSplitter.OnMoved := @MainIDEBar.MainSplitterMoved;
 
-  MainIDEBar.tmIDEHeigth := TTimer.Create(OwningComponent);
-  MainIDEBar.tmIDEHeigth.Interval := 100;
-  MainIDEBar.tmIDEHeigth.Enabled := False;
-  MainIDEBar.tmIDEHeigth.OnTimer := @MainIDEBar.OnTimer;
+  MainIDEBar.tmIDEHeight := TTimer.Create(OwningComponent);
+  MainIDEBar.tmIDEHeight.Interval := 100;
+  MainIDEBar.tmIDEHeight.Enabled := False;
+  MainIDEBar.tmIDEHeight.OnTimer := @MainIDEBar.OnTimer;
 
   MainIDEBar.CoolBar := TCoolBar.Create(OwningComponent);
   MainIDEBar.CoolBar.Parent := MainIDEBar;
+  MainIDEBar.CoolBar.Tag := 112;
   if EnvironmentOptions.ComponentPaletteVisible then
   begin
     MainIDEBar.CoolBar.Align := alLeft;
@@ -2035,6 +2037,7 @@
   end
   else
     MainIDEBar.CoolBar.Align := alClient;
+  MainIDEBar.mnuMainMenu.Tag := 112;
 
   // IDE Coolbar object wraps MainIDEBar.CoolBar.
   IDECoolBar := TIDECoolBar.Create(MainIDEBar.CoolBar);
@@ -2068,6 +2071,7 @@
     Align := alClient;
     Visible:=EnvironmentOptions.ComponentPaletteVisible;
     Parent := MainIDEBar;
+    Tag := 112;
   end;
 end;
 
@@ -3726,7 +3730,7 @@
     MainIDEBar.CoolBar.Align := alClient;
   MainIDEBar.MainSplitter.Visible := MainIDEBar.Coolbar.Visible and
                                      MainIDEBar.ComponentPageControl.Visible;
-  MainIDEBar.SetMainIDEHeigth;
+  MainIDEBar.SetMainIDEHeight;
 end;
 
 procedure TMainIDE.DoToggleViewIDESpeedButtons;
@@ -3740,7 +3744,7 @@
   EnvironmentOptions.IDECoolBarOptions.IDECoolBarVisible := SpeedButtonsVisible;
   MainIDEBar.MainSplitter.Visible := MainIDEBar.Coolbar.Visible and
                                      MainIDEBar.ComponentPageControl.Visible;
-  MainIDEBar.SetMainIDEHeigth;
+  MainIDEBar.SetMainIDEHeight;
 end;
 
 procedure TMainIDE.AllowCompilation(aAllow: Boolean);
Index: ide/mainbar.pas
===================================================================
--- ide/mainbar.pas	(revision 48925)
+++ ide/mainbar.pas	(working copy)
@@ -53,7 +53,7 @@
     //Coolbar and PopUpMenus
     CoolBar: TCoolBar;
     pmOptions: TPopupMenu;
-    tmIDEHeigth: TTimer;
+    tmIDEHeight: TTimer;
     miOptions: TMenuItem;
     OpenFilePopUpMenu: TPopupMenu;
     SetBuildModePopupMenu: TPopupMenu;
@@ -371,6 +371,7 @@
     FNonClientHeight: Integer;
     procedure NewUFDefaultClick(Sender: TObject);
     procedure NewUnitFormPopupMenuPopup(Sender: TObject);
+    function IsDefaultIDE: Boolean;
   protected
     procedure DoActive;
     procedure WndProc(var Message: TLMessage); override;
@@ -382,7 +383,7 @@
     property OnActive: TNotifyEvent read FOnActive write FOnActive;
     procedure UpdateDockCaption({%H-}Exclude: TControl); override;
     procedure RefreshCoolbar;
-    procedure SetMainIDEHeigth;
+    procedure SetMainIDEHeight;
   public
     property NonClientHeight: Integer read FNonClientHeight write FNonClientHeight;
   end;
@@ -583,13 +584,13 @@
   MainSplitter.Align := alLeft;
   MainSplitter.Visible := MainIDEBar.Coolbar.Visible and
                           MainIDEBar.ComponentPageControl.Visible;
-  MainIDEBar.SetMainIDEHeigth;
+  SetMainIDEHeight;
 end;
 
 procedure TMainIDEBar.MainSplitterMoved(Sender: TObject);
 begin
   EnvironmentOptions.IDECoolBarOptions.IDECoolBarWidth := CoolBar.Width;
-  SetMainIDEHeigth
+  SetMainIDEHeight
 end;
 
 
@@ -612,14 +613,29 @@
   end;
   IDECoolBar.Sort;
   IDECoolBar.CopyToOptions(EnvironmentOptions.IDECoolBarOptions);
-  SetMainIDEHeigth;
+  SetMainIDEHeight;
 end;
 
-procedure TMainIDEBar.SetMainIDEHeigth;
+function TMainIDEBar.IsDefaultIDE: Boolean;
+var
+  I: Integer;
 begin
-  if tmIDEHeigth.Enabled then
+  Result := True;
+  for I := 0 to MainIDEBar.ControlCount - 1 do
+  begin
+    if (MainIDEBar.Controls[I] as TControl).Tag <> 112 then
+    begin
+      Result := False;
+      Break;
+    end;
+  end;
+end;
+
+procedure TMainIDEBar.SetMainIDEHeight;
+begin
+  if tmIDEHeight.Enabled then
     Exit;
-  tmIDEHeigth.Enabled := True;
+  tmIDEHeight.Enabled := True;
 end;
 
 procedure TMainIDEBar.OnTimer(Sender: TObject);
@@ -626,40 +642,41 @@
 var
   CoolBarVisible: Boolean;
   ComponentsVisible: Boolean;
-  CoolBarHeigth: Integer;
+  CoolBarHeight: Integer;
   CoolBarDefHeight: Integer;
-  ClientHeigth: Integer;
+  Client_Height: Integer;
 begin
   CoolBarVisible := EnvironmentOptions.IDECoolBarOptions.IDECoolBarVisible;
   ComponentsVisible := EnvironmentOptions.ComponentPaletteVisible;
   CoolBarDefHeight := CoolBar.Bands.Items[0].Height; //there is at least one band
-  CoolBarHeigth := CoolBar.Bands.Items[CoolBar.Bands.Count - 1].Top +
+  CoolBarHeight := CoolBar.Bands.Items[CoolBar.Bands.Count - 1].Top +
                    CoolBar.Bands.Items[CoolBar.Bands.Count - 1].Height;
 
   //only the menu is visible
   if (not CoolBarVisible) and (not ComponentsVisible) then
-    ClientHeigth := 0
+    Client_Height := 0
   //only the coolbar is visible
   else if (CoolBarVisible) and (not ComponentsVisible) then
-    ClientHeigth := CoolBarHeigth
+    Client_Height := CoolBarHeight
   //only the component palette is visible
   else if (not CoolBarVisible) and (ComponentsVisible) then
-    ClientHeigth := 2*CoolBarDefHeight
+    Client_Height := 2*CoolBarDefHeight
   //both coolbar and component palette is visible
   else if (CoolBarVisible) and (ComponentsVisible) then
   begin
-    if CoolBarHeigth > 2*CoolBarDefHeight then
-      ClientHeigth := CoolBarHeigth
+    if CoolBarHeight > 2*CoolBarDefHeight then
+      Client_Height := CoolBarHeight
     else
-      ClientHeigth := 2*CoolBarHeigth;
+      Client_Height := 2*CoolBarHeight;
   end;
 
   MainIDEBar.Constraints.MaxHeight := 0;
   MainIDEBar.Constraints.MinHeight := 0;
-  MainIDEBar.ClientHeight := ClientHeigth;
-  MainIDEBar.Constraints.MaxHeight := NonClientHeight + ClientHeigth;
- // MainIDEBar.Constraints.MinHeight := NonClientHeight + ClientHeigth;
-  tmIDEHeigth.Enabled := False;
+  if IsDefaultIDE then
+    MainIDEBar.ClientHeight := Client_Height;
+  MainIDEBar.Constraints.MaxHeight := NonClientHeight + Client_Height;
+ // MainIDEBar.Constraints.MinHeight := NonClientHeight + Client_Height;
+  tmIDEHeight.Enabled := False;
 end;
 
 
MainIDEBar_Heigth1.patch (6,551 bytes)   

Balázs Székely

2015-05-03 22:51

developer   ~0083440

@Péter Gábor
Thank you for the feedback. Please test with MainIDEBar_Height2.patch, it should work now both with docked/undocked IDE.

@Juha Manninen
To detect if a docking solution is loaded, I had to move the SetMainIDEHeight procedure(implicitly the RefreshCoolbar method) to form show.
PS: Please ignore my previous patch(MainIDEBar_Height1). Thank you!

Balázs Székely

2015-05-03 22:51

developer  

MainIDEBar_Height2.patch (7,132 bytes)   
Index: ide/main.pp
===================================================================
--- ide/main.pp	(revision 48925)
+++ ide/main.pp	(working copy)
@@ -1543,7 +1543,6 @@
 
   // load package configs
   HelpBoss.LoadHelpOptions;
-  MainIDEBar.RefreshCoolbar;
 end;
 
 procedure TMainIDE.StartIDE;
@@ -2019,15 +2018,17 @@
   MainIDEBar.MainSplitter.Parent := MainIDEBar;
   MainIDEBar.MainSplitter.Align := alLeft;
   MainIDEBar.MainSplitter.MinSize := 50;
+  MainIDEBar.MainSplitter.Tag := 112;
   MainIDEBar.MainSplitter.OnMoved := @MainIDEBar.MainSplitterMoved;
 
-  MainIDEBar.tmIDEHeigth := TTimer.Create(OwningComponent);
-  MainIDEBar.tmIDEHeigth.Interval := 100;
-  MainIDEBar.tmIDEHeigth.Enabled := False;
-  MainIDEBar.tmIDEHeigth.OnTimer := @MainIDEBar.OnTimer;
+  MainIDEBar.tmIDEHeight := TTimer.Create(OwningComponent);
+  MainIDEBar.tmIDEHeight.Interval := 100;
+  MainIDEBar.tmIDEHeight.Enabled := False;
+  MainIDEBar.tmIDEHeight.OnTimer := @MainIDEBar.OnTimer;
 
   MainIDEBar.CoolBar := TCoolBar.Create(OwningComponent);
   MainIDEBar.CoolBar.Parent := MainIDEBar;
+  MainIDEBar.CoolBar.Tag := 112;
   if EnvironmentOptions.ComponentPaletteVisible then
   begin
     MainIDEBar.CoolBar.Align := alLeft;
@@ -2036,6 +2037,7 @@
   else
     MainIDEBar.CoolBar.Align := alClient;
 
+  MainIDEBar.mnuMainMenu.Tag := 112;
   // IDE Coolbar object wraps MainIDEBar.CoolBar.
   IDECoolBar := TIDECoolBar.Create(MainIDEBar.CoolBar);
   IDECoolBar.IsVisible := EnvironmentOptions.IDECoolBarOptions.IDECoolBarVisible;;
@@ -2068,6 +2070,7 @@
     Align := alClient;
     Visible:=EnvironmentOptions.ComponentPaletteVisible;
     Parent := MainIDEBar;
+    Tag := 112;
   end;
 end;
 
@@ -3726,7 +3729,7 @@
     MainIDEBar.CoolBar.Align := alClient;
   MainIDEBar.MainSplitter.Visible := MainIDEBar.Coolbar.Visible and
                                      MainIDEBar.ComponentPageControl.Visible;
-  MainIDEBar.SetMainIDEHeigth;
+  MainIDEBar.SetMainIDEHeight;
 end;
 
 procedure TMainIDE.DoToggleViewIDESpeedButtons;
@@ -3740,7 +3743,7 @@
   EnvironmentOptions.IDECoolBarOptions.IDECoolBarVisible := SpeedButtonsVisible;
   MainIDEBar.MainSplitter.Visible := MainIDEBar.Coolbar.Visible and
                                      MainIDEBar.ComponentPageControl.Visible;
-  MainIDEBar.SetMainIDEHeigth;
+  MainIDEBar.SetMainIDEHeight;
 end;
 
 procedure TMainIDE.AllowCompilation(aAllow: Boolean);
Index: ide/mainbar.pas
===================================================================
--- ide/mainbar.pas	(revision 48925)
+++ ide/mainbar.pas	(working copy)
@@ -53,7 +53,7 @@
     //Coolbar and PopUpMenus
     CoolBar: TCoolBar;
     pmOptions: TPopupMenu;
-    tmIDEHeigth: TTimer;
+    tmIDEHeight: TTimer;
     miOptions: TMenuItem;
     OpenFilePopUpMenu: TPopupMenu;
     SetBuildModePopupMenu: TPopupMenu;
@@ -371,8 +371,10 @@
     FNonClientHeight: Integer;
     procedure NewUFDefaultClick(Sender: TObject);
     procedure NewUnitFormPopupMenuPopup(Sender: TObject);
+    function IsDefaultIDE: Boolean;
   protected
     procedure DoActive;
+    procedure DoShow; override;
     procedure WndProc(var Message: TLMessage); override;
   public
     constructor Create(TheOwner: TComponent); override;
@@ -382,7 +384,7 @@
     property OnActive: TNotifyEvent read FOnActive write FOnActive;
     procedure UpdateDockCaption({%H-}Exclude: TControl); override;
     procedure RefreshCoolbar;
-    procedure SetMainIDEHeigth;
+    procedure SetMainIDEHeight;
   public
     property NonClientHeight: Integer read FNonClientHeight write FNonClientHeight;
   end;
@@ -476,6 +478,12 @@
     FOnActive(Self);
 end;
 
+procedure TMainIDEBar.DoShow;
+begin
+  inherited DoShow;
+  RefreshCoolbar;
+end;
+
 procedure TMainIDEBar.WndProc(var Message: TLMessage);
 begin
   inherited WndProc(Message);
@@ -583,13 +591,13 @@
   MainSplitter.Align := alLeft;
   MainSplitter.Visible := MainIDEBar.Coolbar.Visible and
                           MainIDEBar.ComponentPageControl.Visible;
-  MainIDEBar.SetMainIDEHeigth;
+  SetMainIDEHeight;
 end;
 
 procedure TMainIDEBar.MainSplitterMoved(Sender: TObject);
 begin
   EnvironmentOptions.IDECoolBarOptions.IDECoolBarWidth := CoolBar.Width;
-  SetMainIDEHeigth
+  SetMainIDEHeight
 end;
 
 
@@ -612,14 +620,16 @@
   end;
   IDECoolBar.Sort;
   IDECoolBar.CopyToOptions(EnvironmentOptions.IDECoolBarOptions);
-  SetMainIDEHeigth;
+  SetMainIDEHeight;
 end;
 
-procedure TMainIDEBar.SetMainIDEHeigth;
+procedure TMainIDEBar.SetMainIDEHeight;
 begin
-  if tmIDEHeigth.Enabled then
+  if  not IsDefaultIDE then
     Exit;
-  tmIDEHeigth.Enabled := True;
+  if tmIDEHeight.Enabled then
+    Exit;
+  tmIDEHeight.Enabled := True;
 end;
 
 procedure TMainIDEBar.OnTimer(Sender: TObject);
@@ -626,42 +636,57 @@
 var
   CoolBarVisible: Boolean;
   ComponentsVisible: Boolean;
-  CoolBarHeigth: Integer;
+  CoolBarHeight: Integer;
   CoolBarDefHeight: Integer;
-  ClientHeigth: Integer;
+  Client_Height: Integer;
 begin
   CoolBarVisible := EnvironmentOptions.IDECoolBarOptions.IDECoolBarVisible;
   ComponentsVisible := EnvironmentOptions.ComponentPaletteVisible;
   CoolBarDefHeight := CoolBar.Bands.Items[0].Height; //there is at least one band
-  CoolBarHeigth := CoolBar.Bands.Items[CoolBar.Bands.Count - 1].Top +
+  CoolBarHeight := CoolBar.Bands.Items[CoolBar.Bands.Count - 1].Top +
                    CoolBar.Bands.Items[CoolBar.Bands.Count - 1].Height;
 
   //only the menu is visible
   if (not CoolBarVisible) and (not ComponentsVisible) then
-    ClientHeigth := 0
+    Client_Height := 0
   //only the coolbar is visible
   else if (CoolBarVisible) and (not ComponentsVisible) then
-    ClientHeigth := CoolBarHeigth
+    Client_Height := CoolBarHeight
   //only the component palette is visible
   else if (not CoolBarVisible) and (ComponentsVisible) then
-    ClientHeigth := 2*CoolBarDefHeight
+    Client_Height := 2*CoolBarDefHeight
   //both coolbar and component palette is visible
   else if (CoolBarVisible) and (ComponentsVisible) then
   begin
-    if CoolBarHeigth > 2*CoolBarDefHeight then
-      ClientHeigth := CoolBarHeigth
+    if CoolBarHeight > 2*CoolBarDefHeight then
+      Client_Height := CoolBarHeight
     else
-      ClientHeigth := 2*CoolBarHeigth;
+      Client_Height := 2*CoolBarHeight;
   end;
 
   MainIDEBar.Constraints.MaxHeight := 0;
   MainIDEBar.Constraints.MinHeight := 0;
-  MainIDEBar.ClientHeight := ClientHeigth;
-  MainIDEBar.Constraints.MaxHeight := NonClientHeight + ClientHeigth;
- // MainIDEBar.Constraints.MinHeight := NonClientHeight + ClientHeigth;
-  tmIDEHeigth.Enabled := False;
+  MainIDEBar.ClientHeight := Client_Height;
+  MainIDEBar.Constraints.MaxHeight := NonClientHeight + Client_Height;
+ // MainIDEBar.Constraints.MinHeight := NonClientHeight + Client_Height;
+  tmIDEHeight.Enabled := False;
 end;
 
+function TMainIDEBar.IsDefaultIDE: Boolean;
+var
+  I: Integer;
+begin
+  Result := True;
+  for I := 0 to MainIDEBar.ControlCount - 1 do
+  begin
+    if (MainIDEBar.Controls[I] as TControl).Tag <> 112 then
+    begin
+      Result := False;
+      Break;
+    end;
+  end;
+end;
 
+
 end.
 
MainIDEBar_Height2.patch (7,132 bytes)   

Péter Gábor

2015-05-04 19:27

reporter   ~0083457

Last edited: 2015-05-04 19:41

View 4 revisions

MainIDEBar_Height2.patch seems to be working correctly with and without AnchorDocking. (Linux/XFCE4)

Note:
Component palette rearranges icons and shows scroll bar if needed (that's basically right). But this way the limited size of main IDE bar may inhibit the overview of elements on component palette. Also forcing the usage of scroll bar slows down accessing of components. This is not convenient.
So I would prefer a totally free resizing of the main IDE bar (with AnchorDocking it can be freely resized at the moment)...

Ondrej Pokorny

2015-05-04 19:43

developer   ~0083458

>>> So I would prefer a totally free resizing of the main IDE bar...

Me too. I would prefer to set the MaxHeight constraint only when IDE is maximized. When IDE is not maximized, I want to resize the IDE window freely.

WHY? -> There is another bug in LCL regarding Height: If the MainMenu has 2 lines and you set the window Height (or ClientHeight, in Lazarus it's the same), the outer height is calculated and set wrongly (as with 1-line-menu). I'll report it and send a link to the report here as well.

Balázs Székely

2015-05-04 20:02

developer   ~0083459

Personally I like the auto resizing feature, but it should be optional. A freely resizable IDEbar by default and if needed, auto resize can be activated in the option panel.

Ondrej Pokorny

2015-05-04 20:13

developer  

MainIDEBar_Height3.patch (8,970 bytes)   
Index: main.pp
===================================================================
--- main.pp	(revision 48926)
+++ main.pp	(working copy)
@@ -1412,7 +1412,6 @@
   FormCreator: TIDEWindowCreator;
   PkgMngr: TPkgManager;
   CompPalette: TComponentPalette;
-  AMenuHeight: Integer;
 begin
   {$IFDEF IDE_MEM_CHECK}CheckHeapWrtMemCnt('TMainIDE.Create START');{$ENDIF}
   inherited Create(TheOwner);
@@ -1458,21 +1457,6 @@
   Application.CreateForm(TMainIDEBar,MainIDEBar);
   MainIDEBar.OnActive:=@OnMainBarActive;
 
-  AMenuHeight := LCLIntf.GetSystemMetrics(SM_CYMENU);
-  if AMenuHeight > 0 then
-  begin
-    // what we know:
-    // 1. cmd speedbuttons height = 22
-    // 2. components palette buttons = 32
-    // 3. menu height provided by widgetset (varies , depends on theme)
-    // so we set 22 + 32 + (borders * 2).
-    MainIDEBar.NonClientHeight := AMenuHeight +
-      //22 {cmd speedbtns} + 32 {component buttons} +
-      LCLIntf.GetSystemMetrics(SM_CYSIZEFRAME) +
-      (LCLIntf.GetSystemMetrics(SM_CYBORDER) * 2) {borders};
-  end else
-    MainIDEBar.NonClientHeight :=85;
-
   MainIDEBar.Name := NonModalIDEWindowNames[nmiwMainIDEName];
   FormCreator:=IDEWindowCreators.Add(MainIDEBar.Name);
   FormCreator.Right:='100%';
@@ -1543,7 +1527,6 @@
 
   // load package configs
   HelpBoss.LoadHelpOptions;
-  MainIDEBar.RefreshCoolbar;
 end;
 
 procedure TMainIDE.StartIDE;
@@ -2019,15 +2002,17 @@
   MainIDEBar.MainSplitter.Parent := MainIDEBar;
   MainIDEBar.MainSplitter.Align := alLeft;
   MainIDEBar.MainSplitter.MinSize := 50;
+  MainIDEBar.MainSplitter.Tag := 112;
   MainIDEBar.MainSplitter.OnMoved := @MainIDEBar.MainSplitterMoved;
 
-  MainIDEBar.tmIDEHeigth := TTimer.Create(OwningComponent);
-  MainIDEBar.tmIDEHeigth.Interval := 100;
-  MainIDEBar.tmIDEHeigth.Enabled := False;
-  MainIDEBar.tmIDEHeigth.OnTimer := @MainIDEBar.OnTimer;
+  MainIDEBar.tmIDEHeight := TTimer.Create(OwningComponent);
+  MainIDEBar.tmIDEHeight.Interval := 100;
+  MainIDEBar.tmIDEHeight.Enabled := False;
+  MainIDEBar.tmIDEHeight.OnTimer := @MainIDEBar.OnTimer;
 
   MainIDEBar.CoolBar := TCoolBar.Create(OwningComponent);
   MainIDEBar.CoolBar.Parent := MainIDEBar;
+  MainIDEBar.CoolBar.Tag := 112;
   if EnvironmentOptions.ComponentPaletteVisible then
   begin
     MainIDEBar.CoolBar.Align := alLeft;
@@ -2036,6 +2021,7 @@
   else
     MainIDEBar.CoolBar.Align := alClient;
 
+  MainIDEBar.mnuMainMenu.Tag := 112;
   // IDE Coolbar object wraps MainIDEBar.CoolBar.
   IDECoolBar := TIDECoolBar.Create(MainIDEBar.CoolBar);
   IDECoolBar.IsVisible := EnvironmentOptions.IDECoolBarOptions.IDECoolBarVisible;;
@@ -2068,6 +2054,7 @@
     Align := alClient;
     Visible:=EnvironmentOptions.ComponentPaletteVisible;
     Parent := MainIDEBar;
+    Tag := 112;
   end;
 end;
 
@@ -3726,7 +3713,7 @@
     MainIDEBar.CoolBar.Align := alClient;
   MainIDEBar.MainSplitter.Visible := MainIDEBar.Coolbar.Visible and
                                      MainIDEBar.ComponentPageControl.Visible;
-  MainIDEBar.SetMainIDEHeigth;
+  MainIDEBar.SetMainIDEHeight;
 end;
 
 procedure TMainIDE.DoToggleViewIDESpeedButtons;
@@ -3740,7 +3727,7 @@
   EnvironmentOptions.IDECoolBarOptions.IDECoolBarVisible := SpeedButtonsVisible;
   MainIDEBar.MainSplitter.Visible := MainIDEBar.Coolbar.Visible and
                                      MainIDEBar.ComponentPageControl.Visible;
-  MainIDEBar.SetMainIDEHeigth;
+  MainIDEBar.SetMainIDEHeight;
 end;
 
 procedure TMainIDE.AllowCompilation(aAllow: Boolean);
Index: mainbar.pas
===================================================================
--- mainbar.pas	(revision 48926)
+++ mainbar.pas	(working copy)
@@ -38,7 +38,7 @@
 {$IFDEF IDE_MEM_CHECK}
   MemCheck,
 {$ENDIF}
-  Classes, SysUtils, LCLProc, Forms, Controls, Buttons, Menus,
+  Classes, SysUtils, LCLProc, LclIntf, Forms, Controls, Buttons, Menus,
   ComCtrls, ExtCtrls, LMessages,
   // IDEIntf
   ProjectIntf, NewItemIntf, MenuIntf, LazIDEIntf, LazFileCache,
@@ -53,7 +53,7 @@
     //Coolbar and PopUpMenus
     CoolBar: TCoolBar;
     pmOptions: TPopupMenu;
-    tmIDEHeigth: TTimer;
+    tmIDEHeight: TTimer;
     miOptions: TMenuItem;
     OpenFilePopUpMenu: TPopupMenu;
     SetBuildModePopupMenu: TPopupMenu;
@@ -368,11 +368,13 @@
   private
     FOldWindowState: TWindowState;
     FOnActive: TNotifyEvent;
-    FNonClientHeight: Integer;
+    function GetNonClientHeight: Integer;
     procedure NewUFDefaultClick(Sender: TObject);
     procedure NewUnitFormPopupMenuPopup(Sender: TObject);
+    function IsDefaultIDE: Boolean;
   protected
     procedure DoActive;
+    procedure DoShow; override;
     procedure WndProc(var Message: TLMessage); override;
   public
     constructor Create(TheOwner: TComponent); override;
@@ -382,9 +384,9 @@
     property OnActive: TNotifyEvent read FOnActive write FOnActive;
     procedure UpdateDockCaption({%H-}Exclude: TControl); override;
     procedure RefreshCoolbar;
-    procedure SetMainIDEHeigth;
+    procedure SetMainIDEHeight;
   public
-    property NonClientHeight: Integer read FNonClientHeight write FNonClientHeight;
+    property NonClientHeight: Integer read GetNonClientHeight;
   end;
 
 
@@ -476,6 +478,22 @@
     FOnActive(Self);
 end;
 
+procedure TMainIDEBar.DoShow;
+begin
+  inherited DoShow;
+  RefreshCoolbar;
+end;
+
+function TMainIDEBar.GetNonClientHeight: Integer;
+var
+  WindowRect, WindowClientRect: TRect;
+begin
+  LclIntf.GetWindowRect(Handle, WindowRect);
+  LclIntf.GetClientRect(Handle, WindowClientRect);
+  LclIntf.ClientToScreen(Handle, WindowClientRect.TopLeft);
+  Result := WindowClientRect.Top - WindowRect.Top;
+end;
+
 procedure TMainIDEBar.WndProc(var Message: TLMessage);
 begin
   inherited WndProc(Message);
@@ -583,13 +601,13 @@
   MainSplitter.Align := alLeft;
   MainSplitter.Visible := MainIDEBar.Coolbar.Visible and
                           MainIDEBar.ComponentPageControl.Visible;
-  MainIDEBar.SetMainIDEHeigth;
+  SetMainIDEHeight;
 end;
 
 procedure TMainIDEBar.MainSplitterMoved(Sender: TObject);
 begin
   EnvironmentOptions.IDECoolBarOptions.IDECoolBarWidth := CoolBar.Width;
-  SetMainIDEHeigth
+  SetMainIDEHeight
 end;
 
 
@@ -612,14 +630,16 @@
   end;
   IDECoolBar.Sort;
   IDECoolBar.CopyToOptions(EnvironmentOptions.IDECoolBarOptions);
-  SetMainIDEHeigth;
+  SetMainIDEHeight;
 end;
 
-procedure TMainIDEBar.SetMainIDEHeigth;
+procedure TMainIDEBar.SetMainIDEHeight;
 begin
-  if tmIDEHeigth.Enabled then
+  if  not IsDefaultIDE then
     Exit;
-  tmIDEHeigth.Enabled := True;
+  if tmIDEHeight.Enabled then
+    Exit;
+  tmIDEHeight.Enabled := True;
 end;
 
 procedure TMainIDEBar.OnTimer(Sender: TObject);
@@ -626,42 +646,57 @@
 var
   CoolBarVisible: Boolean;
   ComponentsVisible: Boolean;
-  CoolBarHeigth: Integer;
+  CoolBarHeight: Integer;
   CoolBarDefHeight: Integer;
-  ClientHeigth: Integer;
+  Client_Height: Integer;
 begin
   CoolBarVisible := EnvironmentOptions.IDECoolBarOptions.IDECoolBarVisible;
   ComponentsVisible := EnvironmentOptions.ComponentPaletteVisible;
   CoolBarDefHeight := CoolBar.Bands.Items[0].Height; //there is at least one band
-  CoolBarHeigth := CoolBar.Bands.Items[CoolBar.Bands.Count - 1].Top +
+  CoolBarHeight := CoolBar.Bands.Items[CoolBar.Bands.Count - 1].Top +
                    CoolBar.Bands.Items[CoolBar.Bands.Count - 1].Height;
 
   //only the menu is visible
   if (not CoolBarVisible) and (not ComponentsVisible) then
-    ClientHeigth := 0
+    Client_Height := 0
   //only the coolbar is visible
   else if (CoolBarVisible) and (not ComponentsVisible) then
-    ClientHeigth := CoolBarHeigth
+    Client_Height := CoolBarHeight
   //only the component palette is visible
   else if (not CoolBarVisible) and (ComponentsVisible) then
-    ClientHeigth := 2*CoolBarDefHeight
+    Client_Height := 2*CoolBarDefHeight
   //both coolbar and component palette is visible
   else if (CoolBarVisible) and (ComponentsVisible) then
   begin
-    if CoolBarHeigth > 2*CoolBarDefHeight then
-      ClientHeigth := CoolBarHeigth
+    if CoolBarHeight > 2*CoolBarDefHeight then
+      Client_Height := CoolBarHeight
     else
-      ClientHeigth := 2*CoolBarHeigth;
+      Client_Height := 2*CoolBarHeight;
   end;
 
   MainIDEBar.Constraints.MaxHeight := 0;
   MainIDEBar.Constraints.MinHeight := 0;
-  MainIDEBar.ClientHeight := ClientHeigth;
-  MainIDEBar.Constraints.MaxHeight := NonClientHeight + ClientHeigth;
- // MainIDEBar.Constraints.MinHeight := NonClientHeight + ClientHeigth;
-  tmIDEHeigth.Enabled := False;
+  MainIDEBar.ClientHeight := Client_Height;
+  MainIDEBar.Constraints.MaxHeight := NonClientHeight + Client_Height;
+
+  tmIDEHeight.Enabled := False;
 end;
 
+function TMainIDEBar.IsDefaultIDE: Boolean;
+var
+  I: Integer;
+begin
+  Result := True;
+  for I := 0 to MainIDEBar.ControlCount - 1 do
+  begin
+    if (MainIDEBar.Controls[I] as TControl).Tag <> 112 then
+    begin
+      Result := False;
+      Break;
+    end;
+  end;
+end;
 
+
 end.
 
MainIDEBar_Height3.patch (8,970 bytes)   

Ondrej Pokorny

2015-05-04 20:17

developer   ~0083460

I modified MainIDEBar_Height2.patch --->> MainIDEBar_Height3.patch

Now it correctly sets the height for multi-line main menu. The clue was to make NonClientHeight a read-only property with GetNonClientHeight getter that calculates the non-client height correctly for all possible scenarios (single-line or double-line main menu, etc).

Tested on Windows only. Could somebody test it on Linux/GTK2 and other OS?

Sandro Cumerlato

2015-05-04 20:31

reporter   ~0083461

Last edited: 2015-05-04 20:35

View 2 revisions

>>> So I would prefer a totally free resizing of the main IDE bar...
> ... I would prefer to set the MaxHeight constraint only when IDE is maximized.

me too, please take a look at the folloqing (IMHO) nonsense ide windows:
ide1.png, ide2.png, ide3.png, ide4.png

Sandro Cumerlato

2015-05-04 20:31

reporter  

ide1.PNG (9,768 bytes)   
ide1.PNG (9,768 bytes)   

Sandro Cumerlato

2015-05-04 20:31

reporter  

ide2.PNG (11,796 bytes)   
ide2.PNG (11,796 bytes)   

Sandro Cumerlato

2015-05-04 20:31

reporter  

ide3.PNG (16,520 bytes)   
ide3.PNG (16,520 bytes)   

Sandro Cumerlato

2015-05-04 20:32

reporter  

ide4.PNG (26,732 bytes)   
ide4.PNG (26,732 bytes)   

Balázs Székely

2015-05-04 21:31

developer   ~0083462

Last edited: 2015-05-04 21:33

View 2 revisions

@Ondrej Pokorny

>I modified MainIDEBar_Height2.patch --->> MainIDEBar_Height3.patch
Nice patch!
> Could somebody test it on Linux/GTK2 and other OS?
I will test it tomorrow on GTK2/QT/OSX

@Sandro Cumerlato
>me too, please take a look at the folloqing (IMHO) nonsense ide windows
ide1.png, ide2.png, ide3.png --> setting a MinWidth, will solve the problem
ide4.png --> this one is more realistic, we could detect if the ComponentPageControl's vertical scrollbar is visible and set the height accordingly.
Again, a totally freely resizing IDE is also perfectly fine :)

Ondrej Pokorny

2015-05-04 22:39

developer   ~0083464

@Sandro Cumerlato
ide1.png, ide2.png, ide3.png --> solved by MainIDEBar_Height3.patch already, but I agree with you about the constraint - there is no reason for it when the main window is not maximized.

Ondrej Pokorny

2015-05-05 00:47

developer  

MainIDEBar_Height4.patch (10,564 bytes)   
Index: main.pp
===================================================================
--- main.pp	(revision 48926)
+++ main.pp	(working copy)
@@ -1412,7 +1412,6 @@
   FormCreator: TIDEWindowCreator;
   PkgMngr: TPkgManager;
   CompPalette: TComponentPalette;
-  AMenuHeight: Integer;
 begin
   {$IFDEF IDE_MEM_CHECK}CheckHeapWrtMemCnt('TMainIDE.Create START');{$ENDIF}
   inherited Create(TheOwner);
@@ -1458,21 +1457,6 @@
   Application.CreateForm(TMainIDEBar,MainIDEBar);
   MainIDEBar.OnActive:=@OnMainBarActive;
 
-  AMenuHeight := LCLIntf.GetSystemMetrics(SM_CYMENU);
-  if AMenuHeight > 0 then
-  begin
-    // what we know:
-    // 1. cmd speedbuttons height = 22
-    // 2. components palette buttons = 32
-    // 3. menu height provided by widgetset (varies , depends on theme)
-    // so we set 22 + 32 + (borders * 2).
-    MainIDEBar.NonClientHeight := AMenuHeight +
-      //22 {cmd speedbtns} + 32 {component buttons} +
-      LCLIntf.GetSystemMetrics(SM_CYSIZEFRAME) +
-      (LCLIntf.GetSystemMetrics(SM_CYBORDER) * 2) {borders};
-  end else
-    MainIDEBar.NonClientHeight :=85;
-
   MainIDEBar.Name := NonModalIDEWindowNames[nmiwMainIDEName];
   FormCreator:=IDEWindowCreators.Add(MainIDEBar.Name);
   FormCreator.Right:='100%';
@@ -1543,7 +1527,6 @@
 
   // load package configs
   HelpBoss.LoadHelpOptions;
-  MainIDEBar.RefreshCoolbar;
 end;
 
 procedure TMainIDE.StartIDE;
@@ -2019,15 +2002,17 @@
   MainIDEBar.MainSplitter.Parent := MainIDEBar;
   MainIDEBar.MainSplitter.Align := alLeft;
   MainIDEBar.MainSplitter.MinSize := 50;
+  MainIDEBar.MainSplitter.Tag := 112;
   MainIDEBar.MainSplitter.OnMoved := @MainIDEBar.MainSplitterMoved;
 
-  MainIDEBar.tmIDEHeigth := TTimer.Create(OwningComponent);
-  MainIDEBar.tmIDEHeigth.Interval := 100;
-  MainIDEBar.tmIDEHeigth.Enabled := False;
-  MainIDEBar.tmIDEHeigth.OnTimer := @MainIDEBar.OnTimer;
+  MainIDEBar.tmIDEHeight := TTimer.Create(OwningComponent);
+  MainIDEBar.tmIDEHeight.Interval := 100;
+  MainIDEBar.tmIDEHeight.Enabled := False;
+  MainIDEBar.tmIDEHeight.OnTimer := @MainIDEBar.tmIDEHeightOnTimer;
 
   MainIDEBar.CoolBar := TCoolBar.Create(OwningComponent);
   MainIDEBar.CoolBar.Parent := MainIDEBar;
+  MainIDEBar.CoolBar.Tag := 112;
   if EnvironmentOptions.ComponentPaletteVisible then
   begin
     MainIDEBar.CoolBar.Align := alLeft;
@@ -2036,6 +2021,7 @@
   else
     MainIDEBar.CoolBar.Align := alClient;
 
+  MainIDEBar.mnuMainMenu.Tag := 112;
   // IDE Coolbar object wraps MainIDEBar.CoolBar.
   IDECoolBar := TIDECoolBar.Create(MainIDEBar.CoolBar);
   IDECoolBar.IsVisible := EnvironmentOptions.IDECoolBarOptions.IDECoolBarVisible;;
@@ -2068,6 +2054,7 @@
     Align := alClient;
     Visible:=EnvironmentOptions.ComponentPaletteVisible;
     Parent := MainIDEBar;
+    Tag := 112;
   end;
 end;
 
@@ -3726,7 +3713,7 @@
     MainIDEBar.CoolBar.Align := alClient;
   MainIDEBar.MainSplitter.Visible := MainIDEBar.Coolbar.Visible and
                                      MainIDEBar.ComponentPageControl.Visible;
-  MainIDEBar.SetMainIDEHeigth;
+  MainIDEBar.SetMainIDEHeight;
 end;
 
 procedure TMainIDE.DoToggleViewIDESpeedButtons;
@@ -3740,7 +3727,7 @@
   EnvironmentOptions.IDECoolBarOptions.IDECoolBarVisible := SpeedButtonsVisible;
   MainIDEBar.MainSplitter.Visible := MainIDEBar.Coolbar.Visible and
                                      MainIDEBar.ComponentPageControl.Visible;
-  MainIDEBar.SetMainIDEHeigth;
+  MainIDEBar.SetMainIDEHeight;
 end;
 
 procedure TMainIDE.AllowCompilation(aAllow: Boolean);
Index: mainbar.pas
===================================================================
--- mainbar.pas	(revision 48926)
+++ mainbar.pas	(working copy)
@@ -48,12 +48,11 @@
 type
   { TMainIDEBar }
 
-
   TMainIDEBar = class(TForm)
     //Coolbar and PopUpMenus
     CoolBar: TCoolBar;
     pmOptions: TPopupMenu;
-    tmIDEHeigth: TTimer;
+    tmIDEHeight: TTimer;
     miOptions: TMenuItem;
     OpenFilePopUpMenu: TPopupMenu;
     SetBuildModePopupMenu: TPopupMenu;
@@ -364,16 +363,22 @@
       const FileNames: array of String);
     procedure CoolBarOnChange(Sender: TObject);
     procedure MainSplitterMoved(Sender: TObject);
-    procedure OnTimer(Sender: TObject);
+    procedure tmIDEHeightOnTimer(Sender: TObject);
   private
     FOldWindowState: TWindowState;
     FOnActive: TNotifyEvent;
-    FNonClientHeight: Integer;
+    function GetNonClientHeight: Integer;
     procedure NewUFDefaultClick(Sender: TObject);
     procedure NewUnitFormPopupMenuPopup(Sender: TObject);
+    function IsDefaultIDE: Boolean;
   protected
     procedure DoActive;
+    procedure DoShow; override;
     procedure WndProc(var Message: TLMessage); override;
+
+    procedure DoSetMainIDEHeight;
+    function CalcMainIDEHeight: Integer;
+    procedure Resizing(State: TWindowState); override;
   public
     constructor Create(TheOwner: TComponent); override;
     procedure HideIDE;
@@ -382,17 +387,19 @@
     property OnActive: TNotifyEvent read FOnActive write FOnActive;
     procedure UpdateDockCaption({%H-}Exclude: TControl); override;
     procedure RefreshCoolbar;
-    procedure SetMainIDEHeigth;
+    procedure SetMainIDEHeight;
   public
-    property NonClientHeight: Integer read FNonClientHeight write FNonClientHeight;
+    property NonClientHeight: Integer read GetNonClientHeight;
   end;
 
-
 var
   MainIDEBar: TMainIDEBar = nil;
 
 implementation
 
+uses
+  LCLIntf, LCLType;
+
 { TMainIDEBar }
 
 procedure TMainIDEBar.MainIDEBarDropFiles(Sender: TObject;
@@ -476,6 +483,31 @@
     FOnActive(Self);
 end;
 
+procedure TMainIDEBar.DoSetMainIDEHeight;
+var
+  NewHeight: Integer;
+begin
+  NewHeight := CalcMainIDEHeight;
+  Constraints.MaxHeight := NewHeight + NonClientHeight;
+  ClientHeight := NewHeight;
+end;
+
+procedure TMainIDEBar.DoShow;
+begin
+  inherited DoShow;
+  RefreshCoolbar;
+end;
+
+function TMainIDEBar.GetNonClientHeight: Integer;
+var
+  WindowRect, WindowClientRect: TRect;
+begin
+  LclIntf.GetWindowRect(Handle, WindowRect{%H-});
+  LclIntf.GetClientRect(Handle, WindowClientRect{%H-});
+  LclIntf.ClientToScreen(Handle, WindowClientRect.TopLeft);
+  Result := WindowClientRect.Top - WindowRect.Top;
+end;
+
 procedure TMainIDEBar.WndProc(var Message: TLMessage);
 begin
   inherited WndProc(Message);
@@ -583,16 +615,60 @@
   MainSplitter.Align := alLeft;
   MainSplitter.Visible := MainIDEBar.Coolbar.Visible and
                           MainIDEBar.ComponentPageControl.Visible;
-  MainIDEBar.SetMainIDEHeigth;
+  SetMainIDEHeight;
 end;
 
+procedure TMainIDEBar.Resizing(State: TWindowState);
+begin
+  if IsDefaultIDE then
+  begin
+    case State of
+      wsMaximized: DoSetMainIDEHeight;
+      wsNormal: Constraints.MaxHeight := 0;
+    end;
+  end;
+
+  inherited Resizing(State);
+end;
+
 procedure TMainIDEBar.MainSplitterMoved(Sender: TObject);
 begin
   EnvironmentOptions.IDECoolBarOptions.IDECoolBarWidth := CoolBar.Width;
-  SetMainIDEHeigth
+  SetMainIDEHeight
 end;
 
+function TMainIDEBar.CalcMainIDEHeight: Integer;
+var
+  CoolBarVisible: Boolean;
+  ComponentsVisible: Boolean;
+  CoolBarHeight: Integer;
+  CoolBarDefHeight: Integer;
+begin
+  CoolBarVisible := EnvironmentOptions.IDECoolBarOptions.IDECoolBarVisible;
+  ComponentsVisible := EnvironmentOptions.ComponentPaletteVisible;
+  CoolBarDefHeight := CoolBar.Bands.Items[0].Height; //there is at least one band
+  CoolBarHeight := CoolBar.Bands.Items[CoolBar.Bands.Count - 1].Top +
+                   CoolBar.Bands.Items[CoolBar.Bands.Count - 1].Height;
 
+  //only the menu is visible
+  if (not CoolBarVisible) and (not ComponentsVisible) then
+    Result := 0
+  //only the coolbar is visible
+  else if (CoolBarVisible) and (not ComponentsVisible) then
+    Result := CoolBarHeight
+  //only the component palette is visible
+  else if (not CoolBarVisible) and (ComponentsVisible) then
+    Result := 2*CoolBarDefHeight
+  //both coolbar and component palette is visible
+  else if (CoolBarVisible) and (ComponentsVisible) then
+  begin
+    if CoolBarHeight > 2*CoolBarDefHeight then
+      Result := CoolBarHeight
+    else
+      Result := 2*CoolBarHeight;
+  end;
+end;
+
 procedure TMainIDEBar.CoolBarOnChange(Sender: TObject);
 var
   I, J: Integer;
@@ -612,54 +688,35 @@
   end;
   IDECoolBar.Sort;
   IDECoolBar.CopyToOptions(EnvironmentOptions.IDECoolBarOptions);
-  SetMainIDEHeigth;
+  SetMainIDEHeight;
 end;
 
-procedure TMainIDEBar.SetMainIDEHeigth;
+procedure TMainIDEBar.SetMainIDEHeight;
 begin
-  if tmIDEHeigth.Enabled then
-    Exit;
-  tmIDEHeigth.Enabled := True;
+  tmIDEHeight.Enabled := True;
 end;
 
-procedure TMainIDEBar.OnTimer(Sender: TObject);
+procedure TMainIDEBar.tmIDEHeightOnTimer(Sender: TObject);
+begin
+  if IsDefaultIDE and (WindowState = wsMaximized) then
+    DoSetMainIDEHeight;
+
+  tmIDEHeight.Enabled := False;
+end;
+
+function TMainIDEBar.IsDefaultIDE: Boolean;
 var
-  CoolBarVisible: Boolean;
-  ComponentsVisible: Boolean;
-  CoolBarHeigth: Integer;
-  CoolBarDefHeight: Integer;
-  ClientHeigth: Integer;
+  I: Integer;
 begin
-  CoolBarVisible := EnvironmentOptions.IDECoolBarOptions.IDECoolBarVisible;
-  ComponentsVisible := EnvironmentOptions.ComponentPaletteVisible;
-  CoolBarDefHeight := CoolBar.Bands.Items[0].Height; //there is at least one band
-  CoolBarHeigth := CoolBar.Bands.Items[CoolBar.Bands.Count - 1].Top +
-                   CoolBar.Bands.Items[CoolBar.Bands.Count - 1].Height;
-
-  //only the menu is visible
-  if (not CoolBarVisible) and (not ComponentsVisible) then
-    ClientHeigth := 0
-  //only the coolbar is visible
-  else if (CoolBarVisible) and (not ComponentsVisible) then
-    ClientHeigth := CoolBarHeigth
-  //only the component palette is visible
-  else if (not CoolBarVisible) and (ComponentsVisible) then
-    ClientHeigth := 2*CoolBarDefHeight
-  //both coolbar and component palette is visible
-  else if (CoolBarVisible) and (ComponentsVisible) then
+  Result := True;
+  for I := 0 to MainIDEBar.ControlCount - 1 do
   begin
-    if CoolBarHeigth > 2*CoolBarDefHeight then
-      ClientHeigth := CoolBarHeigth
-    else
-      ClientHeigth := 2*CoolBarHeigth;
+    if (MainIDEBar.Controls[I] as TControl).Tag <> 112 then
+    begin
+      Result := False;
+      Break;
+    end;
   end;
-
-  MainIDEBar.Constraints.MaxHeight := 0;
-  MainIDEBar.Constraints.MinHeight := 0;
-  MainIDEBar.ClientHeight := ClientHeigth;
-  MainIDEBar.Constraints.MaxHeight := NonClientHeight + ClientHeigth;
- // MainIDEBar.Constraints.MinHeight := NonClientHeight + ClientHeigth;
-  tmIDEHeigth.Enabled := False;
 end;
 
 
MainIDEBar_Height4.patch (10,564 bytes)   

Ondrej Pokorny

2015-05-05 00:58

developer  

MainIDEBar_Height5.patch (10,655 bytes)   
Index: main.pp
===================================================================
--- main.pp	(revision 48926)
+++ main.pp	(working copy)
@@ -1412,7 +1412,6 @@
   FormCreator: TIDEWindowCreator;
   PkgMngr: TPkgManager;
   CompPalette: TComponentPalette;
-  AMenuHeight: Integer;
 begin
   {$IFDEF IDE_MEM_CHECK}CheckHeapWrtMemCnt('TMainIDE.Create START');{$ENDIF}
   inherited Create(TheOwner);
@@ -1458,21 +1457,6 @@
   Application.CreateForm(TMainIDEBar,MainIDEBar);
   MainIDEBar.OnActive:=@OnMainBarActive;
 
-  AMenuHeight := LCLIntf.GetSystemMetrics(SM_CYMENU);
-  if AMenuHeight > 0 then
-  begin
-    // what we know:
-    // 1. cmd speedbuttons height = 22
-    // 2. components palette buttons = 32
-    // 3. menu height provided by widgetset (varies , depends on theme)
-    // so we set 22 + 32 + (borders * 2).
-    MainIDEBar.NonClientHeight := AMenuHeight +
-      //22 {cmd speedbtns} + 32 {component buttons} +
-      LCLIntf.GetSystemMetrics(SM_CYSIZEFRAME) +
-      (LCLIntf.GetSystemMetrics(SM_CYBORDER) * 2) {borders};
-  end else
-    MainIDEBar.NonClientHeight :=85;
-
   MainIDEBar.Name := NonModalIDEWindowNames[nmiwMainIDEName];
   FormCreator:=IDEWindowCreators.Add(MainIDEBar.Name);
   FormCreator.Right:='100%';
@@ -1543,7 +1527,6 @@
 
   // load package configs
   HelpBoss.LoadHelpOptions;
-  MainIDEBar.RefreshCoolbar;
 end;
 
 procedure TMainIDE.StartIDE;
@@ -2019,15 +2002,17 @@
   MainIDEBar.MainSplitter.Parent := MainIDEBar;
   MainIDEBar.MainSplitter.Align := alLeft;
   MainIDEBar.MainSplitter.MinSize := 50;
+  MainIDEBar.MainSplitter.Tag := 112;
   MainIDEBar.MainSplitter.OnMoved := @MainIDEBar.MainSplitterMoved;
 
-  MainIDEBar.tmIDEHeigth := TTimer.Create(OwningComponent);
-  MainIDEBar.tmIDEHeigth.Interval := 100;
-  MainIDEBar.tmIDEHeigth.Enabled := False;
-  MainIDEBar.tmIDEHeigth.OnTimer := @MainIDEBar.OnTimer;
+  MainIDEBar.tmIDEHeight := TTimer.Create(OwningComponent);
+  MainIDEBar.tmIDEHeight.Interval := 100;
+  MainIDEBar.tmIDEHeight.Enabled := False;
+  MainIDEBar.tmIDEHeight.OnTimer := @MainIDEBar.tmIDEHeightOnTimer;
 
   MainIDEBar.CoolBar := TCoolBar.Create(OwningComponent);
   MainIDEBar.CoolBar.Parent := MainIDEBar;
+  MainIDEBar.CoolBar.Tag := 112;
   if EnvironmentOptions.ComponentPaletteVisible then
   begin
     MainIDEBar.CoolBar.Align := alLeft;
@@ -2036,6 +2021,7 @@
   else
     MainIDEBar.CoolBar.Align := alClient;
 
+  MainIDEBar.mnuMainMenu.Tag := 112;
   // IDE Coolbar object wraps MainIDEBar.CoolBar.
   IDECoolBar := TIDECoolBar.Create(MainIDEBar.CoolBar);
   IDECoolBar.IsVisible := EnvironmentOptions.IDECoolBarOptions.IDECoolBarVisible;;
@@ -2068,6 +2054,7 @@
     Align := alClient;
     Visible:=EnvironmentOptions.ComponentPaletteVisible;
     Parent := MainIDEBar;
+    Tag := 112;
   end;
 end;
 
@@ -3726,7 +3713,7 @@
     MainIDEBar.CoolBar.Align := alClient;
   MainIDEBar.MainSplitter.Visible := MainIDEBar.Coolbar.Visible and
                                      MainIDEBar.ComponentPageControl.Visible;
-  MainIDEBar.SetMainIDEHeigth;
+  MainIDEBar.SetMainIDEHeight;
 end;
 
 procedure TMainIDE.DoToggleViewIDESpeedButtons;
@@ -3740,7 +3727,7 @@
   EnvironmentOptions.IDECoolBarOptions.IDECoolBarVisible := SpeedButtonsVisible;
   MainIDEBar.MainSplitter.Visible := MainIDEBar.Coolbar.Visible and
                                      MainIDEBar.ComponentPageControl.Visible;
-  MainIDEBar.SetMainIDEHeigth;
+  MainIDEBar.SetMainIDEHeight;
 end;
 
 procedure TMainIDE.AllowCompilation(aAllow: Boolean);
Index: mainbar.pas
===================================================================
--- mainbar.pas	(revision 48926)
+++ mainbar.pas	(working copy)
@@ -48,12 +48,11 @@
 type
   { TMainIDEBar }
 
-
   TMainIDEBar = class(TForm)
     //Coolbar and PopUpMenus
     CoolBar: TCoolBar;
     pmOptions: TPopupMenu;
-    tmIDEHeigth: TTimer;
+    tmIDEHeight: TTimer;
     miOptions: TMenuItem;
     OpenFilePopUpMenu: TPopupMenu;
     SetBuildModePopupMenu: TPopupMenu;
@@ -364,16 +363,22 @@
       const FileNames: array of String);
     procedure CoolBarOnChange(Sender: TObject);
     procedure MainSplitterMoved(Sender: TObject);
-    procedure OnTimer(Sender: TObject);
+    procedure tmIDEHeightOnTimer(Sender: TObject);
   private
     FOldWindowState: TWindowState;
     FOnActive: TNotifyEvent;
-    FNonClientHeight: Integer;
+    function GetNonClientHeight: Integer;
     procedure NewUFDefaultClick(Sender: TObject);
     procedure NewUnitFormPopupMenuPopup(Sender: TObject);
+    function IsDefaultIDE: Boolean;
   protected
     procedure DoActive;
+    procedure DoShow; override;
     procedure WndProc(var Message: TLMessage); override;
+
+    procedure DoSetMainIDEHeight(const ASetConstraint: Boolean);
+    function CalcMainIDEHeight: Integer;
+    procedure Resizing(State: TWindowState); override;
   public
     constructor Create(TheOwner: TComponent); override;
     procedure HideIDE;
@@ -382,17 +387,19 @@
     property OnActive: TNotifyEvent read FOnActive write FOnActive;
     procedure UpdateDockCaption({%H-}Exclude: TControl); override;
     procedure RefreshCoolbar;
-    procedure SetMainIDEHeigth;
+    procedure SetMainIDEHeight;
   public
-    property NonClientHeight: Integer read FNonClientHeight write FNonClientHeight;
+    property NonClientHeight: Integer read GetNonClientHeight;
   end;
 
-
 var
   MainIDEBar: TMainIDEBar = nil;
 
 implementation
 
+uses
+  LCLIntf, LCLType;
+
 { TMainIDEBar }
 
 procedure TMainIDEBar.MainIDEBarDropFiles(Sender: TObject;
@@ -476,6 +483,32 @@
     FOnActive(Self);
 end;
 
+procedure TMainIDEBar.DoSetMainIDEHeight(const ASetConstraint: Boolean);
+var
+  NewHeight: Integer;
+begin
+  NewHeight := CalcMainIDEHeight;
+  if ASetConstraint then
+    Constraints.MaxHeight := NewHeight + NonClientHeight;
+  ClientHeight := NewHeight;
+end;
+
+procedure TMainIDEBar.DoShow;
+begin
+  inherited DoShow;
+  RefreshCoolbar;
+end;
+
+function TMainIDEBar.GetNonClientHeight: Integer;
+var
+  WindowRect, WindowClientRect: TRect;
+begin
+  LclIntf.GetWindowRect(Handle, WindowRect{%H-});
+  LclIntf.GetClientRect(Handle, WindowClientRect{%H-});
+  LclIntf.ClientToScreen(Handle, WindowClientRect.TopLeft);
+  Result := WindowClientRect.Top - WindowRect.Top;
+end;
+
 procedure TMainIDEBar.WndProc(var Message: TLMessage);
 begin
   inherited WndProc(Message);
@@ -583,16 +616,60 @@
   MainSplitter.Align := alLeft;
   MainSplitter.Visible := MainIDEBar.Coolbar.Visible and
                           MainIDEBar.ComponentPageControl.Visible;
-  MainIDEBar.SetMainIDEHeigth;
+  SetMainIDEHeight;
 end;
 
+procedure TMainIDEBar.Resizing(State: TWindowState);
+begin
+  if IsDefaultIDE then
+  begin
+    case State of
+      wsMaximized: DoSetMainIDEHeight(True);
+      wsNormal: Constraints.MaxHeight := 0;
+    end;
+  end;
+
+  inherited Resizing(State);
+end;
+
 procedure TMainIDEBar.MainSplitterMoved(Sender: TObject);
 begin
   EnvironmentOptions.IDECoolBarOptions.IDECoolBarWidth := CoolBar.Width;
-  SetMainIDEHeigth
+  SetMainIDEHeight
 end;
 
+function TMainIDEBar.CalcMainIDEHeight: Integer;
+var
+  CoolBarVisible: Boolean;
+  ComponentsVisible: Boolean;
+  CoolBarHeight: Integer;
+  CoolBarDefHeight: Integer;
+begin
+  CoolBarVisible := EnvironmentOptions.IDECoolBarOptions.IDECoolBarVisible;
+  ComponentsVisible := EnvironmentOptions.ComponentPaletteVisible;
+  CoolBarDefHeight := CoolBar.Bands.Items[0].Height; //there is at least one band
+  CoolBarHeight := CoolBar.Bands.Items[CoolBar.Bands.Count - 1].Top +
+                   CoolBar.Bands.Items[CoolBar.Bands.Count - 1].Height;
 
+  //only the menu is visible
+  if (not CoolBarVisible) and (not ComponentsVisible) then
+    Result := 0
+  //only the coolbar is visible
+  else if (CoolBarVisible) and (not ComponentsVisible) then
+    Result := CoolBarHeight
+  //only the component palette is visible
+  else if (not CoolBarVisible) and (ComponentsVisible) then
+    Result := 2*CoolBarDefHeight
+  //both coolbar and component palette is visible
+  else if (CoolBarVisible) and (ComponentsVisible) then
+  begin
+    if CoolBarHeight > 2*CoolBarDefHeight then
+      Result := CoolBarHeight
+    else
+      Result := 2*CoolBarHeight;
+  end;
+end;
+
 procedure TMainIDEBar.CoolBarOnChange(Sender: TObject);
 var
   I, J: Integer;
@@ -612,54 +689,35 @@
   end;
   IDECoolBar.Sort;
   IDECoolBar.CopyToOptions(EnvironmentOptions.IDECoolBarOptions);
-  SetMainIDEHeigth;
+  SetMainIDEHeight;
 end;
 
-procedure TMainIDEBar.SetMainIDEHeigth;
+procedure TMainIDEBar.SetMainIDEHeight;
 begin
-  if tmIDEHeigth.Enabled then
-    Exit;
-  tmIDEHeigth.Enabled := True;
+  tmIDEHeight.Enabled := True;
 end;
 
-procedure TMainIDEBar.OnTimer(Sender: TObject);
+procedure TMainIDEBar.tmIDEHeightOnTimer(Sender: TObject);
+begin
+  if IsDefaultIDE then
+    DoSetMainIDEHeight(WindowState = wsMaximized);
+
+  tmIDEHeight.Enabled := False;
+end;
+
+function TMainIDEBar.IsDefaultIDE: Boolean;
 var
-  CoolBarVisible: Boolean;
-  ComponentsVisible: Boolean;
-  CoolBarHeigth: Integer;
-  CoolBarDefHeight: Integer;
-  ClientHeigth: Integer;
+  I: Integer;
 begin
-  CoolBarVisible := EnvironmentOptions.IDECoolBarOptions.IDECoolBarVisible;
-  ComponentsVisible := EnvironmentOptions.ComponentPaletteVisible;
-  CoolBarDefHeight := CoolBar.Bands.Items[0].Height; //there is at least one band
-  CoolBarHeigth := CoolBar.Bands.Items[CoolBar.Bands.Count - 1].Top +
-                   CoolBar.Bands.Items[CoolBar.Bands.Count - 1].Height;
-
-  //only the menu is visible
-  if (not CoolBarVisible) and (not ComponentsVisible) then
-    ClientHeigth := 0
-  //only the coolbar is visible
-  else if (CoolBarVisible) and (not ComponentsVisible) then
-    ClientHeigth := CoolBarHeigth
-  //only the component palette is visible
-  else if (not CoolBarVisible) and (ComponentsVisible) then
-    ClientHeigth := 2*CoolBarDefHeight
-  //both coolbar and component palette is visible
-  else if (CoolBarVisible) and (ComponentsVisible) then
+  Result := True;
+  for I := 0 to MainIDEBar.ControlCount - 1 do
   begin
-    if CoolBarHeigth > 2*CoolBarDefHeight then
-      ClientHeigth := CoolBarHeigth
-    else
-      ClientHeigth := 2*CoolBarHeigth;
+    if (MainIDEBar.Controls[I] as TControl).Tag <> 112 then
+    begin
+      Result := False;
+      Break;
+    end;
   end;
-
-  MainIDEBar.Constraints.MaxHeight := 0;
-  MainIDEBar.Constraints.MinHeight := 0;
-  MainIDEBar.ClientHeight := ClientHeigth;
-  MainIDEBar.Constraints.MaxHeight := NonClientHeight + ClientHeigth;
- // MainIDEBar.Constraints.MinHeight := NonClientHeight + ClientHeigth;
-  tmIDEHeigth.Enabled := False;
 end;
 
 
MainIDEBar_Height5.patch (10,655 bytes)   

Ondrej Pokorny

2015-05-05 00:59

developer   ~0083465

Added MainIDEBar_Height5.patch

Now the height is calculated as it was before but the MaxWidth constraint is set only when IDE window is maximized. I also renamed the OnTimer procedure to tmIDEHeightOnTimer (OnTimer was very unclear).

When IDE window is in normal state it's height is calculated/changed on coolbar change etc. but it can be resized freely afterwards.

Ondrej Pokorny

2015-05-05 02:34

developer  

MainIDEBar_Height6.patch (11,741 bytes)   
Index: componentpalette.pas
===================================================================
--- componentpalette.pas	(revision 48926)
+++ componentpalette.pas	(working copy)
@@ -331,6 +331,7 @@
       AutoScroll:=false;
       {$ENDIF}
       VertScrollBar.Increment := ComponentPaletteBtnHeight;
+      VertScrollBar.Tracking := True;
       Parent := PageComponent;
     end;
     PanelRight := TPanel.Create(PageComponent);
Index: frames/toolbar_options.pas
===================================================================
--- frames/toolbar_options.pas	(revision 48926)
+++ frames/toolbar_options.pas	(working copy)
@@ -198,6 +198,7 @@
   Opts.IDECoolBarGrabWidth := spGrabWidth.Value;
   Opts.IDECoolBarBorderStyle := cbBorderStyle.ItemIndex;
   MainIDEBar.RefreshCoolbar;
+  MainIDEBar.SetMainIDEHeight;
 end;
 
 class function TToolbarOptionsFrame.SupportedOptionsClass: TAbstractIDEOptionsClass;
Index: main.pp
===================================================================
--- main.pp	(revision 48926)
+++ main.pp	(working copy)
@@ -1412,7 +1412,6 @@
   FormCreator: TIDEWindowCreator;
   PkgMngr: TPkgManager;
   CompPalette: TComponentPalette;
-  AMenuHeight: Integer;
 begin
   {$IFDEF IDE_MEM_CHECK}CheckHeapWrtMemCnt('TMainIDE.Create START');{$ENDIF}
   inherited Create(TheOwner);
@@ -1458,21 +1457,6 @@
   Application.CreateForm(TMainIDEBar,MainIDEBar);
   MainIDEBar.OnActive:=@OnMainBarActive;
 
-  AMenuHeight := LCLIntf.GetSystemMetrics(SM_CYMENU);
-  if AMenuHeight > 0 then
-  begin
-    // what we know:
-    // 1. cmd speedbuttons height = 22
-    // 2. components palette buttons = 32
-    // 3. menu height provided by widgetset (varies , depends on theme)
-    // so we set 22 + 32 + (borders * 2).
-    MainIDEBar.NonClientHeight := AMenuHeight +
-      //22 {cmd speedbtns} + 32 {component buttons} +
-      LCLIntf.GetSystemMetrics(SM_CYSIZEFRAME) +
-      (LCLIntf.GetSystemMetrics(SM_CYBORDER) * 2) {borders};
-  end else
-    MainIDEBar.NonClientHeight :=85;
-
   MainIDEBar.Name := NonModalIDEWindowNames[nmiwMainIDEName];
   FormCreator:=IDEWindowCreators.Add(MainIDEBar.Name);
   FormCreator.Right:='100%';
@@ -1543,7 +1527,6 @@
 
   // load package configs
   HelpBoss.LoadHelpOptions;
-  MainIDEBar.RefreshCoolbar;
 end;
 
 procedure TMainIDE.StartIDE;
@@ -2019,15 +2002,17 @@
   MainIDEBar.MainSplitter.Parent := MainIDEBar;
   MainIDEBar.MainSplitter.Align := alLeft;
   MainIDEBar.MainSplitter.MinSize := 50;
+  MainIDEBar.MainSplitter.Tag := 112;
   MainIDEBar.MainSplitter.OnMoved := @MainIDEBar.MainSplitterMoved;
 
-  MainIDEBar.tmIDEHeigth := TTimer.Create(OwningComponent);
-  MainIDEBar.tmIDEHeigth.Interval := 100;
-  MainIDEBar.tmIDEHeigth.Enabled := False;
-  MainIDEBar.tmIDEHeigth.OnTimer := @MainIDEBar.OnTimer;
+  MainIDEBar.tmIDEHeight := TTimer.Create(OwningComponent);
+  MainIDEBar.tmIDEHeight.Interval := 100;
+  MainIDEBar.tmIDEHeight.Enabled := False;
+  MainIDEBar.tmIDEHeight.OnTimer := @MainIDEBar.tmIDEHeightOnTimer;
 
   MainIDEBar.CoolBar := TCoolBar.Create(OwningComponent);
   MainIDEBar.CoolBar.Parent := MainIDEBar;
+  MainIDEBar.CoolBar.Tag := 112;
   if EnvironmentOptions.ComponentPaletteVisible then
   begin
     MainIDEBar.CoolBar.Align := alLeft;
@@ -2036,6 +2021,7 @@
   else
     MainIDEBar.CoolBar.Align := alClient;
 
+  MainIDEBar.mnuMainMenu.Tag := 112;
   // IDE Coolbar object wraps MainIDEBar.CoolBar.
   IDECoolBar := TIDECoolBar.Create(MainIDEBar.CoolBar);
   IDECoolBar.IsVisible := EnvironmentOptions.IDECoolBarOptions.IDECoolBarVisible;;
@@ -2068,6 +2054,7 @@
     Align := alClient;
     Visible:=EnvironmentOptions.ComponentPaletteVisible;
     Parent := MainIDEBar;
+    Tag := 112;
   end;
 end;
 
@@ -3726,7 +3713,7 @@
     MainIDEBar.CoolBar.Align := alClient;
   MainIDEBar.MainSplitter.Visible := MainIDEBar.Coolbar.Visible and
                                      MainIDEBar.ComponentPageControl.Visible;
-  MainIDEBar.SetMainIDEHeigth;
+  MainIDEBar.SetMainIDEHeight;
 end;
 
 procedure TMainIDE.DoToggleViewIDESpeedButtons;
@@ -3740,7 +3727,7 @@
   EnvironmentOptions.IDECoolBarOptions.IDECoolBarVisible := SpeedButtonsVisible;
   MainIDEBar.MainSplitter.Visible := MainIDEBar.Coolbar.Visible and
                                      MainIDEBar.ComponentPageControl.Visible;
-  MainIDEBar.SetMainIDEHeigth;
+  MainIDEBar.SetMainIDEHeight;
 end;
 
 procedure TMainIDE.AllowCompilation(aAllow: Boolean);
Index: mainbar.pas
===================================================================
--- mainbar.pas	(revision 48926)
+++ mainbar.pas	(working copy)
@@ -48,12 +48,11 @@
 type
   { TMainIDEBar }
 
-
   TMainIDEBar = class(TForm)
     //Coolbar and PopUpMenus
     CoolBar: TCoolBar;
     pmOptions: TPopupMenu;
-    tmIDEHeigth: TTimer;
+    tmIDEHeight: TTimer;
     miOptions: TMenuItem;
     OpenFilePopUpMenu: TPopupMenu;
     SetBuildModePopupMenu: TPopupMenu;
@@ -364,16 +363,22 @@
       const FileNames: array of String);
     procedure CoolBarOnChange(Sender: TObject);
     procedure MainSplitterMoved(Sender: TObject);
-    procedure OnTimer(Sender: TObject);
+    procedure tmIDEHeightOnTimer(Sender: TObject);
   private
     FOldWindowState: TWindowState;
     FOnActive: TNotifyEvent;
-    FNonClientHeight: Integer;
+    function GetNonClientHeight: Integer;
     procedure NewUFDefaultClick(Sender: TObject);
     procedure NewUnitFormPopupMenuPopup(Sender: TObject);
+    function IsDefaultIDE: Boolean;
   protected
     procedure DoActive;
+    procedure DoShow; override;
     procedure WndProc(var Message: TLMessage); override;
+
+    procedure DoSetMainIDEHeight(const ASetConstraint: Boolean);
+    function CalcMainIDEHeight: Integer;
+    procedure Resizing(State: TWindowState); override;
   public
     constructor Create(TheOwner: TComponent); override;
     procedure HideIDE;
@@ -382,17 +387,19 @@
     property OnActive: TNotifyEvent read FOnActive write FOnActive;
     procedure UpdateDockCaption({%H-}Exclude: TControl); override;
     procedure RefreshCoolbar;
-    procedure SetMainIDEHeigth;
+    procedure SetMainIDEHeight;
   public
-    property NonClientHeight: Integer read FNonClientHeight write FNonClientHeight;
+    property NonClientHeight: Integer read GetNonClientHeight;
   end;
 
-
 var
   MainIDEBar: TMainIDEBar = nil;
 
 implementation
 
+uses
+  LCLIntf, LCLType, Math;
+
 { TMainIDEBar }
 
 procedure TMainIDEBar.MainIDEBarDropFiles(Sender: TObject;
@@ -476,6 +483,33 @@
     FOnActive(Self);
 end;
 
+procedure TMainIDEBar.DoSetMainIDEHeight(const ASetConstraint: Boolean);
+var
+  NewHeight: Integer;
+begin
+  NewHeight := CalcMainIDEHeight;
+  if ASetConstraint then
+    Constraints.MaxHeight := NewHeight + NonClientHeight;
+  ClientHeight := NewHeight;
+end;
+
+procedure TMainIDEBar.DoShow;
+begin
+  inherited DoShow;
+  RefreshCoolbar;
+end;
+
+function TMainIDEBar.GetNonClientHeight: Integer;
+var
+  WindowRect, WindowClientRect: TRect;
+begin
+  LclIntf.GetWindowRect(Handle, WindowRect{%H-});
+  LclIntf.GetClientRect(Handle, WindowClientRect{%H-});
+  LclIntf.ClientToScreen(Handle, WindowClientRect.TopLeft);
+  LclIntf.ClientToScreen(Handle, WindowClientRect.BottomRight);
+  Result := WindowClientRect.Top - WindowRect.Top + WindowRect.Bottom - WindowClientRect.Bottom;
+end;
+
 procedure TMainIDEBar.WndProc(var Message: TLMessage);
 begin
   inherited WndProc(Message);
@@ -583,16 +617,64 @@
   MainSplitter.Align := alLeft;
   MainSplitter.Visible := MainIDEBar.Coolbar.Visible and
                           MainIDEBar.ComponentPageControl.Visible;
-  MainIDEBar.SetMainIDEHeigth;
 end;
 
+procedure TMainIDEBar.Resizing(State: TWindowState);
+begin
+  if IsDefaultIDE then
+  begin
+    case State of
+      wsMaximized: DoSetMainIDEHeight(True);
+      wsNormal: Constraints.MaxHeight := 0;
+    end;
+  end;
+
+  inherited Resizing(State);
+end;
+
 procedure TMainIDEBar.MainSplitterMoved(Sender: TObject);
 begin
   EnvironmentOptions.IDECoolBarOptions.IDECoolBarWidth := CoolBar.Width;
-  SetMainIDEHeigth
+  SetMainIDEHeight
 end;
 
+function TMainIDEBar.CalcMainIDEHeight: Integer;
+var
+  NewHeight: Integer;
+  I: Integer;
+  ComponentScrollBox: TScrollBox;
+  SBControl: TControl;
+begin
+  Result := 0;
 
+  if EnvironmentOptions.IDECoolBarOptions.IDECoolBarVisible then
+  begin
+    for I := 0 to CoolBar.Bands.Count-1 do
+    begin
+      NewHeight := CoolBar.Bands[I].Top + CoolBar.Bands[I].Height;
+      Result := Max(Result, NewHeight);
+    end;
+  end;
+
+  if EnvironmentOptions.ComponentPaletteVisible then
+  begin
+    for I := 0 to ComponentPageControl.PageCount-1 do
+    if (ComponentPageControl.Page[I].ControlCount > 0) and (ComponentPageControl.Page[I].Controls[0] is TScrollBox) then
+    begin
+      ComponentScrollBox := TScrollBox(ComponentPageControl.Page[I].Controls[0]);
+      if ComponentScrollBox.ControlCount > 0 then
+      begin
+        SBControl := ComponentScrollBox.Controls[0];
+        NewHeight :=
+          SBControl.Top + SBControl.Height +  //button height
+          ComponentPageControl.Height - ComponentScrollBox.Height;  //page control non-client height (tabs, borders).
+        Result := Max(Result, NewHeight);
+        Break;  //we need only one button (we calculate one line only)
+      end;
+    end;
+  end;
+end;
+
 procedure TMainIDEBar.CoolBarOnChange(Sender: TObject);
 var
   I, J: Integer;
@@ -612,54 +694,35 @@
   end;
   IDECoolBar.Sort;
   IDECoolBar.CopyToOptions(EnvironmentOptions.IDECoolBarOptions);
-  SetMainIDEHeigth;
+  SetMainIDEHeight;
 end;
 
-procedure TMainIDEBar.SetMainIDEHeigth;
+procedure TMainIDEBar.SetMainIDEHeight;
 begin
-  if tmIDEHeigth.Enabled then
-    Exit;
-  tmIDEHeigth.Enabled := True;
+  tmIDEHeight.Enabled := True;
 end;
 
-procedure TMainIDEBar.OnTimer(Sender: TObject);
+procedure TMainIDEBar.tmIDEHeightOnTimer(Sender: TObject);
+begin
+  if IsDefaultIDE then
+    DoSetMainIDEHeight(WindowState = wsMaximized);
+
+  tmIDEHeight.Enabled := False;
+end;
+
+function TMainIDEBar.IsDefaultIDE: Boolean;
 var
-  CoolBarVisible: Boolean;
-  ComponentsVisible: Boolean;
-  CoolBarHeigth: Integer;
-  CoolBarDefHeight: Integer;
-  ClientHeigth: Integer;
+  I: Integer;
 begin
-  CoolBarVisible := EnvironmentOptions.IDECoolBarOptions.IDECoolBarVisible;
-  ComponentsVisible := EnvironmentOptions.ComponentPaletteVisible;
-  CoolBarDefHeight := CoolBar.Bands.Items[0].Height; //there is at least one band
-  CoolBarHeigth := CoolBar.Bands.Items[CoolBar.Bands.Count - 1].Top +
-                   CoolBar.Bands.Items[CoolBar.Bands.Count - 1].Height;
-
-  //only the menu is visible
-  if (not CoolBarVisible) and (not ComponentsVisible) then
-    ClientHeigth := 0
-  //only the coolbar is visible
-  else if (CoolBarVisible) and (not ComponentsVisible) then
-    ClientHeigth := CoolBarHeigth
-  //only the component palette is visible
-  else if (not CoolBarVisible) and (ComponentsVisible) then
-    ClientHeigth := 2*CoolBarDefHeight
-  //both coolbar and component palette is visible
-  else if (CoolBarVisible) and (ComponentsVisible) then
+  Result := True;
+  for I := 0 to MainIDEBar.ControlCount - 1 do
   begin
-    if CoolBarHeigth > 2*CoolBarDefHeight then
-      ClientHeigth := CoolBarHeigth
-    else
-      ClientHeigth := 2*CoolBarHeigth;
+    if (MainIDEBar.Controls[I] as TControl).Tag <> 112 then
+    begin
+      Result := False;
+      Break;
+    end;
   end;
-
-  MainIDEBar.Constraints.MaxHeight := 0;
-  MainIDEBar.Constraints.MinHeight := 0;
-  MainIDEBar.ClientHeight := ClientHeigth;
-  MainIDEBar.Constraints.MaxHeight := NonClientHeight + ClientHeigth;
- // MainIDEBar.Constraints.MinHeight := NonClientHeight + ClientHeigth;
-  tmIDEHeigth.Enabled := False;
 end;
 
 
MainIDEBar_Height6.patch (11,741 bytes)   

Ondrej Pokorny

2015-05-05 02:49

developer   ~0083467

MainIDEBar_Height7.patch - this should serve all the needs:
- Exact calculation of coolbar and component palette height.
- IDE main window height is not reset at start-up.
- Constraint is not set when IDE WindowStyle <> wsMaximized.
- IDE height is calculated only on properties change (visibility, IDE properties) and only when coolbar height was changed.

Ondrej Pokorny

2015-05-05 02:49

developer  

MainIDEBar_Height7.patch (12,439 bytes)   
Index: componentpalette.pas
===================================================================
--- componentpalette.pas	(revision 48926)
+++ componentpalette.pas	(working copy)
@@ -331,6 +331,7 @@
       AutoScroll:=false;
       {$ENDIF}
       VertScrollBar.Increment := ComponentPaletteBtnHeight;
+      VertScrollBar.Tracking := True;
       Parent := PageComponent;
     end;
     PanelRight := TPanel.Create(PageComponent);
Index: frames/toolbar_options.pas
===================================================================
--- frames/toolbar_options.pas	(revision 48926)
+++ frames/toolbar_options.pas	(working copy)
@@ -81,6 +81,7 @@
     FTempCoolBarOptions: TIDECoolBarOptions;
     // Used for assigning and testing the default configuration.
     FDefaultOptions: TDefaultCoolBarOptions;
+    FLastMainIDEHeight: Integer;
     procedure SelectBand(const ID: integer);
     function GetSelectedBand: Integer;
     procedure ToolBarClick(Sender: TObject);
@@ -139,6 +140,8 @@
 var
   Opts: TIDECoolBarOptions;
 begin
+  FLastMainIDEHeight := MainIDEBar.CalcMainIDEHeight;
+
   Opts := (AOptions as TEnvironmentOptions).IDECoolBarOptions;
   cbCoolBarVisible.Checked := Opts.IDECoolBarVisible;
   FTempCoolBar.IsVisible := Opts.IDECoolBarVisible;
@@ -198,6 +201,8 @@
   Opts.IDECoolBarGrabWidth := spGrabWidth.Value;
   Opts.IDECoolBarBorderStyle := cbBorderStyle.ItemIndex;
   MainIDEBar.RefreshCoolbar;
+  if FLastMainIDEHeight <> MainIDEBar.CalcMainIDEHeight then
+    MainIDEBar.SetMainIDEHeight;
 end;
 
 class function TToolbarOptionsFrame.SupportedOptionsClass: TAbstractIDEOptionsClass;
Index: main.pp
===================================================================
--- main.pp	(revision 48926)
+++ main.pp	(working copy)
@@ -1412,7 +1412,6 @@
   FormCreator: TIDEWindowCreator;
   PkgMngr: TPkgManager;
   CompPalette: TComponentPalette;
-  AMenuHeight: Integer;
 begin
   {$IFDEF IDE_MEM_CHECK}CheckHeapWrtMemCnt('TMainIDE.Create START');{$ENDIF}
   inherited Create(TheOwner);
@@ -1458,21 +1457,6 @@
   Application.CreateForm(TMainIDEBar,MainIDEBar);
   MainIDEBar.OnActive:=@OnMainBarActive;
 
-  AMenuHeight := LCLIntf.GetSystemMetrics(SM_CYMENU);
-  if AMenuHeight > 0 then
-  begin
-    // what we know:
-    // 1. cmd speedbuttons height = 22
-    // 2. components palette buttons = 32
-    // 3. menu height provided by widgetset (varies , depends on theme)
-    // so we set 22 + 32 + (borders * 2).
-    MainIDEBar.NonClientHeight := AMenuHeight +
-      //22 {cmd speedbtns} + 32 {component buttons} +
-      LCLIntf.GetSystemMetrics(SM_CYSIZEFRAME) +
-      (LCLIntf.GetSystemMetrics(SM_CYBORDER) * 2) {borders};
-  end else
-    MainIDEBar.NonClientHeight :=85;
-
   MainIDEBar.Name := NonModalIDEWindowNames[nmiwMainIDEName];
   FormCreator:=IDEWindowCreators.Add(MainIDEBar.Name);
   FormCreator.Right:='100%';
@@ -1543,7 +1527,6 @@
 
   // load package configs
   HelpBoss.LoadHelpOptions;
-  MainIDEBar.RefreshCoolbar;
 end;
 
 procedure TMainIDE.StartIDE;
@@ -2019,15 +2002,17 @@
   MainIDEBar.MainSplitter.Parent := MainIDEBar;
   MainIDEBar.MainSplitter.Align := alLeft;
   MainIDEBar.MainSplitter.MinSize := 50;
+  MainIDEBar.MainSplitter.Tag := 112;
   MainIDEBar.MainSplitter.OnMoved := @MainIDEBar.MainSplitterMoved;
 
-  MainIDEBar.tmIDEHeigth := TTimer.Create(OwningComponent);
-  MainIDEBar.tmIDEHeigth.Interval := 100;
-  MainIDEBar.tmIDEHeigth.Enabled := False;
-  MainIDEBar.tmIDEHeigth.OnTimer := @MainIDEBar.OnTimer;
+  MainIDEBar.tmIDEHeight := TTimer.Create(OwningComponent);
+  MainIDEBar.tmIDEHeight.Interval := 100;
+  MainIDEBar.tmIDEHeight.Enabled := False;
+  MainIDEBar.tmIDEHeight.OnTimer := @MainIDEBar.tmIDEHeightOnTimer;
 
   MainIDEBar.CoolBar := TCoolBar.Create(OwningComponent);
   MainIDEBar.CoolBar.Parent := MainIDEBar;
+  MainIDEBar.CoolBar.Tag := 112;
   if EnvironmentOptions.ComponentPaletteVisible then
   begin
     MainIDEBar.CoolBar.Align := alLeft;
@@ -2036,6 +2021,7 @@
   else
     MainIDEBar.CoolBar.Align := alClient;
 
+  MainIDEBar.mnuMainMenu.Tag := 112;
   // IDE Coolbar object wraps MainIDEBar.CoolBar.
   IDECoolBar := TIDECoolBar.Create(MainIDEBar.CoolBar);
   IDECoolBar.IsVisible := EnvironmentOptions.IDECoolBarOptions.IDECoolBarVisible;;
@@ -2068,6 +2054,7 @@
     Align := alClient;
     Visible:=EnvironmentOptions.ComponentPaletteVisible;
     Parent := MainIDEBar;
+    Tag := 112;
   end;
 end;
 
@@ -3726,7 +3713,7 @@
     MainIDEBar.CoolBar.Align := alClient;
   MainIDEBar.MainSplitter.Visible := MainIDEBar.Coolbar.Visible and
                                      MainIDEBar.ComponentPageControl.Visible;
-  MainIDEBar.SetMainIDEHeigth;
+  MainIDEBar.SetMainIDEHeight;
 end;
 
 procedure TMainIDE.DoToggleViewIDESpeedButtons;
@@ -3740,7 +3727,7 @@
   EnvironmentOptions.IDECoolBarOptions.IDECoolBarVisible := SpeedButtonsVisible;
   MainIDEBar.MainSplitter.Visible := MainIDEBar.Coolbar.Visible and
                                      MainIDEBar.ComponentPageControl.Visible;
-  MainIDEBar.SetMainIDEHeigth;
+  MainIDEBar.SetMainIDEHeight;
 end;
 
 procedure TMainIDE.AllowCompilation(aAllow: Boolean);
Index: mainbar.pas
===================================================================
--- mainbar.pas	(revision 48926)
+++ mainbar.pas	(working copy)
@@ -48,12 +48,11 @@
 type
   { TMainIDEBar }
 
-
   TMainIDEBar = class(TForm)
     //Coolbar and PopUpMenus
     CoolBar: TCoolBar;
     pmOptions: TPopupMenu;
-    tmIDEHeigth: TTimer;
+    tmIDEHeight: TTimer;
     miOptions: TMenuItem;
     OpenFilePopUpMenu: TPopupMenu;
     SetBuildModePopupMenu: TPopupMenu;
@@ -364,16 +363,21 @@
       const FileNames: array of String);
     procedure CoolBarOnChange(Sender: TObject);
     procedure MainSplitterMoved(Sender: TObject);
-    procedure OnTimer(Sender: TObject);
+    procedure tmIDEHeightOnTimer(Sender: TObject);
   private
     FOldWindowState: TWindowState;
     FOnActive: TNotifyEvent;
-    FNonClientHeight: Integer;
+    function GetNonClientHeight: Integer;
     procedure NewUFDefaultClick(Sender: TObject);
     procedure NewUnitFormPopupMenuPopup(Sender: TObject);
+    function IsDefaultIDE: Boolean;
   protected
     procedure DoActive;
+    procedure DoShow; override;
     procedure WndProc(var Message: TLMessage); override;
+
+    procedure DoSetMainIDEHeight(const ASetConstraint: Boolean);
+    procedure Resizing(State: TWindowState); override;
   public
     constructor Create(TheOwner: TComponent); override;
     procedure HideIDE;
@@ -382,17 +386,20 @@
     property OnActive: TNotifyEvent read FOnActive write FOnActive;
     procedure UpdateDockCaption({%H-}Exclude: TControl); override;
     procedure RefreshCoolbar;
-    procedure SetMainIDEHeigth;
+    procedure SetMainIDEHeight;
+    function CalcMainIDEHeight: Integer;
   public
-    property NonClientHeight: Integer read FNonClientHeight write FNonClientHeight;
+    property NonClientHeight: Integer read GetNonClientHeight;
   end;
 
-
 var
   MainIDEBar: TMainIDEBar = nil;
 
 implementation
 
+uses
+  LCLIntf, LCLType, Math;
+
 { TMainIDEBar }
 
 procedure TMainIDEBar.MainIDEBarDropFiles(Sender: TObject;
@@ -476,6 +483,33 @@
     FOnActive(Self);
 end;
 
+procedure TMainIDEBar.DoSetMainIDEHeight(const ASetConstraint: Boolean);
+var
+  NewHeight: Integer;
+begin
+  NewHeight := CalcMainIDEHeight;
+  if ASetConstraint then
+    Constraints.MaxHeight := NewHeight + NonClientHeight;
+  ClientHeight := NewHeight;
+end;
+
+procedure TMainIDEBar.DoShow;
+begin
+  inherited DoShow;
+  RefreshCoolbar;
+end;
+
+function TMainIDEBar.GetNonClientHeight: Integer;
+var
+  WindowRect, WindowClientRect: TRect;
+begin
+  LclIntf.GetWindowRect(Handle, WindowRect{%H-});
+  LclIntf.GetClientRect(Handle, WindowClientRect{%H-});
+  LclIntf.ClientToScreen(Handle, WindowClientRect.TopLeft);
+  LclIntf.ClientToScreen(Handle, WindowClientRect.BottomRight);
+  Result := WindowClientRect.Top - WindowRect.Top + WindowRect.Bottom - WindowClientRect.Bottom;
+end;
+
 procedure TMainIDEBar.WndProc(var Message: TLMessage);
 begin
   inherited WndProc(Message);
@@ -583,16 +617,64 @@
   MainSplitter.Align := alLeft;
   MainSplitter.Visible := MainIDEBar.Coolbar.Visible and
                           MainIDEBar.ComponentPageControl.Visible;
-  MainIDEBar.SetMainIDEHeigth;
 end;
 
+procedure TMainIDEBar.Resizing(State: TWindowState);
+begin
+  if IsDefaultIDE then
+  begin
+    case State of
+      wsMaximized: DoSetMainIDEHeight(True);
+      wsNormal: Constraints.MaxHeight := 0;
+    end;
+  end;
+
+  inherited Resizing(State);
+end;
+
 procedure TMainIDEBar.MainSplitterMoved(Sender: TObject);
 begin
   EnvironmentOptions.IDECoolBarOptions.IDECoolBarWidth := CoolBar.Width;
-  SetMainIDEHeigth
+  SetMainIDEHeight
 end;
 
+function TMainIDEBar.CalcMainIDEHeight: Integer;
+var
+  NewHeight: Integer;
+  I: Integer;
+  ComponentScrollBox: TScrollBox;
+  SBControl: TControl;
+begin
+  Result := 0;
 
+  if EnvironmentOptions.IDECoolBarOptions.IDECoolBarVisible then
+  begin
+    for I := 0 to CoolBar.Bands.Count-1 do
+    begin
+      NewHeight := CoolBar.Bands[I].Top + CoolBar.Bands[I].Height;
+      Result := Max(Result, NewHeight);
+    end;
+  end;
+
+  if EnvironmentOptions.ComponentPaletteVisible then
+  begin
+    for I := 0 to ComponentPageControl.PageCount-1 do
+    if (ComponentPageControl.Page[I].ControlCount > 0) and (ComponentPageControl.Page[I].Controls[0] is TScrollBox) then
+    begin
+      ComponentScrollBox := TScrollBox(ComponentPageControl.Page[I].Controls[0]);
+      if ComponentScrollBox.ControlCount > 0 then
+      begin
+        SBControl := ComponentScrollBox.Controls[0];
+        NewHeight :=
+          SBControl.Top + SBControl.Height +  //button height
+          ComponentPageControl.Height - ComponentScrollBox.Height;  //page control non-client height (tabs, borders).
+        Result := Max(Result, NewHeight);
+        Break;  //we need only one button (we calculate one line only)
+      end;
+    end;
+  end;
+end;
+
 procedure TMainIDEBar.CoolBarOnChange(Sender: TObject);
 var
   I, J: Integer;
@@ -612,54 +694,35 @@
   end;
   IDECoolBar.Sort;
   IDECoolBar.CopyToOptions(EnvironmentOptions.IDECoolBarOptions);
-  SetMainIDEHeigth;
+  SetMainIDEHeight;
 end;
 
-procedure TMainIDEBar.SetMainIDEHeigth;
+procedure TMainIDEBar.SetMainIDEHeight;
 begin
-  if tmIDEHeigth.Enabled then
-    Exit;
-  tmIDEHeigth.Enabled := True;
+  tmIDEHeight.Enabled := True;
 end;
 
-procedure TMainIDEBar.OnTimer(Sender: TObject);
+procedure TMainIDEBar.tmIDEHeightOnTimer(Sender: TObject);
+begin
+  if IsDefaultIDE then
+    DoSetMainIDEHeight(WindowState = wsMaximized);
+
+  tmIDEHeight.Enabled := False;
+end;
+
+function TMainIDEBar.IsDefaultIDE: Boolean;
 var
-  CoolBarVisible: Boolean;
-  ComponentsVisible: Boolean;
-  CoolBarHeigth: Integer;
-  CoolBarDefHeight: Integer;
-  ClientHeigth: Integer;
+  I: Integer;
 begin
-  CoolBarVisible := EnvironmentOptions.IDECoolBarOptions.IDECoolBarVisible;
-  ComponentsVisible := EnvironmentOptions.ComponentPaletteVisible;
-  CoolBarDefHeight := CoolBar.Bands.Items[0].Height; //there is at least one band
-  CoolBarHeigth := CoolBar.Bands.Items[CoolBar.Bands.Count - 1].Top +
-                   CoolBar.Bands.Items[CoolBar.Bands.Count - 1].Height;
-
-  //only the menu is visible
-  if (not CoolBarVisible) and (not ComponentsVisible) then
-    ClientHeigth := 0
-  //only the coolbar is visible
-  else if (CoolBarVisible) and (not ComponentsVisible) then
-    ClientHeigth := CoolBarHeigth
-  //only the component palette is visible
-  else if (not CoolBarVisible) and (ComponentsVisible) then
-    ClientHeigth := 2*CoolBarDefHeight
-  //both coolbar and component palette is visible
-  else if (CoolBarVisible) and (ComponentsVisible) then
+  Result := True;
+  for I := 0 to MainIDEBar.ControlCount - 1 do
   begin
-    if CoolBarHeigth > 2*CoolBarDefHeight then
-      ClientHeigth := CoolBarHeigth
-    else
-      ClientHeigth := 2*CoolBarHeigth;
+    if (MainIDEBar.Controls[I] as TControl).Tag <> 112 then
+    begin
+      Result := False;
+      Break;
+    end;
   end;
-
-  MainIDEBar.Constraints.MaxHeight := 0;
-  MainIDEBar.Constraints.MinHeight := 0;
-  MainIDEBar.ClientHeight := ClientHeigth;
-  MainIDEBar.Constraints.MaxHeight := NonClientHeight + ClientHeigth;
- // MainIDEBar.Constraints.MinHeight := NonClientHeight + ClientHeigth;
-  tmIDEHeigth.Enabled := False;
 end;
 
 
MainIDEBar_Height7.patch (12,439 bytes)   

Balázs Székely

2015-05-05 08:17

developer   ~0083472

@Ondrej Pokorny

Tested MainIDEBar_Height7.patch on Win32/64, GTK2, QT, OSX. Working as expected(within the specification), but in my opinion it's counter intuitive.
For example:
1. Set the IDEBar height to 150, click on the coolbar(free space), the IDE will resize itself.
2. Put two or more coolbar bands in a single line, move the splitter from right to left, the IDE will resize itself(I know you design it this way, but is confusing)

I think we should have a fully automated version and a freely resizable one. Anyway let's wait Juha, he's probably cooking up something good as we speaking.

PS: You did a great job! Thank you!

Juha Manninen

2015-05-05 17:52

developer   ~0083479

> Anyway let's wait Juha, he's probably cooking up something good as we speaking.

Unfortunately not, I had some other things. Now Mattias has fixed the code at least partly and the latest MainIDEBar_Height7.patch does not apply any more. I should have applied it earlier.

Would it be possible to have another patch against the current trunk? I try to apply it sooner. I don't know how much features of the last patch were covered by Mattias' commit.
Sorry for the hassle and extra work.

Ondrej Pokorny

2015-05-05 18:28

developer  

MainIDEBar_Height8.patch (31,755 bytes)   
Index: componentpalette.pas
===================================================================
--- componentpalette.pas	(revision 48932)
+++ componentpalette.pas	(working copy)
@@ -331,6 +331,7 @@
       AutoScroll:=false;
       {$ENDIF}
       VertScrollBar.Increment := ComponentPaletteBtnHeight;
+      VertScrollBar.Tracking := True;
       Parent := PageComponent;
     end;
     PanelRight := TPanel.Create(PageComponent);
Index: environmentopts.pp
===================================================================
--- environmentopts.pp	(revision 48932)
+++ environmentopts.pp	(working copy)
@@ -287,6 +287,8 @@
     FSingleTaskBarButton: boolean;
     FHideIDEOnRun: boolean;
     FComponentPaletteVisible: boolean;
+    FAutoAdjustIDEHeight: boolean;
+
     // CompletionWindow
     FCompletionWindowWidth: Integer;
     FCompletionWindowHeight: Integer;
@@ -517,6 +519,7 @@
                                                     write FIDEProjectDirectoryInIdeTitle;
     property ComponentPaletteVisible: boolean read FComponentPaletteVisible
                                               write FComponentPaletteVisible;
+    property AutoAdjustIDEHeight: Boolean read FAutoAdjustIDEHeight write FAutoAdjustIDEHeight;
     property CompletionWindowWidth: Integer read FCompletionWindowWidth
                                             write FCompletionWindowWidth;
     property CompletionWindowHeight: Integer read FCompletionWindowHeight
@@ -878,6 +881,7 @@
   FIDETitleIncludesBuildMode:=false;
   FIDEProjectDirectoryInIdeTitle:=false;
   FComponentPaletteVisible:=true;
+  FAutoAdjustIDEHeight:=true;
 
   // window menu
   FIDENameForDesignedFormList:=false;
@@ -1204,6 +1208,8 @@
         Path+'Desktop/IDEProjectDirectoryInIdeTitle/Value',false);
       FComponentPaletteVisible:=XMLConfig.GetValue(
         Path+'Desktop/ComponentPaletteVisible/Value',true);
+      FAutoAdjustIDEHeight:=XMLConfig.GetValue(
+        Path+'Desktop/AutoAdjustIDEHeight/Value',true);
       FCompletionWindowWidth:=XMLConfig.GetValue(
         Path+'Desktop/CompletionWindowWidth/Value', 320);
       FCompletionWindowHeight:=XMLConfig.GetValue(
@@ -1593,6 +1599,8 @@
                                FIDEProjectDirectoryInIdeTitle,false);
       XMLConfig.SetDeleteValue(Path+'Desktop/ComponentPaletteVisible/Value',
                                FComponentPaletteVisible,true);
+      XMLConfig.SetDeleteValue(Path+'Desktop/AutoAdjustIDEHeight/Value',
+                               FAutoAdjustIDEHeight,true);
       XMLConfig.SetDeleteValue(Path+'Desktop/CompletionWindowWidth/Value',
                                FCompletionWindowWidth, 320);
       XMLConfig.SetDeleteValue(Path+'Desktop/CompletionWindowHeight/Value',
Index: frames/toolbar_options.pas
===================================================================
--- frames/toolbar_options.pas	(revision 48932)
+++ frames/toolbar_options.pas	(working copy)
@@ -198,6 +198,7 @@
   Opts.IDECoolBarGrabWidth := spGrabWidth.Value;
   Opts.IDECoolBarBorderStyle := cbBorderStyle.ItemIndex;
   MainIDEBar.RefreshCoolbar;
+  MainIDEBar.SetMainIDEHeight;
 end;
 
 class function TToolbarOptionsFrame.SupportedOptionsClass: TAbstractIDEOptionsClass;
Index: frames/window_options.lfm
===================================================================
--- frames/window_options.lfm	(revision 48932)
+++ frames/window_options.lfm	(working copy)
@@ -1,13 +1,13 @@
 object WindowOptionsFrame: TWindowOptionsFrame
   Left = 0
-  Height = 545
+  Height = 582
   Top = 0
-  Width = 562
-  ClientHeight = 545
-  ClientWidth = 562
+  Width = 573
+  ClientHeight = 582
+  ClientWidth = 573
   TabOrder = 0
-  DesignLeft = 407
-  DesignTop = 219
+  DesignLeft = 349
+  DesignTop = 181
   object SingleTaskBarButtonCheckBox: TCheckBox
     AnchorSideLeft.Control = Owner
     AnchorSideTop.Control = lblShowingWindows
@@ -14,9 +14,9 @@
     AnchorSideTop.Side = asrBottom
     AnchorSideRight.Side = asrBottom
     Left = 0
-    Height = 24
-    Top = 20
-    Width = 224
+    Height = 17
+    Top = 13
+    Width = 165
     Caption = 'SingleTaskBarButtonCheckBox'
     ParentShowHint = False
     ShowHint = True
@@ -28,9 +28,9 @@
     AnchorSideTop.Side = asrBottom
     AnchorSideRight.Side = asrBottom
     Left = 0
-    Height = 24
-    Top = 44
-    Width = 187
+    Height = 17
+    Top = 30
+    Width = 138
     Caption = 'HideIDEOnRunCheckBox'
     ParentShowHint = False
     ShowHint = True
@@ -37,31 +37,27 @@
     TabOrder = 1
   end
   object WindowPositionsPanel: TPanel
-    AnchorSideLeft.Control = Owner
     AnchorSideTop.Control = lblWindowPosition
     AnchorSideTop.Side = asrBottom
-    AnchorSideRight.Control = Owner
-    AnchorSideRight.Side = asrBottom
-    AnchorSideBottom.Control = Owner
     AnchorSideBottom.Side = asrBottom
     Left = 0
-    Height = 354
-    Top = 191
-    Width = 562
+    Height = 423
+    Top = 154
+    Width = 570
     Anchors = [akTop, akLeft, akRight, akBottom]
-    BorderSpacing.Top = 1
+    BorderSpacing.Top = 3
     Caption = 'WindowPositionsPanel'
-    ClientHeight = 354
-    ClientWidth = 562
-    TabOrder = 2
+    ClientHeight = 423
+    ClientWidth = 570
+    TabOrder = 7
     object LeftLabel: TLabel
       AnchorSideTop.Control = LeftEdit
       AnchorSideTop.Side = asrCenter
       AnchorSideRight.Control = LeftEdit
-      Left = 281
-      Height = 20
-      Top = 238
-      Width = 61
+      Left = 306
+      Height = 13
+      Top = 231
+      Width = 44
       Anchors = [akTop, akRight]
       BorderSpacing.Right = 3
       Caption = 'LeftLabel'
@@ -71,10 +67,10 @@
       AnchorSideTop.Control = TopEdit
       AnchorSideTop.Side = asrCenter
       AnchorSideRight.Control = TopEdit
-      Left = 280
-      Height = 20
-      Top = 272
-      Width = 62
+      Left = 307
+      Height = 13
+      Top = 258
+      Width = 43
       Anchors = [akTop, akRight]
       BorderSpacing.Right = 3
       Caption = 'TopLabel'
@@ -84,10 +80,10 @@
       AnchorSideTop.Control = WidthEdit
       AnchorSideTop.Side = asrCenter
       AnchorSideRight.Control = WidthEdit
-      Left = 401
-      Height = 20
-      Top = 238
-      Width = 76
+      Left = 432
+      Height = 13
+      Top = 231
+      Width = 53
       Anchors = [akTop, akRight]
       BorderSpacing.Right = 3
       Caption = 'WidthLabel'
@@ -97,10 +93,10 @@
       AnchorSideTop.Control = HeightEdit
       AnchorSideTop.Side = asrCenter
       AnchorSideRight.Control = HeightEdit
-      Left = 396
-      Height = 20
-      Top = 272
-      Width = 81
+      Left = 429
+      Height = 13
+      Top = 258
+      Width = 56
       Anchors = [akTop, akRight]
       BorderSpacing.Right = 3
       Caption = 'HeightLabel'
@@ -114,7 +110,7 @@
       Left = 7
       Height = 120
       Top = 3
-      Width = 548
+      Width = 556
       Anchors = [akTop, akLeft, akRight]
       BorderSpacing.Left = 6
       BorderSpacing.Top = 2
@@ -122,7 +118,7 @@
       ItemHeight = 0
       OnSelectionChange = WindowPositionsListBoxSelectionChange
       ParentShowHint = False
-      ScrollWidth = 300
+      ScrollWidth = 552
       ShowHint = True
       TabOrder = 0
     end
@@ -131,9 +127,9 @@
       AnchorSideTop.Control = RestoreWindowGeometryRadioButton
       AnchorSideTop.Side = asrBottom
       Left = 7
-      Height = 24
-      Top = 261
-      Width = 288
+      Height = 17
+      Top = 247
+      Width = 206
       BorderSpacing.Left = 6
       BorderSpacing.Top = 3
       Caption = 'LetWindowManagerDecideRadioButton'
@@ -140,7 +136,7 @@
       OnClick = WindowGeometryRadioButtonClick
       ParentShowHint = False
       ShowHint = True
-      TabOrder = 1
+      TabOrder = 3
     end
     object FixedDefaultRadioButton: TRadioButton
       AnchorSideLeft.Control = WindowPositionsPanel
@@ -147,9 +143,9 @@
       AnchorSideTop.Control = LetWindowManagerDecideRadioButton
       AnchorSideTop.Side = asrBottom
       Left = 7
-      Height = 24
-      Top = 288
-      Width = 191
+      Height = 17
+      Top = 267
+      Width = 140
       BorderSpacing.Left = 6
       BorderSpacing.Top = 3
       Caption = 'FixedDefaultRadioButton'
@@ -156,7 +152,7 @@
       OnClick = WindowGeometryRadioButtonClick
       ParentShowHint = False
       ShowHint = True
-      TabOrder = 2
+      TabOrder = 4
     end
     object RestoreWindowGeometryRadioButton: TRadioButton
       AnchorSideLeft.Control = WindowPositionsPanel
@@ -163,9 +159,9 @@
       AnchorSideTop.Control = SplitterPanel
       AnchorSideTop.Side = asrBottom
       Left = 7
-      Height = 24
-      Top = 234
-      Width = 277
+      Height = 17
+      Top = 227
+      Width = 202
       BorderSpacing.Left = 6
       BorderSpacing.Top = 4
       Caption = 'RestoreWindowGeometryRadioButton'
@@ -173,7 +169,7 @@
       OnClick = CustomGeometryRadioButtonClick
       ParentShowHint = False
       ShowHint = True
-      TabOrder = 3
+      TabOrder = 2
       TabStop = True
     end
     object CustomGeometryRadioButton: TRadioButton
@@ -181,9 +177,9 @@
       AnchorSideTop.Control = FixedDefaultRadioButton
       AnchorSideTop.Side = asrBottom
       Left = 7
-      Height = 24
-      Top = 315
-      Width = 222
+      Height = 17
+      Top = 287
+      Width = 162
       BorderSpacing.Left = 6
       BorderSpacing.Top = 3
       Caption = 'CustomGeometryRadioButton'
@@ -190,14 +186,14 @@
       OnClick = CustomGeometryRadioButtonClick
       ParentShowHint = False
       ShowHint = True
-      TabOrder = 4
+      TabOrder = 5
     end
     object LeftEdit: TSpinEdit
       AnchorSideTop.Control = RestoreWindowGeometryRadioButton
       AnchorSideRight.Control = WidthEdit
-      Left = 345
-      Height = 28
-      Top = 234
+      Left = 353
+      Height = 21
+      Top = 227
       Width = 75
       Anchors = [akTop, akRight]
       BorderSpacing.Right = 60
@@ -205,15 +201,15 @@
       MinValue = -5000
       ParentShowHint = False
       ShowHint = True
-      TabOrder = 5
+      TabOrder = 6
     end
     object TopEdit: TSpinEdit
       AnchorSideTop.Control = LeftEdit
       AnchorSideTop.Side = asrBottom
       AnchorSideRight.Control = HeightEdit
-      Left = 345
-      Height = 28
-      Top = 268
+      Left = 353
+      Height = 21
+      Top = 254
       Width = 75
       Anchors = [akTop, akRight]
       BorderSpacing.Top = 6
@@ -222,15 +218,15 @@
       MinValue = -5000
       ParentShowHint = False
       ShowHint = True
-      TabOrder = 6
+      TabOrder = 7
     end
     object WidthEdit: TSpinEdit
       AnchorSideTop.Control = LeftEdit
       AnchorSideRight.Control = WindowPositionsPanel
       AnchorSideRight.Side = asrBottom
-      Left = 480
-      Height = 28
-      Top = 234
+      Left = 488
+      Height = 21
+      Top = 227
       Width = 75
       Anchors = [akTop, akRight]
       BorderSpacing.Right = 6
@@ -237,7 +233,7 @@
       MaxValue = 4096
       ParentShowHint = False
       ShowHint = True
-      TabOrder = 7
+      TabOrder = 8
     end
     object HeightEdit: TSpinEdit
       AnchorSideTop.Control = WidthEdit
@@ -244,9 +240,9 @@
       AnchorSideTop.Side = asrBottom
       AnchorSideRight.Control = WindowPositionsPanel
       AnchorSideRight.Side = asrBottom
-      Left = 480
-      Height = 28
-      Top = 268
+      Left = 488
+      Height = 21
+      Top = 254
       Width = 75
       Anchors = [akTop, akRight]
       BorderSpacing.Top = 6
@@ -254,15 +250,13 @@
       MaxValue = 4096
       ParentShowHint = False
       ShowHint = True
-      TabOrder = 8
+      TabOrder = 9
     end
     object GetWindowPositionButton: TButton
-      AnchorSideTop.Control = ApplyButton
-      AnchorSideRight.Control = ApplyButton
-      Left = 239
-      Height = 30
-      Top = 308
-      Width = 201
+      Left = 322
+      Height = 23
+      Top = 288
+      Width = 150
       Anchors = [akTop, akRight]
       AutoSize = True
       BorderSpacing.Right = 6
@@ -269,7 +263,7 @@
       Caption = 'GetWindowPositionButton'
       Constraints.MinWidth = 75
       OnClick = GetWindowPositionButtonClick
-      TabOrder = 9
+      TabOrder = 10
     end
     object ApplyButton: TButton
       AnchorSideTop.Control = HeightEdit
@@ -276,10 +270,10 @@
       AnchorSideTop.Side = asrBottom
       AnchorSideRight.Control = WindowPositionsPanel
       AnchorSideRight.Side = asrBottom
-      Left = 446
-      Height = 30
-      Top = 308
-      Width = 109
+      Left = 478
+      Height = 23
+      Top = 287
+      Width = 85
       Anchors = [akTop, akRight]
       AutoSize = True
       BorderSpacing.Top = 12
@@ -287,7 +281,7 @@
       Caption = 'ApplyButton'
       Constraints.MinWidth = 75
       OnClick = ApplyButtonClick
-      TabOrder = 10
+      TabOrder = 11
     end
     object SplitterPanel: TPanel
       AnchorSideLeft.Control = WindowPositionsPanel
@@ -299,8 +293,8 @@
       AnchorSideBottom.Side = asrBottom
       Left = 5
       Height = 78
-      Top = 152
-      Width = 556
+      Top = 145
+      Width = 564
       Anchors = [akTop, akLeft, akRight]
       BorderSpacing.Left = 4
       BorderSpacing.Top = 3
@@ -309,8 +303,8 @@
       BorderStyle = bsSingle
       Caption = ' '
       ClientHeight = 74
-      ClientWidth = 552
-      TabOrder = 11
+      ClientWidth = 560
+      TabOrder = 1
       Visible = False
       object SplitterList: TListBox
         AnchorSideLeft.Control = SplitterPanel
@@ -325,7 +319,7 @@
         ItemHeight = 0
         OnSelectionChange = SplitterListSelectionChange
         ParentShowHint = False
-        ScrollWidth = 273
+        ScrollWidth = 271
         ShowHint = True
         TabOrder = 0
       end
@@ -333,10 +327,10 @@
         AnchorSideTop.Control = SplitEdit
         AnchorSideTop.Side = asrCenter
         AnchorSideRight.Control = SplitEdit
-        Left = 407
-        Height = 20
-        Top = 40
-        Width = 66
+        Left = 436
+        Height = 13
+        Top = 47
+        Width = 45
         Anchors = [akTop, akRight]
         BorderSpacing.Right = 3
         Caption = 'SplitLabel'
@@ -347,9 +341,9 @@
         AnchorSideRight.Side = asrBottom
         AnchorSideBottom.Control = SplitterPanel
         AnchorSideBottom.Side = asrBottom
-        Left = 476
-        Height = 28
-        Top = 36
+        Left = 484
+        Height = 21
+        Top = 43
         Width = 75
         Anchors = [akRight, akBottom]
         BorderSpacing.Bottom = 9
@@ -356,7 +350,7 @@
         MaxValue = 5000
         ParentShowHint = False
         ShowHint = True
-        TabOrder = 1
+        TabOrder = 2
       end
       object dropSplitterPlacement: TComboBox
         AnchorSideLeft.Control = SplitterList
@@ -365,16 +359,16 @@
         AnchorSideRight.Control = SplitterPanel
         AnchorSideRight.Side = asrBottom
         Left = 282
-        Height = 28
+        Height = 21
         Top = 1
-        Width = 269
+        Width = 277
         Anchors = [akTop, akLeft, akRight]
         BorderSpacing.Left = 6
-        ItemHeight = 20
+        ItemHeight = 13
         ParentShowHint = False
         ShowHint = True
         Style = csDropDownList
-        TabOrder = 2
+        TabOrder = 1
       end
     end
     object lblWindowCaption: TDividerBevel
@@ -384,9 +378,9 @@
       AnchorSideRight.Control = WindowPositionsPanel
       AnchorSideRight.Side = asrBottom
       Left = 1
-      Height = 20
+      Height = 13
       Top = 129
-      Width = 560
+      Width = 568
       Caption = 'lblWindowCaption'
       Anchors = [akTop, akLeft, akRight]
       BorderSpacing.Top = 6
@@ -400,13 +394,13 @@
     AnchorSideTop.Control = HideIDEOnRunCheckBox
     AnchorSideTop.Side = asrBottom
     Left = 0
-    Height = 24
-    Top = 68
-    Width = 231
+    Height = 17
+    Top = 47
+    Width = 172
     Caption = 'TitleStartsWithProjectCheckBox'
     ParentShowHint = False
     ShowHint = True
-    TabOrder = 3
+    TabOrder = 2
   end
   object ProjectDirInIdeTitleCheckBox: TCheckBox
     AnchorSideLeft.Control = Owner
@@ -413,13 +407,13 @@
     AnchorSideTop.Control = TitleStartsWithProjectCheckBox
     AnchorSideTop.Side = asrBottom
     Left = 0
-    Height = 24
-    Top = 92
-    Width = 216
+    Height = 17
+    Top = 64
+    Width = 160
     Caption = 'ProjectDirInIdeTitleCheckBox'
     ParentShowHint = False
     ShowHint = True
-    TabOrder = 4
+    TabOrder = 3
   end
   object TitleIncludesBuildMode: TCheckBox
     AnchorSideLeft.Control = Owner
@@ -426,13 +420,13 @@
     AnchorSideTop.Control = ProjectDirInIdeTitleCheckBox
     AnchorSideTop.Side = asrBottom
     Left = 0
-    Height = 24
-    Top = 116
-    Width = 180
+    Height = 17
+    Top = 81
+    Width = 128
     Caption = 'TitleIncludesBuildMode'
     ParentShowHint = False
     ShowHint = True
-    TabOrder = 5
+    TabOrder = 4
   end
   object NameForDesignedFormList: TCheckBox
     AnchorSideLeft.Control = Owner
@@ -439,13 +433,13 @@
     AnchorSideTop.Control = TitleIncludesBuildMode
     AnchorSideTop.Side = asrBottom
     Left = 0
-    Height = 24
-    Top = 140
-    Width = 204
+    Height = 17
+    Top = 98
+    Width = 147
     Caption = 'NameForDesignedFormList'
     ParentShowHint = False
     ShowHint = True
-    TabOrder = 6
+    TabOrder = 5
   end
   object lblShowingWindows: TDividerBevel
     AnchorSideLeft.Control = Owner
@@ -453,9 +447,9 @@
     AnchorSideRight.Control = Owner
     AnchorSideRight.Side = asrBottom
     Left = 0
-    Height = 20
+    Height = 13
     Top = 0
-    Width = 562
+    Width = 573
     Caption = 'lblShowingWindows'
     Anchors = [akTop, akLeft, akRight]
     Font.Style = [fsBold]
@@ -463,14 +457,14 @@
   end
   object lblWindowPosition: TDividerBevel
     AnchorSideLeft.Control = Owner
-    AnchorSideTop.Control = NameForDesignedFormList
+    AnchorSideTop.Control = AutoAdjustIDEHeightCheckBox
     AnchorSideTop.Side = asrBottom
     AnchorSideRight.Control = Owner
     AnchorSideRight.Side = asrBottom
     Left = 0
-    Height = 20
-    Top = 170
-    Width = 562
+    Height = 13
+    Top = 138
+    Width = 573
     Caption = 'lblWindowPosition'
     Anchors = [akTop, akLeft, akRight]
     BorderSpacing.Top = 6
@@ -477,4 +471,17 @@
     Font.Style = [fsBold]
     ParentFont = False
   end
+  object AutoAdjustIDEHeightCheckBox: TCheckBox
+    AnchorSideLeft.Control = Owner
+    AnchorSideTop.Control = NameForDesignedFormList
+    AnchorSideTop.Side = asrBottom
+    Left = 0
+    Height = 17
+    Top = 115
+    Width = 169
+    Caption = 'AutoAdjustIDEHeightCheckBox'
+    ParentShowHint = False
+    ShowHint = True
+    TabOrder = 6
+  end
 end
Index: frames/window_options.pas
===================================================================
--- frames/window_options.pas	(revision 48932)
+++ frames/window_options.pas	(working copy)
@@ -39,6 +39,7 @@
     lblShowingWindows: TDividerBevel;
     lblWindowCaption: TDividerBevel;
     NameForDesignedFormList: TCheckBox;
+    AutoAdjustIDEHeightCheckBox: TCheckBox;
     TitleIncludesBuildMode: TCheckBox;
     dropSplitterPlacement: TComboBox;
     CustomGeometryRadioButton: TRadioButton;
@@ -122,6 +123,8 @@
   TitleIncludesBuildMode.Hint:=lisBuildModeInTitleInExample;
   NameForDesignedFormList.Caption:=lisWindowMenuWithNameForDesignedForm;
   NameForDesignedFormList.Hint:=lisWindowMenuWithNameForDesignedFormHint;
+  AutoAdjustIDEHeightCheckBox.Caption:=lisAutoAdjustIDEHeight;
+  AutoAdjustIDEHeightCheckBox.Hint:=lisAutoAdjustIDEHeightHint;
   ProjectDirInIdeTitleCheckBox.Caption:=lisIDETitleShowsProjectDir;
   ProjectDirInIdeTitleCheckBox.Hint:=lisProjectDirectoryIsShowedInIdeTitleBar;
 end;
@@ -139,6 +142,7 @@
     TitleStartsWithProjectCheckBox.Checked:=IDETitleStartsWithProject;
     TitleIncludesBuildMode.Checked:=IDETitleIncludesBuildMode;
     NameForDesignedFormList.Checked:=IDENameForDesignedFormList;
+    AutoAdjustIDEHeightCheckBox.Checked:=AutoAdjustIDEHeight;
     ProjectDirInIdeTitleCheckBox.Checked:=IDEProjectDirectoryInIdeTitle;
   end;
 
@@ -219,6 +223,7 @@
     IDETitleStartsWithProject:=TitleStartsWithProjectCheckBox.Checked;
     IDETitleIncludesBuildMode := TitleIncludesBuildMode.Checked;
     IDENameForDesignedFormList := NameForDesignedFormList.Checked;
+    AutoAdjustIDEHeight := AutoAdjustIDEHeightCheckBox.Checked;
     IDEProjectDirectoryInIdeTitle:=ProjectDirInIdeTitleCheckBox.Checked;
   end;
 end;
Index: lazarusidestrconsts.pas
===================================================================
--- lazarusidestrconsts.pas	(revision 48932)
+++ lazarusidestrconsts.pas	(working copy)
@@ -1259,6 +1259,8 @@
   lisIDETitleStartsWithProjectName = 'IDE title starts with project name';
   lisIDETitleShowsProjectDir = 'IDE title shows project directory';
   lisIDETitleShowsBuildMode = 'IDE title shows selected build mode';
+  lisAutoAdjustIDEHeight = 'Automatically adjust IDE main window height';
+  lisAutoAdjustIDEHeightHint = 'Applicable only when not maximized and for undocked IDE.';
   lisWindowMenuWithNameForDesignedForm = 'Window menu shows designed form''s name instead of caption';
   lisWindowMenuWithNameForDesignedFormHint = 'Useful especially if the caption is left empty.';
   dlgWinPos = 'Window positions';
Index: main.pp
===================================================================
--- main.pp	(revision 48932)
+++ main.pp	(working copy)
@@ -1412,7 +1412,6 @@
   FormCreator: TIDEWindowCreator;
   PkgMngr: TPkgManager;
   CompPalette: TComponentPalette;
-  AMenuHeight: Integer;
 begin
   {$IFDEF IDE_MEM_CHECK}CheckHeapWrtMemCnt('TMainIDE.Create START');{$ENDIF}
   inherited Create(TheOwner);
@@ -1458,21 +1457,6 @@
   Application.CreateForm(TMainIDEBar,MainIDEBar);
   MainIDEBar.OnActive:=@OnMainBarActive;
 
-  AMenuHeight := LCLIntf.GetSystemMetrics(SM_CYMENU);
-  if AMenuHeight > 0 then
-  begin
-    // what we know:
-    // 1. cmd speedbuttons height = 22
-    // 2. components palette buttons = 32
-    // 3. menu height provided by widgetset (varies , depends on theme)
-    // so we set 22 + 32 + (borders * 2).
-    MainIDEBar.NonClientHeight := AMenuHeight +
-      //22 {cmd speedbtns} + 32 {component buttons} +
-      LCLIntf.GetSystemMetrics(SM_CYSIZEFRAME) +
-      (LCLIntf.GetSystemMetrics(SM_CYBORDER) * 2) {borders};
-  end else
-    MainIDEBar.NonClientHeight :=85;
-
   MainIDEBar.Name := NonModalIDEWindowNames[nmiwMainIDEName];
   FormCreator:=IDEWindowCreators.Add(MainIDEBar.Name);
   FormCreator.Right:='100%';
@@ -1543,7 +1527,6 @@
 
   // load package configs
   HelpBoss.LoadHelpOptions;
-  MainIDEBar.RefreshCoolbar;
 end;
 
 procedure TMainIDE.StartIDE;
@@ -2019,15 +2002,13 @@
   MainIDEBar.MainSplitter.Parent := MainIDEBar;
   MainIDEBar.MainSplitter.Align := alLeft;
   MainIDEBar.MainSplitter.MinSize := 50;
+  MainIDEBar.MainSplitter.Tag := 112;
   MainIDEBar.MainSplitter.OnMoved := @MainIDEBar.MainSplitterMoved;
 
-  MainIDEBar.IDEHeightTimer := TTimer.Create(OwningComponent);
-  MainIDEBar.IDEHeightTimer.Interval := 100;
-  MainIDEBar.IDEHeightTimer.Enabled := False;
-  MainIDEBar.IDEHeightTimer.OnTimer := @MainIDEBar.OnTimer;
 
   MainIDEBar.CoolBar := TCoolBar.Create(OwningComponent);
   MainIDEBar.CoolBar.Parent := MainIDEBar;
+  MainIDEBar.CoolBar.Tag := 112;
   if EnvironmentOptions.ComponentPaletteVisible then
   begin
     MainIDEBar.CoolBar.Align := alLeft;
@@ -2036,6 +2017,7 @@
   else
     MainIDEBar.CoolBar.Align := alClient;
 
+  MainIDEBar.mnuMainMenu.Tag := 112;
   // IDE Coolbar object wraps MainIDEBar.CoolBar.
   IDECoolBar := TIDECoolBar.Create(MainIDEBar.CoolBar);
   IDECoolBar.IsVisible := EnvironmentOptions.IDECoolBarOptions.IDECoolBarVisible;;
@@ -2068,6 +2050,7 @@
     Align := alClient;
     Visible:=EnvironmentOptions.ComponentPaletteVisible;
     Parent := MainIDEBar;
+    Tag := 112;
   end;
 end;
 
@@ -3705,7 +3688,7 @@
 
 procedure TMainIDE.DoToggleViewComponentPalette;
 var
-  ComponentPaletteVisible: boolean;
+  ComponentPaletteVisible: Boolean;
 begin
   ComponentPaletteVisible:=not MainIDEBar.ComponentPageControl.Visible;
   MainIDEBar.itmViewComponentPalette.Checked:=ComponentPaletteVisible;
Index: mainbar.pas
===================================================================
--- mainbar.pas	(revision 48932)
+++ mainbar.pas	(working copy)
@@ -48,12 +48,10 @@
 type
   { TMainIDEBar }
 
-
   TMainIDEBar = class(TForm)
     //Coolbar and PopUpMenus
     CoolBar: TCoolBar;
     OptionsPopupMenu: TPopupMenu;
-    IDEHeightTimer: TTimer;
     OptionsMenuItem: TMenuItem;
     OpenFilePopUpMenu: TPopupMenu;
     SetBuildModePopupMenu: TPopupMenu;
@@ -364,16 +362,21 @@
       const FileNames: array of String);
     procedure CoolBarOnChange(Sender: TObject);
     procedure MainSplitterMoved(Sender: TObject);
-    procedure OnTimer(Sender: TObject);
   private
     FOldWindowState: TWindowState;
     FOnActive: TNotifyEvent;
-    FNonClientHeight: Integer;
     procedure NewUnitFormDefaultClick(Sender: TObject);
     procedure NewUnitFormPopupMenuPopup(Sender: TObject);
+    function IsDefaultIDE: Boolean;
+    function CalcMainIDEHeight: Integer;
+    function CalcNonClientHeight: Integer;
   protected
     procedure DoActive;
+    procedure DoShow; override;
     procedure WndProc(var Message: TLMessage); override;
+
+    procedure DoSetMainIDEHeight(const AIDEIsMaximized: Boolean);
+    procedure Resizing(State: TWindowState); override;
   public
     constructor Create(TheOwner: TComponent); override;
     procedure HideIDE;
@@ -383,16 +386,16 @@
     procedure UpdateDockCaption({%H-}Exclude: TControl); override;
     procedure RefreshCoolbar;
     procedure SetMainIDEHeight;
-  public
-    property NonClientHeight: Integer read FNonClientHeight write FNonClientHeight;
   end;
 
-
 var
   MainIDEBar: TMainIDEBar = nil;
 
 implementation
 
+uses
+  LCLIntf, LCLType, InterfaceBase, Math;
+
 { TMainIDEBar }
 
 procedure TMainIDEBar.MainIDEBarDropFiles(Sender: TObject;
@@ -476,6 +479,54 @@
     FOnActive(Self);
 end;
 
+procedure TMainIDEBar.DoSetMainIDEHeight(const AIDEIsMaximized: Boolean);
+var
+  NewHeight: Integer;
+begin
+  if not (Showing and IsDefaultIDE) then
+    Exit;
+
+  if (AIDEIsMaximized or EnvironmentOptions.AutoAdjustIDEHeight) then
+  begin
+    NewHeight := CalcMainIDEHeight + CalcNonClientHeight;
+    if NewHeight <> Constraints.MaxHeight then
+    begin
+      Constraints.MaxHeight := NewHeight;
+      Constraints.MinHeight := Constraints.MaxHeight;
+      ClientHeight := Constraints.MaxHeight;
+    end;
+  end else
+  if Constraints.MaxHeight <> 0 then
+  begin
+    Constraints.MaxHeight := 0;
+    Constraints.MinHeight := 0;
+  end;
+end;
+
+procedure TMainIDEBar.DoShow;
+begin
+  inherited DoShow;
+  RefreshCoolbar;
+end;
+
+function TMainIDEBar.CalcNonClientHeight: Integer;
+var
+  WindowRect, WindowClientRect: TRect;
+begin
+  if Showing then
+  begin
+    LclIntf.GetWindowRect(Handle, WindowRect{%H-});
+    LclIntf.GetClientRect(Handle, WindowClientRect{%H-});
+    LclIntf.ClientToScreen(Handle, WindowClientRect.TopLeft);
+
+    Result := WindowClientRect.Top - WindowRect.Top;
+
+    if Pos('Win32', WidgetSet.ClassName) > 0 then//TWin32WidgetSet widgetset bug -> the constrained height has to be without SM_CYSIZEFRAME and SM_CYMENU (Gtk2 works fine)
+      Result := Result - (LCLIntf.GetSystemMetrics(SM_CYSIZEFRAME) + LCLIntf.GetSystemMetrics(SM_CYMENU));
+  end else
+    Result := 0;
+end;
+
 procedure TMainIDEBar.WndProc(var Message: TLMessage);
 begin
   inherited WndProc(Message);
@@ -583,16 +634,62 @@
   MainSplitter.Align := alLeft;
   MainSplitter.Visible := MainIDEBar.Coolbar.Visible and
                           MainIDEBar.ComponentPageControl.Visible;
-  MainIDEBar.SetMainIDEHeight;
 end;
 
+procedure TMainIDEBar.Resizing(State: TWindowState);
+begin
+  case State of
+    wsMaximized, wsNormal: DoSetMainIDEHeight(State = wsMaximized);
+  end;
+
+  inherited Resizing(State);
+end;
+
 procedure TMainIDEBar.MainSplitterMoved(Sender: TObject);
 begin
   EnvironmentOptions.IDECoolBarOptions.IDECoolBarWidth := CoolBar.Width;
-  SetMainIDEHeight
+  SetMainIDEHeight;
 end;
 
+function TMainIDEBar.CalcMainIDEHeight: Integer;
+var
+  NewHeight: Integer;
+  I: Integer;
+  ComponentScrollBox: TScrollBox;
+  SBControl: TControl;
+begin
+  Result := 0;
+  if not (Assigned(EnvironmentOptions) and Assigned(CoolBar) and Assigned(ComponentPageControl)) then
+    Exit;
 
+  if EnvironmentOptions.IDECoolBarOptions.IDECoolBarVisible then
+  begin
+    for I := 0 to CoolBar.Bands.Count-1 do
+    begin
+      NewHeight := CoolBar.Bands[I].Top + CoolBar.Bands[I].Height;
+      Result := Max(Result, NewHeight);
+    end;
+  end;
+
+  if EnvironmentOptions.ComponentPaletteVisible then
+  begin
+    for I := 0 to ComponentPageControl.PageCount-1 do
+    if (ComponentPageControl.Page[I].ControlCount > 0) and (ComponentPageControl.Page[I].Controls[0] is TScrollBox) then
+    begin
+      ComponentScrollBox := TScrollBox(ComponentPageControl.Page[I].Controls[0]);
+      if ComponentScrollBox.ControlCount > 0 then
+      begin
+        SBControl := ComponentScrollBox.Controls[0];
+        NewHeight :=
+          SBControl.Top + SBControl.Height +  //button height
+          ComponentPageControl.Height - ComponentScrollBox.ClientHeight;  //page control non-client height (tabs, borders).
+        Result := Max(Result, NewHeight);
+        Break;  //we need only one button (we calculate one line only)
+      end;
+    end;
+  end;
+end;
+
 procedure TMainIDEBar.CoolBarOnChange(Sender: TObject);
 var
   I, J: Integer;
@@ -617,52 +714,22 @@
 
 procedure TMainIDEBar.SetMainIDEHeight;
 begin
-  if IDEHeightTimer.Enabled then
-    Exit;
-  IDEHeightTimer.Enabled := True;
+  DoSetMainIDEHeight(WindowState = wsMaximized);
 end;
 
-procedure TMainIDEBar.OnTimer(Sender: TObject);
+function TMainIDEBar.IsDefaultIDE: Boolean;
 var
-  CoolBarVisible: Boolean;
-  ComponentsVisible: Boolean;
-  CoolBarHeigth: Integer;
-  CoolBarDefHeight: Integer;
-  NewClientHeight: Integer;
+  I: Integer;
 begin
-  CoolBarVisible := EnvironmentOptions.IDECoolBarOptions.IDECoolBarVisible;
-  ComponentsVisible := EnvironmentOptions.ComponentPaletteVisible;
-  CoolBarDefHeight := CoolBar.Bands.Items[0].Height; //there is at least one band
-  CoolBarHeigth := CoolBar.Bands.Items[CoolBar.Bands.Count - 1].Top +
-                   CoolBar.Bands.Items[CoolBar.Bands.Count - 1].Height;
-
-  if (MainIDEBar.Parent=nil) and (MainIDEBar.DockManager=nil) then
+  Result := True;
+  for I := 0 to MainIDEBar.ControlCount - 1 do
   begin
-    //only the menu is visible
-    if (not CoolBarVisible) and (not ComponentsVisible) then
-      NewClientHeight := 0
-    //only the coolbar is visible
-    else if (CoolBarVisible) and (not ComponentsVisible) then
-      NewClientHeight := CoolBarHeigth
-    //only the component palette is visible
-    else if (not CoolBarVisible) and (ComponentsVisible) then
-      NewClientHeight := 2*CoolBarDefHeight
-    //both coolbar and component palette is visible
-    else if (CoolBarVisible) and (ComponentsVisible) then
+    if (MainIDEBar.Controls[I] as TControl).Tag <> 112 then
     begin
-      if CoolBarHeigth > 2*CoolBarDefHeight then
-        NewClientHeight := CoolBarHeigth
-      else
-        NewClientHeight := 2*CoolBarHeigth;
+      Result := False;
+      Break;
     end;
-
-    MainIDEBar.Constraints.MaxHeight := 0;
-    MainIDEBar.Constraints.MinHeight := 0;
-    MainIDEBar.ClientHeight := NewClientHeight;
-    MainIDEBar.Constraints.MaxHeight := NonClientHeight + NewClientHeight;
-   // MainIDEBar.Constraints.MinHeight := NonClientHeight + NewClientHeight;
   end;
-  IDEHeightTimer.Enabled := False;
 end;
 
 
MainIDEBar_Height8.patch (31,755 bytes)   

Ondrej Pokorny

2015-05-05 18:34

developer   ~0083482

MainIDEBar_Height8.patch
- I added a new option in "IDE Options" -> "Window" -> "Automatically adjust IDE main window height"
- If this option is set, the height of IDE window is always calculated and cannot be modified at all. The IDE window height is changed also on resize. If it's not set, you can freely set the IDE window height (it is still set and calculated for maximized IDE, of course).

- I checked Win32 and Gtk2 - it should work fine. Unfortunately, the behaviour of constraints (regarding to main menu) is different, therefore I had to apply a bug workaround for Win32. Search for "//TWin32WidgetSet widgetset bug" in MainBar.pas

Juha Manninen

2015-05-05 21:03

developer   ~0083483

Thanks! I committed it in r48937.
I think only one thing is missing from the height calculation: component palette page scrollbox. When the icons in palette roll into 2 rows, the lower row is hidden. It is still usable because the scrollbox can be scrolled.

Sandro Cumerlato

2015-05-05 21:12

reporter   ~0083484

ide is not maximized correctly on Windows 8.1, looking at the top right corner there is a gap.

Sandro Cumerlato

2015-05-05 21:15

reporter  

ide5.PNG (111,165 bytes)   
ide5.PNG (111,165 bytes)   

Ondrej Pokorny

2015-05-05 21:15

developer   ~0083485

@Juha >> I think only one thing is missing from the height calculation: component palette page scrollbox. When the icons in palette roll into 2 rows, the lower row is hidden. It is still usable because the scrollbox can be scrolled.

I tried to implement this but I don't think it's a good idea. You have to calculate through all buttons but they are not always correctly positioned (they are positioned only for the current page). I was able to force reposition of the buttons in CalcMainIDEHeight, but I was not happy with the result:

Imagine that there is some component palette with lots of components you don't even use, so the IDE window will be very high just because of a palette that even is not visible (e.g. SynEdit). And it's not a good idea to change the height of the IDE window on pallete change either - usually you tidy your desktop so you don't want IDE to change it's height unnecessarily - it would collide with other IDE windows (object inspector, editor etc.).

I think it's much easier and logical to use only one line for automatic height calculation. If you want to see more lines, you can use manual sizing, which is available.

Ondrej Pokorny

2015-05-05 21:26

developer   ~0083486

@Sandro >> ide is not maximized correctly on Windows 8.1, looking at the top right corner there is a gap.

This is strange. I cannot reproduce this behavior under Windows 7. And I don't understand it - I don't set a width-constraint at all... So please somebody with Win 8.1 check it.

Balázs Székely

2015-05-05 22:06

developer   ~0083489

Very nice! The "Automatically adjust IDE main window height" option will make everybody happy.
I'll run a few test tomorrow on OSX(so far no problem on other widgetset).
PS: I don't have win 8.1 to test if there is a gap on maximize.

Ondrej Pokorny

2015-05-05 23:21

developer  

MainIDEBar_Height9.patch (11,927 bytes)   
Index: componentpalette.pas
===================================================================
--- componentpalette.pas	(revision 48939)
+++ componentpalette.pas	(working copy)
@@ -97,6 +97,7 @@
     FPageControl: TPageControl;
     FOnOpenPackage: TNotifyEvent;
     FOnOpenUnit: TNotifyEvent;
+    FOnChangeActivePage: TNotifyEvent;
     fUnregisteredIcon: TCustomBitmap;
     fSelectButtonIcon: TCustomBitmap;
     fUpdatingPageControl: boolean;
@@ -137,6 +138,7 @@
     property PageControl: TPageControl read FPageControl write SetPageControl;
     property OnOpenPackage: TNotifyEvent read FOnOpenPackage write FOnOpenPackage;
     property OnOpenUnit: TNotifyEvent read FOnOpenUnit write FOnOpenUnit;
+    property OnChangeActivePage: TNotifyEvent read FOnChangeActivePage write FOnChangeActivePage;
   end;
 
 function CompareControlsWithTag(Control1, Control2: Pointer): integer;
@@ -243,9 +245,7 @@
     {$ENDIF}
     MaxBtnPerRow:=ButtonTree.Count;
     {$IFnDEF LCLCarbon}
-    // This condition prevents a mysterious repagination on Windows during startup.
-    if MainIDE.IDEStarted then
-      MaxBtnPerRow:=((ScrollBox.VertScrollBar.ClientSizeWithoutBar - ButtonX) div ComponentPaletteBtnWidth);
+    MaxBtnPerRow:=((ScrollBox.VertScrollBar.ClientSizeWithoutBar - ButtonX) div ComponentPaletteBtnWidth);
     {$ENDIF}
     // If we need to wrap, make sure we have space for the scrollbar
     if MaxBtnPerRow < ButtonTree.Count then
@@ -515,6 +515,9 @@
   {$ENDIF}
   ReAlignButtons(FPageControl.ActivePage);
   Selected:=nil;
+
+  if Assigned(FOnChangeActivePage) then
+    FOnChangeActivePage(Sender);
 end;
 
 procedure TComponentPalette.OnScrollBoxResize(Sender: TObject);
Index: environmentopts.pp
===================================================================
--- environmentopts.pp	(revision 48939)
+++ environmentopts.pp	(working copy)
@@ -288,6 +288,7 @@
     FHideIDEOnRun: boolean;
     FComponentPaletteVisible: boolean;
     FAutoAdjustIDEHeight: boolean;
+    FAutoAdjustIDEHeightFullComponentPalette: boolean;
 
     // CompletionWindow
     FCompletionWindowWidth: Integer;
@@ -520,6 +521,7 @@
     property ComponentPaletteVisible: boolean read FComponentPaletteVisible
                                               write FComponentPaletteVisible;
     property AutoAdjustIDEHeight: Boolean read FAutoAdjustIDEHeight write FAutoAdjustIDEHeight;
+    property AutoAdjustIDEHeightFullComponentPalette: Boolean read FAutoAdjustIDEHeightFullComponentPalette write FAutoAdjustIDEHeightFullComponentPalette;
     property CompletionWindowWidth: Integer read FCompletionWindowWidth
                                             write FCompletionWindowWidth;
     property CompletionWindowHeight: Integer read FCompletionWindowHeight
@@ -882,6 +884,7 @@
   FIDEProjectDirectoryInIdeTitle:=false;
   FComponentPaletteVisible:=true;
   FAutoAdjustIDEHeight:=true;
+  FAutoAdjustIDEHeightFullComponentPalette := true;
 
   // window menu
   FIDENameForDesignedFormList:=false;
@@ -1210,6 +1213,8 @@
         Path+'Desktop/ComponentPaletteVisible/Value',true);
       FAutoAdjustIDEHeight:=XMLConfig.GetValue(
         Path+'Desktop/AutoAdjustIDEHeight/Value',true);
+      FAutoAdjustIDEHeightFullComponentPalette:=XMLConfig.GetValue(
+        Path+'Desktop/AutoAdjustIDEHeightFullComponentPalette/Value',true);
       FCompletionWindowWidth:=XMLConfig.GetValue(
         Path+'Desktop/CompletionWindowWidth/Value', 320);
       FCompletionWindowHeight:=XMLConfig.GetValue(
@@ -1601,6 +1606,8 @@
                                FComponentPaletteVisible,true);
       XMLConfig.SetDeleteValue(Path+'Desktop/AutoAdjustIDEHeight/Value',
                                FAutoAdjustIDEHeight,true);
+      XMLConfig.SetDeleteValue(Path+'Desktop/AutoAdjustIDEHeightFullComponentPalette/Value',
+                               FAutoAdjustIDEHeightFullComponentPalette,true);
       XMLConfig.SetDeleteValue(Path+'Desktop/CompletionWindowWidth/Value',
                                FCompletionWindowWidth, 320);
       XMLConfig.SetDeleteValue(Path+'Desktop/CompletionWindowHeight/Value',
Index: frames/window_options.lfm
===================================================================
--- frames/window_options.lfm	(revision 48939)
+++ frames/window_options.lfm	(working copy)
@@ -49,7 +49,7 @@
     Caption = 'WindowPositionsPanel'
     ClientHeight = 423
     ClientWidth = 570
-    TabOrder = 7
+    TabOrder = 8
     object LeftLabel: TLabel
       AnchorSideTop.Control = LeftEdit
       AnchorSideTop.Side = asrCenter
@@ -480,8 +480,23 @@
     Top = 115
     Width = 169
     Caption = 'AutoAdjustIDEHeightCheckBox'
+    OnChange = AutoAdjustIDEHeightCheckBoxChange
     ParentShowHint = False
     ShowHint = True
     TabOrder = 6
   end
+  object AutoAdjustIDEHeightFullComponentPaletteCheckBox: TCheckBox
+    AnchorSideLeft.Control = AutoAdjustIDEHeightCheckBox
+    AnchorSideLeft.Side = asrBottom
+    AnchorSideTop.Control = AutoAdjustIDEHeightCheckBox
+    Left = 189
+    Height = 17
+    Top = 115
+    Width = 274
+    BorderSpacing.Left = 20
+    Caption = 'AutoAdjustIDEHeightFullComponentPaletteCheckBox'
+    ParentShowHint = False
+    ShowHint = True
+    TabOrder = 7
+  end
 end
Index: frames/window_options.pas
===================================================================
--- frames/window_options.pas	(revision 48939)
+++ frames/window_options.pas	(working copy)
@@ -35,6 +35,7 @@
 
   TWindowOptionsFrame = class(TAbstractIDEOptionsEditor)
     ApplyButton: TButton;
+    AutoAdjustIDEHeightFullComponentPaletteCheckBox: TCheckBox;
     lblWindowPosition: TDividerBevel;
     lblShowingWindows: TDividerBevel;
     lblWindowCaption: TDividerBevel;
@@ -66,6 +67,7 @@
     WindowPositionsPanel: TPanel;
     WindowPositionsListBox: TListBox;
     procedure ApplyButtonClick(Sender: TObject);
+    procedure AutoAdjustIDEHeightCheckBoxChange(Sender: TObject);
     procedure CustomGeometryRadioButtonClick(Sender: TObject);
     procedure GetWindowPositionButtonClick(Sender: TObject);
     procedure WindowGeometryRadioButtonClick(Sender: TObject);
@@ -125,6 +127,8 @@
   NameForDesignedFormList.Hint:=lisWindowMenuWithNameForDesignedFormHint;
   AutoAdjustIDEHeightCheckBox.Caption:=lisAutoAdjustIDEHeight;
   AutoAdjustIDEHeightCheckBox.Hint:=lisAutoAdjustIDEHeightHint;
+  AutoAdjustIDEHeightFullComponentPaletteCheckBox.Caption:=lisAutoAdjustIDEHeightFullComponentPalette;
+  AutoAdjustIDEHeightFullComponentPaletteCheckBox.Hint:=lisAutoAdjustIDEHeightFullComponentPaletteHint;
   ProjectDirInIdeTitleCheckBox.Caption:=lisIDETitleShowsProjectDir;
   ProjectDirInIdeTitleCheckBox.Hint:=lisProjectDirectoryIsShowedInIdeTitleBar;
 end;
@@ -143,6 +147,7 @@
     TitleIncludesBuildMode.Checked:=IDETitleIncludesBuildMode;
     NameForDesignedFormList.Checked:=IDENameForDesignedFormList;
     AutoAdjustIDEHeightCheckBox.Checked:=AutoAdjustIDEHeight;
+    AutoAdjustIDEHeightFullComponentPaletteCheckBox.Checked:=AutoAdjustIDEHeightFullComponentPalette;
     ProjectDirInIdeTitleCheckBox.Checked:=IDEProjectDirectoryInIdeTitle;
   end;
 
@@ -224,6 +229,7 @@
     IDETitleIncludesBuildMode := TitleIncludesBuildMode.Checked;
     IDENameForDesignedFormList := NameForDesignedFormList.Checked;
     AutoAdjustIDEHeight := AutoAdjustIDEHeightCheckBox.Checked;
+    AutoAdjustIDEHeightFullComponentPalette := AutoAdjustIDEHeightFullComponentPaletteCheckBox.Checked;
     IDEProjectDirectoryInIdeTitle:=ProjectDirInIdeTitleCheckBox.Checked;
   end;
 end;
@@ -337,6 +343,12 @@
   end;
 end;
 
+procedure TWindowOptionsFrame.AutoAdjustIDEHeightCheckBoxChange(Sender: TObject
+  );
+begin
+  AutoAdjustIDEHeightFullComponentPaletteCheckBox.Enabled := AutoAdjustIDEHeightCheckBox.Checked;
+end;
+
 procedure TWindowOptionsFrame.EnableGeometryEdits(aEnable: Boolean);
 begin
   LeftEdit.Enabled := aEnable;
Index: lazarusidestrconsts.pas
===================================================================
--- lazarusidestrconsts.pas	(revision 48939)
+++ lazarusidestrconsts.pas	(working copy)
@@ -1261,6 +1261,8 @@
   lisIDETitleShowsBuildMode = 'IDE title shows selected build mode';
   lisAutoAdjustIDEHeight = 'Automatically adjust IDE main window height';
   lisAutoAdjustIDEHeightHint = 'Applicable only when not maximized and for undocked IDE.';
+  lisAutoAdjustIDEHeightFullComponentPalette = 'Show complete component palette';
+  lisAutoAdjustIDEHeightFullComponentPaletteHint = 'If component palette spans over more lines, show them all and not only one.';
   lisWindowMenuWithNameForDesignedForm = 'Window menu shows designed form''s name instead of caption';
   lisWindowMenuWithNameForDesignedFormHint = 'Useful especially if the caption is left empty.';
   dlgWinPos = 'Window positions';
Index: main.pp
===================================================================
--- main.pp	(revision 48939)
+++ main.pp	(working copy)
@@ -1517,6 +1517,7 @@
   CompPalette.OnOpenPackage:=@PkgMngr.IDEComponentPaletteOpenPackage;
   CompPalette.OnOpenUnit:=@PkgMngr.IDEComponentPaletteOpenUnit;
   CompPalette.PageControl:=MainIDEBar.ComponentPageControl;
+  CompPalette.OnChangeActivePage:=@MainIDEBar.SetMainIDEHeightEvent;
   // load installed packages
   PkgBoss.LoadInstalledPackages;
 
Index: mainbar.pas
===================================================================
--- mainbar.pas	(revision 48939)
+++ mainbar.pas	(working copy)
@@ -362,6 +362,7 @@
       const FileNames: array of String);
     procedure CoolBarOnChange(Sender: TObject);
     procedure MainSplitterMoved(Sender: TObject);
+    procedure SetMainIDEHeightEvent(Sender: TObject);
   private
     FOldWindowState: TWindowState;
     FOnActive: TNotifyEvent;
@@ -507,6 +508,7 @@
 begin
   inherited DoShow;
   RefreshCoolbar;
+  ComponentPageControl.OnChange(Self);//refresh component palette with button reposition
 end;
 
 function TMainIDEBar.CalcNonClientHeight: Integer;
@@ -527,6 +529,11 @@
     Result := 0;
 end;
 
+procedure TMainIDEBar.SetMainIDEHeightEvent(Sender: TObject);
+begin
+  SetMainIDEHeight;
+end;
+
 procedure TMainIDEBar.WndProc(var Message: TLMessage);
 begin
   inherited WndProc(Message);
@@ -671,21 +678,27 @@
     end;
   end;
 
-  if EnvironmentOptions.ComponentPaletteVisible then
+  if EnvironmentOptions.ComponentPaletteVisible and Assigned(ComponentPageControl.ActivePage) then
   begin
-    for I := 0 to ComponentPageControl.PageCount-1 do
-    if (ComponentPageControl.Page[I].ControlCount > 0) and (ComponentPageControl.Page[I].Controls[0] is TScrollBox) then
+    ComponentScrollBox := nil;
+    for I := 0 to ComponentPageControl.ActivePage.ControlCount-1 do
+    if (ComponentPageControl.ActivePage.Controls[I] is TScrollBox) then
     begin
-      ComponentScrollBox := TScrollBox(ComponentPageControl.Page[I].Controls[0]);
-      if ComponentScrollBox.ControlCount > 0 then
-      begin
-        SBControl := ComponentScrollBox.Controls[0];
-        NewHeight :=
-          SBControl.Top + SBControl.Height +  //button height
-          ComponentPageControl.Height - ComponentScrollBox.ClientHeight;  //page control non-client height (tabs, borders).
-        Result := Max(Result, NewHeight);
+      ComponentScrollBox := TScrollBox(ComponentPageControl.ActivePage.Controls[I]);
+      Break;
+    end;
+
+    if Assigned(ComponentScrollBox) then
+    for I := 0 to ComponentScrollBox.ControlCount-1 do
+    begin
+      SBControl := ComponentScrollBox.Controls[I];
+      NewHeight :=
+        SBControl.Top + SBControl.Height +  //button height
+        ComponentPageControl.Height - ComponentScrollBox.ClientHeight;  //page control non-client height (tabs, borders).
+      Result := Max(Result, NewHeight);
+
+      if not EnvironmentOptions.AutoAdjustIDEHeightFullComponentPalette then
         Break;  //we need only one button (we calculate one line only)
-      end;
     end;
   end;
 end;
MainIDEBar_Height9.patch (11,927 bytes)   

Ondrej Pokorny

2015-05-06 01:20

developer   ~0083492

@Juha >> height calculation: component palette page scrollbox

I changed my mind :) And added another option: "IDE Options" -> "Window" -> "Automatically adjust IDE main window height" -> "Show complete component palette".

When set to true, the height of the IDE window will be resized so that the *active* component page does not have any scrollbars.

Furthermore I added support for docked IDE - when using AnchorDockingDsgn.lpk, the coolbar and component pallete height will be correctly set as well!

See MainIDEBar_Height10.patch

Ondrej Pokorny

2015-05-06 01:20

developer  

MainIDEBar_Height10.patch (18,463 bytes)   
Index: components/anchordocking/design/registeranchordocking.pas
===================================================================
--- components/anchordocking/design/registeranchordocking.pas	(revision 48940)
+++ components/anchordocking/design/registeranchordocking.pas	(working copy)
@@ -94,6 +94,8 @@
     procedure MakeIDEWindowDockable(AControl: TWinControl); override;
     function AddableInWindowMenu(AForm: TCustomForm): boolean; override;
     procedure ShowForm(AForm: TCustomForm; BringToFront: boolean); override;
+    procedure AdjustMainIDEWindowHeight(const AIDEWindow: TCustomForm;
+      const AAdjustHeight: Boolean; const ANewHeight: Integer); override;
     procedure CloseAll; override;
     procedure OnIDERestoreWindows(Sender: TObject);
     function OnProjectClose(Sender: TObject; AProject: TLazProject): TModalResult;
@@ -287,6 +289,33 @@
   Result:=true;
 end;
 
+procedure TIDEAnchorDockMaster.AdjustMainIDEWindowHeight(
+  const AIDEWindow: TCustomForm; const AAdjustHeight: Boolean;
+  const ANewHeight: Integer);
+var
+  Site: TAnchorDockHostSite;
+  I: Integer;
+  SiteNewHeight: Integer;
+begin
+  inherited AdjustMainIDEWindowHeight(AIDEWindow, AAdjustHeight, ANewHeight);
+
+  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 not Assigned(Site) then
+    Exit;
+
+  Site.BoundSplitter.Enabled := not AAdjustHeight;
+  SiteNewHeight := Site.Parent.ClientHeight - ANewHeight - Site.BoundSplitter.Height;
+  if AAdjustHeight and (Site.Height <> SiteNewHeight) then
+    Site.Height := SiteNewHeight;
+end;
+
 function TIDEAnchorDockMaster.GetUserLayoutFilename(Full: boolean): string;
 begin
   if CmdLineLayoutFile<>'' then begin
Index: components/ideintf/idewindowintf.pas
===================================================================
--- components/ideintf/idewindowintf.pas	(revision 48940)
+++ components/ideintf/idewindowintf.pas	(working copy)
@@ -452,6 +452,8 @@
     procedure MakeIDEWindowDockSite(AForm: TCustomForm; ASides: TDockSides = [alBottom]); virtual; abstract; // make AForm a dock site, AForm can not be docked, its Parent must be kept nil, this does not make it visible
     procedure ShowForm(AForm: TCustomForm; BringToFront: boolean); virtual; abstract; // make a form visible, set BringToFront=true if form should be shown on active screen and on front of other windows, normally this focus the form
     function AddableInWindowMenu({%H-}AForm: TCustomForm): boolean; virtual;
+    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
     property HideSimpleLayoutOptions: boolean read FHideSimpleLayoutOptions;
   end;
@@ -2120,6 +2122,13 @@
   Result:=true;
 end;
 
+procedure TIDEDockMaster.AdjustMainIDEWindowHeight(
+  const AIDEWindow: TCustomForm; const AAdjustHeight: Boolean;
+  const ANewHeight: Integer);
+begin
+
+end;
+
 procedure TIDEDockMaster.CloseAll;
 begin
   CloseAllForms;
Index: ide/componentpalette.pas
===================================================================
--- ide/componentpalette.pas	(revision 48940)
+++ ide/componentpalette.pas	(working copy)
@@ -97,6 +97,7 @@
     FPageControl: TPageControl;
     FOnOpenPackage: TNotifyEvent;
     FOnOpenUnit: TNotifyEvent;
+    FOnChangeActivePage: TNotifyEvent;
     fUnregisteredIcon: TCustomBitmap;
     fSelectButtonIcon: TCustomBitmap;
     fUpdatingPageControl: boolean;
@@ -137,6 +138,7 @@
     property PageControl: TPageControl read FPageControl write SetPageControl;
     property OnOpenPackage: TNotifyEvent read FOnOpenPackage write FOnOpenPackage;
     property OnOpenUnit: TNotifyEvent read FOnOpenUnit write FOnOpenUnit;
+    property OnChangeActivePage: TNotifyEvent read FOnChangeActivePage write FOnChangeActivePage;
   end;
 
 function CompareControlsWithTag(Control1, Control2: Pointer): integer;
@@ -243,9 +245,7 @@
     {$ENDIF}
     MaxBtnPerRow:=ButtonTree.Count;
     {$IFnDEF LCLCarbon}
-    // This condition prevents a mysterious repagination on Windows during startup.
-    if MainIDE.IDEStarted then
-      MaxBtnPerRow:=((ScrollBox.VertScrollBar.ClientSizeWithoutBar - ButtonX) div ComponentPaletteBtnWidth);
+    MaxBtnPerRow:=((ScrollBox.VertScrollBar.ClientSizeWithoutBar - ButtonX) div ComponentPaletteBtnWidth);
     {$ENDIF}
     // If we need to wrap, make sure we have space for the scrollbar
     if MaxBtnPerRow < ButtonTree.Count then
@@ -515,6 +515,9 @@
   {$ENDIF}
   ReAlignButtons(FPageControl.ActivePage);
   Selected:=nil;
+
+  if Assigned(FOnChangeActivePage) then
+    FOnChangeActivePage(Sender);
 end;
 
 procedure TComponentPalette.OnScrollBoxResize(Sender: TObject);
Index: ide/environmentopts.pp
===================================================================
--- ide/environmentopts.pp	(revision 48940)
+++ ide/environmentopts.pp	(working copy)
@@ -288,6 +288,7 @@
     FHideIDEOnRun: boolean;
     FComponentPaletteVisible: boolean;
     FAutoAdjustIDEHeight: boolean;
+    FAutoAdjustIDEHeightFullComponentPalette: boolean;
 
     // CompletionWindow
     FCompletionWindowWidth: Integer;
@@ -520,6 +521,7 @@
     property ComponentPaletteVisible: boolean read FComponentPaletteVisible
                                               write FComponentPaletteVisible;
     property AutoAdjustIDEHeight: Boolean read FAutoAdjustIDEHeight write FAutoAdjustIDEHeight;
+    property AutoAdjustIDEHeightFullComponentPalette: Boolean read FAutoAdjustIDEHeightFullComponentPalette write FAutoAdjustIDEHeightFullComponentPalette;
     property CompletionWindowWidth: Integer read FCompletionWindowWidth
                                             write FCompletionWindowWidth;
     property CompletionWindowHeight: Integer read FCompletionWindowHeight
@@ -882,6 +884,7 @@
   FIDEProjectDirectoryInIdeTitle:=false;
   FComponentPaletteVisible:=true;
   FAutoAdjustIDEHeight:=true;
+  FAutoAdjustIDEHeightFullComponentPalette := true;
 
   // window menu
   FIDENameForDesignedFormList:=false;
@@ -1210,6 +1213,8 @@
         Path+'Desktop/ComponentPaletteVisible/Value',true);
       FAutoAdjustIDEHeight:=XMLConfig.GetValue(
         Path+'Desktop/AutoAdjustIDEHeight/Value',true);
+      FAutoAdjustIDEHeightFullComponentPalette:=XMLConfig.GetValue(
+        Path+'Desktop/AutoAdjustIDEHeightFullComponentPalette/Value',true);
       FCompletionWindowWidth:=XMLConfig.GetValue(
         Path+'Desktop/CompletionWindowWidth/Value', 320);
       FCompletionWindowHeight:=XMLConfig.GetValue(
@@ -1601,6 +1606,8 @@
                                FComponentPaletteVisible,true);
       XMLConfig.SetDeleteValue(Path+'Desktop/AutoAdjustIDEHeight/Value',
                                FAutoAdjustIDEHeight,true);
+      XMLConfig.SetDeleteValue(Path+'Desktop/AutoAdjustIDEHeightFullComponentPalette/Value',
+                               FAutoAdjustIDEHeightFullComponentPalette,true);
       XMLConfig.SetDeleteValue(Path+'Desktop/CompletionWindowWidth/Value',
                                FCompletionWindowWidth, 320);
       XMLConfig.SetDeleteValue(Path+'Desktop/CompletionWindowHeight/Value',
Index: ide/frames/window_options.lfm
===================================================================
--- ide/frames/window_options.lfm	(revision 48940)
+++ ide/frames/window_options.lfm	(working copy)
@@ -1,9 +1,9 @@
 object WindowOptionsFrame: TWindowOptionsFrame
   Left = 0
-  Height = 582
+  Height = 585
   Top = 0
   Width = 573
-  ClientHeight = 582
+  ClientHeight = 585
   ClientWidth = 573
   TabOrder = 0
   DesignLeft = 349
@@ -41,15 +41,15 @@
     AnchorSideTop.Side = asrBottom
     AnchorSideBottom.Side = asrBottom
     Left = 0
-    Height = 423
+    Height = 426
     Top = 154
     Width = 570
     Anchors = [akTop, akLeft, akRight, akBottom]
     BorderSpacing.Top = 3
     Caption = 'WindowPositionsPanel'
-    ClientHeight = 423
+    ClientHeight = 426
     ClientWidth = 570
-    TabOrder = 7
+    TabOrder = 8
     object LeftLabel: TLabel
       AnchorSideTop.Control = LeftEdit
       AnchorSideTop.Side = asrCenter
@@ -457,7 +457,7 @@
   end
   object lblWindowPosition: TDividerBevel
     AnchorSideLeft.Control = Owner
-    AnchorSideTop.Control = AutoAdjustIDEHeightCheckBox
+    AnchorSideTop.Control = AutoAdjustIDEHeightFullComponentPaletteCheckBox
     AnchorSideTop.Side = asrBottom
     AnchorSideRight.Control = Owner
     AnchorSideRight.Side = asrBottom
@@ -484,4 +484,18 @@
     ShowHint = True
     TabOrder = 6
   end
+  object AutoAdjustIDEHeightFullComponentPaletteCheckBox: TCheckBox
+    AnchorSideLeft.Control = AutoAdjustIDEHeightCheckBox
+    AnchorSideLeft.Side = asrBottom
+    AnchorSideTop.Control = AutoAdjustIDEHeightCheckBox
+    Left = 189
+    Height = 17
+    Top = 115
+    Width = 274
+    BorderSpacing.Left = 20
+    Caption = 'AutoAdjustIDEHeightFullComponentPaletteCheckBox'
+    ParentShowHint = False
+    ShowHint = True
+    TabOrder = 7
+  end
 end
Index: ide/frames/window_options.pas
===================================================================
--- ide/frames/window_options.pas	(revision 48940)
+++ ide/frames/window_options.pas	(working copy)
@@ -35,6 +35,7 @@
 
   TWindowOptionsFrame = class(TAbstractIDEOptionsEditor)
     ApplyButton: TButton;
+    AutoAdjustIDEHeightFullComponentPaletteCheckBox: TCheckBox;
     lblWindowPosition: TDividerBevel;
     lblShowingWindows: TDividerBevel;
     lblWindowCaption: TDividerBevel;
@@ -125,6 +126,8 @@
   NameForDesignedFormList.Hint:=lisWindowMenuWithNameForDesignedFormHint;
   AutoAdjustIDEHeightCheckBox.Caption:=lisAutoAdjustIDEHeight;
   AutoAdjustIDEHeightCheckBox.Hint:=lisAutoAdjustIDEHeightHint;
+  AutoAdjustIDEHeightFullComponentPaletteCheckBox.Caption:=lisAutoAdjustIDEHeightFullComponentPalette;
+  AutoAdjustIDEHeightFullComponentPaletteCheckBox.Hint:=lisAutoAdjustIDEHeightFullComponentPaletteHint;
   ProjectDirInIdeTitleCheckBox.Caption:=lisIDETitleShowsProjectDir;
   ProjectDirInIdeTitleCheckBox.Hint:=lisProjectDirectoryIsShowedInIdeTitleBar;
 end;
@@ -143,6 +146,7 @@
     TitleIncludesBuildMode.Checked:=IDETitleIncludesBuildMode;
     NameForDesignedFormList.Checked:=IDENameForDesignedFormList;
     AutoAdjustIDEHeightCheckBox.Checked:=AutoAdjustIDEHeight;
+    AutoAdjustIDEHeightFullComponentPaletteCheckBox.Checked:=AutoAdjustIDEHeightFullComponentPalette;
     ProjectDirInIdeTitleCheckBox.Checked:=IDEProjectDirectoryInIdeTitle;
   end;
 
@@ -224,6 +228,7 @@
     IDETitleIncludesBuildMode := TitleIncludesBuildMode.Checked;
     IDENameForDesignedFormList := NameForDesignedFormList.Checked;
     AutoAdjustIDEHeight := AutoAdjustIDEHeightCheckBox.Checked;
+    AutoAdjustIDEHeightFullComponentPalette := AutoAdjustIDEHeightFullComponentPaletteCheckBox.Checked;
     IDEProjectDirectoryInIdeTitle:=ProjectDirInIdeTitleCheckBox.Checked;
   end;
 end;
Index: ide/lazarusidestrconsts.pas
===================================================================
--- ide/lazarusidestrconsts.pas	(revision 48940)
+++ ide/lazarusidestrconsts.pas	(working copy)
@@ -1260,7 +1260,9 @@
   lisIDETitleShowsProjectDir = 'IDE title shows project directory';
   lisIDETitleShowsBuildMode = 'IDE title shows selected build mode';
   lisAutoAdjustIDEHeight = 'Automatically adjust IDE main window height';
-  lisAutoAdjustIDEHeightHint = 'Applicable only when not maximized and for undocked IDE.';
+  lisAutoAdjustIDEHeightHint = '';
+  lisAutoAdjustIDEHeightFullComponentPalette = 'Show complete component palette';
+  lisAutoAdjustIDEHeightFullComponentPaletteHint = 'If component palette spans over more lines, show them all and not only one.';
   lisWindowMenuWithNameForDesignedForm = 'Window menu shows designed form''s name instead of caption';
   lisWindowMenuWithNameForDesignedFormHint = 'Useful especially if the caption is left empty.';
   dlgWinPos = 'Window positions';
Index: ide/main.pp
===================================================================
--- ide/main.pp	(revision 48940)
+++ ide/main.pp	(working copy)
@@ -1517,6 +1517,7 @@
   CompPalette.OnOpenPackage:=@PkgMngr.IDEComponentPaletteOpenPackage;
   CompPalette.OnOpenUnit:=@PkgMngr.IDEComponentPaletteOpenUnit;
   CompPalette.PageControl:=MainIDEBar.ComponentPageControl;
+  CompPalette.OnChangeActivePage:=@MainIDEBar.SetMainIDEHeightEvent;
   // load installed packages
   PkgBoss.LoadInstalledPackages;
 
@@ -2002,13 +2003,11 @@
   MainIDEBar.MainSplitter.Parent := MainIDEBar;
   MainIDEBar.MainSplitter.Align := alLeft;
   MainIDEBar.MainSplitter.MinSize := 50;
-  MainIDEBar.MainSplitter.Tag := 112;
   MainIDEBar.MainSplitter.OnMoved := @MainIDEBar.MainSplitterMoved;
 
 
   MainIDEBar.CoolBar := TCoolBar.Create(OwningComponent);
   MainIDEBar.CoolBar.Parent := MainIDEBar;
-  MainIDEBar.CoolBar.Tag := 112;
   if EnvironmentOptions.ComponentPaletteVisible then
   begin
     MainIDEBar.CoolBar.Align := alLeft;
@@ -2017,7 +2016,6 @@
   else
     MainIDEBar.CoolBar.Align := alClient;
 
-  MainIDEBar.mnuMainMenu.Tag := 112;
   // IDE Coolbar object wraps MainIDEBar.CoolBar.
   IDECoolBar := TIDECoolBar.Create(MainIDEBar.CoolBar);
   IDECoolBar.IsVisible := EnvironmentOptions.IDECoolBarOptions.IDECoolBarVisible;;
@@ -2050,7 +2048,6 @@
     Align := alClient;
     Visible:=EnvironmentOptions.ComponentPaletteVisible;
     Parent := MainIDEBar;
-    Tag := 112;
   end;
 end;
 
Index: ide/mainbar.pas
===================================================================
--- ide/mainbar.pas	(revision 48940)
+++ ide/mainbar.pas	(working copy)
@@ -362,12 +362,12 @@
       const FileNames: array of String);
     procedure CoolBarOnChange(Sender: TObject);
     procedure MainSplitterMoved(Sender: TObject);
+    procedure SetMainIDEHeightEvent(Sender: TObject);
   private
     FOldWindowState: TWindowState;
     FOnActive: TNotifyEvent;
     procedure NewUnitFormDefaultClick(Sender: TObject);
     procedure NewUnitFormPopupMenuPopup(Sender: TObject);
-    function IsDefaultIDE: Boolean;
     function CalcMainIDEHeight: Integer;
     function CalcNonClientHeight: Integer;
   protected
@@ -394,7 +394,7 @@
 implementation
 
 uses
-  LCLIntf, LCLType, InterfaceBase, Math;
+  LCLIntf, LCLType, InterfaceBase, Math, IDEWindowIntf;
 
 { TMainIDEBar }
 
@@ -483,23 +483,32 @@
 var
   NewHeight: Integer;
 begin
-  if not (Showing and IsDefaultIDE) then
+  if not Showing then
     Exit;
 
-  if (AIDEIsMaximized or EnvironmentOptions.AutoAdjustIDEHeight) then
+  if Assigned(IDEDockMaster) then
   begin
-    NewHeight := CalcMainIDEHeight + CalcNonClientHeight;
-    if NewHeight <> Constraints.MaxHeight then
+    if EnvironmentOptions.AutoAdjustIDEHeight then
+      IDEDockMaster.AdjustMainIDEWindowHeight(Self, True, CalcMainIDEHeight)
+    else
+      IDEDockMaster.AdjustMainIDEWindowHeight(Self, False, 0);
+  end else
+  begin
+    if (AIDEIsMaximized or EnvironmentOptions.AutoAdjustIDEHeight) then
     begin
-      Constraints.MaxHeight := NewHeight;
-      Constraints.MinHeight := Constraints.MaxHeight;
-      ClientHeight := Constraints.MaxHeight;
+      NewHeight := CalcMainIDEHeight + CalcNonClientHeight;
+      if NewHeight <> Constraints.MaxHeight then
+      begin
+        Constraints.MaxHeight := NewHeight;
+        Constraints.MinHeight := Constraints.MaxHeight;
+        ClientHeight := Constraints.MaxHeight;
+      end;
+    end else
+    if Constraints.MaxHeight <> 0 then
+    begin
+      Constraints.MaxHeight := 0;
+      Constraints.MinHeight := 0;
     end;
-  end else
-  if Constraints.MaxHeight <> 0 then
-  begin
-    Constraints.MaxHeight := 0;
-    Constraints.MinHeight := 0;
   end;
 end;
 
@@ -507,6 +516,7 @@
 begin
   inherited DoShow;
   RefreshCoolbar;
+  ComponentPageControl.OnChange(Self);//refresh component palette with button reposition
 end;
 
 function TMainIDEBar.CalcNonClientHeight: Integer;
@@ -527,6 +537,11 @@
     Result := 0;
 end;
 
+procedure TMainIDEBar.SetMainIDEHeightEvent(Sender: TObject);
+begin
+  SetMainIDEHeight;
+end;
+
 procedure TMainIDEBar.WndProc(var Message: TLMessage);
 begin
   inherited WndProc(Message);
@@ -671,21 +686,27 @@
     end;
   end;
 
-  if EnvironmentOptions.ComponentPaletteVisible then
+  if EnvironmentOptions.ComponentPaletteVisible and Assigned(ComponentPageControl.ActivePage) then
   begin
-    for I := 0 to ComponentPageControl.PageCount-1 do
-    if (ComponentPageControl.Page[I].ControlCount > 0) and (ComponentPageControl.Page[I].Controls[0] is TScrollBox) then
+    ComponentScrollBox := nil;
+    for I := 0 to ComponentPageControl.ActivePage.ControlCount-1 do
+    if (ComponentPageControl.ActivePage.Controls[I] is TScrollBox) then
     begin
-      ComponentScrollBox := TScrollBox(ComponentPageControl.Page[I].Controls[0]);
-      if ComponentScrollBox.ControlCount > 0 then
-      begin
-        SBControl := ComponentScrollBox.Controls[0];
-        NewHeight :=
-          SBControl.Top + SBControl.Height +  //button height
-          ComponentPageControl.Height - ComponentScrollBox.ClientHeight;  //page control non-client height (tabs, borders).
-        Result := Max(Result, NewHeight);
+      ComponentScrollBox := TScrollBox(ComponentPageControl.ActivePage.Controls[I]);
+      Break;
+    end;
+
+    if Assigned(ComponentScrollBox) then
+    for I := 0 to ComponentScrollBox.ControlCount-1 do
+    begin
+      SBControl := ComponentScrollBox.Controls[I];
+      NewHeight :=
+        SBControl.Top + SBControl.Height +  //button height
+        ComponentPageControl.Height - ComponentScrollBox.ClientHeight;  //page control non-client height (tabs, borders).
+      Result := Max(Result, NewHeight);
+
+      if not EnvironmentOptions.AutoAdjustIDEHeightFullComponentPalette then
         Break;  //we need only one button (we calculate one line only)
-      end;
     end;
   end;
 end;
@@ -717,21 +738,5 @@
   DoSetMainIDEHeight(WindowState = wsMaximized);
 end;
 
-function TMainIDEBar.IsDefaultIDE: Boolean;
-var
-  I: Integer;
-begin
-  Result := True;
-  for I := 0 to MainIDEBar.ControlCount - 1 do
-  begin
-    if (MainIDEBar.Controls[I] as TControl).Tag <> 112 then
-    begin
-      Result := False;
-      Break;
-    end;
-  end;
-end;
-
-
 end.
 
MainIDEBar_Height10.patch (18,463 bytes)   

Balázs Székely

2015-05-06 07:49

developer   ~0083494

Last edited: 2015-05-06 07:53

View 2 revisions

On OSX(Carbon) the height is not calculated correctly(see: OSX.png). It's just a minor inconvenience and can be fixed later. Other then this, I found no issue with patch 10.
Juha please commit patch 10! Thanks.

Balázs Székely

2015-05-06 07:49

developer  

OSX.png (243,859 bytes)   
OSX.png (243,859 bytes)   

Ondrej Pokorny

2015-05-06 08:19

developer   ~0083495

@Balazs: Thanks for the testing.

To the OSX bug:

I assume that this is connected with the constrained size bug I was talking about before. Lazarus behaves differently on different widgetsets - I think this bug should be reported in a separate thread.

The point is, when you set Constraints.MaxHeight/MinHeight, the real constraint is different on different widgetsets - some take the menu height into account etc., some not.

For this reason, I had to modify CalcNonClientHeight when used with Win32. See TMainIDEBar.CalcNonClientHeight //TWin32WidgetSet widgetset bug.

I assume you have to write a bug workaround for Carbon as well. I think that returning 0 or (LCLIntf.GetSystemMetrics(SM_CYSIZEFRAME) + LCLIntf.GetSystemMetrics(SM_CYEDGE)*2) should do the job under Carbon.

In an ideal word, the CalcNonClientHeight shouldn't be needed at all (return 0) and Lazarus should take care of it automatically.

Balázs Székely

2015-05-06 09:26

developer   ~0083496

This will do the job under carbon:
[code]
  ...
  if Pos('Carbon', WidgetSet.ClassName) > 0 then
    Result := 0
  ...
[/code]

Ondrej Pokorny

2015-05-06 11:02

developer  

MainIDEBar_Height11.patch (20,578 bytes)   
Index: components/anchordocking/design/registeranchordocking.pas
===================================================================
--- components/anchordocking/design/registeranchordocking.pas	(revision 48940)
+++ components/anchordocking/design/registeranchordocking.pas	(working copy)
@@ -94,6 +94,8 @@
     procedure MakeIDEWindowDockable(AControl: TWinControl); override;
     function AddableInWindowMenu(AForm: TCustomForm): boolean; override;
     procedure ShowForm(AForm: TCustomForm; BringToFront: boolean); override;
+    procedure AdjustMainIDEWindowHeight(const AIDEWindow: TCustomForm;
+      const AAdjustHeight: Boolean; const ANewHeight: Integer); override;
     procedure CloseAll; override;
     procedure OnIDERestoreWindows(Sender: TObject);
     function OnProjectClose(Sender: TObject; AProject: TLazProject): TModalResult;
@@ -287,6 +289,33 @@
   Result:=true;
 end;
 
+procedure TIDEAnchorDockMaster.AdjustMainIDEWindowHeight(
+  const AIDEWindow: TCustomForm; const AAdjustHeight: Boolean;
+  const ANewHeight: Integer);
+var
+  Site: TAnchorDockHostSite;
+  I: Integer;
+  SiteNewHeight: Integer;
+begin
+  inherited AdjustMainIDEWindowHeight(AIDEWindow, AAdjustHeight, ANewHeight);
+
+  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 not Assigned(Site) then
+    Exit;
+
+  Site.BoundSplitter.Enabled := not AAdjustHeight;
+  SiteNewHeight := Site.Parent.ClientHeight - ANewHeight - Site.BoundSplitter.Height;
+  if AAdjustHeight and (Site.Height <> SiteNewHeight) then
+    Site.Height := SiteNewHeight;
+end;
+
 function TIDEAnchorDockMaster.GetUserLayoutFilename(Full: boolean): string;
 begin
   if CmdLineLayoutFile<>'' then begin
Index: components/ideintf/idewindowintf.pas
===================================================================
--- components/ideintf/idewindowintf.pas	(revision 48940)
+++ components/ideintf/idewindowintf.pas	(working copy)
@@ -452,6 +452,8 @@
     procedure MakeIDEWindowDockSite(AForm: TCustomForm; ASides: TDockSides = [alBottom]); virtual; abstract; // make AForm a dock site, AForm can not be docked, its Parent must be kept nil, this does not make it visible
     procedure ShowForm(AForm: TCustomForm; BringToFront: boolean); virtual; abstract; // make a form visible, set BringToFront=true if form should be shown on active screen and on front of other windows, normally this focus the form
     function AddableInWindowMenu({%H-}AForm: TCustomForm): boolean; virtual;
+    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
     property HideSimpleLayoutOptions: boolean read FHideSimpleLayoutOptions;
   end;
@@ -2120,6 +2122,13 @@
   Result:=true;
 end;
 
+procedure TIDEDockMaster.AdjustMainIDEWindowHeight(
+  const AIDEWindow: TCustomForm; const AAdjustHeight: Boolean;
+  const ANewHeight: Integer);
+begin
+
+end;
+
 procedure TIDEDockMaster.CloseAll;
 begin
   CloseAllForms;
Index: ide/componentpalette.pas
===================================================================
--- ide/componentpalette.pas	(revision 48940)
+++ ide/componentpalette.pas	(working copy)
@@ -97,6 +97,7 @@
     FPageControl: TPageControl;
     FOnOpenPackage: TNotifyEvent;
     FOnOpenUnit: TNotifyEvent;
+    FOnChangeActivePage: TNotifyEvent;
     fUnregisteredIcon: TCustomBitmap;
     fSelectButtonIcon: TCustomBitmap;
     fUpdatingPageControl: boolean;
@@ -137,6 +138,7 @@
     property PageControl: TPageControl read FPageControl write SetPageControl;
     property OnOpenPackage: TNotifyEvent read FOnOpenPackage write FOnOpenPackage;
     property OnOpenUnit: TNotifyEvent read FOnOpenUnit write FOnOpenUnit;
+    property OnChangeActivePage: TNotifyEvent read FOnChangeActivePage write FOnChangeActivePage;
   end;
 
 function CompareControlsWithTag(Control1, Control2: Pointer): integer;
@@ -241,12 +243,9 @@
         ' IsScrollBarVisible=',ScrollBox.HorzScrollBar.IsScrollBarVisible
         ]);
     {$ENDIF}
-    MaxBtnPerRow:=ButtonTree.Count;
-    {$IFnDEF LCLCarbon}
-    // This condition prevents a mysterious repagination on Windows during startup.
-    if MainIDE.IDEStarted then
-      MaxBtnPerRow:=((ScrollBox.VertScrollBar.ClientSizeWithoutBar - ButtonX) div ComponentPaletteBtnWidth);
-    {$ENDIF}
+
+    MaxBtnPerRow:=((ScrollBox.VertScrollBar.ClientSizeWithoutBar - ButtonX) div ComponentPaletteBtnWidth);
+
     // If we need to wrap, make sure we have space for the scrollbar
     if MaxBtnPerRow < ButtonTree.Count then
       MaxBtnPerRow:=((ScrollBox.VertScrollBar.ClientSizeWithBar - ButtonX) div ComponentPaletteBtnWidth);
@@ -515,6 +514,9 @@
   {$ENDIF}
   ReAlignButtons(FPageControl.ActivePage);
   Selected:=nil;
+
+  if Assigned(FOnChangeActivePage) then
+    FOnChangeActivePage(Sender);
 end;
 
 procedure TComponentPalette.OnScrollBoxResize(Sender: TObject);
Index: ide/environmentopts.pp
===================================================================
--- ide/environmentopts.pp	(revision 48940)
+++ ide/environmentopts.pp	(working copy)
@@ -288,6 +288,7 @@
     FHideIDEOnRun: boolean;
     FComponentPaletteVisible: boolean;
     FAutoAdjustIDEHeight: boolean;
+    FAutoAdjustIDEHeightFullComponentPalette: boolean;
 
     // CompletionWindow
     FCompletionWindowWidth: Integer;
@@ -520,6 +521,7 @@
     property ComponentPaletteVisible: boolean read FComponentPaletteVisible
                                               write FComponentPaletteVisible;
     property AutoAdjustIDEHeight: Boolean read FAutoAdjustIDEHeight write FAutoAdjustIDEHeight;
+    property AutoAdjustIDEHeightFullComponentPalette: Boolean read FAutoAdjustIDEHeightFullComponentPalette write FAutoAdjustIDEHeightFullComponentPalette;
     property CompletionWindowWidth: Integer read FCompletionWindowWidth
                                             write FCompletionWindowWidth;
     property CompletionWindowHeight: Integer read FCompletionWindowHeight
@@ -882,6 +884,7 @@
   FIDEProjectDirectoryInIdeTitle:=false;
   FComponentPaletteVisible:=true;
   FAutoAdjustIDEHeight:=true;
+  FAutoAdjustIDEHeightFullComponentPalette := true;
 
   // window menu
   FIDENameForDesignedFormList:=false;
@@ -1210,6 +1213,8 @@
         Path+'Desktop/ComponentPaletteVisible/Value',true);
       FAutoAdjustIDEHeight:=XMLConfig.GetValue(
         Path+'Desktop/AutoAdjustIDEHeight/Value',true);
+      FAutoAdjustIDEHeightFullComponentPalette:=XMLConfig.GetValue(
+        Path+'Desktop/AutoAdjustIDEHeightFullComponentPalette/Value',true);
       FCompletionWindowWidth:=XMLConfig.GetValue(
         Path+'Desktop/CompletionWindowWidth/Value', 320);
       FCompletionWindowHeight:=XMLConfig.GetValue(
@@ -1601,6 +1606,8 @@
                                FComponentPaletteVisible,true);
       XMLConfig.SetDeleteValue(Path+'Desktop/AutoAdjustIDEHeight/Value',
                                FAutoAdjustIDEHeight,true);
+      XMLConfig.SetDeleteValue(Path+'Desktop/AutoAdjustIDEHeightFullComponentPalette/Value',
+                               FAutoAdjustIDEHeightFullComponentPalette,true);
       XMLConfig.SetDeleteValue(Path+'Desktop/CompletionWindowWidth/Value',
                                FCompletionWindowWidth, 320);
       XMLConfig.SetDeleteValue(Path+'Desktop/CompletionWindowHeight/Value',
Index: ide/frames/window_options.lfm
===================================================================
--- ide/frames/window_options.lfm	(revision 48940)
+++ ide/frames/window_options.lfm	(working copy)
@@ -1,9 +1,9 @@
 object WindowOptionsFrame: TWindowOptionsFrame
   Left = 0
-  Height = 582
+  Height = 585
   Top = 0
   Width = 573
-  ClientHeight = 582
+  ClientHeight = 585
   ClientWidth = 573
   TabOrder = 0
   DesignLeft = 349
@@ -41,15 +41,15 @@
     AnchorSideTop.Side = asrBottom
     AnchorSideBottom.Side = asrBottom
     Left = 0
-    Height = 423
+    Height = 426
     Top = 154
     Width = 570
     Anchors = [akTop, akLeft, akRight, akBottom]
     BorderSpacing.Top = 3
     Caption = 'WindowPositionsPanel'
-    ClientHeight = 423
+    ClientHeight = 426
     ClientWidth = 570
-    TabOrder = 7
+    TabOrder = 8
     object LeftLabel: TLabel
       AnchorSideTop.Control = LeftEdit
       AnchorSideTop.Side = asrCenter
@@ -457,7 +457,7 @@
   end
   object lblWindowPosition: TDividerBevel
     AnchorSideLeft.Control = Owner
-    AnchorSideTop.Control = AutoAdjustIDEHeightCheckBox
+    AnchorSideTop.Control = AutoAdjustIDEHeightFullComponentPaletteCheckBox
     AnchorSideTop.Side = asrBottom
     AnchorSideRight.Control = Owner
     AnchorSideRight.Side = asrBottom
@@ -484,4 +484,18 @@
     ShowHint = True
     TabOrder = 6
   end
+  object AutoAdjustIDEHeightFullComponentPaletteCheckBox: TCheckBox
+    AnchorSideLeft.Control = AutoAdjustIDEHeightCheckBox
+    AnchorSideLeft.Side = asrBottom
+    AnchorSideTop.Control = AutoAdjustIDEHeightCheckBox
+    Left = 189
+    Height = 17
+    Top = 115
+    Width = 274
+    BorderSpacing.Left = 20
+    Caption = 'AutoAdjustIDEHeightFullComponentPaletteCheckBox'
+    ParentShowHint = False
+    ShowHint = True
+    TabOrder = 7
+  end
 end
Index: ide/frames/window_options.pas
===================================================================
--- ide/frames/window_options.pas	(revision 48940)
+++ ide/frames/window_options.pas	(working copy)
@@ -35,6 +35,7 @@
 
   TWindowOptionsFrame = class(TAbstractIDEOptionsEditor)
     ApplyButton: TButton;
+    AutoAdjustIDEHeightFullComponentPaletteCheckBox: TCheckBox;
     lblWindowPosition: TDividerBevel;
     lblShowingWindows: TDividerBevel;
     lblWindowCaption: TDividerBevel;
@@ -125,6 +126,8 @@
   NameForDesignedFormList.Hint:=lisWindowMenuWithNameForDesignedFormHint;
   AutoAdjustIDEHeightCheckBox.Caption:=lisAutoAdjustIDEHeight;
   AutoAdjustIDEHeightCheckBox.Hint:=lisAutoAdjustIDEHeightHint;
+  AutoAdjustIDEHeightFullComponentPaletteCheckBox.Caption:=lisAutoAdjustIDEHeightFullComponentPalette;
+  AutoAdjustIDEHeightFullComponentPaletteCheckBox.Hint:=lisAutoAdjustIDEHeightFullComponentPaletteHint;
   ProjectDirInIdeTitleCheckBox.Caption:=lisIDETitleShowsProjectDir;
   ProjectDirInIdeTitleCheckBox.Hint:=lisProjectDirectoryIsShowedInIdeTitleBar;
 end;
@@ -143,6 +146,7 @@
     TitleIncludesBuildMode.Checked:=IDETitleIncludesBuildMode;
     NameForDesignedFormList.Checked:=IDENameForDesignedFormList;
     AutoAdjustIDEHeightCheckBox.Checked:=AutoAdjustIDEHeight;
+    AutoAdjustIDEHeightFullComponentPaletteCheckBox.Checked:=AutoAdjustIDEHeightFullComponentPalette;
     ProjectDirInIdeTitleCheckBox.Checked:=IDEProjectDirectoryInIdeTitle;
   end;
 
@@ -224,6 +228,7 @@
     IDETitleIncludesBuildMode := TitleIncludesBuildMode.Checked;
     IDENameForDesignedFormList := NameForDesignedFormList.Checked;
     AutoAdjustIDEHeight := AutoAdjustIDEHeightCheckBox.Checked;
+    AutoAdjustIDEHeightFullComponentPalette := AutoAdjustIDEHeightFullComponentPaletteCheckBox.Checked;
     IDEProjectDirectoryInIdeTitle:=ProjectDirInIdeTitleCheckBox.Checked;
   end;
 end;
Index: ide/lazarusidestrconsts.pas
===================================================================
--- ide/lazarusidestrconsts.pas	(revision 48940)
+++ ide/lazarusidestrconsts.pas	(working copy)
@@ -1260,7 +1260,9 @@
   lisIDETitleShowsProjectDir = 'IDE title shows project directory';
   lisIDETitleShowsBuildMode = 'IDE title shows selected build mode';
   lisAutoAdjustIDEHeight = 'Automatically adjust IDE main window height';
-  lisAutoAdjustIDEHeightHint = 'Applicable only when not maximized and for undocked IDE.';
+  lisAutoAdjustIDEHeightHint = '';
+  lisAutoAdjustIDEHeightFullComponentPalette = 'Show complete component palette';
+  lisAutoAdjustIDEHeightFullComponentPaletteHint = 'If component palette spans over more lines, show them all and not only one.';
   lisWindowMenuWithNameForDesignedForm = 'Window menu shows designed form''s name instead of caption';
   lisWindowMenuWithNameForDesignedFormHint = 'Useful especially if the caption is left empty.';
   dlgWinPos = 'Window positions';
Index: ide/main.pp
===================================================================
--- ide/main.pp	(revision 48940)
+++ ide/main.pp	(working copy)
@@ -1517,6 +1517,7 @@
   CompPalette.OnOpenPackage:=@PkgMngr.IDEComponentPaletteOpenPackage;
   CompPalette.OnOpenUnit:=@PkgMngr.IDEComponentPaletteOpenUnit;
   CompPalette.PageControl:=MainIDEBar.ComponentPageControl;
+  CompPalette.OnChangeActivePage:=@MainIDEBar.SetMainIDEHeightEvent;
   // load installed packages
   PkgBoss.LoadInstalledPackages;
 
@@ -2002,13 +2003,11 @@
   MainIDEBar.MainSplitter.Parent := MainIDEBar;
   MainIDEBar.MainSplitter.Align := alLeft;
   MainIDEBar.MainSplitter.MinSize := 50;
-  MainIDEBar.MainSplitter.Tag := 112;
   MainIDEBar.MainSplitter.OnMoved := @MainIDEBar.MainSplitterMoved;
 
 
   MainIDEBar.CoolBar := TCoolBar.Create(OwningComponent);
   MainIDEBar.CoolBar.Parent := MainIDEBar;
-  MainIDEBar.CoolBar.Tag := 112;
   if EnvironmentOptions.ComponentPaletteVisible then
   begin
     MainIDEBar.CoolBar.Align := alLeft;
@@ -2017,7 +2016,6 @@
   else
     MainIDEBar.CoolBar.Align := alClient;
 
-  MainIDEBar.mnuMainMenu.Tag := 112;
   // IDE Coolbar object wraps MainIDEBar.CoolBar.
   IDECoolBar := TIDECoolBar.Create(MainIDEBar.CoolBar);
   IDECoolBar.IsVisible := EnvironmentOptions.IDECoolBarOptions.IDECoolBarVisible;;
@@ -2050,7 +2048,6 @@
     Align := alClient;
     Visible:=EnvironmentOptions.ComponentPaletteVisible;
     Parent := MainIDEBar;
-    Tag := 112;
   end;
 end;
 
Index: ide/mainbar.pas
===================================================================
--- ide/mainbar.pas	(revision 48940)
+++ ide/mainbar.pas	(working copy)
@@ -362,12 +362,12 @@
       const FileNames: array of String);
     procedure CoolBarOnChange(Sender: TObject);
     procedure MainSplitterMoved(Sender: TObject);
+    procedure SetMainIDEHeightEvent(Sender: TObject);
   private
     FOldWindowState: TWindowState;
     FOnActive: TNotifyEvent;
     procedure NewUnitFormDefaultClick(Sender: TObject);
     procedure NewUnitFormPopupMenuPopup(Sender: TObject);
-    function IsDefaultIDE: Boolean;
     function CalcMainIDEHeight: Integer;
     function CalcNonClientHeight: Integer;
   protected
@@ -394,7 +394,7 @@
 implementation
 
 uses
-  LCLIntf, LCLType, InterfaceBase, Math;
+  LCLIntf, LCLType, Math, IDEWindowIntf;
 
 { TMainIDEBar }
 
@@ -483,23 +483,32 @@
 var
   NewHeight: Integer;
 begin
-  if not (Showing and IsDefaultIDE) then
+  if not Showing then
     Exit;
 
-  if (AIDEIsMaximized or EnvironmentOptions.AutoAdjustIDEHeight) then
+  if Assigned(IDEDockMaster) then
   begin
-    NewHeight := CalcMainIDEHeight + CalcNonClientHeight;
-    if NewHeight <> Constraints.MaxHeight then
+    if EnvironmentOptions.AutoAdjustIDEHeight then
+      IDEDockMaster.AdjustMainIDEWindowHeight(Self, True, CalcMainIDEHeight)
+    else
+      IDEDockMaster.AdjustMainIDEWindowHeight(Self, False, 0);
+  end else
+  begin
+    if (AIDEIsMaximized or EnvironmentOptions.AutoAdjustIDEHeight) then
     begin
-      Constraints.MaxHeight := NewHeight;
-      Constraints.MinHeight := Constraints.MaxHeight;
-      ClientHeight := Constraints.MaxHeight;
+      NewHeight := CalcMainIDEHeight + CalcNonClientHeight;
+      if NewHeight <> Constraints.MaxHeight then
+      begin
+        Constraints.MaxHeight := NewHeight;
+        Constraints.MinHeight := Constraints.MaxHeight;
+        ClientHeight := Constraints.MaxHeight;
+      end;
+    end else
+    if Constraints.MaxHeight <> 0 then
+    begin
+      Constraints.MaxHeight := 0;
+      Constraints.MinHeight := 0;
     end;
-  end else
-  if Constraints.MaxHeight <> 0 then
-  begin
-    Constraints.MaxHeight := 0;
-    Constraints.MinHeight := 0;
   end;
 end;
 
@@ -507,26 +516,57 @@
 begin
   inherited DoShow;
   RefreshCoolbar;
+  ComponentPageControl.OnChange(Self);//refresh component palette with button reposition
 end;
 
 function TMainIDEBar.CalcNonClientHeight: Integer;
+{$IF DEFINED(LCLWin32) OR DEFINED(LCLGtk2)}
 var
   WindowRect, WindowClientRect: TRect;
+{$ENDIF}
 begin
-  if Showing then
-  begin
-    LclIntf.GetWindowRect(Handle, WindowRect{%H-});
-    LclIntf.GetClientRect(Handle, WindowClientRect{%H-});
-    LclIntf.ClientToScreen(Handle, WindowClientRect.TopLeft);
+  {
+    This function is a bug-workaround for various LCL widgetsets.
+    Every widgetset handles constrained height differently.
+    In an ideal word (when the bugs are fixed), this function shouldn't be
+    needed at all - it should return always 0.
 
-    Result := WindowClientRect.Top - WindowRect.Top;
+    Currently tested: Win32, Gtk2, Carbon.
 
-    if Pos('Win32', WidgetSet.ClassName) > 0 then//TWin32WidgetSet widgetset bug -> the constrained height has to be without SM_CYSIZEFRAME and SM_CYMENU (Gtk2 works fine)
-      Result := Result - (LCLIntf.GetSystemMetrics(SM_CYSIZEFRAME) + LCLIntf.GetSystemMetrics(SM_CYMENU));
-  end else
-    Result := 0;
+    List of bugs related to this workaround:
+      http://bugs.freepascal.org/view.php?id=28033
+      http://bugs.freepascal.org/view.php?id=28034
+      http://bugs.freepascal.org/view.php?id=28036
+
+  }
+
+  if not Showing then
+    Exit(0);
+
+  {$IF DEFINED(LCLWin32) OR DEFINED(LCLGtk2)}
+  //Gtk2 + Win32
+  LclIntf.GetWindowRect(Handle, WindowRect{%H-});
+  LclIntf.GetClientRect(Handle, WindowClientRect{%H-});
+  LclIntf.ClientToScreen(Handle, WindowClientRect.TopLeft);
+
+  Result := WindowClientRect.Top - WindowRect.Top;
+
+  {$IFDEF LCLWin32}
+  //TWin32WidgetSet widgetset bug -> the constrained height has to be without SM_CYSIZEFRAME and SM_CYMENU (Gtk2 works fine)
+  Result := Result - (LCLIntf.GetSystemMetrics(SM_CYSIZEFRAME) + LCLIntf.GetSystemMetrics(SM_CYMENU));
+  {$ENDIF LCLWin32}
+  {$ELSE}
+  //other widgetsets
+  //Carbon tested - it behaves correctly, please test Qt and if a bug workaround is needed, use "{$ELSEIF LCLQt}"
+  Result := 0;
+  {$ENDIF}
 end;
 
+procedure TMainIDEBar.SetMainIDEHeightEvent(Sender: TObject);
+begin
+  SetMainIDEHeight;
+end;
+
 procedure TMainIDEBar.WndProc(var Message: TLMessage);
 begin
   inherited WndProc(Message);
@@ -671,21 +711,27 @@
     end;
   end;
 
-  if EnvironmentOptions.ComponentPaletteVisible then
+  if EnvironmentOptions.ComponentPaletteVisible and Assigned(ComponentPageControl.ActivePage) then
   begin
-    for I := 0 to ComponentPageControl.PageCount-1 do
-    if (ComponentPageControl.Page[I].ControlCount > 0) and (ComponentPageControl.Page[I].Controls[0] is TScrollBox) then
+    ComponentScrollBox := nil;
+    for I := 0 to ComponentPageControl.ActivePage.ControlCount-1 do
+    if (ComponentPageControl.ActivePage.Controls[I] is TScrollBox) then
     begin
-      ComponentScrollBox := TScrollBox(ComponentPageControl.Page[I].Controls[0]);
-      if ComponentScrollBox.ControlCount > 0 then
-      begin
-        SBControl := ComponentScrollBox.Controls[0];
-        NewHeight :=
-          SBControl.Top + SBControl.Height +  //button height
-          ComponentPageControl.Height - ComponentScrollBox.ClientHeight;  //page control non-client height (tabs, borders).
-        Result := Max(Result, NewHeight);
+      ComponentScrollBox := TScrollBox(ComponentPageControl.ActivePage.Controls[I]);
+      Break;
+    end;
+
+    if Assigned(ComponentScrollBox) then
+    for I := 0 to ComponentScrollBox.ControlCount-1 do
+    begin
+      SBControl := ComponentScrollBox.Controls[I];
+      NewHeight :=
+        SBControl.Top + SBControl.Height +  //button height
+        ComponentPageControl.Height - ComponentScrollBox.ClientHeight;  //page control non-client height (tabs, borders).
+      Result := Max(Result, NewHeight);
+
+      if not EnvironmentOptions.AutoAdjustIDEHeightFullComponentPalette then
         Break;  //we need only one button (we calculate one line only)
-      end;
     end;
   end;
 end;
@@ -717,21 +763,5 @@
   DoSetMainIDEHeight(WindowState = wsMaximized);
 end;
 
-function TMainIDEBar.IsDefaultIDE: Boolean;
-var
-  I: Integer;
-begin
-  Result := True;
-  for I := 0 to MainIDEBar.ControlCount - 1 do
-  begin
-    if (MainIDEBar.Controls[I] as TControl).Tag <> 112 then
-    begin
-      Result := False;
-      Break;
-    end;
-  end;
-end;
-
-
 end.
 
MainIDEBar_Height11.patch (20,578 bytes)   

Ondrej Pokorny

2015-05-06 11:07

developer   ~0083498

@Balazs: Thanks!

MainIDEBar_Height11.patch: works under Win32, Gtk2, Carbon. I was not able to recompile the IDE under Qt (some strange error...), so I could not test it. Please somebody with Qt check it and if needed, modify TMainIDEBar.CalcNonClientHeight (there are comments there how to do it).

I also fixed a bug under Carbon - the component palette was always in one line, now it supports multi-line like on other widgetsets.

+ The docked IDE works very nicely with auto-height!

Balázs Székely

2015-05-06 11:38

developer   ~0083499

@Ondrej
Under QT the height is calculated correctly. Instead there is a strange bug:
If you hide both the Coolbar and ComponentPalette, then show the ComponentPalette again, the MainIDEBar(window) disappears(I had to restart lazarus)

This bug, in fact is present on every other widgetset with a slight twist. The MainIDEBar won't disappear, but the height of the reappeared window is wrong. After a horizontal resize or a coolbar band move, the height will adjust itself and will have the correct value. This is just a small inconvenience, I wouldn't even call it a bug. The QT issue instead is more serious. Let's see if anyone else can reproduce it.

Ondrej Pokorny

2015-05-06 12:08

developer  

MainIDEBar_Height12.patch (21,991 bytes)   
Index: components/anchordocking/design/registeranchordocking.pas
===================================================================
--- components/anchordocking/design/registeranchordocking.pas	(revision 48940)
+++ components/anchordocking/design/registeranchordocking.pas	(working copy)
@@ -94,6 +94,8 @@
     procedure MakeIDEWindowDockable(AControl: TWinControl); override;
     function AddableInWindowMenu(AForm: TCustomForm): boolean; override;
     procedure ShowForm(AForm: TCustomForm; BringToFront: boolean); override;
+    procedure AdjustMainIDEWindowHeight(const AIDEWindow: TCustomForm;
+      const AAdjustHeight: Boolean; const ANewHeight: Integer); override;
     procedure CloseAll; override;
     procedure OnIDERestoreWindows(Sender: TObject);
     function OnProjectClose(Sender: TObject; AProject: TLazProject): TModalResult;
@@ -287,6 +289,33 @@
   Result:=true;
 end;
 
+procedure TIDEAnchorDockMaster.AdjustMainIDEWindowHeight(
+  const AIDEWindow: TCustomForm; const AAdjustHeight: Boolean;
+  const ANewHeight: Integer);
+var
+  Site: TAnchorDockHostSite;
+  I: Integer;
+  SiteNewHeight: Integer;
+begin
+  inherited AdjustMainIDEWindowHeight(AIDEWindow, AAdjustHeight, ANewHeight);
+
+  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 not Assigned(Site) then
+    Exit;
+
+  Site.BoundSplitter.Enabled := not AAdjustHeight;
+  SiteNewHeight := Site.Parent.ClientHeight - ANewHeight - Site.BoundSplitter.Height;
+  if AAdjustHeight and (Site.Height <> SiteNewHeight) then
+    Site.Height := SiteNewHeight;
+end;
+
 function TIDEAnchorDockMaster.GetUserLayoutFilename(Full: boolean): string;
 begin
   if CmdLineLayoutFile<>'' then begin
Index: components/ideintf/idewindowintf.pas
===================================================================
--- components/ideintf/idewindowintf.pas	(revision 48940)
+++ components/ideintf/idewindowintf.pas	(working copy)
@@ -452,6 +452,8 @@
     procedure MakeIDEWindowDockSite(AForm: TCustomForm; ASides: TDockSides = [alBottom]); virtual; abstract; // make AForm a dock site, AForm can not be docked, its Parent must be kept nil, this does not make it visible
     procedure ShowForm(AForm: TCustomForm; BringToFront: boolean); virtual; abstract; // make a form visible, set BringToFront=true if form should be shown on active screen and on front of other windows, normally this focus the form
     function AddableInWindowMenu({%H-}AForm: TCustomForm): boolean; virtual;
+    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
     property HideSimpleLayoutOptions: boolean read FHideSimpleLayoutOptions;
   end;
@@ -2120,6 +2122,13 @@
   Result:=true;
 end;
 
+procedure TIDEDockMaster.AdjustMainIDEWindowHeight(
+  const AIDEWindow: TCustomForm; const AAdjustHeight: Boolean;
+  const ANewHeight: Integer);
+begin
+
+end;
+
 procedure TIDEDockMaster.CloseAll;
 begin
   CloseAllForms;
Index: ide/componentpalette.pas
===================================================================
--- ide/componentpalette.pas	(revision 48940)
+++ ide/componentpalette.pas	(working copy)
@@ -97,6 +97,7 @@
     FPageControl: TPageControl;
     FOnOpenPackage: TNotifyEvent;
     FOnOpenUnit: TNotifyEvent;
+    FOnChangeActivePage: TNotifyEvent;
     fUnregisteredIcon: TCustomBitmap;
     fSelectButtonIcon: TCustomBitmap;
     fUpdatingPageControl: boolean;
@@ -137,6 +138,7 @@
     property PageControl: TPageControl read FPageControl write SetPageControl;
     property OnOpenPackage: TNotifyEvent read FOnOpenPackage write FOnOpenPackage;
     property OnOpenUnit: TNotifyEvent read FOnOpenUnit write FOnOpenUnit;
+    property OnChangeActivePage: TNotifyEvent read FOnChangeActivePage write FOnChangeActivePage;
   end;
 
 function CompareControlsWithTag(Control1, Control2: Pointer): integer;
@@ -241,12 +243,9 @@
         ' IsScrollBarVisible=',ScrollBox.HorzScrollBar.IsScrollBarVisible
         ]);
     {$ENDIF}
-    MaxBtnPerRow:=ButtonTree.Count;
-    {$IFnDEF LCLCarbon}
-    // This condition prevents a mysterious repagination on Windows during startup.
-    if MainIDE.IDEStarted then
-      MaxBtnPerRow:=((ScrollBox.VertScrollBar.ClientSizeWithoutBar - ButtonX) div ComponentPaletteBtnWidth);
-    {$ENDIF}
+
+    MaxBtnPerRow:=((ScrollBox.VertScrollBar.ClientSizeWithoutBar - ButtonX) div ComponentPaletteBtnWidth);
+
     // If we need to wrap, make sure we have space for the scrollbar
     if MaxBtnPerRow < ButtonTree.Count then
       MaxBtnPerRow:=((ScrollBox.VertScrollBar.ClientSizeWithBar - ButtonX) div ComponentPaletteBtnWidth);
@@ -515,6 +514,9 @@
   {$ENDIF}
   ReAlignButtons(FPageControl.ActivePage);
   Selected:=nil;
+
+  if Assigned(FOnChangeActivePage) then
+    FOnChangeActivePage(Sender);
 end;
 
 procedure TComponentPalette.OnScrollBoxResize(Sender: TObject);
Index: ide/environmentopts.pp
===================================================================
--- ide/environmentopts.pp	(revision 48940)
+++ ide/environmentopts.pp	(working copy)
@@ -288,6 +288,7 @@
     FHideIDEOnRun: boolean;
     FComponentPaletteVisible: boolean;
     FAutoAdjustIDEHeight: boolean;
+    FAutoAdjustIDEHeightFullComponentPalette: boolean;
 
     // CompletionWindow
     FCompletionWindowWidth: Integer;
@@ -520,6 +521,7 @@
     property ComponentPaletteVisible: boolean read FComponentPaletteVisible
                                               write FComponentPaletteVisible;
     property AutoAdjustIDEHeight: Boolean read FAutoAdjustIDEHeight write FAutoAdjustIDEHeight;
+    property AutoAdjustIDEHeightFullComponentPalette: Boolean read FAutoAdjustIDEHeightFullComponentPalette write FAutoAdjustIDEHeightFullComponentPalette;
     property CompletionWindowWidth: Integer read FCompletionWindowWidth
                                             write FCompletionWindowWidth;
     property CompletionWindowHeight: Integer read FCompletionWindowHeight
@@ -882,6 +884,7 @@
   FIDEProjectDirectoryInIdeTitle:=false;
   FComponentPaletteVisible:=true;
   FAutoAdjustIDEHeight:=true;
+  FAutoAdjustIDEHeightFullComponentPalette := true;
 
   // window menu
   FIDENameForDesignedFormList:=false;
@@ -1210,6 +1213,8 @@
         Path+'Desktop/ComponentPaletteVisible/Value',true);
       FAutoAdjustIDEHeight:=XMLConfig.GetValue(
         Path+'Desktop/AutoAdjustIDEHeight/Value',true);
+      FAutoAdjustIDEHeightFullComponentPalette:=XMLConfig.GetValue(
+        Path+'Desktop/AutoAdjustIDEHeightFullComponentPalette/Value',true);
       FCompletionWindowWidth:=XMLConfig.GetValue(
         Path+'Desktop/CompletionWindowWidth/Value', 320);
       FCompletionWindowHeight:=XMLConfig.GetValue(
@@ -1601,6 +1606,8 @@
                                FComponentPaletteVisible,true);
       XMLConfig.SetDeleteValue(Path+'Desktop/AutoAdjustIDEHeight/Value',
                                FAutoAdjustIDEHeight,true);
+      XMLConfig.SetDeleteValue(Path+'Desktop/AutoAdjustIDEHeightFullComponentPalette/Value',
+                               FAutoAdjustIDEHeightFullComponentPalette,true);
       XMLConfig.SetDeleteValue(Path+'Desktop/CompletionWindowWidth/Value',
                                FCompletionWindowWidth, 320);
       XMLConfig.SetDeleteValue(Path+'Desktop/CompletionWindowHeight/Value',
Index: ide/frames/window_options.lfm
===================================================================
--- ide/frames/window_options.lfm	(revision 48940)
+++ ide/frames/window_options.lfm	(working copy)
@@ -1,9 +1,9 @@
 object WindowOptionsFrame: TWindowOptionsFrame
   Left = 0
-  Height = 582
+  Height = 585
   Top = 0
   Width = 573
-  ClientHeight = 582
+  ClientHeight = 585
   ClientWidth = 573
   TabOrder = 0
   DesignLeft = 349
@@ -41,15 +41,15 @@
     AnchorSideTop.Side = asrBottom
     AnchorSideBottom.Side = asrBottom
     Left = 0
-    Height = 423
+    Height = 426
     Top = 154
     Width = 570
     Anchors = [akTop, akLeft, akRight, akBottom]
     BorderSpacing.Top = 3
     Caption = 'WindowPositionsPanel'
-    ClientHeight = 423
+    ClientHeight = 426
     ClientWidth = 570
-    TabOrder = 7
+    TabOrder = 8
     object LeftLabel: TLabel
       AnchorSideTop.Control = LeftEdit
       AnchorSideTop.Side = asrCenter
@@ -457,7 +457,7 @@
   end
   object lblWindowPosition: TDividerBevel
     AnchorSideLeft.Control = Owner
-    AnchorSideTop.Control = AutoAdjustIDEHeightCheckBox
+    AnchorSideTop.Control = AutoAdjustIDEHeightFullComponentPaletteCheckBox
     AnchorSideTop.Side = asrBottom
     AnchorSideRight.Control = Owner
     AnchorSideRight.Side = asrBottom
@@ -484,4 +484,18 @@
     ShowHint = True
     TabOrder = 6
   end
+  object AutoAdjustIDEHeightFullComponentPaletteCheckBox: TCheckBox
+    AnchorSideLeft.Control = AutoAdjustIDEHeightCheckBox
+    AnchorSideLeft.Side = asrBottom
+    AnchorSideTop.Control = AutoAdjustIDEHeightCheckBox
+    Left = 189
+    Height = 17
+    Top = 115
+    Width = 274
+    BorderSpacing.Left = 20
+    Caption = 'AutoAdjustIDEHeightFullComponentPaletteCheckBox'
+    ParentShowHint = False
+    ShowHint = True
+    TabOrder = 7
+  end
 end
Index: ide/frames/window_options.pas
===================================================================
--- ide/frames/window_options.pas	(revision 48940)
+++ ide/frames/window_options.pas	(working copy)
@@ -35,6 +35,7 @@
 
   TWindowOptionsFrame = class(TAbstractIDEOptionsEditor)
     ApplyButton: TButton;
+    AutoAdjustIDEHeightFullComponentPaletteCheckBox: TCheckBox;
     lblWindowPosition: TDividerBevel;
     lblShowingWindows: TDividerBevel;
     lblWindowCaption: TDividerBevel;
@@ -125,6 +126,8 @@
   NameForDesignedFormList.Hint:=lisWindowMenuWithNameForDesignedFormHint;
   AutoAdjustIDEHeightCheckBox.Caption:=lisAutoAdjustIDEHeight;
   AutoAdjustIDEHeightCheckBox.Hint:=lisAutoAdjustIDEHeightHint;
+  AutoAdjustIDEHeightFullComponentPaletteCheckBox.Caption:=lisAutoAdjustIDEHeightFullComponentPalette;
+  AutoAdjustIDEHeightFullComponentPaletteCheckBox.Hint:=lisAutoAdjustIDEHeightFullComponentPaletteHint;
   ProjectDirInIdeTitleCheckBox.Caption:=lisIDETitleShowsProjectDir;
   ProjectDirInIdeTitleCheckBox.Hint:=lisProjectDirectoryIsShowedInIdeTitleBar;
 end;
@@ -143,6 +146,7 @@
     TitleIncludesBuildMode.Checked:=IDETitleIncludesBuildMode;
     NameForDesignedFormList.Checked:=IDENameForDesignedFormList;
     AutoAdjustIDEHeightCheckBox.Checked:=AutoAdjustIDEHeight;
+    AutoAdjustIDEHeightFullComponentPaletteCheckBox.Checked:=AutoAdjustIDEHeightFullComponentPalette;
     ProjectDirInIdeTitleCheckBox.Checked:=IDEProjectDirectoryInIdeTitle;
   end;
 
@@ -224,6 +228,7 @@
     IDETitleIncludesBuildMode := TitleIncludesBuildMode.Checked;
     IDENameForDesignedFormList := NameForDesignedFormList.Checked;
     AutoAdjustIDEHeight := AutoAdjustIDEHeightCheckBox.Checked;
+    AutoAdjustIDEHeightFullComponentPalette := AutoAdjustIDEHeightFullComponentPaletteCheckBox.Checked;
     IDEProjectDirectoryInIdeTitle:=ProjectDirInIdeTitleCheckBox.Checked;
   end;
 end;
Index: ide/lazarusidestrconsts.pas
===================================================================
--- ide/lazarusidestrconsts.pas	(revision 48940)
+++ ide/lazarusidestrconsts.pas	(working copy)
@@ -1260,7 +1260,9 @@
   lisIDETitleShowsProjectDir = 'IDE title shows project directory';
   lisIDETitleShowsBuildMode = 'IDE title shows selected build mode';
   lisAutoAdjustIDEHeight = 'Automatically adjust IDE main window height';
-  lisAutoAdjustIDEHeightHint = 'Applicable only when not maximized and for undocked IDE.';
+  lisAutoAdjustIDEHeightHint = '';
+  lisAutoAdjustIDEHeightFullComponentPalette = 'Show complete component palette';
+  lisAutoAdjustIDEHeightFullComponentPaletteHint = 'If component palette spans over more lines, show them all and not only one.';
   lisWindowMenuWithNameForDesignedForm = 'Window menu shows designed form''s name instead of caption';
   lisWindowMenuWithNameForDesignedFormHint = 'Useful especially if the caption is left empty.';
   dlgWinPos = 'Window positions';
Index: ide/main.pp
===================================================================
--- ide/main.pp	(revision 48940)
+++ ide/main.pp	(working copy)
@@ -1517,6 +1517,7 @@
   CompPalette.OnOpenPackage:=@PkgMngr.IDEComponentPaletteOpenPackage;
   CompPalette.OnOpenUnit:=@PkgMngr.IDEComponentPaletteOpenUnit;
   CompPalette.PageControl:=MainIDEBar.ComponentPageControl;
+  CompPalette.OnChangeActivePage:=@MainIDEBar.SetMainIDEHeightEvent;
   // load installed packages
   PkgBoss.LoadInstalledPackages;
 
@@ -2002,13 +2003,11 @@
   MainIDEBar.MainSplitter.Parent := MainIDEBar;
   MainIDEBar.MainSplitter.Align := alLeft;
   MainIDEBar.MainSplitter.MinSize := 50;
-  MainIDEBar.MainSplitter.Tag := 112;
   MainIDEBar.MainSplitter.OnMoved := @MainIDEBar.MainSplitterMoved;
 
 
   MainIDEBar.CoolBar := TCoolBar.Create(OwningComponent);
   MainIDEBar.CoolBar.Parent := MainIDEBar;
-  MainIDEBar.CoolBar.Tag := 112;
   if EnvironmentOptions.ComponentPaletteVisible then
   begin
     MainIDEBar.CoolBar.Align := alLeft;
@@ -2017,7 +2016,6 @@
   else
     MainIDEBar.CoolBar.Align := alClient;
 
-  MainIDEBar.mnuMainMenu.Tag := 112;
   // IDE Coolbar object wraps MainIDEBar.CoolBar.
   IDECoolBar := TIDECoolBar.Create(MainIDEBar.CoolBar);
   IDECoolBar.IsVisible := EnvironmentOptions.IDECoolBarOptions.IDECoolBarVisible;;
@@ -2050,7 +2048,6 @@
     Align := alClient;
     Visible:=EnvironmentOptions.ComponentPaletteVisible;
     Parent := MainIDEBar;
-    Tag := 112;
   end;
 end;
 
@@ -3709,6 +3706,9 @@
     MainIDEBar.CoolBar.Align := alClient;
   MainIDEBar.MainSplitter.Visible := MainIDEBar.Coolbar.Visible and
                                      MainIDEBar.ComponentPageControl.Visible;
+
+  if ComponentPaletteVisible then//when showing component palette, it must be visible to calculate it correctly
+    MainIDEBar.DoSetMainIDEHeight(MainIDEBar.WindowState = wsMaximized, 100);//it will cause the IDE to flicker, but it's better than to have wrongly calculated IDE height
   MainIDEBar.SetMainIDEHeight;
 end;
 
Index: ide/mainbar.pas
===================================================================
--- ide/mainbar.pas	(revision 48940)
+++ ide/mainbar.pas	(working copy)
@@ -362,12 +362,12 @@
       const FileNames: array of String);
     procedure CoolBarOnChange(Sender: TObject);
     procedure MainSplitterMoved(Sender: TObject);
+    procedure SetMainIDEHeightEvent(Sender: TObject);
   private
     FOldWindowState: TWindowState;
     FOnActive: TNotifyEvent;
     procedure NewUnitFormDefaultClick(Sender: TObject);
     procedure NewUnitFormPopupMenuPopup(Sender: TObject);
-    function IsDefaultIDE: Boolean;
     function CalcMainIDEHeight: Integer;
     function CalcNonClientHeight: Integer;
   protected
@@ -375,7 +375,6 @@
     procedure DoShow; override;
     procedure WndProc(var Message: TLMessage); override;
 
-    procedure DoSetMainIDEHeight(const AIDEIsMaximized: Boolean);
     procedure Resizing(State: TWindowState); override;
   public
     constructor Create(TheOwner: TComponent); override;
@@ -386,6 +385,7 @@
     procedure UpdateDockCaption({%H-}Exclude: TControl); override;
     procedure RefreshCoolbar;
     procedure SetMainIDEHeight;
+    procedure DoSetMainIDEHeight(const AIDEIsMaximized: Boolean; ANewHeight: Integer = 0);
   end;
 
 var
@@ -394,7 +394,7 @@
 implementation
 
 uses
-  LCLIntf, LCLType, InterfaceBase, Math;
+  LCLIntf, LCLType, Math, IDEWindowIntf;
 
 { TMainIDEBar }
 
@@ -479,27 +479,38 @@
     FOnActive(Self);
 end;
 
-procedure TMainIDEBar.DoSetMainIDEHeight(const AIDEIsMaximized: Boolean);
-var
-  NewHeight: Integer;
+procedure TMainIDEBar.DoSetMainIDEHeight(const AIDEIsMaximized: Boolean;
+  ANewHeight: Integer);
 begin
-  if not (Showing and IsDefaultIDE) then
+  if not Showing then
     Exit;
 
-  if (AIDEIsMaximized or EnvironmentOptions.AutoAdjustIDEHeight) then
+  if ANewHeight <= 0 then
+    ANewHeight := CalcMainIDEHeight;
+
+  if Assigned(IDEDockMaster) then
   begin
-    NewHeight := CalcMainIDEHeight + CalcNonClientHeight;
-    if NewHeight <> Constraints.MaxHeight then
+    if EnvironmentOptions.AutoAdjustIDEHeight then
+      IDEDockMaster.AdjustMainIDEWindowHeight(Self, True, ANewHeight)
+    else
+      IDEDockMaster.AdjustMainIDEWindowHeight(Self, False, 0);
+  end else
+  begin
+    if (AIDEIsMaximized or EnvironmentOptions.AutoAdjustIDEHeight) then
     begin
-      Constraints.MaxHeight := NewHeight;
-      Constraints.MinHeight := Constraints.MaxHeight;
-      ClientHeight := Constraints.MaxHeight;
+      ANewHeight := ANewHeight + CalcNonClientHeight;
+      if ANewHeight <> Constraints.MaxHeight then
+      begin
+        Constraints.MaxHeight := ANewHeight;
+        Constraints.MinHeight := Constraints.MaxHeight;
+        ClientHeight := Constraints.MaxHeight;
+      end;
+    end else
+    if Constraints.MaxHeight <> 0 then
+    begin
+      Constraints.MaxHeight := 0;
+      Constraints.MinHeight := 0;
     end;
-  end else
-  if Constraints.MaxHeight <> 0 then
-  begin
-    Constraints.MaxHeight := 0;
-    Constraints.MinHeight := 0;
   end;
 end;
 
@@ -507,26 +518,60 @@
 begin
   inherited DoShow;
   RefreshCoolbar;
+  ComponentPageControl.OnChange(Self);//refresh component palette with button reposition
 end;
 
 function TMainIDEBar.CalcNonClientHeight: Integer;
+{$IF DEFINED(LCLWin32) OR DEFINED(LCLGtk2)}
 var
   WindowRect, WindowClientRect: TRect;
+{$ENDIF}
 begin
-  if Showing then
-  begin
-    LclIntf.GetWindowRect(Handle, WindowRect{%H-});
-    LclIntf.GetClientRect(Handle, WindowClientRect{%H-});
-    LclIntf.ClientToScreen(Handle, WindowClientRect.TopLeft);
+  {
+    This function is a bug-workaround for various LCL widgetsets.
+    Every widgetset handles constrained height differently.
+    In an ideal word (when the bugs are fixed), this function shouldn't be
+    needed at all - it should return always 0.
 
-    Result := WindowClientRect.Top - WindowRect.Top;
+    Currently tested: Win32, Gtk2, Carbon.
 
-    if Pos('Win32', WidgetSet.ClassName) > 0 then//TWin32WidgetSet widgetset bug -> the constrained height has to be without SM_CYSIZEFRAME and SM_CYMENU (Gtk2 works fine)
-      Result := Result - (LCLIntf.GetSystemMetrics(SM_CYSIZEFRAME) + LCLIntf.GetSystemMetrics(SM_CYMENU));
-  end else
-    Result := 0;
+    List of bugs related to this workaround:
+      http://bugs.freepascal.org/view.php?id=28033
+      http://bugs.freepascal.org/view.php?id=28034
+      http://bugs.freepascal.org/view.php?id=28036
+
+  }
+
+  if not Showing then
+    Exit(0);
+
+  {$IF DEFINED(LCLWin32) OR DEFINED(LCLGtk2)}
+  //Gtk2 + Win32
+  //retrieve real main menu height because
+  // - Win32: multi-line is possible (SM_CYMENU reflects only single line)
+  // - Gtk2:  SM_CYMENU does not work
+  LclIntf.GetWindowRect(Handle, WindowRect{%H-});
+  LclIntf.GetClientRect(Handle, WindowClientRect{%H-});
+  LclIntf.ClientToScreen(Handle, WindowClientRect.TopLeft);
+
+  Result := WindowClientRect.Top - WindowRect.Top;
+
+  {$IFDEF LCLWin32}
+  //Win32 the constrained height has to be without SM_CYSIZEFRAME and SM_CYMENU
+  Result := Result - (LCLIntf.GetSystemMetrics(SM_CYSIZEFRAME) + LCLIntf.GetSystemMetrics(SM_CYMENU));
+  {$ENDIF LCLWin32}
+  {$ELSE}
+  //other widgetsets
+  //Carbon & Qt tested - they behave correctly
+  Result := 0;
+  {$ENDIF}
 end;
 
+procedure TMainIDEBar.SetMainIDEHeightEvent(Sender: TObject);
+begin
+  SetMainIDEHeight;
+end;
+
 procedure TMainIDEBar.WndProc(var Message: TLMessage);
 begin
   inherited WndProc(Message);
@@ -671,21 +716,27 @@
     end;
   end;
 
-  if EnvironmentOptions.ComponentPaletteVisible then
+  if EnvironmentOptions.ComponentPaletteVisible and Assigned(ComponentPageControl.ActivePage) then
   begin
-    for I := 0 to ComponentPageControl.PageCount-1 do
-    if (ComponentPageControl.Page[I].ControlCount > 0) and (ComponentPageControl.Page[I].Controls[0] is TScrollBox) then
+    ComponentScrollBox := nil;
+    for I := 0 to ComponentPageControl.ActivePage.ControlCount-1 do
+    if (ComponentPageControl.ActivePage.Controls[I] is TScrollBox) then
     begin
-      ComponentScrollBox := TScrollBox(ComponentPageControl.Page[I].Controls[0]);
-      if ComponentScrollBox.ControlCount > 0 then
-      begin
-        SBControl := ComponentScrollBox.Controls[0];
-        NewHeight :=
-          SBControl.Top + SBControl.Height +  //button height
-          ComponentPageControl.Height - ComponentScrollBox.ClientHeight;  //page control non-client height (tabs, borders).
-        Result := Max(Result, NewHeight);
+      ComponentScrollBox := TScrollBox(ComponentPageControl.ActivePage.Controls[I]);
+      Break;
+    end;
+
+    if Assigned(ComponentScrollBox) then
+    for I := 0 to ComponentScrollBox.ControlCount-1 do
+    begin
+      SBControl := ComponentScrollBox.Controls[I];
+      NewHeight :=
+        SBControl.Top + SBControl.Height +  //button height
+        ComponentPageControl.Height - ComponentScrollBox.ClientHeight;  //page control non-client height (tabs, borders).
+      Result := Max(Result, NewHeight);
+
+      if not EnvironmentOptions.AutoAdjustIDEHeightFullComponentPalette then
         Break;  //we need only one button (we calculate one line only)
-      end;
     end;
   end;
 end;
@@ -717,21 +768,5 @@
   DoSetMainIDEHeight(WindowState = wsMaximized);
 end;
 
-function TMainIDEBar.IsDefaultIDE: Boolean;
-var
-  I: Integer;
-begin
-  Result := True;
-  for I := 0 to MainIDEBar.ControlCount - 1 do
-  begin
-    if (MainIDEBar.Controls[I] as TControl).Tag <> 112 then
-    begin
-      Result := False;
-      Break;
-    end;
-  end;
-end;
-
-
 end.
 
MainIDEBar_Height12.patch (21,991 bytes)   

Ondrej Pokorny

2015-05-06 12:12

developer   ~0083501

@Balazs: MainIDEBar_Height12.patch solves the issue for Win32. I assume it will solve it also for other widgetsets.

Ondrej Pokorny

2015-05-06 12:27

developer   ~0083502

@Juha, thanks for creating the relations. Please add this bug report to the relations as well: http://bugs.freepascal.org/view.php?id=28036

Balázs Székely

2015-05-07 07:19

developer   ~0083508

Last edited: 2015-05-07 07:24

View 2 revisions

If there is no objections, MainIDEBar_Height12.patch should be committed as soon as possible. What do you think? Ondrej, Juha, Anyone?
There may be issues that neither of us sees yet, but it can be solved later.

@Ondrej
You did a great job, I really think this automated IDEBar resizing is a nice feature.

Juha Manninen

2015-05-07 07:30

developer   ~0083509

MainIDEBar_Height12.patch applied in r48959, thanks.
I am not completely happy with 2 option checkboxes for a feature that logically does not need any but it can be thought of later.
You have studied the Anchordocking code, too. Great. Solving the remaining docking issues could use some help. If you are interested, it can be discusses in mailing list.

Ondrej Pokorny

2015-05-07 07:32

developer  

MainIDEBar_Height13.patch (21,994 bytes)   
Index: components/anchordocking/design/registeranchordocking.pas
===================================================================
--- components/anchordocking/design/registeranchordocking.pas	(revision 48942)
+++ components/anchordocking/design/registeranchordocking.pas	(working copy)
@@ -94,6 +94,8 @@
     procedure MakeIDEWindowDockable(AControl: TWinControl); override;
     function AddableInWindowMenu(AForm: TCustomForm): boolean; override;
     procedure ShowForm(AForm: TCustomForm; BringToFront: boolean); override;
+    procedure AdjustMainIDEWindowHeight(const AIDEWindow: TCustomForm;
+      const AAdjustHeight: Boolean; const ANewHeight: Integer); override;
     procedure CloseAll; override;
     procedure OnIDERestoreWindows(Sender: TObject);
     function OnProjectClose(Sender: TObject; AProject: TLazProject): TModalResult;
@@ -287,6 +289,33 @@
   Result:=true;
 end;
 
+procedure TIDEAnchorDockMaster.AdjustMainIDEWindowHeight(
+  const AIDEWindow: TCustomForm; const AAdjustHeight: Boolean;
+  const ANewHeight: Integer);
+var
+  Site: TAnchorDockHostSite;
+  I: Integer;
+  SiteNewHeight: Integer;
+begin
+  inherited AdjustMainIDEWindowHeight(AIDEWindow, AAdjustHeight, ANewHeight);
+
+  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 not Assigned(Site) then
+    Exit;
+
+  Site.BoundSplitter.Enabled := not AAdjustHeight;
+  SiteNewHeight := Site.Parent.ClientHeight - ANewHeight - Site.BoundSplitter.Height;
+  if AAdjustHeight and (Site.Height <> SiteNewHeight) then
+    Site.Height := SiteNewHeight;
+end;
+
 function TIDEAnchorDockMaster.GetUserLayoutFilename(Full: boolean): string;
 begin
   if CmdLineLayoutFile<>'' then begin
Index: components/ideintf/idewindowintf.pas
===================================================================
--- components/ideintf/idewindowintf.pas	(revision 48942)
+++ components/ideintf/idewindowintf.pas	(working copy)
@@ -452,6 +452,8 @@
     procedure MakeIDEWindowDockSite(AForm: TCustomForm; ASides: TDockSides = [alBottom]); virtual; abstract; // make AForm a dock site, AForm can not be docked, its Parent must be kept nil, this does not make it visible
     procedure ShowForm(AForm: TCustomForm; BringToFront: boolean); virtual; abstract; // make a form visible, set BringToFront=true if form should be shown on active screen and on front of other windows, normally this focus the form
     function AddableInWindowMenu({%H-}AForm: TCustomForm): boolean; virtual;
+    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
     property HideSimpleLayoutOptions: boolean read FHideSimpleLayoutOptions;
   end;
@@ -2120,6 +2122,13 @@
   Result:=true;
 end;
 
+procedure TIDEDockMaster.AdjustMainIDEWindowHeight(
+  const AIDEWindow: TCustomForm; const AAdjustHeight: Boolean;
+  const ANewHeight: Integer);
+begin
+
+end;
+
 procedure TIDEDockMaster.CloseAll;
 begin
   CloseAllForms;
Index: ide/componentpalette.pas
===================================================================
--- ide/componentpalette.pas	(revision 48942)
+++ ide/componentpalette.pas	(working copy)
@@ -97,6 +97,7 @@
     FPageControl: TPageControl;
     FOnOpenPackage: TNotifyEvent;
     FOnOpenUnit: TNotifyEvent;
+    FOnChangeActivePage: TNotifyEvent;
     fUnregisteredIcon: TCustomBitmap;
     fSelectButtonIcon: TCustomBitmap;
     fUpdatingPageControl: boolean;
@@ -137,6 +138,7 @@
     property PageControl: TPageControl read FPageControl write SetPageControl;
     property OnOpenPackage: TNotifyEvent read FOnOpenPackage write FOnOpenPackage;
     property OnOpenUnit: TNotifyEvent read FOnOpenUnit write FOnOpenUnit;
+    property OnChangeActivePage: TNotifyEvent read FOnChangeActivePage write FOnChangeActivePage;
   end;
 
 function CompareControlsWithTag(Control1, Control2: Pointer): integer;
@@ -241,12 +243,9 @@
         ' IsScrollBarVisible=',ScrollBox.HorzScrollBar.IsScrollBarVisible
         ]);
     {$ENDIF}
-    MaxBtnPerRow:=ButtonTree.Count;
-    {$IFnDEF LCLCarbon}
-    // This condition prevents a mysterious repagination on Windows during startup.
-    if MainIDE.IDEStarted then
-      MaxBtnPerRow:=((ScrollBox.VertScrollBar.ClientSizeWithoutBar - ButtonX) div ComponentPaletteBtnWidth);
-    {$ENDIF}
+
+    MaxBtnPerRow:=((ScrollBox.VertScrollBar.ClientSizeWithoutBar - ButtonX) div ComponentPaletteBtnWidth);
+
     // If we need to wrap, make sure we have space for the scrollbar
     if MaxBtnPerRow < ButtonTree.Count then
       MaxBtnPerRow:=((ScrollBox.VertScrollBar.ClientSizeWithBar - ButtonX) div ComponentPaletteBtnWidth);
@@ -515,6 +514,9 @@
   {$ENDIF}
   ReAlignButtons(FPageControl.ActivePage);
   Selected:=nil;
+
+  if Assigned(FOnChangeActivePage) then
+    FOnChangeActivePage(Sender);
 end;
 
 procedure TComponentPalette.OnScrollBoxResize(Sender: TObject);
Index: ide/environmentopts.pp
===================================================================
--- ide/environmentopts.pp	(revision 48942)
+++ ide/environmentopts.pp	(working copy)
@@ -288,6 +288,7 @@
     FHideIDEOnRun: boolean;
     FComponentPaletteVisible: boolean;
     FAutoAdjustIDEHeight: boolean;
+    FAutoAdjustIDEHeightFullComponentPalette: boolean;
 
     // CompletionWindow
     FCompletionWindowWidth: Integer;
@@ -520,6 +521,7 @@
     property ComponentPaletteVisible: boolean read FComponentPaletteVisible
                                               write FComponentPaletteVisible;
     property AutoAdjustIDEHeight: Boolean read FAutoAdjustIDEHeight write FAutoAdjustIDEHeight;
+    property AutoAdjustIDEHeightFullComponentPalette: Boolean read FAutoAdjustIDEHeightFullComponentPalette write FAutoAdjustIDEHeightFullComponentPalette;
     property CompletionWindowWidth: Integer read FCompletionWindowWidth
                                             write FCompletionWindowWidth;
     property CompletionWindowHeight: Integer read FCompletionWindowHeight
@@ -882,6 +884,7 @@
   FIDEProjectDirectoryInIdeTitle:=false;
   FComponentPaletteVisible:=true;
   FAutoAdjustIDEHeight:=true;
+  FAutoAdjustIDEHeightFullComponentPalette := true;
 
   // window menu
   FIDENameForDesignedFormList:=false;
@@ -1210,6 +1213,8 @@
         Path+'Desktop/ComponentPaletteVisible/Value',true);
       FAutoAdjustIDEHeight:=XMLConfig.GetValue(
         Path+'Desktop/AutoAdjustIDEHeight/Value',true);
+      FAutoAdjustIDEHeightFullComponentPalette:=XMLConfig.GetValue(
+        Path+'Desktop/AutoAdjustIDEHeightFullComponentPalette/Value',true);
       FCompletionWindowWidth:=XMLConfig.GetValue(
         Path+'Desktop/CompletionWindowWidth/Value', 320);
       FCompletionWindowHeight:=XMLConfig.GetValue(
@@ -1601,6 +1606,8 @@
                                FComponentPaletteVisible,true);
       XMLConfig.SetDeleteValue(Path+'Desktop/AutoAdjustIDEHeight/Value',
                                FAutoAdjustIDEHeight,true);
+      XMLConfig.SetDeleteValue(Path+'Desktop/AutoAdjustIDEHeightFullComponentPalette/Value',
+                               FAutoAdjustIDEHeightFullComponentPalette,true);
       XMLConfig.SetDeleteValue(Path+'Desktop/CompletionWindowWidth/Value',
                                FCompletionWindowWidth, 320);
       XMLConfig.SetDeleteValue(Path+'Desktop/CompletionWindowHeight/Value',
Index: ide/frames/window_options.lfm
===================================================================
--- ide/frames/window_options.lfm	(revision 48942)
+++ ide/frames/window_options.lfm	(working copy)
@@ -1,9 +1,9 @@
 object WindowOptionsFrame: TWindowOptionsFrame
   Left = 0
-  Height = 582
+  Height = 585
   Top = 0
   Width = 573
-  ClientHeight = 582
+  ClientHeight = 585
   ClientWidth = 573
   TabOrder = 0
   DesignLeft = 349
@@ -41,15 +41,15 @@
     AnchorSideTop.Side = asrBottom
     AnchorSideBottom.Side = asrBottom
     Left = 0
-    Height = 423
+    Height = 426
     Top = 154
     Width = 570
     Anchors = [akTop, akLeft, akRight, akBottom]
     BorderSpacing.Top = 3
     Caption = 'WindowPositionsPanel'
-    ClientHeight = 423
+    ClientHeight = 426
     ClientWidth = 570
-    TabOrder = 7
+    TabOrder = 8
     object LeftLabel: TLabel
       AnchorSideTop.Control = LeftEdit
       AnchorSideTop.Side = asrCenter
@@ -457,7 +457,7 @@
   end
   object lblWindowPosition: TDividerBevel
     AnchorSideLeft.Control = Owner
-    AnchorSideTop.Control = AutoAdjustIDEHeightCheckBox
+    AnchorSideTop.Control = AutoAdjustIDEHeightFullComponentPaletteCheckBox
     AnchorSideTop.Side = asrBottom
     AnchorSideRight.Control = Owner
     AnchorSideRight.Side = asrBottom
@@ -484,4 +484,18 @@
     ShowHint = True
     TabOrder = 6
   end
+  object AutoAdjustIDEHeightFullComponentPaletteCheckBox: TCheckBox
+    AnchorSideLeft.Control = AutoAdjustIDEHeightCheckBox
+    AnchorSideLeft.Side = asrBottom
+    AnchorSideTop.Control = AutoAdjustIDEHeightCheckBox
+    Left = 189
+    Height = 17
+    Top = 115
+    Width = 274
+    BorderSpacing.Left = 20
+    Caption = 'AutoAdjustIDEHeightFullComponentPaletteCheckBox'
+    ParentShowHint = False
+    ShowHint = True
+    TabOrder = 7
+  end
 end
Index: ide/frames/window_options.pas
===================================================================
--- ide/frames/window_options.pas	(revision 48942)
+++ ide/frames/window_options.pas	(working copy)
@@ -35,6 +35,7 @@
 
   TWindowOptionsFrame = class(TAbstractIDEOptionsEditor)
     ApplyButton: TButton;
+    AutoAdjustIDEHeightFullComponentPaletteCheckBox: TCheckBox;
     lblWindowPosition: TDividerBevel;
     lblShowingWindows: TDividerBevel;
     lblWindowCaption: TDividerBevel;
@@ -125,6 +126,8 @@
   NameForDesignedFormList.Hint:=lisWindowMenuWithNameForDesignedFormHint;
   AutoAdjustIDEHeightCheckBox.Caption:=lisAutoAdjustIDEHeight;
   AutoAdjustIDEHeightCheckBox.Hint:=lisAutoAdjustIDEHeightHint;
+  AutoAdjustIDEHeightFullComponentPaletteCheckBox.Caption:=lisAutoAdjustIDEHeightFullComponentPalette;
+  AutoAdjustIDEHeightFullComponentPaletteCheckBox.Hint:=lisAutoAdjustIDEHeightFullComponentPaletteHint;
   ProjectDirInIdeTitleCheckBox.Caption:=lisIDETitleShowsProjectDir;
   ProjectDirInIdeTitleCheckBox.Hint:=lisProjectDirectoryIsShowedInIdeTitleBar;
 end;
@@ -143,6 +146,7 @@
     TitleIncludesBuildMode.Checked:=IDETitleIncludesBuildMode;
     NameForDesignedFormList.Checked:=IDENameForDesignedFormList;
     AutoAdjustIDEHeightCheckBox.Checked:=AutoAdjustIDEHeight;
+    AutoAdjustIDEHeightFullComponentPaletteCheckBox.Checked:=AutoAdjustIDEHeightFullComponentPalette;
     ProjectDirInIdeTitleCheckBox.Checked:=IDEProjectDirectoryInIdeTitle;
   end;
 
@@ -224,6 +228,7 @@
     IDETitleIncludesBuildMode := TitleIncludesBuildMode.Checked;
     IDENameForDesignedFormList := NameForDesignedFormList.Checked;
     AutoAdjustIDEHeight := AutoAdjustIDEHeightCheckBox.Checked;
+    AutoAdjustIDEHeightFullComponentPalette := AutoAdjustIDEHeightFullComponentPaletteCheckBox.Checked;
     IDEProjectDirectoryInIdeTitle:=ProjectDirInIdeTitleCheckBox.Checked;
   end;
 end;
Index: ide/lazarusidestrconsts.pas
===================================================================
--- ide/lazarusidestrconsts.pas	(revision 48942)
+++ ide/lazarusidestrconsts.pas	(working copy)
@@ -1260,7 +1260,9 @@
   lisIDETitleShowsProjectDir = 'IDE title shows project directory';
   lisIDETitleShowsBuildMode = 'IDE title shows selected build mode';
   lisAutoAdjustIDEHeight = 'Automatically adjust IDE main window height';
-  lisAutoAdjustIDEHeightHint = 'Applicable only when not maximized and for undocked IDE.';
+  lisAutoAdjustIDEHeightHint = '';
+  lisAutoAdjustIDEHeightFullComponentPalette = 'Show complete component palette';
+  lisAutoAdjustIDEHeightFullComponentPaletteHint = 'If component palette spans over more lines, show them all and not only one.';
   lisWindowMenuWithNameForDesignedForm = 'Window menu shows designed form''s name instead of caption';
   lisWindowMenuWithNameForDesignedFormHint = 'Useful especially if the caption is left empty.';
   dlgWinPos = 'Window positions';
Index: ide/main.pp
===================================================================
--- ide/main.pp	(revision 48942)
+++ ide/main.pp	(working copy)
@@ -1517,6 +1517,7 @@
   CompPalette.OnOpenPackage:=@PkgMngr.IDEComponentPaletteOpenPackage;
   CompPalette.OnOpenUnit:=@PkgMngr.IDEComponentPaletteOpenUnit;
   CompPalette.PageControl:=MainIDEBar.ComponentPageControl;
+  CompPalette.OnChangeActivePage:=@MainIDEBar.SetMainIDEHeightEvent;
   // load installed packages
   PkgBoss.LoadInstalledPackages;
 
@@ -2002,13 +2003,11 @@
   MainIDEBar.MainSplitter.Parent := MainIDEBar;
   MainIDEBar.MainSplitter.Align := alLeft;
   MainIDEBar.MainSplitter.MinSize := 50;
-  MainIDEBar.MainSplitter.Tag := 112;
   MainIDEBar.MainSplitter.OnMoved := @MainIDEBar.MainSplitterMoved;
 
 
   MainIDEBar.CoolBar := TCoolBar.Create(OwningComponent);
   MainIDEBar.CoolBar.Parent := MainIDEBar;
-  MainIDEBar.CoolBar.Tag := 112;
   if EnvironmentOptions.ComponentPaletteVisible then
   begin
     MainIDEBar.CoolBar.Align := alLeft;
@@ -2017,7 +2016,6 @@
   else
     MainIDEBar.CoolBar.Align := alClient;
 
-  MainIDEBar.mnuMainMenu.Tag := 112;
   // IDE Coolbar object wraps MainIDEBar.CoolBar.
   IDECoolBar := TIDECoolBar.Create(MainIDEBar.CoolBar);
   IDECoolBar.IsVisible := EnvironmentOptions.IDECoolBarOptions.IDECoolBarVisible;;
@@ -2050,7 +2048,6 @@
     Align := alClient;
     Visible:=EnvironmentOptions.ComponentPaletteVisible;
     Parent := MainIDEBar;
-    Tag := 112;
   end;
 end;
 
@@ -3709,6 +3706,9 @@
     MainIDEBar.CoolBar.Align := alClient;
   MainIDEBar.MainSplitter.Visible := MainIDEBar.Coolbar.Visible and
                                      MainIDEBar.ComponentPageControl.Visible;
+
+  if ComponentPaletteVisible then//when showing component palette, it must be visible to calculate it correctly
+    MainIDEBar.DoSetMainIDEHeight(MainIDEBar.WindowState = wsMaximized, 55);//it will cause the IDE to flicker, but it's better than to have wrongly calculated IDE height
   MainIDEBar.SetMainIDEHeight;
 end;
 
Index: ide/mainbar.pas
===================================================================
--- ide/mainbar.pas	(revision 48942)
+++ ide/mainbar.pas	(working copy)
@@ -362,12 +362,12 @@
       const FileNames: array of String);
     procedure CoolBarOnChange(Sender: TObject);
     procedure MainSplitterMoved(Sender: TObject);
+    procedure SetMainIDEHeightEvent(Sender: TObject);
   private
     FOldWindowState: TWindowState;
     FOnActive: TNotifyEvent;
     procedure NewUnitFormDefaultClick(Sender: TObject);
     procedure NewUnitFormPopupMenuPopup(Sender: TObject);
-    function IsDefaultIDE: Boolean;
     function CalcMainIDEHeight: Integer;
     function CalcNonClientHeight: Integer;
   protected
@@ -375,7 +375,6 @@
     procedure DoShow; override;
     procedure WndProc(var Message: TLMessage); override;
 
-    procedure DoSetMainIDEHeight(const AIDEIsMaximized: Boolean);
     procedure Resizing(State: TWindowState); override;
   public
     constructor Create(TheOwner: TComponent); override;
@@ -386,6 +385,7 @@
     procedure UpdateDockCaption({%H-}Exclude: TControl); override;
     procedure RefreshCoolbar;
     procedure SetMainIDEHeight;
+    procedure DoSetMainIDEHeight(const AIDEIsMaximized: Boolean; ANewHeight: Integer = 0);
   end;
 
 var
@@ -394,7 +394,7 @@
 implementation
 
 uses
-  LCLIntf, LCLType, InterfaceBase, Math;
+  LCLIntf, LCLType, Math, IDEWindowIntf;
 
 { TMainIDEBar }
 
@@ -479,27 +479,38 @@
     FOnActive(Self);
 end;
 
-procedure TMainIDEBar.DoSetMainIDEHeight(const AIDEIsMaximized: Boolean);
-var
-  NewHeight: Integer;
+procedure TMainIDEBar.DoSetMainIDEHeight(const AIDEIsMaximized: Boolean;
+  ANewHeight: Integer);
 begin
-  if not (Showing and IsDefaultIDE) then
+  if not Showing then
     Exit;
 
-  if (AIDEIsMaximized or EnvironmentOptions.AutoAdjustIDEHeight) then
+  if ANewHeight <= 0 then
+    ANewHeight := CalcMainIDEHeight;
+
+  if Assigned(IDEDockMaster) then
   begin
-    NewHeight := CalcMainIDEHeight + CalcNonClientHeight;
-    if NewHeight <> Constraints.MaxHeight then
+    if EnvironmentOptions.AutoAdjustIDEHeight then
+      IDEDockMaster.AdjustMainIDEWindowHeight(Self, True, ANewHeight)
+    else
+      IDEDockMaster.AdjustMainIDEWindowHeight(Self, False, 0);
+  end else
+  begin
+    if (AIDEIsMaximized or EnvironmentOptions.AutoAdjustIDEHeight) then
     begin
-      Constraints.MaxHeight := NewHeight;
-      Constraints.MinHeight := Constraints.MaxHeight;
-      ClientHeight := Constraints.MaxHeight;
+      ANewHeight := ANewHeight + CalcNonClientHeight;
+      if ANewHeight <> Constraints.MaxHeight then
+      begin
+        Constraints.MaxHeight := ANewHeight;
+        Constraints.MinHeight := Constraints.MaxHeight;
+        ClientHeight := Constraints.MaxHeight;
+      end;
+    end else
+    if Constraints.MaxHeight <> 0 then
+    begin
+      Constraints.MaxHeight := 0;
+      Constraints.MinHeight := 0;
     end;
-  end else
-  if Constraints.MaxHeight <> 0 then
-  begin
-    Constraints.MaxHeight := 0;
-    Constraints.MinHeight := 0;
   end;
 end;
 
@@ -507,26 +518,60 @@
 begin
   inherited DoShow;
   RefreshCoolbar;
+  ComponentPageControl.OnChange(Self);//refresh component palette with button reposition
 end;
 
 function TMainIDEBar.CalcNonClientHeight: Integer;
+{$IF DEFINED(LCLWin32) OR DEFINED(LCLGtk2)}
 var
   WindowRect, WindowClientRect: TRect;
+{$ENDIF}
 begin
-  if Showing then
-  begin
-    LclIntf.GetWindowRect(Handle, WindowRect{%H-});
-    LclIntf.GetClientRect(Handle, WindowClientRect{%H-});
-    LclIntf.ClientToScreen(Handle, WindowClientRect.TopLeft);
+  {
+    This function is a bug-workaround for various LCL widgetsets.
+    Every widgetset handles constrained height differently.
+    In an ideal word (when the bugs are fixed), this function shouldn't be
+    needed at all - it should return always 0.
 
-    Result := WindowClientRect.Top - WindowRect.Top;
+    Currently tested: Win32, Gtk2, Carbon, Qt.
 
-    if Pos('Win32', WidgetSet.ClassName) > 0 then//TWin32WidgetSet widgetset bug -> the constrained height has to be without SM_CYSIZEFRAME and SM_CYMENU (Gtk2 works fine)
-      Result := Result - (LCLIntf.GetSystemMetrics(SM_CYSIZEFRAME) + LCLIntf.GetSystemMetrics(SM_CYMENU));
-  end else
-    Result := 0;
+    List of bugs related to this workaround:
+      http://bugs.freepascal.org/view.php?id=28033
+      http://bugs.freepascal.org/view.php?id=28034
+      http://bugs.freepascal.org/view.php?id=28036
+
+  }
+
+  if not Showing then
+    Exit(0);
+
+  {$IF DEFINED(LCLWin32) OR DEFINED(LCLGtk2)}
+  //Gtk2 + Win32
+  //retrieve real main menu height because
+  // - Win32: multi-line is possible (SM_CYMENU reflects only single line)
+  // - Gtk2:  SM_CYMENU does not work
+  LclIntf.GetWindowRect(Handle, WindowRect{%H-});
+  LclIntf.GetClientRect(Handle, WindowClientRect{%H-});
+  LclIntf.ClientToScreen(Handle, WindowClientRect.TopLeft);
+
+  Result := WindowClientRect.Top - WindowRect.Top;
+
+  {$IFDEF LCLWin32}
+  //Win32 the constrained height has to be without SM_CYSIZEFRAME and SM_CYMENU
+  Result := Result - (LCLIntf.GetSystemMetrics(SM_CYSIZEFRAME) + LCLIntf.GetSystemMetrics(SM_CYMENU));
+  {$ENDIF LCLWin32}
+  {$ELSE}
+  //other widgetsets
+  //Carbon & Qt tested - they behave correctly
+  Result := 0;
+  {$ENDIF}
 end;
 
+procedure TMainIDEBar.SetMainIDEHeightEvent(Sender: TObject);
+begin
+  SetMainIDEHeight;
+end;
+
 procedure TMainIDEBar.WndProc(var Message: TLMessage);
 begin
   inherited WndProc(Message);
@@ -671,21 +716,27 @@
     end;
   end;
 
-  if EnvironmentOptions.ComponentPaletteVisible then
+  if EnvironmentOptions.ComponentPaletteVisible and Assigned(ComponentPageControl.ActivePage) then
   begin
-    for I := 0 to ComponentPageControl.PageCount-1 do
-    if (ComponentPageControl.Page[I].ControlCount > 0) and (ComponentPageControl.Page[I].Controls[0] is TScrollBox) then
+    ComponentScrollBox := nil;
+    for I := 0 to ComponentPageControl.ActivePage.ControlCount-1 do
+    if (ComponentPageControl.ActivePage.Controls[I] is TScrollBox) then
     begin
-      ComponentScrollBox := TScrollBox(ComponentPageControl.Page[I].Controls[0]);
-      if ComponentScrollBox.ControlCount > 0 then
-      begin
-        SBControl := ComponentScrollBox.Controls[0];
-        NewHeight :=
-          SBControl.Top + SBControl.Height +  //button height
-          ComponentPageControl.Height - ComponentScrollBox.ClientHeight;  //page control non-client height (tabs, borders).
-        Result := Max(Result, NewHeight);
+      ComponentScrollBox := TScrollBox(ComponentPageControl.ActivePage.Controls[I]);
+      Break;
+    end;
+
+    if Assigned(ComponentScrollBox) then
+    for I := 0 to ComponentScrollBox.ControlCount-1 do
+    begin
+      SBControl := ComponentScrollBox.Controls[I];
+      NewHeight :=
+        SBControl.Top + SBControl.Height +  //button height
+        ComponentPageControl.Height - ComponentScrollBox.ClientHeight;  //page control non-client height (tabs, borders).
+      Result := Max(Result, NewHeight);
+
+      if not EnvironmentOptions.AutoAdjustIDEHeightFullComponentPalette then
         Break;  //we need only one button (we calculate one line only)
-      end;
     end;
   end;
 end;
@@ -717,21 +768,5 @@
   DoSetMainIDEHeight(WindowState = wsMaximized);
 end;
 
-function TMainIDEBar.IsDefaultIDE: Boolean;
-var
-  I: Integer;
-begin
-  Result := True;
-  for I := 0 to MainIDEBar.ControlCount - 1 do
-  begin
-    if (MainIDEBar.Controls[I] as TControl).Tag <> 112 then
-    begin
-      Result := False;
-      Break;
-    end;
-  end;
-end;
-
-
 end.
 
MainIDEBar_Height13.patch (21,994 bytes)   

Ondrej Pokorny

2015-05-07 07:36

developer  

MainIDEBar_Height14.patch (1,263 bytes)   
Index: ide/main.pp
===================================================================
--- ide/main.pp	(revision 48959)
+++ ide/main.pp	(working copy)
@@ -3708,7 +3708,7 @@
                                      MainIDEBar.ComponentPageControl.Visible;
 
   if ComponentPaletteVisible then//when showing component palette, it must be visible to calculate it correctly
-    MainIDEBar.DoSetMainIDEHeight(MainIDEBar.WindowState = wsMaximized, 100);//it will cause the IDE to flicker, but it's better than to have wrongly calculated IDE height
+    MainIDEBar.DoSetMainIDEHeight(MainIDEBar.WindowState = wsMaximized, 55);//it will cause the IDE to flicker, but it's better than to have wrongly calculated IDE height
   MainIDEBar.SetMainIDEHeight;
 end;
 
Index: ide/mainbar.pas
===================================================================
--- ide/mainbar.pas	(revision 48959)
+++ ide/mainbar.pas	(working copy)
@@ -533,7 +533,7 @@
     In an ideal word (when the bugs are fixed), this function shouldn't be
     needed at all - it should return always 0.
 
-    Currently tested: Win32, Gtk2, Carbon.
+    Currently tested: Win32, Gtk2, Carbon, Qt.
 
     List of bugs related to this workaround:
       http://bugs.freepascal.org/view.php?id=28033
MainIDEBar_Height14.patch (1,263 bytes)   

Ondrej Pokorny

2015-05-07 07:40

developer   ~0083510

@Balasz: Thanks!
@Juha: Yes, it is a matter of discussion of the settings, but generally it's better to have an option to choose than to force some feature.

Thanks for committing. I uploaded "MainIDEBar_Height14.patch" with 2 small cosmetic changes (better comment and better resizing when opening component palette), but it's not crucial.

Now I am leaving for holidays, let's talk about it next week!

Juha Manninen

2015-05-09 10:13

developer   ~0083532

Last edited: 2015-05-09 19:40

View 2 revisions

I applied MainIDEBar_Height14.patch, thanks.
I think problems regarding the IDE main window size are solved thus I am resolving this report. It is long and already difficult to follow.
Future improvemets can have their own report, marked as related if needed.

[Edit] The feature is broken on Linux with QT. I opened 0028063, please look at it. I have not studied the code enough yet.

Issue History

Date Modified Username Field Change
2015-04-23 12:26 Ondrej Pokorny New Issue
2015-04-23 12:26 Ondrej Pokorny File Added: laz-ide-height.png
2015-04-23 17:34 Juha Manninen Note Added: 0083143
2015-04-23 21:08 Bart Broersma Note Added: 0083147
2015-04-23 21:14 Ondrej Pokorny Note Added: 0083148
2015-04-23 21:15 Ondrej Pokorny Note Added: 0083149
2015-05-02 18:29 Juha Manninen Assigned To => Juha Manninen
2015-05-02 18:29 Juha Manninen Status new => assigned
2015-05-03 10:40 Balázs Székely Note Added: 0083422
2015-05-03 10:41 Balázs Székely File Added: MainIDEBar_Heigth.patch
2015-05-03 12:03 Juha Manninen Fixed in Revision => r48925
2015-05-03 12:03 Juha Manninen LazTarget => -
2015-05-03 12:03 Juha Manninen Note Added: 0083424
2015-05-03 12:03 Juha Manninen Status assigned => resolved
2015-05-03 12:03 Juha Manninen Resolution open => fixed
2015-05-03 12:52 Balázs Székely Note Added: 0083427
2015-05-03 13:08 Juha Manninen Status resolved => assigned
2015-05-03 13:08 Juha Manninen Resolution fixed => reopened
2015-05-03 16:13 Péter Gábor Note Added: 0083430
2015-05-03 16:19 Péter Gábor Note Edited: 0083430 View Revisions
2015-05-03 18:27 Balázs Székely File Added: MainIDEBar_Heigth1.patch
2015-05-03 22:51 Balázs Székely Note Added: 0083440
2015-05-03 22:51 Balázs Székely File Added: MainIDEBar_Height2.patch
2015-05-04 19:27 Péter Gábor Note Added: 0083457
2015-05-04 19:27 Péter Gábor Note Edited: 0083457 View Revisions
2015-05-04 19:28 Péter Gábor Note Edited: 0083457 View Revisions
2015-05-04 19:41 Péter Gábor Note Edited: 0083457 View Revisions
2015-05-04 19:43 Ondrej Pokorny Note Added: 0083458
2015-05-04 20:02 Balázs Székely Note Added: 0083459
2015-05-04 20:13 Ondrej Pokorny File Added: MainIDEBar_Height3.patch
2015-05-04 20:17 Ondrej Pokorny Note Added: 0083460
2015-05-04 20:31 Sandro Cumerlato Note Added: 0083461
2015-05-04 20:31 Sandro Cumerlato File Added: ide1.PNG
2015-05-04 20:31 Sandro Cumerlato File Added: ide2.PNG
2015-05-04 20:31 Sandro Cumerlato File Added: ide3.PNG
2015-05-04 20:32 Sandro Cumerlato File Added: ide4.PNG
2015-05-04 20:35 Sandro Cumerlato Note Edited: 0083461 View Revisions
2015-05-04 21:31 Balázs Székely Note Added: 0083462
2015-05-04 21:33 Balázs Székely Note Edited: 0083462 View Revisions
2015-05-04 22:39 Ondrej Pokorny Note Added: 0083464
2015-05-05 00:47 Ondrej Pokorny File Added: MainIDEBar_Height4.patch
2015-05-05 00:58 Ondrej Pokorny File Added: MainIDEBar_Height5.patch
2015-05-05 00:59 Ondrej Pokorny Note Added: 0083465
2015-05-05 02:34 Ondrej Pokorny File Added: MainIDEBar_Height6.patch
2015-05-05 02:49 Ondrej Pokorny Note Added: 0083467
2015-05-05 02:49 Ondrej Pokorny File Added: MainIDEBar_Height7.patch
2015-05-05 08:17 Balázs Székely Note Added: 0083472
2015-05-05 17:52 Juha Manninen Note Added: 0083479
2015-05-05 17:52 Juha Manninen Status assigned => feedback
2015-05-05 18:28 Ondrej Pokorny File Added: MainIDEBar_Height8.patch
2015-05-05 18:34 Ondrej Pokorny Note Added: 0083482
2015-05-05 18:34 Ondrej Pokorny Status feedback => assigned
2015-05-05 21:03 Juha Manninen Note Added: 0083483
2015-05-05 21:12 Sandro Cumerlato Note Added: 0083484
2015-05-05 21:15 Sandro Cumerlato File Added: ide5.PNG
2015-05-05 21:15 Ondrej Pokorny Note Added: 0083485
2015-05-05 21:26 Ondrej Pokorny Note Added: 0083486
2015-05-05 22:06 Balázs Székely Note Added: 0083489
2015-05-05 23:21 Ondrej Pokorny File Added: MainIDEBar_Height9.patch
2015-05-06 01:20 Ondrej Pokorny Note Added: 0083492
2015-05-06 01:20 Ondrej Pokorny File Added: MainIDEBar_Height10.patch
2015-05-06 07:49 Balázs Székely Note Added: 0083494
2015-05-06 07:49 Balázs Székely File Added: OSX.png
2015-05-06 07:53 Balázs Székely Note Edited: 0083494 View Revisions
2015-05-06 08:19 Ondrej Pokorny Note Added: 0083495
2015-05-06 09:26 Balázs Székely Note Added: 0083496
2015-05-06 11:01 Juha Manninen Relationship added related to 0028033
2015-05-06 11:02 Ondrej Pokorny File Added: MainIDEBar_Height11.patch
2015-05-06 11:07 Ondrej Pokorny Note Added: 0083498
2015-05-06 11:21 Juha Manninen Relationship added related to 0028034
2015-05-06 11:38 Balázs Székely Note Added: 0083499
2015-05-06 12:08 Ondrej Pokorny File Added: MainIDEBar_Height12.patch
2015-05-06 12:12 Ondrej Pokorny Note Added: 0083501
2015-05-06 12:27 Ondrej Pokorny Note Added: 0083502
2015-05-06 23:06 Maxim Ganetsky Relationship added related to 0028036
2015-05-07 07:19 Balázs Székely Note Added: 0083508
2015-05-07 07:24 Balázs Székely Note Edited: 0083508 View Revisions
2015-05-07 07:30 Juha Manninen Note Added: 0083509
2015-05-07 07:32 Ondrej Pokorny File Added: MainIDEBar_Height13.patch
2015-05-07 07:36 Ondrej Pokorny File Added: MainIDEBar_Height14.patch
2015-05-07 07:40 Ondrej Pokorny Note Added: 0083510
2015-05-09 10:13 Juha Manninen Fixed in Revision r48925 => r48925, r48937, r48959, r48977
2015-05-09 10:13 Juha Manninen Note Added: 0083532
2015-05-09 10:13 Juha Manninen Status assigned => resolved
2015-05-09 10:13 Juha Manninen Resolution reopened => fixed
2015-05-09 19:37 Juha Manninen Relationship added related to 0028063
2015-05-09 19:40 Juha Manninen Note Edited: 0083532 View Revisions
2015-05-10 19:04 Ondrej Pokorny Status resolved => closed