Blob Blame History Raw
From 712bf13e3fb2039cde3b4ee0c2d8c2e49f003a02 Mon Sep 17 00:00:00 2001
From: dghart <dghart@users.sourceforge.net>
Date: Sun, 21 Dec 2014 15:20:02 +0000
Subject: [PATCH 1/2] Make the toolbar the correct size for its tools in gtk3
 builds too

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!
Fixed by removing that old code, and allowing the toolbar to size itself naturally.
---
 Externs.h   | 2 --
 MyFrame.cpp | 4 ++--
 Redo.cpp    | 4 ++--
 config.h    | 7 -------
 4 files changed, 4 insertions(+), 13 deletions(-)

diff --git a/Externs.h b/Externs.h
index c5213c2..2f0223d 100644
--- a/Externs.h
+++ b/Externs.h
@@ -86,8 +86,6 @@ extern wxString BITMAPSDIR;
 extern wxString RCDIR;
 extern wxString HELPDIR;
 
-extern int MAINTOOLBARWIDTH;
-
 extern wxWindowID NextID;
 
 #if defined(__WXGTK20__)
diff --git a/MyFrame.cpp b/MyFrame.cpp
index ebae40f..757c043 100644
--- a/MyFrame.cpp
+++ b/MyFrame.cpp
@@ -547,7 +547,7 @@ CreateMenuBar(MenuBar); SetMenuBar(MenuBar);
 
 toolbar = NULL; LoadToolbarButtons();  // Toolbar pt1
 
-panelette = new wxPanel(this, -1, wxDefaultPosition, wxSize(-1,MAINTOOLBARWIDTH), wxTAB_TRAVERSAL, wxT("TBPanel"));  // & pt2, for MyBitmapButtons
+panelette = new wxPanel(this, -1, wxDefaultPosition, wxDefaultSize, wxTAB_TRAVERSAL, wxT("TBPanel"));  // & pt2, for MyBitmapButtons
 sizerTB = new wxBoxSizer(wxHORIZONTAL);
 sizerTB->Add(toolbar, 0, wxEXPAND);
 sizerTB->Add(panelette, 1, wxEXPAND);
@@ -666,7 +666,7 @@ if (recreating)
     toolbar->Destroy();
   }
 
-toolbar = new wxToolBar(this, ID_FRAMETOOLBAR ,wxPoint(0,0), wxSize(-1,MAINTOOLBARWIDTH));
+toolbar = new wxToolBar(this, ID_FRAMETOOLBAR);
 
 wxBitmap toolBarBitmaps[8];
 
diff --git a/Redo.cpp b/Redo.cpp
index f3cc6bc..f55928e 100644
--- a/Redo.cpp
+++ b/Redo.cpp
@@ -295,7 +295,7 @@ int offset = 0;                                 // This copes with displays of >
 
     // 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.
 wxPoint pt;                     // The solution is to cheat, & place it where calcs say it ought to be.  This may fail on future resizes etc
-pt.y = MAINTOOLBARWIDTH + 2;    // The y pos could be anywhere within the button, so replace with the known toolbar-width, plus a fiddle-factor
+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
 pt.x = (MyFrame::mainframe->buttonsbeforesidebar * 30) + (MyFrame::mainframe->separatorsbeforesidebar * 7);  // & we counted the tools as we inserted them
 
 do
@@ -379,7 +379,7 @@ int offset = 0;                             // This copes with displays of >1 pa
 
     // 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.
 wxPoint pt;                     // The solution is to cheat, & place it where calcs say it ought to be.  This may fail on future resizes etc
-pt.y = MAINTOOLBARWIDTH + 2;    // The y pos could be anywhere within the button, so replace with the known toolbar-width, plus a fiddle-factor
+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
 pt.x = (MyFrame::mainframe->buttonsbeforesidebar * 30) + 30 + 13  // (The extra 30 is for the Undo button, the 13 for the Undo sidebar buttton)
           + (MyFrame::mainframe->separatorsbeforesidebar* 7);     // We counted the other tools as we inserted them
 
diff --git a/config.h b/config.h
index 641d694..b2b7c46 100644
--- a/config.h
+++ b/config.h
@@ -47,13 +47,6 @@ wxString BITMAPSDIR;
 wxString RCDIR;
 wxString HELPDIR;
 
-#ifdef __WXGTK20__
-int MAINTOOLBARWIDTH = 38;
-#else
-int MAINTOOLBARWIDTH = 30;
-#endif
-
-
 size_t MAX_COMMAND_HISTORY = 25;            // How many recent commands from eg grep or locate, should be stored
 wxArrayString FilterHistory;
 
-- 
2.1.0