Bit of a hack to make the port matrix for port inserts at least vaguely usable.
authorCarl Hetherington <carl@carlh.net>
Tue, 10 Feb 2009 02:09:46 +0000 (02:09 +0000)
committerCarl Hetherington <carl@carlh.net>
Tue, 10 Feb 2009 02:09:46 +0000 (02:09 +0000)
git-svn-id: svn://localhost/ardour2/branches/3.0@4516 d708f5d6-7413-0410-9779-e7cbd77b26cf

gtk2_ardour/io_selector.cc
gtk2_ardour/port_matrix.cc
gtk2_ardour/port_matrix.h
gtk2_ardour/port_matrix_body.cc

index 76892dcd3ddc48cbd8f26a9d25391ee97e0d97b5..e868a6ad2bcf53f6642ff149f9430d97f3cac54b 100644 (file)
@@ -347,6 +347,9 @@ PortInsertUI::PortInsertUI (ARDOUR::Session& sess, boost::shared_ptr<ARDOUR::Por
        : input_selector (sess, pi->io(), true),
          output_selector (sess, pi->io(), false)
 {
+       output_selector.set_min_height_divisor (2);
+       input_selector.set_min_height_divisor (2);
+       
        pack_start (output_selector, true, true);
        pack_start (input_selector, true, true);
 }
index 1c00fb89945c72926a7fc3685fdb9639e482ff8e..63779a6083c210c3733c93d05493e4af50dbb68b 100644 (file)
@@ -45,7 +45,8 @@ PortMatrix::PortMatrix (ARDOUR::Session& session, ARDOUR::DataType type)
          _setup_once (false),
          _arrangement (TOP_TO_RIGHT),
          _row_index (0),
-         _column_index (1)
+         _column_index (1),
+         _min_height_divisor (1)
 {
        _body = new PortMatrixBody (this);
 
@@ -494,7 +495,6 @@ PortMatrix::setup_global_ports ()
        }
 }
 
-       
 void
 PortMatrix::setup_all_ports ()
 {
index 8514306544066d5397fb86cc69c9987c669f0254..d397c5df05a9b9da8f2bd56a1694a15293ae626c 100644 (file)
@@ -61,6 +61,13 @@ public:
        void setup_scrollbars ();
        void popup_channel_context_menu (int, uint32_t, uint32_t);
 
+       int min_height_divisor () const {
+               return _min_height_divisor;
+       }
+       void set_min_height_divisor (int f) {
+               _min_height_divisor = f;
+       }
+
        enum Arrangement {
                TOP_TO_RIGHT,  ///< column labels on top, row labels to the right
                LEFT_TO_BOTTOM ///< row labels to the left, column labels on the bottom
@@ -169,6 +176,7 @@ private:
        Arrangement _arrangement;
        int _row_index;
        int _column_index;
+       int _min_height_divisor;
 };
 
 #endif
index 3f8fcdc0c6a8bf869465afd8978b92feb0a3e138..205e6d4bdd9934116784ca38c756c3530d538d3e 100644 (file)
@@ -146,8 +146,12 @@ PortMatrixBody::on_size_request (Gtk::Requisition *req)
        /* don't ask for the maximum size of our contents, otherwise GTK won't
           let the containing window shrink below this size */
 
-       req->width = std::min (512, std::max (col.first, grid.first + row.first));
-       req->height = std::min (512, col.second + grid.second);
+       /* XXX these shouldn't be hard-coded */
+       int const min_width = 512;
+       int const min_height = 512;
+
+       req->width = std::min (min_width, std::max (col.first, grid.first + row.first));
+       req->height = std::min (min_height / _matrix->min_height_divisor(), col.second + grid.second);
 }
 
 void