summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: 6c1dc2f)
raw | patch | inline | side by side (parent: 6c1dc2f)
| author | buliabyak <buliabyak@users.sourceforge.net> | |
| Thu, 25 Jan 2007 03:33:01 +0000 (03:33 +0000) | ||
| committer | buliabyak <buliabyak@users.sourceforge.net> | |
| Thu, 25 Jan 2007 03:33:01 +0000 (03:33 +0000) |
| src/gradient-drag.cpp | patch | blob | history |
diff --git a/src/gradient-drag.cpp b/src/gradient-drag.cpp
index 5b3b586b241cc9f8b04e0a5dfe784bea356a9684..311e741d6d5b9ce9ed83b093041e1c4137be2130 100644 (file)
--- a/src/gradient-drag.cpp
+++ b/src/gradient-drag.cpp
#include "display/sp-ctrlline.h"
#include "xml/repr.h"
+#include "svg/css-ostringstream.h"
+
+#include "svg/svg.h"
#include "prefs-utils.h"
#include "sp-item.h"
}
/**
-When a _query_style_signal is received, check that \a property requests fill/stroke (otherwise
+When a _query_style_signal is received, check that \a property requests fill/stroke/opacity (otherwise
skip), and fill the \a style with the averaged color of all draggables of the selected dragger, if
any.
*/
{
GrDrag *drag = (GrDrag *) data;
- if (property != QUERY_STYLE_PROPERTY_FILL && property != QUERY_STYLE_PROPERTY_STROKE) {
+ if (property != QUERY_STYLE_PROPERTY_FILL && property != QUERY_STYLE_PROPERTY_STROKE && property != QUERY_STYLE_PROPERTY_MASTEROPACITY) {
return QUERY_STYLE_NOTHING;
}
style->stroke.set = TRUE;
style->stroke.type = SP_PAINT_TYPE_COLOR;
- style->fill_opacity.value = SP_SCALE24_FROM_FLOAT (cf[3]);
+ style->fill_opacity.value = SP_SCALE24_FROM_FLOAT (1.0);
style->fill_opacity.set = TRUE;
- style->stroke_opacity.value = SP_SCALE24_FROM_FLOAT (cf[3]);
+ style->stroke_opacity.value = SP_SCALE24_FROM_FLOAT (1.0);
style->stroke_opacity.set = TRUE;
+
+ style->opacity.value = SP_SCALE24_FROM_FLOAT (cf[3]);
+ style->opacity.set = TRUE;
}
return ret;
if (css->attribute("stop-color"))
sp_repr_css_set_property (stop, "stop-color", css->attribute("stop-color"));
- // any of opacity properties, in order of increasing priority:
- if (css->attribute("flood-opacity"))
- sp_repr_css_set_property (stop, "stop-opacity", css->attribute("flood-color"));
-
- if (css->attribute("opacity")) // TODO: multiply
- sp_repr_css_set_property (stop, "stop-opacity", css->attribute("color"));
-
- if (css->attribute("stroke-opacity")) // TODO: multiply
- sp_repr_css_set_property (stop, "stop-opacity", css->attribute("stroke-opacity"));
- if (css->attribute("fill-opacity")) // TODO: multiply
- sp_repr_css_set_property (stop, "stop-opacity", css->attribute("fill-opacity"));
-
- if ((css->attribute("fill") && !strcmp(css->attribute("fill"), "none")) ||
- (css->attribute("stroke") && !strcmp(css->attribute("stroke"), "none")))
- sp_repr_css_set_property (stop, "stop-opacity", "0"); // if set to none, don't change color, set opacity to 0
-
- if (css->attribute("stop-opacity"))
+ if (css->attribute("stop-opacity")) { // direct setting of stop-opacity has priority
sp_repr_css_set_property (stop, "stop-opacity", css->attribute("stop-opacity"));
+ } else { // multiply all opacity properties:
+ gdouble accumulated = 1.0;
+ accumulated *= sp_svg_read_percentage(css->attribute("flood-opacity"), 1.0);
+ accumulated *= sp_svg_read_percentage(css->attribute("opacity"), 1.0);
+ accumulated *= sp_svg_read_percentage(css->attribute("stroke-opacity"), 1.0);
+ accumulated *= sp_svg_read_percentage(css->attribute("fill-opacity"), 1.0);
+
+ Inkscape::CSSOStringStream os;
+ os << accumulated;
+ sp_repr_css_set_property (stop, "stop-opacity", os.str().c_str());
+
+ if ((css->attribute("fill") && !strcmp(css->attribute("fill"), "none")) ||
+ (css->attribute("stroke") && !strcmp(css->attribute("stroke"), "none")))
+ sp_repr_css_set_property (stop, "stop-opacity", "0"); // if set to none, don't change color, set opacity to 0
+ }
if (!stop->attributeList()) { // nothing for us here, pass it on
sp_repr_css_attr_unref(stop);
SPGradient *gradient = sp_item_gradient (draggable->item, draggable->fill_or_stroke);
gradient = sp_gradient_get_vector (gradient, false);
if (gradient->vector.stops.size() > 2) { // 2 is the minimum
- SPStop *stop;
+ SPStop *stop = NULL;
switch (draggable->point_type) { // if we delete first or last stop, move the next/previous to the edge
case POINT_LG_BEGIN:
case POINT_RG_CENTER:
/**
-\brief Deselect all stops/draggers
+\brief Deselect all stops/draggers (private)
*/
void
GrDrag::deselect_all()
selected = g_list_remove(selected, selected->data);
}
}
+
+/**
+\brief Deselect all stops/draggers (public; emits signal)
+*/
+void
+GrDrag::deselectAll()
+{
+ deselect_all();
+ this->desktop->emitToolSubselectionChanged(NULL);
+}
+
/**
\brief Select a dragger