summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: 4850ac9)
raw | patch | inline | side by side (parent: 4850ac9)
author | Jon A. Cruz <jon@joncruz.org> | |
Tue, 23 Mar 2010 06:35:55 +0000 (23:35 -0700) | ||
committer | Jon A. Cruz <jon@joncruz.org> | |
Tue, 23 Mar 2010 06:35:55 +0000 (23:35 -0700) |
index b2e68c345b613a4140c35c33c90713b2269deeff..c95c1b2c5228ec25da0311d503d0c2f826a70964 100644 (file)
// Check the number of uses of the gradient within this object;
// if we are private and there are no other users,
- if (SP_OBJECT_HREFCOUNT(gr) <= count_gradient_hrefs(user, gr)) {
+ if (!vector->isSwatch() && (SP_OBJECT_HREFCOUNT(gr) <= count_gradient_hrefs(user, gr))) {
// check vector
if ( gr != vector && gr->ref->getObject() != vector ) {
/* our href is not the vector, and vector is different from gr; relink */
@@ -1080,10 +1080,11 @@ sp_item_set_gradient(SPItem *item, SPGradient *gr, SPGradientType type, bool is_
/* Current fill style is the gradient of the required type */
SPGradient *current = SP_GRADIENT(ps);
- //g_print("hrefcount %d count %d\n", SP_OBJECT_HREFCOUNT(ig), count_gradient_hrefs(SP_OBJECT(item), ig));
+ //g_message("hrefcount %d count %d\n", SP_OBJECT_HREFCOUNT(current), count_gradient_hrefs(SP_OBJECT(item), current));
- if (SP_OBJECT_HREFCOUNT(current) == 1 ||
- SP_OBJECT_HREFCOUNT(current) == count_gradient_hrefs(SP_OBJECT(item), current)) {
+ if (!current->isSwatch()
+ && (SP_OBJECT_HREFCOUNT(current) == 1 ||
+ SP_OBJECT_HREFCOUNT(current) == count_gradient_hrefs(SP_OBJECT(item), current))) {
// current is private and it's either used once, or all its uses are by children of item;
// so just change its href to vector
index 57fa229762388f490efa1bc2661a7131642e1f48..3f2018b912fcb90a17d1e890ac67c08f6b5f011a 100644 (file)
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 );
+ g_print ( "Fill style widget constructed: inkscape %p\n",
+ spw->inkscape );
#endif
if (spw->inkscape) {
sp_fill_style_widget_update (spw);
SP_OBJECT_PARENT_MODIFIED_FLAG |
SP_OBJECT_STYLE_MODIFIED_FLAG) )
{
+#ifdef SP_FS_VERBOSE
+ g_message("sp_fill_style_widget_modify_selection()");
+#endif
sp_fill_style_widget_update (spw);
}
}
case QUERY_STYLE_MULTIPLE_AVERAGED: // TODO: treat this slightly differently, e.g. display "averaged" somewhere in paint selector
case QUERY_STYLE_MULTIPLE_SAME:
{
- SPPaintSelector::Mode pselmode = sp_style_determine_paint_selector_mode(query, true);
+ SPPaintSelector::Mode pselmode = SPPaintSelector::getModeForStyle(*query, true);
psel->setMode(pselmode);
psel->setFillrule(query->fill_rule.computed == ART_WIND_RULE_NONZERO?
psel->setColorAlpha(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);
+ SPPaintServer *server = query->getFillPaintServer();
if (server && SP_IS_GRADIENT(server) && SP_GRADIENT(server)->getVector()->isSwatch()) {
SPGradient *vector = SP_GRADIENT(server)->getVector();
if (g_object_get_data (G_OBJECT (spw), "update"))
return;
+#ifdef SP_FS_VERBOSE
+ g_message("sp_fill_style_widget_paint_mode_changed(psel:%p, mode, spw:%p)", psel, spw);
+#endif
+
/* TODO: Does this work? */
/* TODO: Not really, here we have to get old color back from object */
/* Instead of relying on paint widget having meaningful colors set */
sp_fill_style_widget_paint_changed ( SPPaintSelector *psel,
SPWidget *spw )
{
+#ifdef SP_FS_VERBOSE
+ g_message("sp_fill_style_widget_paint_changed(psel:%p, spw:%p)", psel, spw);
+#endif
if (g_object_get_data (G_OBJECT (spw), "update")) {
return;
}
index 6f3fd823ee930a07a08959c6fd92ca41610059ba..288764177275cf986dc74a734f2233c69aea1a04 100644 (file)
@@ -1137,42 +1137,42 @@ void SPPaintSelector::setFlatColor( SPDesktop *desktop, gchar const *color_prope
sp_repr_css_attr_unref(css);
}
-SPPaintSelector::Mode sp_style_determine_paint_selector_mode(SPStyle *style, bool isfill)
+SPPaintSelector::Mode SPPaintSelector::getModeForStyle(SPStyle const & style, bool isfill)
{
- SPPaintSelector::Mode mode = SPPaintSelector::MODE_UNSET;
- SPIPaint& target = isfill ? style->fill : style->stroke;
+ Mode mode = MODE_UNSET;
+ SPIPaint const & target = isfill ? style.fill : style.stroke;
if ( !target.set ) {
- mode = SPPaintSelector::MODE_UNSET;
+ mode = MODE_UNSET;
} else if ( target.isPaintserver() ) {
- SPPaintServer *server = isfill? SP_STYLE_FILL_SERVER(style) : SP_STYLE_STROKE_SERVER(style);
-
+ SPPaintServer const *server = isfill ? style.getFillPaintServer() : style.getStrokePaintServer();
#ifdef SP_PS_VERBOSE
+ g_message("SPPaintSelector::getModeForStyle(%p, %d)", &style, isfill);
g_message("==== server:%p %s grad:%s swatch:%s", server, server->getId(), (SP_IS_GRADIENT(server)?"Y":"n"), (SP_IS_GRADIENT(server) && SP_GRADIENT(server)->getVector()->isSwatch()?"Y":"n"));
#endif // SP_PS_VERBOSE
if (server && SP_IS_GRADIENT(server) && SP_GRADIENT(server)->getVector()->isSwatch()) {
- mode = SPPaintSelector::MODE_SWATCH;
+ mode = MODE_SWATCH;
} else if (SP_IS_LINEARGRADIENT(server)) {
- mode = SPPaintSelector::MODE_GRADIENT_LINEAR;
+ mode = MODE_GRADIENT_LINEAR;
} else if (SP_IS_RADIALGRADIENT(server)) {
- mode = SPPaintSelector::MODE_GRADIENT_RADIAL;
+ mode = MODE_GRADIENT_RADIAL;
} else if (SP_IS_PATTERN(server)) {
- mode = SPPaintSelector::MODE_PATTERN;
+ mode = MODE_PATTERN;
} else {
g_warning( "file %s: line %d: Unknown paintserver", __FILE__, __LINE__ );
- mode = SPPaintSelector::MODE_NONE;
+ mode = MODE_NONE;
}
} else if ( target.isColor() ) {
// TODO this is no longer a valid assertion:
- mode = SPPaintSelector::MODE_COLOR_RGB; // so far only rgb can be read from svg
+ mode = MODE_COLOR_RGB; // so far only rgb can be read from svg
} else if ( target.isNone() ) {
- mode = SPPaintSelector::MODE_NONE;
+ mode = MODE_NONE;
} else {
g_warning( "file %s: line %d: Unknown paint type", __FILE__, __LINE__ );
- mode = SPPaintSelector::MODE_NONE;
+ mode = MODE_NONE;
}
return mode;
index 63b8f733e1eddc5d6734c974369e8b1ea4d9e7b0..a3c4cb973817fd7b3da9b503a4e1c895787f832d 100644 (file)
SPColor color;
float alpha;
+ static Mode getModeForStyle(SPStyle const & style, bool isfill);
void setMode( Mode mode );
void setFillrule( FillRule fillrule );
-SPPaintSelector::Mode sp_style_determine_paint_selector_mode(SPStyle *style, bool isfill);
-
#endif // SEEN_SP_PAINT_SELECTOR_H
/*
index edf42f30b164d1a3a1785c3e7fa4e3bf9c3ab099..ddd1c92d3991eab7af78bb4c4feed1f5d8250499 100644 (file)
case QUERY_STYLE_MULTIPLE_AVERAGED: // TODO: treat this slightly differently, e.g. display "averaged" somewhere in paint selector
case QUERY_STYLE_MULTIPLE_SAME:
{
- SPPaintSelector::Mode pselmode = sp_style_determine_paint_selector_mode (query, false);
+ SPPaintSelector::Mode pselmode = SPPaintSelector::getModeForStyle(*query, false);
psel->setMode(pselmode);
if (query->stroke.set && query->stroke.isPaintserver()) {