#include <map>
#include <vector>
-#include <pbd/lockmonitor.h>
+#include <gtkmm/messagedialog.h>
+
+#include <glibmm/thread.h>
#include <ardour/io.h>
#include <ardour/route.h>
#include <ardour/port.h>
#include <ardour/insert.h>
#include <ardour/session.h>
-#include <ardour/diskstream.h>
+#include <ardour/audio_diskstream.h>
#include <gtkmm2ext/doi.h>
#include <gtkmm2ext/gtk_ui.h>
+#include <gtkmm2ext/utils.h>
#include "utils.h"
-#include "ardour_message.h"
#include "io_selector.h"
#include "keyboard.h"
#include "gui_thread.h"
using namespace Glib;
using namespace sigc;
using namespace ARDOUR;
+using namespace PBD;
+using namespace Gtkmm2ext;
IOSelectorWindow::IOSelectorWindow (Session& sess, IO& ior, bool input, bool can_cancel)
: ArdourDialog ("i/o selector"),
row[port_display_columns.full_name] = s->second;
}
- display->get_selection()->signal_changed().connect
- (bind (mem_fun(*this, &IOSelector::port_selection_changed), display));
-
+ //display->get_selection()->signal_changed().connect (bind (mem_fun(*this, &IOSelector::port_selection_changed), display));
+ display->signal_button_release_event().connect (bind (mem_fun(*this, &IOSelector::port_selection_changed), display));
Label *tab_label = manage (new Label);
tab_label->set_name ("IOSelectorNotebookTab");
}
notebook.set_current_page (current_page);
- notebook.signal_show().connect (bind (mem_fun (notebook, &Notebook::set_current_page), current_page));
+ //notebook.signal_show().connect (bind (mem_fun (notebook, &Notebook::set_current_page), current_page));
selector_box.show_all ();
}
TreeView *selected_port_tview = 0;
{
- LockMonitor lm (port_display_lock, __LINE__, __FILE__);
+ Glib::Mutex::Lock lm (port_display_lock);
Port *port;
uint32_t limit;
tview->set_name ("IOSelectorPortList");
port_box.pack_start (*tview);
- //scroller = manage (new ScrolledWindow);
-
- //scroller->add (*tview);
- //scroller->set_policy (POLICY_NEVER, POLICY_NEVER);
-
port_displays.insert (port_displays.end(), tview);
- //port_box.pack_start (*scroller);
-
- //scroller->set_size_request (-1, 75);
/* now fill the clist with the current connections */
TreeViewColumn* col = tview->get_column (0);
col->set_clickable (true);
- //col->set_widget(0);
- /* handle button events on the column header and within the treeview itself */
- //col->get_widget()->signal_button_release_event().connect (bind (mem_fun(*this, &IOSelector::port_column_button_release), tview));
+ /* handle button events on the column header and within the treeview itself */
+ col->signal_clicked().connect (bind (mem_fun(*this, &IOSelector::select_treeview), tview));
tview->signal_button_release_event().connect (bind (mem_fun(*this, &IOSelector::connection_button_release), tview));
}
}
}
-void
-IOSelector::port_selection_changed (TreeView* treeview)
+bool
+IOSelector::port_selection_changed (GdkEventButton *ev, TreeView* treeview)
{
TreeModel::iterator i = treeview->get_selection()->get_selected();
int status;
if (!i) {
- return;
+ return 0;
}
if (selected_port == 0) {
- return;
+ return 0;
}
ustring other_port_name = (*i)[port_display_columns.full_name];
if (status == 0) {
select_next_treeview ();
}
+
+ treeview->get_selection()->unselect_all();
+ return 0;
}
void
}
catch (AudioEngine::PortRegistrationFailure& err) {
- ArdourMessage msg (0, X_("noport dialog"), _("There are no more JACK ports available."));
+ MessageDialog msg (0, _("There are no more JACK ports available."));
+ msg.run ();
}
if (io.input_maximum() >= 0 && io.input_maximum() <= (int) io.n_inputs()) {
}
catch (AudioEngine::PortRegistrationFailure& err) {
- ArdourMessage msg (0, X_("noport dialog"),
- _("There are no more JACK ports available."));
+ MessageDialog msg (0, _("There are no more JACK ports available."));
+ msg.run ();
}
if (io.output_maximum() >= 0 && io.output_maximum() <= (int) io.n_outputs()) {
/* path is valid */
ustring connected_port_name = (*iter)[port_display_columns.full_name];
- cerr << "selected row displayed_name: " << (*iter)[port_display_columns.displayed_name] << endl;
- cerr << "selected row string was " << connected_port_name << endl;
Port *port = reinterpret_cast<Port *> (treeview->get_data (_("port")));
if (for_input) {
return true;
}
-int
+gint
IOSelector::port_column_button_release (GdkEventButton* event, TreeView* treeview)
{
/* this handles button release on the button at the top of a single-column
if (Keyboard::is_delete_event (event)) {
Port* port;
{
- LockMonitor lm (port_display_lock, __LINE__, __FILE__);
+ Glib::Mutex::Lock lm (port_display_lock);
port = static_cast<Port *> (treeview->get_data (_("port")));
switch.
*/
- LockMonitor lm (port_display_lock, __LINE__, __FILE__);
+ Glib::Mutex::Lock lm (port_display_lock);
Port* port = reinterpret_cast<Port *> (tview->get_data (_("port")));
if (port != selected_port) {
}
button_box.pack_start (ok_button);
- vbox.pack_start (_portinsertui);
- vbox.pack_start (button_box, false, false);
-
- add (vbox);
+ get_vbox()->pack_start (_portinsertui);
+ get_vbox()->pack_start (button_box, false, false);
ok_button.signal_clicked().connect (mem_fun(*this, &PortInsertWindow::accept));
cancel_button.signal_clicked().connect (mem_fun(*this, &PortInsertWindow::cancel));