diff options
| author | Jabier Arraiza <jabier.arraiza@marker.es> | 2018-06-18 20:36:14 +0000 |
|---|---|---|
| committer | Jabier Arraiza <jabier.arraiza@marker.es> | 2018-08-05 00:37:57 +0000 |
| commit | fef6d13a74f00cd79d2cb526687f35a0443fb5b1 (patch) | |
| tree | 955d9568e7347e83c8fb09a01485792a538f499f /src | |
| parent | Fixes compiling bugs (diff) | |
| download | inkscape-fef6d13a74f00cd79d2cb526687f35a0443fb5b1.tar.gz inkscape-fef6d13a74f00cd79d2cb526687f35a0443fb5b1.zip | |
coding style fixes
Diffstat (limited to 'src')
| -rw-r--r-- | src/extension/internal/emf-inout.cpp | 60 | ||||
| -rw-r--r-- | src/extension/internal/emf-print.cpp | 4 | ||||
| -rw-r--r-- | src/extension/internal/wmf-inout.cpp | 20 | ||||
| -rw-r--r-- | src/extension/internal/wmf-print.cpp | 7 | ||||
| -rw-r--r-- | src/object/sp-item.cpp | 10 | ||||
| -rw-r--r-- | src/style-internal.cpp | 35 | ||||
| -rw-r--r-- | src/style-internal.h | 12 | ||||
| -rw-r--r-- | src/ui/dialog/inkscape-preferences.cpp | 9 | ||||
| -rw-r--r-- | src/widgets/dash-selector.cpp | 3 | ||||
| -rw-r--r-- | src/widgets/stroke-style.cpp | 9 |
10 files changed, 93 insertions, 76 deletions
diff --git a/src/extension/internal/emf-inout.cpp b/src/extension/internal/emf-inout.cpp index 49ad7c5ed..045470b53 100644 --- a/src/extension/internal/emf-inout.cpp +++ b/src/extension/internal/emf-inout.cpp @@ -32,22 +32,22 @@ #include <cstdint> #include <3rdparty/libuemf/symbol_convert.h> +#include "clear-n_.h" +#include "display/drawing-item.h" +#include "display/drawing.h" #include "document.h" -#include "object/sp-root.h" -#include "object/sp-path.h" -#include "print.h" -#include "extension/system.h" -#include "extension/print.h" #include "extension/db.h" #include "extension/input.h" #include "extension/output.h" -#include "display/drawing.h" -#include "display/drawing-item.h" -#include "clear-n_.h" -#include "svg/svg.h" +#include "extension/print.h" +#include "extension/system.h" +#include "inkscape.h" // even though it is included indirectly by emf-inout.h +#include "object/sp-path.h" +#include "object/sp-root.h" +#include "print.h" #include "svg/css-ostringstream.h" +#include "svg/svg.h" #include "util/units.h" // even though it is included indirectly by emf-inout.h -#include "inkscape.h" // even though it is included indirectly by emf-inout.h #include "emf-print.h" #include "emf-inout.h" @@ -1098,21 +1098,23 @@ Emf::select_pen(PEMF_CALLBACK_DATA d, int index) SPILength spilength; spilength.read("1"); int penstyle = (pEmr->lopn.lopnStyle & U_PS_STYLE_MASK); - if (!d->dc[d->level].style.stroke_dasharray.values.empty() && (d->level==0 || (d->level>0 && d->dc[d->level].style.stroke_dasharray!=d->dc[d->level-1].style.stroke_dasharray))) + if (!d->dc[d->level].style.stroke_dasharray.values.empty() && + (d->level == 0 || (d->level > 0 && d->dc[d->level].style.stroke_dasharray != + d->dc[d->level - 1].style.stroke_dasharray))) d->dc[d->level].style.stroke_dasharray.values.clear(); if (penstyle==U_PS_DASH || penstyle==U_PS_DASHDOT || penstyle==U_PS_DASHDOTDOT) { spilength.read("3"); - d->dc[d->level].style.stroke_dasharray.values.push_back( spilength ); + d->dc[d->level].style.stroke_dasharray.values.push_back(spilength); spilength.read("1"); - d->dc[d->level].style.stroke_dasharray.values.push_back( spilength ); + d->dc[d->level].style.stroke_dasharray.values.push_back(spilength); } if (penstyle==U_PS_DOT || penstyle==U_PS_DASHDOT || penstyle==U_PS_DASHDOTDOT) { - d->dc[d->level].style.stroke_dasharray.values.push_back( spilength ); - d->dc[d->level].style.stroke_dasharray.values.push_back( spilength ); + d->dc[d->level].style.stroke_dasharray.values.push_back(spilength); + d->dc[d->level].style.stroke_dasharray.values.push_back(spilength); } if (penstyle==U_PS_DASHDOTDOT) { - d->dc[d->level].style.stroke_dasharray.values.push_back( spilength ); - d->dc[d->level].style.stroke_dasharray.values.push_back( spilength ); + d->dc[d->level].style.stroke_dasharray.values.push_back(spilength); + d->dc[d->level].style.stroke_dasharray.values.push_back(spilength); } d->dc[d->level].style.stroke_dasharray.set = 1; @@ -1184,7 +1186,9 @@ Emf::select_extpen(PEMF_CALLBACK_DATA d, int index) case U_PS_USERSTYLE: { if (pEmr->elp.elpNumEntries) { - if (!d->dc[d->level].style.stroke_dasharray.values.empty() && (d->level==0 || (d->level>0 && d->dc[d->level].style.stroke_dasharray!=d->dc[d->level-1].style.stroke_dasharray))) + if (!d->dc[d->level].style.stroke_dasharray.values.empty() && + (d->level == 0 || (d->level > 0 && d->dc[d->level].style.stroke_dasharray != + d->dc[d->level - 1].style.stroke_dasharray))) d->dc[d->level].style.stroke_dasharray.values.clear(); SPILength spilength; for (unsigned int i=0; i<pEmr->elp.elpNumEntries; i++) { @@ -1207,26 +1211,28 @@ Emf::select_extpen(PEMF_CALLBACK_DATA d, int index) case U_PS_DASHDOTDOT: { int penstyle = (pEmr->elp.elpPenStyle & U_PS_STYLE_MASK); - if (!d->dc[d->level].style.stroke_dasharray.values.empty() && (d->level==0 || (d->level>0 && d->dc[d->level].style.stroke_dasharray!=d->dc[d->level-1].style.stroke_dasharray))) + if (!d->dc[d->level].style.stroke_dasharray.values.empty() && + (d->level == 0 || (d->level > 0 && d->dc[d->level].style.stroke_dasharray != + d->dc[d->level - 1].style.stroke_dasharray))) d->dc[d->level].style.stroke_dasharray.values.clear(); SPILength spilength; if (penstyle==U_PS_DASH || penstyle==U_PS_DASHDOT || penstyle==U_PS_DASHDOTDOT) { spilength.read("3"); - d->dc[d->level].style.stroke_dasharray.values.push_back( spilength ); + d->dc[d->level].style.stroke_dasharray.values.push_back(spilength); spilength.read("2"); - d->dc[d->level].style.stroke_dasharray.values.push_back( spilength ); + d->dc[d->level].style.stroke_dasharray.values.push_back(spilength); } if (penstyle==U_PS_DOT || penstyle==U_PS_DASHDOT || penstyle==U_PS_DASHDOTDOT) { spilength.read("1"); - d->dc[d->level].style.stroke_dasharray.values.push_back( spilength ); + d->dc[d->level].style.stroke_dasharray.values.push_back(spilength); spilength.read("2"); - d->dc[d->level].style.stroke_dasharray.values.push_back( spilength ); + d->dc[d->level].style.stroke_dasharray.values.push_back(spilength); } if (penstyle==U_PS_DASHDOTDOT) { spilength.read("1"); - d->dc[d->level].style.stroke_dasharray.values.push_back( spilength ); + d->dc[d->level].style.stroke_dasharray.values.push_back(spilength); spilength.read("2"); - d->dc[d->level].style.stroke_dasharray.values.push_back( spilength ); + d->dc[d->level].style.stroke_dasharray.values.push_back(spilength); } d->dc[d->level].style.stroke_dasharray.set = 1; @@ -2363,7 +2369,9 @@ std::cout << "BEFORE DRAW" d->level = d->level + pEmr->iRelative; } while (old_level > d->level) { - if (!d->dc[old_level].style.stroke_dasharray.values.empty() && (old_level==0 || (old_level>0 && d->dc[old_level].style.stroke_dasharray!=d->dc[old_level-1].style.stroke_dasharray))){ + if (!d->dc[old_level].style.stroke_dasharray.values.empty() && + (old_level == 0 || (old_level > 0 && d->dc[old_level].style.stroke_dasharray != + d->dc[old_level - 1].style.stroke_dasharray))) { d->dc[old_level].style.stroke_dasharray.values.clear(); } if(d->dc[old_level].font_name){ diff --git a/src/extension/internal/emf-print.cpp b/src/extension/internal/emf-print.cpp index ee698ea4a..a4c351d82 100644 --- a/src/extension/internal/emf-print.cpp +++ b/src/extension/internal/emf-print.cpp @@ -705,7 +705,7 @@ int PrintEmf::create_pen(SPStyle const *style, const Geom::Affine &transform) n_dash = style->stroke_dasharray.values.size(); dash = new uint32_t[n_dash]; for (i = 0; i < n_dash; i++) { - dash[i] = MAX(1, (uint32_t) round(scale * style->stroke_dasharray.values[i].value * PX2WORLD)); + dash[i] = MAX(1, (uint32_t)round(scale * style->stroke_dasharray.values[i].value * PX2WORLD)); } } } @@ -1469,7 +1469,7 @@ unsigned int PrintEmf::stroke( first_frag = fragment; } slength = elength; - slength += style->stroke_dasharray.values[i++].value; // the gap + slength += style->stroke_dasharray.values[i++].value; // the gap if (i >= n_dash) { i = 0; } diff --git a/src/extension/internal/wmf-inout.cpp b/src/extension/internal/wmf-inout.cpp index d88998a16..1f8d4668d 100644 --- a/src/extension/internal/wmf-inout.cpp +++ b/src/extension/internal/wmf-inout.cpp @@ -987,21 +987,23 @@ Wmf::select_pen(PWMF_CALLBACK_DATA d, int index) int penstyle = (up.Style & U_PS_STYLE_MASK); SPILength spilength; spilength.read("1"); - if (!d->dc[d->level].style.stroke_dasharray.values.empty() && (d->level==0 || (d->level>0 && d->dc[d->level].style.stroke_dasharray!=d->dc[d->level-1].style.stroke_dasharray))) + if (!d->dc[d->level].style.stroke_dasharray.values.empty() && + (d->level == 0 || (d->level > 0 && d->dc[d->level].style.stroke_dasharray != + d->dc[d->level - 1].style.stroke_dasharray))) d->dc[d->level].style.stroke_dasharray.values.clear(); if (penstyle==U_PS_DASH || penstyle==U_PS_DASHDOT || penstyle==U_PS_DASHDOTDOT) { spilength.read("3"); - d->dc[d->level].style.stroke_dasharray.values.push_back( spilength ); + d->dc[d->level].style.stroke_dasharray.values.push_back(spilength); spilength.read("1"); - d->dc[d->level].style.stroke_dasharray.values.push_back( spilength ); + d->dc[d->level].style.stroke_dasharray.values.push_back(spilength); } if (penstyle==U_PS_DOT || penstyle==U_PS_DASHDOT || penstyle==U_PS_DASHDOTDOT) { - d->dc[d->level].style.stroke_dasharray.values.push_back( spilength ); - d->dc[d->level].style.stroke_dasharray.values.push_back( spilength ); + d->dc[d->level].style.stroke_dasharray.values.push_back(spilength); + d->dc[d->level].style.stroke_dasharray.values.push_back(spilength); } if (penstyle==U_PS_DASHDOTDOT) { - d->dc[d->level].style.stroke_dasharray.values.push_back( spilength ); - d->dc[d->level].style.stroke_dasharray.values.push_back( spilength ); + d->dc[d->level].style.stroke_dasharray.values.push_back(spilength); + d->dc[d->level].style.stroke_dasharray.values.push_back(spilength); } d->dc[d->level].style.stroke_dasharray.set = 1; @@ -2444,7 +2446,9 @@ std::cout << "BEFORE DRAW" d->level = d->level + DC; } while (old_level > d->level) { - if (!d->dc[old_level].style.stroke_dasharray.values.empty() && (old_level==0 || (old_level>0 && d->dc[old_level].style.stroke_dasharray!=d->dc[old_level-1].style.stroke_dasharray))){ + if (!d->dc[old_level].style.stroke_dasharray.values.empty() && + (old_level == 0 || (old_level > 0 && d->dc[old_level].style.stroke_dasharray != + d->dc[old_level - 1].style.stroke_dasharray))) { d->dc[old_level].style.stroke_dasharray.values.clear(); } if(d->dc[old_level].font_name){ diff --git a/src/extension/internal/wmf-print.cpp b/src/extension/internal/wmf-print.cpp index 3419ac89a..917aded32 100644 --- a/src/extension/internal/wmf-print.cpp +++ b/src/extension/internal/wmf-print.cpp @@ -603,8 +603,9 @@ int PrintWmf::create_pen(SPStyle const *style, const Geom::Affine &transform) int mark_long =0; int i; for (i=0;i<n_dash;i++) { - int mark = style->stroke_dasharray.values[i].value; - if (mark>mark_long) { mark_long = mark; } + int mark = style->stroke_dasharray.values[i].value; + if (mark > mark_long) { + mark_long = mark; } if (mark<mark_short) { mark_short = mark; } } if(mark_long == mark_short){ // only one mark size @@ -901,7 +902,7 @@ unsigned int PrintWmf::stroke( first_frag = fragment; } slength = elength; - slength += style->stroke_dasharray.values[i++].value; // the gap + slength += style->stroke_dasharray.values[i++].value; // the gap if (i >= n_dash) { i = 0; } diff --git a/src/object/sp-item.cpp b/src/object/sp-item.cpp index fa281e9ee..0853acc51 100644 --- a/src/object/sp-item.cpp +++ b/src/object/sp-item.cpp @@ -20,13 +20,13 @@ #include <glibmm/i18n.h> +#include "attributes.h" #include "bad-uri-exception.h" -#include "svg/svg.h" -#include "svg/css-ostringstream.h" -#include "print.h" #include "display/drawing-item.h" -#include "attributes.h" #include "document.h" +#include "print.h" +#include "svg/css-ostringstream.h" +#include "svg/svg.h" #include "inkscape.h" #include "desktop.h" @@ -1308,7 +1308,7 @@ void SPItem::adjust_stroke( gdouble ex ) if ( !style->stroke_dasharray.values.empty() ) { for (unsigned i = 0; i < style->stroke_dasharray.values.size(); i++) { - double dash = style->stroke_dasharray.values[i].value * ex; + double dash = style->stroke_dasharray.values[i].value * ex; Inkscape::CSSOStringStream osarray; osarray << dash; style->stroke_dasharray.values[i].read(osarray.str().c_str()); diff --git a/src/style-internal.cpp b/src/style-internal.cpp index d58eaf51e..f22f77026 100644 --- a/src/style-internal.cpp +++ b/src/style-internal.cpp @@ -33,13 +33,13 @@ #include "bad-uri-exception.h" #include "extract-uri.h" +#include "inkscape.h" #include "preferences.h" #include "streq.h" #include "strneq.h" -#include "inkscape.h" -#include "svg/svg.h" -#include "svg/svg-color.h" #include "svg/css-ostringstream.h" +#include "svg/svg-color.h" +#include "svg/svg.h" #include "util/units.h" @@ -431,15 +431,17 @@ SPILength::merge( const SPIBase* const parent ) { } // Generate a string useful for passing dasharray without name, etc. -const Glib::ustring -SPILength::toString( guint const flags, SPStyleSrc const &style_src_req, SPIBase const *const base) const { - SPILength const *const my_base = dynamic_cast<const SPILength*>(base); +const Glib::ustring SPILength::toString(guint const flags, SPStyleSrc const &style_src_req, + SPIBase const *const base) const +{ + SPILength const *const my_base = dynamic_cast<const SPILength *>(base); bool dfp = (!inherits || !my_base || (my_base != this)); // Different from parent bool src = (style_src_req == style_src || !(flags & SP_STYLE_FLAG_IFSRC)); if (should_write(flags, set, dfp, src)) { if (this->inherit) { return ("inherit"); - } else { + } + else { Inkscape::CSSOStringStream os; switch (this->unit) { case SP_CSS_UNIT_NONE: @@ -2083,24 +2085,25 @@ SPIDashArray::read( gchar const *str ) { if( strcmp(str, "none") == 0) { return; } - std::vector<Glib::ustring> tokens = Glib::Regex::split_simple("[(,\\s|\\s)]+", str ); + std::vector<Glib::ustring> tokens = Glib::Regex::split_simple("[(,\\s|\\s)]+", str); gchar *e = NULL; bool LineSolid = true; SPDocument *document = NULL; - if ( style) { + if (style) { document = (style->object) ? style->object->document : NULL; } - for (auto token:tokens) { + for (auto token : tokens) { SPILength spilength; spilength.read(token.c_str()); - if(spilength.value > 0.00000001) - LineSolid = false; + if (spilength.value > 0.00000001) + LineSolid = false; double dash = spilength.value; if (document) { if (spilength.unit == SPCSSUnit::SP_CSS_UNIT_PERCENT) { dash = document->getViewBox().width() * spilength.value; - } else if(spilength.unit != SPCSSUnit::SP_CSS_UNIT_NONE) { + } + else if (spilength.unit != SPCSSUnit::SP_CSS_UNIT_NONE) { dash = spilength.computed / document->getDocumentScale()[0]; } } @@ -2170,9 +2173,9 @@ SPIDashArray::merge( const SPIBase* const parent ) { bool SPIDashArray::operator==(const SPIBase& rhs) { - if( const SPIDashArray* r = dynamic_cast<const SPIDashArray*>(&rhs) ) { - for (int i = 0;i < values.size(); i++) { - if (values[i] != r->values[i]) { + if (const SPIDashArray *r = dynamic_cast<const SPIDashArray *>(&rhs)) { + for (int i = 0; i < values.size(); i++) { + if (values[i] != r->values[i]) { return false; } } diff --git a/src/style-internal.h b/src/style-internal.h index b3e467398..935bf0630 100644 --- a/src/style-internal.h +++ b/src/style-internal.h @@ -404,11 +404,11 @@ public: } virtual const Glib::ustring toString(guint const flags = SP_STYLE_FLAG_IFSET, - SPStyleSrc const &style_src_req = SP_STYLE_SRC_STYLE_PROP, - SPIBase const *const base = NULL) const; + SPStyleSrc const &style_src_req = SP_STYLE_SRC_STYLE_PROP, + SPIBase const *const base = nullptr) const; - // To do: make private -public: + // To do: make private + public: unsigned unit : 4; float value; float computed; @@ -455,7 +455,7 @@ public: bool operator!=(const SPIBase& rhs) override { return !(*this == rhs); } - + // To do: make private public: bool normal : 1; @@ -1016,7 +1016,7 @@ public: // To do: make private, change double to SVGLength public: - std::vector<SPILength> values; + std::vector<SPILength> values; }; /// Filter type internal to SPStyle diff --git a/src/ui/dialog/inkscape-preferences.cpp b/src/ui/dialog/inkscape-preferences.cpp index 9e6ff92c1..f452f4812 100644 --- a/src/ui/dialog/inkscape-preferences.cpp +++ b/src/ui/dialog/inkscape-preferences.cpp @@ -1447,11 +1447,10 @@ void InkscapePreferences::initPageBehavior() _("Always store transformation as a transform= attribute on objects")); this->AddPage(_page_transforms, _("Transforms"), iter_behavior, PREFS_PAGE_BEHAVIOR_TRANSFORMS); - - _dash_scale.init ( _("Stroke width change dashes"), "/options/dash/scale", true); - _page_dashes.add_line( false, "", _dash_scale, "", - _("When chage stroke width, scale the dash array")); - + + _dash_scale.init(_("Stroke width change dashes"), "/options/dash/scale", true); + _page_dashes.add_line(false, "", _dash_scale, "", _("When chage stroke width, scale the dash array")); + this->AddPage(_page_dashes, _("Dashes"), iter_behavior, PREFS_PAGE_BEHAVIOR_DASHES); // Scrolling options diff --git a/src/widgets/dash-selector.cpp b/src/widgets/dash-selector.cpp index 7c3f32765..9956b9062 100644 --- a/src/widgets/dash-selector.cpp +++ b/src/widgets/dash-selector.cpp @@ -170,7 +170,8 @@ void SPDashSelector::set_dash (int ndash, double *dash, double o) if (scale) { if (!Geom::are_near(dash[j], pattern[j], delta)) break; - } else { + } + else { if (!Geom::are_near(dash[j], pattern[j], delta)) break; } diff --git a/src/widgets/stroke-style.cpp b/src/widgets/stroke-style.cpp index ae49f9e40..bfa21a9ea 100644 --- a/src/widgets/stroke-style.cpp +++ b/src/widgets/stroke-style.cpp @@ -754,9 +754,9 @@ StrokeStyle::setDashSelectorFromStyle(SPDashSelector *dsel, SPStyle *style) else d[i] = style->stroke_dasharray.values[i].value; // is there a better thing to do for stroke_width==0? } - dsel->set_dash(len, d, style->stroke_width.computed != 0 ? - style->stroke_dashoffset.value / scaledash : - style->stroke_dashoffset.value); + dsel->set_dash(len, d, + style->stroke_width.computed != 0 ? style->stroke_dashoffset.value / scaledash + : style->stroke_dashoffset.value); } else { dsel->set_dash(0, nullptr, 0.0); } @@ -1053,7 +1053,8 @@ StrokeStyle::scaleLine() gboolean scale = prefs->getBool("/options/dash/scale", true); if (scale) { setScaledDash(css, ndash, dash, offset, width); - } else { + } + else { setScaledDash(css, ndash, dash, offset, document->getDocumentScale()[0]); } sp_desktop_apply_css_recursive ((*i), css, true); |
