Port matrix tweaks: scroll wheel support; use the correct verb for disassociation...
authorCarl Hetherington <carl@carlh.net>
Sun, 19 Jul 2009 19:07:31 +0000 (19:07 +0000)
committerCarl Hetherington <carl@carlh.net>
Sun, 19 Jul 2009 19:07:31 +0000 (19:07 +0000)
git-svn-id: svn://localhost/ardour2/branches/3.0@5382 d708f5d6-7413-0410-9779-e7cbd77b26cf

gtk2_ardour/bundle_manager.h
gtk2_ardour/global_port_matrix.h
gtk2_ardour/io_selector.h
gtk2_ardour/port_matrix.cc
gtk2_ardour/port_matrix.h
gtk2_ardour/port_matrix_body.cc
gtk2_ardour/port_matrix_column_labels.cc
gtk2_ardour/port_matrix_grid.cc
gtk2_ardour/port_matrix_row_labels.cc
gtk2_ardour/route_params_ui.cc
gtk2_ardour/session_option_editor.cc

index 2d0f41e10e816733550aa5a163fa570717c3bfd2..035bc6ffac686311770877e75da787d6f528cb88 100644 (file)
@@ -25,6 +25,7 @@
 #include <gtkmm/entry.h>
 #include "ardour_dialog.h"
 #include "port_matrix.h"
+#include "i18n.h"
 
 namespace ARDOUR {
        class Session;
@@ -50,6 +51,10 @@ class BundleEditorMatrix : public PortMatrix
        void setup_ports (int);
        bool list_is_global (int) const;
 
+       std::string disassociation_verb () const {
+               return _("Disassociate");
+       }
+
   private:
        enum {
                OTHER = 0,
index 0e5fb02dc5fee47e10dee5a3538401f2f052a848..1372c651f1d1e7fcef1e91da767da5b81cbc8bb0 100644 (file)
@@ -24,6 +24,7 @@
 #include "port_matrix.h"
 #include "port_group.h"
 #include "ardour_dialog.h"
+#include "i18n.h"
 
 class GlobalPortMatrix : public PortMatrix
 {
@@ -44,6 +45,10 @@ public:
                return false;
        }
 
+       std::string disassociation_verb () const {
+               return _("Disconnect");
+       }
+       
        bool list_is_global (int) const {
                return true;
        }
index 24e99e27ecd3329101cf3584ade1172733402a58..eccdd91a261082e2a2beaf5a9f6107d37512e0c2 100644 (file)
@@ -22,6 +22,7 @@
 
 #include "ardour_dialog.h"
 #include "port_matrix.h"
+#include "i18n.h"
 
 namespace ARDOUR {
        class PortInsert;
@@ -43,6 +44,10 @@ class IOSelector : public PortMatrix
        bool can_rename_channels (int d) const {
                return false;
        }
+
+       std::string disassociation_verb () const {
+               return _("Disconnect");
+       }
        
        uint32_t n_io_ports () const;
        boost::shared_ptr<ARDOUR::IO> const io () { return _io; }
@@ -61,7 +66,6 @@ class IOSelector : public PortMatrix
                return _other;
        }
 
-
   private:
        
        int _other;
index 8727c1f6776d10100c493850a8f4fd5006573ed2..001d06081f580f9caadcd44b37d7ab619351c449 100644 (file)
@@ -30,6 +30,7 @@
 #include "ardour/route.h"
 #include "port_matrix.h"
 #include "port_matrix_body.h"
+#include "port_matrix_component.h"
 #include "i18n.h"
 
 using namespace std;
@@ -319,11 +320,13 @@ PortMatrix::popup_menu (
                        boost::weak_ptr<ARDOUR::Bundle> w (bc[dim].bundle);
 
                        if (_show_only_bundles) {
-                               snprintf (buf, sizeof (buf), _("Disassociate all from '%s'"), bc[dim].bundle->name().c_str());
+                               snprintf (buf, sizeof (buf), _("%s all from '%s'"), disassociation_verb().c_str(), bc[dim].bundle->name().c_str());
                        } else {
                                snprintf (
-                                       buf, sizeof (buf), _("Disassociate all from '%s/%s'"),
-                                       bc[dim].bundle->name().c_str(), bc[dim].bundle->channel_name (bc[dim].channel).c_str()
+                                       buf, sizeof (buf), _("%s all from '%s/%s'"),
+                                       disassociation_verb().c_str(),
+                                       bc[dim].bundle->name().c_str(),
+                                       bc[dim].bundle->channel_name (bc[dim].channel).c_str()
                                        );
                        }
                        
@@ -464,3 +467,27 @@ PortMatrix::setup_max_size ()
 {
        MaxSizeChanged ();
 }
+
+bool
+PortMatrix::on_scroll_event (GdkEventScroll* ev)
+{
+       double const h = _hscroll.get_value ();
+       double const v = _vscroll.get_value ();
+       
+       switch (ev->direction) {
+       case GDK_SCROLL_UP:
+               _vscroll.set_value (v - PortMatrixComponent::grid_spacing ());
+               break;
+       case GDK_SCROLL_DOWN:
+               _vscroll.set_value (v + PortMatrixComponent::grid_spacing ());
+               break;
+       case GDK_SCROLL_LEFT:
+               _hscroll.set_value (h - PortMatrixComponent::grid_spacing ());
+               break;
+       case GDK_SCROLL_RIGHT:
+               _hscroll.set_value (h + PortMatrixComponent::grid_spacing ());
+               break;
+       }
+
+       return true;
+}
index 4d103bf3698d4cbae9d55fd5cce1be0e40288004..885745aa6a17562387db466b34dab81000b09d5e 100644 (file)
@@ -129,6 +129,7 @@ public:
        virtual void remove_channel (ARDOUR::BundleChannel) = 0;
        virtual bool can_rename_channels (int) const = 0;
        virtual void rename_channel (ARDOUR::BundleChannel) {}
+       virtual std::string disassociation_verb () const = 0;
        
        enum Result {
                Cancelled,
@@ -162,6 +163,7 @@ private:
        void hide_group (boost::weak_ptr<PortGroup>);
        void show_group (boost::weak_ptr<PortGroup>);
        void toggle_show_only_bundles ();
+       bool on_scroll_event (GdkEventScroll *);
 
        /// port type that we are working with
        ARDOUR::DataType _type;
index 93345e893e939289d068484a57a1324df55d765f..f61593d540b671e1bcd165e02936947b8bb7d769 100644 (file)
@@ -210,7 +210,7 @@ PortMatrixBody::compute_rectangles ()
        } else if (_matrix->arrangement() == PortMatrix::LEFT_TO_BOTTOM) {
 
                col_rect.set_height (min (_alloc_height, col.second));
-               
+
                row_rect.set_x (0);
                row_rect.set_y (0);
                row_rect.set_width (min (_alloc_width, row.first));
index 3183d96a9d7998e626b4e4ed50e4c2dad8b6e35f..1679b321df0a0d07980e07c6afc72b55ec039b07 100644 (file)
@@ -49,26 +49,30 @@ PortMatrixColumnLabels::compute_dimensions ()
        _highest_text = 0;
        /* width of the whole thing */
        _width = 0;
-
-       PortGroup::BundleList const c = _matrix->columns()->bundles();
-       for (PortGroup::BundleList::const_iterator i = c.begin (); i != c.end(); ++i) {
-
-               cairo_text_extents_t ext;
-               cairo_text_extents (cr, i->bundle->name().c_str(), &ext);
-               if (ext.width > _longest_bundle_name) {
-                       _longest_bundle_name = ext.width;
-               }
-               if (ext.height > _highest_text) {
-                       _highest_text = ext.height;
-               }
-
-               for (uint32_t j = 0; j < i->bundle->nchannels (); ++j) {
+       _highest_group_name = 0;
+       
+       for (PortGroupList::List::const_iterator i = _matrix->columns()->begin(); i != _matrix->columns()->end(); ++i) {
+               PortGroup::BundleList const c = _matrix->columns()->bundles();
+               for (PortGroup::BundleList::const_iterator j = c.begin (); j != c.end(); ++j) {
                        
-                       cairo_text_extents (
-                               cr,
-                               i->bundle->channel_name (j).c_str(),
-                               &ext
-                               );
+                       cairo_text_extents_t ext;
+                       cairo_text_extents (cr, j->bundle->name().c_str(), &ext);
+                       if (ext.width > _longest_bundle_name) {
+                               _longest_bundle_name = ext.width;
+                       }
+                       
+                       if (ext.height > _highest_text) {
+                               _highest_text = ext.height;
+                       }
+                       
+                       for (uint32_t k = 0; k < j->bundle->nchannels (); ++k) {
+
+                               cairo_text_extents (
+                                       cr,
+                                       j->bundle->channel_name (k).c_str(),
+                                       &ext
+                                       );
+                       }
                        
                        if (ext.width > _longest_channel_name) {
                                _longest_channel_name = ext.width;
@@ -78,23 +82,12 @@ PortMatrixColumnLabels::compute_dimensions ()
                        }
                }
 
-               if (_matrix->show_only_bundles()) {
-                       _width += grid_spacing();
-               } else {
-                       _width += i->bundle->nchannels() * grid_spacing();
-               }
-       }
+               _width += group_size (*i) * grid_spacing ();
 
-       _highest_group_name = 0;
-       for (PortGroupList::List::const_iterator i = _matrix->columns()->begin(); i != _matrix->columns()->end(); ++i) {
-               if ((*i)->visible()) {
-                       cairo_text_extents_t ext;
-                       cairo_text_extents (cr, (*i)->name.c_str(), &ext);
-                       if (ext.height > _highest_group_name) {
-                               _highest_group_name = ext.height;
-                       }
-               } else {
-                       _width += grid_spacing ();
+               cairo_text_extents_t ext;
+               cairo_text_extents (cr, (*i)->name.c_str(), &ext);
+               if (ext.height > _highest_group_name) {
+                       _highest_group_name = ext.height;
                }
        }
 
index 66bf09aaa72f56bc9f3e022936f1b9b2b3d0e6ea..feaf6b1222dcd7d2bab8f82119eef960ca2a68b7 100644 (file)
@@ -39,6 +39,7 @@ void
 PortMatrixGrid::compute_dimensions ()
 {
        _width = 0;
+
        for (PortGroupList::List::const_iterator i = _matrix->columns()->begin(); i != _matrix->columns()->end(); ++i) {
                _width += group_size (*i) * grid_spacing ();
        }
index 00806b36a52a095337f72ccbdd0c13caf3c2f3da..7b4383155d2bc2a925d97c17b0e38a17df37b447 100644 (file)
@@ -45,44 +45,37 @@ PortMatrixRowLabels::compute_dimensions ()
        _longest_port_name = 0;
        _longest_bundle_name = 0;
        _height = 0;
+       _highest_group_name = 0;
+
+       for (PortGroupList::List::const_iterator i = _matrix->rows()->begin(); i != _matrix->rows()->end(); ++i) {
+               
+               PortGroup::BundleList const r = (*i)->bundles ();
+               for (PortGroup::BundleList::const_iterator j = r.begin(); j != r.end(); ++j) {
+                       
+                       for (uint32_t k = 0; k < j->bundle->nchannels(); ++k) {
+                               cairo_text_extents_t ext;
+                               cairo_text_extents (cr, j->bundle->channel_name(k).c_str(), &ext);
+                               if (ext.width > _longest_port_name) {
+                                       _longest_port_name = ext.width;
+                               }
+                       }
 
-       PortGroup::BundleList const r = _matrix->rows()->bundles();
-       for (PortGroup::BundleList::const_iterator i = r.begin(); i != r.end(); ++i) {
-               for (uint32_t j = 0; j < i->bundle->nchannels(); ++j) {
                        cairo_text_extents_t ext;
-                       cairo_text_extents (cr, i->bundle->channel_name(j).c_str(), &ext);
-                       if (ext.width > _longest_port_name) {
-                               _longest_port_name = ext.width;
+                       cairo_text_extents (cr, j->bundle->name().c_str(), &ext);
+                       if (ext.width > _longest_bundle_name) {
+                               _longest_bundle_name = ext.width;
                        }
                }
 
+               _height += group_size (*i) * grid_spacing ();
+               
                cairo_text_extents_t ext;
-               cairo_text_extents (cr, i->bundle->name().c_str(), &ext);
-               if (ext.width > _longest_bundle_name) {
-                       _longest_bundle_name = ext.width;
-               }
-
-               if (_matrix->show_only_bundles()) {
-                       _height += grid_spacing ();
-               } else {
-                       _height += i->bundle->nchannels() * grid_spacing();
+               cairo_text_extents (cr, (*i)->name.c_str(), &ext);
+               if (ext.height > _highest_group_name) {
+                       _highest_group_name = ext.height;
                }
        }
 
-       _highest_group_name = 0;
-       for (PortGroupList::List::const_iterator i = _matrix->rows()->begin(); i != _matrix->rows()->end(); ++i) {
-               if ((*i)->visible()) {
-                       cairo_text_extents_t ext;
-                       cairo_text_extents (cr, (*i)->name.c_str(), &ext);
-                       if (ext.height > _highest_group_name) {
-                               _highest_group_name = ext.height;
-                       }
-               } else {
-                       /* add another grid_spacing for a tab for this hidden group */
-                       _height += grid_spacing ();
-               }
-       }
-                       
        cairo_destroy (cr);
        gdk_pixmap_unref (pm);
 
index 245b0019dc483f1d635a95ba0ba6b083e645da0c..aadd7ccdeedd32c600be394351a1bec694940252 100644 (file)
@@ -511,8 +511,6 @@ RouteParams_UI::show_track_menu()
 void
 RouteParams_UI::redirect_selected (boost::shared_ptr<ARDOUR::Processor> insert)
 {
-       Placement place = PreFader;
-       
        boost::shared_ptr<Send> send;
        boost::shared_ptr<Return> retrn;
        boost::shared_ptr<PluginInsert> plugin_insert;
index 09138f428ecbb5d281ee4773383238e04f5d036e..5defe27e9d3e1dfe9d5f26358f9bc444070539cf 100644 (file)
@@ -101,6 +101,10 @@ public:
        bool can_rename_channels (int) const {
                return false;
        }
+
+       std::string disassociation_verb () const {
+               return _("Disassociate");
+       }
        
 private:
        /* see PortMatrix: signal flow from 0 to 1 (out to in) */