Modify hacks associated with initial sizing of port matrices to try and make things work with both fluxbox and metacity.

git-svn-id: svn://localhost/ardour2/branches/3.0@5604 d708f5d6-7413-0410-9779-e7cbd77b26cf
This commit is contained in:
Carl Hetherington 2009-08-29 20:48:11 +00:00
parent 94c5a98e02
commit 7c49119be0
10 changed files with 36 additions and 28 deletions

View File

@ -29,6 +29,7 @@
#include "ardour/audioengine.h"
#include "bundle_manager.h"
#include "i18n.h"
#include "utils.h"
using namespace std;
using namespace ARDOUR;
@ -227,8 +228,14 @@ BundleEditor::BundleEditor (Session& session, boost::shared_ptr<UserBundle> bund
}
show_all ();
}
resize (32768, 32768);
void
BundleEditor::on_show ()
{
Gtk::Window::on_show ();
pair<uint32_t, uint32_t> const pm_max = _matrix.max_size ();
resize_window_to_proportion_of_monitor (this, pm_max.first, pm_max.second);
}
void
@ -403,7 +410,6 @@ BundleManager::bundle_changed (Bundle::Change c, boost::shared_ptr<UserBundle> b
}
}
NameChannelDialog::NameChannelDialog ()
: ArdourDialog (_("Add channel")),
_adding (true)
@ -447,3 +453,4 @@ NameChannelDialog::get_name () const
{
return _name.get_text ();
}

View File

@ -76,6 +76,7 @@ class BundleEditor : public ArdourDialog
void name_changed ();
void input_or_output_changed ();
void type_changed ();
void on_show ();
BundleEditorMatrix _matrix;
boost::shared_ptr<ARDOUR::UserBundle> _bundle;

View File

@ -20,6 +20,7 @@
#include <gtkmm/image.h>
#include <gtkmm/stock.h>
#include "global_port_matrix.h"
#include "utils.h"
#include "ardour/bundle.h"
#include "ardour/session.h"
@ -123,16 +124,12 @@ GlobalPortMatrixWindow::GlobalPortMatrixWindow (ARDOUR::Session& s, ARDOUR::Data
add (_port_matrix);
show_all ();
/* XXX: hack to make the window full-size on opening. This may not work for
people with very large monitors */
resize (32768, 32768);
}
void
GlobalPortMatrixWindow::on_show ()
{
Gtk::Window::on_show ();
_port_matrix.setup_max_size ();
pair<uint32_t, uint32_t> const pm_max = _port_matrix.max_size ();
resize_window_to_proportion_of_monitor (this, pm_max.first, pm_max.second);
}

View File

@ -166,8 +166,6 @@ IOSelectorWindow::IOSelectorWindow (ARDOUR::Session& session, boost::shared_ptr<
show_all ();
signal_delete_event().connect (bind (sigc::ptr_fun (just_hide_it), this));
resize (32768, 32768);
}
void
@ -177,6 +175,14 @@ IOSelectorWindow::on_map ()
Window::on_map ();
}
void
IOSelectorWindow::on_show ()
{
Gtk::Window::on_show ();
pair<uint32_t, uint32_t> const pm_max = _selector.max_size ();
resize_window_to_proportion_of_monitor (this, pm_max.first, pm_max.second);
}
void
IOSelectorWindow::io_name_changed (void* src)
{

View File

@ -79,6 +79,7 @@ class IOSelectorWindow : public Gtk::Window
protected:
void on_map ();
void on_show ();
private:
IOSelector _selector;

View File

@ -500,22 +500,6 @@ PortMatrix::max_size () const
return m;
}
void
PortMatrix::setup_max_size ()
{
if (!_parent) {
return;
}
pair<uint32_t, uint32_t> const m = max_size ();
GdkGeometry g;
g.max_width = m.first;
g.max_height = m.second;
_parent->set_geometry_hints (*this, g, Gdk::HINT_MAX_SIZE);
}
bool
PortMatrix::on_scroll_event (GdkEventScroll* ev)
{

View File

@ -111,7 +111,6 @@ public:
void setup_all_ports ();
std::pair<uint32_t, uint32_t> max_size () const;
void setup_max_size ();
/** @param c Channels; where c[0] is from _ports[0] and c[1] is from _ports[1].
* @param s New state.

View File

@ -471,7 +471,6 @@ void
PortMatrixBody::component_size_changed ()
{
compute_rectangles ();
_matrix->setup_max_size ();
_matrix->setup_scrollbars ();
}

View File

@ -923,3 +923,16 @@ convert_bgra_to_rgba (guint8 const* src,
src_pixel += 4;
}
}
void
resize_window_to_proportion_of_monitor (Gtk::Window* window, int max_width, int max_height)
{
Glib::RefPtr<Gdk::Screen> screen = window->get_screen ();
Gdk::Rectangle monitor_rect;
screen->get_monitor_geometry (0, monitor_rect);
int const w = std::min (monitor_rect.get_width(), max_width) * 0.8;
int const h = std::min (monitor_rect.get_height(), max_height) * 0.8;
window->resize (w, h);
}

View File

@ -102,5 +102,6 @@ void convert_bgra_to_rgba (guint8 const* src,
int width,
int height);
void resize_window_to_proportion_of_monitor (Gtk::Window*, int, int);
#endif /* __ardour_gtk_utils_h__ */