2007-06-29 13:33:35 -04:00
|
|
|
/*
|
2019-08-02 17:26:43 -04:00
|
|
|
* Copyright (C) 2007 Doug McLain <doug@nostar.net>
|
|
|
|
* Copyright (C) 2008-2014 David Robillard <d@drobilla.net>
|
|
|
|
* Copyright (C) 2009-2016 Paul Davis <paul@linuxaudiosystems.com>
|
|
|
|
* Copyright (C) 2009 Carl Hetherington <carl@carlh.net>
|
|
|
|
* Copyright (C) 2014-2017 Robin Gareus <robin@gareus.org>
|
|
|
|
* Copyright (C) 2015-2016 Tim Mayberry <mojofunk@gmail.com>
|
|
|
|
*
|
|
|
|
* 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.
|
|
|
|
*/
|
2007-06-29 13:33:35 -04:00
|
|
|
|
|
|
|
#ifndef __ardour_ui_configuration_h__
|
|
|
|
#define __ardour_ui_configuration_h__
|
|
|
|
|
|
|
|
#include <sstream>
|
|
|
|
#include <ostream>
|
|
|
|
#include <iostream>
|
2023-01-27 14:07:45 -05:00
|
|
|
#include <map>
|
2007-06-29 13:33:35 -04:00
|
|
|
|
2014-12-05 09:01:49 -05:00
|
|
|
#include <boost/function.hpp>
|
|
|
|
#include <boost/bind.hpp>
|
|
|
|
|
Fix typos in gtk2_ardour/ directory
Found via `codespell -q 3 -S *.po,./share/patchfiles,./libs -L ba,buss,busses,doubleclick,hsi,ontop,ro,seh,siz,sur,te,trough,ue`
2022-01-26 12:35:38 -05:00
|
|
|
#include "ardour/types.h" // required for operators 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
|
|
|
|
2023-01-27 14:07:45 -05:00
|
|
|
#include "pbd/configuration.h"
|
|
|
|
#include "pbd/configuration_variable.h"
|
2009-10-14 12:10:01 -04:00
|
|
|
#include "pbd/stateful.h"
|
2009-02-25 13:26:51 -05:00
|
|
|
#include "pbd/xml++.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
|
|
|
|
2023-04-07 17:59:55 -04:00
|
|
|
#include "editing.h"
|
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:
|
2022-05-05 18:50:06 -04:00
|
|
|
UIConfiguration ();
|
|
|
|
~UIConfiguration ();
|
2007-06-29 13:33:35 -04:00
|
|
|
|
2017-07-01 15:11:14 -04:00
|
|
|
public:
|
2022-05-05 18:50:06 -04: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;
|
2023-01-27 17:07:51 -05:00
|
|
|
static void build_metadata ();
|
2016-05-29 11:46:10 -04:00
|
|
|
|
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
|
|
|
|
2023-01-27 14:07:45 -05:00
|
|
|
void map_parameters (boost::function<void (std::string)>&);
|
2022-05-05 18:50:06 -04:00
|
|
|
int set_state (const XMLNode&, int version);
|
2022-04-06 23:56:45 -04:00
|
|
|
XMLNode& get_state () const;
|
2023-01-27 14:07:45 -05:00
|
|
|
XMLNode& get_variables (std::string const &) const;
|
2022-05-05 18:50:06 -04:00
|
|
|
void set_variables (const XMLNode&);
|
2014-12-05 09:01:49 -05:00
|
|
|
|
2024-08-01 13:43:07 -04:00
|
|
|
std::string color_file_name (bool use_my, bool with_version, bool fallback = false) const;
|
2016-05-30 12:19:09 -04:00
|
|
|
|
2022-05-05 18:50:06 -04:00
|
|
|
typedef std::map<std::string, Gtkmm2ext::Color> Colors;
|
|
|
|
typedef std::map<std::string, std::string> ColorAliases;
|
|
|
|
typedef std::map<std::string, Gtkmm2ext::SVAModifier> Modifiers;
|
2014-12-05 09:01:49 -05:00
|
|
|
|
2022-05-05 18:50:06 -04:00
|
|
|
Colors colors;
|
|
|
|
ColorAliases color_aliases;
|
|
|
|
Modifiers modifiers;
|
2014-12-05 09:01:49 -05:00
|
|
|
|
2022-05-05 18:50:06 -04: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);
|
2022-05-05 18:50:06 -04:00
|
|
|
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
|
|
|
Gtkmm2ext::Color quantized (Gtkmm2ext::Color) const;
|
2007-06-29 13:33:35 -04:00
|
|
|
|
2022-05-05 18:50:06 -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;
|
2017-07-17 12:34:35 -04:00
|
|
|
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
|
|
|
|
2022-05-05 18:50:06 -04:00
|
|
|
void reset_dpi ();
|
2015-04-29 07:30:07 -04:00
|
|
|
float get_ui_scale ();
|
2015-10-05 10:17:49 -04:00
|
|
|
|
2022-05-05 18:50:06 -04:00
|
|
|
sigc::signal<void, std::string> ParameterChanged;
|
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
|
|
|
|
2023-01-27 14:07:45 -05:00
|
|
|
std::map<std::string,PBD::ConfigVariableBase*> _my_variables;
|
|
|
|
|
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()); } \
|
2022-11-07 05:55:16 -05:00
|
|
|
Pango::FontDescription get_Ardour##var () const { return ARDOUR_UI_UTILS::ardour_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
|
|
|
|
2022-04-06 23:56:45 -04:00
|
|
|
XMLNode& state () const;
|
2022-05-05 18:50:06 -04:00
|
|
|
bool _dirty;
|
|
|
|
bool aliases_modified;
|
|
|
|
bool colors_modified;
|
|
|
|
bool modifiers_modified;
|
2015-10-05 10:17:49 -04:00
|
|
|
|
2016-07-18 11:50:21 -04:00
|
|
|
int store_color_theme ();
|
2022-05-05 18:50:06 -04:00
|
|
|
void load_color_aliases (XMLNode const&);
|
|
|
|
void load_colors (XMLNode const&);
|
|
|
|
void load_modifiers (XMLNode const&);
|
2014-12-06 15:27:18 -05:00
|
|
|
void reset_gtk_theme ();
|
2022-05-05 18:50:06 -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__ */
|