summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorsu_v <suv-sf@users.sourceforge.net>2013-03-11 17:40:03 +0000
committer~suv <suv-sf@users.sourceforge.net>2013-03-11 17:40:03 +0000
commit3b80081f5a6a0b3ad870d5e90037189e56c9468f (patch)
tree3de07a42745f10892ae2eca52c1cf3fb49421301 /src
parentmerge from trunk (r12182) (diff)
parentfix build warnings / cppcheck ( Bug #1120585 ) (diff)
downloadinkscape-3b80081f5a6a0b3ad870d5e90037189e56c9468f.tar.gz
inkscape-3b80081f5a6a0b3ad870d5e90037189e56c9468f.zip
merge from trunk (r12191)
(bzr r11668.1.55)
Diffstat (limited to 'src')
-rw-r--r--src/dom/io/domstream.cpp220
-rw-r--r--src/dom/io/domstream.h70
-rw-r--r--src/extension/internal/odf.cpp188
-rw-r--r--src/interface.cpp2
-rw-r--r--src/io/inkscapestream.cpp2
-rw-r--r--src/libnrtype/font-lister.cpp14
-rw-r--r--src/ui/dialog/aboutbox.cpp19
-rw-r--r--src/ui/dialog/calligraphic-profile-rename.cpp35
-rw-r--r--src/ui/dialog/calligraphic-profile-rename.h22
-rw-r--r--src/ui/dialog/export.h1
-rw-r--r--src/ui/dialog/filter-effects-dialog.cpp19
-rw-r--r--src/ui/dialog/guides.cpp13
-rw-r--r--src/ui/dialog/inkscape-preferences.cpp14
-rw-r--r--src/ui/dialog/object-attributes.cpp11
-rw-r--r--src/ui/dialog/object-attributes.h5
-rw-r--r--src/ui/dialog/object-properties.cpp157
-rw-r--r--src/ui/dialog/object-properties.h23
-rw-r--r--src/ui/dialog/swatches.cpp3
-rw-r--r--src/ui/previewholder.cpp270
-rw-r--r--src/ui/previewholder.h19
-rw-r--r--src/ui/widget/selected-style.cpp27
-rw-r--r--src/ui/widget/selected-style.h16
-rw-r--r--src/widgets/desktop-widget.cpp5
23 files changed, 787 insertions, 368 deletions
diff --git a/src/dom/io/domstream.cpp b/src/dom/io/domstream.cpp
index b9ff7e9d2..7118025d6 100644
--- a/src/dom/io/domstream.cpp
+++ b/src/dom/io/domstream.cpp
@@ -66,7 +66,7 @@ void pipeStream(InputStream &source, OutputStream &dest)
}
dest.flush();
}
-
+/*
//#########################################################################
@@ -74,11 +74,11 @@ void pipeStream(InputStream &source, OutputStream &dest)
//#########################################################################
static char const *digits = "0123456789abcdefghijklmnopqrstuvwxyz";
-
-static int dprintInt(Writer &outs,
- long arg, int base,
- int flag, int width, int /*precision*/)
-{
+*/
+// static int dprintInt(Writer &outs,
+ // long arg, int base,
+ // int flag, int width, int /*precision*/)
+/*{
DOMString buf;
@@ -209,7 +209,7 @@ static int dprintDouble(Writer &outs, double val,
}
return 1;
}
-
+*/
/**
* Output a string. We veer from the standard a tiny bit.
@@ -217,9 +217,9 @@ static int dprintDouble(Writer &outs, double val,
* it as an indicator that the user wants to XML-escape any
* XML entities.
*/
-static int dprintString(Writer &outs, const DOMString &str,
- int flags, int /*width*/, int /*precision*/)
-{
+// static int dprintString(Writer &outs, const DOMString &str,
+ // int flags, int /*width*/, int /*precision*/)
+/*{
int len = str.size();
if (flags == '#')
{
@@ -418,7 +418,7 @@ static int dprintf(Writer &outs, const DOMString &fmt, va_list ap)
return 1;
}
-
+*/
//#########################################################################
//# B A S I C I N P U T S T R E A M
@@ -514,7 +514,7 @@ int BasicOutputStream::put(gunichar ch)
if (closed)
return -1;
destination.put(ch);
- return 1;
+ return 1;
}
@@ -811,38 +811,37 @@ gunichar StdReader::get()
//#########################################################################
//# B A S I C W R I T E R
//#########################################################################
-
/**
*
- */
+ */
BasicWriter::BasicWriter(const Writer &destinationWriter)
{
- destination = (Writer *)&destinationWriter;
+ destination = (Writer*) &destinationWriter;
}
/**
* Closes this writer and releases any system resources
* associated with this writer.
- */
+ */
void BasicWriter::close()
{
if (destination)
destination->close();
}
-
+
/**
* Flushes this output stream and forces any buffered output
* bytes to be written out.
- */
+ */
void BasicWriter::flush()
{
if (destination)
destination->flush();
}
-
+
/**
* Writes the specified byte to this output writer.
- */
+ */
int BasicWriter::put(gunichar ch)
{
if (destination && destination->put(ch)>=0)
@@ -852,50 +851,66 @@ int BasicWriter::put(gunichar ch)
/**
* Provide printf()-like formatting
- */
-/*
+ */
Writer &BasicWriter::printf(char const *fmt, ...)
{
va_list args;
va_start(args, fmt);
- //replace this wish vsnprintf()
- vsnprintf(formatBuf, 2047, fmt, args);
+ gchar *buf = g_strdup_vprintf(fmt, args);
va_end(args);
- writeString(formatBuf);
-
- return *this;
-}
-*/
-Writer &BasicWriter::printf(const DOMString &fmt, ...)
-{
- va_list args;
- va_start(args, fmt);
- dprintf(*this, fmt, args);
+ if (buf) {
+ writeString(buf);
+ g_free(buf);
+ }
return *this;
}
-
-
/**
* Writes the specified character to this output writer.
- */
+ */
Writer &BasicWriter::writeChar(char ch)
{
- XMLCh uch = ch;
+ gunichar uch = ch;
put(uch);
return *this;
}
/**
- * Writes the specified standard string to this output writer.
- */
-Writer &BasicWriter::writeString(const DOMString &str)
+ * Writes the specified unicode string to this output writer.
+ */
+Writer &BasicWriter::writeUString(Glib::ustring &str)
{
for (int i=0; i< (int)str.size(); i++)
put(str[i]);
return *this;
}
+/**
+ * Writes the specified standard string to this output writer.
+ */
+Writer &BasicWriter::writeStdString(std::string &str)
+{
+ Glib::ustring tmp(str);
+ writeUString(tmp);
+ return *this;
+}
+
+/**
+ * Writes the specified character string to this output writer.
+ */
+Writer &BasicWriter::writeString(const char *str)
+{
+ Glib::ustring tmp;
+ if (str)
+ tmp = str;
+ else
+ tmp = "null";
+ writeUString(tmp);
+ return *this;
+}
+
+
+
/**
*
@@ -915,10 +930,12 @@ Writer &BasicWriter::writeBool (bool val )
*/
Writer &BasicWriter::writeShort (short val )
{
- char buf[32];
- snprintf(buf, 31, "%d", val);
- writeString(buf);
- return *this;
+ gchar *buf = g_strdup_printf("%d", val);
+ if (buf) {
+ writeString(buf);
+ g_free(buf);
+ }
+ return *this;
}
@@ -928,9 +945,11 @@ Writer &BasicWriter::writeShort (short val )
*/
Writer &BasicWriter::writeUnsignedShort (unsigned short val )
{
- char buf[32];
- snprintf(buf, 31, "%u", val);
- writeString(buf);
+ gchar *buf = g_strdup_printf("%u", val);
+ if (buf) {
+ writeString(buf);
+ g_free(buf);
+ }
return *this;
}
@@ -939,9 +958,11 @@ Writer &BasicWriter::writeUnsignedShort (unsigned short val )
*/
Writer &BasicWriter::writeInt (int val)
{
- char buf[32];
- snprintf(buf, 31, "%d", val);
- writeString(buf);
+ gchar *buf = g_strdup_printf("%d", val);
+ if (buf) {
+ writeString(buf);
+ g_free(buf);
+ }
return *this;
}
@@ -950,9 +971,11 @@ Writer &BasicWriter::writeInt (int val)
*/
Writer &BasicWriter::writeUnsignedInt (unsigned int val)
{
- char buf[32];
- snprintf(buf, 31, "%u", val);
- writeString(buf);
+ gchar *buf = g_strdup_printf("%u", val);
+ if (buf) {
+ writeString(buf);
+ g_free(buf);
+ }
return *this;
}
@@ -961,9 +984,11 @@ Writer &BasicWriter::writeUnsignedInt (unsigned int val)
*/
Writer &BasicWriter::writeLong (long val)
{
- char buf[32];
- snprintf(buf, 31, "%ld", val);
- writeString(buf);
+ gchar *buf = g_strdup_printf("%ld", val);
+ if (buf) {
+ writeString(buf);
+ g_free(buf);
+ }
return *this;
}
@@ -972,9 +997,11 @@ Writer &BasicWriter::writeLong (long val)
*/
Writer &BasicWriter::writeUnsignedLong(unsigned long val)
{
- char buf[32];
- snprintf(buf, 31, "%lu", val);
- writeString(buf);
+ gchar *buf = g_strdup_printf("%lu", val);
+ if (buf) {
+ writeString(buf);
+ g_free(buf);
+ }
return *this;
}
@@ -983,9 +1010,16 @@ Writer &BasicWriter::writeUnsignedLong(unsigned long val)
*/
Writer &BasicWriter::writeFloat(float val)
{
- char buf[32];
- snprintf(buf, 31, "%8.3f", val);
- writeString(buf);
+#if 1
+ gchar *buf = g_strdup_printf("%8.3f", val);
+ if (buf) {
+ writeString(buf);
+ g_free(buf);
+ }
+#else
+ std::string tmp = ftos(val, 'g', 8, 3, 0);
+ writeStdString(tmp);
+#endif
return *this;
}
@@ -994,9 +1028,16 @@ Writer &BasicWriter::writeFloat(float val)
*/
Writer &BasicWriter::writeDouble(double val)
{
- char buf[32];
- snprintf(buf, 31, "%8.3f", val);
- writeString(buf);
+#if 1
+ gchar *buf = g_strdup_printf("%8.3f", val);
+ if (buf) {
+ writeString(buf);
+ g_free(buf);
+ }
+#else
+ std::string tmp = ftos(val, 'g', 8, 3, 0);
+ writeStdString(tmp);
+#endif
return *this;
}
@@ -1013,7 +1054,7 @@ OutputStreamWriter::OutputStreamWriter(OutputStream &outputStreamDest)
{
}
-
+
/**
* Close the underlying OutputStream
@@ -1023,7 +1064,7 @@ void OutputStreamWriter::close()
flush();
outputStream.close();
}
-
+
/**
* Flush the underlying OutputStream
*/
@@ -1031,18 +1072,16 @@ void OutputStreamWriter::flush()
{
outputStream.flush();
}
-
+
/**
* Overloaded to redirect the output chars from the next Writer
* in the chain to an OutputStream instead.
*/
int OutputStreamWriter::put(gunichar ch)
{
- //Do we need conversions here?
- int intCh = (int) ch;
- if (outputStream.put(intCh) < 0)
- return -1;
- return 1;
+ if (outputStream.put(ch)>=0)
+ return 1;
+ return -1;
}
//#########################################################################
@@ -1051,24 +1090,21 @@ int OutputStreamWriter::put(gunichar ch)
/**
- *
+ *
*/
StdWriter::StdWriter()
{
outputStream = new StdOutputStream();
}
-
-
+
/**
- *
+ *
*/
StdWriter::~StdWriter()
{
delete outputStream;
}
-
-
/**
* Close the underlying OutputStream
*/
@@ -1077,7 +1113,7 @@ void StdWriter::close()
flush();
outputStream->close();
}
-
+
/**
* Flush the underlying OutputStream
*/
@@ -1085,23 +1121,20 @@ void StdWriter::flush()
{
outputStream->flush();
}
-
+
/**
* Overloaded to redirect the output chars from the next Writer
* in the chain to an OutputStream instead.
*/
int StdWriter::put(gunichar ch)
{
- //Do we need conversions here?
- if (outputStream->put(ch) < 0)
- return -1;
- return 1;
+ if (outputStream && (outputStream->put(ch)>=0))
+ return 1;
+ return -1;
}
-
-
//###############################################
//# O P E R A T O R S
//###############################################
@@ -1144,11 +1177,16 @@ const Reader& operator>> (Reader &reader, double &val)
-
Writer& operator<< (Writer &writer, char val)
{ return writer.writeChar(val); }
-Writer& operator<< (Writer &writer, const DOMString &val)
+Writer& operator<< (Writer &writer, Glib::ustring &val)
+ { return writer.writeUString(val); }
+
+Writer& operator<< (Writer &writer, std::string &val)
+ { return writer.writeStdString(val); }
+
+Writer& operator<< (Writer &writer, char const *val)
{ return writer.writeString(val); }
Writer& operator<< (Writer &writer, bool val)
@@ -1178,8 +1216,6 @@ Writer& operator<< (Writer &writer, float val)
Writer& operator<< (Writer &writer, double val)
{ return writer.writeDouble(val); }
-
-
} //namespace io
} //namespace dom
} //namespace w3c
diff --git a/src/dom/io/domstream.h b/src/dom/io/domstream.h
index a021676fa..edd180b83 100644
--- a/src/dom/io/domstream.h
+++ b/src/dom/io/domstream.h
@@ -490,17 +490,21 @@ public:
virtual ~Writer() {}
virtual void close() = 0;
-
+
virtual void flush() = 0;
-
+
virtual int put(gunichar ch) = 0;
-
+
/* Formatted output */
- virtual Writer& printf(const DOMString &fmt, ...) = 0;
+ virtual Writer& printf(char const *fmt, ...) G_GNUC_PRINTF(2,3) = 0;
virtual Writer& writeChar(char val) = 0;
- virtual Writer& writeString(const DOMString &val) = 0;
+ virtual Writer& writeUString(Glib::ustring &val) = 0;
+
+ virtual Writer& writeStdString(std::string &val) = 0;
+
+ virtual Writer& writeString(const char *str) = 0;
virtual Writer& writeBool (bool val ) = 0;
@@ -520,7 +524,7 @@ public:
virtual Writer& writeDouble (double val ) = 0;
-
+
}; // interface Writer
@@ -540,19 +544,23 @@ public:
/*Overload these 3 for your implementation*/
virtual void close();
-
+
virtual void flush();
-
+
virtual int put(gunichar ch);
-
-
-
+
+
+
/* Formatted output */
- virtual Writer &printf(const DOMString &fmt, ...);
+ virtual Writer &printf(char const *fmt, ...) G_GNUC_PRINTF(2,3);
virtual Writer& writeChar(char val);
- virtual Writer& writeString(const DOMString &val);
+ virtual Writer& writeUString(Glib::ustring &val);
+
+ virtual Writer& writeStdString(std::string &val);
+
+ virtual Writer& writeString(const char *str);
virtual Writer& writeBool (bool val );
@@ -572,33 +580,26 @@ public:
virtual Writer& writeDouble (double val );
-
+
protected:
Writer *destination;
BasicWriter()
- {
- destination = NULL;
- for(int k=0;k<2048;++k)
- {
- formatBuf[k]=0;
- }
- }
-
- //Used for printf() or other things that might
- //require formatting before sending down the stream
- char formatBuf[2048];
-
+ { destination = NULL; }
+
private:
}; // class BasicWriter
-
Writer& operator<< (Writer &writer, char val);
-Writer& operator<< (Writer &writer, const DOMString &val);
+Writer& operator<< (Writer &writer, Glib::ustring &val);
+
+Writer& operator<< (Writer &writer, std::string &val);
+
+Writer& operator<< (Writer &writer, char const *val);
Writer& operator<< (Writer &writer, bool val);
@@ -619,8 +620,6 @@ Writer& operator<< (Writer &writer, float val);
Writer& operator<< (Writer &writer, double val);
-
-
/**
* Class for placing a Writer on an open OutputStream
*
@@ -630,12 +629,10 @@ class OutputStreamWriter : public BasicWriter
public:
OutputStreamWriter(OutputStream &outputStreamDest);
-
+
/*Overload these 3 for your implementation*/
virtual void close();
-
virtual void flush();
-
virtual int put(gunichar ch);
@@ -656,14 +653,8 @@ public:
StdWriter();
virtual ~StdWriter();
-
-
virtual void close();
-
-
virtual void flush();
-
-
virtual int put(gunichar ch);
@@ -680,7 +671,6 @@ private:
void pipeStream(InputStream &source, OutputStream &dest);
-
} //namespace io
} //namespace dom
} //namespace w3c
diff --git a/src/extension/internal/odf.cpp b/src/extension/internal/odf.cpp
index bd74ba47c..47671a8d2 100644
--- a/src/extension/internal/odf.cpp
+++ b/src/extension/internal/odf.cpp
@@ -4,7 +4,7 @@
* This is an an entry in the extensions mechanism to begin to enable
* the inputting and outputting of OpenDocument Format (ODF) files from
* within Inkscape. Although the initial implementations will be very lossy
- * do to the differences in the models of SVG and ODF, they will hopefully
+ * due to the differences in the models of SVG and ODF, they will hopefully
* improve greatly with time. People should consider this to be a framework
* that can be continously upgraded for ever improving fidelity. Potential
* developers should especially look in preprocess() and writeTree() to see how
@@ -15,8 +15,10 @@
* Authors:
* Bob Jamison
* Abhishek Sharma
+ * Kris De Gussem
*
* Copyright (C) 2006, 2007 Bob Jamison
+ * Copyright (C) 2013 Kris De Gussem
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
@@ -293,11 +295,13 @@ public:
@return Structure to access U, S and V.
*/
- SingularValueDecomposition (const SVDMatrix &mat)
+ SingularValueDecomposition (const SVDMatrix &mat) :
+ A (mat),
+ U (),
+ s (NULL),
+ s_size (0),
+ V ()
{
- A = mat;
- s = NULL;
- s_size = 0;
calculate();
}
@@ -1078,14 +1082,16 @@ OdfOutput::preprocess(ZipFile &zf, Inkscape::XML::Node *node)
//Now consider items.
SPObject *reprobj = SP_ACTIVE_DOCUMENT->getObjectByRepr(node);
if (!reprobj)
+ {
return;
+ }
if (!SP_IS_ITEM(reprobj))
- {
+ {
return;
- }
- SPItem *item = SP_ITEM(reprobj);
+ }
+ //SPItem *item = SP_ITEM(reprobj);
//### Get SVG-to-ODF transform
- Geom::Affine tf = getODFTransform(item);
+ //Geom::Affine tf = getODFTransform(item);
if (nodeName == "image" || nodeName == "svg:image")
{
@@ -1180,7 +1186,7 @@ bool OdfOutput::writeManifest(ZipFile &zf)
else if (ext == ".jpg")
outs.printf("image/jpeg");
outs.printf("\" manifest:full-path=\"");
- outs.printf(newName.c_str());
+ outs.writeString(newName.c_str());
outs.printf("\"/>\n");
}
outs.printf("</manifest:manifest>\n");
@@ -1208,14 +1214,19 @@ bool OdfOutput::writeMeta(ZipFile &zf)
time(&tim);
std::map<Glib::ustring, Glib::ustring>::iterator iter;
- Glib::ustring creator = "unknown";
+ Glib::ustring InkscapeVersion = Glib::ustring("Inkscape.org - ") + Inkscape::version_string;
+ Glib::ustring creator = InkscapeVersion;
iter = metadata.find("dc:creator");
if (iter != metadata.end())
+ {
creator = iter->second;
+ }
Glib::ustring date = "";
iter = metadata.find("dc:date");
if (iter != metadata.end())
+ {
date = iter->second;
+ }
outs.printf("<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n");
outs.printf("\n");
@@ -1240,21 +1251,20 @@ bool OdfOutput::writeMeta(ZipFile &zf)
outs.printf("xmlns:anim=\"urn:oasis:names:tc:opendocument:xmlns:animation:1.0\"\n");
outs.printf("office:version=\"1.0\">\n");
outs.printf("<office:meta>\n");
- Glib::ustring tmp = Glib::ustring(" <meta:generator>Inkscape.org - ") + Inkscape::version_string + "</meta:generator>\n";
- outs.writeString(tmp);
- outs.printf(" <meta:initial-creator>%#s</meta:initial-creator>\n",
- creator.c_str());
- outs.printf(" <meta:creation-date>%#s</meta:creation-date>\n", date.c_str());
+ Glib::ustring tmp = Glib::ustring(" <meta:generator>") + InkscapeVersion + "</meta:generator>\n";
+ outs.writeUString(tmp);
+ outs.printf(" <meta:initial-creator>%s</meta:initial-creator>\n", creator.c_str());
+ outs.printf(" <meta:creation-date>%s</meta:creation-date>\n", date.c_str());
for (iter = metadata.begin() ; iter != metadata.end() ; ++iter)
- {
+ {
Glib::ustring name = iter->first;
Glib::ustring value = iter->second;
- if (name.size() > 0 && value.size()>0)
- {
- outs.printf(" <%#s>%#s</%#s>\n",
- name.c_str(), value.c_str(), name.c_str());
- }
+ if (!name.empty() && !value.empty())
+ {
+ tmp = Glib::ustring::compose(" <%1>%2</%3>\n", name, value, name);
+ outs.writeUString(tmp);
}
+ }
outs.printf(" <meta:editing-cycles>2</meta:editing-cycles>\n");
outs.printf(" <meta:editing-duration>PT56S</meta:editing-duration>\n");
outs.printf(" <meta:user-defined meta:name=\"Info 1\"/>\n");
@@ -1331,7 +1341,7 @@ bool OdfOutput::writeStyle(ZipFile &zf)
}
//## Dump our gradient table
- int gradientCount = 0;
+ unsigned int gradientCount = 0;
outs.printf("\n");
outs.printf("<!-- ####### Gradients from Inkscape document ####### -->\n");
std::vector<GradientInfo>::iterator giter;
@@ -1357,8 +1367,8 @@ bool OdfOutput::writeStyle(ZipFile &zf)
continue;
}
outs.printf("<svg:linearGradient ");
- outs.printf("id=\"%#s_g\" ", gi.name.c_str());
- outs.printf("draw:name=\"%#s_g\"\n", gi.name.c_str());
+ outs.printf("id=\"%s\" ", gi.name.c_str());
+ outs.printf("draw:name=\"%s\"\n", gi.name.c_str());
outs.printf(" draw:display-name=\"imported linear %u\"\n",
gradientCount);
outs.printf(" svg:x1=\"%05.3fcm\" svg:y1=\"%05.3fcm\"\n",
@@ -1400,9 +1410,9 @@ bool OdfOutput::writeStyle(ZipFile &zf)
continue;
}
outs.printf("<svg:radialGradient ");
- outs.printf("id=\"%#s_g\" ", gi.name.c_str());
- outs.printf("draw:name=\"%#s_g\"\n", gi.name.c_str());
- outs.printf(" draw:display-name=\"imported radial %d\"\n",
+ outs.printf("id=\"%s\" ", gi.name.c_str());
+ outs.printf("draw:name=\"%s\"\n", gi.name.c_str());
+ outs.printf(" draw:display-name=\"imported radial %u\"\n",
gradientCount);
outs.printf(" svg:cx=\"%05.3f\" svg:cy=\"%05.3f\"\n",
gi.cx, gi.cy);
@@ -1429,11 +1439,11 @@ bool OdfOutput::writeStyle(ZipFile &zf)
{
g_warning("unsupported gradient style '%s'", gi.style.c_str());
}
- outs.printf("<style:style style:name=\"%#s\" style:family=\"graphic\" ",
+ outs.printf("<style:style style:name=\"%s\" style:family=\"graphic\" ",
gi.name.c_str());
outs.printf("style:parent-style-name=\"standard\">\n");
outs.printf(" <style:graphic-properties draw:fill=\"gradient\" ");
- outs.printf("draw:fill-gradient-name=\"%#s_g\"\n",
+ outs.printf("draw:fill-gradient-name=\"%s\"\n",
gi.name.c_str());
outs.printf(" draw:textarea-horizontal-align=\"center\" ");
outs.printf("draw:textarea-vertical-align=\"middle\"/>\n");
@@ -1750,8 +1760,8 @@ bool OdfOutput::processGradient(Writer &outs, SPItem *item,
return false;;
}
outs.printf("<svg:linearGradient ");
- outs.printf("id=\"%#s_g\" ", gi.name.c_str());
- outs.printf("draw:name=\"%#s_g\"\n", gi.name.c_str());
+ outs.printf("id=\"%s\" ", gi.name.c_str());
+ outs.printf("draw:name=\"%s\"\n", gi.name.c_str());
outs.printf(" draw:display-name=\"imported linear %d\"\n",
gradientCount);
outs.printf(" svg:gradientUnits=\"objectBoundingBox\"\n");
@@ -1793,8 +1803,8 @@ bool OdfOutput::processGradient(Writer &outs, SPItem *item,
return false;
}
outs.printf("<svg:radialGradient ");
- outs.printf("id=\"%#s_g\" ", gi.name.c_str());
- outs.printf("draw:name=\"%#s_g\"\n", gi.name.c_str());
+ outs.printf("id=\"%s\" ", gi.name.c_str());
+ outs.printf("draw:name=\"%s\"\n", gi.name.c_str());
outs.printf(" draw:display-name=\"imported radial %d\"\n",
gradientCount);
outs.printf(" svg:gradientUnits=\"objectBoundingBox\"\n");
@@ -1823,11 +1833,11 @@ bool OdfOutput::processGradient(Writer &outs, SPItem *item,
g_warning("unsupported gradient style '%s'", gi.style.c_str());
return false;
}
- outs.printf("<style:style style:name=\"%#s\" style:family=\"graphic\" ",
+ outs.printf("<style:style style:name=\"%s\" style:family=\"graphic\" ",
gi.name.c_str());
outs.printf("style:parent-style-name=\"standard\">\n");
outs.printf(" <style:graphic-properties draw:fill=\"gradient\" ");
- outs.printf("draw:fill-gradient-name=\"%#s_g\"\n",
+ outs.printf("draw:fill-gradient-name=\"%s\"\n",
gi.name.c_str());
outs.printf(" draw:textarea-horizontal-align=\"center\" ");
outs.printf("draw:textarea-vertical-align=\"middle\"/>\n");
@@ -1889,35 +1899,47 @@ bool OdfOutput::writeTree(Writer &couts, Writer &souts,
if (nodeName == "svg" || nodeName == "svg:svg")
- {
+ {
//# Iterate through the children
for (Inkscape::XML::Node *child = node->firstChild() ;
child ; child = child->next())
- {
+ {
if (!writeTree(couts, souts, child))
+ {
return false;
}
- return true;
}
+ return true;
+ }
else if (nodeName == "g" || nodeName == "svg:g")
+ {
+ if (!id.empty())
{
- if (id.size() > 0)
couts.printf("<draw:g id=\"%s\">\n", id.c_str());
+ }
else
+ {
couts.printf("<draw:g>\n");
+ }
//# Iterate through the children
for (Inkscape::XML::Node *child = node->firstChild() ;
child ; child = child->next())
- {
+ {
if (!writeTree(couts, souts, child))
+ {
return false;
}
- if (id.size() > 0)
+ }
+ if (!id.empty())
+ {
couts.printf("</draw:g> <!-- id=\"%s\" -->\n", id.c_str());
+ }
else
+ {
couts.printf("</draw:g>\n");
- return true;
}
+ return true;
+ }
//######################################
//# S T Y L E
@@ -1930,19 +1952,17 @@ bool OdfOutput::writeTree(Writer &couts, Writer &souts,
processGradient(souts, item, id, tf);
-
-
//######################################
//# I T E M D A T A
//######################################
//g_message("##### %s #####", nodeName.c_str());
if (nodeName == "image" || nodeName == "svg:image")
- {
+ {
if (!SP_IS_IMAGE(item))
- {
+ {
g_warning("<image> is not an SPImage. Why? ;-)");
return false;
- }
+ }
SPImage *img = SP_IMAGE(item);
double ix = img->x.value;
@@ -1954,8 +1974,6 @@ bool OdfOutput::writeTree(Writer &couts, Writer &souts,
ibbox = ibbox * tf;
ix = ibbox.min()[Geom::X];
iy = ibbox.min()[Geom::Y];
- //iwidth = ibbox.max()[Geom::X] - ibbox.min()[Geom::X];
- //iheight = ibbox.max()[Geom::Y] - ibbox.min()[Geom::Y];
iwidth = xscale * iwidth;
iheight = yscale * iheight;
@@ -1966,29 +1984,30 @@ bool OdfOutput::writeTree(Writer &couts, Writer &souts,
Glib::ustring href = getAttribute(node, "xlink:href");
std::map<Glib::ustring, Glib::ustring>::iterator iter = imageTable.find(href);
if (iter == imageTable.end())
- {
+ {
g_warning("image '%s' not in table", href.c_str());
return false;
- }
+ }
Glib::ustring newName = iter->second;
couts.printf("<draw:frame ");
- if (id.size() > 0)
+ if (!id.empty())
+ {
couts.printf("id=\"%s\" ", id.c_str());
+ }
couts.printf("draw:style-name=\"gr1\" draw:text-style-name=\"P1\" draw:layer=\"layout\" ");
//no x or y. make them the translate transform, last one
couts.printf("svg:width=\"%.3fcm\" svg:height=\"%.3fcm\" ",
iwidth, iheight);
- if (itemTransformString.size() > 0)
- {
+ if (!itemTransformString.empty())
+ {
couts.printf("draw:transform=\"%s translate(%.3fcm, %.3fcm)\" ",
itemTransformString.c_str(), ix, iy);
- }
+ }
else
- {
- couts.printf("draw:transform=\"translate(%.3fcm, %.3fcm)\" ",
- ix, iy);
- }
+ {
+ couts.printf("draw:transform=\"translate(%.3fcm, %.3fcm)\" ", ix, iy);
+ }
couts.printf(">\n");
couts.printf(" <draw:image xlink:href=\"%s\" xlink:type=\"simple\"\n",
@@ -1998,41 +2017,41 @@ bool OdfOutput::writeTree(Writer &couts, Writer &souts,
couts.printf(" </draw:image>\n");
couts.printf("</draw:frame>\n");
return true;
- }
+ }
else if (SP_IS_SHAPE(item))
- {
- //g_message("### %s is a shape", nodeName.c_str());
+ {
curve = SP_SHAPE(item)->getCurve();
- }
+ }
else if (SP_IS_TEXT(item) || SP_IS_FLOWTEXT(item))
- {
+ {
curve = te_get_layout(item)->convertToCurves();
- }
+ }
if (curve)
- {
+ {
//### Default <path> output
-
couts.printf("<draw:path ");
- if (id.size()>0)
+ if (!id.empty())
+ {
couts.printf("id=\"%s\" ", id.c_str());
+ }
std::map<Glib::ustring, Glib::ustring>::iterator siter;
siter = styleLookupTable.find(id);
if (siter != styleLookupTable.end())
- {
+ {
Glib::ustring styleName = siter->second;
couts.printf("draw:style-name=\"%s\" ", styleName.c_str());
- }
+ }
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);
@@ -2052,7 +2071,7 @@ bool OdfOutput::writeTree(Writer &couts, Writer &souts,
curve->unref();
- }
+ }
return true;
}
@@ -2304,29 +2323,40 @@ bool OdfOutput::writeContent(ZipFile &zf, Inkscape::XML::Node *node)
OutputStreamWriter couts(cbouts);
if (!writeContentHeader(couts))
+ {
return false;
+ }
//Style.xml stream
BufferOutputStream sbouts;
OutputStreamWriter souts(sbouts);
if (!writeStyleHeader(souts))
+ {
return false;
-
+ }
//# Descend into the tree, doing all of our conversions
- //# to both files as the same time
+ //# to both files at the same time
+ char *oldlocale = g_strdup (setlocale (LC_NUMERIC, NULL));
+ setlocale (LC_NUMERIC, "C");
if (!writeTree(couts, souts, node))
- {
+ {
g_warning("Failed to convert SVG tree");
+ setlocale (LC_NUMERIC, oldlocale);
+ g_free (oldlocale);
return false;
- }
+ }
+ setlocale (LC_NUMERIC, oldlocale);
+ g_free (oldlocale);
//# Finish content file
if (!writeContentFooter(couts))
+ {
return false;
+ }
ZipEntry *ze = zf.newEntry("content.xml", "ODF master content file");
ze->setUncompressedData(cbouts.getBuffer());
@@ -2336,7 +2366,9 @@ bool OdfOutput::writeContent(ZipFile &zf, Inkscape::XML::Node *node)
//# Finish style file
if (!writeStyleFooter(souts))
+ {
return false;
+ }
ze = zf.newEntry("styles.xml", "ODF style file");
ze->setUncompressedData(sbouts.getBuffer());
diff --git a/src/interface.cpp b/src/interface.cpp
index bf497b407..69832a2eb 100644
--- a/src/interface.cpp
+++ b/src/interface.cpp
@@ -468,6 +468,8 @@ static GtkWidget *sp_ui_menu_append_item_from_verb(GtkMenu *menu, Inkscape::Verb
item = gtk_image_menu_item_new_with_mnemonic(action->name);
}
+ gtk_label_set_markup_with_mnemonic( GTK_LABEL(gtk_bin_get_child(GTK_BIN (item))), action->name);
+
GtkAccelGroup *accel_group = sp_shortcut_get_accel_group();
gtk_menu_set_accel_group(menu, accel_group);
diff --git a/src/io/inkscapestream.cpp b/src/io/inkscapestream.cpp
index 4c7fa4d49..dcfc662ca 100644
--- a/src/io/inkscapestream.cpp
+++ b/src/io/inkscapestream.cpp
@@ -130,7 +130,7 @@ int BasicOutputStream::put(gunichar ch)
if (closed)
return -1;
destination.put(ch);
- return 1;
+ return 1;
}
diff --git a/src/libnrtype/font-lister.cpp b/src/libnrtype/font-lister.cpp
index 1e3ba01e9..712c17915 100644
--- a/src/libnrtype/font-lister.cpp
+++ b/src/libnrtype/font-lister.cpp
@@ -556,13 +556,13 @@ namespace Inkscape
PangoWeight weight = pango_font_description_get_weight( desc );
switch ( weight ) {
case PANGO_WEIGHT_THIN:
- sp_repr_css_set_property (css, "font-weight", "100" );
+ sp_repr_css_set_property (css, "font-weight", "thin" );
break;
case PANGO_WEIGHT_ULTRALIGHT:
- sp_repr_css_set_property (css, "font-weight", "200" );
+ sp_repr_css_set_property (css, "font-weight", "extra light" );
break;
case PANGO_WEIGHT_LIGHT:
- sp_repr_css_set_property (css, "font-weight", "300" );
+ sp_repr_css_set_property (css, "font-weight", "light" );
break;
case PANGO_WEIGHT_BOOK:
sp_repr_css_set_property (css, "font-weight", "380" );
@@ -571,19 +571,19 @@ namespace Inkscape
sp_repr_css_set_property (css, "font-weight", "normal" );
break;
case PANGO_WEIGHT_MEDIUM:
- sp_repr_css_set_property (css, "font-weight", "500" );
+ sp_repr_css_set_property (css, "font-weight", "medium" );
break;
case PANGO_WEIGHT_SEMIBOLD:
- sp_repr_css_set_property (css, "font-weight", "600" );
+ sp_repr_css_set_property (css, "font-weight", "semi bold" );
break;
case PANGO_WEIGHT_BOLD:
sp_repr_css_set_property (css, "font-weight", "bold" );
break;
case PANGO_WEIGHT_ULTRABOLD:
- sp_repr_css_set_property (css, "font-weight", "800" );
+ sp_repr_css_set_property (css, "font-weight", "extra bold" );
break;
case PANGO_WEIGHT_HEAVY:
- sp_repr_css_set_property (css, "font-weight", "900" );
+ sp_repr_css_set_property (css, "font-weight", "black" );
break;
case PANGO_WEIGHT_ULTRAHEAVY:
sp_repr_css_set_property (css, "font-weight", "1000" );
diff --git a/src/ui/dialog/aboutbox.cpp b/src/ui/dialog/aboutbox.cpp
index d4928d25d..ba9670d86 100644
--- a/src/ui/dialog/aboutbox.cpp
+++ b/src/ui/dialog/aboutbox.cpp
@@ -447,7 +447,7 @@ void AboutBox::initStrings() {
"Aleksandar Urošević <urke@users.sourceforge.net>, 2004-2006.\n"
"Alessio Frusciante <algol@firenze.linux.it>, 2002, 2003.\n"
"Alexander Shopov <ash@contact.bg>, 2006.\n"
-"Alexandre Prokoudine <alexandre.prokoudine@gmail.com>, 2005, 2010-2011.\n"
+"Alexandre Prokoudine <alexandre.prokoudine@gmail.com>, 2005, 2010-2013.\n"
"Alexey Remizov <alexey@remizov.pp.ru>, 2004.\n"
"Ali Ghanavatian <ghanvatian.ali@gmail.com>, 2010.\n"
"Álvaro Lopes <alvieboy@alvie.com>, 2001, 2002.\n"
@@ -468,14 +468,14 @@ void AboutBox::initStrings() {
"Christian Meyer <chrisime@gnome.org>, 2000-2002.\n"
"Christian Neumair <chris@gnome-de.org>, 2002, 2003.\n"
"Christian Rose <menthos@menthos.com>, 2000-2003.\n"
-"Cristian Secară <cristi@secarica.ro>, 2010.\n"
+"Cristian Secară <cristi@secarica.ro>, 2010-2013.\n"
"Christophe Merlet (RedFox) <redfox@redfoxcenter.org>, 2000-2002.\n"
"Clytie Siddall <clytie@riverland.net.au>, 2004-2008.\n"
"Colin Marquardt <colin@marquardt-home.de>, 2004-2006.\n"
"Cédric Gemy <radar.map35@free.fr>, 2006.\n"
"Daniel Díaz <yosoy@danieldiaz.org>, 2004.\n"
"Didier Conchaudron <conchaudron@free.fr>, 2003.\n"
-"Dimitris Spingos <dmtrs32@gmail.com>, 2011.\n"
+"Dimitris Spingos <dmtrs32@gmail.com>, 2011-2013.\n"
"Dorji Tashi <dorjee_doss@hotmail.com>, 2006.\n"
"Duarte Loreto <happyguy_pt@hotmail.com> 2002, 2003 (Maintainer).\n"
"Elias Norberg <elno0959 at student.su.se>, 2009.\n"
@@ -493,6 +493,7 @@ void AboutBox::initStrings() {
"Ilia Penev <lichopicho@gmail.com>, 2006.\n"
"Ivan Masár <helix84@centrum.sk>, 2006-2010. \n"
"Iñaki Larrañaga <dooteo@euskalgnu.org>, 2006.\n"
+"Jānis Eisaks <jancs@dv.lv>, 2012, 2013.\n"
"Jeffrey Steve Borbón Sanabria <jeff_kerokid@yahoo.com>, 2005.\n"
"Jesper Öqvist <jesper@llbit.se>, 2010, 2011.\n"
"Joaquim Perez i Noguer <noguer@gmail.com>, 2008-2009.\n"
@@ -514,16 +515,16 @@ void AboutBox::initStrings() {
"Kingsley Turner <kingsley@maddogsbreakfast.com.au>, 2006.\n"
"Kitae <bluetux@gmail.com>, 2006.\n"
"Kjartan Maraas <kmaraas@gnome.org>, 2000-2002.\n"
-"Kris De Gussem <kris.DeGussem@gmail.com>, 2008-2011.\n"
+"Kris De Gussem <Kris.DeGussem@gmail.com>, 2008-2013.\n"
"Lauris Kaplinski <lauris@ariman.ee>, 2000.\n"
"Leandro Regueiro <leandro.regueiro@gmail.com>, 2006-2008, 2010.\n"
"Liu Xiaoqin <liuxqsmile@gmail.com>, 2008.\n"
"Luca Bruno <luca.br@uno.it>, 2005.\n"
-"Lucas Vieites Fariña<lucas@codexion.com>, 2003-2010.\n"
+"Lucas Vieites Fariña<lucas@codexion.com>, 2003-2013.\n"
"Mahesh subedi <submanesh@hotmail.com>, 2006.\n"
"Martin Srebotnjak, <miles@filmsi.net>, 2005, 2010.\n"
"Masatake YAMATO <jet@gyve.org>, 2002.\n"
-"Masato Hashimoto <cabezon.hashimoto@gmail.com>, 2009-2011.\n"
+"Masato Hashimoto <cabezon.hashimoto@gmail.com>, 2009-2012.\n"
"Matiphas <matiphas _a_ free _point_ fr>, 2004-2006.\n"
"Mattias Hultgren <mattias_hultgren@tele2.se>, 2005, 2006.\n"
"Maxim Dziumanenko <mvd@mylinux.com.ua>, 2004.\n"
@@ -534,7 +535,7 @@ void AboutBox::initStrings() {
"Muhammad Bashir Al-Noimi <mhdbnoimi@gmail.com>, 2008.\n"
"Myckel Habets <myckel@sdf.lonestar.org>, 2008.\n"
"Nguyen Dinh Trung <nguyendinhtrung141@gmail.com>, 2007, 2008.\n"
-"Nicolas Dufour <nicoduf@yahoo.fr>, 2008-2011.\n"
+"Nicolas Dufour <nicoduf@yahoo.fr>, 2008-2013.\n"
"Pawan Chitrakar <pchitrakar@gmail.com>, 2006.\n"
"Przemysław Loesch <p_loesch@poczta.onet.pl>, 2005.\n"
"Quico Llach <quico@softcatala.org>, 2000. Traducció sodipodi.\n"
@@ -555,7 +556,7 @@ void AboutBox::initStrings() {
"Thiago Pimentel <thiago.merces@gmail.com>, 2006.\n"
"Toshifumi Sato <sato@centrosystem.com>, 2005.\n"
"Jon South <striker@lunar-linux.org>, 2006. \n"
-"Uwe Schöler <oss@oss-marketplace.com>, 2006-2011.\n"
+"Uwe Schöler <oss@oss-marketplace.com>, 2006-2013.\n"
"Valek Filippov <frob@df.ru>, 2000, 2003.\n"
"Victor Dachev <vdachev@gmail.com>, 2006.\n"
"Vincent van Adrighem <V.vanAdrighem@dirck.mine.nu>, 2003.\n"
@@ -570,7 +571,7 @@ void AboutBox::initStrings() {
"Yaron Shahrabani <sh.yaron@gmail.com>, 2009.\n"
"Yukihiro Nakai <nakai@gnome.gr.jp>, 2000, 2003.\n"
"Yuri Beznos <zhiz0id@gmail.com>, 2006.\n"
-"Yuri Chornoivan <yurchor@ukr.net>, 2007-2011.\n"
+"Yuri Chornoivan <yurchor@ukr.net>, 2007-2013.\n"
"Yuri Syrota <rasta@renome.rovno.ua>, 2000.\n"
"Yves Guillou <yvesguillou@users.sourceforge.net>, 2004.\n"
"Zdenko Podobný <zdpo@mailbox.sk>, 2003, 2004."
diff --git a/src/ui/dialog/calligraphic-profile-rename.cpp b/src/ui/dialog/calligraphic-profile-rename.cpp
index da43763c8..9ae22db2d 100644
--- a/src/ui/dialog/calligraphic-profile-rename.cpp
+++ b/src/ui/dialog/calligraphic-profile-rename.cpp
@@ -13,14 +13,16 @@
* Released under GNU GPL. Read the file 'COPYING' for more information
*/
-#ifdef HAVE_CONFIG_H
-# include <config.h>
-#endif
-
#include "calligraphic-profile-rename.h"
#include <glibmm/i18n.h>
#include <gtkmm/stock.h>
+#if WITH_GTKMM_3_0
+# include <gtkmm/grid.h>
+#else
+# include <gtkmm/table.h>
+#endif
+
#include "desktop.h"
namespace Inkscape {
@@ -28,29 +30,42 @@ namespace UI {
namespace Dialog {
CalligraphicProfileRename::CalligraphicProfileRename() :
+#if WITH_GTKMM_3_0
+ _layout_table(Gtk::manage(new Gtk::Grid())),
+#else
+ _layout_table(Gtk::manage(new Gtk::Table(1, 2))),
+#endif
_applied(false)
{
set_title(_("Edit profile"));
#if WITH_GTKMM_3_0
Gtk::Box *mainVBox = get_content_area();
+ _layout_table->set_column_spacing(4);
+ _layout_table->set_row_spacing(4);
#else
Gtk::Box *mainVBox = get_vbox();
+ _layout_table->set_spacings(4);
#endif
- _layout_table.set_spacings(4);
- _layout_table.resize (1, 2);
-
_profile_name_entry.set_activates_default(true);
_profile_name_label.set_label(_("Profile name:"));
_profile_name_label.set_alignment(1.0, 0.5);
- _layout_table.attach(_profile_name_label,
+#if WITH_GTKMM_3_0
+ _layout_table->attach(_profile_name_label, 0, 0, 1, 1);
+
+ _profile_name_entry.set_hexpand();
+ _layout_table->attach(_profile_name_entry, 1, 0, 1, 1);
+#else
+ _layout_table->attach(_profile_name_label,
0, 1, 0, 1, Gtk::FILL, Gtk::FILL);
- _layout_table.attach(_profile_name_entry,
+ _layout_table->attach(_profile_name_entry,
1, 2, 0, 1, Gtk::FILL | Gtk::EXPAND, Gtk::FILL);
- mainVBox->pack_start(_layout_table, false, false, 4);
+#endif
+
+ mainVBox->pack_start(*_layout_table, false, false, 4);
// Buttons
_close_button.set_use_stock(true);
_close_button.set_label(Gtk::Stock::CANCEL.id);
diff --git a/src/ui/dialog/calligraphic-profile-rename.h b/src/ui/dialog/calligraphic-profile-rename.h
index 8fe82d7bb..4ef71900b 100644
--- a/src/ui/dialog/calligraphic-profile-rename.h
+++ b/src/ui/dialog/calligraphic-profile-rename.h
@@ -11,10 +11,22 @@
#ifndef INKSCAPE_DIALOG_CALLIGRAPHIC_PROFILE_H
#define INKSCAPE_DIALOG_CALLIGRAPHIC_PROFILE_H
+#if HAVE_CONFIG_H
+# include "config.h"
+#endif
+
#include <gtkmm/dialog.h>
#include <gtkmm/entry.h>
#include <gtkmm/label.h>
-#include <gtkmm/table.h>
+
+namespace Gtk {
+#if WITH_GTKMM_3_0
+class Grid;
+#else
+class Table;
+#endif
+}
+
class SPDesktop;
namespace Inkscape {
@@ -47,7 +59,13 @@ protected:
Gtk::Label _profile_name_label;
Gtk::Entry _profile_name_entry;
- Gtk::Table _layout_table;
+
+#if WITH_GTKMM_3_0
+ Gtk::Grid* _layout_table;
+#else
+ Gtk::Table* _layout_table;
+#endif
+
Gtk::Button _close_button;
Gtk::Button _delete_button;
Gtk::Button _apply_button;
diff --git a/src/ui/dialog/export.h b/src/ui/dialog/export.h
index c8376cdcb..c5782fabc 100644
--- a/src/ui/dialog/export.h
+++ b/src/ui/dialog/export.h
@@ -24,7 +24,6 @@
#include "ui/widget/panel.h"
#include "ui/widget/button.h"
#include "ui/widget/entry.h"
-#include "widgets/sp-attribute-widget.h"
namespace Inkscape {
namespace UI {
diff --git a/src/ui/dialog/filter-effects-dialog.cpp b/src/ui/dialog/filter-effects-dialog.cpp
index fd368ed9f..989c40264 100644
--- a/src/ui/dialog/filter-effects-dialog.cpp
+++ b/src/ui/dialog/filter-effects-dialog.cpp
@@ -313,9 +313,15 @@ public:
set_tooltip_text(tip_text);
}
+#if WITH_GTKMM_3_0
+ Gdk::RGBA col;
+ col.set_rgba_u(65535, 65535, 65535);
+ set_rgba(col);
+#else
Gdk::Color col;
col.set_rgb(65535, 65535, 65535);
set_color(col);
+#endif
}
// Returns the color in 'rgb(r,g,b)' form.
@@ -323,8 +329,14 @@ public:
{
// no doubles here, so we can use the standard string stream.
std::ostringstream os;
+
+#if WITH_GTKMM_3_0
+ const Gdk::RGBA c = get_rgba();
+ const int r = c.get_red_u() / 257, g = c.get_green_u() / 257, b = c.get_blue_u() / 257;//TO-DO: verify this. This sounds a lot strange! shouldn't it be 256?
+#else
const Gdk::Color c = get_color();
const int r = c.get_red() / 257, g = c.get_green() / 257, b = c.get_blue() / 257;//TO-DO: verify this. This sounds a lot strange! shouldn't it be 256?
+#endif
os << "rgb(" << r << "," << g << "," << b << ")";
return os.str();
}
@@ -340,9 +352,16 @@ public:
i = (guint32) get_default()->as_uint();
}
const int r = SP_RGBA32_R_U(i), g = SP_RGBA32_G_U(i), b = SP_RGBA32_B_U(i);
+
+#if WITH_GTKMM_3_0
+ Gdk::RGBA col;
+ col.set_rgba_u(r * 256, g * 256, b * 256);
+ set_rgba(col);
+#else
Gdk::Color col;
col.set_rgb(r * 256, g * 256, b * 256);
set_color(col);
+#endif
}
};
diff --git a/src/ui/dialog/guides.cpp b/src/ui/dialog/guides.cpp
index 06671393d..51bbc7d9a 100644
--- a/src/ui/dialog/guides.cpp
+++ b/src/ui/dialog/guides.cpp
@@ -70,9 +70,15 @@ void GuidelinePropertiesDialog::showDialog(SPGuide *guide, SPDesktop *desktop) {
void GuidelinePropertiesDialog::_colorChanged()
{
+#if WITH_GTKMM_3_0
+ const Gdk::RGBA c = _color.get_rgba();
+ unsigned r = c.get_red_u()/257, g = c.get_green_u()/257, b = c.get_blue_u()/257;
+#else
const Gdk::Color c = _color.get_color();
unsigned r = c.get_red()/257, g = c.get_green()/257, b = c.get_blue()/257;
+#endif
//TODO: why 257? verify this!
+
sp_guide_set_color(*_guide, r, g, b, true);
}
@@ -328,9 +334,16 @@ void GuidelinePropertiesDialog::_setup() {
// init name entry
_label_entry.getEntry()->set_text(_guide->label ? _guide->label : "");
+
+#if WITH_GTKMM_3_0
+ Gdk::RGBA c;
+ c.set_rgba(((_guide->color>>24)&0xff) / 255.0, ((_guide->color>>16)&0xff) / 255.0, ((_guide->color>>8)&0xff) / 255.0);
+ _color.set_rgba(c);
+#else
Gdk::Color c;
c.set_rgb_p(((_guide->color>>24)&0xff) / 255.0, ((_guide->color>>16)&0xff) / 255.0, ((_guide->color>>8)&0xff) / 255.0);
_color.set_color(c);
+#endif
_modeChanged(); // sets values of spinboxes.
diff --git a/src/ui/dialog/inkscape-preferences.cpp b/src/ui/dialog/inkscape-preferences.cpp
index c63b78c70..fb814e066 100644
--- a/src/ui/dialog/inkscape-preferences.cpp
+++ b/src/ui/dialog/inkscape-preferences.cpp
@@ -799,10 +799,17 @@ static void proofComboChanged( Gtk::ComboBoxText* combo )
}
static void gamutColorChanged( Gtk::ColorButton* btn ) {
+#if WITH_GTKMM_3_0
+ Gdk::RGBA rgba = btn->get_rgba();
+ gushort r = rgba.get_red_u();
+ gushort g = rgba.get_green_u();
+ gushort b = rgba.get_blue_u();
+#else
Gdk::Color color = btn->get_color();
gushort r = color.get_red();
gushort g = color.get_green();
gushort b = color.get_blue();
+#endif
gchar* tmp = g_strdup_printf("#%02x%02x%02x", (r >> 8), (g >> 8), (b >> 8) );
@@ -967,8 +974,15 @@ void InkscapePreferences::initPageIO()
_("Highlights colors that are out of gamut for the target device"), false);
Glib::ustring colorStr = prefs->getString("/options/softproof/gamutcolor");
+
+#if WITH_GTKMM_3_0
+ Gdk::RGBA tmpColor( colorStr.empty() ? "#00ff00" : colorStr);
+ _cms_gamutcolor.set_rgba( tmpColor );
+#else
Gdk::Color tmpColor( colorStr.empty() ? "#00ff00" : colorStr);
_cms_gamutcolor.set_color( tmpColor );
+#endif
+
_page_cms.add_line( true, _("Out of gamut warning color:"), _cms_gamutcolor, "",
_("Selects the color used for out of gamut warning"), false);
diff --git a/src/ui/dialog/object-attributes.cpp b/src/ui/dialog/object-attributes.cpp
index 1ae9730d5..3d780fa83 100644
--- a/src/ui/dialog/object-attributes.cpp
+++ b/src/ui/dialog/object-attributes.cpp
@@ -30,6 +30,7 @@
#include "xml/repr.h"
#include "ui/dialog/dialog-manager.h"
#include "ui/dialog/object-attributes.h"
+#include "widgets/sp-attribute-widget.h"
#include "inkscape.h"
#include "selection.h"
@@ -81,14 +82,14 @@ ObjectAttributes::ObjectAttributes (void) :
UI::Widget::Panel ("", "/dialogs/objectattr/", SP_VERB_DIALOG_ATTR),
blocked (false),
CurrentItem(NULL),
- attrTable(),
+ attrTable(Gtk::manage(new SPAttributeTable())),
desktop(NULL),
deskTrack(),
selectChangedConn(),
subselChangedConn(),
selectModifiedConn()
{
- attrTable.show();
+ attrTable->show();
widget_setup();
desktopChangeConn = deskTrack.connectDesktopChanged( sigc::mem_fun(*this, &ObjectAttributes::setTargetDesktop) );
@@ -163,12 +164,12 @@ void ObjectAttributes::widget_setup (void)
attrs.push_back (desc[len].attribute);
len += 1;
}
- attrTable.set_object(obj, labels, attrs, (GtkWidget*)gobj());
+ attrTable->set_object(obj, labels, attrs, (GtkWidget*)gobj());
CurrentItem = item;
}
else
{
- attrTable.change_object(obj);
+ attrTable->change_object(obj);
}
set_sensitive (true);
@@ -201,7 +202,7 @@ void ObjectAttributes::selectionModifiedCB( guint flags )
if (flags & ( SP_OBJECT_MODIFIED_FLAG |
SP_OBJECT_PARENT_MODIFIED_FLAG |
SP_OBJECT_STYLE_MODIFIED_FLAG) ) {
- attrTable.reread_properties();
+ attrTable->reread_properties();
}
}
diff --git a/src/ui/dialog/object-attributes.h b/src/ui/dialog/object-attributes.h
index 81467dea6..b0d02a0af 100644
--- a/src/ui/dialog/object-attributes.h
+++ b/src/ui/dialog/object-attributes.h
@@ -28,7 +28,8 @@
#include "desktop.h"
#include "ui/dialog/desktop-tracker.h"
#include "ui/widget/panel.h"
-#include "widgets/sp-attribute-widget.h"
+
+class SPAttributeTable;
namespace Inkscape {
namespace UI {
@@ -72,7 +73,7 @@ private:
* in the SPAttrDesc arrays at the top of the cpp-file. This widgets also
* ensures object attribute modifications by the user are set.
*/
- SPAttributeTable attrTable;
+ SPAttributeTable *attrTable;
/**
* Stores the current desktop.
diff --git a/src/ui/dialog/object-properties.cpp b/src/ui/dialog/object-properties.cpp
index 0800346f7..114204961 100644
--- a/src/ui/dialog/object-properties.cpp
+++ b/src/ui/dialog/object-properties.cpp
@@ -26,11 +26,8 @@
* Abhishek Sharma
*/
-#ifdef HAVE_CONFIG_H
-# include "config.h"
-#endif
-
#include "object-properties.h"
+#include "widgets/sp-attribute-widget.h"
#include "../../desktop-handles.h"
#include "../../document.h"
#include "../../document-undo.h"
@@ -50,19 +47,27 @@ ObjectProperties::ObjectProperties (void) :
UI::Widget::Panel ("", "/dialogs/object/", SP_VERB_DIALOG_ITEM),
blocked (false),
CurrentItem(NULL),
- TopTable (3, 4, false),
+#if WITH_GTKMM_3_0
+ TopTable(Gtk::manage(new Gtk::Grid())),
+#else
+ TopTable(Gtk::manage(new Gtk::Table(3, 4))),
+#endif
LabelID(_("_ID:"), 1),
LabelLabel(_("_Label:"), 1),
LabelTitle(_("_Title:"),1),
LabelDescription(_("_Description:"),1),
FrameDescription("", FALSE),
HBoxCheck(FALSE, 0),
- CheckTable(1, 2, TRUE),
+#if WITH_GTKMM_3_0
+ CheckTable(Gtk::manage(new Gtk::Grid())),
+#else
+ CheckTable(Gtk::manage(new Gtk::Table(1, 2, true))),
+#endif
CBHide(_("_Hide"), 1),
CBLock(_("L_ock"), 1),
BSet (_("_Set"), 1),
LabelInteractivity(_("_Interactivity"), 1),
- attrTable(),
+ attrTable(Gtk::manage(new SPAttributeTable())),
desktop(NULL),
deskTrack(),
selectChangedConn(),
@@ -91,6 +96,11 @@ ObjectProperties::ObjectProperties (void) :
desktopChangeConn = deskTrack.connectDesktopChanged( sigc::mem_fun(*this, &ObjectProperties::setTargetDesktop) );
deskTrack.connect(GTK_WIDGET(gobj()));
+
+#if WITH_GTKMM_3_0
+ CheckTable->set_row_homogeneous();
+ CheckTable->set_column_homogeneous(true);
+#endif
MakeWidget();
}
@@ -108,24 +118,44 @@ void ObjectProperties::MakeWidget(void)
Gtk::Box *contents = _getContents();
contents->set_spacing(0);
- TopTable.set_border_width(4);
- TopTable.set_row_spacings(4);
- TopTable.set_col_spacings(0);
- contents->pack_start (TopTable, false, false, 0);
+ TopTable->set_border_width(4);
+
+#if WITH_GTKMM_3_0
+ TopTable->set_row_spacing(4);
+ TopTable->set_column_spacing(0);
+#else
+ TopTable->set_row_spacings(4);
+ TopTable->set_col_spacings(0);
+#endif
+
+ contents->pack_start (*TopTable, false, false, 0);
/* Create the label for the object id */
LabelID.set_label (LabelID.get_label() + " ");
LabelID.set_alignment (1, 0.5);
- TopTable.attach (LabelID, 0, 1, 0, 1,
- Gtk::SHRINK | Gtk::FILL,
- Gtk::AttachOptions(), 0, 0 );
+
+#if WITH_GTKMM_3_0
+ LabelID.set_valign(Gtk::ALIGN_CENTER);
+ TopTable->attach(LabelID, 0, 0, 1, 1);
+#else
+ TopTable->attach(LabelID, 0, 1, 0, 1,
+ Gtk::SHRINK | Gtk::FILL,
+ Gtk::AttachOptions(), 0, 0 );
+#endif
/* Create the entry box for the object id */
EntryID.set_tooltip_text (_("The id= attribute (only letters, digits, and the characters .-_: allowed)"));
EntryID.set_max_length (64);
- TopTable.attach (EntryID, 1, 2, 0, 1,
- Gtk::EXPAND | Gtk::FILL,
- Gtk::AttachOptions(), 0, 0 );
+
+#if WITH_GTKMM_3_0
+ EntryID.set_valign(Gtk::ALIGN_CENTER);
+ TopTable->attach(EntryID, 1, 0, 1, 1);
+#else
+ TopTable->attach(EntryID, 1, 2, 0, 1,
+ Gtk::EXPAND | Gtk::FILL,
+ Gtk::AttachOptions(), 0, 0 );
+#endif
+
LabelID.set_mnemonic_widget (EntryID);
// pressing enter in the id field is the same as clicking Set:
@@ -136,16 +166,30 @@ void ObjectProperties::MakeWidget(void)
/* Create the label for the object label */
LabelLabel.set_label (LabelLabel.get_label() + " ");
LabelLabel.set_alignment (1, 0.5);
- TopTable.attach (LabelLabel, 0, 1, 1, 2,
- Gtk::SHRINK | Gtk::FILL,
- Gtk::AttachOptions(), 0, 0 );
+
+#if WITH_GTKMM_3_0
+ LabelLabel.set_valign(Gtk::ALIGN_CENTER);
+ TopTable->attach(LabelLabel, 0, 1, 1, 1);
+#else
+ TopTable->attach(LabelLabel, 0, 1, 1, 2,
+ Gtk::SHRINK | Gtk::FILL,
+ Gtk::AttachOptions(), 0, 0 );
+#endif
/* Create the entry box for the object label */
EntryLabel.set_tooltip_text (_("A freeform label for the object"));
EntryLabel.set_max_length (256);
- TopTable.attach (EntryLabel, 1, 2, 1, 2,
- Gtk::EXPAND | Gtk::FILL,
- Gtk::AttachOptions(), 0, 0 );
+
+#if WITH_GTKMM_3_0
+ EntryLabel.set_hexpand();
+ EntryLabel.set_valign(Gtk::ALIGN_CENTER);
+ TopTable->attach(EntryLabel, 1, 1, 1, 1);
+#else
+ TopTable->attach(EntryLabel, 1, 2, 1, 2,
+ Gtk::EXPAND | Gtk::FILL,
+ Gtk::AttachOptions(), 0, 0 );
+#endif
+
LabelLabel.set_mnemonic_widget (EntryLabel);
// pressing enter in the label field is the same as clicking Set:
@@ -154,16 +198,30 @@ void ObjectProperties::MakeWidget(void)
/* Create the label for the object title */
LabelTitle.set_label (LabelTitle.get_label() + " ");
LabelTitle.set_alignment (1, 0.5);
- TopTable.attach (LabelTitle, 0, 1, 2, 3,
- Gtk::SHRINK | Gtk::FILL,
- Gtk::AttachOptions(), 0, 0 );
+
+#if WITH_GTKMM_3_0
+ LabelTitle.set_valign(Gtk::ALIGN_CENTER);
+ TopTable->attach(LabelTitle, 0, 2, 1, 1);
+#else
+ TopTable->attach(LabelTitle, 0, 1, 2, 3,
+ Gtk::SHRINK | Gtk::FILL,
+ Gtk::AttachOptions(), 0, 0 );
+#endif
/* Create the entry box for the object title */
EntryTitle.set_sensitive (FALSE);
EntryTitle.set_max_length (256);
- TopTable.attach (EntryTitle, 1, 2, 2, 3,
- Gtk::EXPAND | Gtk::FILL,
- Gtk::AttachOptions(), 0, 0 );
+
+#if WITH_GTKMM_3_0
+ EntryTitle.set_hexpand();
+ EntryTitle.set_valign(Gtk::ALIGN_CENTER);
+ TopTable->attach(EntryTitle, 1, 2, 1, 1);
+#else
+ TopTable->attach(EntryTitle, 1, 2, 2, 3,
+ Gtk::EXPAND | Gtk::FILL,
+ Gtk::AttachOptions(), 0, 0 );
+#endif
+
LabelTitle.set_mnemonic_widget (EntryTitle);
// pressing enter in the label field is the same as clicking Set:
EntryTitle.signal_activate().connect(sigc::mem_fun(this, &ObjectProperties::label_changed));
@@ -186,29 +244,52 @@ void ObjectProperties::MakeWidget(void)
/* Check boxes */
contents->pack_start (HBoxCheck, FALSE, FALSE, 0);
- CheckTable.set_border_width(4);
- HBoxCheck.pack_start (CheckTable, TRUE, TRUE, 0);
+ CheckTable->set_border_width(4);
+ HBoxCheck.pack_start(*CheckTable, true, true, 0);
/* Hide */
CBHide.set_tooltip_text (_("Check to make the object invisible"));
- CheckTable.attach (CBHide, 0, 1, 0, 1,
+
+#if WITH_GTKMM_3_0
+ CBHide.set_hexpand();
+ CBHide.set_valign(Gtk::ALIGN_CENTER);
+ CheckTable->attach(CBHide, 0, 0, 1, 1);
+#else
+ CheckTable->attach(CBHide, 0, 1, 0, 1,
Gtk::EXPAND | Gtk::FILL,
Gtk::AttachOptions(), 0, 0 );
+#endif
+
CBHide.signal_toggled().connect(sigc::mem_fun(this, &ObjectProperties::hidden_toggled));
/* Lock */
// TRANSLATORS: "Lock" is a verb here
CBLock.set_tooltip_text (_("Check to make the object insensitive (not selectable by mouse)"));
- CheckTable.attach (CBLock, 1, 2, 0, 1,
+
+#if WITH_GTKMM_3_0
+ CBLock.set_hexpand();
+ CBLock.set_valign(Gtk::ALIGN_CENTER);
+ CheckTable->attach(CBLock, 1, 0, 1, 1);
+#else
+ CheckTable->attach(CBLock, 1, 2, 0, 1,
Gtk::EXPAND | Gtk::FILL,
Gtk::AttachOptions(), 0, 0 );
+#endif
+
CBLock.signal_toggled().connect(sigc::mem_fun(this, &ObjectProperties::sensitivity_toggled));
/* Button for setting the object's id, label, title and description. */
- CheckTable.attach (BSet, 2, 3, 0, 1,
+#if WITH_GTKMM_3_0
+ BSet.set_hexpand();
+ BSet.set_valign(Gtk::ALIGN_CENTER);
+ CheckTable->attach(BSet, 2, 0, 1, 1);
+#else
+ CheckTable->attach(BSet, 2, 3, 0, 1,
Gtk::EXPAND | Gtk::FILL,
Gtk::AttachOptions(), 0, 0 );
+#endif
+
BSet.signal_clicked().connect(sigc::mem_fun(this, &ObjectProperties::label_changed));
/* Create the frame for interactivity options */
@@ -237,7 +318,7 @@ void ObjectProperties::widget_setup(void)
CurrentItem = NULL;
//no selection anymore or multiple objects selected, means that we need
//to close the connections to the previously selected object
- attrTable.clear();
+ attrTable->clear();
return;
} else {
contents->set_sensitive (true);
@@ -301,13 +382,13 @@ void ObjectProperties::widget_setup(void)
if (CurrentItem == NULL)
{
- attrTable.set_object(obj, int_labels, int_attrs, (GtkWidget*)EInteractivity.gobj());
+ attrTable->set_object(obj, int_labels, int_attrs, (GtkWidget*)EInteractivity.gobj());
}
else
{
- attrTable.change_object(obj);
+ attrTable->change_object(obj);
}
- attrTable.show_all();
+ attrTable->show_all();
}
CurrentItem = item;
blocked = false;
diff --git a/src/ui/dialog/object-properties.h b/src/ui/dialog/object-properties.h
index a04c62bec..b49293ea1 100644
--- a/src/ui/dialog/object-properties.h
+++ b/src/ui/dialog/object-properties.h
@@ -29,6 +29,10 @@
#ifndef SEEN_DIALOGS_ITEM_PROPERTIES_H
#define SEEN_DIALOGS_ITEM_PROPERTIES_H
+#ifdef HAVE_CONFIG_H
+# include "config.h"
+#endif
+
#include "ui/widget/panel.h"
#include "ui/widget/frame.h"
#include <gtkmm/entry.h>
@@ -37,8 +41,8 @@
#include <gtkmm/textview.h>
#include "ui/dialog/desktop-tracker.h"
-#include "widgets/sp-attribute-widget.h"
+class SPAttributeTable;
class SPDesktop;
class SPItem;
@@ -70,7 +74,12 @@ private:
std::vector<Glib::ustring> int_attrs;
std::vector<Glib::ustring> int_labels;
- Gtk::Table TopTable; //the table with the object properties
+#if WITH_GTKMM_3_0
+ Gtk::Grid *TopTable; //the table with the object properties
+#else
+ Gtk::Table *TopTable; //the table with the object properties
+#endif
+
Gtk::Label LabelID; //the label for the object ID
Gtk::Entry EntryID; //the entry for the object ID
Gtk::Label LabelLabel; //the label for the object label
@@ -84,14 +93,20 @@ private:
Gtk::TextView TextViewDescription; //the text view object showing the object description
Gtk::HBox HBoxCheck; // the HBox for the check boxes
- Gtk::Table CheckTable; //the table for the check boxes
+
+#if WITH_GTKMM_3_0
+ Gtk::Grid *CheckTable; //the table for the check boxes
+#else
+ Gtk::Table *CheckTable; //the table for the check boxes
+#endif
+
Gtk::CheckButton CBHide; //the check button hide
Gtk::CheckButton CBLock; //the check button lock
Gtk::Button BSet; //the button set
Gtk::Label LabelInteractivity; //the label for interactivity
Gtk::Expander EInteractivity; //the label for interactivity
- SPAttributeTable attrTable; //the widget for showing the on... names at the bottom
+ SPAttributeTable *attrTable; //the widget for showing the on... names at the bottom
SPDesktop *desktop;
DesktopTracker deskTrack;
diff --git a/src/ui/dialog/swatches.cpp b/src/ui/dialog/swatches.cpp
index 71fee342a..90cb1cdc9 100644
--- a/src/ui/dialog/swatches.cpp
+++ b/src/ui/dialog/swatches.cpp
@@ -1179,9 +1179,6 @@ void SwatchesPanel::_rebuild()
_holder->thawUpdates();
}
-
-
-
} //namespace Dialogs
} //namespace UI
} //namespace Inkscape
diff --git a/src/ui/previewholder.cpp b/src/ui/previewholder.cpp
index 0b280ccb9..b5a1a29a8 100644
--- a/src/ui/previewholder.cpp
+++ b/src/ui/previewholder.cpp
@@ -19,6 +19,12 @@
#include <gtkmm/scrollbar.h>
#include <gtkmm/adjustment.h>
+#if WITH_GTKMM_3_0
+# include <gtkmm/grid.h>
+#else
+# include <gtkmm/table.h>
+#endif
+
#define COLUMNS_FOR_SMALL 16
#define COLUMNS_FOR_LARGE 8
//#define COLUMNS_FOR_SMALL 48
@@ -44,13 +50,31 @@ PreviewHolder::PreviewHolder() :
_border(BORDER_NONE)
{
_scroller = manage(new Gtk::ScrolledWindow());
+
+#if WITH_GTKMM_3_0
+ _insides = manage(new Gtk::Grid());
+ _insides->set_column_spacing(8);
+
+ // Add a container with the scroller and a spacer
+ Gtk::Grid* spaceHolder = manage(new Gtk::Grid());
+
+ _scroller->set_hexpand();
+ _scroller->set_vexpand();
+#else
_insides = manage(new Gtk::Table( 1, 2 ));
_insides->set_col_spacings( 8 );
-
+
// Add a container with the scroller and a spacer
Gtk::Table* spaceHolder = manage( new Gtk::Table(1, 2) );
+#endif
+
_scroller->add( *_insides );
+
+#if WITH_GTKMM_3_0
+ spaceHolder->attach( *_scroller, 0, 0, 1, 1);
+#else
spaceHolder->attach( *_scroller, 0, 1, 0, 1, Gtk::FILL|Gtk::EXPAND, Gtk::FILL|Gtk::EXPAND );
+#endif
pack_start(*spaceHolder, Gtk::PACK_EXPAND_WIDGET);
}
@@ -93,6 +117,11 @@ void PreviewHolder::clear()
rebuildUI();
}
+/**
+ * Add a Previewable item to the PreviewHolder
+ *
+ * \param[in] preview The Previewable item to add
+ */
void PreviewHolder::addPreview( Previewable* preview )
{
items.push_back(preview);
@@ -100,41 +129,78 @@ void PreviewHolder::addPreview( Previewable* preview )
{
int i = items.size() - 1;
- if ( _view == VIEW_TYPE_LIST ) {
- Gtk::Widget* label = manage(preview->getPreview(PREVIEW_STYLE_BLURB, VIEW_TYPE_LIST, _baseSize, _ratio, _border));
- Gtk::Widget* thing = manage(preview->getPreview(PREVIEW_STYLE_PREVIEW, VIEW_TYPE_LIST, _baseSize, _ratio, _border));
+ switch(_view) {
+ case VIEW_TYPE_LIST:
+ {
+ Gtk::Widget* label = manage(preview->getPreview(PREVIEW_STYLE_BLURB, VIEW_TYPE_LIST, _baseSize, _ratio, _border));
+ Gtk::Widget* thing = manage(preview->getPreview(PREVIEW_STYLE_PREVIEW, VIEW_TYPE_LIST, _baseSize, _ratio, _border));
- _insides->attach( *thing, 0, 1, i, i+1, Gtk::FILL|Gtk::EXPAND, Gtk::FILL|Gtk::EXPAND );
- _insides->attach( *label, 1, 2, i, i+1, Gtk::FILL|Gtk::EXPAND, Gtk::SHRINK );
- } else {
- Gtk::Widget* thing = manage(items[i]->getPreview(PREVIEW_STYLE_PREVIEW, VIEW_TYPE_GRID, _baseSize, _ratio, _border));
-
- int width = 1;
- int height = 1;
- calcGridSize( thing, items.size(), width, height );
- int col = i % width;
- int row = i / width;
-
- if ( _insides && width > (int)_insides->property_n_columns() ) {
- std::vector<Gtk::Widget*>kids = _insides->get_children();
- int oldWidth = (int)_insides->property_n_columns();
- int childCount = (int)kids.size();
-// g_message(" %3d resize from %d to %d (r:%d, c:%d) with %d children", i, oldWidth, width, row, col, childCount );
- _insides->resize( height, width );
-
- for ( int j = oldWidth; j < childCount; j++ ) {
- Gtk::Widget* target = kids[childCount - (j + 1)];
- int col2 = j % width;
- int row2 = j / width;
- Glib::RefPtr<Gtk::Widget> handle(target);
- _insides->remove( *target );
- _insides->attach( *target, col2, col2+1, row2, row2+1, Gtk::FILL|Gtk::EXPAND, Gtk::FILL|Gtk::EXPAND );
+#if WITH_GTKMM_3_0
+ thing->set_hexpand();
+ thing->set_vexpand();
+ _insides->attach(*thing, 0, i, 1, 1);
+
+ label->set_hexpand();
+ label->set_valign(Gtk::ALIGN_CENTER);
+ _insides->attach(*label, 1, i, 1, 1);
+#else
+ _insides->attach( *thing, 0, 1, i, i+1, Gtk::FILL|Gtk::EXPAND, Gtk::FILL|Gtk::EXPAND );
+ _insides->attach( *label, 1, 2, i, i+1, Gtk::FILL|Gtk::EXPAND, Gtk::SHRINK );
+#endif
+ }
+
+ break;
+ case VIEW_TYPE_GRID:
+ {
+ Gtk::Widget* thing = manage(items[i]->getPreview(PREVIEW_STYLE_PREVIEW, VIEW_TYPE_GRID, _baseSize, _ratio, _border));
+
+ int width = 1;
+ int height = 1;
+ calcGridSize( thing, items.size(), width, height );
+
+ // Column and row for the new widget
+ int col = i % width;
+ int row = i / width;
+
+#if !WITH_GTKMM_3_0
+ // If the existing grid isn't wide enough, we need to resize
+ // it and re-pack the existing widgets
+ if ( _insides && width > (int)_insides->property_n_columns() ) {
+ _insides->resize( height, width );
+#endif
+ std::vector<Gtk::Widget*>kids = _insides->get_children();
+ int childCount = (int)kids.size();
+ // g_message(" %3d resize from %d to %d (r:%d, c:%d) with %d children", i, oldWidth, width, row, col, childCount );
+
+ // Loop through the existing widgets and move them to new location
+ for ( int j = 1; j < childCount; j++ ) {
+ Gtk::Widget* target = kids[childCount - (j + 1)];
+ int col2 = j % width;
+ int row2 = j / width;
+ Glib::RefPtr<Gtk::Widget> handle(target);
+ _insides->remove( *target );
+
+#if WITH_GTKMM_3_0
+ target->set_hexpand();
+ target->set_vexpand();
+ _insides->attach( *target, col2, row2, 1, 1);
+#else
+ _insides->attach( *target, col2, col2+1, row2, row2+1, Gtk::FILL|Gtk::EXPAND, Gtk::FILL|Gtk::EXPAND );
+#endif
+ }
+#if WITH_GTKMM_3_0
+ thing->set_hexpand();
+ thing->set_vexpand();
+ _insides->attach(*thing, col, row, 1, 1);
+#else
+ } else if ( col == 0 ) {
+ // we just started a new row
+ _insides->resize( row + 1, width );
+ }
+
+ _insides->attach( *thing, col, col+1, row, row+1, Gtk::FILL|Gtk::EXPAND, Gtk::FILL|Gtk::EXPAND );
+#endif
}
- } else if ( col == 0 ) {
- // we just started a new row
- _insides->resize( row + 1, width );
- }
- _insides->attach( *thing, col, col+1, row, row+1, Gtk::FILL|Gtk::EXPAND, Gtk::FILL|Gtk::EXPAND );
}
_scroller->show_all_children();
@@ -258,8 +324,17 @@ void PreviewHolder::on_size_allocate( Gtk::Allocation& allocation )
// g_message(" items:%d", (int)items.size());
//}
+/**
+ * Calculate the grid side of a preview holder
+ *
+ * \param[in] thing
+ * \param[in] itemCount The number of items to pack into the grid
+ * \param[out] width The width of the grid
+ * \param[out] height The height of the grid
+ */
void PreviewHolder::calcGridSize( const Gtk::Widget* thing, int itemCount, int& width, int& height )
{
+ // Initially set all items in a horizontal row
width = itemCount;
height = 1;
@@ -326,55 +401,104 @@ void PreviewHolder::rebuildUI()
_scroller->remove();
_insides = 0; // remove() call should have deleted the Gtk::Table.
- if ( _view == VIEW_TYPE_LIST ) {
- _insides = manage(new Gtk::Table( 1, 2 ));
- _insides->set_col_spacings( 8 );
- if (_border == BORDER_WIDE) {
- _insides->set_row_spacings( 1 );
- }
+ switch(_view) {
+ case VIEW_TYPE_LIST:
+ {
- for ( unsigned int i = 0; i < items.size(); i++ ) {
- Gtk::Widget* label = manage(items[i]->getPreview(PREVIEW_STYLE_BLURB, _view, _baseSize, _ratio, _border));
- //label->set_alignment(Gtk::ALIGN_LEFT, Gtk::ALIGN_CENTER);
+#if WITH_GTKMM_3_0
+ _insides = manage(new Gtk::Grid());
+ _insides->set_column_spacing(8);
+#else
+ _insides = manage(new Gtk::Table( 1, 2 ));
+ _insides->set_col_spacings( 8 );
+#endif
- Gtk::Widget* thing = manage(items[i]->getPreview(PREVIEW_STYLE_PREVIEW, _view, _baseSize, _ratio, _border));
+ if (_border == BORDER_WIDE) {
+#if WITH_GTKMM_3_0
+ _insides->set_row_spacing(1);
+#else
+ _insides->set_row_spacings( 1 );
+#endif
+ }
- _insides->attach( *thing, 0, 1, i, i+1, Gtk::FILL|Gtk::EXPAND, Gtk::FILL|Gtk::EXPAND );
- _insides->attach( *label, 1, 2, i, i+1, Gtk::FILL|Gtk::EXPAND, Gtk::SHRINK );
- }
- _scroller->add( *_insides );
- } else {
- int col = 0;
- int row = 0;
- int width = 2;
- int height = 1;
+ for ( unsigned int i = 0; i < items.size(); i++ ) {
+ Gtk::Widget* label = manage(items[i]->getPreview(PREVIEW_STYLE_BLURB, _view, _baseSize, _ratio, _border));
+ //label->set_alignment(Gtk::ALIGN_LEFT, Gtk::ALIGN_CENTER);
- for ( unsigned int i = 0; i < items.size(); i++ ) {
+ Gtk::Widget* thing = manage(items[i]->getPreview(PREVIEW_STYLE_PREVIEW, _view, _baseSize, _ratio, _border));
- // If this is the last row, flag so the previews can draw a bottom
- ::BorderStyle border = ((row == height -1) && (_border == BORDER_SOLID)) ? BORDER_SOLID_LAST_ROW : _border;
- Gtk::Widget* thing = manage(items[i]->getPreview(PREVIEW_STYLE_PREVIEW, _view, _baseSize, _ratio, border));
+#if WITH_GTKMM_3_0
+ thing->set_hexpand();
+ thing->set_vexpand();
+ _insides->attach(*thing, 0, i, 1, 1);
- if ( !_insides ) {
- calcGridSize( thing, items.size(), width, height );
- _insides = manage(new Gtk::Table( height, width ));
- if (_border == BORDER_WIDE) {
- _insides->set_col_spacings( 1 );
- _insides->set_row_spacings( 1 );
+ label->set_hexpand();
+ label->set_valign(Gtk::ALIGN_CENTER);
+ _insides->attach(*label, 1, i, 1, 1);
+#else
+ _insides->attach( *thing, 0, 1, i, i+1, Gtk::FILL|Gtk::EXPAND, Gtk::FILL|Gtk::EXPAND );
+ _insides->attach( *label, 1, 2, i, i+1, Gtk::FILL|Gtk::EXPAND, Gtk::SHRINK );
+#endif
}
- }
- _insides->attach( *thing, col, col+1, row, row+1, Gtk::FILL|Gtk::EXPAND, Gtk::FILL|Gtk::EXPAND );
- if ( ++col >= width ) {
- col = 0;
- row++;
+ _scroller->add( *_insides );
}
- }
- if ( !_insides ) {
- _insides = manage(new Gtk::Table( 1, 2 ));
- }
+ break;
- _scroller->add( *_insides );
+ case VIEW_TYPE_GRID:
+ {
+ int col = 0;
+ int row = 0;
+ int width = 2;
+ int height = 1;
+
+ for ( unsigned int i = 0; i < items.size(); i++ ) {
+
+ // If this is the last row, flag so the previews can draw a bottom
+ ::BorderStyle border = ((row == height -1) && (_border == BORDER_SOLID)) ? BORDER_SOLID_LAST_ROW : _border;
+ Gtk::Widget* thing = manage(items[i]->getPreview(PREVIEW_STYLE_PREVIEW, _view, _baseSize, _ratio, border));
+
+ if ( !_insides ) {
+ calcGridSize( thing, items.size(), width, height );
+
+#if WITH_GTKMM_3_0
+ _insides = manage(new Gtk::Grid());
+ if (_border == BORDER_WIDE) {
+ _insides->set_column_spacing(1);
+ _insides->set_row_spacing(1);
+ }
+#else
+ _insides = manage(new Gtk::Table( height, width ));
+ if (_border == BORDER_WIDE) {
+ _insides->set_col_spacings( 1 );
+ _insides->set_row_spacings( 1 );
+ }
+#endif
+ }
+
+#if WITH_GTKMM_3_0
+ thing->set_hexpand();
+ thing->set_vexpand();
+ _insides->attach( *thing, col, row, 1, 1);
+#else
+ _insides->attach( *thing, col, col+1, row, row+1, Gtk::FILL|Gtk::EXPAND, Gtk::FILL|Gtk::EXPAND );
+#endif
+
+ if ( ++col >= width ) {
+ col = 0;
+ row++;
+ }
+ }
+ if ( !_insides ) {
+#if WITH_GTKMM_3_0
+ _insides = manage(new Gtk::Grid());
+#else
+ _insides = manage(new Gtk::Table( 1, 2 ));
+#endif
+ }
+
+ _scroller->add( *_insides );
+ }
}
_scroller->show_all_children();
diff --git a/src/ui/previewholder.h b/src/ui/previewholder.h
index 4c591bfaf..f6d1985cc 100644
--- a/src/ui/previewholder.h
+++ b/src/ui/previewholder.h
@@ -12,10 +12,21 @@
* Released under GNU GPL, read the file 'COPYING' for more information
*/
+#if HAVE_CONFIG_H
+# include "config.h"
+#endif
#include <gtkmm/box.h>
#include <gtkmm/bin.h>
-#include <gtkmm/table.h>
+
+namespace Gtk {
+#if WITH_GTKMM_3_0
+class Grid;
+#else
+class Table;
+#endif
+}
+
#include "previewfillable.h"
#include "../widgets/eek-preview.h"
#include "enums.h"
@@ -56,7 +67,13 @@ private:
std::vector<Previewable*> items;
Gtk::Bin *_scroller;
+
+#if WITH_GTKMM_3_0
+ Gtk::Grid *_insides;
+#else
Gtk::Table *_insides;
+#endif
+
int _prefCols;
bool _updatesFrozen;
SPAnchorType _anchor;
diff --git a/src/ui/widget/selected-style.cpp b/src/ui/widget/selected-style.cpp
index 41d7c8be2..18dbb984b 100644
--- a/src/ui/widget/selected-style.cpp
+++ b/src/ui/widget/selected-style.cpp
@@ -119,8 +119,11 @@ SelectedStyle::SelectedStyle(bool /*layout*/)
current_stroke_width(0),
_desktop (NULL),
-
+#if WITH_GTKMM_3_0
+ _table(),
+#else
_table(2, 6),
+#endif
_fill_label (_("Fill:")),
_stroke_label (_("Stroke:")),
_opacity_label (_("O:")),
@@ -158,8 +161,13 @@ SelectedStyle::SelectedStyle(bool /*layout*/)
_opacity_label.set_alignment(0.0, 0.5);
_opacity_label.set_padding(0, 0);
+#if WITH_GTKMM_3_0
+ _table.set_column_spacing(2);
+ _table.set_row_spacing(0);
+#else
_table.set_col_spacings (2);
_table.set_row_spacings (0);
+#endif
for (int i = SS_FILL; i <= SS_STROKE; i++) {
@@ -361,6 +369,16 @@ SelectedStyle::SelectedStyle(bool /*layout*/)
_opacity_sb.set_size_request (SELECTED_STYLE_SB_WIDTH, -1);
_opacity_sb.set_sensitive (false);
+#if WITH_GTKMM_3_0
+ _table.attach(_fill_label, 0, 0, 1, 1);
+ _table.attach(_stroke_label, 0, 1, 1, 1);
+
+ _table.attach(_fill_flag_place, 1, 0, 1, 1);
+ _table.attach(_stroke_flag_place, 1, 1, 1, 1);
+
+ _table.attach(_fill_place, 2, 0, 1, 1);
+ _table.attach(_stroke, 2, 1, 1, 1);
+#else
_table.attach(_fill_label, 0,1, 0,1, Gtk::FILL, Gtk::SHRINK);
_table.attach(_stroke_label, 0,1, 1,2, Gtk::FILL, Gtk::SHRINK);
@@ -369,10 +387,17 @@ SelectedStyle::SelectedStyle(bool /*layout*/)
_table.attach(_fill_place, 2,3, 0,1);
_table.attach(_stroke, 2,3, 1,2);
+#endif
_opacity_place.add(_opacity_label);
+
+#if WITH_GTKMM_3_0
+ _table.attach(_opacity_place, 4, 0, 1, 2);
+ _table.attach(_opacity_sb, 5, 0, 1, 2);
+#else
_table.attach(_opacity_place, 4,5, 0,2, Gtk::SHRINK, Gtk::SHRINK);
_table.attach(_opacity_sb, 5,6, 0,2, Gtk::SHRINK, Gtk::SHRINK);
+#endif
pack_start(_table, true, true, 2);
diff --git a/src/ui/widget/selected-style.h b/src/ui/widget/selected-style.h
index fac4f22e6..6d5222429 100644
--- a/src/ui/widget/selected-style.h
+++ b/src/ui/widget/selected-style.h
@@ -11,8 +11,18 @@
#ifndef INKSCAPE_UI_CURRENT_STYLE_H
#define INKSCAPE_UI_CURRENT_STYLE_H
+#if HAVE_CONFIG_H
+# include "config.h"
+#endif
+
#include <gtkmm/box.h>
-#include <gtkmm/table.h>
+
+#if WITH_GTKMM_3_0
+# include <gtkmm/grid.h>
+#else
+# include <gtkmm/table.h>
+#endif
+
#include <gtkmm/label.h>
#include <gtkmm/eventbox.h>
#include <gtkmm/enums.h>
@@ -127,7 +137,11 @@ public:
protected:
SPDesktop *_desktop;
+#if WITH_GTKMM_3_0
+ Gtk::Grid _table;
+#else
Gtk::Table _table;
+#endif
Gtk::Label _fill_label;
Gtk::Label _stroke_label;
diff --git a/src/widgets/desktop-widget.cpp b/src/widgets/desktop-widget.cpp
index b0d8d974e..4af7c0795 100644
--- a/src/widgets/desktop-widget.cpp
+++ b/src/widgets/desktop-widget.cpp
@@ -357,6 +357,11 @@ void SPDesktopWidget::init( SPDesktopWidget *dtw )
dtw->panels = new SwatchesPanel("/embedded/swatches");
dtw->panels->setOrientation(SP_ANCHOR_SOUTH);
+
+#if GTK_CHECK_VERSION(3,0,0)
+ dtw->panels->set_vexpand(false);
+#endif
+
gtk_box_pack_end( GTK_BOX( dtw->vbox ), GTK_WIDGET(dtw->panels->gobj()), FALSE, TRUE, 0 );
}