Substantially simpler fix for editor window jumping.
authorCarl Hetherington <carl@carlh.net>
Mon, 3 Jan 2011 16:23:58 +0000 (16:23 +0000)
committerCarl Hetherington <carl@carlh.net>
Mon, 3 Jan 2011 16:23:58 +0000 (16:23 +0000)
git-svn-id: svn://localhost/ardour2/branches/3.0@8418 d708f5d6-7413-0410-9779-e7cbd77b26cf

gtk2_ardour/editor.cc
gtk2_ardour/editor.h
libs/gtkmm2ext/gtkmm2ext/trimming_bin.h [deleted file]
libs/gtkmm2ext/trimming_bin.cc [deleted file]
libs/gtkmm2ext/wscript

index 8c49af3cf4d897c1c29f59738c7ed69589a5dabd..740e0cca3503a485f1502ca9250782ae8f6d3220 100644 (file)
@@ -265,6 +265,7 @@ Editor::Editor ()
        , automation_mode_button (_("mode"))
        , global_automation_button (_("automation"))
 
+       , _toolbar_viewport (*manage (new Gtk::Adjustment (0, 0, 1e10)), *manage (new Gtk::Adjustment (0, 0, 1e10)))
        , midi_panic_button (_("Panic"))
 
 #ifdef WITH_CMT
@@ -2860,11 +2861,13 @@ Editor::setup_toolbar ()
        toolbar_base.set_name ("ToolBarBase");
        toolbar_base.add (toolbar_hbox);
 
-       _toolbar_trimmer.add (toolbar_base);
+       _toolbar_viewport.add (toolbar_base);
+       /* stick to the required height but allow width to vary if there's not enough room */
+       _toolbar_viewport.set_size_request (1, -1);
 
        toolbar_frame.set_shadow_type (SHADOW_OUT);
        toolbar_frame.set_name ("BaseFrame");
-       toolbar_frame.add (_toolbar_trimmer);
+       toolbar_frame.add (_toolbar_viewport);
         
         DPIReset.connect (sigc::mem_fun (*this, &Editor::resize_text_widgets));
 }
index fb2361048b20dbf126c971490d154715c8a2dbde..8c4b132ec62899b7eb9bfb39d6a3f609e7e5af03 100644 (file)
@@ -42,7 +42,6 @@
 #include "gtkmm2ext/selector.h"
 #include "gtkmm2ext/click_box.h"
 #include "gtkmm2ext/dndtreeview.h"
-#include "gtkmm2ext/trimming_bin.h"
 
 #include "pbd/stateful.h"
 #include "pbd/signals.h"
@@ -1589,7 +1588,7 @@ class Editor : public PublicEditor, public PBD::ScopedConnectionList, public ARD
        Gtk::HBox                toolbar_hbox;
        Gtk::EventBox            toolbar_base;
        Gtk::Frame               toolbar_frame;
-       Gtkmm2ext::TrimmingBin  _toolbar_trimmer;
+       Gtk::Viewport           _toolbar_viewport;
        
        /* midi toolbar */
 
diff --git a/libs/gtkmm2ext/gtkmm2ext/trimming_bin.h b/libs/gtkmm2ext/gtkmm2ext/trimming_bin.h
deleted file mode 100644 (file)
index 4566d71..0000000
+++ /dev/null
@@ -1,24 +0,0 @@
-#include <gtkmm/scrolledwindow.h>
-
-namespace Gtkmm2ext {
-
-/** A somewhat specialised adaption of Gtk::ScrolledWindow which is the same,
- *  except that the scrollbars are never visible.  It is useful for long toolbars
- *  which may not fit horizontally on smaller screens; it lets them extend off the
- *  right-hand side of the screen without causing the parent window to jump around.
- *
- *  It is not the same as a Gtk::ScrolledWindow with policies to never display
- *  scrollbars, as these do not behave as we require in this case.
- *
- *  It is hard-wired to perform as if it were a Gtk::ScrolledWindow with a
- *  vertical scrollbar policy of POLICY_NEVER and a horizontal policy of
- *  POLICY_AUTOMATIC.  This could be generalised.
- */
-class TrimmingBin : public Gtk::ScrolledWindow
-{
-public:
-       void on_size_request (Gtk::Requisition *);
-       void on_size_allocate (Gtk::Allocation &);
-};
-       
-}
diff --git a/libs/gtkmm2ext/trimming_bin.cc b/libs/gtkmm2ext/trimming_bin.cc
deleted file mode 100644 (file)
index 0aba116..0000000
+++ /dev/null
@@ -1,38 +0,0 @@
-#include <iostream>
-#include "gtkmm2ext/trimming_bin.h"
-
-using namespace std;
-using namespace Gtkmm2ext;
-
-void
-TrimmingBin::on_size_request (Gtk::Requisition* r)
-{
-       Gtk::ScrolledWindow::on_size_request (r);
-
-       /* Munge the height request so that it is that of the child;
-          the Gtk::ScrolledWindow's request may include space for
-          a horizontal scrollbar, which we will never show.
-       */
-
-       Gtk::Widget* c = get_child ();
-       if (c && c->is_visible ()) {
-               Gtk::Requisition cr;
-               c->size_request (cr);
-               r->height = cr.height;
-       }
-}
-
-void
-TrimmingBin::on_size_allocate (Gtk::Allocation& a)
-{
-       /* We replace Gtk::ScrolledWindow's on_size_allocate with this
-          which accepts what we are given and forces the child to use
-          the same allocation (which may result in it being shrunk).
-       */
-       
-       set_allocation (a);
-       Widget* c = get_child ();
-       if (c && c->is_visible ()) {
-               c->size_allocate (a);
-       }
-}
index 40896ac3ad023c3a89ea0ff9c6d641d1ee72f583..0425b6614971790205689a2bc007e76114912299 100644 (file)
@@ -51,7 +51,6 @@ gtkmm2ext_sources = [
        'tearoff.cc',
        'textviewer.cc',
         'treeutils.cc',
-       'trimming_bin.cc',
        'utils.cc',
        'version.cc',
        'window_title.cc'