summaryrefslogtreecommitdiffstats
path: root/src/ui/widget
diff options
context:
space:
mode:
authorDenis Declara <declara91@gmail.com>2012-03-20 10:09:49 +0000
committerDenis Declara <declara91@gmail.com>2012-03-20 10:09:49 +0000
commit1cd9c8450500b945614a12a762e06c057ee85bbe (patch)
tree9973553a223ef7d6c5f9d18c35766fb3e7296e57 /src/ui/widget
parentFix deprecated Gtk::Widget flags (diff)
parentdesktop cutting plotter dxf output. ignore orphaned clones (Bug 957086) (diff)
downloadinkscape-1cd9c8450500b945614a12a762e06c057ee85bbe.tar.gz
inkscape-1cd9c8450500b945614a12a762e06c057ee85bbe.zip
Merged with trunk
(bzr r11073.1.1)
Diffstat (limited to 'src/ui/widget')
-rw-r--r--src/ui/widget/color-preview.cpp48
-rw-r--r--src/ui/widget/color-preview.h3
-rw-r--r--src/ui/widget/filter-effect-chooser.cpp31
-rw-r--r--src/ui/widget/filter-effect-chooser.h2
-rw-r--r--src/ui/widget/object-composite-settings.cpp19
-rw-r--r--src/ui/widget/object-composite-settings.h1
-rw-r--r--src/ui/widget/preferences-widget.cpp4
7 files changed, 89 insertions, 19 deletions
diff --git a/src/ui/widget/color-preview.cpp b/src/ui/widget/color-preview.cpp
index 8bb523831..244e2b4e3 100644
--- a/src/ui/widget/color-preview.cpp
+++ b/src/ui/widget/color-preview.cpp
@@ -114,6 +114,54 @@ ColorPreview::paint (GdkRectangle *area)
cairo_destroy(ct);
}
+GdkPixbuf*
+ColorPreview::toPixbuf (int width, int height)
+{
+ GdkRectangle carea;
+ gint w2;
+ w2 = width / 2;
+
+ cairo_surface_t *s = cairo_image_surface_create(CAIRO_FORMAT_ARGB32, width, height);
+ cairo_t *ct = cairo_create(s);
+
+ /* Transparent area */
+ carea.x = 0;
+ carea.y = 0;
+ carea.width = w2;
+ carea.height = height;
+
+ cairo_pattern_t *checkers = ink_cairo_pattern_create_checkerboard();
+
+ cairo_rectangle(ct, carea.x, carea.y, carea.width, carea.height);
+ cairo_set_source(ct, checkers);
+ cairo_fill_preserve(ct);
+ ink_cairo_set_source_rgba32(ct, _rgba);
+ cairo_fill(ct);
+
+ cairo_pattern_destroy(checkers);
+
+ /* Solid area */
+ carea.x = w2;
+ carea.y = 0;
+ carea.width = width - w2;
+ carea.height = height;
+
+ cairo_rectangle(ct, carea.x, carea.y, carea.width, carea.height);
+ ink_cairo_set_source_rgba32(ct, _rgba | 0xff);
+ cairo_fill(ct);
+
+ cairo_destroy(ct);
+ cairo_surface_flush(s);
+
+ GdkPixbuf* pixbuf = gdk_pixbuf_new_from_data( cairo_image_surface_get_data(s),
+ GDK_COLORSPACE_RGB, TRUE, 8,
+ width, height, cairo_image_surface_get_stride(s),
+ ink_cairo_pixbuf_cleanup, s);
+ convert_pixbuf_argb32_to_normal(pixbuf);
+
+ return pixbuf;
+}
+
}}}
/*
diff --git a/src/ui/widget/color-preview.h b/src/ui/widget/color-preview.h
index f89e0ea42..d6d3da01c 100644
--- a/src/ui/widget/color-preview.h
+++ b/src/ui/widget/color-preview.h
@@ -24,13 +24,14 @@ class ColorPreview : public Gtk::Widget {
public:
ColorPreview (guint32 rgba);
void setRgba32 (guint32 rgba);
+ GdkPixbuf* toPixbuf (int width, int height);
protected:
virtual void on_size_request (Gtk::Requisition *req);
virtual void on_size_allocate (Gtk::Allocation &all);
virtual bool on_expose_event (GdkEventExpose *event);
void paint (GdkRectangle *area);
-
+
guint32 _rgba;
};
diff --git a/src/ui/widget/filter-effect-chooser.cpp b/src/ui/widget/filter-effect-chooser.cpp
index 6fe21319d..a2519d4bb 100644
--- a/src/ui/widget/filter-effect-chooser.cpp
+++ b/src/ui/widget/filter-effect-chooser.cpp
@@ -22,26 +22,35 @@ namespace UI {
namespace Widget {
SimpleFilterModifier::SimpleFilterModifier(int flags)
- : _lb_blend(_("Blend mode:")),
-#if WITH_GTKMM_2_22
- _lb_blur(_("_Blur:"), Gtk::ALIGN_START, Gtk::ALIGN_CENTER, true),
-#else
- _lb_blur(_("_Blur:"), Gtk::ALIGN_LEFT, Gtk::ALIGN_CENTER, true),
-#endif
+ : _hb_blur(false, 0),
+ _lb_blend(_("Blend mode:")),
+ _lb_blur(_("_Blur:")),
_blend(BlendModeConverter, SP_ATTR_INVALID, false),
- _blur(0, 0, 100, 1, 0.01, 2)
+ _blur(0, 0, 100, 1, 0.01, 1)
{
_flags = flags;
if (flags & BLEND) {
add(_hb_blend);
- _hb_blend.pack_start(_lb_blend, false, false);
+ _hb_blend.pack_start(_lb_blend);
_hb_blend.pack_start(_blend);
}
if (flags & BLUR) {
- add(_vb_blur);
- _vb_blur.add(_lb_blur);
- _vb_blur.add(_blur);
+ add(_hb_blur);
+ /*
+ * Hack to get a min size of label, but still be able to expand if needed
+ * Should match ObjectCompositeSettings::_opacity_label
+ */
+ if (_lb_blur.get_text().length() < 7) {
+ _lb_blur.set_width_chars(7);
+ }
+ #if WITH_GTKMM_2_22
+ _lb_blur.set_alignment(Gtk::ALIGN_END, Gtk::ALIGN_CENTER);
+ #else
+ _lb_blur.set_alignment(Gtk::ALIGN_RIGHT, Gtk::ALIGN_CENTER);
+ #endif
+ _hb_blur.pack_start(_lb_blur, false, false, 0);
+ _hb_blur.pack_start(_blur, true, true, 0);
}
show_all_children();
diff --git a/src/ui/widget/filter-effect-chooser.h b/src/ui/widget/filter-effect-chooser.h
index 3c3da6c2d..2d41eb3bf 100644
--- a/src/ui/widget/filter-effect-chooser.h
+++ b/src/ui/widget/filter-effect-chooser.h
@@ -49,7 +49,7 @@ public:
private:
int _flags;
Gtk::HBox _hb_blend;
- Gtk::VBox _vb_blur;
+ Gtk::HBox _hb_blur;
Gtk::Label _lb_blend, _lb_blur;
ComboBoxEnum<Inkscape::Filters::FilterBlendMode> _blend;
SpinSlider _blur;
diff --git a/src/ui/widget/object-composite-settings.cpp b/src/ui/widget/object-composite-settings.cpp
index afeec5492..9613f2d4f 100644
--- a/src/ui/widget/object-composite-settings.cpp
+++ b/src/ui/widget/object-composite-settings.cpp
@@ -62,8 +62,7 @@ ObjectCompositeSettings::ObjectCompositeSettings(unsigned int verb_code, char co
_blur_tag(Glib::ustring(history_prefix) + ":blur"),
_opacity_tag(Glib::ustring(history_prefix) + ":opacity"),
_opacity_vbox(false, 0),
- _opacity_label_box(false, 0),
- _opacity_label(_("_Opacity (%):"), 0.0, 1.0, true),
+ _opacity_label(_("Opacity:")),
_opacity_adjustment(100.0, 0.0, 100.0, 1.0, 1.0, 0.0),
_opacity_hscale(_opacity_adjustment),
_opacity_spin_button(_opacity_adjustment, 0.01, 1),
@@ -72,6 +71,7 @@ ObjectCompositeSettings::ObjectCompositeSettings(unsigned int verb_code, char co
_fe_alignment(1, 1, 1, 1),
_blocked(false)
{
+
// Filter Effects
pack_start(_fe_vbox, false, false, 2);
_fe_alignment.set_padding(0, 0, 4, 0);
@@ -81,10 +81,19 @@ ObjectCompositeSettings::ObjectCompositeSettings(unsigned int verb_code, char co
// Opacity
pack_start(_opacity_vbox, false, false, 2);
- _opacity_label_box.pack_start(_opacity_label, false, false, 4);
- _opacity_vbox.pack_start(_opacity_label_box, false, false, 0);
+ if (_opacity_label.get_text().length() < 7) {
+ _opacity_label.set_width_chars(7);
+ }
+#if WITH_GTKMM_2_22
+ _opacity_label.set_alignment(Gtk::ALIGN_END, Gtk::ALIGN_CENTER);
+#else
+ _opacity_label.set_alignment(Gtk::ALIGN_RIGHT, Gtk::ALIGN_CENTER);
+#endif
+
+ _opacity_hbox.pack_start(_opacity_label, false, false, 3);
+ //_opacity_vbox.pack_start(_opacity_label_box, false, false, 0);
_opacity_vbox.pack_start(_opacity_hbox, false, false, 0);
- _opacity_hbox.pack_start(_opacity_hscale, true, true, 4);
+ _opacity_hbox.pack_start(_opacity_hscale, true, true, 0);
_opacity_hbox.pack_start(_opacity_spin_button, false, false, 0);
_opacity_hscale.set_draw_value(false);
_opacity_adjustment.signal_value_changed().connect(sigc::mem_fun(*this, &ObjectCompositeSettings::_opacityValueChanged));
diff --git a/src/ui/widget/object-composite-settings.h b/src/ui/widget/object-composite-settings.h
index 7b0e9b994..d05839a03 100644
--- a/src/ui/widget/object-composite-settings.h
+++ b/src/ui/widget/object-composite-settings.h
@@ -45,7 +45,6 @@ private:
Glib::ustring _opacity_tag;
Gtk::VBox _opacity_vbox;
- Gtk::HBox _opacity_label_box;
Gtk::HBox _opacity_hbox;
Gtk::Label _opacity_label;
Gtk::Adjustment _opacity_adjustment;
diff --git a/src/ui/widget/preferences-widget.cpp b/src/ui/widget/preferences-widget.cpp
index fec351ab0..a7b51d535 100644
--- a/src/ui/widget/preferences-widget.cpp
+++ b/src/ui/widget/preferences-widget.cpp
@@ -386,8 +386,12 @@ ZoomCorrRuler::redraw() {
Glib::RefPtr<Gdk::Window> window = get_window();
Cairo::RefPtr<Cairo::Context> cr = window->create_cairo_context();
+#if WITH_GTKMM_2_24
+ int w = window->get_width();
+#else
int w, h;
window->get_size(w, h);
+#endif
_drawing_width = w - _border * 2;
cr->set_source_rgb(1.0, 1.0, 1.0);