if (tact) {
bool x = (Config->*get)();
+
+ cerr << "\ttoggle config, action = " << tact->get_active() << " config = " << x << endl;
if (x != tact->get_active()) {
(Config->*set) (!x);
Glib::RefPtr<ToggleAction> tact = Glib::RefPtr<ToggleAction>::cast_dynamic(act);
if (tact) {
+
bool x = (Config->*get)();
+
+ cerr << "\tmap state, action = " << tact->get_active() << " config = " << x << endl;
if (tact->get_active() != x) {
tact->set_active (x);
}
+ } else {
+ cerr << "not a toggle\n";
}
+ } else {
+ cerr << group << ':' << action << " not an action\n";
}
}
void
ARDOUR_UI::parameter_changed (const char* parameter_name)
{
+ cerr << "Parameter changed : " << parameter_name << endl;
+
#define PARAM_IS(x) (!strcmp (parameter_name, (x)))
if (PARAM_IS ("slave-source")) {
map_some_state ("options", "UseMIDIcontrol", &Configuration::get_midi_control);
} else if (PARAM_IS ("do-not-record-plugins")) {
map_some_state ("options", "DoNotRunPluginsWhileRecording", &Configuration::get_do_not_record_plugins);
+ } else if (PARAM_IS ("automatic-crossfades")) {
+ map_some_state ("Editor", "toggle-auto-xfades", &Configuration::get_automatic_crossfades);
} else if (PARAM_IS ("crossfades-active")) {
- map_some_state ("options", "CrossfadesActive", &Configuration::get_crossfades_active);
+ map_some_state ("Editor", "toggle-xfades-active", &Configuration::get_crossfades_active);
+ } else if (PARAM_IS ("crossfades-visible")) {
+ map_some_state ("Editor", "toggle-xfades-visible", &Configuration::get_crossfades_visible);
} else if (PARAM_IS ("latched-record-enable")) {
map_some_state ("options", "LatchedRecordEnable", &Configuration::get_latched_record_enable);
} else if (PARAM_IS ("solo-latched")) {
int set_state (const XMLNode&);
XMLNode& get_state (void);
- XMLNode& get_partial_state (ConfigVariableBase::Owner);
+ XMLNode& get_variables (sigc::slot<bool,ConfigVariableBase::Owner>);
void set_variables (const XMLNode&, ConfigVariableBase::Owner owner);
void set_current_owner (ConfigVariableBase::Owner);
ConfigVariableBase::Owner current_owner;
XMLNode* _control_protocol_state;
- XMLNode& state (ConfigVariableBase::Owner);
+ XMLNode& state (sigc::slot<bool,ConfigVariableBase::Owner>);
+ bool save_config_options_predicate (ConfigVariableBase::Owner owner);
};
extern Configuration *Config;
class ConfigVariableBase {
public:
enum Owner {
- Default,
- System,
- Config,
- Session,
- Interface
+ Default = 0x1,
+ System = 0x2,
+ Config = 0x4,
+ Session = 0x8,
+ Interface = 0x10
};
ConfigVariableBase (std::string str) : _name (str), _owner (Default) {}
return false;
}
value = val;
- _owner = owner;
+ _owner = (ConfigVariableBase::Owner)(_owner |owner);
return true;
}
std::stringstream ss;
ss << prop->value();
ss >> value;
- _owner = owner;
+ _owner = (ConfigVariableBase::Owner)(_owner |owner);
return true;
}
}
std::stringstream ss;
ss << opt_prop->value();
ss >> value;
- _owner = owner;
+ _owner = (ConfigVariableBase::Owner)(_owner |owner);
return true;
}
}
CONFIG_VARIABLE (bool, mmc_control, "mmc-control", false)
CONFIG_VARIABLE (bool, midi_feedback, "midi-feedback", false)
CONFIG_VARIABLE (bool, midi_control, "midi-control", false)
+CONFIG_VARIABLE (bool, automatic_crossfades, "automatic-crossfades", false)
CONFIG_VARIABLE (bool, crossfades_active, "crossfades-active", false)
+CONFIG_VARIABLE (bool, crossfades_visible, "crossfades-visible", false)
CONFIG_VARIABLE (bool, seamless_loop, "seamless-loop", false)
-CONFIG_VARIABLE (bool, do_not_record_plugins, "do_not_record_plugins", false)
+CONFIG_VARIABLE (bool, do_not_record_plugins, "do-not-record-plugins", false)
CONFIG_VARIABLE (AutoConnectOption, output_auto_connect, "output-auto-connect", AutoConnectOption (0))
CONFIG_VARIABLE (AutoConnectOption, input_auto_connect, "input-auto-connect", AutoConnectOption (0))
CONFIG_VARIABLE (EditMode, edit_mode, "edit-mode", Slide)
int load_options (const XMLNode&);
XMLNode& get_options () const;
int load_state (string snapshot_name);
+ bool save_config_options_predicate (ConfigVariableBase::Owner owner) const;
nframes_t _last_roll_location;
nframes_t _last_record_location;
XMLTree tree;
string rcfile;
- /* Note: this only writes the state not touched by Session or Interface
- */
-
rcfile = get_user_ardour_path ();
rcfile += "ardour.rc";
if (rcfile.length()) {
- tree.set_root (&state (ConfigVariableBase::Config));
+ tree.set_root (&get_state());
if (!tree.write (rcfile.c_str())){
error << string_compose (_("Config file %1 not saved"), rcfile) << endmsg;
return -1;
return 0;
}
-XMLNode&
-Configuration::get_state ()
+bool
+Configuration::save_config_options_predicate (ConfigVariableBase::Owner owner)
{
- return state (ConfigVariableBase::Config);
+ const ConfigVariableBase::Owner default_or_from_config_file = (ConfigVariableBase::Owner)
+ (ConfigVariableBase::Default|ConfigVariableBase::System|ConfigVariableBase::Config);
+
+ return owner & default_or_from_config_file;
}
XMLNode&
-Configuration::get_partial_state (ConfigVariableBase::Owner owner)
+Configuration::get_state ()
{
- return state (owner);
+ XMLNode* root;
+ LocaleGuard lg (X_("POSIX"));
+
+ root = new XMLNode("Ardour");
+ typedef map<string, MidiPortDescriptor*>::const_iterator CI;
+ for(CI m = midi_ports.begin(); m != midi_ports.end(); ++m){
+ root->add_child_nocopy(m->second->get_state());
+ }
+
+ root->add_child_nocopy (get_variables (sigc::mem_fun (*this, &Configuration::save_config_options_predicate)));
+
+ if (_extra_xml) {
+ root->add_child_copy (*_extra_xml);
+ }
+
+ root->add_child_nocopy (ControlProtocolManager::instance().get_state());
+ root->add_child_nocopy (Library->get_state());
+
+ return *root;
}
XMLNode&
-Configuration::state (ConfigVariableBase::Owner owner)
+Configuration::get_variables (sigc::slot<bool,ConfigVariableBase::Owner> predicate)
{
- XMLNode* root;
XMLNode* node;
LocaleGuard lg (X_("POSIX"));
#undef CONFIG_VARIABLE
#undef CONFIG_VARIABLE_SPECIAL
#define CONFIG_VARIABLE(type,var,name,value) \
- if (var.owner() <= owner) var.add_to_node (*node);
+ if (predicate (var.owner())) { var.add_to_node (*node); }
#define CONFIG_VARIABLE_SPECIAL(type,var,name,value,mutator) \
- if (var.owner() <= owner) var.add_to_node (*node);
+ if (predicate (var.owner())) { var.add_to_node (*node); }
#include "ardour/configuration_vars.h"
#undef CONFIG_VARIABLE
#undef CONFIG_VARIABLE_SPECIAL
-
- if (owner == ConfigVariableBase::Config) {
-
- root = new XMLNode("Ardour");
- typedef map<string, MidiPortDescriptor*>::const_iterator CI;
- for(CI m = midi_ports.begin(); m != midi_ports.end(); ++m){
- root->add_child_nocopy(m->second->get_state());
- }
-
- root->add_child_nocopy (*node);
-
- if (_extra_xml) {
- root->add_child_copy (*_extra_xml);
- }
-
- root->add_child_nocopy (ControlProtocolManager::instance().get_state());
- root->add_child_nocopy (Library->get_state());
-
- } else {
-
- root = node;
- }
-
- return *root;
+
+ return *node;
}
int
return 0;
}
+bool
+Session::save_config_options_predicate (ConfigVariableBase::Owner owner) const
+{
+ const ConfigVariableBase::Owner modified_by_session_or_user = (ConfigVariableBase::Owner)
+ (ConfigVariableBase::Session|ConfigVariableBase::Interface);
+
+ return owner & modified_by_session_or_user;
+}
+
XMLNode&
Session::get_options () const
{
XMLNode* child;
LocaleGuard lg (X_("POSIX"));
- XMLNode& option_root = Config->get_partial_state (ConfigVariableBase::Interface);
+ XMLNode& option_root = Config->get_variables (mem_fun (*this, &Session::save_config_options_predicate));
child = option_root.add_child ("end-marker-is-free");
child->add_property ("val", _end_location_is_free ? "yes" : "no");