summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorJabier Arraiza Cenoz <jabier.arraiza@marker.es>2013-03-10 20:36:05 +0000
committerJabiertxo Arraiza Zenotz <jtx@jtx.marker.es>2013-03-10 20:36:05 +0000
commit8db86f8405ff74e590566bfd552d1c23f00bdf5b (patch)
tree2913da86831eb11925cdc4d978982507dfe8e751 /src
parentAdd pencil BSpline mode (diff)
parentMigrate Object Properties dialog to Gtk::Grid (diff)
downloadinkscape-8db86f8405ff74e590566bfd552d1c23f00bdf5b.tar.gz
inkscape-8db86f8405ff74e590566bfd552d1c23f00bdf5b.zip
Merge from trunk
(bzr r11950.1.50)
Diffstat (limited to 'src')
-rw-r--r--src/display/canvas-axonomgrid.cpp54
-rw-r--r--src/display/canvas-grid.cpp57
-rw-r--r--src/dom/io/domstream.cpp220
-rw-r--r--src/dom/io/domstream.h70
-rw-r--r--src/extension/error-file.cpp4
-rw-r--r--src/extension/extension.cpp26
-rw-r--r--src/extension/extension.h10
-rw-r--r--src/extension/implementation/script.cpp4
-rw-r--r--src/extension/internal/odf.cpp112
-rw-r--r--src/extension/internal/pdf-input-cairo.cpp8
-rw-r--r--src/extension/internal/pdfinput/pdf-input.cpp8
-rw-r--r--src/extension/prefdialog.cpp15
-rw-r--r--src/io/inkscapestream.cpp2
-rw-r--r--src/libnrtype/FontFactory.cpp17
-rw-r--r--src/libnrtype/font-lister.cpp14
-rw-r--r--src/ui/dialog/aboutbox.cpp9
-rw-r--r--src/ui/dialog/calligraphic-profile-rename.cpp38
-rw-r--r--src/ui/dialog/calligraphic-profile-rename.h22
-rw-r--r--src/ui/dialog/debug.cpp4
-rw-r--r--src/ui/dialog/export.h1
-rw-r--r--src/ui/dialog/filter-effects-dialog.cpp19
-rw-r--r--src/ui/dialog/floating-behavior.cpp8
-rw-r--r--src/ui/dialog/guides.cpp17
-rw-r--r--src/ui/dialog/inkscape-preferences.cpp14
-rw-r--r--src/ui/dialog/layer-properties.cpp4
-rw-r--r--src/ui/dialog/livepatheffect-add.cpp5
-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/svg-fonts-dialog.cpp21
-rw-r--r--src/ui/dialog/svg-fonts-dialog.h16
-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/color-picker.cpp6
-rw-r--r--src/ui/widget/dock.cpp12
-rw-r--r--src/ui/widget/scalar.cpp2
-rw-r--r--src/ui/widget/selected-style.cpp27
-rw-r--r--src/ui/widget/selected-style.h16
-rw-r--r--src/ui/widget/spin-slider.cpp9
-rw-r--r--src/ui/widget/spin-slider.h8
-rw-r--r--src/ui/widget/tolerance-slider.cpp9
-rw-r--r--src/ui/widget/tolerance-slider.h13
-rw-r--r--src/widgets/desktop-widget.cpp5
45 files changed, 1029 insertions, 365 deletions
diff --git a/src/display/canvas-axonomgrid.cpp b/src/display/canvas-axonomgrid.cpp
index bfc6f27c4..170684328 100644
--- a/src/display/canvas-axonomgrid.cpp
+++ b/src/display/canvas-axonomgrid.cpp
@@ -12,11 +12,20 @@
* smaller than 90 degrees (measured from horizontal, 0 degrees being a line extending
* to the right). The x-axis will always have an angle between 0 and 90 degrees.
*/
-
+
+#if HAVE_CONFIG_H
+# include "config.h"
+#endif
#include <gtkmm/box.h>
#include <gtkmm/label.h>
-#include <gtkmm/table.h>
+
+#if WITH_GTKMM_3_0
+# include <gtkmm/grid.h>
+#else
+# include <gtkmm/table.h>
+#endif
+
#include <glibmm/i18n.h>
#include "display/canvas-axonomgrid.h"
@@ -83,28 +92,60 @@ namespace Inkscape {
#define SPACE_SIZE_X 15
#define SPACE_SIZE_Y 10
static inline void
+#if WITH_GTKMM_3_0
+attach_all(Gtk::Grid &table, Gtk::Widget const *const arr[], unsigned size, int start = 0)
+#else
attach_all(Gtk::Table &table, Gtk::Widget const *const arr[], unsigned size, int start = 0)
+#endif
{
for (unsigned i=0, r=start; i<size/sizeof(Gtk::Widget*); i+=2) {
if (arr[i] && arr[i+1]) {
+#if WITH_GTKMM_3_0
+ (const_cast<Gtk::Widget&>(*arr[i])).set_hexpand();
+ (const_cast<Gtk::Widget&>(*arr[i])).set_valign(Gtk::ALIGN_CENTER);
+ table.attach(const_cast<Gtk::Widget&>(*arr[i]), 1, r, 1, 1);
+
+ (const_cast<Gtk::Widget&>(*arr[i+1])).set_hexpand();
+ (const_cast<Gtk::Widget&>(*arr[i+1])).set_valign(Gtk::ALIGN_CENTER);
+ table.attach(const_cast<Gtk::Widget&>(*arr[i+1]), 2, r, 1, 1);
+#else
table.attach (const_cast<Gtk::Widget&>(*arr[i]), 1, 2, r, r+1,
Gtk::FILL|Gtk::EXPAND, (Gtk::AttachOptions)0,0,0);
table.attach (const_cast<Gtk::Widget&>(*arr[i+1]), 2, 3, r, r+1,
Gtk::FILL|Gtk::EXPAND, (Gtk::AttachOptions)0,0,0);
+#endif
} else {
if (arr[i+1]) {
+#if WITH_GTKMM_3_0
+ (const_cast<Gtk::Widget&>(*arr[i+1])).set_hexpand();
+ (const_cast<Gtk::Widget&>(*arr[i+1])).set_valign(Gtk::ALIGN_CENTER);
+ table.attach(const_cast<Gtk::Widget&>(*arr[i+1]), 1, r, 2, 1);
+#else
table.attach (const_cast<Gtk::Widget&>(*arr[i+1]), 1, 3, r, r+1,
Gtk::FILL|Gtk::EXPAND, (Gtk::AttachOptions)0,0,0);
+#endif
} else if (arr[i]) {
Gtk::Label& label = reinterpret_cast<Gtk::Label&> (const_cast<Gtk::Widget&>(*arr[i]));
label.set_alignment (0.0);
+#if WITH_GTKMM_3_0
+ label.set_hexpand();
+ label.set_valign(Gtk::ALIGN_CENTER);
+ table.attach(label, 0, r, 3, 1);
+#else
table.attach (label, 0, 3, r, r+1,
Gtk::FILL|Gtk::EXPAND, (Gtk::AttachOptions)0,0,0);
+#endif
} else {
Gtk::HBox *space = manage (new Gtk::HBox);
space->set_size_request (SPACE_SIZE_X, SPACE_SIZE_Y);
+#if WITH_GTKMM_3_0
+ space->set_halign(Gtk::ALIGN_CENTER);
+ space->set_valign(Gtk::ALIGN_CENTER);
+ table.attach(*space, 0, r, 1, 1);
+#else
table.attach (*space, 0, 1, r, r+1,
(Gtk::AttachOptions)0, (Gtk::AttachOptions)0,0,0);
+#endif
}
}
++r;
@@ -306,14 +347,17 @@ CanvasAxonomGrid::onReprAttrChanged(Inkscape::XML::Node */*repr*/, gchar const *
updateWidgets();
}
-
-
-
Gtk::Widget *
CanvasAxonomGrid::newSpecificWidget()
{
+#if WITH_GTKMM_3_0
+ Gtk::Grid *table = Gtk::manage(new Gtk::Grid());
+ table->set_row_spacing(2);
+ table->set_column_spacing(2);
+#else
Gtk::Table * table = Gtk::manage( new Gtk::Table(1,1) );
table->set_spacings(2);
+#endif
_wr.setUpdating (true);
diff --git a/src/display/canvas-grid.cpp b/src/display/canvas-grid.cpp
index 51a6dd89b..c53890f9f 100644
--- a/src/display/canvas-grid.cpp
+++ b/src/display/canvas-grid.cpp
@@ -13,10 +13,19 @@
* Don't be shy to correct things.
*/
+#if HAVE_CONFIG_H
+# include "config.h"
+#endif
+
#include <glibmm/i18n.h>
#include <gtkmm/box.h>
#include <gtkmm/label.h>
-#include <gtkmm/table.h>
+
+#if WITH_GTKMM_3_0
+# include <gtkmm/grid.h>
+#else
+# include <gtkmm/table.h>
+#endif
#include "ui/widget/registered-widget.h"
#include "desktop.h"
@@ -410,29 +419,60 @@ void CanvasGrid::setOrigin(Geom::Point const &origin_px)
**/
#define SPACE_SIZE_X 15
#define SPACE_SIZE_Y 10
-static inline void
-attach_all(Gtk::Table &table, Gtk::Widget const *const arr[], unsigned size, int start = 0)
+#if WITH_GTKMM_3_0
+static inline void attach_all(Gtk::Grid &table, Gtk::Widget const *const arr[], unsigned size, int start = 0)
+#else
+static inline void attach_all(Gtk::Table &table, Gtk::Widget const *const arr[], unsigned size, int start = 0)
+#endif
{
for (unsigned i=0, r=start; i<size/sizeof(Gtk::Widget*); i+=2) {
if (arr[i] && arr[i+1]) {
+#if WITH_GTKMM_3_0
+ (const_cast<Gtk::Widget&>(*arr[i])).set_hexpand();
+ (const_cast<Gtk::Widget&>(*arr[i])).set_valign(Gtk::ALIGN_CENTER);
+ table.attach(const_cast<Gtk::Widget&>(*arr[i]), 1, r, 1, 1);
+
+ (const_cast<Gtk::Widget&>(*arr[i+1])).set_hexpand();
+ (const_cast<Gtk::Widget&>(*arr[i+1])).set_valign(Gtk::ALIGN_CENTER);
+ table.attach(const_cast<Gtk::Widget&>(*arr[i+1]), 2, r, 1, 1);
+#else
table.attach (const_cast<Gtk::Widget&>(*arr[i]), 1, 2, r, r+1,
Gtk::FILL|Gtk::EXPAND, (Gtk::AttachOptions)0,0,0);
table.attach (const_cast<Gtk::Widget&>(*arr[i+1]), 2, 3, r, r+1,
Gtk::FILL|Gtk::EXPAND, (Gtk::AttachOptions)0,0,0);
+#endif
} else {
if (arr[i+1]) {
+#if WITH_GTKMM_3_0
+ (const_cast<Gtk::Widget&>(*arr[i+1])).set_hexpand();
+ (const_cast<Gtk::Widget&>(*arr[i+1])).set_valign(Gtk::ALIGN_CENTER);
+ table.attach(const_cast<Gtk::Widget&>(*arr[i+1]), 1, r, 2, 1);
+#else
table.attach (const_cast<Gtk::Widget&>(*arr[i+1]), 1, 3, r, r+1,
Gtk::FILL|Gtk::EXPAND, (Gtk::AttachOptions)0,0,0);
+#endif
} else if (arr[i]) {
Gtk::Label& label = reinterpret_cast<Gtk::Label&> (const_cast<Gtk::Widget&>(*arr[i]));
label.set_alignment (0.0);
+#if WITH_GTKMM_3_0
+ label.set_hexpand();
+ label.set_valign(Gtk::ALIGN_CENTER);
+ table.attach(label, 0, r, 3, 1);
+#else
table.attach (label, 0, 3, r, r+1,
Gtk::FILL|Gtk::EXPAND, (Gtk::AttachOptions)0,0,0);
+#endif
} else {
Gtk::HBox *space = manage (new Gtk::HBox);
space->set_size_request (SPACE_SIZE_X, SPACE_SIZE_Y);
+#if WITH_GTKMM_3_0
+ space->set_halign(Gtk::ALIGN_CENTER);
+ space->set_valign(Gtk::ALIGN_CENTER);
+ table.attach(*space, 0, r, 1, 1);
+#else
table.attach (*space, 0, 1, r, r+1,
(Gtk::AttachOptions)0, (Gtk::AttachOptions)0,0,0);
+#endif
}
}
++r;
@@ -688,7 +728,14 @@ CanvasXYGrid::onReprAttrChanged(Inkscape::XML::Node */*repr*/, gchar const */*ke
Gtk::Widget *
CanvasXYGrid::newSpecificWidget()
{
+#if WITH_GTKMM_3_0
+ Gtk::Grid * table = Gtk::manage( new Gtk::Grid() );
+ table->set_row_spacing(2);
+ table->set_column_spacing(2);
+#else
Gtk::Table * table = Gtk::manage( new Gtk::Table(1,1) );
+ table->set_spacings(2);
+#endif
Inkscape::UI::Widget::RegisteredUnitMenu *_rumg = Gtk::manage( new Inkscape::UI::Widget::RegisteredUnitMenu(
_("Grid _units:"), "units", _wr, repr, doc) );
@@ -715,9 +762,7 @@ CanvasXYGrid::newSpecificWidget()
Inkscape::UI::Widget::RegisteredSuffixedInteger *_rsi = Gtk::manage( new Inkscape::UI::Widget::RegisteredSuffixedInteger(
_("_Major grid line every:"), "", _("lines"), "empspacing", _wr, repr, doc) );
- table->set_spacings(2);
-
-_wr.setUpdating (true);
+ _wr.setUpdating (true);
_rsu_ox->setDigits(5);
_rsu_ox->setIncrements(0.1, 1.0);
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/error-file.cpp b/src/extension/error-file.cpp
index 2a56f55e8..778295f47 100644
--- a/src/extension/error-file.cpp
+++ b/src/extension/error-file.cpp
@@ -56,7 +56,11 @@ ErrorFileNotice::ErrorFileNotice (void) :
g_free(ext_error_file);
set_message(dialog_text, true);
+#if WITH_GTKMM_3_0
+ Gtk::Box * vbox = get_content_area();
+#else
Gtk::Box * vbox = get_vbox();
+#endif
/* This is some filler text, needs to change before relase */
Inkscape::Preferences *prefs = Inkscape::Preferences::get();
diff --git a/src/extension/extension.cpp b/src/extension/extension.cpp
index 4e2c5b9e4..28f556e75 100644
--- a/src/extension/extension.cpp
+++ b/src/extension/extension.cpp
@@ -19,12 +19,16 @@
# include "config.h"
#endif
-
#include <glibmm/i18n.h>
#include <gtkmm/box.h>
#include <gtkmm/label.h>
#include <gtkmm/frame.h>
-#include <gtkmm/table.h>
+
+#if WITH_GTKMM_3_0
+# include <gtkmm/grid.h>
+#else
+# include <gtkmm/table.h>
+#endif
#include "inkscape.h"
#include "extension/implementation/implementation.h"
@@ -720,7 +724,12 @@ Extension::get_info_widget(void)
Gtk::Frame * info = Gtk::manage(new Gtk::Frame("General Extension Information"));
retval->pack_start(*info, true, true, 5);
+#if WITH_GTKMM_3_0
+ Gtk::Grid * table = Gtk::manage(new Gtk::Grid());
+#else
Gtk::Table * table = Gtk::manage(new Gtk::Table());
+#endif
+
info->add(*table);
int row = 0;
@@ -733,8 +742,11 @@ Extension::get_info_widget(void)
return retval;
}
-void
-Extension::add_val(Glib::ustring labelstr, Glib::ustring valuestr, Gtk::Table * table, int * row)
+#if WITH_GTKMM_3_0
+void Extension::add_val(Glib::ustring labelstr, Glib::ustring valuestr, Gtk::Grid * table, int * row)
+#else
+void Extension::add_val(Glib::ustring labelstr, Glib::ustring valuestr, Gtk::Table * table, int * row)
+#endif
{
Gtk::Label * label;
Gtk::Label * value;
@@ -742,8 +754,14 @@ Extension::add_val(Glib::ustring labelstr, Glib::ustring valuestr, Gtk::Table *
(*row)++;
label = Gtk::manage(new Gtk::Label(labelstr));
value = Gtk::manage(new Gtk::Label(valuestr));
+
+#if WITH_GTKMM_3_0
+ table->attach(*label, 0, (*row) - 1, 1, 1);
+ table->attach(*value, 1, (*row) - 1, 1, 1);
+#else
table->attach(*label, 0, 1, (*row) - 1, *row);
table->attach(*value, 1, 2, (*row) - 1, *row);
+#endif
label->show();
value->show();
diff --git a/src/extension/extension.h b/src/extension/extension.h
index 78999631a..dcabb3df7 100644
--- a/src/extension/extension.h
+++ b/src/extension/extension.h
@@ -22,7 +22,12 @@
#include <sigc++/signal.h>
namespace Gtk {
+#if WITH_GTKMM_3_0
+ class Grid;
+#else
class Table;
+#endif
+
class VBox;
class Widget;
}
@@ -285,8 +290,11 @@ public:
Gtk::VBox * get_help_widget(void);
Gtk::VBox * get_params_widget(void);
protected:
+#if WITH_GTKMM_3_0
+ inline static void add_val(Glib::ustring labelstr, Glib::ustring valuestr, Gtk::Grid * table, int * row);
+#else
inline static void add_val(Glib::ustring labelstr, Glib::ustring valuestr, Gtk::Table * table, int * row);
-
+#endif
};
diff --git a/src/extension/implementation/script.cpp b/src/extension/implementation/script.cpp
index fa46569e2..3ac1e06ab 100644
--- a/src/extension/implementation/script.cpp
+++ b/src/extension/implementation/script.cpp
@@ -854,7 +854,11 @@ void Script::checkStderr (const Glib::ustring &data,
GtkWidget *dlg = GTK_WIDGET(warning.gobj());
sp_transientize(dlg);
+#if WITH_GTKMM_3_0
+ Gtk::Box * vbox = warning.get_content_area();
+#else
Gtk::Box * vbox = warning.get_vbox();
+#endif
/* Gtk::TextView * textview = new Gtk::TextView(Gtk::TextBuffer::create()); */
Gtk::TextView * textview = new Gtk::TextView();
diff --git a/src/extension/internal/odf.cpp b/src/extension/internal/odf.cpp
index bd74ba47c..7634c7aa1 100644
--- a/src/extension/internal/odf.cpp
+++ b/src/extension/internal/odf.cpp
@@ -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
@@ -1180,7 +1182,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");
@@ -1241,7 +1243,7 @@ bool OdfOutput::writeMeta(ZipFile &zf)
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.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());
@@ -1889,35 +1891,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 +1944,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 +1966,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 +1976,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 +2009,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 +2063,7 @@ bool OdfOutput::writeTree(Writer &couts, Writer &souts,
curve->unref();
- }
+ }
return true;
}
@@ -2304,29 +2315,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 +2358,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/extension/internal/pdf-input-cairo.cpp b/src/extension/internal/pdf-input-cairo.cpp
index d3c6c5931..c83ebad82 100644
--- a/src/extension/internal/pdf-input-cairo.cpp
+++ b/src/extension/internal/pdf-input-cairo.cpp
@@ -224,9 +224,17 @@ PdfImportCairoDialog::PdfImportCairoDialog(PopplerDocument *doc)
vbox1->pack_start(*_importSettingsFrame, Gtk::PACK_EXPAND_PADDING, 0);
hbox1->pack_start(*vbox1);
hbox1->pack_start(*_previewArea, Gtk::PACK_EXPAND_WIDGET, 4);
+
+#if WITH_GTKMM_3_0
+ get_content_area()->set_homogeneous(false);
+ get_content_area()->set_spacing(0);
+ get_content_area()->pack_start(*hbox1);
+#else
this->get_vbox()->set_homogeneous(false);
this->get_vbox()->set_spacing(0);
this->get_vbox()->pack_start(*hbox1);
+#endif
+
this->set_title(_("PDF Import Settings"));
this->set_modal(true);
sp_transientize(GTK_WIDGET(this->gobj())); //Make transient
diff --git a/src/extension/internal/pdfinput/pdf-input.cpp b/src/extension/internal/pdfinput/pdf-input.cpp
index 535deafce..531cda20a 100644
--- a/src/extension/internal/pdfinput/pdf-input.cpp
+++ b/src/extension/internal/pdfinput/pdf-input.cpp
@@ -240,9 +240,17 @@ PdfImportDialog::PdfImportDialog(PDFDoc *doc, const gchar */*uri*/)
vbox1->pack_start(*_importSettingsFrame, Gtk::PACK_EXPAND_PADDING, 0);
hbox1->pack_start(*vbox1);
hbox1->pack_start(*_previewArea, Gtk::PACK_EXPAND_WIDGET, 4);
+
+#if WITH_GTKMM_3_0
+ get_content_area()->set_homogeneous(false);
+ get_content_area()->set_spacing(0);
+ get_content_area()->pack_start(*hbox1);
+#else
this->get_vbox()->set_homogeneous(false);
this->get_vbox()->set_spacing(0);
this->get_vbox()->pack_start(*hbox1);
+#endif
+
this->set_title(_("PDF Import Settings"));
this->set_modal(true);
sp_transientize(GTK_WIDGET(this->gobj())); //Make transient
diff --git a/src/extension/prefdialog.cpp b/src/extension/prefdialog.cpp
index 649dc398a..f3c6508af 100644
--- a/src/extension/prefdialog.cpp
+++ b/src/extension/prefdialog.cpp
@@ -67,7 +67,12 @@ PrefDialog::PrefDialog (Glib::ustring name, gchar const * help, Gtk::Widget * co
hbox->pack_start(*controls, true, true, 6);
hbox->show();
+
+#if WITH_GTKMM_3_0
+ this->get_content_area()->pack_start(*hbox, true, true, 6);
+#else
this->get_vbox()->pack_start(*hbox, true, true, 6);
+#endif
/*
Gtk::Button * help_button = add_button(Gtk::Stock::HELP, Gtk::RESPONSE_HELP);
@@ -95,14 +100,24 @@ PrefDialog::PrefDialog (Glib::ustring name, gchar const * help, Gtk::Widget * co
#endif
sep->show();
+
+#if WITH_GTKMM_3_0
+ this->get_content_area()->pack_start(*sep, true, true, 4);
+#else
this->get_vbox()->pack_start(*sep, true, true, 4);
+#endif
hbox = Gtk::manage(new Gtk::HBox());
_button_preview = _param_preview->get_widget(NULL, NULL, &_signal_preview);
_button_preview->show();
hbox->pack_start(*_button_preview, true, true,6);
hbox->show();
+
+#if WITH_GTKMM_3_0
+ this->get_content_area()->pack_start(*hbox, true, true, 6);
+#else
this->get_vbox()->pack_start(*hbox, true, true, 6);
+#endif
Gtk::Box * hbox = dynamic_cast<Gtk::Box *>(_button_preview);
if (hbox != NULL) {
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/FontFactory.cpp b/src/libnrtype/FontFactory.cpp
index a1a9ddc89..bb8b0887f 100644
--- a/src/libnrtype/FontFactory.cpp
+++ b/src/libnrtype/FontFactory.cpp
@@ -741,16 +741,23 @@ void font_factory::GetUIFamiliesAndStyles(FamilyToStylesMap *map)
continue;
}
- // Disable synthesized (faux) font faces
- if (pango_font_face_is_synthesized(faces[currentFace]) ) {
- continue;
- }
-
PangoFontDescription *faceDescr = pango_font_face_describe(faces[currentFace]);
if (faceDescr) {
Glib::ustring familyUIName = GetUIFamilyString(faceDescr);
Glib::ustring styleUIName = GetUIStyleString(faceDescr);
+ // Disable synthesized (faux) font faces except for CSS generic faces
+ if (pango_font_face_is_synthesized(faces[currentFace]) ) {
+ if( familyUIName.compare( "sans-serif" ) != 0 &&
+ familyUIName.compare( "serif" ) != 0 &&
+ familyUIName.compare( "monospace" ) != 0 &&
+ familyUIName.compare( "fantasy" ) != 0 &&
+ familyUIName.compare( "cursive" ) != 0 ) {
+ //std::cout << "faux: " << familyUIName << " | " << styleUIName << std::endl;
+ continue;
+ }
+ }
+
if (!familyUIName.empty() && !styleUIName.empty()) {
// Find the right place to put the style information, adding
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 0c0027c15..d4928d25d 100644
--- a/src/ui/dialog/aboutbox.cpp
+++ b/src/ui/dialog/aboutbox.cpp
@@ -97,7 +97,12 @@ AboutBox::AboutBox() : Gtk::Dialog(_("About Inkscape")) {
tabs->append_page(*manage(
make_scrolled_text(license_text)), _("_License"), true);
+#if WITH_GTKMM_3_0
+ get_content_area()->pack_end(*manage(tabs), true, true);
+#else
get_vbox()->pack_end(*manage(tabs), true, true);
+#endif
+
tabs->show_all();
add_button(Gtk::Stock::CLOSE, Gtk::RESPONSE_CLOSE);
@@ -114,7 +119,11 @@ AboutBox::AboutBox() : Gtk::Dialog(_("About Inkscape")) {
label->set_selectable(true);
label->show();
+#if WITH_GTKMM_3_0
+ get_content_area()->pack_start(*manage(label), false, false);
+#else
get_vbox()->pack_start(*manage(label), false, false);
+#endif
Gtk::Requisition requisition;
#if GTK_CHECK_VERSION(3,0,0)
diff --git a/src/ui/dialog/calligraphic-profile-rename.cpp b/src/ui/dialog/calligraphic-profile-rename.cpp
index 77a4f4f03..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,24 +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);
- _layout_table.resize (1, 2);
+ _layout_table->set_spacings(4);
+#endif
_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/debug.cpp b/src/ui/dialog/debug.cpp
index 429ed57bf..e61f8e389 100644
--- a/src/ui/dialog/debug.cpp
+++ b/src/ui/dialog/debug.cpp
@@ -69,7 +69,11 @@ DebugDialogImpl::DebugDialogImpl()
set_title(_("Messages"));
set_size_request(300, 400);
+#if WITH_GTKMM_3_0
+ Gtk::Box *mainVBox = get_content_area();
+#else
Gtk::Box *mainVBox = get_vbox();
+#endif
//## Add a menu for clear()
Gtk::MenuItem* item = Gtk::manage(new Gtk::MenuItem(_("_File"), true));
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/floating-behavior.cpp b/src/ui/dialog/floating-behavior.cpp
index eab5f9d8f..d70c5f187 100644
--- a/src/ui/dialog/floating-behavior.cpp
+++ b/src/ui/dialog/floating-behavior.cpp
@@ -135,7 +135,13 @@ FloatingBehavior::create(Dialog &dialog)
inline FloatingBehavior::operator Gtk::Widget &() { return *_d; }
inline GtkWidget *FloatingBehavior::gobj() { return GTK_WIDGET(_d->gobj()); }
-inline Gtk::Box* FloatingBehavior::get_vbox() { return _d->get_vbox(); }
+inline Gtk::Box* FloatingBehavior::get_vbox() {
+#if WITH_GTKMM_3_0
+ return _d->get_content_area();
+#else
+ return _d->get_vbox();
+#endif
+}
inline void FloatingBehavior::present() { _d->present(); }
inline void FloatingBehavior::hide() { _d->hide(); }
inline void FloatingBehavior::show() { _d->show(); }
diff --git a/src/ui/dialog/guides.cpp b/src/ui/dialog/guides.cpp
index d8bbb5539..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);
}
@@ -166,12 +172,12 @@ void GuidelinePropertiesDialog::_setup() {
add_button(Gtk::Stock::DELETE, -12);
add_button(Gtk::Stock::CANCEL, Gtk::RESPONSE_CANCEL);
- Gtk::Box *mainVBox = get_vbox();
-
#if WITH_GTKMM_3_0
+ Gtk::Box *mainVBox = get_content_area();
_layout_table.set_row_spacing(4);
_layout_table.set_column_spacing(4);
#else
+ Gtk::Box *mainVBox = get_vbox();
_layout_table.set_spacings(4);
_layout_table.resize (3, 4);
#endif
@@ -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/layer-properties.cpp b/src/ui/dialog/layer-properties.cpp
index 6a1bc829e..3feed2afe 100644
--- a/src/ui/dialog/layer-properties.cpp
+++ b/src/ui/dialog/layer-properties.cpp
@@ -40,12 +40,12 @@ namespace Dialogs {
LayerPropertiesDialog::LayerPropertiesDialog()
: _strategy(NULL), _desktop(NULL), _layer(NULL), _position_visible(false)
{
- Gtk::Box *mainVBox = get_vbox();
-
#if WITH_GTKMM_3_0
+ Gtk::Box *mainVBox = get_content_area();
_layout_table.set_row_spacing(4);
_layout_table.set_column_spacing(4);
#else
+ Gtk::Box *mainVBox = get_vbox();
_layout_table.set_spacings(4);
_layout_table.resize (1, 2);
#endif
diff --git a/src/ui/dialog/livepatheffect-add.cpp b/src/ui/dialog/livepatheffect-add.cpp
index e899dbcfc..b5f51d81d 100644
--- a/src/ui/dialog/livepatheffect-add.cpp
+++ b/src/ui/dialog/livepatheffect-add.cpp
@@ -73,7 +73,12 @@ LivePathEffectAdd::LivePathEffectAdd() :
add_button.set_use_underline(true);
add_button.set_can_default();
+#if WITH_GTKMM_3_0
+ Gtk::Box *mainVBox = get_content_area();
+#else
Gtk::Box *mainVBox = get_vbox();
+#endif
+
mainVBox->pack_start(scrolled_window, true, true);
add_action_widget(close_button, Gtk::RESPONSE_CLOSE);
add_action_widget(add_button, Gtk::RESPONSE_APPLY);
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/svg-fonts-dialog.cpp b/src/ui/dialog/svg-fonts-dialog.cpp
index be69635e8..0da39dd73 100644
--- a/src/ui/dialog/svg-fonts-dialog.cpp
+++ b/src/ui/dialog/svg-fonts-dialog.cpp
@@ -22,6 +22,7 @@
#include "document-undo.h"
#include <gtkmm/notebook.h>
#include <gtkmm/imagemenuitem.h>
+#include <gtkmm/scale.h>
#include <gtkmm/stock.h>
#include <glibmm/i18n.h>
#include <message-stack.h>
@@ -191,7 +192,7 @@ void SvgFontsDialog::on_kerning_value_changed(){
//slider values increase from right to left so that they match the kerning pair preview
//XML Tree being directly used here while it shouldn't be.
- this->kerning_pair->getRepr()->setAttribute("k", Glib::Ascii::dtostr(get_selected_spfont()->horiz_adv_x - kerning_slider.get_value()).c_str());
+ this->kerning_pair->getRepr()->setAttribute("k", Glib::Ascii::dtostr(get_selected_spfont()->horiz_adv_x - kerning_slider->get_value()).c_str());
DocumentUndo::maybeDone(document, undokey.c_str(), SP_VERB_DIALOG_SVG_FONTS, _("Adjust kerning value"));
//populate_kerning_pairs_box();
@@ -299,7 +300,7 @@ void SvgFontsDialog::on_kerning_pair_selection_changed(){
this->kerning_pair = kern;
//slider values increase from right to left so that they match the kerning pair preview
- kerning_slider.set_value(get_selected_spfont()->horiz_adv_x - kern->k);
+ kerning_slider->set_value(get_selected_spfont()->horiz_adv_x - kern->k);
}
void SvgFontsDialog::update_global_settings_tab(){
@@ -328,9 +329,9 @@ void SvgFontsDialog::on_font_selection_changed(){
double set_width = spfont->horiz_adv_x;
setwidth_spin.set_value(set_width);
- kerning_slider.set_range(0, set_width);
- kerning_slider.set_draw_value(false);
- kerning_slider.set_value(0);
+ kerning_slider->set_range(0, set_width);
+ kerning_slider->set_draw_value(false);
+ kerning_slider->set_value(0);
update_global_settings_tab();
populate_glyphs_box();
@@ -779,7 +780,7 @@ Gtk::VBox* SvgFontsDialog::kerning_tab(){
add_kernpair_button.set_label(_("Add pair"));
add_kernpair_button.signal_clicked().connect(sigc::mem_fun(*this, &SvgFontsDialog::add_kerning_pair));
_KerningPairsList.get_selection()->signal_changed().connect(sigc::mem_fun(*this, &SvgFontsDialog::on_kerning_pair_selection_changed));
- kerning_slider.signal_value_changed().connect(sigc::mem_fun(*this, &SvgFontsDialog::on_kerning_value_changed));
+ kerning_slider->signal_value_changed().connect(sigc::mem_fun(*this, &SvgFontsDialog::on_kerning_value_changed));
kerning_vbox.pack_start(*kerning_selector, false,false);
@@ -797,7 +798,7 @@ Gtk::VBox* SvgFontsDialog::kerning_tab(){
Gtk::HBox* kerning_amount_hbox = Gtk::manage(new Gtk::HBox());
kerning_vbox.pack_start(*kerning_amount_hbox, false,false);
kerning_amount_hbox->add(*Gtk::manage(new Gtk::Label(_("Kerning value:"))));
- kerning_amount_hbox->add(kerning_slider);
+ kerning_amount_hbox->add(*kerning_slider);
kerning_preview.set_size(300 + 20, 150 + 20);
_font_da.set_size(150 + 20, 50 + 20);
@@ -884,6 +885,12 @@ void SvgFontsDialog::add_font(){
SvgFontsDialog::SvgFontsDialog()
: UI::Widget::Panel("", "/dialogs/svgfonts", SP_VERB_DIALOG_SVG_FONTS), _add(Gtk::Stock::NEW)
{
+#if WITH_GTKMM_3_0
+ kerning_slider = Gtk::manage(new Gtk::Scale(Gtk::ORIENTATION_HORIZONTAL));
+#else
+ kerning_slider = Gtk::manage(new Gtk::HScale);
+#endif
+
_add.signal_clicked().connect(sigc::mem_fun(*this, &SvgFontsDialog::add_font));
Gtk::HBox* hbox = Gtk::manage(new Gtk::HBox());
diff --git a/src/ui/dialog/svg-fonts-dialog.h b/src/ui/dialog/svg-fonts-dialog.h
index 910f79d4c..9be984820 100644
--- a/src/ui/dialog/svg-fonts-dialog.h
+++ b/src/ui/dialog/svg-fonts-dialog.h
@@ -20,13 +20,20 @@
#include <gtkmm/drawingarea.h>
#include <gtkmm/entry.h>
#include <gtkmm/liststore.h>
-#include <gtkmm/scale.h>
#include <gtkmm/scrolledwindow.h>
#include <gtkmm/treeview.h>
#include "attributes.h"
#include "xml/helper-observer.h"
+namespace Gtk {
+#if WITH_GTKMM_3_0
+class Scale;
+#else
+class HScale;
+#endif
+}
+
class SPGlyph;
class SPGlyphKerning;
class SvgFont;
@@ -210,7 +217,12 @@ private:
GlyphComboBox first_glyph, second_glyph;
SPGlyphKerning* kerning_pair;
Inkscape::UI::Widget::SpinButton setwidth_spin;
- Gtk::HScale kerning_slider;
+
+#if WITH_GTKMM_3_0
+ Gtk::Scale* kerning_slider;
+#else
+ Gtk::HScale* kerning_slider;
+#endif
class EntryWidget : public Gtk::HBox
{
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/color-picker.cpp b/src/ui/widget/color-picker.cpp
index 31fb3096c..5585f2db4 100644
--- a/src/ui/widget/color-picker.cpp
+++ b/src/ui/widget/color-picker.cpp
@@ -56,8 +56,14 @@ void ColorPicker::setupDialog(const Glib::ustring &title)
_colorSelectorDialog.set_title (title);
_colorSelectorDialog.set_border_width (4);
_colorSelector = SP_COLOR_SELECTOR(sp_color_selector_new(SP_TYPE_COLOR_NOTEBOOK));
+
+#if WITH_GTKMM_3_0
+ _colorSelectorDialog.get_content_area()->pack_start (
+ *Glib::wrap(&_colorSelector->vbox), true, true, 0);
+#else
_colorSelectorDialog.get_vbox()->pack_start (
*Glib::wrap(&_colorSelector->vbox), true, true, 0);
+#endif
g_signal_connect(G_OBJECT(_colorSelector), "dragged",
G_CALLBACK(sp_color_picker_color_mod), (void *)this);
diff --git a/src/ui/widget/dock.cpp b/src/ui/widget/dock.cpp
index a38a93fb1..2bfc7e0df 100644
--- a/src/ui/widget/dock.cpp
+++ b/src/ui/widget/dock.cpp
@@ -54,6 +54,17 @@ Dock::Dock(Gtk::Orientation orientation)
{
gdl_dock_bar_set_orientation(_gdl_dock_bar, static_cast<GtkOrientation>(orientation));
+#if WITH_GTKMM_3_0
+ switch(orientation) {
+ case Gtk::ORIENTATION_VERTICAL:
+ _dock_box = Gtk::manage(new Gtk::Box(Gtk::ORIENTATION_HORIZONTAL));
+ break;
+ case Gtk::ORIENTATION_HORIZONTAL:
+ _dock_box = Gtk::manage(new Gtk::Box(Gtk::ORIENTATION_VERTICAL));
+ }
+
+ _paned = Gtk::manage(new Gtk::Paned(orientation));
+#else
switch (orientation) {
case Gtk::ORIENTATION_VERTICAL:
_dock_box = Gtk::manage(new Gtk::HBox());
@@ -63,6 +74,7 @@ Dock::Dock(Gtk::Orientation orientation)
_dock_box = Gtk::manage(new Gtk::VBox());
_paned = Gtk::manage(new Gtk::HPaned());
}
+#endif
_scrolled_window->add(*_dock_box);
_scrolled_window->set_policy(Gtk::POLICY_NEVER, Gtk::POLICY_AUTOMATIC);
diff --git a/src/ui/widget/scalar.cpp b/src/ui/widget/scalar.cpp
index 9bbcc80f9..fca8a7974 100644
--- a/src/ui/widget/scalar.cpp
+++ b/src/ui/widget/scalar.cpp
@@ -142,7 +142,7 @@ void Scalar::update()
void Scalar::addSlider()
{
#if WITH_GTKMM_3_0
- Gtk::HScale *scale = new Gtk::HScale(static_cast<SpinButton*>(_widget)->get_adjustment());
+ Gtk::Scale *scale = new Gtk::Scale(static_cast<SpinButton*>(_widget)->get_adjustment());
#else
Gtk::HScale *scale = new Gtk::HScale( * static_cast<SpinButton*>(_widget)->get_adjustment() );
#endif
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/ui/widget/spin-slider.cpp b/src/ui/widget/spin-slider.cpp
index 323b1209c..facbf704c 100644
--- a/src/ui/widget/spin-slider.cpp
+++ b/src/ui/widget/spin-slider.cpp
@@ -116,11 +116,20 @@ Gtk::Adjustment& SpinSlider::get_adjustment()
return _adjustment;
}
+#if WITH_GTKMM_3_0
+const Gtk::Scale& SpinSlider::get_scale() const
+#else
const Gtk::HScale& SpinSlider::get_scale() const
+#endif
{
return _scale;
}
+
+#if WITH_GTKMM_3_0
+Gtk::Scale& SpinSlider::get_scale()
+#else
Gtk::HScale& SpinSlider::get_scale()
+#endif
{
return _scale;
}
diff --git a/src/ui/widget/spin-slider.h b/src/ui/widget/spin-slider.h
index f4a62107b..8a45299e5 100644
--- a/src/ui/widget/spin-slider.h
+++ b/src/ui/widget/spin-slider.h
@@ -41,13 +41,14 @@ public:
#if WITH_GTKMM_3_0
const Glib::RefPtr<Gtk::Adjustment> get_adjustment() const;
Glib::RefPtr<Gtk::Adjustment> get_adjustment();
+ const Gtk::Scale& get_scale() const;
+ Gtk::Scale& get_scale();
#else
const Gtk::Adjustment& get_adjustment() const;
Gtk::Adjustment& get_adjustment();
-#endif
-
const Gtk::HScale& get_scale() const;
Gtk::HScale& get_scale();
+#endif
const Inkscape::UI::Widget::SpinButton& get_spin_button() const;
Inkscape::UI::Widget::SpinButton& get_spin_button();
@@ -57,10 +58,11 @@ public:
private:
#if WITH_GTKMM_3_0
Glib::RefPtr<Gtk::Adjustment> _adjustment;
+ Gtk::Scale _scale;
#else
Gtk::Adjustment _adjustment;
-#endif
Gtk::HScale _scale;
+#endif
Inkscape::UI::Widget::SpinButton _spin;
};
diff --git a/src/ui/widget/tolerance-slider.cpp b/src/ui/widget/tolerance-slider.cpp
index 16558f0ee..f92a08d0a 100644
--- a/src/ui/widget/tolerance-slider.cpp
+++ b/src/ui/widget/tolerance-slider.cpp
@@ -73,8 +73,15 @@ void ToleranceSlider::init (const Glib::ustring& label1, const Glib::ustring& la
theLabel1->set_use_underline();
theLabel1->set_alignment(0, 0.5);
// align the label with the checkbox text above by indenting 22 px.
- _hbox->pack_start(*theLabel1, Gtk::PACK_EXPAND_WIDGET, 22);
+ _hbox->pack_start(*theLabel1, Gtk::PACK_EXPAND_WIDGET, 22);
+
+#if WITH_GTKMM_3_0
+ _hscale = manage(new Gtk::Scale(Gtk::ORIENTATION_HORIZONTAL));
+ _hscale->set_range(1.0, 51.0);
+#else
_hscale = manage (new Gtk::HScale (1.0, 51, 1.0));
+#endif
+
theLabel1->set_mnemonic_widget (*_hscale);
_hscale->set_draw_value (true);
_hscale->set_value_pos (Gtk::POS_RIGHT);
diff --git a/src/ui/widget/tolerance-slider.h b/src/ui/widget/tolerance-slider.h
index d0b78e3c1..2184cd52b 100644
--- a/src/ui/widget/tolerance-slider.h
+++ b/src/ui/widget/tolerance-slider.h
@@ -13,7 +13,12 @@
#include <gtkmm/radiobuttongroup.h>
namespace Gtk {
- class RadioButton;
+class RadioButton;
+#if WITH_GTKMM_3_0
+class Scale;
+#else
+class HScale;
+#endif
}
namespace Inkscape {
@@ -55,7 +60,13 @@ protected:
void on_toggled();
void update (double val);
Gtk::HBox *_hbox;
+
+#if WITH_GTKMM_3_0
+ Gtk::Scale *_hscale;
+#else
Gtk::HScale *_hscale;
+#endif
+
Gtk::RadioButtonGroup _radio_button_group;
Gtk::RadioButton *_button1;
Gtk::RadioButton *_button2;
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 );
}