remove obsolete jack includes in libardour
[ardour.git] / gtk2_ardour / editor_rulers.cc
index bdc7421eb9bf853569def4c9a775b8b236b4d1c3..6e2267bf62b1eca0d9750ee6a2c0d06390e7ed5b 100644 (file)
 #include "editing.h"
 #include "actions.h"
 #include "gui_thread.h"
+#include "ruler_dialog.h"
 #include "time_axis_view.h"
 #include "editor_drag.h"
 #include "editor_cursors.h"
-#include "utils.h"
 
 #include "i18n.h"
 
@@ -122,8 +122,14 @@ void
 Editor::initialize_rulers ()
 {
        ruler_grabbed_widget = 0;
-       Pango::FontDescription font (ARDOUR_UI::config()->get_canvasvar_SmallFont());
-
+       /* Not really sure why we can't get this right in a cross-platform way,
+          but it seems hard.
+       */
+#ifdef __APPLE__       
+       Pango::FontDescription font (ARDOUR_UI::config()->get_SmallerFont());
+#else
+       Pango::FontDescription font (ARDOUR_UI::config()->get_SmallFont());
+#endif
        _timecode_metric = new TimecodeMetric (this);
        _bbt_metric = new BBTMetric (this);
        _minsec_metric = new MinsecMetric (this);
@@ -181,10 +187,10 @@ bool
 Editor::ruler_label_button_release (GdkEventButton* ev)
 {
        if (Gtkmm2ext::Keyboard::is_context_menu_event (ev)) {
-               Gtk::Menu* m = dynamic_cast<Gtk::Menu*> (ActionManager::get_widget (X_("/RulerMenuPopup")));
-               if (m) {
-                       m->popup (1, ev->time);
+               if (!ruler_dialog) {
+                       ruler_dialog = new RulerDialog ();
                }
+               ruler_dialog->present ();
        }
 
        return true;
@@ -231,12 +237,10 @@ Editor::popup_ruler_menu (framepos_t where, ItemType t)
 
        case TempoBarItem:
                ruler_items.push_back (MenuElem (_("New Tempo"), sigc::bind ( sigc::mem_fun(*this, &Editor::mouse_add_new_tempo_event), where)));
-               ruler_items.push_back (SeparatorElem ());
                break;
 
        case MeterBarItem:
                ruler_items.push_back (MenuElem (_("New Meter"), sigc::bind ( sigc::mem_fun(*this, &Editor::mouse_add_new_meter_event), where)));
-               ruler_items.push_back (SeparatorElem ());
                break;
 
        case VideoBarItem:
@@ -255,70 +259,19 @@ Editor::popup_ruler_menu (framepos_t where, ItemType t)
 
                ruler_items.push_back (CheckMenuElem (_("Lock")));
                {
-               Gtk::CheckMenuItem* vtl_lock = static_cast<Gtk::CheckMenuItem*>(&ruler_items.back());
-               vtl_lock->set_active(is_video_timeline_locked());
-               vtl_lock->signal_activate().connect (sigc::mem_fun(*this, &Editor::toggle_video_timeline_locked));
+                       Gtk::CheckMenuItem* vtl_lock = static_cast<Gtk::CheckMenuItem*>(&ruler_items.back());
+                       vtl_lock->set_active(is_video_timeline_locked());
+                       vtl_lock->signal_activate().connect (sigc::mem_fun(*this, &Editor::toggle_video_timeline_locked));
                }
-
-               ruler_items.push_back (SeparatorElem ());
                break;
 
        default:
                break;
        }
 
-       Glib::RefPtr<Action> action;
-
-       action = ActionManager::get_action ("Rulers", "toggle-minsec-ruler");
-       if (action) {
-               ruler_items.push_back (MenuElem (*action->create_menu_item()));
-       }
-       if (!Profile->get_sae()) {
-               action = ActionManager::get_action ("Rulers", "toggle-timecode-ruler");
-               if (action) {
-                       ruler_items.push_back (MenuElem (*action->create_menu_item()));
-               }
-       }
-       action = ActionManager::get_action ("Rulers", "toggle-samples-ruler");
-       if (action) {
-               ruler_items.push_back (MenuElem (*action->create_menu_item()));
+       if (!ruler_items.empty()) {
+               editor_ruler_menu->popup (1, gtk_get_current_event_time());
        }
-       action = ActionManager::get_action ("Rulers", "toggle-bbt-ruler");
-       if (action) {
-               ruler_items.push_back (MenuElem (*action->create_menu_item()));
-       }
-       action = ActionManager::get_action ("Rulers", "toggle-meter-ruler");
-       if (action) {
-               ruler_items.push_back (MenuElem (*action->create_menu_item()));
-       }
-       action = ActionManager::get_action ("Rulers", "toggle-tempo-ruler");
-       if (action) {
-               ruler_items.push_back (MenuElem (*action->create_menu_item()));
-       }
-       if (!Profile->get_sae()) {
-               action = ActionManager::get_action ("Rulers", "toggle-range-ruler");
-               if (action) {
-                       ruler_items.push_back (MenuElem (*action->create_menu_item()));
-               }
-       }
-       action = ActionManager::get_action ("Rulers", "toggle-loop-punch-ruler");
-       if (action) {
-               ruler_items.push_back (MenuElem (*action->create_menu_item()));
-       }
-       action = ActionManager::get_action ("Rulers", "toggle-cd-marker-ruler");
-       if (action) {
-               ruler_items.push_back (MenuElem (*action->create_menu_item()));
-       }
-       action = ActionManager::get_action ("Rulers", "toggle-marker-ruler");
-       if (action) {
-               ruler_items.push_back (MenuElem (*action->create_menu_item()));
-       }
-       action = ActionManager::get_action ("Rulers", "toggle-video-ruler");
-       if (action) {
-               ruler_items.push_back (MenuElem (*action->create_menu_item()));
-       }
-
-       editor_ruler_menu->popup (1, gtk_get_current_event_time());
 
        no_ruler_shown_update = false;
 }