Preferences/Config changes for image-surface settings
[ardour.git] / gtk2_ardour / ui_config.cc
index 8b1d5a8c27784174b1484ddaf3afff5777c98c4b..b2d302646f1972dfbab5f3d6bef1a08fdd71ff1b 100644 (file)
@@ -1,25 +1,24 @@
 /*
-    Copyright (C) 1999-2014 Paul Davis
-
-    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.
-
-*/
-
-#if !defined USE_CAIRO_IMAGE_SURFACE && !defined NDEBUG
-#define OPTIONAL_CAIRO_IMAGE_SURFACE
-#endif
+ * Copyright (C) 2008-2014 David Robillard <d@drobilla.net>
+ * Copyright (C) 2008-2016 Paul Davis <paul@linuxaudiosystems.com>
+ * Copyright (C) 2009-2010 Carl Hetherington <carl@carlh.net>
+ * Copyright (C) 2012-2016 Tim Mayberry <mojofunk@gmail.com>
+ * Copyright (C) 2014-2017 Robin Gareus <robin@gareus.org>
+ *
+ * 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.
+ */
 
 #include <iostream>
 #include <sstream>
@@ -60,7 +59,7 @@
 using namespace std;
 using namespace PBD;
 using namespace ARDOUR;
-using namespace ArdourCanvas;
+using namespace Gtkmm2ext;
 
 static const char* ui_config_file_name = "ui_config";
 static const char* default_ui_config_file_name = "default_ui_config";
@@ -72,6 +71,7 @@ UIConfiguration&
 UIConfiguration::instance ()
 {
        static UIConfiguration s_instance;
+       _instance = &s_instance;
        return s_instance;
 }
 
@@ -142,7 +142,7 @@ UIConfiguration::reset_gtk_theme ()
 
                if (g->first.find ("gtk_") == 0) {
                        const string gtk_name = g->first.substr (4);
-                       ArdourCanvas::Color a_color = color (g->second);
+                       Gtkmm2ext::Color a_color = color (g->second);
 
                        color_scheme_string += gtk_name + ":#" + color_to_hex_string_no_alpha (a_color) + ';';
                }
@@ -200,7 +200,7 @@ UIConfiguration::pre_gui_init ()
                g_setenv ("FORCE_BUGGY_GRADIENTS", "1", 1);
        }
 #endif
-#ifdef OPTIONAL_CAIRO_IMAGE_SURFACE
+#ifndef USE_CAIRO_IMAGE_SURFACE
        if (get_cairo_image_surface()) {
                g_setenv ("ARDOUR_IMAGE_SURFACE", "1", 1);
        }
@@ -616,7 +616,7 @@ UIConfiguration::load_colors (XMLNode const & node)
                color = child->property (X_("value"));
 
                if (name && color) {
-                       ArdourCanvas::Color c;
+                       Gtkmm2ext::Color c;
                        c = strtoul (color->value().c_str(), 0, 16);
                        /* insert or replace color name definition */
                        colors[name->value()] =  c;
@@ -660,7 +660,7 @@ UIConfiguration::set_variables (const XMLNode& node)
 #undef  CANVAS_FONT_VARIABLE
 }
 
-ArdourCanvas::SVAModifier
+Gtkmm2ext::SVAModifier
 UIConfiguration::modifier (string const & name) const
 {
        Modifiers::const_iterator m = modifiers.find (name);
@@ -670,19 +670,19 @@ UIConfiguration::modifier (string const & name) const
        return SVAModifier ();
 }
 
-ArdourCanvas::Color
+Gtkmm2ext::Color
 UIConfiguration::color_mod (std::string const & colorname, std::string const & modifiername) const
 {
        return HSV (color (colorname)).mod (modifier (modifiername)).color ();
 }
 
-ArdourCanvas::Color
-UIConfiguration::color_mod (const ArdourCanvas::Color& color, std::string const & modifiername) const
+Gtkmm2ext::Color
+UIConfiguration::color_mod (const Gtkmm2ext::Color& color, std::string const & modifiername) const
 {
        return HSV (color).mod (modifier (modifiername)).color ();
 }
 
-ArdourCanvas::Color
+Gtkmm2ext::Color
 UIConfiguration::color (const std::string& name, bool* failed) const
 {
        ColorAliases::const_iterator e = color_aliases.find (name);
@@ -730,7 +730,7 @@ UIConfiguration::quantized (Color c) const
 }
 
 void
-UIConfiguration::set_color (string const& name, ArdourCanvas::Color color)
+UIConfiguration::set_color (string const& name, Gtkmm2ext::Color color)
 {
        Colors::iterator i = colors.find (name);
        if (i == colors.end()) {
@@ -790,7 +790,7 @@ UIConfiguration::load_rc_file (bool themechange, bool allow_own)
 }
 
 std::string
-UIConfiguration::color_to_hex_string (ArdourCanvas::Color c)
+UIConfiguration::color_to_hex_string (Gtkmm2ext::Color c)
 {
        char buf[16];
        int retval = g_snprintf (buf, sizeof(buf), "%08x", c);
@@ -802,7 +802,7 @@ UIConfiguration::color_to_hex_string (ArdourCanvas::Color c)
 }
 
 std::string
-UIConfiguration::color_to_hex_string_no_alpha (ArdourCanvas::Color c)
+UIConfiguration::color_to_hex_string_no_alpha (Gtkmm2ext::Color c)
 {
        c >>= 8; // shift/remove alpha
        char buf[16];