Reduce #includes - avoid ardour_ui.h
authorRobin Gareus <robin@gareus.org>
Fri, 8 Mar 2019 00:53:55 +0000 (01:53 +0100)
committerRobin Gareus <robin@gareus.org>
Fri, 8 Mar 2019 00:53:55 +0000 (01:53 +0100)
gtk2_ardour/automation_controller.cc
gtk2_ardour/context_menu_helper.h [new file with mode: 0644]
gtk2_ardour/editor_summary.cc
gtk2_ardour/meter_strip.cc
gtk2_ardour/mixer_strip.cc
gtk2_ardour/utils.cc
gtk2_ardour/visibility_group.cc

index aa37feabb3281721e5988f0983f7de70986977fe..3d9fc186757ebb1048881fe7141208e4bdc1bcf3 100644 (file)
@@ -32,8 +32,8 @@
 #include "widgets/ardour_button.h"
 #include "widgets/ardour_knob.h"
 
-#include "ardour_ui.h"
 #include "automation_controller.h"
+#include "context_menu_helper.h"
 #include "gui_thread.h"
 #include "note_select_dialog.h"
 #include "timers.h"
@@ -303,14 +303,14 @@ AutomationController::on_button_release(GdkEventButton* ev)
 
        const ARDOUR::ParameterDescriptor& desc = _controllable->desc();
        if (desc.unit == ARDOUR::ParameterDescriptor::MIDI_NOTE) {
-               Gtk::Menu* menu  = ARDOUR_UI::instance()->shared_popup_menu ();
+               Gtk::Menu* menu  = ARDOUR_UI_UTILS::shared_popup_menu ();
                MenuList&  items = menu->items();
                items.push_back(MenuElem(_("Select Note..."),
                                         sigc::mem_fun(*this, &AutomationController::run_note_select_dialog)));
                menu->popup(1, ev->time);
                return true;
        } else if (desc.unit == ARDOUR::ParameterDescriptor::HZ) {
-               Gtk::Menu* menu  = ARDOUR_UI::instance()->shared_popup_menu ();
+               Gtk::Menu* menu  = ARDOUR_UI_UTILS::shared_popup_menu ();
                MenuList&  items = menu->items();
                items.push_back(MenuElem(_("Halve"),
                                         sigc::bind(sigc::mem_fun(*this, &AutomationController::set_ratio),
diff --git a/gtk2_ardour/context_menu_helper.h b/gtk2_ardour/context_menu_helper.h
new file mode 100644 (file)
index 0000000..7d8f5ff
--- /dev/null
@@ -0,0 +1,30 @@
+/*
+ * Copyright (C) 2019 Robin Gareus <robin@gareus.org>
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License along
+ * with this program; if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+ */
+
+#ifndef _gtkardour_context_menu_helper_h_
+#define _gtkardour_context_menu_helper_h_
+
+namespace Gtk {
+       class Menu;
+}
+
+namespace ARDOUR_UI_UTILS {
+       Gtk::Menu* shared_popup_menu ();
+}
+
+#endif
index ab80917229a31bf6125b4cc559285949b1ac0886..ac86e884c2b6d61fc779f3b4491685ba8f34ae53 100644 (file)
@@ -24,7 +24,7 @@
 #include <gtkmm/menu.h>
 #include <gtkmm/menuitem.h>
 
-#include "ardour_ui.h"
+#include "context_menu_helper.h"
 #include "time_axis_view.h"
 #include "streamview.h"
 #include "editor_summary.h"
@@ -462,7 +462,7 @@ EditorSummary::on_button_press_event (GdkEventButton* ev)
 
        if (ev->button == 3) { // right-click:  show the reset menu action
                using namespace Gtk::Menu_Helpers;
-               Gtk::Menu* m = ARDOUR_UI::instance()->shared_popup_menu ();
+               Gtk::Menu* m = ARDOUR_UI_UTILS::shared_popup_menu ();
                MenuList& items = m->items ();
                items.push_back(MenuElem(_("Reset Summary to Extents"),
                        sigc::mem_fun(*this, &EditorSummary::reset_to_extents)));
index ea6ace2af1944b37b1109bd4c61ef18481ff17b3..079d6c00f09ca3d7f309fac9d101505d7312f0ae 100644 (file)
@@ -40,8 +40,8 @@
 #include "widgets/tooltips.h"
 
 #include "gui_thread.h"
-#include "ardour_ui.h"
 #include "ardour_window.h"
+#include "context_menu_helper.h"
 #include "ui_config.h"
 #include "utils.h"
 
@@ -838,7 +838,7 @@ MeterStrip::popup_level_meter_menu (GdkEventButton* ev)
 {
        using namespace Gtk::Menu_Helpers;
 
-       Gtk::Menu* m = ARDOUR_UI::instance()->shared_popup_menu ();
+       Gtk::Menu* m = ARDOUR_UI_UTILS::shared_popup_menu ();
        MenuList& items = m->items ();
 
        RadioMenuItem::Group group;
@@ -889,7 +889,7 @@ MeterStrip::popup_name_label_menu (GdkEventButton* ev)
 {
        using namespace Gtk::Menu_Helpers;
 
-       Gtk::Menu* m = ARDOUR_UI::instance()->shared_popup_menu ();
+       Gtk::Menu* m = ARDOUR_UI_UTILS::shared_popup_menu ();
        MenuList& items = m->items ();
 
        RadioMenuItem::Group group;
index 052f08204ee4e18c951e1922d7f59b55bf10c2e6..de4551940ae5fca02be295379a409430cd9adb5c 100644 (file)
@@ -59,8 +59,8 @@
 
 #include "widgets/tooltips.h"
 
-#include "ardour_ui.h"
 #include "ardour_window.h"
+#include "context_menu_helper.h"
 #include "enums_convert.h"
 #include "mixer_strip.h"
 #include "mixer_ui.h"
@@ -2521,7 +2521,7 @@ MixerStrip::popup_level_meter_menu (GdkEventButton* ev)
 {
        using namespace Gtk::Menu_Helpers;
 
-       Gtk::Menu* m = ARDOUR_UI::instance()->shared_popup_menu ();
+       Gtk::Menu* m = ARDOUR_UI_UTILS::shared_popup_menu ();
        MenuList& items = m->items ();
 
        RadioMenuItem::Group group;
index a4578494d18748b8d4f6089af649b46d821c6f75..098b2c989230ff486a40b47a99f622157935a48f 100644 (file)
@@ -53,6 +53,7 @@
 #include "canvas/item.h"
 
 #include "actions.h"
+#include "context_menu_helper.h"
 #include "debug.h"
 #include "public_editor.h"
 #include "keyboard.h"
@@ -816,3 +817,9 @@ ARDOUR_UI_UTILS::running_from_source_tree ()
        gchar const *x = g_getenv ("ARDOUR_THEMES_PATH");
        return x && (string (x).find ("gtk2_ardour") != string::npos);
 }
+
+Gtk::Menu*
+ARDOUR_UI_UTILS::shared_popup_menu ()
+{
+       return ARDOUR_UI::instance()->shared_popup_menu ();
+}
index 0090e39019918c11d471184217e18083a9b72966..c6aae3244bcdee369ca55238f0a694dfa0db29bc 100644 (file)
@@ -25,7 +25,7 @@
 #include "pbd/strsplit.h"
 #include "pbd/xml++.h"
 
-#include "ardour_ui.h"
+#include "context_menu_helper.h"
 #include "visibility_group.h"
 
 #include "pbd/i18n.h"
@@ -72,7 +72,7 @@ VisibilityGroup::button_press_event (GdkEventButton* ev)
 
        using namespace Gtk::Menu_Helpers;
 
-       Gtk::Menu* m = ARDOUR_UI::instance()->shared_popup_menu ();
+       Gtk::Menu* m = ARDOUR_UI_UTILS::shared_popup_menu ();
        MenuList& items = m->items ();
 
        for (vector<Member>::iterator i = _members.begin(); i != _members.end(); ++i) {