*/
#include <cmath>
-#include <glib.h>
#include <sigc++/bind.h>
+#include <pbd/convert.h>
+
+#include <gtkmm/messagedialog.h>
+
#include <gtkmm2ext/gtk_ui.h>
#include <gtkmm2ext/utils.h>
#include <gtkmm2ext/choice.h>
#include <ardour/audioengine.h>
#include <ardour/route.h>
#include <ardour/audio_track.h>
-#include <ardour/diskstream.h>
+#include <ardour/audio_diskstream.h>
#include <ardour/send.h>
#include <ardour/insert.h>
#include <ardour/ladspa_plugin.h>
#include "ardour_ui.h"
#include "ardour_dialog.h"
-#include "ardour_message.h"
#include "public_editor.h"
#include "redirect_box.h"
#include "keyboard.h"
using namespace sigc;
using namespace ARDOUR;
+using namespace PBD;
using namespace Gtk;
using namespace Glib;
using namespace Gtkmm2ext;
redirect_display.set_name ("RedirectSelector");
redirect_display.set_headers_visible (false);
redirect_display.set_reorderable (true);
- redirect_display.set_size_request (-1, 48);
+ redirect_display.set_size_request (-1, 40);
redirect_display.get_column(0)->set_sizing(TREE_VIEW_COLUMN_FIXED);
redirect_display.get_column(0)->set_fixed_width(48);
redirect_display.add_object_drag (columns.redirect.index(), "redirects");
redirect_scroller.add (redirect_display);
redirect_eventbox.add (redirect_scroller);
+
+ redirect_scroller.set_size_request (-1, 40);
pack_start (redirect_eventbox, true, true);
paste_action->set_sensitive (!_rr_selection.redirects.empty());
- redirect_menu->popup (1, 0);
+ redirect_menu->popup (1, arg);
}
void
} else if (Keyboard::is_context_menu_event (ev)) {
- show_redirect_menu(0);
+ show_redirect_menu(ev->time);
ret = true;
} else if (redirect && ev->button == 2 && ev->state == 0) {
ret = true;
}
+ else if (redirect && ev->button == 1 && selected) {
+ // this is purely informational but necessary
+ RedirectSelected (redirect); // emit
+ }
+
return ret;
}
RedirectBox::selection_changed ()
{
bool sensitive = (redirect_display.get_selection()->count_selected_rows()) ? true : false;
-
- for (vector<Glib::RefPtr<Gtk::Action> >::iterator i = ActionManager::plugin_selection_sensitive_actions.begin(); i != ActionManager::plugin_selection_sensitive_actions.end(); ++i) {
- (*i)->set_sensitive (sensitive);
- }
+ ActionManager::set_sensitive (ActionManager::plugin_selection_sensitive_actions, sensitive);
}
void
dialog.set_modal (true);
dialog.show_all ();
- // GTK2FIX
- //dialog.realize();
- //dialog.get_window()->set_decorations (Gdk::WMDecoration (GDK_DECOR_BORDER|GDK_DECOR_RESIZEH));
-
dialog.run ();
}
name_display += send->name().substr (lbracket+1, lbracket-rbracket-1);
break;
case Narrow:
- name_display += short_version (send->name().substr (lbracket+1, lbracket-rbracket-1), 4);
+ name_display += PBD::short_version (send->name().substr (lbracket+1, lbracket-rbracket-1), 4);
break;
}
name_display += redirect.name();
break;
case Narrow:
- name_display += short_version (redirect.name(), 5);
+ name_display += PBD::short_version (redirect.name(), 5);
break;
}
void
RedirectBox::rename_redirect (Redirect* redirect)
{
- ArdourDialog dialog (_("ardour: rename redirect"), true);
- Entry entry;
- VBox vbox;
- HBox hbox;
- Button ok_button (_("OK"));
- Button cancel_button (_("Cancel"));
-
- dialog.set_name ("RedirectRenameWindow");
- dialog.set_size_request (300, -1);
- dialog.set_position (Gtk::WIN_POS_MOUSE);
-
- dialog.add_action_widget (entry, RESPONSE_ACCEPT);
- dialog.add_button (Stock::OK, RESPONSE_ACCEPT);
- dialog.add_button (Stock::CANCEL, RESPONSE_CANCEL);
-
- entry.set_name ("RedirectNameDisplay");
- entry.set_text (redirect->name());
- entry.select_region (0, -1);
- entry.grab_focus ();
-
- switch (dialog.run ()) {
- case RESPONSE_ACCEPT:
- redirect->set_name (entry.get_text(), this);
- break;
- default:
+ ArdourPrompter name_prompter (true);
+ string result;
+ name_prompter.set_prompt (_("rename redirect"));
+ name_prompter.set_initial_text (redirect->name());
+ name_prompter.add_button (_("Rename"), Gtk::RESPONSE_ACCEPT);
+ name_prompter.set_response_sensitive (Gtk::RESPONSE_ACCEPT, false);
+ name_prompter.show_all ();
+
+ switch (name_prompter.run ()) {
+
+ case Gtk::RESPONSE_ACCEPT:
+ name_prompter.get_result (result);
+ if (result.length()) {
+ redirect->set_name (result, this);
+ }
break;
}
+
+ return;
+
}
void
"Copying the set of redirects on the clipboard failed,\n\
probably because the I/O configuration of the plugins\n\
could not match the configuration of this track.");
- ArdourMessage am (0, X_("bad redirect copy dialog"), msg);
+ MessageDialog am (msg);
+ am.run ();
}
}
"Copying the set of redirects on the clipboard failed,\n\
probably because the I/O configuration of the plugins\n\
could not match the configuration of this track.");
- ArdourMessage am (0, X_("bad redirect copy dialog"), msg);
+ MessageDialog am (msg);
+ am.run ();
}
}
}
"(this cannot be undone)");
}
- choices.push_back (_("Yes, remove them all"));
choices.push_back (_("Cancel"));
+ choices.push_back (_("Yes, remove them all"));
Gtkmm2ext::Choice prompter (prompt, choices);
- prompter.chosen.connect(sigc::ptr_fun(Gtk::Main::quit));
- prompter.show_all ();
-
- Gtk::Main::run ();
-
- if (prompter.get_choice() == 0) {
+ if (prompter.run () == 1) {
_route.clear_redirects (this);
}
}
-
void
RedirectBox::edit_redirect (Redirect* redirect)
{
} else if ((port_insert = dynamic_cast<PortInsert *> (insert)) != 0) {
if (!_session.engine().connected()) {
- ArdourMessage msg (NULL, "nojackdialog", _("Not connected to JACK - no I/O changes are possible"));
+ MessageDialog msg ( _("Not connected to JACK - no I/O changes are possible"));
+ msg.run ();
return;
}