summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorAlex Valavanis <valavanisalex@gmail.com>2013-03-09 17:43:14 +0000
committerAlex Valavanis <valavanisalex@gmail.com>2013-03-09 17:43:14 +0000
commitd14045f60c68e12a39b9e92e700a2f9dd12fcaa2 (patch)
treefb49e399fb509408c4a7f47f5f667a860cb2a588 /src
parentUse Gtk::Grid in PreviewHolder. Fixes color preview in RegisteredColorPicker (diff)
downloadinkscape-d14045f60c68e12a39b9e92e700a2f9dd12fcaa2.tar.gz
inkscape-d14045f60c68e12a39b9e92e700a2f9dd12fcaa2.zip
Migrate from Gtk::Color to Gtk::RGBA
(bzr r12186)
Diffstat (limited to 'src')
-rw-r--r--src/ui/dialog/filter-effects-dialog.cpp19
-rw-r--r--src/ui/dialog/guides.cpp13
-rw-r--r--src/ui/dialog/inkscape-preferences.cpp14
3 files changed, 46 insertions, 0 deletions
diff --git a/src/ui/dialog/filter-effects-dialog.cpp b/src/ui/dialog/filter-effects-dialog.cpp
index fd368ed9f..989c40264 100644
--- a/src/ui/dialog/filter-effects-dialog.cpp
+++ b/src/ui/dialog/filter-effects-dialog.cpp
@@ -313,9 +313,15 @@ public:
set_tooltip_text(tip_text);
}
+#if WITH_GTKMM_3_0
+ Gdk::RGBA col;
+ col.set_rgba_u(65535, 65535, 65535);
+ set_rgba(col);
+#else
Gdk::Color col;
col.set_rgb(65535, 65535, 65535);
set_color(col);
+#endif
}
// Returns the color in 'rgb(r,g,b)' form.
@@ -323,8 +329,14 @@ public:
{
// no doubles here, so we can use the standard string stream.
std::ostringstream os;
+
+#if WITH_GTKMM_3_0
+ const Gdk::RGBA c = get_rgba();
+ const int r = c.get_red_u() / 257, g = c.get_green_u() / 257, b = c.get_blue_u() / 257;//TO-DO: verify this. This sounds a lot strange! shouldn't it be 256?
+#else
const Gdk::Color c = get_color();
const int r = c.get_red() / 257, g = c.get_green() / 257, b = c.get_blue() / 257;//TO-DO: verify this. This sounds a lot strange! shouldn't it be 256?
+#endif
os << "rgb(" << r << "," << g << "," << b << ")";
return os.str();
}
@@ -340,9 +352,16 @@ public:
i = (guint32) get_default()->as_uint();
}
const int r = SP_RGBA32_R_U(i), g = SP_RGBA32_G_U(i), b = SP_RGBA32_B_U(i);
+
+#if WITH_GTKMM_3_0
+ Gdk::RGBA col;
+ col.set_rgba_u(r * 256, g * 256, b * 256);
+ set_rgba(col);
+#else
Gdk::Color col;
col.set_rgb(r * 256, g * 256, b * 256);
set_color(col);
+#endif
}
};
diff --git a/src/ui/dialog/guides.cpp b/src/ui/dialog/guides.cpp
index 06671393d..51bbc7d9a 100644
--- a/src/ui/dialog/guides.cpp
+++ b/src/ui/dialog/guides.cpp
@@ -70,9 +70,15 @@ void GuidelinePropertiesDialog::showDialog(SPGuide *guide, SPDesktop *desktop) {
void GuidelinePropertiesDialog::_colorChanged()
{
+#if WITH_GTKMM_3_0
+ const Gdk::RGBA c = _color.get_rgba();
+ unsigned r = c.get_red_u()/257, g = c.get_green_u()/257, b = c.get_blue_u()/257;
+#else
const Gdk::Color c = _color.get_color();
unsigned r = c.get_red()/257, g = c.get_green()/257, b = c.get_blue()/257;
+#endif
//TODO: why 257? verify this!
+
sp_guide_set_color(*_guide, r, g, b, true);
}
@@ -328,9 +334,16 @@ void GuidelinePropertiesDialog::_setup() {
// init name entry
_label_entry.getEntry()->set_text(_guide->label ? _guide->label : "");
+
+#if WITH_GTKMM_3_0
+ Gdk::RGBA c;
+ c.set_rgba(((_guide->color>>24)&0xff) / 255.0, ((_guide->color>>16)&0xff) / 255.0, ((_guide->color>>8)&0xff) / 255.0);
+ _color.set_rgba(c);
+#else
Gdk::Color c;
c.set_rgb_p(((_guide->color>>24)&0xff) / 255.0, ((_guide->color>>16)&0xff) / 255.0, ((_guide->color>>8)&0xff) / 255.0);
_color.set_color(c);
+#endif
_modeChanged(); // sets values of spinboxes.
diff --git a/src/ui/dialog/inkscape-preferences.cpp b/src/ui/dialog/inkscape-preferences.cpp
index c63b78c70..fb814e066 100644
--- a/src/ui/dialog/inkscape-preferences.cpp
+++ b/src/ui/dialog/inkscape-preferences.cpp
@@ -799,10 +799,17 @@ static void proofComboChanged( Gtk::ComboBoxText* combo )
}
static void gamutColorChanged( Gtk::ColorButton* btn ) {
+#if WITH_GTKMM_3_0
+ Gdk::RGBA rgba = btn->get_rgba();
+ gushort r = rgba.get_red_u();
+ gushort g = rgba.get_green_u();
+ gushort b = rgba.get_blue_u();
+#else
Gdk::Color color = btn->get_color();
gushort r = color.get_red();
gushort g = color.get_green();
gushort b = color.get_blue();
+#endif
gchar* tmp = g_strdup_printf("#%02x%02x%02x", (r >> 8), (g >> 8), (b >> 8) );
@@ -967,8 +974,15 @@ void InkscapePreferences::initPageIO()
_("Highlights colors that are out of gamut for the target device"), false);
Glib::ustring colorStr = prefs->getString("/options/softproof/gamutcolor");
+
+#if WITH_GTKMM_3_0
+ Gdk::RGBA tmpColor( colorStr.empty() ? "#00ff00" : colorStr);
+ _cms_gamutcolor.set_rgba( tmpColor );
+#else
Gdk::Color tmpColor( colorStr.empty() ? "#00ff00" : colorStr);
_cms_gamutcolor.set_color( tmpColor );
+#endif
+
_page_cms.add_line( true, _("Out of gamut warning color:"), _cms_gamutcolor, "",
_("Selects the color used for out of gamut warning"), false);