13
0

Substantially simpler fix for editor window jumping.

git-svn-id: svn://localhost/ardour2/branches/3.0@8418 d708f5d6-7413-0410-9779-e7cbd77b26cf
This commit is contained in:
Carl Hetherington 2011-01-03 16:23:58 +00:00
parent c78c14c3df
commit 544d8f33c8
5 changed files with 6 additions and 67 deletions

View 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));
}

View 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 */

View File

@ -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 &);
};
}

View File

@ -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);
}
}

View File

@ -51,7 +51,6 @@ gtkmm2ext_sources = [
'tearoff.cc',
'textviewer.cc',
'treeutils.cc',
'trimming_bin.cc',
'utils.cc',
'version.cc',
'window_title.cc'