stock icons, transport controls as proxies, make ActionManager::get_action() work

git-svn-id: svn://localhost/trunk/ardour2@165 d708f5d6-7413-0410-9779-e7cbd77b26cf
This commit is contained in:
Paul Davis 2005-12-05 04:11:08 +00:00
parent f2c09c7a7a
commit 7d1f1eeb20
9 changed files with 145 additions and 85 deletions

View file

@ -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

View file

@ -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")),

View file

@ -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));

View file

@ -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);

View file

@ -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));

View file

@ -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();

View file

@ -64,75 +64,6 @@ static const gchar speaker_cursor_mask_bits[] = {
0xff, 0xff, 0xff, 0xff, 0x00, 0xfc, 0x00, 0xfc, 0x00, 0xf0, 0x00, 0xf0,
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",

View file

@ -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;

View file

@ -227,10 +227,17 @@ UI::quit ()
request (Quit);
}
static bool idle_quit ()
{
cerr << "idle quit, level = " << Main::level() << endl;
Main::quit ();
return true;
}
void
UI::do_quit ()
{
longjmp (quit_context, 1);
Glib::signal_idle().connect (sigc::ptr_fun (idle_quit));
}
int