summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: 99f8079)
raw | patch | inline | side by side (parent: 99f8079)
author | Jon A. Cruz <jon@joncruz.org> | |
Mon, 22 Mar 2010 02:47:06 +0000 (19:47 -0700) | ||
committer | Jon A. Cruz <jon@joncruz.org> | |
Mon, 22 Mar 2010 02:47:06 +0000 (19:47 -0700) |
index c84a3a07e7eb3da172deb2e8c220624295e59a2a..57fa229762388f490efa1bc2661a7131642e1f48 100644 (file)
static void sp_fill_style_widget_update (SPWidget *spw);
-static void sp_fill_style_widget_paint_mode_changed ( SPPaintSelector *psel,
- SPPaintSelectorMode mode,
- SPWidget *spw );
-static void sp_fill_style_widget_fillrule_changed ( SPPaintSelector *psel,
- SPPaintSelectorFillRule mode,
- SPWidget *spw );
+static void sp_fill_style_widget_paint_mode_changed( SPPaintSelector *psel,
+ SPPaintSelector::Mode mode,
+ SPWidget *spw );
+static void sp_fill_style_widget_fillrule_changed( SPPaintSelector *psel,
+ SPPaintSelector::FillRule mode,
+ SPWidget *spw );
static void sp_fill_style_widget_paint_dragged (SPPaintSelector *psel, SPWidget *spw );
static void sp_fill_style_widget_paint_changed (SPPaintSelector *psel, SPWidget *spw );
case QUERY_STYLE_NOTHING:
{
/* No paint at all */
- psel->setMode(SP_PAINT_SELECTOR_MODE_EMPTY);
+ psel->setMode(SPPaintSelector::MODE_EMPTY);
break;
}
case QUERY_STYLE_MULTIPLE_AVERAGED: // TODO: treat this slightly differently, e.g. display "averaged" somewhere in paint selector
case QUERY_STYLE_MULTIPLE_SAME:
{
- SPPaintSelectorMode pselmode = sp_style_determine_paint_selector_mode (query, true);
+ SPPaintSelector::Mode pselmode = sp_style_determine_paint_selector_mode(query, true);
psel->setMode(pselmode);
psel->setFillrule(query->fill_rule.computed == ART_WIND_RULE_NONZERO?
- SP_PAINT_SELECTOR_FILLRULE_NONZERO : SP_PAINT_SELECTOR_FILLRULE_EVENODD);
+ SPPaintSelector::FILLRULE_NONZERO : SPPaintSelector::FILLRULE_EVENODD);
if (query->fill.set && query->fill.isColor()) {
psel->setColorAlpha(query->fill.value.color, SP_SCALE24_TO_FLOAT(query->fill_opacity.value));
case QUERY_STYLE_MULTIPLE_DIFFERENT:
{
- psel->setMode(SP_PAINT_SELECTOR_MODE_MULTIPLE);
+ psel->setMode(SPPaintSelector::MODE_MULTIPLE);
break;
}
}
static void
-sp_fill_style_widget_paint_mode_changed ( SPPaintSelector *psel,
- SPPaintSelectorMode /*mode*/,
- SPWidget *spw )
+sp_fill_style_widget_paint_mode_changed( SPPaintSelector *psel,
+ SPPaintSelector::Mode /*mode*/,
+ SPWidget *spw )
{
if (g_object_get_data (G_OBJECT (spw), "update"))
return;
sp_fill_style_widget_paint_changed (psel, spw);
}
-static void
-sp_fill_style_widget_fillrule_changed ( SPPaintSelector */*psel*/,
- SPPaintSelectorFillRule mode,
- SPWidget *spw )
+static void sp_fill_style_widget_fillrule_changed( SPPaintSelector */*psel*/,
+ SPPaintSelector::FillRule mode,
+ SPWidget *spw )
{
if (g_object_get_data (G_OBJECT (spw), "update"))
return;
SPDesktop *desktop = SP_ACTIVE_DESKTOP;
SPCSSAttr *css = sp_repr_css_attr_new ();
- sp_repr_css_set_property (css, "fill-rule", mode == SP_PAINT_SELECTOR_FILLRULE_EVENODD? "evenodd":"nonzero");
+ sp_repr_css_set_property(css, "fill-rule", mode == SPPaintSelector::FILLRULE_EVENODD? "evenodd":"nonzero");
sp_desktop_set_style (desktop, css);
switch (psel->mode) {
- case SP_PAINT_SELECTOR_MODE_COLOR_RGB:
- case SP_PAINT_SELECTOR_MODE_COLOR_CMYK:
+ case SPPaintSelector::MODE_COLOR_RGB:
+ case SPPaintSelector::MODE_COLOR_CMYK:
{
psel->setFlatColor( SP_ACTIVE_DESKTOP, "fill", "fill-opacity" );
sp_document_maybe_done (sp_desktop_document(SP_ACTIVE_DESKTOP), undo_label, SP_VERB_DIALOG_FILL_STROKE,
switch (psel->mode) {
- case SP_PAINT_SELECTOR_MODE_EMPTY:
+ case SPPaintSelector::MODE_EMPTY:
// This should not happen.
g_warning ( "file %s: line %d: Paint %d should not emit 'changed'",
__FILE__, __LINE__, psel->mode);
break;
- case SP_PAINT_SELECTOR_MODE_MULTIPLE:
+ case SPPaintSelector::MODE_MULTIPLE:
// This happens when you switch multiple objects with different gradients to flat color;
// nothing to do here.
break;
- case SP_PAINT_SELECTOR_MODE_NONE:
+ case SPPaintSelector::MODE_NONE:
{
SPCSSAttr *css = sp_repr_css_attr_new ();
sp_repr_css_set_property (css, "fill", "none");
break;
}
- case SP_PAINT_SELECTOR_MODE_COLOR_RGB:
- case SP_PAINT_SELECTOR_MODE_COLOR_CMYK:
+ case SPPaintSelector::MODE_COLOR_RGB:
+ case SPPaintSelector::MODE_COLOR_CMYK:
{
// FIXME: fix for GTK breakage, see comment in SelectedStyle::on_opacity_changed; here it results in losing release events
sp_canvas_force_full_redraw_after_interruptions(sp_desktop_canvas(desktop), 0);
break;
}
- case SP_PAINT_SELECTOR_MODE_GRADIENT_LINEAR:
- case SP_PAINT_SELECTOR_MODE_GRADIENT_RADIAL:
- case SP_PAINT_SELECTOR_MODE_SWATCH:
+ case SPPaintSelector::MODE_GRADIENT_LINEAR:
+ case SPPaintSelector::MODE_GRADIENT_RADIAL:
+ case SPPaintSelector::MODE_SWATCH:
if (items) {
- SPGradientType const gradient_type = ( psel->mode != SP_PAINT_SELECTOR_MODE_GRADIENT_RADIAL
+ SPGradientType const gradient_type = ( psel->mode != SPPaintSelector::MODE_GRADIENT_RADIAL
? SP_GRADIENT_TYPE_LINEAR
: SP_GRADIENT_TYPE_RADIAL );
}
break;
- case SP_PAINT_SELECTOR_MODE_PATTERN:
+ case SPPaintSelector::MODE_PATTERN:
if (items) {
break;
- case SP_PAINT_SELECTOR_MODE_UNSET:
+ case SPPaintSelector::MODE_UNSET:
if (items) {
SPCSSAttr *css = sp_repr_css_attr_new ();
sp_repr_css_unset_property (css, "fill");
index 3609942415efa7d0776500639eb75d3bf361f58e..6f3fd823ee930a07a08959c6fd92ca41610059ba 100644 (file)
static void sp_paint_selector_init(SPPaintSelector *slider);
static void sp_paint_selector_destroy(GtkObject *object);
-static GtkWidget *sp_paint_selector_style_button_add(SPPaintSelector *psel, gchar const *px, SPPaintSelectorMode mode, GtkTooltips *tt, gchar const *tip);
+static GtkWidget *sp_paint_selector_style_button_add(SPPaintSelector *psel, gchar const *px, SPPaintSelector::Mode mode, GtkTooltips *tt, gchar const *tip);
static void sp_paint_selector_style_button_toggled(GtkToggleButton *tb, SPPaintSelector *psel);
static void sp_paint_selector_fillrule_toggled(GtkToggleButton *tb, SPPaintSelector *psel);
static void sp_paint_selector_set_mode_empty(SPPaintSelector *psel);
static void sp_paint_selector_set_mode_multiple(SPPaintSelector *psel);
static void sp_paint_selector_set_mode_none(SPPaintSelector *psel);
-static void sp_paint_selector_set_mode_color(SPPaintSelector *psel, SPPaintSelectorMode mode);
-static void sp_paint_selector_set_mode_gradient(SPPaintSelector *psel, SPPaintSelectorMode mode);
-static void sp_paint_selector_set_mode_pattern(SPPaintSelector *psel, SPPaintSelectorMode mode);
-static void sp_paint_selector_set_mode_swatch(SPPaintSelector *psel, SPPaintSelectorMode mode);
+static void sp_paint_selector_set_mode_color(SPPaintSelector *psel, SPPaintSelector::Mode mode);
+static void sp_paint_selector_set_mode_gradient(SPPaintSelector *psel, SPPaintSelector::Mode mode);
+static void sp_paint_selector_set_mode_pattern(SPPaintSelector *psel, SPPaintSelector::Mode mode);
+static void sp_paint_selector_set_mode_swatch(SPPaintSelector *psel, SPPaintSelector::Mode mode);
static void sp_paint_selector_set_mode_unset(SPPaintSelector *psel);
};
#endif
-static bool isPaintModeGradient( SPPaintSelectorMode mode )
+
+static bool isPaintModeGradient( SPPaintSelector::Mode mode )
{
- bool isGrad = (mode == SP_PAINT_SELECTOR_MODE_GRADIENT_LINEAR) ||
- (mode == SP_PAINT_SELECTOR_MODE_GRADIENT_RADIAL) ||
- (mode == SP_PAINT_SELECTOR_MODE_SWATCH);
+ bool isGrad = (mode == SPPaintSelector::MODE_GRADIENT_LINEAR) ||
+ (mode == SPPaintSelector::MODE_GRADIENT_RADIAL) ||
+ (mode == SPPaintSelector::MODE_SWATCH);
return isGrad;
}
static SPGradientSelector *getGradientFromData(SPPaintSelector const *psel)
{
SPGradientSelector *grad = 0;
- if (psel->mode == SP_PAINT_SELECTOR_MODE_SWATCH) {
+ if (psel->mode == SPPaintSelector::MODE_SWATCH) {
SwatchSelector *swatchsel = static_cast<SwatchSelector*>(g_object_get_data(G_OBJECT(psel->selector), "swatch-selector"));
if (swatchsel) {
grad = swatchsel->getGradientSelector();
{
GtkTooltips *tt = gtk_tooltips_new();
- psel->mode = (SPPaintSelectorMode)-1; // huh? do you mean 0xff? -- I think this means "not in the enum"
+ psel->mode = static_cast<SPPaintSelector::Mode>(-1); // huh? do you mean 0xff? -- I think this means "not in the enum"
/* Paint style button box */
psel->style = gtk_hbox_new(FALSE, 0);
/* Buttons */
psel->none = sp_paint_selector_style_button_add(psel, INKSCAPE_ICON_PAINT_NONE,
- SP_PAINT_SELECTOR_MODE_NONE, tt, _("No paint"));
+ SPPaintSelector::MODE_NONE, tt, _("No paint"));
psel->solid = sp_paint_selector_style_button_add(psel, INKSCAPE_ICON_PAINT_SOLID,
- SP_PAINT_SELECTOR_MODE_COLOR_RGB, tt, _("Flat color"));
+ SPPaintSelector::MODE_COLOR_RGB, tt, _("Flat color"));
psel->gradient = sp_paint_selector_style_button_add(psel, INKSCAPE_ICON_PAINT_GRADIENT_LINEAR,
- SP_PAINT_SELECTOR_MODE_GRADIENT_LINEAR, tt, _("Linear gradient"));
+ SPPaintSelector::MODE_GRADIENT_LINEAR, tt, _("Linear gradient"));
psel->radial = sp_paint_selector_style_button_add(psel, INKSCAPE_ICON_PAINT_GRADIENT_RADIAL,
- SP_PAINT_SELECTOR_MODE_GRADIENT_RADIAL, tt, _("Radial gradient"));
+ SPPaintSelector::MODE_GRADIENT_RADIAL, tt, _("Radial gradient"));
psel->pattern = sp_paint_selector_style_button_add(psel, INKSCAPE_ICON_PAINT_PATTERN,
- SP_PAINT_SELECTOR_MODE_PATTERN, tt, _("Pattern"));
+ SPPaintSelector::MODE_PATTERN, tt, _("Pattern"));
psel->swatch = sp_paint_selector_style_button_add(psel, INKSCAPE_ICON_PAINT_SWATCH,
- SP_PAINT_SELECTOR_MODE_SWATCH, tt, _("Swatch"));
+ SPPaintSelector::MODE_SWATCH, tt, _("Swatch"));
psel->unset = sp_paint_selector_style_button_add(psel, INKSCAPE_ICON_PAINT_UNKNOWN,
- SP_PAINT_SELECTOR_MODE_UNSET, tt, _("Unset paint (make it undefined so it can be inherited)"));
+ SPPaintSelector::MODE_UNSET, tt, _("Unset paint (make it undefined so it can be inherited)"));
/* Fillrule */
{
gtk_toggle_button_set_mode(GTK_TOGGLE_BUTTON(psel->evenodd), FALSE);
// TRANSLATORS: for info, see http://www.w3.org/TR/2000/CR-SVG-20000802/painting.html#FillRuleProperty
gtk_tooltips_set_tip(tt, psel->evenodd, _("Any path self-intersections or subpaths create holes in the fill (fill-rule: evenodd)"), NULL);
- gtk_object_set_data(GTK_OBJECT(psel->evenodd), "mode", GUINT_TO_POINTER(SP_PAINT_SELECTOR_FILLRULE_EVENODD));
+ gtk_object_set_data(GTK_OBJECT(psel->evenodd), "mode", GUINT_TO_POINTER(SPPaintSelector::FILLRULE_EVENODD));
w = sp_icon_new(Inkscape::ICON_SIZE_DECORATION, INKSCAPE_ICON_FILL_RULE_EVEN_ODD);
gtk_container_add(GTK_CONTAINER(psel->evenodd), w);
gtk_box_pack_start(GTK_BOX(psel->fillrulebox), psel->evenodd, FALSE, FALSE, 0);
gtk_toggle_button_set_mode(GTK_TOGGLE_BUTTON(psel->nonzero), FALSE);
// TRANSLATORS: for info, see http://www.w3.org/TR/2000/CR-SVG-20000802/painting.html#FillRuleProperty
gtk_tooltips_set_tip(tt, psel->nonzero, _("Fill is solid unless a subpath is counterdirectional (fill-rule: nonzero)"), NULL);
- gtk_object_set_data(GTK_OBJECT(psel->nonzero), "mode", GUINT_TO_POINTER(SP_PAINT_SELECTOR_FILLRULE_NONZERO));
+ gtk_object_set_data(GTK_OBJECT(psel->nonzero), "mode", GUINT_TO_POINTER(SPPaintSelector::FILLRULE_NONZERO));
w = sp_icon_new(Inkscape::ICON_SIZE_DECORATION, INKSCAPE_ICON_FILL_RULE_NONZERO);
gtk_container_add(GTK_CONTAINER(psel->nonzero), w);
gtk_box_pack_start(GTK_BOX(psel->fillrulebox), psel->nonzero, FALSE, FALSE, 0);
(* ((GtkObjectClass *) parent_class)->destroy)(object);
}
-static GtkWidget *
-sp_paint_selector_style_button_add(SPPaintSelector *psel,
- gchar const *pixmap, SPPaintSelectorMode mode,
- GtkTooltips *tt, gchar const *tip)
+static GtkWidget *sp_paint_selector_style_button_add(SPPaintSelector *psel,
+ gchar const *pixmap, SPPaintSelector::Mode mode,
+ GtkTooltips *tt, gchar const *tip)
{
GtkWidget *b, *w;
sp_paint_selector_style_button_toggled(GtkToggleButton *tb, SPPaintSelector *psel)
{
if (!psel->update && gtk_toggle_button_get_active(tb)) {
- psel->setMode(static_cast<SPPaintSelectorMode>(GPOINTER_TO_UINT(gtk_object_get_data(GTK_OBJECT(tb), "mode"))));
+ psel->setMode(static_cast<SPPaintSelector::Mode>(GPOINTER_TO_UINT(gtk_object_get_data(GTK_OBJECT(tb), "mode"))));
}
}
sp_paint_selector_fillrule_toggled(GtkToggleButton *tb, SPPaintSelector *psel)
{
if (!psel->update && gtk_toggle_button_get_active(tb)) {
- SPPaintSelectorFillRule fr = (SPPaintSelectorFillRule)GPOINTER_TO_UINT(gtk_object_get_data(GTK_OBJECT(tb), "mode"));
+ SPPaintSelector::FillRule fr = static_cast<SPPaintSelector::FillRule>(GPOINTER_TO_UINT(g_object_get_data(G_OBJECT(tb), "mode")));
gtk_signal_emit(GTK_OBJECT(psel), psel_signals[FILLRULE_CHANGED], fr);
}
}
{
SPPaintSelector *psel = static_cast<SPPaintSelector*>(gtk_type_new(SP_TYPE_PAINT_SELECTOR));
- psel->setMode(SP_PAINT_SELECTOR_MODE_MULTIPLE);
+ psel->setMode(SPPaintSelector::MODE_MULTIPLE);
// This silliness is here because I don't know how to pass a parameter to the
// GtkObject "constructor" (sp_paint_selector_init). Remove it when paint_selector
return GTK_WIDGET(psel);
}
-void SPPaintSelector::setMode(SPPaintSelectorMode mode)
+void SPPaintSelector::setMode(Mode mode)
{
if (this->mode != mode) {
update = TRUE;
g_print("Mode change %d -> %d %s -> %s\n", this->mode, mode, modeStrings[this->mode], modeStrings[mode]);
#endif
switch (mode) {
- case SP_PAINT_SELECTOR_MODE_EMPTY:
+ case MODE_EMPTY:
sp_paint_selector_set_mode_empty(this);
break;
- case SP_PAINT_SELECTOR_MODE_MULTIPLE:
+ case MODE_MULTIPLE:
sp_paint_selector_set_mode_multiple(this);
break;
- case SP_PAINT_SELECTOR_MODE_NONE:
+ case MODE_NONE:
sp_paint_selector_set_mode_none(this);
break;
- case SP_PAINT_SELECTOR_MODE_COLOR_RGB:
- case SP_PAINT_SELECTOR_MODE_COLOR_CMYK:
+ case MODE_COLOR_RGB:
+ case MODE_COLOR_CMYK:
sp_paint_selector_set_mode_color(this, mode);
break;
- case SP_PAINT_SELECTOR_MODE_GRADIENT_LINEAR:
- case SP_PAINT_SELECTOR_MODE_GRADIENT_RADIAL:
+ case MODE_GRADIENT_LINEAR:
+ case MODE_GRADIENT_RADIAL:
sp_paint_selector_set_mode_gradient(this, mode);
break;
- case SP_PAINT_SELECTOR_MODE_PATTERN:
+ case MODE_PATTERN:
sp_paint_selector_set_mode_pattern(this, mode);
break;
- case SP_PAINT_SELECTOR_MODE_SWATCH:
+ case MODE_SWATCH:
sp_paint_selector_set_mode_swatch(this, mode);
break;
- case SP_PAINT_SELECTOR_MODE_UNSET:
+ case MODE_UNSET:
sp_paint_selector_set_mode_unset(this);
break;
default:
}
}
-void SPPaintSelector::setFillrule(SPPaintSelectorFillRule fillrule)
+void SPPaintSelector::setFillrule(FillRule fillrule)
{
if (fillrulebox) {
// TODO this flips widgets but does not use a member to store state. Revisit
- gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(evenodd), (fillrule == SP_PAINT_SELECTOR_FILLRULE_EVENODD));
- gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(nonzero), (fillrule == SP_PAINT_SELECTOR_FILLRULE_NONZERO));
+ gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(evenodd), (fillrule == FILLRULE_EVENODD));
+ gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(nonzero), (fillrule == FILLRULE_NONZERO));
}
}
#ifdef SP_PS_VERBOSE
g_print("PaintSelector set CMYKA\n");
#endif
- sp_paint_selector_set_mode(psel, SP_PAINT_SELECTOR_MODE_COLOR_CMYK);
+ sp_paint_selector_set_mode(psel, MODE_COLOR_CMYK);
}
else
*/
#ifdef SP_PS_VERBOSE
g_print("PaintSelector set RGBA\n");
#endif
- setMode(SP_PAINT_SELECTOR_MODE_COLOR_RGB);
+ setMode(MODE_COLOR_RGB);
}
csel = reinterpret_cast<SPColorSelector*>(gtk_object_get_data(GTK_OBJECT(selector), "color-selector"));
#ifdef SP_PS_VERBOSE
g_print("PaintSelector set SWATCH\n");
#endif
- setMode(SP_PAINT_SELECTOR_MODE_SWATCH);
+ setMode(MODE_SWATCH);
SwatchSelector *swatchsel = static_cast<SwatchSelector*>(g_object_get_data(G_OBJECT(selector), "swatch-selector"));
if (swatchsel) {
#ifdef SP_PS_VERBOSE
g_print("PaintSelector set GRADIENT LINEAR\n");
#endif
- setMode(SP_PAINT_SELECTOR_MODE_GRADIENT_LINEAR);
+ setMode(MODE_GRADIENT_LINEAR);
SPGradientSelector *gsel = getGradientFromData(this);
#ifdef SP_PS_VERBOSE
g_print("PaintSelector set GRADIENT RADIAL\n");
#endif
- setMode(SP_PAINT_SELECTOR_MODE_GRADIENT_RADIAL);
+ setMode(MODE_GRADIENT_RADIAL);
SPGradientSelector *gsel = getGradientFromData(this);
/* Color paint */
-static void
-sp_paint_selector_color_grabbed(SPColorSelector *csel, SPPaintSelector *psel)
+static void sp_paint_selector_color_grabbed(SPColorSelector * /*csel*/, SPPaintSelector *psel)
{
- (void)csel;
gtk_signal_emit(GTK_OBJECT(psel), psel_signals[GRABBED]);
}
-static void
-sp_paint_selector_color_dragged(SPColorSelector *csel, SPPaintSelector *psel)
+static void sp_paint_selector_color_dragged(SPColorSelector * /*csel*/, SPPaintSelector *psel)
{
- (void)csel;
gtk_signal_emit(GTK_OBJECT(psel), psel_signals[DRAGGED]);
}
-static void
-sp_paint_selector_color_released(SPColorSelector *csel, SPPaintSelector *psel)
+static void sp_paint_selector_color_released(SPColorSelector * /*csel*/, SPPaintSelector *psel)
{
- (void)csel;
gtk_signal_emit(GTK_OBJECT(psel), psel_signals[RELEASED]);
}
gtk_signal_emit(GTK_OBJECT(psel), psel_signals[CHANGED]);
}
-static void
-sp_paint_selector_set_mode_color(SPPaintSelector *psel, SPPaintSelectorMode mode)
+static void sp_paint_selector_set_mode_color(SPPaintSelector *psel, SPPaintSelector::Mode /*mode*/)
{
- (void)mode;
GtkWidget *csel;
sp_paint_selector_set_style_buttons(psel, psel->solid);
gtk_widget_set_sensitive(psel->style, TRUE);
- if ((psel->mode == SP_PAINT_SELECTOR_MODE_COLOR_RGB) || (psel->mode == SP_PAINT_SELECTOR_MODE_COLOR_CMYK)) {
+ if ((psel->mode == SPPaintSelector::MODE_COLOR_RGB) || (psel->mode == SPPaintSelector::MODE_COLOR_CMYK)) {
/* Already have color selector */
csel = (GtkWidget*)gtk_object_get_data(GTK_OBJECT(psel->selector), "color-selector");
} else {
@@ -692,49 +684,40 @@ sp_paint_selector_set_mode_color(SPPaintSelector *psel, SPPaintSelectorMode mode
/* Gradient */
-static void
-sp_paint_selector_gradient_grabbed(SPColorSelector *csel, SPPaintSelector *psel)
+static void sp_paint_selector_gradient_grabbed(SPColorSelector * /*csel*/, SPPaintSelector *psel)
{
- (void)csel;
gtk_signal_emit(GTK_OBJECT(psel), psel_signals[GRABBED]);
}
-static void
-sp_paint_selector_gradient_dragged(SPColorSelector *csel, SPPaintSelector *psel)
+static void sp_paint_selector_gradient_dragged(SPColorSelector * /*csel*/, SPPaintSelector *psel)
{
- (void)csel;
gtk_signal_emit(GTK_OBJECT(psel), psel_signals[DRAGGED]);
}
-static void
-sp_paint_selector_gradient_released(SPColorSelector *csel, SPPaintSelector *psel)
+static void sp_paint_selector_gradient_released(SPColorSelector * /*csel*/, SPPaintSelector *psel)
{
- (void)csel;
gtk_signal_emit(GTK_OBJECT(psel), psel_signals[RELEASED]);
}
-static void
-sp_paint_selector_gradient_changed(SPColorSelector *csel, SPPaintSelector *psel)
+static void sp_paint_selector_gradient_changed(SPColorSelector * /*csel*/, SPPaintSelector *psel)
{
- (void)csel;
gtk_signal_emit(GTK_OBJECT(psel), psel_signals[CHANGED]);
}
-static void
-sp_paint_selector_set_mode_gradient(SPPaintSelector *psel, SPPaintSelectorMode mode)
+static void sp_paint_selector_set_mode_gradient(SPPaintSelector *psel, SPPaintSelector::Mode mode)
{
GtkWidget *gsel;
/* fixme: We do not need function-wide gsel at all */
- if (mode == SP_PAINT_SELECTOR_MODE_GRADIENT_LINEAR) {
+ if (mode == SPPaintSelector::MODE_GRADIENT_LINEAR) {
sp_paint_selector_set_style_buttons(psel, psel->gradient);
} else {
sp_paint_selector_set_style_buttons(psel, psel->radial);
}
gtk_widget_set_sensitive(psel->style, TRUE);
- if ((psel->mode == SP_PAINT_SELECTOR_MODE_GRADIENT_LINEAR) || (psel->mode == SP_PAINT_SELECTOR_MODE_GRADIENT_RADIAL)) {
+ if ((psel->mode == SPPaintSelector::MODE_GRADIENT_LINEAR) || (psel->mode == SPPaintSelector::MODE_GRADIENT_RADIAL)) {
/* Already have gradient selector */
gsel = (GtkWidget*)gtk_object_get_data(GTK_OBJECT(psel->selector), "gradient-selector");
} else {
@@ -753,7 +736,7 @@ sp_paint_selector_set_mode_gradient(SPPaintSelector *psel, SPPaintSelectorMode m
}
/* Actually we have to set option menu history here */
- if (mode == SP_PAINT_SELECTOR_MODE_GRADIENT_LINEAR) {
+ if (mode == SPPaintSelector::MODE_GRADIENT_LINEAR) {
SP_GRADIENT_SELECTOR(gsel)->setMode(SPGradientSelector::MODE_LINEAR);
//sp_gradient_selector_set_mode(SP_GRADIENT_SELECTOR(gsel), SP_GRADIENT_SELECTOR_MODE_LINEAR);
gtk_frame_set_label(GTK_FRAME(psel->frame), _("Linear gradient"));
gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(psel->unset), (active == psel->unset));
}
-static void
-sp_psel_pattern_destroy(GtkWidget *widget, SPPaintSelector *psel)
+static void sp_psel_pattern_destroy(GtkWidget *widget, SPPaintSelector * /*psel*/)
{
- (void)psel;
// drop our reference to the pattern menu widget
g_object_unref( G_OBJECT(widget) );
}
-static void
-sp_psel_pattern_change(GtkWidget *widget, SPPaintSelector *psel)
+static void sp_psel_pattern_change(GtkWidget * /*widget*/, SPPaintSelector *psel)
{
- (void)widget;
gtk_signal_emit(GTK_OBJECT(psel), psel_signals[CHANGED]);
}
@@ -865,17 +844,15 @@ sp_pattern_menu_build (GtkWidget *m, GSList *pattern_list, SPDocument */*source*
* current_doc (if non-NULL), and add items to the pattern menu
*
*/
-static void
-sp_pattern_list_from_doc (GtkWidget *m, SPDocument *current_doc, SPDocument *source, SPDocument *pattern_doc)
+static void sp_pattern_list_from_doc (GtkWidget *m, SPDocument * /*current_doc*/, SPDocument *source, SPDocument * /*pattern_doc*/)
{
- (void)current_doc;
- (void)pattern_doc;
GSList *pl = ink_pattern_list_get(source);
GSList *clean_pl = NULL;
for (; pl != NULL; pl = pl->next) {
- if (!SP_IS_PATTERN(pl->data))
+ if (!SP_IS_PATTERN(pl->data)) {
continue;
+ }
// Add to the list of patterns we really do wish to show
clean_pl = g_slist_prepend (clean_pl, pl->data);
//gtk_option_menu_set_history(GTK_OPTION_MENU(mnu), 0);
}
-static void
-sp_paint_selector_set_mode_pattern(SPPaintSelector *psel, SPPaintSelectorMode mode)
+static void sp_paint_selector_set_mode_pattern(SPPaintSelector *psel, SPPaintSelector::Mode mode)
{
- if (mode == SP_PAINT_SELECTOR_MODE_PATTERN)
+ if (mode == SPPaintSelector::MODE_PATTERN) {
sp_paint_selector_set_style_buttons(psel, psel->pattern);
+ }
gtk_widget_set_sensitive(psel->style, TRUE);
GtkWidget *tbl = NULL;
- if (psel->mode == SP_PAINT_SELECTOR_MODE_PATTERN){
+ if (psel->mode == SPPaintSelector::MODE_PATTERN) {
/* Already have pattern menu */
tbl = (GtkWidget*)gtk_object_get_data(GTK_OBJECT(psel->selector), "pattern-selector");
} else {
@@ -1058,7 +1035,7 @@ sp_paint_selector_set_mode_pattern(SPPaintSelector *psel, SPPaintSelectorMode mo
SPPattern *SPPaintSelector::getPattern()
{
SPPattern *pat = 0;
- g_return_val_if_fail((mode == SP_PAINT_SELECTOR_MODE_PATTERN) , NULL);
+ g_return_val_if_fail((mode == MODE_PATTERN) , NULL);
GtkWidget *patmnu = (GtkWidget *) g_object_get_data(G_OBJECT(this), "patternmenu");
/* no pattern menu if we were just selected */
return pat;
}
-static void sp_paint_selector_set_mode_swatch(SPPaintSelector *psel, SPPaintSelectorMode mode)
+static void sp_paint_selector_set_mode_swatch(SPPaintSelector *psel, SPPaintSelector::Mode mode)
{
- if (mode == SP_PAINT_SELECTOR_MODE_SWATCH) {
+ if (mode == SPPaintSelector::MODE_SWATCH) {
sp_paint_selector_set_style_buttons(psel, psel->swatch);
}
@@ -1105,7 +1082,7 @@ static void sp_paint_selector_set_mode_swatch(SPPaintSelector *psel, SPPaintSele
SwatchSelector *swatchsel = 0;
- if (psel->mode == SP_PAINT_SELECTOR_MODE_SWATCH){
+ if (psel->mode == SPPaintSelector::MODE_SWATCH){
/* Already have pattern menu */
swatchsel = static_cast<SwatchSelector*>(g_object_get_data(G_OBJECT(psel->selector), "swatch-selector"));
} else {
@@ -1160,13 +1137,13 @@ void SPPaintSelector::setFlatColor( SPDesktop *desktop, gchar const *color_prope
sp_repr_css_attr_unref(css);
}
-SPPaintSelectorMode sp_style_determine_paint_selector_mode(SPStyle *style, bool isfill)
+SPPaintSelector::Mode sp_style_determine_paint_selector_mode(SPStyle *style, bool isfill)
{
- SPPaintSelectorMode mode = SP_PAINT_SELECTOR_MODE_UNSET;
+ SPPaintSelector::Mode mode = SPPaintSelector::MODE_UNSET;
SPIPaint& target = isfill ? style->fill : style->stroke;
if ( !target.set ) {
- mode = SP_PAINT_SELECTOR_MODE_UNSET;
+ mode = SPPaintSelector::MODE_UNSET;
} else if ( target.isPaintserver() ) {
SPPaintServer *server = isfill? SP_STYLE_FILL_SERVER(style) : SP_STYLE_STROKE_SERVER(style);
@@ -1177,24 +1154,25 @@ SPPaintSelectorMode sp_style_determine_paint_selector_mode(SPStyle *style, bool
if (server && SP_IS_GRADIENT(server) && SP_GRADIENT(server)->getVector()->isSwatch()) {
- mode = SP_PAINT_SELECTOR_MODE_SWATCH;
+ mode = SPPaintSelector::MODE_SWATCH;
} else if (SP_IS_LINEARGRADIENT(server)) {
- mode = SP_PAINT_SELECTOR_MODE_GRADIENT_LINEAR;
+ mode = SPPaintSelector::MODE_GRADIENT_LINEAR;
} else if (SP_IS_RADIALGRADIENT(server)) {
- mode = SP_PAINT_SELECTOR_MODE_GRADIENT_RADIAL;
+ mode = SPPaintSelector::MODE_GRADIENT_RADIAL;
} else if (SP_IS_PATTERN(server)) {
- mode = SP_PAINT_SELECTOR_MODE_PATTERN;
+ mode = SPPaintSelector::MODE_PATTERN;
} else {
g_warning( "file %s: line %d: Unknown paintserver", __FILE__, __LINE__ );
- mode = SP_PAINT_SELECTOR_MODE_NONE;
+ mode = SPPaintSelector::MODE_NONE;
}
} else if ( target.isColor() ) {
- mode = SP_PAINT_SELECTOR_MODE_COLOR_RGB; // so far only rgb can be read from svg
+ // TODO this is no longer a valid assertion:
+ mode = SPPaintSelector::MODE_COLOR_RGB; // so far only rgb can be read from svg
} else if ( target.isNone() ) {
- mode = SP_PAINT_SELECTOR_MODE_NONE;
+ mode = SPPaintSelector::MODE_NONE;
} else {
g_warning( "file %s: line %d: Unknown paint type", __FILE__, __LINE__ );
- mode = SP_PAINT_SELECTOR_MODE_NONE;
+ mode = SPPaintSelector::MODE_NONE;
}
return mode;
index 9d0c5e76cdb2bf42a126895e0c82ae4b2e43b17a..63b8f733e1eddc5d6734c974369e8b1ea4d9e7b0 100644 (file)
#include <color.h>
#include <libnr/nr-forward.h>
-typedef enum {
- SP_PAINT_SELECTOR_MODE_EMPTY,
- SP_PAINT_SELECTOR_MODE_MULTIPLE,
- SP_PAINT_SELECTOR_MODE_NONE,
- SP_PAINT_SELECTOR_MODE_COLOR_RGB,
- SP_PAINT_SELECTOR_MODE_COLOR_CMYK,
- SP_PAINT_SELECTOR_MODE_GRADIENT_LINEAR,
- SP_PAINT_SELECTOR_MODE_GRADIENT_RADIAL,
- SP_PAINT_SELECTOR_MODE_PATTERN,
- SP_PAINT_SELECTOR_MODE_SWATCH,
- SP_PAINT_SELECTOR_MODE_UNSET
-} SPPaintSelectorMode;
-
-typedef enum {
- SP_PAINT_SELECTOR_FILLRULE_NONZERO,
- SP_PAINT_SELECTOR_FILLRULE_EVENODD
-} SPPaintSelectorFillRule;
/// Generic paint selector widget
struct SPPaintSelector {
GtkVBox vbox;
+ enum Mode {
+ MODE_EMPTY,
+ MODE_MULTIPLE,
+ MODE_NONE,
+ MODE_COLOR_RGB,
+ MODE_COLOR_CMYK,
+ MODE_GRADIENT_LINEAR,
+ MODE_GRADIENT_RADIAL,
+ MODE_PATTERN,
+ MODE_SWATCH,
+ MODE_UNSET
+ } ;
+
+ enum FillRule {
+ FILLRULE_NONZERO,
+ FILLRULE_EVENODD
+ } ;
+
guint update : 1;
- SPPaintSelectorMode mode;
+ Mode mode;
GtkWidget *style;
GtkWidget *none;
float alpha;
- void setMode( SPPaintSelectorMode mode );
- void setFillrule( SPPaintSelectorFillRule fillrule );
+ void setMode( Mode mode );
+ void setFillrule( FillRule fillrule );
void setColorAlpha( SPColor const &color, float alpha );
void getColorAlpha( SPColor &color, gfloat &alpha ) const;
struct SPPaintSelectorClass {
GtkVBoxClass parent_class;
- void (* mode_changed) (SPPaintSelector *psel, SPPaintSelectorMode mode);
+ void (* mode_changed) (SPPaintSelector *psel, SPPaintSelector::Mode mode);
void (* grabbed) (SPPaintSelector *psel);
void (* dragged) (SPPaintSelector *psel);
void (* released) (SPPaintSelector *psel);
void (* changed) (SPPaintSelector *psel);
- void (* fillrule_changed) (SPPaintSelector *psel, SPPaintSelectorFillRule fillrule);
+ void (* fillrule_changed) (SPPaintSelector *psel, SPPaintSelector::FillRule fillrule);
};
GtkType sp_paint_selector_get_type (void);
-SPPaintSelectorMode sp_style_determine_paint_selector_mode (SPStyle *style, bool isfill);
+SPPaintSelector::Mode sp_style_determine_paint_selector_mode(SPStyle *style, bool isfill);
#endif // SEEN_SP_PAINT_SELECTOR_H
index 57dce6fff6d8d3871c131354a7f6482e40f87c30..edf42f30b164d1a3a1785c3e7fa4e3bf9c3ab099 100644 (file)
static void sp_stroke_style_paint_selection_changed (SPWidget *spw, Inkscape::Selection *selection, SPPaintSelector *psel);
static void sp_stroke_style_paint_update(SPWidget *spw);
-static void sp_stroke_style_paint_mode_changed(SPPaintSelector *psel, SPPaintSelectorMode mode, SPWidget *spw);
+static void sp_stroke_style_paint_mode_changed(SPPaintSelector *psel, SPPaintSelector::Mode mode, SPWidget *spw);
static void sp_stroke_style_paint_dragged(SPPaintSelector *psel, SPWidget *spw);
static void sp_stroke_style_paint_changed(SPPaintSelector *psel, SPWidget *spw);
case QUERY_STYLE_NOTHING:
{
/* No paint at all */
- psel->setMode(SP_PAINT_SELECTOR_MODE_EMPTY);
+ psel->setMode(SPPaintSelector::MODE_EMPTY);
break;
}
case QUERY_STYLE_MULTIPLE_AVERAGED: // TODO: treat this slightly differently, e.g. display "averaged" somewhere in paint selector
case QUERY_STYLE_MULTIPLE_SAME:
{
- SPPaintSelectorMode pselmode = sp_style_determine_paint_selector_mode (query, false);
+ SPPaintSelector::Mode pselmode = sp_style_determine_paint_selector_mode (query, false);
psel->setMode(pselmode);
if (query->stroke.set && query->stroke.isPaintserver()) {
case QUERY_STYLE_MULTIPLE_DIFFERENT:
{
- psel->setMode(SP_PAINT_SELECTOR_MODE_MULTIPLE);
+ psel->setMode(SPPaintSelector::MODE_MULTIPLE);
break;
}
}
*/
static void
sp_stroke_style_paint_mode_changed( SPPaintSelector *psel,
- SPPaintSelectorMode /*mode*/,
+ SPPaintSelector::Mode /*mode*/,
SPWidget *spw )
{
if (gtk_object_get_data(GTK_OBJECT(spw), "update")) {
}
switch (psel->mode) {
- case SP_PAINT_SELECTOR_MODE_COLOR_RGB:
- case SP_PAINT_SELECTOR_MODE_COLOR_CMYK:
+ case SPPaintSelector::MODE_COLOR_RGB:
+ case SPPaintSelector::MODE_COLOR_CMYK:
{
psel->setFlatColor( SP_ACTIVE_DESKTOP, "stroke", "stroke-opacity" );
sp_document_maybe_done (sp_desktop_document(SP_ACTIVE_DESKTOP), undo_label, SP_VERB_DIALOG_FILL_STROKE,
GSList const *items = selection->itemList();
switch (psel->mode) {
- case SP_PAINT_SELECTOR_MODE_EMPTY:
+ case SPPaintSelector::MODE_EMPTY:
// This should not happen.
g_warning ( "file %s: line %d: Paint %d should not emit 'changed'",
__FILE__, __LINE__, psel->mode);
break;
- case SP_PAINT_SELECTOR_MODE_MULTIPLE:
+ case SPPaintSelector::MODE_MULTIPLE:
// This happens when you switch multiple objects with different gradients to flat color;
// nothing to do here.
break;
- case SP_PAINT_SELECTOR_MODE_NONE:
+ case SPPaintSelector::MODE_NONE:
{
SPCSSAttr *css = sp_repr_css_attr_new();
sp_repr_css_set_property(css, "stroke", "none");
break;
}
- case SP_PAINT_SELECTOR_MODE_COLOR_RGB:
- case SP_PAINT_SELECTOR_MODE_COLOR_CMYK:
+ case SPPaintSelector::MODE_COLOR_RGB:
+ case SPPaintSelector::MODE_COLOR_CMYK:
{
psel->setFlatColor(desktop, "stroke", "stroke-opacity");
sp_document_maybe_done (sp_desktop_document(desktop), undo_label, SP_VERB_DIALOG_FILL_STROKE,
break;
}
- case SP_PAINT_SELECTOR_MODE_GRADIENT_LINEAR:
- case SP_PAINT_SELECTOR_MODE_GRADIENT_RADIAL:
+ case SPPaintSelector::MODE_GRADIENT_LINEAR:
+ case SPPaintSelector::MODE_GRADIENT_RADIAL:
if (items) {
- SPGradientType const gradient_type = ( psel->mode == SP_PAINT_SELECTOR_MODE_GRADIENT_LINEAR
+ SPGradientType const gradient_type = ( psel->mode == SPPaintSelector::MODE_GRADIENT_LINEAR
? SP_GRADIENT_TYPE_LINEAR
: SP_GRADIENT_TYPE_RADIAL );
SPGradient *vector = psel->getGradientVector();
}
break;
- case SP_PAINT_SELECTOR_MODE_PATTERN:
+ case SPPaintSelector::MODE_PATTERN:
if (items) {
break;
- case SP_PAINT_SELECTOR_MODE_SWATCH:
+ case SPPaintSelector::MODE_SWATCH:
// TODO
break;
- case SP_PAINT_SELECTOR_MODE_UNSET:
+ case SPPaintSelector::MODE_UNSET:
if (items) {
SPCSSAttr *css = sp_repr_css_attr_new ();
sp_repr_css_unset_property (css, "stroke");