2007-06-29 13:33:35 -04:00
|
|
|
/*
|
2009-10-14 12:10:01 -04:00
|
|
|
Copyright (C) 2000-2007 Paul Davis
|
2007-06-29 13:33:35 -04:00
|
|
|
|
|
|
|
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., 675 Mass Ave, Cambridge, MA 02139, USA.
|
|
|
|
|
|
|
|
*/
|
|
|
|
|
|
|
|
#ifndef __ardour_ui_configuration_h__
|
|
|
|
#define __ardour_ui_configuration_h__
|
|
|
|
|
|
|
|
#include <sstream>
|
|
|
|
#include <ostream>
|
|
|
|
#include <iostream>
|
|
|
|
|
2014-12-05 09:01:49 -05:00
|
|
|
#include <boost/function.hpp>
|
|
|
|
#include <boost/bind.hpp>
|
|
|
|
|
2015-09-16 18:10:50 -04:00
|
|
|
#include "ardour/types.h" // required for opeators used in pbd/configuration_variable.h
|
2017-04-19 12:23:52 -04:00
|
|
|
#include "ardour/types_convert.h"
|
2015-09-16 18:10:50 -04:00
|
|
|
|
2009-10-14 12:10:01 -04:00
|
|
|
#include "pbd/stateful.h"
|
2009-02-25 13:26:51 -05:00
|
|
|
#include "pbd/xml++.h"
|
2014-12-22 18:53:19 -05:00
|
|
|
#include "pbd/configuration_variable.h"
|
2007-06-29 13:33:35 -04:00
|
|
|
|
2017-07-17 12:34:35 -04:00
|
|
|
#include "gtkmm2ext/colors.h"
|
2017-07-15 11:38:28 -04:00
|
|
|
#include "widgets/ui_config.h"
|
2014-11-19 13:14:26 -05:00
|
|
|
|
2014-06-19 11:18:37 -04:00
|
|
|
#include "utils.h"
|
|
|
|
|
2017-07-15 11:38:28 -04:00
|
|
|
class UIConfiguration : public ArdourWidgets::UIConfigurationBase
|
2007-06-29 13:33:35 -04:00
|
|
|
{
|
2015-01-02 09:44:54 -05:00
|
|
|
private:
|
2007-06-29 13:33:35 -04:00
|
|
|
UIConfiguration();
|
|
|
|
~UIConfiguration();
|
|
|
|
|
2017-07-01 15:11:14 -04:00
|
|
|
public:
|
2015-01-02 09:44:54 -05:00
|
|
|
static UIConfiguration& instance();
|
2014-11-19 13:14:26 -05:00
|
|
|
|
2016-05-29 11:46:10 -04:00
|
|
|
static std::string color_file_suffix;
|
|
|
|
|
2014-12-08 22:02:32 -05:00
|
|
|
void load_rc_file (bool themechange, bool allow_own = true);
|
|
|
|
|
2007-06-29 13:33:35 -04:00
|
|
|
int load_state ();
|
|
|
|
int save_state ();
|
2008-02-01 22:57:35 -05:00
|
|
|
int load_defaults ();
|
2016-07-18 11:50:21 -04:00
|
|
|
int load_color_theme (bool allow_own);
|
2007-06-29 13:33:35 -04:00
|
|
|
|
2009-10-15 14:56:11 -04:00
|
|
|
int set_state (const XMLNode&, int version);
|
2007-06-29 13:33:35 -04:00
|
|
|
XMLNode& get_state (void);
|
|
|
|
XMLNode& get_variables (std::string);
|
|
|
|
void set_variables (const XMLNode&);
|
2014-12-05 09:01:49 -05:00
|
|
|
|
2016-07-18 11:50:21 -04:00
|
|
|
std::string color_file_name (bool use_my, bool with_version) const;
|
2016-05-30 12:19:09 -04:00
|
|
|
|
2017-07-17 12:34:35 -04:00
|
|
|
typedef std::map<std::string,Gtkmm2ext::Color> Colors;
|
2014-12-05 09:01:49 -05:00
|
|
|
typedef std::map<std::string,std::string> ColorAliases;
|
2017-07-17 12:34:35 -04:00
|
|
|
typedef std::map<std::string,Gtkmm2ext::SVAModifier> Modifiers;
|
2014-12-05 09:01:49 -05:00
|
|
|
|
2014-12-14 16:14:18 -05:00
|
|
|
Colors colors;
|
2014-12-08 15:52:18 -05:00
|
|
|
ColorAliases color_aliases;
|
2014-12-14 23:34:59 -05:00
|
|
|
Modifiers modifiers;
|
2014-12-05 09:01:49 -05:00
|
|
|
|
|
|
|
void set_alias (std::string const & name, std::string const & alias);
|
2017-07-17 12:34:35 -04:00
|
|
|
void set_color (const std::string& name, Gtkmm2ext::Color);
|
|
|
|
void set_modifier (std::string const &, Gtkmm2ext::SVAModifier svam);
|
2015-10-05 10:17:49 -04:00
|
|
|
|
2017-07-17 12:34:35 -04:00
|
|
|
std::string color_as_alias (Gtkmm2ext::Color c);
|
|
|
|
Gtkmm2ext::Color quantized (Gtkmm2ext::Color) const;
|
2007-06-29 13:33:35 -04:00
|
|
|
|
2017-07-17 12:34:35 -04:00
|
|
|
Gtkmm2ext::Color color (const std::string&, bool* failed = 0) const;
|
|
|
|
Gtkmm2ext::Color color_mod (std::string const & color, std::string const & modifier) const;
|
|
|
|
Gtkmm2ext::Color color_mod (const Gtkmm2ext::Color& color, std::string const & modifier) const;
|
|
|
|
Gtkmm2ext::HSV color_hsv (const std::string&) const;
|
|
|
|
Gtkmm2ext::SVAModifier modifier (const std::string&) const;
|
2015-01-04 08:30:59 -05:00
|
|
|
|
2017-07-17 12:34:35 -04:00
|
|
|
static std::string color_to_hex_string (Gtkmm2ext::Color c);
|
|
|
|
static std::string color_to_hex_string_no_alpha (Gtkmm2ext::Color c);
|
2016-09-06 00:27:10 -04:00
|
|
|
|
2015-01-04 08:30:59 -05:00
|
|
|
void reset_dpi ();
|
2015-04-29 07:30:07 -04:00
|
|
|
float get_ui_scale ();
|
2015-10-05 10:17:49 -04:00
|
|
|
|
2015-04-29 07:30:07 -04:00
|
|
|
sigc::signal<void,std::string> ParameterChanged;
|
2013-06-21 17:15:56 -04:00
|
|
|
void map_parameters (boost::function<void (std::string)>&);
|
2007-06-29 13:33:35 -04:00
|
|
|
|
2014-12-07 13:12:36 -05:00
|
|
|
void parameter_changed (std::string);
|
2015-05-28 12:46:31 -04:00
|
|
|
|
|
|
|
/** called before initializing any part of the GUI. Sets up
|
|
|
|
* any runtime environment required to make the GUI work
|
|
|
|
* in specific ways.
|
|
|
|
*/
|
|
|
|
int pre_gui_init ();
|
|
|
|
|
2017-07-01 15:11:14 -04:00
|
|
|
/** called after the GUI toolkit has been initialized. */
|
2015-05-28 12:46:31 -04:00
|
|
|
UIConfiguration* post_gui_init ();
|
2015-10-05 10:17:49 -04:00
|
|
|
|
2013-04-16 23:46:22 -04:00
|
|
|
#undef UI_CONFIG_VARIABLE
|
|
|
|
#define UI_CONFIG_VARIABLE(Type,var,name,value) \
|
|
|
|
Type get_##var () const { return var.get(); } \
|
|
|
|
bool set_##var (Type val) { bool ret = var.set (val); if (ret) { ParameterChanged (name); } return ret; }
|
|
|
|
#include "ui_config_vars.h"
|
2007-06-29 13:33:35 -04:00
|
|
|
#undef UI_CONFIG_VARIABLE
|
2014-06-19 11:18:37 -04:00
|
|
|
#define CANVAS_FONT_VARIABLE(var,name) \
|
2014-06-25 15:27:37 -04:00
|
|
|
Pango::FontDescription get_##var () const { return ARDOUR_UI_UTILS::sanitized_font (var.get()); } \
|
2014-06-19 11:18:37 -04:00
|
|
|
bool set_##var (const std::string& val) { bool ret = var.set (val); if (ret) { ParameterChanged (name); } return ret; }
|
2013-04-16 23:46:22 -04:00
|
|
|
#include "canvas_vars.h"
|
2014-06-19 11:18:37 -04:00
|
|
|
#undef CANVAS_FONT_VARIABLE
|
2013-04-16 23:46:22 -04:00
|
|
|
|
2017-07-01 15:11:14 -04:00
|
|
|
private:
|
2013-04-16 23:46:22 -04:00
|
|
|
/* declare variables */
|
|
|
|
|
|
|
|
#undef UI_CONFIG_VARIABLE
|
2014-12-22 18:53:19 -05:00
|
|
|
#define UI_CONFIG_VARIABLE(Type,var,name,value) PBD::ConfigVariable<Type> var;
|
2007-06-29 13:33:35 -04:00
|
|
|
#include "ui_config_vars.h"
|
2013-04-16 23:46:22 -04:00
|
|
|
#undef UI_CONFIG_VARIABLE
|
|
|
|
|
2014-12-22 18:53:19 -05:00
|
|
|
#define CANVAS_FONT_VARIABLE(var,name) PBD::ConfigVariable<std::string> var;
|
2007-06-29 13:33:35 -04:00
|
|
|
#include "canvas_vars.h"
|
2014-06-19 11:18:37 -04:00
|
|
|
#undef CANVAS_FONT_VARIABLE
|
2007-06-29 13:33:35 -04:00
|
|
|
|
|
|
|
XMLNode& state ();
|
2011-10-26 17:01:14 -04:00
|
|
|
bool _dirty;
|
2014-12-05 11:17:56 -05:00
|
|
|
bool aliases_modified;
|
2014-12-14 16:14:18 -05:00
|
|
|
bool colors_modified;
|
2014-12-15 12:07:05 -05:00
|
|
|
bool modifiers_modified;
|
2015-10-05 10:17:49 -04:00
|
|
|
|
2016-07-18 11:50:21 -04:00
|
|
|
int store_color_theme ();
|
2014-12-05 11:17:56 -05:00
|
|
|
void load_color_aliases (XMLNode const &);
|
2014-12-14 16:14:18 -05:00
|
|
|
void load_colors (XMLNode const &);
|
2014-12-14 23:34:59 -05:00
|
|
|
void load_modifiers (XMLNode const &);
|
2014-12-06 15:27:18 -05:00
|
|
|
void reset_gtk_theme ();
|
2016-07-18 11:50:21 -04:00
|
|
|
int load_color_file (std::string const &);
|
2014-12-07 14:20:17 -05:00
|
|
|
void colors_changed ();
|
2014-12-08 22:02:32 -05:00
|
|
|
|
|
|
|
uint32_t block_save;
|
2007-06-29 13:33:35 -04:00
|
|
|
};
|
|
|
|
|
|
|
|
#endif /* __ardour_ui_configuration_h__ */
|