diff options
author | Paul Davis <paul@linuxaudiosystems.com> | 2005-12-05 04:11:08 +0000 |
---|---|---|
committer | Paul Davis <paul@linuxaudiosystems.com> | 2005-12-05 04:11:08 +0000 |
commit | 7d1f1eeb20edc21d704cc69529e4e94dd7eabd39 (patch) | |
tree | 28641dd038b3e778f7edeb17d9df73fa3ee6cd3e /gtk2_ardour | |
parent | f2c09c7a7a195bcd4cf6e095b3c380e803b5a058 (diff) |
stock icons, transport controls as proxies, make ActionManager::get_action() work
git-svn-id: svn://localhost/trunk/ardour2@165 d708f5d6-7413-0410-9779-e7cbd77b26cf
Diffstat (limited to 'gtk2_ardour')
-rw-r--r-- | gtk2_ardour/actions.cc | 39 | ||||
-rw-r--r-- | gtk2_ardour/ardour_ui.cc | 2 | ||||
-rw-r--r-- | gtk2_ardour/ardour_ui2.cc | 89 | ||||
-rw-r--r-- | gtk2_ardour/ardour_ui_ed.cc | 1 | ||||
-rw-r--r-- | gtk2_ardour/editor.cc | 6 | ||||
-rw-r--r-- | gtk2_ardour/editor_cursors.cc | 9 | ||||
-rw-r--r-- | gtk2_ardour/editor_xpms | 69 | ||||
-rw-r--r-- | gtk2_ardour/main.cc | 6 |
8 files changed, 137 insertions, 84 deletions
diff --git a/gtk2_ardour/actions.cc b/gtk2_ardour/actions.cc index 0dca875e3f..8a50451cb5 100644 --- a/gtk2_ardour/actions.cc +++ b/gtk2_ardour/actions.cc @@ -20,6 +20,8 @@ #include <vector> #include <gtk/gtkaccelmap.h> +#include <gtk/gtkuimanager.h> +#include <gtk/gtkactiongroup.h> #include <gtkmm/accelmap.h> #include <gtkmm/uimanager.h> @@ -192,7 +194,42 @@ ActionManager::get_widget (ustring name) RefPtr<Action> ActionManager::get_action (ustring name) { - return ui_manager->get_action (name); + // ListHandle<RefPtr<ActionGroup> > uim_groups = ui_manager->get_action_groups (); + GList* list = gtk_ui_manager_get_action_groups (ui_manager->gobj()); + GList* node; + RefPtr<Action> act; + + if (name.substr (0,9) != "<Actions>") { + cerr << "badly specified action name" << endl; + return act; + } + + ustring::size_type last_slash = name.find_last_of ('/'); + ustring group_name = name.substr (10, last_slash - 10); + cerr << "group name = " << group_name << endl; + ustring action_name = name.substr (last_slash+1); + cerr << "action name = " << action_name << endl; + + cerr << "there are " << g_list_length (list) << " action roups\n"; + + for (node = list; node; node = g_list_next (node)) { + + GtkActionGroup* _ag = (GtkActionGroup*) node->data; + + cerr << "\tchecking in " << gtk_action_group_get_name (_ag) << endl; + + if (group_name == gtk_action_group_get_name (_ag)) { + + GtkAction* _act; + + if ((_act = gtk_action_group_get_action (_ag, action_name.c_str())) != 0) { + act = Glib::wrap (_act); + break; + } + } + } + + return act; } void diff --git a/gtk2_ardour/ardour_ui.cc b/gtk2_ardour/ardour_ui.cc index 0633e9cceb..b9342bcdb1 100644 --- a/gtk2_ardour/ardour_ui.cc +++ b/gtk2_ardour/ardour_ui.cc @@ -805,7 +805,7 @@ ARDOUR_UI::ARDOUR_UI (int *argcp, char **argvp[], string rcfile) shuttle_units_button (_("% ")), shuttle_style_button (_("spring")), - + punch_in_button (_("punch\nin")), punch_out_button (_("punch\nout")), auto_return_button (_("auto\nreturn")), diff --git a/gtk2_ardour/ardour_ui2.cc b/gtk2_ardour/ardour_ui2.cc index d0f93dab8d..8a7c1b6ede 100644 --- a/gtk2_ardour/ardour_ui2.cc +++ b/gtk2_ardour/ardour_ui2.cc @@ -50,6 +50,7 @@ using namespace std; using namespace ARDOUR; using namespace Gtkmm2ext; using namespace Gtk; +using namespace Glib; using namespace sigc; int @@ -200,14 +201,83 @@ ARDOUR_UI::setup_transport () static_cast<Gtk::Widget*> (&transport_frame), 1)); - goto_start_button.add (*(manage (new Image (Gdk::Pixbuf::create_from_xpm_data(start_xpm))))); - goto_end_button.add (*(manage (new Image (Gdk::Pixbuf::create_from_xpm_data(end_xpm))))); - roll_button.add (*(manage (new Image (Gdk::Pixbuf::create_from_xpm_data(arrow_xpm))))); - - stop_button.add (*(manage (new Image (Gdk::Pixbuf::create_from_xpm_data(stop_xpm))))); - play_selection_button.add (*(manage (new Image (Gdk::Pixbuf::create_from_xpm_data(play_selection_xpm))))); - rec_button.add (*(manage (new Image (Gdk::Pixbuf::create_from_xpm_data(rec_xpm))))); - auto_loop_button.add (*(manage (new Image (Gdk::Pixbuf::create_from_xpm_data(loop_xpm))))); + Widget* w; + +#ifdef THE_OLD + w = manage (new Image (Gdk::Pixbuf::create_from_xpm_data(start_xpm))); + w->show(); + goto_start_button.add (*w); + w = manage (new Image (Gdk::Pixbuf::create_from_xpm_data(end_xpm))); + w->show(); + goto_end_button.add (*w); + w = manage (new Image (Gdk::Pixbuf::create_from_xpm_data(arrow_xpm))); + w->show(); + roll_button.add (*w); + w = manage (new Image (Gdk::Pixbuf::create_from_xpm_data(stop_xpm))); + w->show(); + stop_button.add (*w); + w = manage (new Image (Gdk::Pixbuf::create_from_xpm_data(play_selection_xpm))); + w->show(); + play_selection_button.add (*w); + w = manage (new Image (Gdk::Pixbuf::create_from_xpm_data(rec_xpm))); + w->show(); + rec_button.add (*w); + w = manage (new Image (Gdk::Pixbuf::create_from_xpm_data(loop_xpm))); + w->show(); + auto_loop_button.add (*w); + + + stop_button.set_use_stock (false); + roll_button.set_use_stock (false); + rec_button.set_use_stock (false); + goto_start_button.set_use_stock (false); + goto_end_button.set_use_stock (false); + auto_loop_button.set_use_stock (false); +#else + w = manage (new Image (Stock::MEDIA_PREVIOUS, ICON_SIZE_BUTTON)); + w->show(); + goto_start_button.add (*w); + w = manage (new Image (Stock::MEDIA_NEXT, ICON_SIZE_BUTTON)); + w->show(); + goto_end_button.add (*w); + w = manage (new Image (Stock::MEDIA_PLAY, ICON_SIZE_BUTTON)); + w->show(); + roll_button.add (*w); + w = manage (new Image (Stock::MEDIA_STOP, ICON_SIZE_BUTTON)); + w->show(); + stop_button.add (*w); + w = manage (new Image (Stock::MEDIA_PLAY, ICON_SIZE_BUTTON)); + w->show(); + play_selection_button.add (*w); + w = manage (new Image (Stock::MEDIA_RECORD, ICON_SIZE_BUTTON)); + w->show(); + rec_button.add (*w); + w = manage (new Image (Gdk::Pixbuf::create_from_xpm_data(loop_xpm))); + w->show(); + auto_loop_button.add (*w); + + stop_button.set_use_stock (true); + roll_button.set_use_stock (true); + rec_button.set_use_stock (true); + goto_start_button.set_use_stock (true); + goto_end_button.set_use_stock (true); + auto_loop_button.set_use_stock (true); +#endif + + RefPtr<Action> act; + + act = ActionManager::get_action (X_("<Actions>/Common/TransportStop")); + act->connect_proxy (stop_button); + act = ActionManager::get_action (X_("<Actions>/Common/TransportRoll")); + act->connect_proxy (roll_button); + act = ActionManager::get_action (X_("<Actions>/Common/TransportRecord")); + act->connect_proxy (rec_button); + act = ActionManager::get_action (X_("<Actions>/Common/TransportGotoStart")); + act->connect_proxy (goto_start_button); + act = ActionManager::get_action (X_("<Actions>/Common/TransportGotoEnd")); + act->connect_proxy (goto_end_button); + act = ActionManager::get_action (X_("<Actions>/Common/TransportLoop")); + act->connect_proxy (auto_loop_button); ARDOUR_UI::instance()->tooltips().set_tip (roll_button, _("Play from playhead")); ARDOUR_UI::instance()->tooltips().set_tip (stop_button, _("Stop playback")); @@ -277,6 +347,8 @@ ARDOUR_UI::setup_transport () punch_in_button.set_events (punch_in_button.get_events() & ~(Gdk::ENTER_NOTIFY_MASK|Gdk::LEAVE_NOTIFY_MASK)); punch_out_button.set_events (punch_out_button.get_events() & ~(Gdk::ENTER_NOTIFY_MASK|Gdk::LEAVE_NOTIFY_MASK)); +#if 0 + goto_start_button.signal_clicked().connect (mem_fun(*this,&ARDOUR_UI::transport_goto_start)); goto_end_button.signal_clicked().connect (mem_fun(*this,&ARDOUR_UI::transport_goto_end)); @@ -286,6 +358,7 @@ ARDOUR_UI::setup_transport () stop_button.signal_button_release_event().connect (mem_fun(*this,&ARDOUR_UI::mouse_transport_stop)); rec_button.signal_button_release_event().connect (mem_fun(*this,&ARDOUR_UI::mouse_transport_record)); +#endif shuttle_box.signal_button_press_event().connect (mem_fun(*this, &ARDOUR_UI::shuttle_box_button_press)); shuttle_box.signal_button_release_event().connect (mem_fun(*this, &ARDOUR_UI::shuttle_box_button_release)); diff --git a/gtk2_ardour/ardour_ui_ed.cc b/gtk2_ardour/ardour_ui_ed.cc index 04d059b31f..53dcb33666 100644 --- a/gtk2_ardour/ardour_ui_ed.cc +++ b/gtk2_ardour/ardour_ui_ed.cc @@ -185,6 +185,7 @@ ARDOUR_UI::install_actions () act = ActionManager::register_action (common_actions, X_("RemoveLastCapture"), _("remove last capture"), mem_fun(*this, &ARDOUR_UI::remove_last_capture)); ActionManager::session_sensitive_actions.push_back (act); act = ActionManager::register_action (common_actions, X_("TransportStop"), _("transport stop"), mem_fun(*this, &ARDOUR_UI::transport_stop)); + cerr << "Stop has path " << act->get_accel_path() << endl; ActionManager::session_sensitive_actions.push_back (act); act = ActionManager::register_action (common_actions, X_("TransportStopAndForgetCapture"), _("transport stop and forget capture"), mem_fun(*this, &ARDOUR_UI::transport_stop_and_forget_capture)); ActionManager::session_sensitive_actions.push_back (act); diff --git a/gtk2_ardour/editor.cc b/gtk2_ardour/editor.cc index 0310dbbf4c..3c49e8a14e 100644 --- a/gtk2_ardour/editor.cc +++ b/gtk2_ardour/editor.cc @@ -462,9 +462,9 @@ Editor::Editor (AudioEngine& eng) zoom_out_full_button.set_name ("EditorTimeButton"); ARDOUR_UI::instance()->tooltips().set_tip (zoom_out_full_button, _("Zoom to session")); - zoom_in_button.add (*(manage (new Gtk::Image (Gdk::Pixbuf::create_from_xpm_data(zoom_in_button_xpm))))); - zoom_out_button.add (*(manage (new Gtk::Image (Gdk::Pixbuf::create_from_xpm_data(zoom_out_button_xpm))))); - zoom_out_full_button.add (*(manage (new Gtk::Image (Gdk::Pixbuf::create_from_xpm_data(zoom_out_full_button_xpm))))); + zoom_in_button.add (*(manage (new Gtk::Image (Stock::ZOOM_IN, ICON_SIZE_BUTTON)))); + zoom_out_button.add (*(manage (new Gtk::Image (Stock::ZOOM_OUT, ICON_SIZE_BUTTON)))); + zoom_out_full_button.add (*(manage (new Gtk::Image (Stock::ZOOM_FIT, ICON_SIZE_BUTTON)))); zoom_in_button.signal_clicked().connect (bind (mem_fun(*this, &Editor::temporal_zoom_step), false)); zoom_out_button.signal_clicked().connect (bind (mem_fun(*this, &Editor::temporal_zoom_step), true)); diff --git a/gtk2_ardour/editor_cursors.cc b/gtk2_ardour/editor_cursors.cc index c6551095c8..02d277b8e5 100644 --- a/gtk2_ardour/editor_cursors.cc +++ b/gtk2_ardour/editor_cursors.cc @@ -83,14 +83,21 @@ Editor::Cursor::set_position (jack_nframes_t frame) points.front().set_x (new_pos); points.back().set_x (new_pos); + + canvas_item.property_points() = points; + + ArdourCanvas::Points p = canvas_item.property_points(); cerr << "new cursor points = " << points.front().get_x() << ',' << points.front().get_y() << " .. " << points.back().get_x() << ',' << points.back().get_y() + << " vs. " << endl + << p.front().get_x() << ',' << p.front().get_y() + << " .. " + << p.back().get_x() << ',' << p.back().get_y() << endl; - canvas_item.property_points() = points; } canvas_item.raise_to_top(); diff --git a/gtk2_ardour/editor_xpms b/gtk2_ardour/editor_xpms index 1dd134c959..9d501efc3e 100644 --- a/gtk2_ardour/editor_xpms +++ b/gtk2_ardour/editor_xpms @@ -65,75 +65,6 @@ static const gchar speaker_cursor_mask_bits[] = { 0x00, 0xc0, 0x00, 0xc0 }; /* XPM */ -static const gchar * zoom_in_button_xpm[] = { -"16 16 3 1", -" c None", -". c #000000", -"+ c #FFFFFF", -" ....... ", -" .+++++++. ", -" .+++++++++. ", -" .+++.....+++. ", -" .+++. + .+++.", -" .++. +.+ .++.", -" .++. ++.++ .++.", -" .++.+.....+.++.", -" .++. ++.++ .++.", -" .++. +.+ .++.", -" .+++. + .+++.", -" .+++.....+++. ", -" .+++++++++++. ", -".+++.+++++++. ", -".++. ....... ", -"... "}; - -/* XPM */ -static const gchar * zoom_out_button_xpm[] = { -"16 16 3 1", -" c None", -". c #000000", -"+ c #FFFFFF", -" ....... ", -" .+++++++. ", -" .+++++++++. ", -" .+++.....+++. ", -" .+++. .+++.", -" .++. .++.", -" .++. +++++ .++.", -" .++.+.....+.++.", -" .++. +++++ .++.", -" .++. .++.", -" .+++. .+++.", -" .+++.....+++. ", -" .+++++++++++. ", -".+++.+++++++. ", -".++. ....... ", -"... "}; - -/* XPM */ -static const gchar * zoom_out_full_button_xpm[] = { -"16 16 3 1", -" c None", -". c #000000", -"+ c #FFFFFF", -" ", -" ", -" ", -" ", -".... ....", -".++. .++.", -".++..........++.", -".++++++++++++++.", -".++++++++++++++.", -".++++++++++++++.", -".++..........++.", -".++. .++.", -".... ....", -" ", -" ", -" "}; - -/* XPM */ static const gchar * right_arrow_xpm[] = { "12 15 3 1", " c None", diff --git a/gtk2_ardour/main.cc b/gtk2_ardour/main.cc index 808e4f32c8..acd8188bcb 100644 --- a/gtk2_ardour/main.cc +++ b/gtk2_ardour/main.cc @@ -475,8 +475,12 @@ To create it from the command line, start ardour as \"ardour --new %1"), path) } } - if (!ui->set_quit_context ()) { + try { + ui->run (text_receiver); + + } catch (...) { + } ui = 0; |