diff options
author | harrison <harrison@localhost.localdomain> | 2014-03-23 18:11:42 -0500 |
---|---|---|
committer | harrison <harrison@localhost.localdomain> | 2014-03-23 18:11:42 -0500 |
commit | b9708d5f6b4ccfaf762e6a3c2b211b208b012db0 (patch) | |
tree | 3525f71087fcf34dede4d7d3e9ac53dbc1753953 /gtk2_ardour | |
parent | 54d2e44e1dc9fb9d2af39ba7982cc725e47070be (diff) |
New theme for editor window using ArdourMenu
Diffstat (limited to 'gtk2_ardour')
-rw-r--r-- | gtk2_ardour/ardour3_ui_default.conf | 22 | ||||
-rw-r--r-- | gtk2_ardour/ardour_button.cc | 23 | ||||
-rw-r--r-- | gtk2_ardour/ardour_button.h | 2 | ||||
-rw-r--r-- | gtk2_ardour/canvas_vars.h | 2 | ||||
-rw-r--r-- | gtk2_ardour/editor.cc | 292 | ||||
-rw-r--r-- | gtk2_ardour/editor.h | 31 | ||||
-rw-r--r-- | gtk2_ardour/editor_actions.cc | 2 | ||||
-rw-r--r-- | gtk2_ardour/wscript | 1 |
8 files changed, 200 insertions, 175 deletions
diff --git a/gtk2_ardour/ardour3_ui_default.conf b/gtk2_ardour/ardour3_ui_default.conf index 2f21c0e28b..8e0646a8be 100644 --- a/gtk2_ardour/ardour3_ui_default.conf +++ b/gtk2_ardour/ardour3_ui_default.conf @@ -436,7 +436,7 @@ <Option name="punch button: led active" value="00000000"/> <Option name="punch button: text" value="a5a5a5ff"/> <Option name="punch button: text active" value="d8d8d8ff"/> - <Option name="mouse mode button: fill start" value="636470ff"/> + <Option name="mouse mode button: fill start" value="6d7ab460"/> <Option name="mouse mode button: fill end" value="54555dff"/> <Option name="mouse mode button: fill start active" value="1d7a05ff"/> <Option name="mouse mode button: fill end active" value="14ae08ff"/> @@ -444,8 +444,24 @@ <Option name="mouse mode button: led active" value="ffa500ff"/> <Option name="mouse mode button: text" value="f2f2f2ff"/> <Option name="mouse mode button: text active" value="000000ff"/> - <Option name="zoom button: fill start" value="626370ff"/> - <Option name="zoom button: fill end" value="54555dff"/> + <Option name="nudge button: fill start" value="785754dd"/> + <Option name="nudge button: fill end" value="564242dd"/> + <Option name="nudge button: fill start active" value="202025ff"/> + <Option name="nudge button: fill end active" value="404045ff"/> + <Option name="nudge button: led" value="4f3300ff"/> + <Option name="nudge button: led active" value="ffa500ff"/> + <Option name="nudge button: text" value="c7c7d8ff"/> + <Option name="nudge button: text active" value="c8c8d9ff"/> + <Option name="zoom menu: fill start" value="99997950"/> + <Option name="zoom menu: fill end" value="99996999"/> + <Option name="zoom menu: fill start active" value="202025ff"/> + <Option name="zoom menu: fill end active" value="404045ff"/> + <Option name="zoom menu: led" value="4f3300ff"/> + <Option name="zoom menu: led active" value="ffa500ff"/> + <Option name="zoom menu: text" value="c7c7d8ff"/> + <Option name="zoom menu: text active" value="c8c8d9ff"/> + <Option name="zoom button: fill start" value="b9b99989"/> + <Option name="zoom button: fill end" value="99996989"/> <Option name="zoom button: fill start active" value="202025ff"/> <Option name="zoom button: fill end active" value="404045ff"/> <Option name="zoom button: led" value="4f3300ff"/> diff --git a/gtk2_ardour/ardour_button.cc b/gtk2_ardour/ardour_button.cc index bc10530417..0970f85fca 100644 --- a/gtk2_ardour/ardour_button.cc +++ b/gtk2_ardour/ardour_button.cc @@ -324,7 +324,10 @@ ArdourButton::render (cairo_t* cr, cairo_rectangle_t *) cairo_new_path (cr); cairo_set_source_rgba (cr, text_r, text_g, text_b, text_a); - if (_elements & Indicator) { + if ( (_elements & Menu) == Menu) { + cairo_move_to (cr, text_margin, get_height()/2.0 - _text_height/2.0); + pango_cairo_show_layout (cr, _layout->gobj()); + } else if ( (_elements & Indicator) == Indicator) { if (_led_left) { cairo_move_to (cr, text_margin + _diameter + 4, get_height()/2.0 - _text_height/2.0); } else { @@ -363,6 +366,24 @@ ArdourButton::render (cairo_t* cr, cairo_rectangle_t *) cairo_restore (cr); } + if (((_elements & Menu)==Menu)) { + + cairo_save (cr); + + cairo_translate (cr, 0,0 ); + + //white arrow + cairo_set_source_rgba (cr, 1, 1, 1, 0.4); + cairo_move_to(cr, get_width() - ((_diameter/2.0) + 6.0), get_height()/2.0 +_diameter/4); + cairo_rel_line_to(cr, -_diameter/2, -_diameter/2); + cairo_rel_line_to(cr, _diameter, 0); + cairo_close_path(cr); + cairo_fill(cr); + + + cairo_restore (cr); + } + if (((_elements & Indicator)==Indicator)) { /* move to the center of the indicator/led */ diff --git a/gtk2_ardour/ardour_button.h b/gtk2_ardour/ardour_button.h index 2f9389efed..c3a18869b3 100644 --- a/gtk2_ardour/ardour_button.h +++ b/gtk2_ardour/ardour_button.h @@ -38,6 +38,7 @@ class ArdourButton : public CairoWidget , public Gtkmm2ext::Activatable Text = 0x4, Indicator = 0x8, FlatFace = 0x10, + Menu = 0x20, }; static Element default_elements; @@ -72,6 +73,7 @@ class ArdourButton : public CairoWidget , public Gtkmm2ext::Activatable void set_diameter (float); void set_text (const std::string&); + const std::string& get_text () {return _text;} void set_markup (const std::string&); void set_angle (const double); void set_alignment (const float, const float); diff --git a/gtk2_ardour/canvas_vars.h b/gtk2_ardour/canvas_vars.h index e9dde4c1af..3bcbd7d8fa 100644 --- a/gtk2_ardour/canvas_vars.h +++ b/gtk2_ardour/canvas_vars.h @@ -227,7 +227,9 @@ BUTTON_VARS(TransportActiveOptionButton, "transport active option button") BUTTON_VARS(PluginBypassButton, "plugin bypass button") BUTTON_VARS(PunchButton, "punch button") BUTTON_VARS(MouseModeButton, "mouse mode button") +BUTTON_VARS(NudgeButton, "nudge button") BUTTON_VARS(ZoomButton, "zoom button") +BUTTON_VARS(ZoomMenu, "zoom menu") BUTTON_VARS(RouteButton, "route button") BUTTON_VARS(MixerStripButton, "mixer strip button") BUTTON_VARS(MixerStripNameButton, "mixer strip name button") diff --git a/gtk2_ardour/editor.cc b/gtk2_ardour/editor.cc index 9e58773d99..c5518495fb 100644 --- a/gtk2_ardour/editor.cc +++ b/gtk2_ardour/editor.cc @@ -52,6 +52,9 @@ #include <gdkmm/color.h> #include <gdkmm/bitmap.h> +#include <gtkmm/menu.h> +#include <gtkmm/menuitem.h> + #include "gtkmm2ext/bindings.h" #include "gtkmm2ext/grouped_buttons.h" #include "gtkmm2ext/gtk_ui.h" @@ -286,7 +289,7 @@ Editor::Editor () PublicEditor::_instance = this; _have_idled = false; - + selection = new Selection (this); cut_buffer = new Selection (this); @@ -309,6 +312,12 @@ Editor::Editor () rb_current_opt = 4; #endif + build_edit_mode_menu(); + build_zoom_focus_menu(); + build_snap_mode_menu(); + build_snap_type_menu(); + build_edit_point_menu(); + snap_threshold = 5.0; bbt_beat_subdivision = 4; _visible_canvas_width = 0; @@ -654,12 +663,12 @@ Editor::Editor () /* nudge stuff */ - nudge_forward_button.set_name ("zoom button"); - nudge_forward_button.add_elements (ArdourButton::FlatFace); + nudge_forward_button.set_name ("nudge button"); +// nudge_forward_button.add_elements (ArdourButton::FlatFace); nudge_forward_button.set_image(::get_icon("nudge_right")); - nudge_backward_button.set_name ("zoom button"); - nudge_backward_button.add_elements (ArdourButton::FlatFace); + nudge_backward_button.set_name ("nudge button"); +// nudge_backward_button.add_elements (ArdourButton::FlatFace); nudge_backward_button.set_image(::get_icon("nudge_left")); fade_context_menu.set_name ("ArdourContextMenu"); @@ -2061,8 +2070,8 @@ Editor::set_snap_to (SnapType st) string str = snap_type_strings[snap_ind]; - if (str != snap_type_selector.get_active_text()) { - snap_type_selector.set_active_text (str); + if (str != snap_type_selector.get_text()) { + snap_type_selector.set_text (str); } instant_save (); @@ -2124,8 +2133,8 @@ Editor::set_snap_mode (SnapMode mode) _snap_mode = mode; - if (str != snap_mode_selector.get_active_text ()) { - snap_mode_selector.set_active_text (str); + if (str != snap_mode_selector.get_text ()) { + snap_mode_selector.set_text (str); } instant_save (); @@ -2138,8 +2147,8 @@ Editor::set_edit_point_preference (EditPoint ep, bool force) _edit_point = ep; string str = edit_point_strings[(int)ep]; - if (str != edit_point_selector.get_active_text ()) { - edit_point_selector.set_active_text (str); + if (str != edit_point_selector.get_text ()) { + edit_point_selector.set_text (str); } set_canvas_cursor (); @@ -2876,9 +2885,9 @@ Editor::setup_toolbar () } edit_mode_strings.push_back (edit_mode_to_string (Lock)); - edit_mode_selector.set_name ("EditModeSelector"); - set_popdown_strings (edit_mode_selector, edit_mode_strings); - edit_mode_selector.signal_changed().connect (sigc::mem_fun(*this, &Editor::edit_mode_selection_done)); + edit_mode_selector.set_name ("mouse mode button"); + edit_mode_selector.set_size_request (65, -1); + edit_mode_selector.add_elements (ArdourButton::FlatFace); mode_box->pack_start (edit_mode_selector, false, false); mode_box->pack_start (*mouse_mode_box, false, false); @@ -2907,30 +2916,30 @@ Editor::setup_toolbar () RefPtr<Action> act; - zoom_in_button.set_name ("zoom button"); - zoom_in_button.add_elements ( ArdourButton::FlatFace ); + zoom_in_button.set_name ("transport option button"); +// zoom_in_button.add_elements ( ArdourButton::FlatFace ); zoom_in_button.set_tweaks ((ArdourButton::Tweaks) (ArdourButton::ShowClick) ); zoom_in_button.set_image(::get_icon ("zoom_in")); act = ActionManager::get_action (X_("Editor"), X_("temporal-zoom-in")); zoom_in_button.set_related_action (act); - zoom_out_button.set_name ("zoom button"); - zoom_out_button.add_elements ( ArdourButton::FlatFace ); + zoom_out_button.set_name ("transport option button"); +// zoom_out_button.add_elements ( ArdourButton::FlatFace ); zoom_out_button.set_tweaks ((ArdourButton::Tweaks) (ArdourButton::ShowClick) ); zoom_out_button.set_image(::get_icon ("zoom_out")); act = ActionManager::get_action (X_("Editor"), X_("temporal-zoom-out")); zoom_out_button.set_related_action (act); - zoom_out_full_button.set_name ("zoom button"); - zoom_out_full_button.add_elements ( ArdourButton::FlatFace ); + zoom_out_full_button.set_name ("transport option button"); +// zoom_out_full_button.add_elements ( ArdourButton::FlatFace ); zoom_out_full_button.set_tweaks ((ArdourButton::Tweaks) (ArdourButton::ShowClick) ); zoom_out_full_button.set_image(::get_icon ("zoom_full")); act = ActionManager::get_action (X_("Editor"), X_("zoom-to-session")); zoom_out_full_button.set_related_action (act); - zoom_focus_selector.set_name ("ZoomFocusSelector"); - set_popdown_strings (zoom_focus_selector, zoom_focus_strings); - zoom_focus_selector.signal_changed().connect (sigc::mem_fun(*this, &Editor::zoom_focus_selection_done)); + zoom_focus_selector.set_name ("transport option button"); + zoom_focus_selector.set_size_request (80, -1); +// zoom_focus_selector.add_elements (ArdourButton::FlatFace); _zoom_box.pack_start (zoom_out_button, false, false); _zoom_box.pack_start (zoom_in_button, false, false); @@ -2939,16 +2948,16 @@ Editor::setup_toolbar () _zoom_box.pack_start (zoom_focus_selector, false, false); /* Track zoom buttons */ - tav_expand_button.set_name ("zoom button"); - tav_expand_button.add_elements ( ArdourButton::FlatFace ); + tav_expand_button.set_name ("transport option button"); +// tav_expand_button.add_elements ( ArdourButton::FlatFace ); tav_expand_button.set_tweaks ((ArdourButton::Tweaks) (ArdourButton::ShowClick) ); tav_expand_button.set_size_request (-1, 20); tav_expand_button.set_image(::get_icon ("tav_exp")); act = ActionManager::get_action (X_("Editor"), X_("expand-tracks")); tav_expand_button.set_related_action (act); - tav_shrink_button.set_name ("zoom button"); - tav_shrink_button.add_elements ( ArdourButton::FlatFace ); + tav_shrink_button.set_name ("transport option button"); +// tav_shrink_button.add_elements ( ArdourButton::FlatFace ); tav_shrink_button.set_tweaks ((ArdourButton::Tweaks) (ArdourButton::ShowClick) ); tav_shrink_button.set_size_request (-1, 20); tav_shrink_button.set_image(::get_icon ("tav_shrink")); @@ -2972,17 +2981,17 @@ Editor::setup_toolbar () snap_box.set_spacing (2); snap_box.set_border_width (2); - snap_type_selector.set_name ("SnapTypeSelector"); - set_popdown_strings (snap_type_selector, snap_type_strings); - snap_type_selector.signal_changed().connect (sigc::mem_fun(*this, &Editor::snap_type_selection_done)); + snap_type_selector.set_name ("mouse mode button"); + snap_type_selector.set_size_request (140, -1); + snap_type_selector.add_elements (ArdourButton::FlatFace); - snap_mode_selector.set_name ("SnapModeSelector"); - set_popdown_strings (snap_mode_selector, snap_mode_strings); - snap_mode_selector.signal_changed().connect (sigc::mem_fun(*this, &Editor::snap_mode_selection_done)); + snap_mode_selector.set_name ("mouse mode button"); + snap_mode_selector.set_size_request (85, -1); + snap_mode_selector.add_elements (ArdourButton::FlatFace); - edit_point_selector.set_name ("EditPointSelector"); - set_popdown_strings (edit_point_selector, edit_point_strings); - edit_point_selector.signal_changed().connect (sigc::mem_fun(*this, &Editor::edit_point_selection_done)); + edit_point_selector.set_name ("mouse mode button"); + edit_point_selector.set_size_request (85, -1); + edit_point_selector.add_elements (ArdourButton::FlatFace); snap_box.pack_start (snap_mode_selector, false, false); snap_box.pack_start (snap_type_selector, false, false); @@ -3057,6 +3066,73 @@ Editor::setup_toolbar () } void +Editor::build_edit_point_menu () +{ + using namespace Menu_Helpers; + + edit_point_selector.AddMenuElem (MenuElem ( edit_point_strings[(int)EditAtPlayhead], sigc::bind (sigc::mem_fun(*this, &Editor::edit_point_selection_done), (EditPoint) EditAtPlayhead))); + edit_point_selector.AddMenuElem (MenuElem ( edit_point_strings[(int)EditAtSelectedMarker], sigc::bind (sigc::mem_fun(*this, &Editor::edit_point_selection_done), (EditPoint) EditAtSelectedMarker))); + edit_point_selector.AddMenuElem (MenuElem ( edit_point_strings[(int)EditAtMouse], sigc::bind (sigc::mem_fun(*this, &Editor::edit_point_selection_done), (EditPoint) EditAtMouse))); +} + +void +Editor::build_edit_mode_menu () +{ + using namespace Menu_Helpers; + + edit_mode_selector.AddMenuElem (MenuElem ( edit_mode_to_string(Slide), sigc::bind (sigc::mem_fun(*this, &Editor::edit_mode_selection_done), (EditMode) Slide))); + edit_mode_selector.AddMenuElem (MenuElem ( edit_mode_to_string(Splice), sigc::bind (sigc::mem_fun(*this, &Editor::edit_mode_selection_done), (EditMode) Splice))); + edit_mode_selector.AddMenuElem (MenuElem ( edit_mode_to_string(Lock), sigc::bind (sigc::mem_fun(*this, &Editor::edit_mode_selection_done), (EditMode) Lock))); +} + +void +Editor::build_snap_mode_menu () +{ + using namespace Menu_Helpers; + + snap_mode_selector.AddMenuElem (MenuElem ( snap_mode_strings[(int)SnapOff], sigc::bind (sigc::mem_fun(*this, &Editor::snap_mode_selection_done), (SnapMode) SnapOff))); + snap_mode_selector.AddMenuElem (MenuElem ( snap_mode_strings[(int)SnapNormal], sigc::bind (sigc::mem_fun(*this, &Editor::snap_mode_selection_done), (SnapMode) SnapNormal))); + snap_mode_selector.AddMenuElem (MenuElem ( snap_mode_strings[(int)SnapMagnetic], sigc::bind (sigc::mem_fun(*this, &Editor::snap_mode_selection_done), (SnapMode) SnapMagnetic))); +} + +void +Editor::build_snap_type_menu () +{ + using namespace Menu_Helpers; + + snap_type_selector.AddMenuElem (MenuElem ( snap_type_strings[(int)SnapToCDFrame], sigc::bind (sigc::mem_fun(*this, &Editor::snap_type_selection_done), (SnapType) SnapToCDFrame))); + snap_type_selector.AddMenuElem (MenuElem ( snap_type_strings[(int)SnapToTimecodeFrame], sigc::bind (sigc::mem_fun(*this, &Editor::snap_type_selection_done), (SnapType) SnapToTimecodeFrame))); + snap_type_selector.AddMenuElem (MenuElem ( snap_type_strings[(int)SnapToTimecodeSeconds], sigc::bind (sigc::mem_fun(*this, &Editor::snap_type_selection_done), (SnapType) SnapToTimecodeSeconds))); + snap_type_selector.AddMenuElem (MenuElem ( snap_type_strings[(int)SnapToTimecodeMinutes], sigc::bind (sigc::mem_fun(*this, &Editor::snap_type_selection_done), (SnapType) SnapToTimecodeMinutes))); + snap_type_selector.AddMenuElem (MenuElem ( snap_type_strings[(int)SnapToSeconds], sigc::bind (sigc::mem_fun(*this, &Editor::snap_type_selection_done), (SnapType) SnapToSeconds))); + snap_type_selector.AddMenuElem (MenuElem ( snap_type_strings[(int)SnapToMinutes], sigc::bind (sigc::mem_fun(*this, &Editor::snap_type_selection_done), (SnapType) SnapToMinutes))); + snap_type_selector.AddMenuElem (MenuElem ( snap_type_strings[(int)SnapToBeatDiv128], sigc::bind (sigc::mem_fun(*this, &Editor::snap_type_selection_done), (SnapType) SnapToBeatDiv128))); + snap_type_selector.AddMenuElem (MenuElem ( snap_type_strings[(int)SnapToBeatDiv64], sigc::bind (sigc::mem_fun(*this, &Editor::snap_type_selection_done), (SnapType) SnapToBeatDiv64))); + snap_type_selector.AddMenuElem (MenuElem ( snap_type_strings[(int)SnapToBeatDiv32], sigc::bind (sigc::mem_fun(*this, &Editor::snap_type_selection_done), (SnapType) SnapToBeatDiv32))); + snap_type_selector.AddMenuElem (MenuElem ( snap_type_strings[(int)SnapToBeatDiv28], sigc::bind (sigc::mem_fun(*this, &Editor::snap_type_selection_done), (SnapType) SnapToBeatDiv28))); + snap_type_selector.AddMenuElem (MenuElem ( snap_type_strings[(int)SnapToBeatDiv24], sigc::bind (sigc::mem_fun(*this, &Editor::snap_type_selection_done), (SnapType) SnapToBeatDiv24))); + snap_type_selector.AddMenuElem (MenuElem ( snap_type_strings[(int)SnapToBeatDiv20], sigc::bind (sigc::mem_fun(*this, &Editor::snap_type_selection_done), (SnapType) SnapToBeatDiv20))); + snap_type_selector.AddMenuElem (MenuElem ( snap_type_strings[(int)SnapToBeatDiv16], sigc::bind (sigc::mem_fun(*this, &Editor::snap_type_selection_done), (SnapType) SnapToBeatDiv16))); + snap_type_selector.AddMenuElem (MenuElem ( snap_type_strings[(int)SnapToBeatDiv14], sigc::bind (sigc::mem_fun(*this, &Editor::snap_type_selection_done), (SnapType) SnapToBeatDiv14))); + snap_type_selector.AddMenuElem (MenuElem ( snap_type_strings[(int)SnapToBeatDiv12], sigc::bind (sigc::mem_fun(*this, &Editor::snap_type_selection_done), (SnapType) SnapToBeatDiv12))); + snap_type_selector.AddMenuElem (MenuElem ( snap_type_strings[(int)SnapToBeatDiv10], sigc::bind (sigc::mem_fun(*this, &Editor::snap_type_selection_done), (SnapType) SnapToBeatDiv10))); + snap_type_selector.AddMenuElem (MenuElem ( snap_type_strings[(int)SnapToBeatDiv8], sigc::bind (sigc::mem_fun(*this, &Editor::snap_type_selection_done), (SnapType) SnapToBeatDiv8))); + snap_type_selector.AddMenuElem (MenuElem ( snap_type_strings[(int)SnapToBeatDiv7], sigc::bind (sigc::mem_fun(*this, &Editor::snap_type_selection_done), (SnapType) SnapToBeatDiv7))); + snap_type_selector.AddMenuElem (MenuElem ( snap_type_strings[(int)SnapToBeatDiv6], sigc::bind (sigc::mem_fun(*this, &Editor::snap_type_selection_done), (SnapType) SnapToBeatDiv6))); + snap_type_selector.AddMenuElem (MenuElem ( snap_type_strings[(int)SnapToBeatDiv5], sigc::bind (sigc::mem_fun(*this, &Editor::snap_type_selection_done), (SnapType) SnapToBeatDiv5))); + snap_type_selector.AddMenuElem (MenuElem ( snap_type_strings[(int)SnapToBeatDiv4], sigc::bind (sigc::mem_fun(*this, &Editor::snap_type_selection_done), (SnapType) SnapToBeatDiv4))); + snap_type_selector.AddMenuElem (MenuElem ( snap_type_strings[(int)SnapToBeatDiv3], sigc::bind (sigc::mem_fun(*this, &Editor::snap_type_selection_done), (SnapType) SnapToBeatDiv3))); + snap_type_selector.AddMenuElem (MenuElem ( snap_type_strings[(int)SnapToBeatDiv2], sigc::bind (sigc::mem_fun(*this, &Editor::snap_type_selection_done), (SnapType) SnapToBeatDiv2))); + snap_type_selector.AddMenuElem (MenuElem ( snap_type_strings[(int)SnapToBeat], sigc::bind (sigc::mem_fun(*this, &Editor::snap_type_selection_done), (SnapType) SnapToBeat))); + snap_type_selector.AddMenuElem (MenuElem ( snap_type_strings[(int)SnapToBar], sigc::bind (sigc::mem_fun(*this, &Editor::snap_type_selection_done), (SnapType) SnapToBar))); + snap_type_selector.AddMenuElem (MenuElem ( snap_type_strings[(int)SnapToMark], sigc::bind (sigc::mem_fun(*this, &Editor::snap_type_selection_done), (SnapType) SnapToMark))); + snap_type_selector.AddMenuElem (MenuElem ( snap_type_strings[(int)SnapToRegionStart], sigc::bind (sigc::mem_fun(*this, &Editor::snap_type_selection_done), (SnapType) SnapToRegionStart))); + snap_type_selector.AddMenuElem (MenuElem ( snap_type_strings[(int)SnapToRegionEnd], sigc::bind (sigc::mem_fun(*this, &Editor::snap_type_selection_done), (SnapType) SnapToRegionEnd))); + snap_type_selector.AddMenuElem (MenuElem ( snap_type_strings[(int)SnapToRegionSync], sigc::bind (sigc::mem_fun(*this, &Editor::snap_type_selection_done), (SnapType) SnapToRegionSync))); + snap_type_selector.AddMenuElem (MenuElem ( snap_type_strings[(int)SnapToRegionBoundary], sigc::bind (sigc::mem_fun(*this, &Editor::snap_type_selection_done), (SnapType) SnapToRegionBoundary))); +} + +void Editor::setup_tooltips () { ARDOUR_UI::instance()->set_tip (smart_mode_button, _("Smart Mode (add Range functions to Object mode)")); @@ -3329,83 +3405,14 @@ Editor::cycle_edit_mode () } void -Editor::edit_mode_selection_done () +Editor::edit_mode_selection_done ( EditMode m ) { - string s = edit_mode_selector.get_active_text (); - - if (!s.empty()) { - Config->set_edit_mode (string_to_edit_mode (s)); - } + Config->set_edit_mode ( m ); } void -Editor::snap_type_selection_done () -{ - string choice = snap_type_selector.get_active_text(); - SnapType snaptype = SnapToBeat; - - if (choice == _("Beats/2")) { - snaptype = SnapToBeatDiv2; - } else if (choice == _("Beats/3")) { - snaptype = SnapToBeatDiv3; - } else if (choice == _("Beats/4")) { - snaptype = SnapToBeatDiv4; - } else if (choice == _("Beats/5")) { - snaptype = SnapToBeatDiv5; - } else if (choice == _("Beats/6")) { - snaptype = SnapToBeatDiv6; - } else if (choice == _("Beats/7")) { - snaptype = SnapToBeatDiv7; - } else if (choice == _("Beats/8")) { - snaptype = SnapToBeatDiv8; - } else if (choice == _("Beats/10")) { - snaptype = SnapToBeatDiv10; - } else if (choice == _("Beats/12")) { - snaptype = SnapToBeatDiv12; - } else if (choice == _("Beats/14")) { - snaptype = SnapToBeatDiv14; - } else if (choice == _("Beats/16")) { - snaptype = SnapToBeatDiv16; - } else if (choice == _("Beats/20")) { - snaptype = SnapToBeatDiv20; - } else if (choice == _("Beats/24")) { - snaptype = SnapToBeatDiv24; - } else if (choice == _("Beats/28")) { - snaptype = SnapToBeatDiv28; - } else if (choice == _("Beats/32")) { - snaptype = SnapToBeatDiv32; - } else if (choice == _("Beats/64")) { - snaptype = SnapToBeatDiv64; - } else if (choice == _("Beats/128")) { - snaptype = SnapToBeatDiv128; - } else if (choice == _("Beats")) { - snaptype = SnapToBeat; - } else if (choice == _("Bars")) { - snaptype = SnapToBar; - } else if (choice == _("Marks")) { - snaptype = SnapToMark; - } else if (choice == _("Region starts")) { - snaptype = SnapToRegionStart; - } else if (choice == _("Region ends")) { - snaptype = SnapToRegionEnd; - } else if (choice == _("Region bounds")) { - snaptype = SnapToRegionBoundary; - } else if (choice == _("Region syncs")) { - snaptype = SnapToRegionSync; - } else if (choice == _("CD Frames")) { - snaptype = SnapToCDFrame; - } else if (choice == _("Timecode Frames")) { - snaptype = SnapToTimecodeFrame; - } else if (choice == _("Timecode Seconds")) { - snaptype = SnapToTimecodeSeconds; - } else if (choice == _("Timecode Minutes")) { - snaptype = SnapToTimecodeMinutes; - } else if (choice == _("Seconds")) { - snaptype = SnapToSeconds; - } else if (choice == _("Minutes")) { - snaptype = SnapToMinutes; - } - +Editor::snap_type_selection_done (SnapType snaptype) +{ RefPtr<RadioAction> ract = snap_type_action (snaptype); if (ract) { ract->set_active (); @@ -3413,19 +3420,8 @@ Editor::snap_type_selection_done () } void -Editor::snap_mode_selection_done () +Editor::snap_mode_selection_done (SnapMode mode) { - string choice = snap_mode_selector.get_active_text(); - SnapMode mode = SnapNormal; - - if (choice == _("No Grid")) { - mode = SnapOff; - } else if (choice == _("Grid")) { - mode = SnapNormal; - } else if (choice == _("Magnetic")) { - mode = SnapMagnetic; - } - RefPtr<RadioAction> ract = snap_mode_action (mode); if (ract) { @@ -3454,48 +3450,28 @@ Editor::cycle_edit_point (bool with_marker) } void -Editor::edit_point_selection_done () +Editor::edit_point_selection_done (EditPoint ep) { - string choice = edit_point_selector.get_active_text(); - EditPoint ep = EditAtSelectedMarker; - - if (choice == _("Marker")) { - set_edit_point_preference (EditAtSelectedMarker); - } else if (choice == _("Playhead")) { - set_edit_point_preference (EditAtPlayhead); - } else { - set_edit_point_preference (EditAtMouse); - } - - RefPtr<RadioAction> ract = edit_point_action (ep); - - if (ract) { - ract->set_active (true); - } + set_edit_point_preference ( ep ); } void -Editor::zoom_focus_selection_done () +Editor::build_zoom_focus_menu () { - string choice = zoom_focus_selector.get_active_text(); - ZoomFocus focus_type = ZoomFocusLeft; - - if (choice == _("Left")) { - focus_type = ZoomFocusLeft; - } else if (choice == _("Right")) { - focus_type = ZoomFocusRight; - } else if (choice == _("Center")) { - focus_type = ZoomFocusCenter; - } else if (choice == _("Playhead")) { - focus_type = ZoomFocusPlayhead; - } else if (choice == _("Mouse")) { - focus_type = ZoomFocusMouse; - } else if (choice == _("Edit point")) { - focus_type = ZoomFocusEdit; - } + using namespace Menu_Helpers; - RefPtr<RadioAction> ract = zoom_focus_action (focus_type); + zoom_focus_selector.AddMenuElem (MenuElem ( zoom_focus_strings[(int)ZoomFocusLeft], sigc::bind (sigc::mem_fun(*this, &Editor::zoom_focus_selection_done), (ZoomFocus) ZoomFocusLeft))); + zoom_focus_selector.AddMenuElem (MenuElem ( zoom_focus_strings[(int)ZoomFocusRight], sigc::bind (sigc::mem_fun(*this, &Editor::zoom_focus_selection_done), (ZoomFocus) ZoomFocusRight))); + zoom_focus_selector.AddMenuElem (MenuElem ( zoom_focus_strings[(int)ZoomFocusCenter], sigc::bind (sigc::mem_fun(*this, &Editor::zoom_focus_selection_done), (ZoomFocus) ZoomFocusCenter))); + zoom_focus_selector.AddMenuElem (MenuElem ( zoom_focus_strings[(int)ZoomFocusPlayhead], sigc::bind (sigc::mem_fun(*this, &Editor::zoom_focus_selection_done), (ZoomFocus) ZoomFocusPlayhead))); + zoom_focus_selector.AddMenuElem (MenuElem ( zoom_focus_strings[(int)ZoomFocusMouse], sigc::bind (sigc::mem_fun(*this, &Editor::zoom_focus_selection_done), (ZoomFocus) ZoomFocusMouse))); + zoom_focus_selector.AddMenuElem (MenuElem ( zoom_focus_strings[(int)ZoomFocusEdit], sigc::bind (sigc::mem_fun(*this, &Editor::zoom_focus_selection_done), (ZoomFocus) ZoomFocusEdit))); +} +void +Editor::zoom_focus_selection_done ( ZoomFocus f ) +{ + RefPtr<RadioAction> ract = zoom_focus_action (f); if (ract) { ract->set_active (); } @@ -3530,8 +3506,8 @@ Editor::set_zoom_focus (ZoomFocus f) { string str = zoom_focus_strings[(int)f]; - if (str != zoom_focus_selector.get_active_text()) { - zoom_focus_selector.set_active_text (str); + if (str != zoom_focus_selector.get_text()) { + zoom_focus_selector.set_text (str); } if (zoom_focus != f) { diff --git a/gtk2_ardour/editor.h b/gtk2_ardour/editor.h index 11aea62ee3..3bc094d165 100644 --- a/gtk2_ardour/editor.h +++ b/gtk2_ardour/editor.h @@ -51,6 +51,7 @@ #include "gtk-custom-ruler.h" #include "ardour_button.h" #include "ardour_dialog.h" +#include "ardour_menu.h" #include "public_editor.h" #include "editing.h" #include "enums.h" @@ -1593,35 +1594,40 @@ class Editor : public PublicEditor, public PBD::ScopedConnectionList, public ARD Gtk::VBox automation_box; Gtk::Button automation_mode_button; - Gtk::ComboBoxText edit_mode_selector; + //edit mode menu stuff + ArdourMenu edit_mode_selector; + void edit_mode_selection_done ( ARDOUR::EditMode m ); + void build_edit_mode_menu (); Gtk::VBox edit_mode_box; std::vector<std::string> edit_mode_strings; void set_edit_mode (ARDOUR::EditMode); void cycle_edit_mode (); - void edit_mode_selection_done (); - Gtk::ComboBoxText snap_type_selector; - Gtk::ComboBoxText snap_mode_selector; + ArdourMenu snap_type_selector; + void build_snap_type_menu (); + + ArdourMenu snap_mode_selector; + void build_snap_mode_menu (); Gtk::HBox snap_box; std::vector<std::string> snap_type_strings; std::vector<std::string> snap_mode_strings; - void snap_type_selection_done (); - void snap_mode_selection_done (); + void snap_type_selection_done (Editing::SnapType); + void snap_mode_selection_done (Editing::SnapMode); void snap_mode_chosen (Editing::SnapMode); void snap_type_chosen (Editing::SnapType); Glib::RefPtr<Gtk::RadioAction> snap_type_action (Editing::SnapType); Glib::RefPtr<Gtk::RadioAction> snap_mode_action (Editing::SnapMode); - Gtk::ComboBoxText zoom_focus_selector; - Gtk::VBox zoom_focus_box; - + //zoom focus meu stuff + ArdourMenu zoom_focus_selector; + void zoom_focus_selection_done ( Editing::ZoomFocus f ); + void build_zoom_focus_menu (); std::vector<std::string> zoom_focus_strings; - void zoom_focus_selection_done (); void zoom_focus_chosen (Editing::ZoomFocus); Glib::RefPtr<Gtk::RadioAction> zoom_focus_action (Editing::ZoomFocus); @@ -1943,12 +1949,13 @@ class Editor : public PublicEditor, public PBD::ScopedConnectionList, public ARD Editing::EditPoint _edit_point; - Gtk::ComboBoxText edit_point_selector; + ArdourMenu edit_point_selector; + void build_edit_point_menu(); void set_edit_point_preference (Editing::EditPoint ep, bool force = false); void cycle_edit_point (bool with_marker); void set_edit_point (); - void edit_point_selection_done (); + void edit_point_selection_done (Editing::EditPoint); void edit_point_chosen (Editing::EditPoint); Glib::RefPtr<Gtk::RadioAction> edit_point_action (Editing::EditPoint); std::vector<std::string> edit_point_strings; diff --git a/gtk2_ardour/editor_actions.cc b/gtk2_ardour/editor_actions.cc index 423a9ad1a1..cb7345438f 100644 --- a/gtk2_ardour/editor_actions.cc +++ b/gtk2_ardour/editor_actions.cc @@ -1610,7 +1610,7 @@ Editor::parameter_changed (std::string p) } else if (p == "show-region-fades") { update_region_fade_visibility (); } else if (p == "edit-mode") { - edit_mode_selector.set_active_text (edit_mode_to_string (Config->get_edit_mode())); + edit_mode_selector.set_text (edit_mode_to_string (Config->get_edit_mode())); } else if (p == "show-track-meters") { toggle_meter_updating(); } else if (p == "show-summary") { diff --git a/gtk2_ardour/wscript b/gtk2_ardour/wscript index 760b983457..1340c46fcf 100644 --- a/gtk2_ardour/wscript +++ b/gtk2_ardour/wscript @@ -25,6 +25,7 @@ gtk2_ardour_sources = [ 'analysis_window.cc', 'ardour_button.cc', 'ardour_dialog.cc', + 'ardour_menu.cc', 'ardour_ui.cc', 'ardour_ui2.cc', 'ardour_ui_dependents.cc', |