#include "pbd/failed_constructor.h"
#include "pbd/xml++.h"
-#include "pbd/filesystem.h"
#include "pbd/file_utils.h"
#include "pbd/error.h"
#undef CANVAS_VARIABLE
#define UI_CONFIG_VARIABLE(Type,var,name,val) var (name,val),
#define CANVAS_VARIABLE(var,name) var (name),
+#define CANVAS_STRING_VARIABLE(var,name) var (name),
#include "ui_config_vars.h"
#include "canvas_vars.h"
#undef UI_CONFIG_VARIABLE
#undef CANVAS_VARIABLE
+#undef CANVAS_STRING_VARIABLE
_dirty (false)
{
load_state();
{
}
+void
+UIConfiguration::map_parameters (boost::function<void (std::string)>& functor)
+{
+#undef UI_CONFIG_VARIABLE
+#define UI_CONFIG_VARIABLE(Type,var,Name,value) functor (Name);
+#include "ui_config_vars.h"
+#undef UI_CONFIG_VARIABLE
+}
+
int
UIConfiguration::load_defaults ()
{
{
XMLTree tree;
- sys::path rcfile_path(user_config_directory());
-
- rcfile_path /= "ardour3_ui.conf";
- const string rcfile = rcfile_path.to_string();
+ std::string rcfile(user_config_directory());
+ rcfile = Glib::build_filename (rcfile, "ardour3_ui.conf");
// this test seems bogus?
if (rcfile.length()) {
#undef CANVAS_VARIABLE
#define UI_CONFIG_VARIABLE(Type,var,Name,value) if (node->name() == "UI") { var.add_to_node (*node); }
#define CANVAS_VARIABLE(var,Name) if (node->name() == "Canvas") { var.add_to_node (*node); }
+#define CANVAS_STRING_VARIABLE(var,Name) if (node->name() == "Canvas") { var.add_to_node (*node); }
#include "ui_config_vars.h"
#include "canvas_vars.h"
#undef UI_CONFIG_VARIABLE
#undef CANVAS_VARIABLE
+#undef CANVAS_STRING_VARIABLE
return *node;
}
if (var.set_from_node (node)) { \
ParameterChanged (name); \
}
+#define CANVAS_STRING_VARIABLE(var,name) \
+ if (var.set_from_node (node)) { \
+ ParameterChanged (name); \
+ }
#include "ui_config_vars.h"
#include "canvas_vars.h"
#undef UI_CONFIG_VARIABLE
#undef CANVAS_VARIABLE
+#undef CANVAS_STRING_VARIABLE
}
void
UIConfiguration::pack_canvasvars ()
{
#undef CANVAS_VARIABLE
-#define CANVAS_VARIABLE(var,name) canvas_colors.insert (std::pair<std::string,UIConfigVariable<uint32_t>* >(name,&var));
+#define CANVAS_VARIABLE(var,name) canvas_colors.insert (std::pair<std::string,ColorVariable<uint32_t>* >(name,&var));
+#define CANVAS_STRING_VARIABLE(var,name)
#include "canvas_vars.h"
#undef CANVAS_VARIABLE
+#undef CANVAS_STRING_VARIABLE
}
uint32_t
UIConfiguration::color_by_name (const std::string& name)
{
- map<std::string,UIConfigVariable<uint32_t>* >::iterator i = canvas_colors.find (name);
+ map<std::string,ColorVariable<uint32_t>* >::iterator i = canvas_colors.find (name);
if (i != canvas_colors.end()) {
return i->second->get();
}
// cerr << string_compose (_("Color %1 not found"), name) << endl;
- return RGBA_TO_UINT (random()%256,random()%256,random()%256,0xff);
+ return RGBA_TO_UINT (g_random_int()%256,g_random_int()%256,g_random_int()%256,0xff);
}
void