summaryrefslogtreecommitdiffstats
path: root/src/marker.cpp
diff options
context:
space:
mode:
authorLiam P. White <inkscapebrony@gmail.com>2014-08-31 18:59:47 +0000
committerLiam P. White <inkscapebrony@gmail.com>2014-08-31 18:59:47 +0000
commit6a306cf8edbaebacbe679a58f6b162657caf5ad0 (patch)
treef043ce64170b0ab7ada1712efb8e38a3fbe5681a /src/marker.cpp
parentUpdate to experimental r13483 (diff)
parentHeader cleanup: stop using Glib types where they aren't truly needed. Eases G... (diff)
downloadinkscape-6a306cf8edbaebacbe679a58f6b162657caf5ad0.tar.gz
inkscape-6a306cf8edbaebacbe679a58f6b162657caf5ad0.zip
Update to experimental r13531
(bzr r13090.1.106)
Diffstat (limited to 'src/marker.cpp')
-rw-r--r--src/marker.cpp41
1 files changed, 25 insertions, 16 deletions
diff --git a/src/marker.cpp b/src/marker.cpp
index 7fee16ead..a4cbc30ca 100644
--- a/src/marker.cpp
+++ b/src/marker.cpp
@@ -52,7 +52,7 @@ SPMarker::SPMarker() : SPGroup(), SPViewBox() {
this->markerUnits = 0;
this->markerUnits_set = 0;
- this->orient_auto = 0;
+ this->orient_mode = MARKER_ORIENT_ANGLE;
this->orient_set = 0;
this->orient = 0;
@@ -158,16 +158,20 @@ void SPMarker::set(unsigned int key, const gchar* value) {
case SP_ATTR_ORIENT:
this->orient_set = FALSE;
- this->orient_auto = FALSE;
+ this->orient_mode = MARKER_ORIENT_ANGLE;
this->orient = 0.0;
if (value) {
- if (!strcmp (value, "auto")) {
- this->orient_auto = TRUE;
- this->orient_set = TRUE;
- } else if (sp_svg_number_read_f (value, &this->orient)) {
- this->orient_set = TRUE;
- }
+ if (!strcmp (value, "auto")) {
+ this->orient_mode = MARKER_ORIENT_AUTO;
+ this->orient_set = TRUE;
+ } else if (!strcmp (value, "auto-start-reverse")) {
+ this->orient_mode = MARKER_ORIENT_AUTO_START_REVERSE;
+ this->orient_set = TRUE;
+ } else if (sp_svg_number_read_f (value, &this->orient)) {
+ this->orient_mode = MARKER_ORIENT_ANGLE;
+ this->orient_set = TRUE;
+ }
}
this->requestDisplayUpdate(SP_OBJECT_MODIFIED_FLAG);
@@ -264,15 +268,17 @@ Inkscape::XML::Node* SPMarker::write(Inkscape::XML::Document *xml_doc, Inkscape:
}
if (this->orient_set) {
- if (this->orient_auto) {
- repr->setAttribute("orient", "auto");
- } else {
- sp_repr_set_css_double(repr, "orient", this->orient);
- }
+ if (this->orient_mode == MARKER_ORIENT_AUTO) {
+ repr->setAttribute("orient", "auto");
+ } else if (this->orient_mode == MARKER_ORIENT_AUTO_START_REVERSE) {
+ repr->setAttribute("orient", "auto-start-reverse");
+ } else {
+ sp_repr_set_css_double(repr, "orient", this->orient);
+ }
} else {
- repr->setAttribute("orient", NULL);
+ repr->setAttribute("orient", NULL);
}
-
+
/* fixme: */
//XML Tree being used directly here while it shouldn't be....
repr->setAttribute("viewBox", this->getRepr()->attribute("viewBox"));
@@ -381,7 +387,10 @@ sp_marker_show_instance ( SPMarker *marker, Inkscape::DrawingItem *parent,
}
if (v->items[pos]) {
Geom::Affine m;
- if (marker->orient_auto) {
+ if (marker->orient_mode == MARKER_ORIENT_AUTO) {
+ m = base;
+ } else if (marker->orient_mode == MARKER_ORIENT_AUTO_START_REVERSE) {
+ m = Geom::Rotate::from_degrees( 180.0 ) * base;
m = base;
} else {
/* fixme: Orient units (Lauris) */