Desensitize playlist menu with >1 selected tracks.
[ardour.git] / gtk2_ardour / itest.cc
index 7938f6c6e7da32691d8d314351dac7c6a3cc60c8..db6ede0fd2f29bfdd62823ee843f173e0c91c3ae 100644 (file)
@@ -1,3 +1,22 @@
+/*
+    Copyright (C) 2000-2007 Paul Davis
+
+    This program is free software; you can redistribute it and/or modify
+    it under the terms of the GNU General Public License as published by
+    the Free Software Foundation; either version 2 of the License, or
+    (at your option) any later version.
+
+    This program is distributed in the hope that it will be useful,
+    but WITHOUT ANY WARRANTY; without even the implied warranty of
+    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+    GNU General Public License for more details.
+
+    You should have received a copy of the GNU General Public License
+    along with this program; if not, write to the Free Software
+    Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+
+*/
+
 #include <map>
 #include <vector>
 #include <string>
 #include <jack/jack.h>
 
 using namespace std;
-using namespace sigc;
 using namespace Gtk;
 using namespace Gtkmm2ext;
 using namespace Glib;
 
 struct ModelColumns : public TreeModel::ColumnRecord {
-    ModelColumns() { 
+    ModelColumns() {
            add (used);
            add (text);
            add (port);
     }
     TreeModelColumn<bool>         used;
-    TreeModelColumn<ustring>      text;
+    TreeModelColumn<string>      text;
     TreeModelColumn<jack_port_t*> port;
 };
 
@@ -41,12 +59,12 @@ fill_it (RefPtr<TreeStore> model, TreeView* display, ModelColumns* columns)
        display->set_model (RefPtr<TreeStore>(0));
 
        model->clear ();
-       
+
        const char ** ports;
        typedef map<string,vector<pair<string,string> > > PortMap;
        PortMap portmap;
        PortMap::iterator i;
-       
+
        ports = jack_get_ports (jack, "", JACK_DEFAULT_AUDIO_TYPE, JackPortIsOutput);
 
        if (ports == 0) {
@@ -54,7 +72,7 @@ fill_it (RefPtr<TreeStore> model, TreeView* display, ModelColumns* columns)
        }
 
        /* find all the client names and group their ports into a list-by-client */
-       
+
        for (int n = 0; ports[n]; ++n) {
 
                pair<string,vector<pair<string,string> > > newpair;
@@ -67,10 +85,10 @@ fill_it (RefPtr<TreeStore> model, TreeView* display, ModelColumns* columns)
 
                pos = str.find (':');
 
-               newpair.first = str.substr (0, pos); 
+               newpair.first = str.substr (0, pos);
                portname = str.substr (pos+1);
 
-               /* this may or may not succeed at actually inserting. 
+               /* this may or may not succeed at actually inserting.
                   we don't care, however: we just want an iterator
                   that gives us either the inserted element or
                   the existing one with the same name.
@@ -98,7 +116,7 @@ fill_it (RefPtr<TreeStore> model, TreeView* display, ModelColumns* columns)
                for (vector<pair<string,string> >::iterator s = i->second.begin(); s != i->second.end(); ++s) {
 
                        /* s->first is a port name */
-                       
+
                        TreeModel::Row row = *(model->append (parent.children()));
 
                        row[columns->used] = ((random()%2) == 1);
@@ -153,17 +171,17 @@ main (int argc, char* argv[])
 
        RefPtr<TreeStore> modelA = TreeStore::create (columns);
        RefPtr<TreeStore> modelB = TreeStore::create (columns);
-       
+
        displayA.set_model (modelA);
        displayA.append_column ("Use", columns.used);
        displayA.append_column ("Source/Port", columns.text);
        displayA.set_reorderable (true);
        displayA.add_object_drag (columns.port.index(), "ports");
        displayA.signal_object_drop.connect (ptr_fun (object_drop));
-       
+
        displayA.get_selection()->set_mode (SELECTION_MULTIPLE);
-       displayA.get_selection()->set_select_function (bind (ptr_fun (selection_filter), &columns));
-       displayA.get_selection()->signal_changed().connect (bind (ptr_fun (selection_changed), modelA, &displayA, &columns));
+       displayA.get_selection()->set_select_function (sigc::bind (ptr_fun (selection_filter), &columns));
+       displayA.get_selection()->signal_changed().connect (sigc::bind (ptr_fun (selection_changed), modelA, &displayA, &columns));
 
        displayB.set_model (modelB);
        displayB.append_column ("Use", columns.used);
@@ -173,8 +191,8 @@ main (int argc, char* argv[])
        displayB.signal_object_drop.connect (ptr_fun (object_drop));
 
        displayB.get_selection()->set_mode (SELECTION_MULTIPLE);
-       displayB.get_selection()->set_select_function (bind (ptr_fun (selection_filter), &columns));
-       displayB.get_selection()->signal_changed().connect (bind (ptr_fun (selection_changed), modelB, &displayB, &columns));
+       displayB.get_selection()->set_select_function (sigc::bind (ptr_fun (selection_filter), &columns));
+       displayB.get_selection()->signal_changed().connect (sigc::bind (ptr_fun (selection_changed), modelB, &displayB, &columns));
 
        scrollerA.add (displayA);
        scrollerB.add (displayB);
@@ -184,14 +202,14 @@ main (int argc, char* argv[])
 
        vpacker.pack_start (hpacker);
        vpacker.pack_start (rescan, false, false);
-       
+
        win.add (vpacker);
        win.set_size_request (500, 400);
        win.show_all ();
-       
-       rescan.signal_clicked().connect (bind (ptr_fun (fill_it), modelA, &displayA, &columns));
-       rescan.signal_clicked().connect (bind (ptr_fun (fill_it), modelB, &displayB, &columns));
-       
+
+       rescan.signal_clicked().connect (sigc::bind (ptr_fun (fill_it), modelA, &displayA, &columns));
+       rescan.signal_clicked().connect (sigc::bind (ptr_fun (fill_it), modelB, &displayB, &columns));
+
        fill_it (modelA, &displayA, &columns);
        fill_it (modelB, &displayB, &columns);