From 7c49119be05c2a0fc324f6a13e91720ac66a5957 Mon Sep 17 00:00:00 2001 From: Carl Hetherington Date: Sat, 29 Aug 2009 20:48:11 +0000 Subject: 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 --- gtk2_ardour/bundle_manager.cc | 11 +++++++++-- gtk2_ardour/bundle_manager.h | 1 + gtk2_ardour/global_port_matrix.cc | 9 +++------ gtk2_ardour/io_selector.cc | 10 ++++++++-- gtk2_ardour/io_selector.h | 1 + gtk2_ardour/port_matrix.cc | 16 ---------------- gtk2_ardour/port_matrix.h | 1 - gtk2_ardour/port_matrix_body.cc | 1 - gtk2_ardour/utils.cc | 13 +++++++++++++ gtk2_ardour/utils.h | 1 + 10 files changed, 36 insertions(+), 28 deletions(-) (limited to 'gtk2_ardour') diff --git a/gtk2_ardour/bundle_manager.cc b/gtk2_ardour/bundle_manager.cc index d406dfe5f2..ba62d73f0e 100644 --- a/gtk2_ardour/bundle_manager.cc +++ b/gtk2_ardour/bundle_manager.cc @@ -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 bund } show_all (); +} - resize (32768, 32768); +void +BundleEditor::on_show () +{ + Gtk::Window::on_show (); + pair 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 b } } - NameChannelDialog::NameChannelDialog () : ArdourDialog (_("Add channel")), _adding (true) @@ -447,3 +453,4 @@ NameChannelDialog::get_name () const { return _name.get_text (); } + diff --git a/gtk2_ardour/bundle_manager.h b/gtk2_ardour/bundle_manager.h index 2be459c610..dd4c711d4e 100644 --- a/gtk2_ardour/bundle_manager.h +++ b/gtk2_ardour/bundle_manager.h @@ -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 _bundle; diff --git a/gtk2_ardour/global_port_matrix.cc b/gtk2_ardour/global_port_matrix.cc index 3e8eea8866..be809e44bd 100644 --- a/gtk2_ardour/global_port_matrix.cc +++ b/gtk2_ardour/global_port_matrix.cc @@ -20,6 +20,7 @@ #include #include #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 const pm_max = _port_matrix.max_size (); + resize_window_to_proportion_of_monitor (this, pm_max.first, pm_max.second); } diff --git a/gtk2_ardour/io_selector.cc b/gtk2_ardour/io_selector.cc index 2b7038e61e..963b03ba3f 100644 --- a/gtk2_ardour/io_selector.cc +++ b/gtk2_ardour/io_selector.cc @@ -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 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) { diff --git a/gtk2_ardour/io_selector.h b/gtk2_ardour/io_selector.h index adf5bb97f6..83050e2a5c 100644 --- a/gtk2_ardour/io_selector.h +++ b/gtk2_ardour/io_selector.h @@ -79,6 +79,7 @@ class IOSelectorWindow : public Gtk::Window protected: void on_map (); + void on_show (); private: IOSelector _selector; diff --git a/gtk2_ardour/port_matrix.cc b/gtk2_ardour/port_matrix.cc index 81a62d52c8..d9eea649e9 100644 --- a/gtk2_ardour/port_matrix.cc +++ b/gtk2_ardour/port_matrix.cc @@ -500,22 +500,6 @@ PortMatrix::max_size () const return m; } -void -PortMatrix::setup_max_size () -{ - if (!_parent) { - return; - } - - pair 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) { diff --git a/gtk2_ardour/port_matrix.h b/gtk2_ardour/port_matrix.h index 3a1515cef3..b3d94055eb 100644 --- a/gtk2_ardour/port_matrix.h +++ b/gtk2_ardour/port_matrix.h @@ -111,7 +111,6 @@ public: void setup_all_ports (); std::pair 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. diff --git a/gtk2_ardour/port_matrix_body.cc b/gtk2_ardour/port_matrix_body.cc index f61593d540..08849ee165 100644 --- a/gtk2_ardour/port_matrix_body.cc +++ b/gtk2_ardour/port_matrix_body.cc @@ -471,7 +471,6 @@ void PortMatrixBody::component_size_changed () { compute_rectangles (); - _matrix->setup_max_size (); _matrix->setup_scrollbars (); } diff --git a/gtk2_ardour/utils.cc b/gtk2_ardour/utils.cc index 5e5534222e..a5dcd72438 100644 --- a/gtk2_ardour/utils.cc +++ b/gtk2_ardour/utils.cc @@ -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 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); +} diff --git a/gtk2_ardour/utils.h b/gtk2_ardour/utils.h index 5e0c3b53c2..0df04cb0f8 100644 --- a/gtk2_ardour/utils.h +++ b/gtk2_ardour/utils.h @@ -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__ */ -- cgit v1.2.3