summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorJabier Arraiza Cenoz <jabier.arraiza@marker.es>2013-04-26 16:55:14 +0000
committerJabiertxo Arraiza Zenotz <jtx@jtx.marker.es>2013-04-26 16:55:14 +0000
commitdccca32d43a1ec37bf8ca643c4672a377ec1dfe9 (patch)
treeddc43e8c99f1bfe83175064ba2c3608a686b465c /src
parentupdating to previous po (diff)
parenttranslation typo (diff)
downloadinkscape-dccca32d43a1ec37bf8ca643c4672a377ec1dfe9.tar.gz
inkscape-dccca32d43a1ec37bf8ca643c4672a377ec1dfe9.zip
update to trunk
(bzr r11950.1.107)
Diffstat (limited to 'src')
-rw-r--r--src/color-profile.cpp6
-rw-r--r--src/color.cpp4
-rw-r--r--src/dom/util/ziptool.cpp26
-rw-r--r--src/extension/internal/odf.cpp69
-rw-r--r--src/extension/internal/odf.h2
-rw-r--r--src/selection-chemistry.cpp79
-rw-r--r--src/selection-chemistry.h3
-rw-r--r--src/snapped-point.cpp163
-rw-r--r--src/sp-use.cpp13
-rw-r--r--src/style.cpp2
-rw-r--r--src/style.h6
-rw-r--r--src/ui/clipboard.cpp12
-rw-r--r--src/ui/dialog/symbols.cpp81
-rw-r--r--src/ui/dialog/symbols.h8
-rw-r--r--src/ui/dialog/xml-tree.cpp1
-rw-r--r--src/ui/previewholder.cpp2
-rw-r--r--src/verbs.cpp2
-rw-r--r--src/widgets/desktop-widget.cpp20
-rw-r--r--src/widgets/widget-sizes.h2
-rw-r--r--src/xml/repr-util.cpp2
20 files changed, 268 insertions, 235 deletions
diff --git a/src/color-profile.cpp b/src/color-profile.cpp
index 14f88c77e..5fb84d8ac 100644
--- a/src/color-profile.cpp
+++ b/src/color-profile.cpp
@@ -619,8 +619,6 @@ cmsHTRANSFORM ColorProfile::getTransfGamutCheck()
bool ColorProfile::GamutCheck(SPColor color)
{
- bool result = false;
-
guint32 val = color.toRGBA32(0);
#if HAVE_LIBLCMS1
@@ -651,9 +649,7 @@ bool ColorProfile::GamutCheck(SPColor color)
cmsSetAlarmCodes(oldAlarmCodes);
#endif // HAVE_LIBLCMS1
- result = (outofgamut != 0);
-
- return result;
+ return (outofgamut != 0);
}
class ProfileInfo
diff --git a/src/color.cpp b/src/color.cpp
index 0a07d3f21..5eb0d91ef 100644
--- a/src/color.cpp
+++ b/src/color.cpp
@@ -99,9 +99,7 @@ bool SPColor::operator == (SPColor const& other) const
*/
bool SPColor::isClose( SPColor const& other, float epsilon ) const
{
- bool match = false;
-
- match = (fabs((v.c[0]) - (other.v.c[0])) < epsilon)
+ bool match = (fabs((v.c[0]) - (other.v.c[0])) < epsilon)
&& (fabs((v.c[1]) - (other.v.c[1])) < epsilon)
&& (fabs((v.c[2]) - (other.v.c[2])) < epsilon);
diff --git a/src/dom/util/ziptool.cpp b/src/dom/util/ziptool.cpp
index 9d9d5685c..cf024008f 100644
--- a/src/dom/util/ziptool.cpp
+++ b/src/dom/util/ziptool.cpp
@@ -1895,24 +1895,30 @@ bool GzipFile::readFile(const std::string &fileName)
/**
* Constructor
*/
-ZipEntry::ZipEntry()
+ZipEntry::ZipEntry() :
+ crc (0L),
+ fileName (),
+ comment (),
+ compressionMethod (8),
+ compressedData (),
+ uncompressedData (),
+ position (0)
{
- crc = 0L;
- compressionMethod = 8;
- position = 0;
}
/**
*
*/
ZipEntry::ZipEntry(const std::string &fileNameArg,
- const std::string &commentArg)
+ const std::string &commentArg) :
+ crc (0L),
+ fileName (fileNameArg),
+ comment (commentArg),
+ compressionMethod (8),
+ compressedData (),
+ uncompressedData (),
+ position (0)
{
- crc = 0L;
- compressionMethod = 8;
- fileName = fileNameArg;
- comment = commentArg;
- position = 0;
}
/**
diff --git a/src/extension/internal/odf.cpp b/src/extension/internal/odf.cpp
index 70798099d..b23378fc3 100644
--- a/src/extension/internal/odf.cpp
+++ b/src/extension/internal/odf.cpp
@@ -47,7 +47,7 @@
#include <stdio.h>
#include <time.h>
#include <vector>
-
+#include <math.h>
//# Inkscape includes
#include "clear-n_.h"
@@ -1315,8 +1315,9 @@ writePath(Writer &outs, Geom::PathVector const &pathv,
return nrPoints;
}
-bool OdfOutput::processStyle(Writer &outs, SPItem *item, const Glib::ustring &id, const Glib::ustring &gradientNameFill, const Glib::ustring &gradientNameStroke)
+bool OdfOutput::processStyle(SPItem *item, const Glib::ustring &id, const Glib::ustring &gradientNameFill, const Glib::ustring &gradientNameStroke, Glib::ustring& output)
{
+ output.clear();
if (!item)
{
return false;
@@ -1408,37 +1409,34 @@ bool OdfOutput::processStyle(Writer &outs, SPItem *item, const Glib::ustring &id
styleTable.push_back(si);
styleLookupTable[id] = styleName;
- Glib::ustring tmpstring = Glib::ustring::compose ("<style:style style:name=\"%1\" style:family=\"graphic\" style:parent-style-name=\"standard\">\n", si.name);
- tmpstring += "<style:graphic-properties";
+ output = Glib::ustring::compose ("<style:style style:name=\"%1\" style:family=\"graphic\" style:parent-style-name=\"standard\">\n", si.name);
+ output += "<style:graphic-properties";
if (si.fill == "gradient")
{
- tmpstring += Glib::ustring::compose (" draw:fill=\"gradient\" draw:fill-gradient-name=\"%1\"", gradientNameFill);
+ output += Glib::ustring::compose (" draw:fill=\"gradient\" draw:fill-gradient-name=\"%1\"", gradientNameFill);
}
else
{
- tmpstring += Glib::ustring(" draw:fill=\"") + si.fill + "\"";
+ output += Glib::ustring(" draw:fill=\"") + si.fill + "\"";
if(si.fill != "none")
{
- // tmpstring += Glib::ustring::compose(" draw:fill-color=\"%1\" draw:fill-opacity=\"%2\"", si.fillColor, si.fillOpacity);
- tmpstring += Glib::ustring::compose(" draw:fill-color=\"%1\"", si.fillColor);
+ output += Glib::ustring::compose(" draw:fill-color=\"%1\"", si.fillColor);
}
}
if (si.stroke == "gradient")
{
//does not seem to be supported by Open Office.org
- tmpstring += Glib::ustring::compose (" draw:stroke=\"gradient\" draw:stroke-gradient-name=\"%1\"", gradientNameStroke);
+ output += Glib::ustring::compose (" draw:stroke=\"gradient\" draw:stroke-gradient-name=\"%1\"", gradientNameStroke);
}
else
{
- tmpstring += Glib::ustring(" draw:stroke=\"") + si.stroke + "\"";
+ output += Glib::ustring(" draw:stroke=\"") + si.stroke + "\"";
if (si.stroke != "none")
{
- tmpstring += Glib::ustring::compose (" svg:stroke-width=\"%1\" svg:stroke-color=\"%2\" ", si.strokeWidth, si.strokeColor);
- // tmpstring += Glib::ustring::compose (" svg:stroke-width=\"%1\" svg:stroke-color=\"%2\" draw:stroke-opacity=\"%3\" ", si.strokeWidth, si.strokeColor, si.strokeOpacity);
+ output += Glib::ustring::compose (" svg:stroke-width=\"%1\" svg:stroke-color=\"%2\" ", si.strokeWidth, si.strokeColor);
}
}
- tmpstring += "/>\n</style:style>\n";
- outs.writeUString (tmpstring);
+ output += "/>\n</style:style>\n";
return true;
}
@@ -1483,6 +1481,7 @@ bool OdfOutput::processGradient(SPItem *item,
gi.stops.push_back(gs);
}
+ Glib::ustring gradientName2;
if (SP_IS_LINEARGRADIENT(gradient))
{
gi.style = "linear";
@@ -1491,16 +1490,16 @@ bool OdfOutput::processGradient(SPItem *item,
gi.y1 = linGrad->y1.value;
gi.x2 = linGrad->x2.value;
gi.y2 = linGrad->y2.value;
+ gradientName2 = Glib::ustring::compose("ImportedLinearGradient%1", gradientTable.size());
}
else if (SP_IS_RADIALGRADIENT(gradient))
{
gi.style = "radial";
SPRadialGradient *radGrad = SP_RADIALGRADIENT(gradient);
- SPRadialGradient tmpGrad = *radGrad;
- tmpGrad.cx.unit= SVGLength::PERCENT;
- tmpGrad.cy.unit= SVGLength::PERCENT;
- gi.cx = tmpGrad.cx.computed;// * 100.0;//ODG cx is percentages
- gi.cy = tmpGrad.cy.computed;// * 100.0;
+ Geom::OptRect bbox = item->documentVisualBounds();
+ gi.cx = (radGrad->cx.value-bbox->left())/bbox->width();
+ gi.cy = (radGrad->cy.value-bbox->top())/bbox->height();
+ gradientName2 = Glib::ustring::compose("ImportedRadialGradient%1", gradientTable.size());
}
else
{
@@ -1529,7 +1528,7 @@ bool OdfOutput::processGradient(SPItem *item,
}
// No match, let us write a new entry
- gradientName = Glib::ustring::compose("gradient%1", gradientTable.size());
+ gradientName = gradientName2;
gi.name = gradientName;
gradientTable.push_back(gi);
gradientLookupTable[id] = gradientName;
@@ -1555,12 +1554,17 @@ bool OdfOutput::processGradient(SPItem *item,
return false;
}
output += Glib::ustring::compose("<draw:gradient draw:name=\"%1\"", gi.name);
- output += Glib::ustring::compose(" draw:display-name=\"imported linear %1\"", gradientCount);
+ output += Glib::ustring::compose(" draw:display-name=\"%1\"", gi.name);
output += " draw:style=\"linear\"";
snprintf(buf, 127, " draw:start-color=\"#%06lx\" draw:end-color=\"#%06lx\"", gi.stops[0].rgb, gi.stops[1].rgb);
output += buf;
- output += Glib::ustring::compose(" draw:start-intensity=\"%1\" draw:end-intensity=\"%2\" draw:angle=\"0\"/>\n",
- gi.stops[0].opacity * 100.0, gi.stops[1].opacity * 100.0);// draw:border=\"0%%\"
+ //TODO: apply maths, to define begin of gradient, taking gradient begin and end, as well as object boundary into account
+ double angle = (gi.y2-gi.y1);
+ angle = (angle != 0.) ? (atan((gi.x2-gi.x1)/(gi.y2-gi.y1))* 180. / pi) : 90;
+ angle = (angle < 0)?(180+angle):angle;
+ angle = angle * 10; //why do we need this: precision?????????????
+ output += Glib::ustring::compose(" draw:start-intensity=\"%1\" draw:end-intensity=\"%2\" draw:angle=\"%3\"/>\n",
+ gi.stops[0].opacity * 100.0, gi.stops[1].opacity * 100.0, angle);// draw:border=\"0%%\"
}
else if (gi.style == "radial")
{
@@ -1581,8 +1585,8 @@ bool OdfOutput::processGradient(SPItem *item,
g_warning("Need at least 2 stops for a radial gradient");
return false;
}
- output += Glib::ustring::compose("<draw:gradient draw:name=\"%1\" draw:display-name=\"imported radial %2\" ", gi.name, gradientCount);
- snprintf(buf, 127, "draw:cx=\"%05.3f\" draw:cy=\"%05.3f\" ", gi.cx, gi.cy);
+ output += Glib::ustring::compose("<draw:gradient draw:name=\"%1\" draw:display-name=\"%1\" ", gi.name);
+ snprintf(buf, 127, "draw:cx=\"%05.3f\" draw:cy=\"%05.3f\" ", gi.cx*100, gi.cy*100);
output += Glib::ustring("draw:style=\"radial\" ") + buf;
snprintf(buf, 127, "draw:start-color=\"#%06lx\" draw:end-color=\"#%06lx\" ", gi.stops[0].rgb, gi.stops[1].rgb);
output += buf;
@@ -1689,6 +1693,7 @@ bool OdfOutput::writeTree(Writer &couts, Writer &souts,
Glib::ustring gradientNameStroke;
Glib::ustring outputFill;
Glib::ustring outputStroke;
+ Glib::ustring outputStyle;
processGradient(item, id, tf, gradientNameFill, outputFill, 1);
processGradient(item, id, tf, gradientNameStroke, outputStroke, 0);
@@ -1696,8 +1701,8 @@ bool OdfOutput::writeTree(Writer &couts, Writer &souts,
souts.writeUString(outputStroke);
//# STYLE
- processStyle(souts, item, id, gradientNameFill, gradientNameStroke);
-
+ processStyle(item, id, gradientNameFill, gradientNameStroke, outputStyle);
+ souts.writeUString(outputStyle);
//# ITEM DATA
if (nodeName == "image" || nodeName == "svg:image")
@@ -1787,16 +1792,6 @@ bool OdfOutput::writeTree(Writer &couts, Writer &souts,
Glib::ustring styleName = siter->second;
couts.printf("draw:style-name=\"%s\" ", styleName.c_str());
}
- // couts.writeUString(styleString);
-
- // std::map<Glib::ustring, Glib::ustring>::iterator giter;
- // giter = gradientLookupTable.find(id);
- // if (giter != gradientLookupTable.end())
- // {
- // Glib::ustring gradientName = giter->second;
- // couts.printf("draw:fill-gradient-name=\"%s\" ",
- // gradientName.c_str());
- // }
couts.printf("draw:layer=\"layout\" svg:x=\"%.3fcm\" svg:y=\"%.3fcm\" ",
bbox_x, bbox_y);
diff --git a/src/extension/internal/odf.h b/src/extension/internal/odf.h
index 7dfbf9786..6b915e347 100644
--- a/src/extension/internal/odf.h
+++ b/src/extension/internal/odf.h
@@ -313,7 +313,7 @@ private:
bool writeStyle(ZipFile &zf);
- bool processStyle(Writer &outs, SPItem *item, const Glib::ustring &id, const Glib::ustring &gradientNameFill, const Glib::ustring &gradientNameStroke);
+ bool processStyle(SPItem *item, const Glib::ustring &id, const Glib::ustring &gradientNameFill, const Glib::ustring &gradientNameStroke, Glib::ustring& output);
bool processGradient(SPItem *item,
const Glib::ustring &id, Geom::Affine &tf, Glib::ustring& gradientName, Glib::ustring& output, bool checkFillGradient = 1);
diff --git a/src/selection-chemistry.cpp b/src/selection-chemistry.cpp
index 41ebc9bfc..beafc59a5 100644
--- a/src/selection-chemistry.cpp
+++ b/src/selection-chemistry.cpp
@@ -360,6 +360,7 @@ void sp_selection_delete(SPDesktop *desktop)
selection->clear();
sp_selection_delete_impl(selected);
g_slist_free(const_cast<GSList *>(selected));
+ reinterpret_cast<SPObject *>(desktop->currentLayer())->requestDisplayUpdate(SP_OBJECT_MODIFIED_FLAG);
/* a tool may have set up private information in it's selection context
* that depends on desktop items. I think the only sane way to deal with
@@ -2891,45 +2892,52 @@ void sp_selection_to_guides(SPDesktop *desktop)
/*
* Convert <g> to <symbol>, leaving all <use> elements referencing group unchanged.
*/
-void sp_selection_symbol(SPDesktop *desktop, bool /*apply*/ )
+void sp_selection_symbols(SPDesktop *desktop, bool /*apply*/ )
{
-
if (desktop == NULL) {
return;
}
SPDocument *doc = sp_desktop_document(desktop);
- Inkscape::XML::Document *xml_doc = doc->getReprDoc();
+ doc->ensureUpToDate();
Inkscape::Selection *selection = sp_desktop_selection(desktop);
// Check if something is selected.
if (selection->isEmpty()) {
- desktop->messageStack()->flash(Inkscape::WARNING_MESSAGE, _("Select one <b>group</b> to convert to symbol."));
- return;
+ desktop->messageStack()->flash(Inkscape::WARNING_MESSAGE, _("Select <b>groups</b> to convert to symbols."));
+ return;
}
- SPObject* group = selection->single();
+ GSList *items = g_slist_copy(const_cast<GSList *>(selection->list()));
+ bool hasWorked = false;
- // Make sure we have only one object in selection.
- if( group == NULL ) {
- desktop->messageStack()->flash(Inkscape::WARNING_MESSAGE, _("Select only one <b>group</b> to convert to symbol."));
- return;
- }
+ for ( GSList const *iter=items; iter != NULL ; iter = iter->next ) {
+ SPObject *object = reinterpret_cast<SPObject *>( iter->data );
- // Make sure we convert the original.
- if( SP_IS_USE( group ) ) {
- desktop->messageStack()->flash(Inkscape::WARNING_MESSAGE, _("Select original (<b>Shift+D</b>) to convert to symbol."));
- return;
+ // Require that we really have a group.
+ if( SP_IS_GROUP( object ) ) {
+ sp_selection_symbol( doc, object );
+ hasWorked = true;
+ }
}
- // Require that we really have a group.
- if( !SP_IS_GROUP( group ) ) {
- desktop->messageStack()->flash(Inkscape::WARNING_MESSAGE, _("Group selection first to convert to symbol."));
- return;
+ g_slist_free(items);
+
+ if( !hasWorked ) {
+ desktop->messageStack()->flash(Inkscape::WARNING_MESSAGE, _("No <b>groups</b> converted to symbols."));
+ return;
}
- doc->ensureUpToDate();
+ selection->clear();
+ // Group just disappears, nothing to select.
+
+ DocumentUndo::done(doc, SP_VERB_EDIT_SYMBOL, _("Group to symbol"));
+}
+
+void sp_selection_symbol(SPDocument *doc, SPObject *group)
+{
+ Inkscape::XML::Document *xml_doc = doc->getReprDoc();
Inkscape::XML::Node *symbol = xml_doc->createElement("svg:symbol");
symbol->setAttribute("style", group->getAttribute("style"));
@@ -2951,20 +2959,25 @@ void sp_selection_symbol(SPDesktop *desktop, bool /*apply*/ )
// Need to delete <g>; all <use> elements that referenced <g> should
// auto-magically reference <symbol>.
doc->getDefs()->getRepr()->appendChild(symbol);
- symbol->setAttribute("id",id.c_str()); // After we delete group with same id.
- // Mysterious, must set symbol ID before deleting group or all <use>
- // refering to symbol get turned into groups. (Linked to unlinking clones?)
- group->deleteObject(true);
+ // Mysterious, must set symbol ID before deleting group or all <use> items
+ // get turned into groups. (Linked to unlinking clones?)
+ symbol->setAttribute("id",id.c_str());
- Inkscape::GC::release(symbol);
- selection->clear();
- // Group just disappears, nothing to select.
+ // Create a clone of the symbol to replace the deleted group.
+ Inkscape::XML::Node *clone = xml_doc->createElement("svg:use");
+ clone->setAttribute("x", "0", false);
+ clone->setAttribute("y", "0", false);
+ clone->setAttribute("xlink:href", g_strdup_printf("#%s", id.c_str()), false);
- // Need to signal Symbol dialog to update
+ clone->setAttribute("inkscape:transform-center-x", group->getAttribute("inkscape:transform-center-x"), false);
+ clone->setAttribute("inkscape:transform-center-y", group->getAttribute("inkscape:transform-center-y"), false);
+ group->parent->getRepr()->appendChild(clone);
+
+ group->deleteObject(true);
g_slist_free(children);
- DocumentUndo::done(doc, SP_VERB_EDIT_SYMBOL, _("Group to symbol"));
+ Inkscape::GC::release(symbol);
}
/*
@@ -2972,7 +2985,6 @@ void sp_selection_symbol(SPDesktop *desktop, bool /*apply*/ )
*/
void sp_selection_unsymbol(SPDesktop *desktop)
{
-
if (desktop == NULL) {
return;
}
@@ -2991,13 +3003,8 @@ void sp_selection_unsymbol(SPDesktop *desktop)
SPObject* use = selection->single();
// Make sure we have only one object in selection.
- if( use == NULL ) {
- desktop->messageStack()->flash(Inkscape::WARNING_MESSAGE, _("Select only one <b>symbol</b> to convert to group."));
- return;
- }
-
// Require that we really have a <use> that references a <symbol>.
- if( !SP_IS_USE( use ) && !SP_IS_SYMBOL( use->firstChild() ) ) {
+ if( use == NULL || ( !SP_IS_USE( use ) && !SP_IS_SYMBOL( use->firstChild() ))) {
desktop->messageStack()->flash(Inkscape::WARNING_MESSAGE, _("Select only one <b>symbol</b> to convert to group."));
return;
}
diff --git a/src/selection-chemistry.h b/src/selection-chemistry.h
index 83dd93bdd..1c627fd1a 100644
--- a/src/selection-chemistry.h
+++ b/src/selection-chemistry.h
@@ -68,7 +68,8 @@ void sp_selection_clone_original_path_lpe(SPDesktop *desktop);
void sp_selection_to_marker(SPDesktop *desktop, bool apply = true);
void sp_selection_to_guides(SPDesktop *desktop);
-void sp_selection_symbol(SPDesktop *desktop, bool apply = true);
+void sp_selection_symbols(SPDesktop *desktop, bool apply = true);
+void sp_selection_symbol(SPDocument *doc, SPObject *group);
void sp_selection_unsymbol(SPDesktop *desktop);
void sp_selection_tile(SPDesktop *desktop, bool apply = true);
diff --git a/src/snapped-point.cpp b/src/snapped-point.cpp
index d155babd7..ab545bd5f 100644
--- a/src/snapped-point.cpp
+++ b/src/snapped-point.cpp
@@ -14,92 +14,111 @@
#include "preferences.h"
// overloaded constructor
-Inkscape::SnappedPoint::SnappedPoint(Geom::Point const &p, SnapSourceType const &source, long source_num, SnapTargetType const &target, Geom::Coord const &d, Geom::Coord const &t, bool const &a, bool const &constrained_snap, bool const &fully_constrained, Geom::OptRect target_bbox)
- : _point(p), _source(source), _source_num(source_num), _target(target), _distance(d), _tolerance(std::max(t,1.0)), _always_snap(a), _target_bbox(target_bbox)
+Inkscape::SnappedPoint::SnappedPoint(Geom::Point const &p, SnapSourceType const &source, long source_num, SnapTargetType const &target, Geom::Coord const &d, Geom::Coord const &t, bool const &a, bool const &constrained_snap, bool const &fully_constrained, Geom::OptRect target_bbox) :
+ _point(p),
+ _tangent(Geom::Point(0,0)),
+ _source(source),
+ _source_num(source_num),
+ _target(target),
+ _at_intersection (false),
+ _constrained_snap (constrained_snap),
+ _fully_constrained (fully_constrained),
+ _distance(d),
+ _tolerance(std::max(t,1.0)),// tolerance should never be smaller than 1 px, as it is used for normalization in isOtherSnapBetter. We don't want a division by zero.
+ _always_snap(a),
+ _second_distance (Geom::infinity()),
+ _second_tolerance (1),
+ _second_always_snap (false),
+ _transformation (Geom::Point(1,1)),
+ _target_bbox(target_bbox),
+ _pointer_distance (Geom::infinity())
{
- // tolerance should never be smaller than 1 px, as it is used for normalization in isOtherSnapBetter. We don't want a division by zero.
- _at_intersection = false;
- _constrained_snap = constrained_snap;
- _fully_constrained = fully_constrained;
- _second_distance = Geom::infinity();
- _second_tolerance = 1;
- _second_always_snap = false;
- _transformation = Geom::Point(1,1);
- _tangent = Geom::Point(0,0);
- _pointer_distance = Geom::infinity();
}
-Inkscape::SnappedPoint::SnappedPoint(Inkscape::SnapCandidatePoint const &p, SnapTargetType const &target, Geom::Coord const &d, Geom::Coord const &t, bool const &a, bool const &constrained_snap, bool const &fully_constrained)
- : _target(target), _distance(d), _tolerance(std::max(t,1.0)), _always_snap(a)
+Inkscape::SnappedPoint::SnappedPoint(Inkscape::SnapCandidatePoint const &p, SnapTargetType const &target, Geom::Coord const &d, Geom::Coord const &t, bool const &a, bool const &constrained_snap, bool const &fully_constrained) :
+ _point (p.getPoint()),
+ _tangent (Geom::Point(0,0)),
+ _source (p.getSourceType()),
+ _source_num (p.getSourceNum()),
+ _target(target),
+ _at_intersection (false),
+ _constrained_snap (constrained_snap),
+ _fully_constrained (fully_constrained),
+ _distance(d),
+ _tolerance(std::max(t,1.0)),
+ _always_snap(a),
+ _second_distance (Geom::infinity()),
+ _second_tolerance (1),
+ _second_always_snap (false),
+ _transformation (Geom::Point(1,1)),
+ _target_bbox (p.getTargetBBox()),
+ _pointer_distance (Geom::infinity())
{
- _point = p.getPoint();
- _source = p.getSourceType();
- _source_num = p.getSourceNum();
- _at_intersection = false;
- _constrained_snap = constrained_snap;
- _fully_constrained = fully_constrained;
- _second_distance = Geom::infinity();
- _second_tolerance = 1;
- _second_always_snap = false;
- _transformation = Geom::Point(1,1);
- _tangent = Geom::Point(0,0);
- _pointer_distance = Geom::infinity();
- _target_bbox = p.getTargetBBox();
-
}
-Inkscape::SnappedPoint::SnappedPoint(Geom::Point const &p, SnapSourceType const &source, long source_num, SnapTargetType const &target, Geom::Coord const &d, Geom::Coord const &t, bool const &a, bool const &at_intersection, bool const &constrained_snap, bool const &fully_constrained, Geom::Coord const &d2, Geom::Coord const &t2, bool const &a2)
- : _point(p), _source(source), _source_num(source_num), _target(target), _at_intersection(at_intersection), _constrained_snap(constrained_snap), _fully_constrained(fully_constrained), _distance(d), _tolerance(std::max(t,1.0)), _always_snap(a),
- _second_distance(d2), _second_tolerance(std::max(t2,1.0)), _second_always_snap(a2)
-{
+Inkscape::SnappedPoint::SnappedPoint(Geom::Point const &p, SnapSourceType const &source, long source_num, SnapTargetType const &target, Geom::Coord const &d, Geom::Coord const &t, bool const &a, bool const &at_intersection, bool const &constrained_snap, bool const &fully_constrained, Geom::Coord const &d2, Geom::Coord const &t2, bool const &a2) :
+ _point(p),
+ _tangent (Geom::Point(0,0)),
+ _source(source),
+ _source_num(source_num),
+ _target(target),
+ _at_intersection(at_intersection),
+ _constrained_snap(constrained_snap),
+ _fully_constrained(fully_constrained),
+ _distance(d),
+ _tolerance(std::max(t,1.0)),
+ _always_snap(a),
+ _second_distance(d2),
+ _second_tolerance(std::max(t2,1.0)),
+ _second_always_snap(a2),
// tolerance should never be smaller than 1 px, as it is used for normalization in
// isOtherSnapBetter. We don't want a division by zero.
- _transformation = Geom::Point(1,1);
- _tangent = Geom::Point(0,0);
- _pointer_distance = Geom::infinity();
- _target_bbox = Geom::OptRect();
+ _transformation (Geom::Point(1,1)),
+ _target_bbox (Geom::OptRect()),
+ _pointer_distance (Geom::infinity())
+{
}
-Inkscape::SnappedPoint::SnappedPoint()
+Inkscape::SnappedPoint::SnappedPoint():
+ _point (Geom::Point(0,0)),
+ _tangent (Geom::Point(0,0)),
+ _source (SNAPSOURCE_UNDEFINED),
+ _source_num (-1),
+ _target (SNAPTARGET_UNDEFINED),
+ _at_intersection (false),
+ _constrained_snap (false),
+ _fully_constrained (false),
+ _distance (Geom::infinity()),
+ _tolerance (1),
+ _always_snap (false),
+ _second_distance (Geom::infinity()),
+ _second_tolerance (1),
+ _second_always_snap (false),
+ _transformation (Geom::Point(1,1)),
+ _target_bbox (Geom::OptRect()),
+ _pointer_distance (Geom::infinity())
{
- _point = Geom::Point(0,0);
- _source = SNAPSOURCE_UNDEFINED,
- _source_num = -1,
- _target = SNAPTARGET_UNDEFINED,
- _at_intersection = false;
- _constrained_snap = false;
- _fully_constrained = false;
- _distance = Geom::infinity();
- _tolerance = 1;
- _always_snap = false;
- _second_distance = Geom::infinity();
- _second_tolerance = 1;
- _second_always_snap = false;
- _transformation = Geom::Point(1,1);
- _tangent = Geom::Point(0,0);
- _pointer_distance = Geom::infinity();
- _target_bbox = Geom::OptRect();
}
-Inkscape::SnappedPoint::SnappedPoint(Geom::Point const &p)
+Inkscape::SnappedPoint::SnappedPoint(Geom::Point const &p):
+ _point (p),
+ _tangent (Geom::Point(0,0)),
+ _source (SNAPSOURCE_UNDEFINED),
+ _source_num (-1),
+ _target (SNAPTARGET_UNDEFINED),
+ _at_intersection (false),
+ _constrained_snap (false),
+ _fully_constrained (false),
+ _distance (Geom::infinity()),
+ _tolerance (1),
+ _always_snap (false),
+ _second_distance (Geom::infinity()),
+ _second_tolerance (1),
+ _second_always_snap (false),
+ _transformation (Geom::Point(1,1)),
+ _target_bbox (Geom::OptRect()),
+ _pointer_distance (Geom::infinity())
{
- _point = p;
- _source = SNAPSOURCE_UNDEFINED,
- _source_num = -1,
- _target = SNAPTARGET_UNDEFINED,
- _at_intersection = false;
- _constrained_snap = false;
- _fully_constrained = false;
- _distance = Geom::infinity();
- _tolerance = 1;
- _always_snap = false;
- _second_distance = Geom::infinity();
- _second_tolerance = 1;
- _second_always_snap = false;
- _transformation = Geom::Point(1,1);
- _tangent = Geom::Point(0,0);
- _pointer_distance = Geom::infinity();
- _target_bbox = Geom::OptRect();
}
Inkscape::SnappedPoint::~SnappedPoint()
diff --git a/src/sp-use.cpp b/src/sp-use.cpp
index d5b3c004a..2220b4b47 100644
--- a/src/sp-use.cpp
+++ b/src/sp-use.cpp
@@ -30,6 +30,7 @@
#include "uri.h"
#include "print.h"
#include "xml/repr.h"
+#include "svg/svg.h"
#include "preferences.h"
#include "style.h"
#include "sp-symbol.h"
@@ -238,8 +239,9 @@ sp_use_write(SPObject *object, Inkscape::XML::Document *xml_doc, Inkscape::XML::
sp_repr_set_svg_double(repr, "x", use->x.computed);
sp_repr_set_svg_double(repr, "y", use->y.computed);
- sp_repr_set_svg_double(repr, "width", use->width.computed);
- sp_repr_set_svg_double(repr, "height", use->height.computed);
+
+ repr->setAttribute("width", sp_svg_length_write_with_units(use->width).c_str());
+ repr->setAttribute("height", sp_svg_length_write_with_units(use->height).c_str());
if (use->ref->getURI()) {
gchar *uri_string = use->ref->getURI()->toString();
@@ -297,10 +299,9 @@ sp_use_description(SPItem *item)
if (use->child) {
if( SP_IS_SYMBOL( use->child ) ) {
- //char *symbol_desc = SP_ITEM(use->child)->description();
- //g_free(symbol_desc);
- return g_strdup(_("<b>Clone of Symbol</b>"));
- //return g_strdup_printf(_("<b>Clone of Symbol</b>: %s"), symbol_desc );
+ char *symbol_desc = SP_ITEM(use->child)->title();
+ return g_strdup_printf(_("<b>'%s' Symbol</b>"), symbol_desc );
+ g_free(symbol_desc);
}
static unsigned recursion_depth = 0;
diff --git a/src/style.cpp b/src/style.cpp
index ca89e6f65..479f30597 100644
--- a/src/style.cpp
+++ b/src/style.cpp
@@ -4358,7 +4358,7 @@ sp_style_write_ifilter(gchar *p, gint const len, gchar const *key,
}
SPIPaint::SPIPaint() :
- set(0),
+ set(false),
inherit(0),
currentcolor(0),
colorSet(0),
diff --git a/src/style.h b/src/style.h
index 534a6ae70..2b98c9e5d 100644
--- a/src/style.h
+++ b/src/style.h
@@ -136,9 +136,9 @@ struct SPILength {
/// Paint type internal to SPStyle.
struct SPIPaint {
- unsigned set : 1;
- unsigned inherit : 1;
- unsigned currentcolor : 1;
+ unsigned int set : 1; //c++ bitfields are used here as opposed to bools to reduce memory consumption, see http://tinyurl.com/cswh6mq
+ unsigned int inherit : 1;
+ unsigned int currentcolor : 1;
unsigned int colorSet : 1;
unsigned int noneSet : 1;
struct {
diff --git a/src/ui/clipboard.cpp b/src/ui/clipboard.cpp
index f2b9fb02a..72ddd90a9 100644
--- a/src/ui/clipboard.cpp
+++ b/src/ui/clipboard.cpp
@@ -332,6 +332,10 @@ void ClipboardManagerImpl::copySymbol(Inkscape::XML::Node* symbol, gchar const*
use->setAttribute("style", style );
_root->appendChild(use);
+ // This min and max sets offsets, we don't have any so set to zero.
+ sp_repr_set_point(_clipnode, "min", Geom::Point(0,0));
+ sp_repr_set_point(_clipnode, "max", Geom::Point(0,0));
+
fit_canvas_to_drawing(_clipboardSPDoc);
_setClipboardTargets();
}
@@ -767,14 +771,6 @@ void ClipboardManagerImpl::_copyUsedDefs(SPItem *item)
}
}
- // Copy symbols: We may want to be more clever...
- // if (SP_IS_USE(item)) {
- // SPObject *symbol = SP_USE(item)->child;
- // if( symbol && SP_IS_SYMBOL(symbol) ) {
- // _copyNode(symbol->getRepr(), _doc, _defs);
- // }
- // }
-
// recurse
for (SPObject *o = item->children ; o != NULL ; o = o->next) {
if (SP_IS_ITEM(o)) {
diff --git a/src/ui/dialog/symbols.cpp b/src/ui/dialog/symbols.cpp
index 4eeb1b5f0..989375bbd 100644
--- a/src/ui/dialog/symbols.cpp
+++ b/src/ui/dialog/symbols.cpp
@@ -49,6 +49,7 @@
#include "inkscape.h"
#include "sp-root.h"
#include "sp-use.h"
+#include "sp-defs.h"
#include "sp-symbol.h"
#ifdef WITH_LIBVISIO
@@ -246,12 +247,19 @@ SymbolsDialog::SymbolsDialog( gchar const* prefsPath ) :
key = SPItem::display_key_new(1);
renderDrawing.setRoot(previewDocument->getRoot()->invoke_show(renderDrawing, key, SP_ITEM_SHOW_DISPLAY ));
+ // This might need to be a global variable so setTargetDesktop can modify it
+ SPDefs *defs = currentDocument->getDefs();
+ sigc::connection defsModifiedConn = (SP_OBJECT(defs))->connectModified(
+ sigc::mem_fun(*this, &SymbolsDialog::defsModified));
+ instanceConns.push_back(defsModifiedConn);
+
get_symbols();
draw_symbols( currentDocument ); /* Defaults to current document */
- desktopChangeConn =
+ sigc::connection desktopChangeConn =
deskTrack.connectDesktopChanged( sigc::mem_fun(*this, &SymbolsDialog::setTargetDesktop) );
instanceConns.push_back( desktopChangeConn );
+
deskTrack.connect(GTK_WIDGET(gobj()));
}
@@ -304,6 +312,13 @@ void SymbolsDialog::iconDragDataGet(const Glib::RefPtr<Gdk::DragContext>& /*cont
}
+void SymbolsDialog::defsModified(SPObject *object, guint flags)
+{
+ if ( !symbolSets[symbolSet->get_active_text()] ) {
+ rebuild();
+ }
+}
+
void SymbolsDialog::iconChanged() {
#if WITH_GTKMM_3_0
std::vector<Gtk::TreePath> iconArray = iconView->get_selected_items();
@@ -484,10 +499,8 @@ void SymbolsDialog::get_symbols() {
}
GSList* SymbolsDialog::symbols_in_doc_recursive (SPObject *r, GSList *l)
-{
- if (!r) {
- return l;
- }
+{
+ g_return_val_if_fail(r != NULL, l);
// Stop multiple counting of same symbol
if( SP_IS_USE(r) ) {
@@ -559,32 +572,32 @@ gchar const* SymbolsDialog::style_from_use( gchar const* id, SPDocument* documen
void SymbolsDialog::draw_symbols( SPDocument* symbolDocument ) {
-
- SymbolColumns* columns = getColumns();
-
GSList* l = symbols_in_doc( symbolDocument );
for( ; l != NULL; l = l->next ) {
-
SPObject* symbol = SP_OBJECT(l->data);
- if (!SP_IS_SYMBOL(symbol)) {
- //std::cout << " Error: not symbol" << std::endl;
- continue;
+ if (SP_IS_SYMBOL(symbol)) {
+ draw_symbol( symbol );
}
+ }
+}
- gchar const *id = symbol->getRepr()->attribute("id");
- gchar const *title = symbol->title(); // From title element
- if( !title ) {
- title = id;
- }
+void SymbolsDialog::draw_symbol( SPObject* symbol ) {
+
+ SymbolColumns* columns = getColumns();
- Glib::RefPtr<Gdk::Pixbuf> pixbuf = create_symbol_image(id, symbolDocument, &renderDrawing, key );
- if( pixbuf ) {
+ gchar const *id = symbol->getRepr()->attribute("id");
+ gchar const *title = symbol->title(); // From title element
+ if( !title ) {
+ title = id;
+ }
- Gtk::ListStore::iterator row = store->append();
- (*row)[columns->symbol_id] = Glib::ustring( id );
- (*row)[columns->symbol_title] = Glib::ustring( title );
- (*row)[columns->symbol_image] = pixbuf;
- }
+ Glib::RefPtr<Gdk::Pixbuf> pixbuf = create_symbol_image(id, symbol );
+
+ if( pixbuf ) {
+ Gtk::ListStore::iterator row = store->append();
+ (*row)[columns->symbol_id] = Glib::ustring( id );
+ (*row)[columns->symbol_title] = Glib::ustring( title );
+ (*row)[columns->symbol_image] = pixbuf;
}
delete columns;
@@ -600,18 +613,8 @@ void SymbolsDialog::draw_symbols( SPDocument* symbolDocument ) {
* the temporary document is rendered.
*/
Glib::RefPtr<Gdk::Pixbuf>
-SymbolsDialog::create_symbol_image(gchar const *symbol_id,
- SPDocument *source,
- Inkscape::Drawing* drawing,
- unsigned /*visionkey*/)
+SymbolsDialog::create_symbol_image(gchar const *symbol_id, SPObject *symbol)
{
- // Retrieve the symbol named 'symbol_id' from the source SVG document
- SPObject const* symbol = source->getObjectById(symbol_id);
- if (symbol == NULL) {
- //std::cout << " Failed to find symbol: " << symbol_id << std::endl;
- //return 0;
- }
-
// Create a copy repr of the symbol with id="the_symbol"
Inkscape::XML::Document *xml_doc = previewDocument->getReprDoc();
Inkscape::XML::Node *repr = symbol->getRepr()->duplicate(xml_doc);
@@ -628,10 +631,10 @@ SymbolsDialog::create_symbol_image(gchar const *symbol_id,
gchar const* style = repr->attribute("inkscape:symbol-style");
if( !style ) {
// If no default style in <symbol>, look in documents.
- if( source == currentDocument ) {
- style = style_from_use( symbol_id, source );
+ if( symbol->document == currentDocument ) {
+ style = style_from_use( symbol_id, symbol->document );
} else {
- style = source->getReprRoot()->attribute("style");
+ style = symbol->document->getReprRoot()->attribute("style");
}
}
// Last ditch effort to provide some default styling
@@ -721,7 +724,7 @@ SymbolsDialog::create_symbol_image(gchar const *symbol_id,
scale = atof( previewScaleString.c_str() );
}
- pixbuf = Glib::wrap(render_pixbuf(*drawing, scale, *dbox, psize));
+ pixbuf = Glib::wrap(render_pixbuf(renderDrawing, scale, *dbox, psize));
svg_preview_cache.set_preview_in_cache(key, pixbuf->gobj());
}
diff --git a/src/ui/dialog/symbols.h b/src/ui/dialog/symbols.h
index 08221bf22..b81f6981e 100644
--- a/src/ui/dialog/symbols.h
+++ b/src/ui/dialog/symbols.h
@@ -46,11 +46,13 @@ private:
static SymbolColumns *getColumns();
void rebuild();
+ void defsModified(SPObject *object, guint flags);
void iconChanged();
void iconDragDataGet(const Glib::RefPtr<Gdk::DragContext>& context, Gtk::SelectionData& selection_data, guint info, guint time);
void get_symbols();
void draw_symbols( SPDocument* symbol_document );
+ void draw_symbol( SPObject* symbol_document );
SPDocument* symbols_preview_doc();
GSList* symbols_in_doc_recursive(SPObject *r, GSList *l);
@@ -60,9 +62,7 @@ private:
gchar const* style_from_use( gchar const* id, SPDocument* document);
Glib::RefPtr<Gdk::Pixbuf>
- create_symbol_image(gchar const *symbol_name,
- SPDocument *source, Inkscape::Drawing* drawing,
- unsigned /*visionkey*/);
+ create_symbol_image(gchar const *symbol_name, SPObject *symbol);
/* Keep track of all symbol template documents */
std::map<Glib::ustring, SPDocument*> symbolSets;
@@ -85,8 +85,6 @@ private:
Inkscape::Drawing renderDrawing;
std::vector<sigc::connection> instanceConns;
- sigc::connection desktopChangeConn;
-
};
} //namespace Dialogs
diff --git a/src/ui/dialog/xml-tree.cpp b/src/ui/dialog/xml-tree.cpp
index 29dbc4b93..a537b7fca 100644
--- a/src/ui/dialog/xml-tree.cpp
+++ b/src/ui/dialog/xml-tree.cpp
@@ -986,6 +986,7 @@ void XmlTree::cmd_delete_node()
g_assert(selected_repr != NULL);
sp_repr_unparent(selected_repr);
+ reinterpret_cast<SPObject *>(current_desktop->currentLayer())->requestDisplayUpdate(SP_OBJECT_MODIFIED_FLAG);
DocumentUndo::done(current_document, SP_VERB_DIALOG_XML_EDITOR,
Q_("nodeAsInXMLinHistoryDialog|Delete node"));
}
diff --git a/src/ui/previewholder.cpp b/src/ui/previewholder.cpp
index b5a1a29a8..38f6f353f 100644
--- a/src/ui/previewholder.cpp
+++ b/src/ui/previewholder.cpp
@@ -50,6 +50,8 @@ PreviewHolder::PreviewHolder() :
_border(BORDER_NONE)
{
_scroller = manage(new Gtk::ScrolledWindow());
+ ((Gtk::ScrolledWindow *)_scroller)->set_policy(Gtk::POLICY_AUTOMATIC,
+ Gtk::POLICY_AUTOMATIC);
#if WITH_GTKMM_3_0
_insides = manage(new Gtk::Grid());
diff --git a/src/verbs.cpp b/src/verbs.cpp
index 4777e168c..ec7cad8dd 100644
--- a/src/verbs.cpp
+++ b/src/verbs.cpp
@@ -955,7 +955,7 @@ void EditVerb::perform(SPAction *action, void *data)
sp_selection_untile(dt);
break;
case SP_VERB_EDIT_SYMBOL:
- sp_selection_symbol(dt);
+ sp_selection_symbols(dt);
break;
case SP_VERB_EDIT_UNSYMBOL:
sp_selection_unsymbol(dt);
diff --git a/src/widgets/desktop-widget.cpp b/src/widgets/desktop-widget.cpp
index 4af7c0795..ca76cb568 100644
--- a/src/widgets/desktop-widget.cpp
+++ b/src/widgets/desktop-widget.cpp
@@ -55,6 +55,7 @@
#include "ui/widget/dock.h"
#include "ui/widget/layer-selector.h"
#include "ui/widget/selected-style.h"
+#include "ui/widget/gimpspinscale.h"
#include "ui/uxmanager.h"
#include "util/ege-appear-time-tracker.h"
#include "sp-root.h"
@@ -628,7 +629,14 @@ void SPDesktopWidget::init( SPDesktopWidget *dtw )
gtk_box_pack_end (GTK_BOX (dtw->statusbar), statusbar_tail, FALSE, FALSE, 0);
// zoom status spinbutton
- dtw->zoom_status = gtk_spin_button_new_with_range (log(SP_DESKTOP_ZOOM_MIN)/log(2), log(SP_DESKTOP_ZOOM_MAX)/log(2), 0.1);
+#if WITH_GTKMM_3_0
+ Glib::RefPtr<Gtk::Adjustment> _adjustment = Gtk::Adjustment::create(100.0, log(SP_DESKTOP_ZOOM_MIN)/log(2), log(SP_DESKTOP_ZOOM_MAX)/log(2), 0.1, 1.0);
+#else
+ Gtk::Adjustment *_adjustment = new Gtk::Adjustment(100.0, log(SP_DESKTOP_ZOOM_MIN)/log(2), log(SP_DESKTOP_ZOOM_MAX)/log(2), 0.1, 1.0);
+#endif
+ dtw->zoom_status = gimp_spin_scale_new (_adjustment->gobj(), _("Zoom"), 1);
+
+ //dtw->zoom_status = gtk_spin_button_new_with_range (log(SP_DESKTOP_ZOOM_MIN)/log(2), log(SP_DESKTOP_ZOOM_MAX)/log(2), 0.1);
gtk_widget_set_tooltip_text (dtw->zoom_status, _("Zoom"));
gtk_widget_set_size_request (dtw->zoom_status, STATUS_ZOOM_WIDTH, -1);
gtk_entry_set_width_chars (GTK_ENTRY (dtw->zoom_status), 6);
@@ -689,18 +697,18 @@ void SPDesktopWidget::init( SPDesktopWidget *dtw )
dtw->coord_status_y = gtk_label_new(NULL);
gtk_label_set_markup( GTK_LABEL(dtw->coord_status_y), "<tt> 0.00 </tt>" );
gtk_misc_set_alignment (GTK_MISC(dtw->coord_status_y), 1.0, 0.5);
- GtkWidget* label_z = gtk_label_new(_("Z:"));
+ //GtkWidget* label_z = gtk_label_new(_("Z:"));
#if GTK_CHECK_VERSION(3,0,0)
gtk_grid_attach(GTK_GRID(dtw->coord_status), dtw->coord_status_x, 2, 0, 1, 1);
gtk_grid_attach(GTK_GRID(dtw->coord_status), dtw->coord_status_y, 2, 1, 1, 1);
- gtk_grid_attach(GTK_GRID(dtw->coord_status), label_z, 3, 0, 1, 2);
- gtk_grid_attach(GTK_GRID(dtw->coord_status), dtw->zoom_status, 4, 0, 1, 2);
+ //gtk_grid_attach(GTK_GRID(dtw->coord_status), label_z, 3, 0, 1, 2);
+ gtk_grid_attach(GTK_GRID(dtw->coord_status), dtw->zoom_status, 3, 0, 1, 2);
#else
gtk_table_attach(GTK_TABLE(dtw->coord_status), dtw->coord_status_x, 2,3, 0,1, GTK_FILL, GTK_FILL, 0, 0);
gtk_table_attach(GTK_TABLE(dtw->coord_status), dtw->coord_status_y, 2,3, 1,2, GTK_FILL, GTK_FILL, 0, 0);
- gtk_table_attach(GTK_TABLE(dtw->coord_status), label_z, 3,4, 0,2, GTK_FILL, GTK_FILL, 0, 0);
- gtk_table_attach(GTK_TABLE(dtw->coord_status), dtw->zoom_status, 4,5, 0,2, GTK_FILL, GTK_FILL, 0, 0);
+ //gtk_table_attach(GTK_TABLE(dtw->coord_status), label_z, 3,4, 0,2, GTK_FILL, GTK_FILL, 0, 0);
+ gtk_table_attach(GTK_TABLE(dtw->coord_status), dtw->zoom_status, 3,4, 0,2, GTK_FILL, GTK_FILL, 0, 0);
#endif
sp_set_font_size_smaller (dtw->coord_status);
diff --git a/src/widgets/widget-sizes.h b/src/widgets/widget-sizes.h
index 87c7ca2e0..8db036734 100644
--- a/src/widgets/widget-sizes.h
+++ b/src/widgets/widget-sizes.h
@@ -27,7 +27,7 @@
#define STATUS_BAR_FONT_SIZE 10000
-#define STATUS_ZOOM_WIDTH 57
+#define STATUS_ZOOM_WIDTH 100
#define SELECTED_STYLE_SB_WIDTH 48
#define SELECTED_STYLE_WIDTH 190
diff --git a/src/xml/repr-util.cpp b/src/xml/repr-util.cpp
index 6ea20b87a..8c8425de0 100644
--- a/src/xml/repr-util.cpp
+++ b/src/xml/repr-util.cpp
@@ -524,6 +524,8 @@ unsigned int sp_repr_get_point(Inkscape::XML::Node *repr, gchar const *key, Geom
gchar const *v = repr->attribute(key);
+ g_return_val_if_fail(v != NULL, FALSE);
+
gchar ** strarray = g_strsplit(v, ",", 2);
if (strarray && strarray[0] && strarray[1]) {