diff options
| author | su_v <suv-sf@users.sourceforge.net> | 2014-07-27 11:44:25 +0000 |
|---|---|---|
| committer | ~suv <suv-sf@users.sourceforge.net> | 2014-07-27 11:44:25 +0000 |
| commit | 3ebd8c4550a8c8bf944e18fec8f3df3d2da5c1af (patch) | |
| tree | 981526f208f9998ea858cfd55a2c946f72dcb02e /src | |
| parent | update to trunk (r13454) (diff) | |
| parent | Properly fix 1309050, revert incorrect fix for 601336 (diff) | |
| download | inkscape-3ebd8c4550a8c8bf944e18fec8f3df3d2da5c1af.tar.gz inkscape-3ebd8c4550a8c8bf944e18fec8f3df3d2da5c1af.zip | |
update to trunk (r13472)
(bzr r13398.1.5)
Diffstat (limited to 'src')
| -rw-r--r-- | src/box3d.cpp | 19 | ||||
| -rw-r--r-- | src/desktop-events.cpp | 5 | ||||
| -rw-r--r-- | src/extension/internal/emf-inout.cpp | 22 | ||||
| -rw-r--r-- | src/extension/internal/emf-print.cpp | 2 | ||||
| -rw-r--r-- | src/extension/internal/emf-print.h | 2 | ||||
| -rw-r--r-- | src/extension/internal/text_reassemble.c | 20 | ||||
| -rw-r--r-- | src/extension/internal/wmf-inout.cpp | 4 | ||||
| -rw-r--r-- | src/extension/internal/wmf-print.cpp | 2 | ||||
| -rw-r--r-- | src/extension/internal/wmf-print.h | 2 | ||||
| -rw-r--r-- | src/gradient-chemistry.cpp | 12 | ||||
| -rw-r--r-- | src/gradient-drag.cpp | 9 | ||||
| -rw-r--r-- | src/knot.cpp | 5 | ||||
| -rw-r--r-- | src/sp-flowregion.cpp | 4 | ||||
| -rw-r--r-- | src/sp-flowtext.cpp | 2 | ||||
| -rw-r--r-- | src/sp-text.cpp | 1 | ||||
| -rw-r--r-- | src/sp-use.cpp | 12 | ||||
| -rw-r--r-- | src/style-internal.cpp | 8 | ||||
| -rw-r--r-- | src/svg/svg-color.cpp | 53 | ||||
| -rw-r--r-- | src/ui/dialog/dialog-manager.cpp | 6 | ||||
| -rw-r--r-- | src/ui/dialog/template-widget.cpp | 2 | ||||
| -rw-r--r-- | src/ui/tools/pen-tool.cpp | 2 | ||||
| -rw-r--r-- | src/ui/tools/spray-tool.cpp | 2 | ||||
| -rw-r--r-- | src/ui/tools/tool-base.cpp | 9 | ||||
| -rw-r--r-- | src/ui/widget/style-swatch.cpp | 2 | ||||
| -rw-r--r-- | src/widgets/ruler.cpp | 2 |
25 files changed, 146 insertions, 63 deletions
diff --git a/src/box3d.cpp b/src/box3d.cpp index 13a8d0e3e..eb82524dd 100644 --- a/src/box3d.cpp +++ b/src/box3d.cpp @@ -672,15 +672,6 @@ box3d_aux_set_z_orders (int z_orders[6], int a, int b, int c, int d, int e, int z_orders[5] = f; } -static inline void -box3d_swap_z_orders (int z_orders[6]) { - int tmp; - for (int i = 0; i < 3; ++i) { - tmp = z_orders[i]; - z_orders[i] = z_orders[5-i]; - z_orders[5-i] = tmp; - } -} /* * In standard perspective we have: @@ -695,11 +686,6 @@ box3d_swap_z_orders (int z_orders[6]) { /* All VPs infinite */ static void box3d_set_new_z_orders_case0 (SPBox3D *box, int z_orders[6], Box3D::Axis central_axis) { - Persp3D *persp = box3d_get_perspective(box); - Geom::Point xdir(persp3d_get_infinite_dir(persp, Proj::X)); - Geom::Point ydir(persp3d_get_infinite_dir(persp, Proj::Y)); - Geom::Point zdir(persp3d_get_infinite_dir(persp, Proj::Z)); - bool swapped = box3d_XY_axes_are_swapped(box); switch(central_axis) { @@ -811,12 +797,7 @@ box3d_set_new_z_orders_case1 (SPBox3D *box, int z_orders[6], Box3D::Axis central /* Precisely 2 finite VPs */ static void box3d_set_new_z_orders_case2 (SPBox3D *box, int z_orders[6], Box3D::Axis central_axis, Box3D::Axis /*infinite_axis*/) { - Persp3D *persp = box3d_get_perspective(box); - Geom::Point c3(box3d_get_corner_screen(box, 3, false)); - Geom::Point xdir(persp3d_get_PL_dir_from_pt(persp, c3, Proj::X)); - Geom::Point ydir(persp3d_get_PL_dir_from_pt(persp, c3, Proj::Y)); - Geom::Point zdir(persp3d_get_PL_dir_from_pt(persp, c3, Proj::Z)); bool swapped = box3d_XY_axes_are_swapped(box); diff --git a/src/desktop-events.cpp b/src/desktop-events.cpp index 0129a382d..8be5e001b 100644 --- a/src/desktop-events.cpp +++ b/src/desktop-events.cpp @@ -365,7 +365,7 @@ gint sp_dt_guide_event(SPCanvasItem *item, GdkEvent *event, gpointer data) if (event->motion.state & GDK_CONTROL_MASK) { Inkscape::Preferences *prefs = Inkscape::Preferences::get(); unsigned const snaps = abs(prefs->getInt("/options/rotationsnapsperpi/value", 12)); - bool const relative_snaps = abs(prefs->getBool("/options/relativeguiderotationsnap/value", false)); + bool const relative_snaps = prefs->getBool("/options/relativeguiderotationsnap/value", false); if (snaps) { if (relative_snaps) { Geom::Angle orig_angle(guide->normal_to_line); @@ -442,7 +442,7 @@ gint sp_dt_guide_event(SPCanvasItem *item, GdkEvent *event, gpointer data) if (event->motion.state & GDK_CONTROL_MASK) { Inkscape::Preferences *prefs = Inkscape::Preferences::get(); unsigned const snaps = abs(prefs->getInt("/options/rotationsnapsperpi/value", 12)); - bool const relative_snaps = abs(prefs->getBool("/options/relativeguiderotationsnap/value", false)); + bool const relative_snaps = prefs->getBool("/options/relativeguiderotationsnap/value", false); if (snaps) { if (relative_snaps) { Geom::Angle orig_angle(guide->normal_to_line); @@ -491,7 +491,6 @@ gint sp_dt_guide_event(SPCanvasItem *item, GdkEvent *event, gpointer data) // set move or rotate cursor Geom::Point const event_w(event->crossing.x, event->crossing.y); - Geom::Point const event_dt(desktop->w2d(event_w)); if ((event->crossing.state & GDK_SHIFT_MASK) && (drag_type != SP_DRAG_MOVE_ORIGIN)) { GdkCursor *guide_cursor; diff --git a/src/extension/internal/emf-inout.cpp b/src/extension/internal/emf-inout.cpp index 863d1e006..084fbcd58 100644 --- a/src/extension/internal/emf-inout.cpp +++ b/src/extension/internal/emf-inout.cpp @@ -1641,11 +1641,19 @@ int Emf::myEnhMetaFileProc(char *contents, unsigned int length, PEMF_CALLBACK_DA // next record is valid type and forces pending text to be drawn immediately if ((d->dc[d->level].dirty & DIRTY_TEXT) || ((emr_mask != U_EMR_INVALID) && (emr_mask & U_DRAW_TEXT) && d->tri->dirty)){ TR_layout_analyze(d->tri); + if (d->dc[d->level].clip_id){ + SVGOStringStream tmp_clip; + tmp_clip << "\n<g\n\tclip-path=\"url(#clipEmfPath" << d->dc[d->level].clip_id << ")\"\n>"; + d->outsvg += tmp_clip.str().c_str(); + } TR_layout_2_svg(d->tri); SVGOStringStream ts; ts << d->tri->out; d->outsvg += ts.str().c_str(); d->tri = trinfo_clear(d->tri); + if (d->dc[d->level].clip_id){ + d->outsvg += "\n</g>\n"; + } } if(d->dc[d->level].dirty){ //Apply the delayed background changes, clear the flag d->dc[d->level].bkMode = tbkMode; @@ -2524,8 +2532,8 @@ std::cout << "BEFORE DRAW" double cx = pix_to_x_point( d, (rclBox.left + rclBox.right)/2.0, (rclBox.bottom + rclBox.top)/2.0 ); double cy = pix_to_y_point( d, (rclBox.left + rclBox.right)/2.0, (rclBox.bottom + rclBox.top)/2.0 ); - double rx = pix_to_abs_size( d, fabs(rclBox.right - rclBox.left )/2.0 ); - double ry = pix_to_abs_size( d, fabs(rclBox.top - rclBox.bottom)/2.0 ); + double rx = pix_to_abs_size( d, std::abs(rclBox.right - rclBox.left )/2.0 ); + double ry = pix_to_abs_size( d, std::abs(rclBox.top - rclBox.bottom)/2.0 ); SVGOStringStream tmp_ellipse; tmp_ellipse << "cx=\"" << cx << "\" "; @@ -3141,11 +3149,19 @@ std::cout << "BEFORE DRAW" int status = trinfo_load_textrec(d->tri, &tsp, tsp.ori,TR_EMFBOT); // ori is actually escapement if(status==-1){ // change of escapement, emit what we have and reset TR_layout_analyze(d->tri); + if (d->dc[d->level].clip_id){ + SVGOStringStream tmp_clip; + tmp_clip << "\n<g\n\tclip-path=\"url(#clipEmfPath" << d->dc[d->level].clip_id << ")\"\n>"; + d->outsvg += tmp_clip.str().c_str(); + } TR_layout_2_svg(d->tri); ts << d->tri->out; d->outsvg += ts.str().c_str(); d->tri = trinfo_clear(d->tri); (void) trinfo_load_textrec(d->tri, &tsp, tsp.ori,TR_EMFBOT); // ignore return status, it must work + if (d->dc[d->level].clip_id){ + d->outsvg += "\n</g>\n"; + } } g_free(escaped_text); @@ -3479,7 +3495,7 @@ Emf::open( Inkscape::Extension::Input * /*mod*/, const gchar *uri ) if (d.pDesc){ free( d.pDesc ); } -// std::cout << "SVG Output: " << std::endl << *(d.outsvg) << std::endl; +// std::cout << "SVG Output: " << std::endl << d.outsvg << std::endl; SPDocument *doc = SPDocument::createNewDocFromMem(d.outsvg.c_str(), strlen(d.outsvg.c_str()), TRUE); diff --git a/src/extension/internal/emf-print.cpp b/src/extension/internal/emf-print.cpp index 0bdfd45b9..e054829b5 100644 --- a/src/extension/internal/emf-print.cpp +++ b/src/extension/internal/emf-print.cpp @@ -1882,7 +1882,7 @@ unsigned int PrintEmf::text(Inkscape::Extension::Print * /*mod*/, char const *te fix90n = 1; //assume vertical rot = (double)(((int) round(rot)) - irem); rotb = rot * M_PI / 1800.0; - if (abs(rot) == 900.0) { + if (std::abs(rot) == 900.0) { fix90n = 2; } } diff --git a/src/extension/internal/emf-print.h b/src/extension/internal/emf-print.h index 1e4970a46..9a1251b38 100644 --- a/src/extension/internal/emf-print.h +++ b/src/extension/internal/emf-print.h @@ -29,7 +29,7 @@ namespace Internal { class PrintEmf : public PrintMetafile { - uint32_t hbrush, hbrushOld, hpen, hpenOld; + uint32_t hbrush, hbrushOld, hpen; unsigned int print_pathv (Geom::PathVector const &pathv, const Geom::Affine &transform); bool print_simple_shape (Geom::PathVector const &pathv, const Geom::Affine &transform); diff --git a/src/extension/internal/text_reassemble.c b/src/extension/internal/text_reassemble.c index 810e3f8cc..4dfc49420 100644 --- a/src/extension/internal/text_reassemble.c +++ b/src/extension/internal/text_reassemble.c @@ -67,8 +67,8 @@ Optional compiler switches for development: File: text_reassemble.c -Version: 0.0.14 -Date: 25-MAR-2014 +Version: 0.0.15 +Date: 24-JUL-2014 Author: David Mathog, Biology Division, Caltech email: mathog@caltech.edu Copyright: 2014 David Mathog and California Institute of Technology (Caltech) @@ -550,7 +550,7 @@ int TR_check_set_vadvance(TR_INFO *tri, int src, int lines){ See if the line to be added is compatible. All text fields in a complex have the same advance, so just set/check the first one. vadvance must be within 1% or do not add a new line */ - if(fabs(1.0 - (tpi->chunks[trec].vadvance/newV) > 0.01)){ + if(fabs(1.0 - (tpi->chunks[trec].vadvance/newV)) > 0.01){ status = 1; } else { /* recalculate the weighted vadvance */ @@ -1820,7 +1820,9 @@ printf("Face idx:%d bbox: xMax/Min:%ld,%ld yMax/Min:%ld,%ld UpEM:%d asc/des:%d,% fasc = ((double) (fsp->face->ascender) )/64.0; fdsc = ((double) (fsp->face->descender))/64.0; - if(tri->load_flags & FT_LOAD_NO_SCALE) xe *= tsp->fs/32.0; + /* originally the denominator was just 32.0, but it broke when units_per_EM wasn't 2048 */ + double fixscale = tsp->fs/(((double) fsp->face->units_per_EM)/64.0); + if(tri->load_flags & FT_LOAD_NO_SCALE) xe *= fixscale; /* now place the rectangle using ALN information */ if( taln & ALIHORI & ALILEFT ){ @@ -1837,11 +1839,11 @@ printf("Face idx:%d bbox: xMax/Min:%ld,%ld yMax/Min:%ld,%ld UpEM:%d asc/des:%d,% } tpi->chunks[current].ldir = tsp->ldir; - if(tri->load_flags & FT_LOAD_NO_SCALE){ - asc *= tsp->fs/32.0; - dsc *= tsp->fs/32.0; - fasc *= tsp->fs/32.0; - fdsc *= tsp->fs/32.0; + if(tri->load_flags & FT_LOAD_NO_SCALE){ + asc *= fixscale; + dsc *= fixscale; + fasc *= fixscale; + fdsc *= fixscale; } diff --git a/src/extension/internal/wmf-inout.cpp b/src/extension/internal/wmf-inout.cpp index 2b05c6d2c..beb6190d3 100644 --- a/src/extension/internal/wmf-inout.cpp +++ b/src/extension/internal/wmf-inout.cpp @@ -2053,8 +2053,8 @@ std::cout << "BEFORE DRAW" double cx = pix_to_x_point( d, (rc.left + rc.right)/2.0, (rc.bottom + rc.top)/2.0 ); double cy = pix_to_y_point( d, (rc.left + rc.right)/2.0, (rc.bottom + rc.top)/2.0 ); - double rx = pix_to_abs_size( d, fabs(rc.right - rc.left )/2.0 ); - double ry = pix_to_abs_size( d, fabs(rc.top - rc.bottom)/2.0 ); + double rx = pix_to_abs_size( d, std::abs(rc.right - rc.left )/2.0 ); + double ry = pix_to_abs_size( d, std::abs(rc.top - rc.bottom)/2.0 ); SVGOStringStream tmp_ellipse; tmp_ellipse << "cx=\"" << cx << "\" "; diff --git a/src/extension/internal/wmf-print.cpp b/src/extension/internal/wmf-print.cpp index 55ad5da5f..e5ff34009 100644 --- a/src/extension/internal/wmf-print.cpp +++ b/src/extension/internal/wmf-print.cpp @@ -1396,7 +1396,7 @@ unsigned int PrintWmf::text(Inkscape::Extension::Print * /*mod*/, char const *te fix90n = 1; //assume vertical rot = (double)(((int) round(rot)) - irem); rotb = rot * M_PI / 1800.0; - if (abs(rot) == 900.0) { + if (std::abs(rot) == 900.0) { fix90n = 2; } } diff --git a/src/extension/internal/wmf-print.h b/src/extension/internal/wmf-print.h index 1e5d4c323..e4cf19184 100644 --- a/src/extension/internal/wmf-print.h +++ b/src/extension/internal/wmf-print.h @@ -28,7 +28,7 @@ namespace Internal { class PrintWmf : public PrintMetafile { - uint32_t hbrush, hpen, hpenOld, hbrush_null, hpen_null; + uint32_t hbrush, hpen, hbrush_null, hpen_null; uint32_t hmiterlimit; // used to minimize redundant records that set this unsigned int print_pathv (Geom::PathVector const &pathv, const Geom::Affine &transform); diff --git a/src/gradient-chemistry.cpp b/src/gradient-chemistry.cpp index 89b7968fc..27f4d7a98 100644 --- a/src/gradient-chemistry.cpp +++ b/src/gradient-chemistry.cpp @@ -1296,6 +1296,10 @@ Geom::Point getGradientCoords(SPItem *item, GrPointType point_type, guint point_ break; case POINT_LG_MID: { + if (lg->vector.stops.size() < point_i) { + g_message("POINT_LG_MID bug trigger, see LP bug #453067"); + break; + } gdouble offset = lg->vector.stops.at(point_i).offset; p = (1-offset) * Geom::Point(lg->x1.computed, lg->y1.computed) + offset * Geom::Point(lg->x2.computed, lg->y2.computed); } @@ -1321,12 +1325,20 @@ Geom::Point getGradientCoords(SPItem *item, GrPointType point_type, guint point_ break; case POINT_RG_MID1: { + if (rg->vector.stops.size() < point_i) { + g_message("POINT_RG_MID1 bug trigger, see LP bug #453067"); + break; + } gdouble offset = rg->vector.stops.at(point_i).offset; p = (1-offset) * Geom::Point (rg->cx.computed, rg->cy.computed) + offset * Geom::Point(rg->cx.computed + rg->r.computed, rg->cy.computed); } break; case POINT_RG_MID2: { + if (rg->vector.stops.size() < point_i) { + g_message("POINT_RG_MID2 bug trigger, see LP bug #453067"); + break; + } gdouble offset = rg->vector.stops.at(point_i).offset; p = (1-offset) * Geom::Point (rg->cx.computed, rg->cy.computed) + offset * Geom::Point(rg->cx.computed, rg->cy.computed - rg->r.computed); } diff --git a/src/gradient-drag.cpp b/src/gradient-drag.cpp index ee4c1bc8c..a14220cfa 100644 --- a/src/gradient-drag.cpp +++ b/src/gradient-drag.cpp @@ -21,7 +21,6 @@ #include <glibmm/i18n.h> #include <cstring> #include <string> -//#include <2geom/bezier-curve.h> #include "desktop-handles.h" #include "selection.h" @@ -38,6 +37,7 @@ #include "svg/css-ostringstream.h" #include "svg/svg.h" #include "preferences.h" +#include "inkscape.h" #include "sp-item.h" #include "style.h" #include "knot.h" @@ -55,6 +55,7 @@ #include "verbs.h" #include "display/sp-canvas.h" #include "ui/control-manager.h" +#include "ui/tools/tool-base.h" using Inkscape::ControlManager; using Inkscape::CtrlLineType; @@ -783,6 +784,9 @@ static void gr_knot_moved_handler(SPKnot *knot, Geom::Point const &ppointer, gui dragger->parent->draggers = g_list_remove (dragger->parent->draggers, dragger); delete dragger; + // throw out delayed snap context + Inkscape::UI::Tools::sp_event_context_discard_delayed_snap_event(SP_ACTIVE_DESKTOP->event_context); + // update the new merged dragger d_new->fireDraggables(true, false, true); d_new->parent->updateLines(); @@ -790,8 +794,7 @@ static void gr_knot_moved_handler(SPKnot *knot, Geom::Point const &ppointer, gui d_new->updateKnotShape (); d_new->updateTip (); d_new->updateDependencies(true); - DocumentUndo::done(sp_desktop_document (d_new->parent->desktop), SP_VERB_CONTEXT_GRADIENT, - _("Merge gradient handles")); + DocumentUndo::done(sp_desktop_document (d_new->parent->desktop), SP_VERB_CONTEXT_GRADIENT, _("Merge gradient handles")); return; } } diff --git a/src/knot.cpp b/src/knot.cpp index 61d0dff39..2f8f55a2e 100644 --- a/src/knot.cpp +++ b/src/knot.cpp @@ -162,6 +162,9 @@ SPKnot::~SPKnot() { g_free(this->tip); this->tip = NULL; } + + // FIXME: cannot snap to destroyed knot (lp:1309050) + //sp_event_context_discard_delayed_snap_event(this->desktop->event_context); } void SPKnot::startDragging(Geom::Point const &p, gint x, gint y, guint32 etime) { @@ -282,7 +285,7 @@ static int sp_knot_handler(SPCanvasItem */*item*/, GdkEvent *event, SPKnot *knot knot->setFlag(SP_KNOT_DRAGGING, TRUE); } - sp_event_context_snap_delay_handler(knot->desktop->event_context, NULL, (gpointer) knot, (GdkEventMotion *)event, Inkscape::UI::Tools::DelayedSnapEvent::KNOT_HANDLER); + sp_event_context_snap_delay_handler(knot->desktop->event_context, NULL, knot, (GdkEventMotion *)event, Inkscape::UI::Tools::DelayedSnapEvent::KNOT_HANDLER); sp_knot_handler_request_position(event, knot); moved = TRUE; } diff --git a/src/sp-flowregion.cpp b/src/sp-flowregion.cpp index 709e9e464..e8e5c3d95 100644 --- a/src/sp-flowregion.cpp +++ b/src/sp-flowregion.cpp @@ -185,6 +185,8 @@ Inkscape::XML::Node *SPFlowregion::write(Inkscape::XML::Document *xml_doc, Inksc SPItem::write(xml_doc, repr, flags); + this->UpdateComputed(); // copied from update(), see LP Bug 1339305 + return repr; } @@ -372,6 +374,8 @@ static void GetDest(SPObject* child,Shape **computed) tr_mat = SP_ITEM(u_child)->transform; } if ( SP_IS_SHAPE (u_child) ) { + if (!(SP_SHAPE(u_child)->_curve)) + SP_SHAPE (u_child)->set_shape (); curve = SP_SHAPE (u_child)->getCurve (); } else if ( SP_IS_TEXT (u_child) ) { curve = SP_TEXT (u_child)->getNormalizedBpath (); diff --git a/src/sp-flowtext.cpp b/src/sp-flowtext.cpp index b4fd54ee4..59832a2b4 100644 --- a/src/sp-flowtext.cpp +++ b/src/sp-flowtext.cpp @@ -255,6 +255,8 @@ Inkscape::XML::Node* SPFlowtext::write(Inkscape::XML::Document* doc, Inkscape::X } } + this->rebuildLayout(); // copied from update(), see LP Bug 1339305 + SPItem::write(doc, repr, flags); return repr; diff --git a/src/sp-text.cpp b/src/sp-text.cpp index bbc7ec43d..9a7f0b7a0 100644 --- a/src/sp-text.cpp +++ b/src/sp-text.cpp @@ -278,6 +278,7 @@ Inkscape::XML::Node *SPText::write(Inkscape::XML::Document *xml_doc, Inkscape::X } this->attributes.writeTo(repr); + this->rebuildLayout(); // copied from update(), see LP Bug 1339305 // deprecated attribute, but keep it around for backwards compatibility if (this->style->line_height.set && !this->style->line_height.inherit && !this->style->line_height.normal && this->style->line_height.unit == SP_CSS_UNIT_PERCENT) { diff --git a/src/sp-use.cpp b/src/sp-use.cpp index 7d908a66a..e3fcd252a 100644 --- a/src/sp-use.cpp +++ b/src/sp-use.cpp @@ -38,6 +38,8 @@ #include "sp-use.h" #include "sp-use-reference.h" #include "sp-shape.h" +#include "sp-text.h" +#include "sp-flowtext.h" namespace { SPObject* createUse() { @@ -177,8 +179,16 @@ Inkscape::XML::Node* SPUse::write(Inkscape::XML::Document *xml_doc, Inkscape::XM g_free(uri_string); } - if (SP_IS_SHAPE(this->child)) + if (SP_IS_SHAPE(this->child)) { SP_SHAPE(this->child)->set_shape(); // evaluate SPCurve of child + } else if (SP_IS_TEXT(this->child)) { + SP_TEXT(this->child)->rebuildLayout(); // refresh Layout, LP Bug 1339305 + } else if (SP_IS_FLOWTEXT(this->child)) { + if (SP_IS_FLOWREGION(SP_FLOWTEXT(this->child)->firstChild())) + SP_FLOWREGION(SP_FLOWTEXT(this->child)->firstChild())->UpdateComputed(); + SP_FLOWTEXT(this->child)->rebuildLayout(); + } + return repr; } diff --git a/src/style-internal.cpp b/src/style-internal.cpp index 6a56d75c0..ae70fc10d 100644 --- a/src/style-internal.cpp +++ b/src/style-internal.cpp @@ -270,18 +270,18 @@ SPILength::read( gchar const *str ) { } else if (!strcmp(e, "em")) { /* EM square */ unit = SP_CSS_UNIT_EM; - if( style && &style->font_size ) { + if( style ) { computed = value * style->font_size.computed; } else { - computed = value * style->font_size.font_size_default; + computed = value * SPIFontSize::font_size_default; } } else if (!strcmp(e, "ex")) { /* ex square */ unit = SP_CSS_UNIT_EX; - if( style && &style->font_size ) { + if( style ) { computed = value * style->font_size.computed * 0.5; // FIXME } else { - computed = value * style->font_size.font_size_default * 0.5; + computed = value * SPIFontSize::font_size_default * 0.5; } } else if (!strcmp(e, "%")) { /* Percentage */ diff --git a/src/svg/svg-color.cpp b/src/svg/svg-color.cpp index ca94c241f..5108b7702 100644 --- a/src/svg/svg-color.cpp +++ b/src/svg/svg-color.cpp @@ -310,6 +310,59 @@ static guint32 internal_sp_svg_read_color(gchar const *str, gchar const **end_pt *end_ptr = s; } return val; + } else if (strneq(str, "hsl(", 4)) { + + gchar *ptr = (gchar *) str + 4; + + gchar *e; // ptr after read + + double h = g_ascii_strtod(ptr, &e); // Read h (0-360) + if (ptr == e) return def; // Read failed + ptr = e; + + while (*ptr && g_ascii_isspace(*ptr)) ptr += 1; // Remove any white space + if (*ptr != ',') return def; // Need comma + ptr += 1; + while (*ptr && g_ascii_isspace(*ptr)) ptr += 1; // Remove any white space + + double s = g_ascii_strtod(ptr, &e); // Read s (percent) + if (ptr == e) return def; // Read failed + ptr = e; + while (*ptr && g_ascii_isspace(*ptr)) ptr += 1; // Remove any white space + if (*ptr != '%') return def; // Need % + ptr += 1; + + while (*ptr && g_ascii_isspace(*ptr)) ptr += 1; // Remove any white space + if (*ptr != ',') return def; // Need comma + ptr += 1; + while (*ptr && g_ascii_isspace(*ptr)) ptr += 1; // Remove any white space + + double l = g_ascii_strtod(ptr, &e); // Read l (percent) + if (ptr == e) return def; // Read failed + ptr = e; + while (*ptr && g_ascii_isspace(*ptr)) ptr += 1; // Remove any white space + if (*ptr != '%') return def; // Need % + ptr += 1; + + if (end_ptr) { + *end_ptr = ptr; + } + + + // Normalize to 0..1 + h /= 360.0; + s /= 100.0; + l /= 100.0; + + gfloat rgb[3]; + + sp_color_hsl_to_rgb_floatv( rgb, h, s, l ); + + val = static_cast<guint>(floor(CLAMP(rgb[0], 0.0, 1.0) * 255.9999)) << 24; + val |= (static_cast<guint>(floor(CLAMP(rgb[1], 0.0, 1.0) * 255.9999)) << 16); + val |= (static_cast<guint>(floor(CLAMP(rgb[2], 0.0, 1.0) * 255.9999)) << 8); + return val; + } else { gint i; if (colors.empty()) { diff --git a/src/ui/dialog/dialog-manager.cpp b/src/ui/dialog/dialog-manager.cpp index d427e3590..7e69e439a 100644 --- a/src/ui/dialog/dialog-manager.cpp +++ b/src/ui/dialog/dialog-manager.cpp @@ -251,7 +251,7 @@ void DialogManager::showDialog(gchar const *name, bool grabfocus) { /** * Shows the named dialog, creating it if necessary. */ -void DialogManager::showDialog(GQuark name, bool grabfocus) { +void DialogManager::showDialog(GQuark name, bool /*grabfocus*/) { bool wantTiming = Inkscape::Preferences::get()->getBool("/dialogs/debug/trackAppear", false); GTimer *timer = (wantTiming) ? g_timer_new() : 0; // if needed, must be created/started before getDialog() Dialog *dialog = getDialog(name); @@ -262,8 +262,8 @@ void DialogManager::showDialog(GQuark name, bool grabfocus) { tracker->setAutodelete(true); timer = 0; } - if (grabfocus) - dialog->present(); + // should check for grabfocus, but lp:1348927 prevents it + dialog->present(); } if ( timer ) { diff --git a/src/ui/dialog/template-widget.cpp b/src/ui/dialog/template-widget.cpp index ef91962d4..9758b35ac 100644 --- a/src/ui/dialog/template-widget.cpp +++ b/src/ui/dialog/template-widget.cpp @@ -120,7 +120,7 @@ void TemplateWidget::_displayTemplateDetails() if (_current_template.long_description != "") message += _("Description: ") + _current_template.long_description + "\n\n"; - if (~_current_template.keywords.empty()){ + if (!_current_template.keywords.empty()){ message += _("Keywords: "); for (std::set<Glib::ustring>::iterator it = _current_template.keywords.begin(); it != _current_template.keywords.end(); ++it) message += *it + " "; diff --git a/src/ui/tools/pen-tool.cpp b/src/ui/tools/pen-tool.cpp index 70cbcaf0d..649c64034 100644 --- a/src/ui/tools/pen-tool.cpp +++ b/src/ui/tools/pen-tool.cpp @@ -1185,7 +1185,7 @@ void PenTool::_setSubsequentPoint(Geom::Point const p, bool statusbar, guint sta // we are drawing horizontal/vertical lines and hit an anchor; Geom::Point const origin = this->p[0]; // if the previous point and the anchor are not aligned either horizontally or vertically... - if ((abs(p[Geom::X] - origin[Geom::X]) > 1e-9) && (abs(p[Geom::Y] - origin[Geom::Y]) > 1e-9)) { + if ((std::abs(p[Geom::X] - origin[Geom::X]) > 1e-9) && (std::abs(p[Geom::Y] - origin[Geom::Y]) > 1e-9)) { // ...then we should draw an L-shaped path, consisting of two paraxial segments Geom::Point intermed = p; this->_setToNearestHorizVert(intermed, status, false); diff --git a/src/ui/tools/spray-tool.cpp b/src/ui/tools/spray-tool.cpp index 08d3119a1..29f1b9a73 100644 --- a/src/ui/tools/spray-tool.cpp +++ b/src/ui/tools/spray-tool.cpp @@ -677,7 +677,7 @@ bool SprayTool::root_handler(GdkEvent* event) { desktop->setToolboxAdjustmentValue("population", this->population * 100); Geom::Point const scroll_w(event->button.x, event->button.y); Geom::Point const scroll_dt = desktop->point();; - Geom::Point motion_doc(desktop->dt2doc(scroll_dt)); + switch (event->scroll.direction) { case GDK_SCROLL_DOWN: case GDK_SCROLL_UP: { diff --git a/src/ui/tools/tool-base.cpp b/src/ui/tools/tool-base.cpp index 4195c9eb2..f1d90f6c6 100644 --- a/src/ui/tools/tool-base.cpp +++ b/src/ui/tools/tool-base.cpp @@ -1289,8 +1289,7 @@ void sp_event_context_snap_delay_handler(ToolBase *ec, // now, just in case there's no future motion event that drops under the speed limit (when // stopping abruptly) delete ec->_delayed_snap_event; - ec->_delayed_snap_event = new DelayedSnapEvent(ec, dse_item, dse_item2, - event, origin); // watchdog is reset, i.e. pushed forward in time + ec->_delayed_snap_event = new DelayedSnapEvent(ec, dse_item, dse_item2, event, origin); // watchdog is reset, i.e. pushed forward in time // If the watchdog expires before a new motion event is received, we will snap (as explained // above). This means however that when the timer is too short, we will always snap and that the // speed threshold is ineffective. In the extreme case the delay is set to zero, and snapping will @@ -1301,15 +1300,13 @@ void sp_event_context_snap_delay_handler(ToolBase *ec, // snap, and set a new watchdog again. if (ec->_delayed_snap_event == NULL) { // no watchdog has been set // it might have already expired, so we'll set a new one; the snapping frequency will be limited this way - ec->_delayed_snap_event = new DelayedSnapEvent(ec, dse_item, - dse_item2, event, origin); + ec->_delayed_snap_event = new DelayedSnapEvent(ec, dse_item, dse_item2, event, origin); } // else: watchdog has been set before and we'll wait for it to expire } } else { // This is the first GDK_MOTION_NOTIFY event, so postpone snapping and set the watchdog g_assert(ec->_delayed_snap_event == NULL); - ec->_delayed_snap_event = new DelayedSnapEvent(ec, dse_item, dse_item2, - event, origin); + ec->_delayed_snap_event = new DelayedSnapEvent(ec, dse_item, dse_item2, event, origin); } prev_pos = event_pos; diff --git a/src/ui/widget/style-swatch.cpp b/src/ui/widget/style-swatch.cpp index a33c1d09f..98f4e47cd 100644 --- a/src/ui/widget/style-swatch.cpp +++ b/src/ui/widget/style-swatch.cpp @@ -261,7 +261,7 @@ void StyleSwatch::setStyle(SPCSSAttr *css) Glib::ustring css_string; sp_repr_css_write_string (_css, css_string); SPStyle *temp_spstyle = sp_style_new(SP_ACTIVE_DOCUMENT); - if (~css_string.empty()) { + if (!css_string.empty()) { sp_style_merge_from_style_string (temp_spstyle, css_string.c_str()); } diff --git a/src/widgets/ruler.cpp b/src/widgets/ruler.cpp index 5d5151343..8e818843d 100644 --- a/src/widgets/ruler.cpp +++ b/src/widgets/ruler.cpp @@ -1394,7 +1394,7 @@ sp_ruler_draw_ticks (SPRuler *ruler) (label_spacing_px > 6*digit_height || tick_index%2 == 0 || cur == 0) && (label_spacing_px > 3*digit_height || tick_index%4 == 0 || cur == 0)) { - if (fabs((int)cur) >= 2000 && (((int) cur)/1000)*1000 == ((int) cur)) + if (std::abs((int)cur) >= 2000 && (((int) cur)/1000)*1000 == ((int) cur)) sprintf (unit_str, "%dk", ((int) cur)/1000); else sprintf (unit_str, "%d", (int) cur); |
