Reduce #includes - avoid ardour_ui.h

This commit is contained in:
Robin Gareus 2019-03-08 01:53:55 +01:00
parent d42c0f2d60
commit 2e5daf2eeb
No known key found for this signature in database
GPG key ID: A090BCE02CF57F04
7 changed files with 49 additions and 12 deletions

View file

@ -32,8 +32,8 @@
#include "widgets/ardour_button.h" #include "widgets/ardour_button.h"
#include "widgets/ardour_knob.h" #include "widgets/ardour_knob.h"
#include "ardour_ui.h"
#include "automation_controller.h" #include "automation_controller.h"
#include "context_menu_helper.h"
#include "gui_thread.h" #include "gui_thread.h"
#include "note_select_dialog.h" #include "note_select_dialog.h"
#include "timers.h" #include "timers.h"
@ -303,14 +303,14 @@ AutomationController::on_button_release(GdkEventButton* ev)
const ARDOUR::ParameterDescriptor& desc = _controllable->desc(); const ARDOUR::ParameterDescriptor& desc = _controllable->desc();
if (desc.unit == ARDOUR::ParameterDescriptor::MIDI_NOTE) { 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(); MenuList& items = menu->items();
items.push_back(MenuElem(_("Select Note..."), items.push_back(MenuElem(_("Select Note..."),
sigc::mem_fun(*this, &AutomationController::run_note_select_dialog))); sigc::mem_fun(*this, &AutomationController::run_note_select_dialog)));
menu->popup(1, ev->time); menu->popup(1, ev->time);
return true; return true;
} else if (desc.unit == ARDOUR::ParameterDescriptor::HZ) { } 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(); MenuList& items = menu->items();
items.push_back(MenuElem(_("Halve"), items.push_back(MenuElem(_("Halve"),
sigc::bind(sigc::mem_fun(*this, &AutomationController::set_ratio), sigc::bind(sigc::mem_fun(*this, &AutomationController::set_ratio),

View file

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

View file

@ -24,7 +24,7 @@
#include <gtkmm/menu.h> #include <gtkmm/menu.h>
#include <gtkmm/menuitem.h> #include <gtkmm/menuitem.h>
#include "ardour_ui.h" #include "context_menu_helper.h"
#include "time_axis_view.h" #include "time_axis_view.h"
#include "streamview.h" #include "streamview.h"
#include "editor_summary.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 if (ev->button == 3) { // right-click: show the reset menu action
using namespace Gtk::Menu_Helpers; 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 (); MenuList& items = m->items ();
items.push_back(MenuElem(_("Reset Summary to Extents"), items.push_back(MenuElem(_("Reset Summary to Extents"),
sigc::mem_fun(*this, &EditorSummary::reset_to_extents))); sigc::mem_fun(*this, &EditorSummary::reset_to_extents)));

View file

@ -40,8 +40,8 @@
#include "widgets/tooltips.h" #include "widgets/tooltips.h"
#include "gui_thread.h" #include "gui_thread.h"
#include "ardour_ui.h"
#include "ardour_window.h" #include "ardour_window.h"
#include "context_menu_helper.h"
#include "ui_config.h" #include "ui_config.h"
#include "utils.h" #include "utils.h"
@ -838,7 +838,7 @@ MeterStrip::popup_level_meter_menu (GdkEventButton* ev)
{ {
using namespace Gtk::Menu_Helpers; 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 (); MenuList& items = m->items ();
RadioMenuItem::Group group; RadioMenuItem::Group group;
@ -889,7 +889,7 @@ MeterStrip::popup_name_label_menu (GdkEventButton* ev)
{ {
using namespace Gtk::Menu_Helpers; 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 (); MenuList& items = m->items ();
RadioMenuItem::Group group; RadioMenuItem::Group group;

View file

@ -59,8 +59,8 @@
#include "widgets/tooltips.h" #include "widgets/tooltips.h"
#include "ardour_ui.h"
#include "ardour_window.h" #include "ardour_window.h"
#include "context_menu_helper.h"
#include "enums_convert.h" #include "enums_convert.h"
#include "mixer_strip.h" #include "mixer_strip.h"
#include "mixer_ui.h" #include "mixer_ui.h"
@ -2521,7 +2521,7 @@ MixerStrip::popup_level_meter_menu (GdkEventButton* ev)
{ {
using namespace Gtk::Menu_Helpers; 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 (); MenuList& items = m->items ();
RadioMenuItem::Group group; RadioMenuItem::Group group;

View file

@ -53,6 +53,7 @@
#include "canvas/item.h" #include "canvas/item.h"
#include "actions.h" #include "actions.h"
#include "context_menu_helper.h"
#include "debug.h" #include "debug.h"
#include "public_editor.h" #include "public_editor.h"
#include "keyboard.h" #include "keyboard.h"
@ -816,3 +817,9 @@ ARDOUR_UI_UTILS::running_from_source_tree ()
gchar const *x = g_getenv ("ARDOUR_THEMES_PATH"); gchar const *x = g_getenv ("ARDOUR_THEMES_PATH");
return x && (string (x).find ("gtk2_ardour") != string::npos); return x && (string (x).find ("gtk2_ardour") != string::npos);
} }
Gtk::Menu*
ARDOUR_UI_UTILS::shared_popup_menu ()
{
return ARDOUR_UI::instance()->shared_popup_menu ();
}

View file

@ -25,7 +25,7 @@
#include "pbd/strsplit.h" #include "pbd/strsplit.h"
#include "pbd/xml++.h" #include "pbd/xml++.h"
#include "ardour_ui.h" #include "context_menu_helper.h"
#include "visibility_group.h" #include "visibility_group.h"
#include "pbd/i18n.h" #include "pbd/i18n.h"
@ -72,7 +72,7 @@ VisibilityGroup::button_press_event (GdkEventButton* ev)
using namespace Gtk::Menu_Helpers; 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 (); MenuList& items = m->items ();
for (vector<Member>::iterator i = _members.begin(); i != _members.end(); ++i) { for (vector<Member>::iterator i = _members.begin(); i != _members.end(); ++i) {