index 086838727a83566fcd3ab94c40b6adafff8c70f8..e1c30e7aebdf4a5fb21625fe4e48f1a28146fabe 100644 (file)
-#define __SP_FILL_STYLE_C__
-
-/**
- * \brief Fill style widget
- *
- * Authors:
+/** @file
+ * @brief Fill style widget
+ */
+/* Authors:
* Lauris Kaplinski <lauris@kaplinski.com>
* Frank Felfe <innerspace@iname.com>
* bulia byak <buliabyak@users.sf.net>
#endif
-#include <widgets/sp-widget.h>
-#include <sp-linear-gradient.h>
-#include <sp-pattern.h>
-#include <sp-radial-gradient.h>
-#include <widgets/paint-selector.h>
-#include <style.h>
-#include <gradient-chemistry.h>
-#include <desktop-style.h>
-#include <desktop-handles.h>
-#include <selection.h>
-#include <inkscape.h>
-#include <document-private.h>
-#include <xml/repr.h>
+#include "widgets/sp-widget.h"
+#include "sp-linear-gradient.h"
+#include "sp-pattern.h"
+#include "sp-radial-gradient.h"
+#include "widgets/paint-selector.h"
+#include "style.h"
+#include "gradient-chemistry.h"
+#include "desktop-style.h"
+#include "desktop-handles.h"
+#include "selection.h"
+#include "inkscape.h"
+#include "document-private.h"
+#include "xml/repr.h"
#include <glibmm/i18n.h>
-#include <display/sp-canvas.h>
+#include "display/sp-canvas.h"
// These can be deleted once we sort out the libart dependence.
static void
-sp_fill_style_widget_construct ( SPWidget *spw, SPPaintSelector *psel )
+sp_fill_style_widget_construct( SPWidget *spw, SPPaintSelector */*psel*/ )
{
-
#ifdef SP_FS_VERBOSE
g_print ( "Fill style widget constructed: inkscape %p repr %p\n",
spw->inkscape, spw->repr );
#endif
if (spw->inkscape) {
-
sp_fill_style_widget_update (spw);
-
}
} // end of sp_fill_style_widget_construct()
static void
-sp_fill_style_widget_modify_selection ( SPWidget *spw,
- Inkscape::Selection *selection,
- guint flags,
- SPPaintSelector *psel )
+sp_fill_style_widget_modify_selection( SPWidget *spw,
+ Inkscape::Selection */*selection*/,
+ guint flags,
+ SPPaintSelector */*psel*/ )
{
if (flags & ( SP_OBJECT_MODIFIED_FLAG |
SP_OBJECT_PARENT_MODIFIED_FLAG |
}
static void
-sp_fill_style_widget_change_subselection ( Inkscape::Application *inkscape,
- SPDesktop *desktop,
- SPWidget *spw )
+sp_fill_style_widget_change_subselection( Inkscape::Application */*inkscape*/,
+ SPDesktop */*desktop*/,
+ SPWidget *spw )
{
sp_fill_style_widget_update (spw);
}
static void
-sp_fill_style_widget_change_selection ( SPWidget *spw,
- Inkscape::Selection *selection,
- SPPaintSelector *psel )
+sp_fill_style_widget_change_selection( SPWidget *spw,
+ Inkscape::Selection */*selection*/,
+ SPPaintSelector */*psel*/ )
{
sp_fill_style_widget_update (spw);
}
SPPaintSelector *psel = SP_PAINT_SELECTOR (g_object_get_data (G_OBJECT (spw), "paint-selector"));
// create temporary style
- SPStyle *query = sp_style_new ();
+ SPStyle *query = sp_style_new (SP_ACTIVE_DOCUMENT);
// query style from desktop into it. This returns a result flag and fills query with the style of subselection, if any, or selection
int result = sp_desktop_query_style (SP_ACTIVE_DESKTOP, query, QUERY_STYLE_PROPERTY_FILL);
sp_paint_selector_set_fillrule (psel, query->fill_rule.computed == ART_WIND_RULE_NONZERO?
SP_PAINT_SELECTOR_FILLRULE_NONZERO : SP_PAINT_SELECTOR_FILLRULE_EVENODD);
- if (query->fill.set && query->fill.type == SP_PAINT_TYPE_COLOR) {
- gfloat d[3];
- sp_color_get_rgb_floatv (&query->fill.value.color, d);
- SPColor color;
- sp_color_set_rgb_float (&color, d[0], d[1], d[2]);
- sp_paint_selector_set_color_alpha (psel, &color, SP_SCALE24_TO_FLOAT (query->fill_opacity.value));
-
- } else if (query->fill.set && query->fill.type == SP_PAINT_TYPE_PAINTSERVER) {
+ if (query->fill.set && query->fill.isColor()) {
+ sp_paint_selector_set_color_alpha (psel, &query->fill.value.color, SP_SCALE24_TO_FLOAT (query->fill_opacity.value));
+ } else if (query->fill.set && query->fill.isPaintserver()) {
SPPaintServer *server = SP_STYLE_FILL_SERVER (query);
static void
sp_fill_style_widget_paint_mode_changed ( SPPaintSelector *psel,
- SPPaintSelectorMode mode,
+ SPPaintSelectorMode /*mode*/,
SPWidget *spw )
{
if (g_object_get_data (G_OBJECT (spw), "update"))
}
static void
-sp_fill_style_widget_fillrule_changed ( SPPaintSelector *psel,
+sp_fill_style_widget_fillrule_changed ( SPPaintSelector */*psel*/,
SPPaintSelectorFillRule mode,
SPWidget *spw )
{
_("Change fill rule"));
}
-static gchar *undo_label_1 = "fill:flatcolor:1";
-static gchar *undo_label_2 = "fill:flatcolor:2";
-static gchar *undo_label = undo_label_1;
+static gchar const *undo_label_1 = "fill:flatcolor:1";
+static gchar const *undo_label_2 = "fill:flatcolor:2";
+static gchar const *undo_label = undo_label_1;
/**
This is called repeatedly while you are dragging a color slider, only for flat color
if (!vector) {
/* No vector in paint selector should mean that we just changed mode */
- SPStyle *query = sp_style_new ();
- int result = objects_query_fillstroke ((GSList *) items, query, true);
+ SPStyle *query = sp_style_new (SP_ACTIVE_DOCUMENT);
+ int result = objects_query_fillstroke ((GSList *) items, query, true);
guint32 common_rgb = 0;
if (result == QUERY_STYLE_MULTIPLE_SAME) {
- if (query->fill.type != SP_PAINT_TYPE_COLOR) {
+ if (!query->fill.isColor()) {
common_rgb = sp_desktop_get_color(desktop, true);
} else {
- common_rgb = sp_color_get_rgba32_ualpha(&query->fill.value.color, 0xff);
+ common_rgb = query->fill.value.color.toRGBA32( 0xff );
}
vector = sp_document_default_gradient_vector(document, common_rgb);
}
sp_repr_css_change_recursive(SP_OBJECT_REPR(i->data), css, "style");
if (!vector) {
- sp_item_set_gradient(SP_ITEM(i->data),
+ sp_item_set_gradient(SP_ITEM(i->data),
sp_gradient_vector_for_object(document, desktop, SP_OBJECT(i->data), true),
gradient_type, true);
} else {
SPObject *selobj = SP_OBJECT (i->data);
SPStyle *style = SP_OBJECT_STYLE (selobj);
- if (style && style->fill.type == SP_PAINT_TYPE_PAINTSERVER) {
+ if (style && style->fill.isPaintserver()) {
SPObject *server = SP_OBJECT_STYLE_FILL_SERVER (selobj);
if (SP_IS_PATTERN (server) && pattern_getroot (SP_PATTERN(server)) == pattern)
// only if this object's pattern is not rooted in our selected pattern, apply