Blame 4Pane-HEAD-0005-Make-the-toolbar-the-correct-size-for-its-tools-in-g.patch

5350dd7
From 712bf13e3fb2039cde3b4ee0c2d8c2e49f003a02 Mon Sep 17 00:00:00 2001
5350dd7
From: dghart <dghart@users.sourceforge.net>
5350dd7
Date: Sun, 21 Dec 2014 15:20:02 +0000
5350dd7
Subject: [PATCH 1/2] Make the toolbar the correct size for its tools in gtk3
5350dd7
 builds too
5350dd7
5350dd7
When built against wxWidgets using gtk3, the toolbar was clipping the icons of its tools. This was caused by old code designed to ease the transition between gtk1.2 and 2.0!
5350dd7
Fixed by removing that old code, and allowing the toolbar to size itself naturally.
5350dd7
---
5350dd7
 Externs.h   | 2 --
5350dd7
 MyFrame.cpp | 4 ++--
5350dd7
 Redo.cpp    | 4 ++--
5350dd7
 config.h    | 7 -------
5350dd7
 4 files changed, 4 insertions(+), 13 deletions(-)
5350dd7
5350dd7
diff --git a/Externs.h b/Externs.h
5350dd7
index c5213c2..2f0223d 100644
5350dd7
--- a/Externs.h
5350dd7
+++ b/Externs.h
5350dd7
@@ -86,8 +86,6 @@ extern wxString BITMAPSDIR;
5350dd7
 extern wxString RCDIR;
5350dd7
 extern wxString HELPDIR;
5350dd7
 
5350dd7
-extern int MAINTOOLBARWIDTH;
5350dd7
-
5350dd7
 extern wxWindowID NextID;
5350dd7
 
5350dd7
 #if defined(__WXGTK20__)
5350dd7
diff --git a/MyFrame.cpp b/MyFrame.cpp
5350dd7
index ebae40f..757c043 100644
5350dd7
--- a/MyFrame.cpp
5350dd7
+++ b/MyFrame.cpp
5350dd7
@@ -547,7 +547,7 @@ CreateMenuBar(MenuBar); SetMenuBar(MenuBar);
5350dd7
 
5350dd7
 toolbar = NULL; LoadToolbarButtons();  // Toolbar pt1
5350dd7
 
5350dd7
-panelette = new wxPanel(this, -1, wxDefaultPosition, wxSize(-1,MAINTOOLBARWIDTH), wxTAB_TRAVERSAL, wxT("TBPanel"));  // & pt2, for MyBitmapButtons
5350dd7
+panelette = new wxPanel(this, -1, wxDefaultPosition, wxDefaultSize, wxTAB_TRAVERSAL, wxT("TBPanel"));  // & pt2, for MyBitmapButtons
5350dd7
 sizerTB = new wxBoxSizer(wxHORIZONTAL);
5350dd7
 sizerTB->Add(toolbar, 0, wxEXPAND);
5350dd7
 sizerTB->Add(panelette, 1, wxEXPAND);
5350dd7
@@ -666,7 +666,7 @@ if (recreating)
5350dd7
     toolbar->Destroy();
5350dd7
   }
5350dd7
 
5350dd7
-toolbar = new wxToolBar(this, ID_FRAMETOOLBAR ,wxPoint(0,0), wxSize(-1,MAINTOOLBARWIDTH));
5350dd7
+toolbar = new wxToolBar(this, ID_FRAMETOOLBAR);
5350dd7
 
5350dd7
 wxBitmap toolBarBitmaps[8];
5350dd7
 
5350dd7
diff --git a/Redo.cpp b/Redo.cpp
5350dd7
index f3cc6bc..f55928e 100644
5350dd7
--- a/Redo.cpp
5350dd7
+++ b/Redo.cpp
5350dd7
@@ -295,7 +295,7 @@ int offset = 0;                                 // This copes with displays of >
5350dd7
 
5350dd7
     // We need to pop-up the sidebar menu below the Undo button.  WxWidgets doesn't let us locate this, & the mouse pos could be anywhere within the button.
5350dd7
 wxPoint pt;                     // The solution is to cheat, & place it where calcs say it ought to be.  This may fail on future resizes etc
5350dd7
-pt.y = MAINTOOLBARWIDTH + 2;    // The y pos could be anywhere within the button, so replace with the known toolbar-width, plus a fiddle-factor
5350dd7
+pt.y = MyFrame::mainframe->toolbar->GetSize().GetHeight() + 2; // The y pos could be anywhere within the button, so replace with the known toolbar-height, plus a fiddle-factor
5350dd7
 pt.x = (MyFrame::mainframe->buttonsbeforesidebar * 30) + (MyFrame::mainframe->separatorsbeforesidebar * 7);  // & we counted the tools as we inserted them
5350dd7
 
5350dd7
 do
5350dd7
@@ -379,7 +379,7 @@ int offset = 0;                             // This copes with displays of >1 pa
5350dd7
 
5350dd7
     // We need to pop-up the sidebar menu below the Redo button.  WxWidgets doesn't let us locate this, & the mouse pos could be anywhere within the button.
5350dd7
 wxPoint pt;                     // The solution is to cheat, & place it where calcs say it ought to be.  This may fail on future resizes etc
5350dd7
-pt.y = MAINTOOLBARWIDTH + 2;    // The y pos could be anywhere within the button, so replace with the known toolbar-width, plus a fiddle-factor
5350dd7
+pt.y = MyFrame::mainframe->toolbar->GetSize().GetHeight() + 2; // The y pos could be anywhere within the button, so replace with the known toolbar-height, plus a fiddle-factor
5350dd7
 pt.x = (MyFrame::mainframe->buttonsbeforesidebar * 30) + 30 + 13  // (The extra 30 is for the Undo button, the 13 for the Undo sidebar buttton)
5350dd7
           + (MyFrame::mainframe->separatorsbeforesidebar* 7);     // We counted the other tools as we inserted them
5350dd7
 
5350dd7
diff --git a/config.h b/config.h
5350dd7
index 641d694..b2b7c46 100644
5350dd7
--- a/config.h
5350dd7
+++ b/config.h
5350dd7
@@ -47,13 +47,6 @@ wxString BITMAPSDIR;
5350dd7
 wxString RCDIR;
5350dd7
 wxString HELPDIR;
5350dd7
 
5350dd7
-#ifdef __WXGTK20__
5350dd7
-int MAINTOOLBARWIDTH = 38;
5350dd7
-#else
5350dd7
-int MAINTOOLBARWIDTH = 30;
5350dd7
-#endif
5350dd7
-
5350dd7
-
5350dd7
 size_t MAX_COMMAND_HISTORY = 25;            // How many recent commands from eg grep or locate, should be stored
5350dd7
 wxArrayString FilterHistory;
5350dd7
 
5350dd7
-- 
5350dd7
2.1.0
5350dd7