X-Git-Url: https://main.carlh.net/gitweb/?a=blobdiff_plain;f=gtk2_ardour%2Fitest.cc;h=db6ede0fd2f29bfdd62823ee843f173e0c91c3ae;hb=1c5f395c01270cfae0397d56ceb63a104d34b1a0;hp=7938f6c6e7da32691d8d314351dac7c6a3cc60c8;hpb=538cd1f7596f6ca6f5e74ccea1674165c9290539;p=ardour.git diff --git a/gtk2_ardour/itest.cc b/gtk2_ardour/itest.cc index 7938f6c6e7..db6ede0fd2 100644 --- a/gtk2_ardour/itest.cc +++ b/gtk2_ardour/itest.cc @@ -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 #include #include @@ -16,19 +35,18 @@ #include 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 used; - TreeModelColumn text; + TreeModelColumn text; TreeModelColumn port; }; @@ -41,12 +59,12 @@ fill_it (RefPtr model, TreeView* display, ModelColumns* columns) display->set_model (RefPtr(0)); model->clear (); - + const char ** ports; typedef map > > 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 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 > > newpair; @@ -67,10 +85,10 @@ fill_it (RefPtr 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 model, TreeView* display, ModelColumns* columns) for (vector >::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 modelA = TreeStore::create (columns); RefPtr 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);