Fix port matrix menu checkbox when the window is closed. Make the port matrix origin...
authorCarl Hetherington <carl@carlh.net>
Tue, 24 Aug 2010 13:28:27 +0000 (13:28 +0000)
committerCarl Hetherington <carl@carlh.net>
Tue, 24 Aug 2010 13:28:27 +0000 (13:28 +0000)
git-svn-id: svn://localhost/ardour2/branches/3.0@7673 d708f5d6-7413-0410-9779-e7cbd77b26cf

gtk2_ardour/ardour_ui_ed.cc
gtk2_ardour/port_matrix.cc
gtk2_ardour/port_matrix_body.cc
libs/gtkmm2ext/actions.cc
libs/gtkmm2ext/gtkmm2ext/actions.h

index 4f1f98075110ba641f946e71d68e1b784cdacb31..e493de0be2c825909a16bae72dd56cce5a19c7ec 100644 (file)
@@ -751,14 +751,22 @@ ARDOUR_UI::save_ardour_state ()
 void
 ARDOUR_UI::toggle_global_port_matrix (ARDOUR::DataType t)
 {
+       std::string const action = string_compose ("toggle-%1-connection-manager", t.to_string ());
+       
        if (_global_port_matrix[t]->get() == 0) {
                _global_port_matrix[t]->set (new GlobalPortMatrixWindow (_session, t));
+               _global_port_matrix[t]->get()->signal_unmap().connect(sigc::bind (sigc::ptr_fun (&ActionManager::uncheck_toggleaction), string_compose (X_("<Actions>/Common/%1"), action)));
        }
 
-       if (_global_port_matrix[t]->get()->is_visible ()) {
-               _global_port_matrix[t]->get()->hide ();
-       } else {
-               _global_port_matrix[t]->get()->present ();
+       RefPtr<Action> act = ActionManager::get_action (X_("Common"), action.c_str());
+       if (act) {
+               RefPtr<ToggleAction> tact = RefPtr<ToggleAction>::cast_dynamic (act);
+
+               if (tact->get_active()) {
+                       _global_port_matrix[t]->get()->present ();
+               } else {
+                       _global_port_matrix[t]->get()->hide ();
+               }
        }
 }
 
index f3559cbb21374d8f853827370181e57cfbe0dbf4..3be545897341fd86cf5a186086f031c16e9b88c5 100644 (file)
@@ -787,7 +787,16 @@ PortMatrix::body_dimensions_changed ()
                _vspacer.hide ();
        }
 
-       pair<uint32_t, uint32_t> const m = max_size ();
+       int curr_width;
+       int curr_height;
+       _parent->get_size (curr_width, curr_height);
+
+       pair<uint32_t, uint32_t> m = max_size ();
+
+       /* Don't shrink the window */
+       m.first = max (int (m.first), curr_width);
+       m.second = max (int (m.second), curr_height);
+       
        resize_window_to_proportion_of_monitor (_parent, m.first, m.second);
 }
 
index 73eae929b9d2eacb998c971d46d89ad550e82ac8..009c63fa2a8cee4283068693938223dcaef65993 100644 (file)
@@ -223,21 +223,21 @@ PortMatrixBody::compute_rectangles ()
        } else if (_matrix->arrangement() == PortMatrix::LEFT_TO_BOTTOM) {
 
                col_rect.set_height (min (_alloc_height, col.second));
+               row_rect.set_height (std::min (_alloc_height - col_rect.get_height(), row.second));
 
                row_rect.set_x (0);
-               row_rect.set_y (0);
+               row_rect.set_y (_alloc_height - row_rect.get_height() - col_rect.get_height());
                row_rect.set_width (min (_alloc_width, row.first));
-               row_rect.set_height (std::min (_alloc_height - col_rect.get_height(), row.second));
 
                grid_rect.set_x (row_rect.get_width());
-               grid_rect.set_y (0);
+               grid_rect.set_y (_alloc_height - row_rect.get_height() - col_rect.get_height());
                grid_rect.set_width (std::min (_alloc_width - row_rect.get_width(), grid.first));
                grid_rect.set_height (row_rect.get_height ());
 
                col_rect.set_width (grid_rect.get_width () + col_overhang);
                col_rect.set_x (row_rect.get_width() + grid_rect.get_width() - col_rect.get_width());
                _column_labels_border_x = col_rect.get_x () >= 0 ? col_rect.get_x () : 0;
-               col_rect.set_y (row_rect.get_height());
+               col_rect.set_y (_alloc_height - col_rect.get_height());
        }
 
        _column_labels_height = col_rect.get_height ();
index bff718e9b74aeed5a9d660aacad164bb56879324..e9ff15fa461f263934cdac1b2ced7713f3920110 100644 (file)
@@ -268,8 +268,10 @@ ActionManager::set_sensitive (vector<RefPtr<Action> >& actions, bool state)
 }
 
 void
-ActionManager::uncheck_toggleaction (const char * name)
+ActionManager::uncheck_toggleaction (string n)
 {
+       char const * name = n.c_str ();
+       
        const char *last_slash = strrchr (name, '/');
 
        if (last_slash == 0) {
index 5616bbb302f0a99f87b4d24b795ce75bcf0508cb..da19015313d6ee46b4e0727e7d8e6f7403e8ca6e 100644 (file)
@@ -77,7 +77,7 @@ namespace ActionManager {
                                     std::vector<std::string>& paths,
                                     std::vector<Gtk::AccelKey>& bindings);
 
-       extern void uncheck_toggleaction (const char * actionname);
+       extern void uncheck_toggleaction (std::string);
 };
 
 #endif /* __libgtkmm2ext_actions_h__ */