mirror of
https://github.com/Ardour/ardour.git
synced 2026-01-04 12:45:45 +01:00
Move control surface options into RC prefs editor. Remove Options menu.
git-svn-id: svn://localhost/ardour2/branches/3.0@5088 d708f5d6-7413-0410-9779-e7cbd77b26cf
This commit is contained in:
parent
dab9b3aa8c
commit
73a6b8ef25
4 changed files with 116 additions and 141 deletions
|
|
@ -432,8 +432,6 @@
|
|||
<menuitem action='toggle-midi-connection-manager'/>
|
||||
<separator/>
|
||||
</menu>
|
||||
<menu name='Options' action='Options'>
|
||||
</menu>
|
||||
<menu name='Help' action='Help'>
|
||||
<menuitem action='About'/>
|
||||
</menu>
|
||||
|
|
|
|||
|
|
@ -494,7 +494,6 @@ class ARDOUR_UI : public Gtkmm2ext::UI
|
|||
|
||||
void use_menubar_as_top_menubar ();
|
||||
void build_menu_bar ();
|
||||
void build_control_surface_menu ();
|
||||
|
||||
Gtk::Label wall_clock_label;
|
||||
Gtk::EventBox wall_clock_box;
|
||||
|
|
@ -685,9 +684,6 @@ class ARDOUR_UI : public Gtkmm2ext::UI
|
|||
void mtc_port_changed ();
|
||||
void parameter_changed (std::string);
|
||||
|
||||
void toggle_control_protocol (ARDOUR::ControlProtocolInfo*);
|
||||
void toggle_control_protocol_feedback (ARDOUR::ControlProtocolInfo*, const char* group_name, std::string action_name);
|
||||
|
||||
bool first_idle ();
|
||||
|
||||
void no_memory_warning ();
|
||||
|
|
|
|||
|
|
@ -91,7 +91,6 @@ ARDOUR_UI::install_actions ()
|
|||
ActionManager::register_action (main_actions, X_("Files"), _("Import/Export"));
|
||||
ActionManager::register_action (main_actions, X_("Cleanup"), _("Cleanup"));
|
||||
ActionManager::register_action (main_actions, X_("Sync"), _("Sync"));
|
||||
ActionManager::register_action (main_actions, X_("Options"), _("Options"));
|
||||
ActionManager::register_action (main_actions, X_("TransportOptions"), _("Options"));
|
||||
ActionManager::register_action (main_actions, X_("Help"), _("Help"));
|
||||
ActionManager::register_action (main_actions, X_("KeyMouseActions"), _("Misc. Shortcuts"));
|
||||
|
|
@ -450,52 +449,6 @@ ARDOUR_UI::install_actions ()
|
|||
ActionManager::add_action_group (common_actions);
|
||||
}
|
||||
|
||||
void
|
||||
ARDOUR_UI::toggle_control_protocol (ControlProtocolInfo* cpi)
|
||||
{
|
||||
if (!session) {
|
||||
/* this happens when we build the menu bar when control protocol support
|
||||
has been used in the past for some given protocol - the item needs
|
||||
to be made active, but there is no session yet.
|
||||
*/
|
||||
return;
|
||||
}
|
||||
|
||||
if (cpi->protocol == 0) {
|
||||
ControlProtocolManager::instance().instantiate (*cpi);
|
||||
} else {
|
||||
ControlProtocolManager::instance().teardown (*cpi);
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
ARDOUR_UI::toggle_control_protocol_feedback (ControlProtocolInfo* cpi, const char* group, string action)
|
||||
{
|
||||
if (!session) {
|
||||
/* this happens when we build the menu bar when control protocol support
|
||||
has been used in the past for some given protocol - the item needs
|
||||
to be made active, but there is no session yet.
|
||||
*/
|
||||
return;
|
||||
}
|
||||
|
||||
if (cpi->protocol) {
|
||||
Glib::RefPtr<Gtk::Action> act = ActionManager::get_action (group, action.c_str());
|
||||
|
||||
if (act) {
|
||||
Glib::RefPtr<ToggleAction> tact = Glib::RefPtr<ToggleAction>::cast_dynamic (act);
|
||||
|
||||
if (tact) {
|
||||
bool x = tact->get_active();
|
||||
|
||||
if (x != cpi->protocol->get_feedback()) {
|
||||
cpi->protocol->set_feedback (x);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
ARDOUR_UI::set_jack_buffer_size (nframes_t nframes)
|
||||
{
|
||||
|
|
@ -547,84 +500,9 @@ ARDOUR_UI::set_jack_buffer_size (nframes_t nframes)
|
|||
}
|
||||
}
|
||||
|
||||
void
|
||||
ARDOUR_UI::build_control_surface_menu ()
|
||||
{
|
||||
list<ControlProtocolInfo*>::iterator i;
|
||||
bool with_feedback;
|
||||
|
||||
/* !!! this has to match the top level entry from ardour.menus */
|
||||
|
||||
string ui = "<menubar name='Main' action='MainMenu'>\n"
|
||||
"<menu name='Options' action='Options'>\n"
|
||||
"<menu action='ControlSurfaces'><separator/>\n";
|
||||
|
||||
for (i = ControlProtocolManager::instance().control_protocol_info.begin();
|
||||
i != ControlProtocolManager::instance().control_protocol_info.end(); ++i) {
|
||||
|
||||
if (!(*i)->mandatory) {
|
||||
|
||||
// Enable surface
|
||||
|
||||
string action_name = "Toggle";
|
||||
action_name += legalize_for_path ((*i)->name);
|
||||
action_name += "Surface";
|
||||
|
||||
string action_label = (*i)->name;
|
||||
|
||||
Glib::RefPtr<Action> act = ActionManager::register_toggle_action (
|
||||
editor->editor_actions, action_name.c_str(), action_label.c_str(), (bind (
|
||||
mem_fun (*this, &ARDOUR_UI::toggle_control_protocol),
|
||||
*i)));
|
||||
|
||||
Glib::RefPtr<ToggleAction> tact = Glib::RefPtr<ToggleAction>::cast_dynamic (act);
|
||||
|
||||
with_feedback = false;
|
||||
|
||||
if ((*i)->protocol || (*i)->requested) {
|
||||
tact->set_active ();
|
||||
}
|
||||
|
||||
ui += "<menuitem action='";
|
||||
ui += action_name;
|
||||
ui += "'/>\n";
|
||||
|
||||
// Enable feedback
|
||||
|
||||
if ((*i)->supports_feedback) {
|
||||
|
||||
action_name += "Feedback";
|
||||
string feedback_label = action_label + " " + _("Feedback");
|
||||
|
||||
Glib::RefPtr<Action> act = ActionManager::register_toggle_action (
|
||||
editor->editor_actions, action_name.c_str(), feedback_label.c_str(), (bind (
|
||||
mem_fun (*this, &ARDOUR_UI::toggle_control_protocol_feedback),
|
||||
*i, "Editor", action_name)));
|
||||
|
||||
ui += "<menuitem action='";
|
||||
ui += action_name;
|
||||
ui += "'/>\n";
|
||||
|
||||
if ((*i)->protocol) {
|
||||
Glib::RefPtr<ToggleAction> tact = Glib::RefPtr<ToggleAction>::cast_dynamic (act);
|
||||
tact->set_active ((*i)->protocol->get_feedback ());
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
ui += "</menu>\n</menu>\n</menubar>\n";
|
||||
|
||||
ActionManager::ui_manager->add_ui_from_string (ui);
|
||||
}
|
||||
|
||||
void
|
||||
ARDOUR_UI::build_menu_bar ()
|
||||
{
|
||||
if (!Profile->get_sae()) {
|
||||
build_control_surface_menu ();
|
||||
}
|
||||
|
||||
menu_bar = dynamic_cast<MenuBar*> (ActionManager::get_widget (X_("/Main")));
|
||||
menu_bar->set_name ("MainMenuBar");
|
||||
|
||||
|
|
|
|||
|
|
@ -6,6 +6,8 @@
|
|||
#include "midi++/manager.h"
|
||||
#include "midi++/factory.h"
|
||||
#include "ardour/rc_configuration.h"
|
||||
#include "ardour/control_protocol_manager.h"
|
||||
#include "control_protocol/control_protocol.h"
|
||||
#include "rc_option_editor.h"
|
||||
#include "utils.h"
|
||||
#include "midi_port_dialog.h"
|
||||
|
|
@ -30,6 +32,8 @@ public:
|
|||
_store = ListStore::create (_model);
|
||||
_view.set_model (_store);
|
||||
_view.append_column (_("Name"), _model.name);
|
||||
_view.get_column(0)->set_resizable (true);
|
||||
_view.get_column(0)->set_expand (true);
|
||||
_view.append_column_editable (_("Online"), _model.online);
|
||||
_view.append_column_editable (_("Trace input"), _model.trace_input);
|
||||
_view.append_column_editable (_("Trace output"), _model.trace_output);
|
||||
|
|
@ -689,6 +693,101 @@ private:
|
|||
HScale _dpi_slider;
|
||||
};
|
||||
|
||||
|
||||
class ControlSurfacesOptions : public OptionEditorBox
|
||||
{
|
||||
public:
|
||||
ControlSurfacesOptions ()
|
||||
{
|
||||
_store = ListStore::create (_model);
|
||||
_view.set_model (_store);
|
||||
_view.append_column (_("Name"), _model.name);
|
||||
_view.get_column(0)->set_resizable (true);
|
||||
_view.get_column(0)->set_expand (true);
|
||||
_view.append_column_editable (_("Enabled"), _model.enabled);
|
||||
_view.append_column_editable (_("Feedback"), _model.feedback);
|
||||
|
||||
_box->pack_start (_view, false, false);
|
||||
|
||||
_store->signal_row_changed().connect (mem_fun (*this, &ControlSurfacesOptions::model_changed));
|
||||
}
|
||||
|
||||
void parameter_changed (std::string const &)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
void set_state_from_config ()
|
||||
{
|
||||
_store->clear ();
|
||||
|
||||
ControlProtocolManager& m = ControlProtocolManager::instance ();
|
||||
for (list<ControlProtocolInfo*>::iterator i = m.control_protocol_info.begin(); i != m.control_protocol_info.end(); ++i) {
|
||||
|
||||
if (!(*i)->mandatory) {
|
||||
TreeModel::Row r = *_store->append ();
|
||||
r[_model.name] = (*i)->name;
|
||||
r[_model.enabled] = ((*i)->protocol || (*i)->requested);
|
||||
r[_model.feedback] = ((*i)->protocol && (*i)->protocol->get_feedback ());
|
||||
r[_model.protocol_info] = *i;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private:
|
||||
|
||||
void model_changed (TreeModel::Path const & p, TreeModel::iterator const & i)
|
||||
{
|
||||
TreeModel::Row r = *i;
|
||||
|
||||
ControlProtocolInfo* cpi = r[_model.protocol_info];
|
||||
if (!cpi) {
|
||||
return;
|
||||
}
|
||||
|
||||
bool const was_enabled = (cpi->protocol != 0);
|
||||
bool const is_enabled = r[_model.enabled];
|
||||
|
||||
if (was_enabled != is_enabled) {
|
||||
if (!was_enabled) {
|
||||
ControlProtocolManager::instance().instantiate (*cpi);
|
||||
} else {
|
||||
ControlProtocolManager::instance().teardown (*cpi);
|
||||
}
|
||||
}
|
||||
|
||||
bool const was_feedback = (cpi->protocol && cpi->protocol->get_feedback ());
|
||||
bool const is_feedback = r[_model.feedback];
|
||||
|
||||
if (was_feedback != is_feedback && cpi->protocol) {
|
||||
cpi->protocol->set_feedback (is_feedback);
|
||||
}
|
||||
}
|
||||
|
||||
class ControlSurfacesModelColumns : public TreeModelColumnRecord
|
||||
{
|
||||
public:
|
||||
|
||||
ControlSurfacesModelColumns ()
|
||||
{
|
||||
add (name);
|
||||
add (enabled);
|
||||
add (feedback);
|
||||
add (protocol_info);
|
||||
}
|
||||
|
||||
TreeModelColumn<string> name;
|
||||
TreeModelColumn<bool> enabled;
|
||||
TreeModelColumn<bool> feedback;
|
||||
TreeModelColumn<ControlProtocolInfo*> protocol_info;
|
||||
};
|
||||
|
||||
Glib::RefPtr<ListStore> _store;
|
||||
ControlSurfacesModelColumns _model;
|
||||
TreeView _view;
|
||||
};
|
||||
|
||||
|
||||
RCOptionEditor::RCOptionEditor ()
|
||||
: OptionEditor (Config, _("Ardour Preferences")),
|
||||
_rc_config (Config)
|
||||
|
|
@ -734,19 +833,6 @@ RCOptionEditor::RCOptionEditor ()
|
|||
|
||||
add_option (_("Misc"), new OptionEditorHeading (_("Misc")));
|
||||
|
||||
ComboOption<RemoteModel>* rm = new ComboOption<RemoteModel> (
|
||||
"remote-model",
|
||||
_("Control surface remote ID"),
|
||||
mem_fun (*_rc_config, &RCConfiguration::get_remote_model),
|
||||
mem_fun (*_rc_config, &RCConfiguration::set_remote_model)
|
||||
);
|
||||
|
||||
rm->add (UserOrdered, _("assigned by user"));
|
||||
rm->add (MixerOrdered, _("follows order of mixer"));
|
||||
rm->add (EditorOrdered, _("follows order of editor"));
|
||||
|
||||
add_option (_("Misc"), rm);
|
||||
|
||||
#ifndef GTKOSX
|
||||
/* font scaling does nothing with GDK/Quartz */
|
||||
add_option (_("Misc"), new FontScalingOptions (_rc_config));
|
||||
|
|
@ -1082,6 +1168,23 @@ RCOptionEditor::RCOptionEditor ()
|
|||
-1, 65536, 1, 10
|
||||
));
|
||||
|
||||
/* CONTROL SURFACES */
|
||||
|
||||
add_option (_("Control surfaces"), new ControlSurfacesOptions);
|
||||
|
||||
ComboOption<RemoteModel>* rm = new ComboOption<RemoteModel> (
|
||||
"remote-model",
|
||||
_("Control surface remote ID"),
|
||||
mem_fun (*_rc_config, &RCConfiguration::get_remote_model),
|
||||
mem_fun (*_rc_config, &RCConfiguration::set_remote_model)
|
||||
);
|
||||
|
||||
rm->add (UserOrdered, _("assigned by user"));
|
||||
rm->add (MixerOrdered, _("follows order of mixer"));
|
||||
rm->add (EditorOrdered, _("follows order of editor"));
|
||||
|
||||
add_option (_("Control surfaces"), rm);
|
||||
|
||||
/* CLICK */
|
||||
|
||||
add_option (_("Click"), new ClickOptions (_rc_config, this));
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue