diff options
| author | root <root@jtx.marker.es> | 2013-03-16 20:28:39 +0000 |
|---|---|---|
| committer | root <root@jtx.marker.es> | 2013-03-16 20:28:39 +0000 |
| commit | dc88806b0778f65a3f16071c9782d607cc735dda (patch) | |
| tree | ac560318c8a3bb2ac244edba6511082bb06cac34 /src | |
| parent | Updating original path (diff) | |
| parent | Fix another tonne of forward declaration tags (diff) | |
| download | inkscape-dc88806b0778f65a3f16071c9782d607cc735dda.tar.gz inkscape-dc88806b0778f65a3f16071c9782d607cc735dda.zip | |
widget working not compile
(bzr r11950.1.54)
Diffstat (limited to 'src')
132 files changed, 1328 insertions, 446 deletions
diff --git a/src/2geom/basic-intersection.cpp b/src/2geom/basic-intersection.cpp index 3be6792b9..544bf0dd1 100644 --- a/src/2geom/basic-intersection.cpp +++ b/src/2geom/basic-intersection.cpp @@ -64,7 +64,12 @@ void find_intersections(std::vector< std::pair<double, double> > & xs, void split(vector<Point> const &p, double t, vector<Point> &left, vector<Point> &right) { const unsigned sz = p.size(); - Geom::Point Vtemp[sz][sz]; + + Geom::Point **Vtemp = new Geom::Point* [sz]; + + for (unsigned int i = 0; i < sz; ++i) { + Vtemp[i] = new Geom::Point[sz]; + } /* Copy control points */ std::copy(p.begin(), p.end(), Vtemp[0]); @@ -82,6 +87,11 @@ void split(vector<Point> const &p, double t, left[j] = Vtemp[j][0]; for (unsigned j = 0; j < sz; j++) right[j] = Vtemp[sz-1-j][j]; + + for (unsigned int i = 0; i < sz; ++i) + delete[] Vtemp[i]; + + delete[] Vtemp; } diff --git a/src/2geom/recursive-bezier-intersection.cpp b/src/2geom/recursive-bezier-intersection.cpp index b4c81e08e..7db0438a7 100644 --- a/src/2geom/recursive-bezier-intersection.cpp +++ b/src/2geom/recursive-bezier-intersection.cpp @@ -81,7 +81,11 @@ const double INV_EPS = (1L<<14); */ void OldBezier::split(double t, OldBezier &left, OldBezier &right) const { const unsigned sz = p.size(); - Geom::Point Vtemp[sz][sz]; + + Geom::Point **Vtemp = new Geom::Point* [sz]; + + for (unsigned int i = 0; i < sz; ++i) + Vtemp[i] = new Geom::Point[sz]; /* Copy control points */ std::copy(p.begin(), p.end(), Vtemp[0]); @@ -99,6 +103,11 @@ void OldBezier::split(double t, OldBezier &left, OldBezier &right) const { left.p[j] = Vtemp[j][0]; for (unsigned j = 0; j < sz; j++) right.p[j] = Vtemp[sz-1-j][j]; + + for (unsigned int i = 0; i < sz; ++i) + delete[] Vtemp[i]; + + delete[] Vtemp; } #if 0 diff --git a/src/2geom/solve-bezier-parametric.cpp b/src/2geom/solve-bezier-parametric.cpp index 76cf65e17..ed693c584 100644 --- a/src/2geom/solve-bezier-parametric.cpp +++ b/src/2geom/solve-bezier-parametric.cpp @@ -68,13 +68,20 @@ find_parametric_bezier_roots(Geom::Point const *w, /* The control points */ break; } - /* Otherwise, solve recursively after subdividing control polygon */ - Geom::Point Left[degree+1], /* New left and right */ - Right[degree+1]; /* control polygons */ + /* + * Otherwise, solve recursively after subdividing control polygon + * New left and right control polygons + */ + Geom::Point *Left = new Geom::Point[degree+1]; + Geom::Point *Right = new Geom::Point[degree+1]; + Bezier(w, degree, 0.5, Left, Right); total_subs ++; find_parametric_bezier_roots(Left, degree, solutions, depth+1); find_parametric_bezier_roots(Right, degree, solutions, depth+1); + + delete[] Left; + delete[] Right; } @@ -191,7 +198,10 @@ Bezier(Geom::Point const *V, /* Control pts */ Geom::Point *Left, /* RETURN left half ctl pts */ Geom::Point *Right) /* RETURN right half ctl pts */ { - Geom::Point Vtemp[degree+1][degree+1]; + Geom::Point **Vtemp = new Geom::Point* [degree+1]; + + for (unsigned int i = 0; i < degree+1; ++i) + Vtemp[i] = new Geom::Point[degree+1]; /* Copy control points */ std::copy(V, V+degree+1, Vtemp[0]); @@ -208,7 +218,14 @@ Bezier(Geom::Point const *V, /* Control pts */ for (unsigned j = 0; j <= degree; j++) Right[j] = Vtemp[degree-j][j]; - return (Vtemp[degree][0]); + Geom::Point return_value = Vtemp[degree][0]; + + for (unsigned int i = 0; i < degree+1; ++i) + delete[] Vtemp[i]; + + delete[] Vtemp; + + return return_value; } }; diff --git a/src/arc-context.h b/src/arc-context.h index 46a6e1dce..3e4f5412d 100644 --- a/src/arc-context.h +++ b/src/arc-context.h @@ -27,9 +27,6 @@ #define SP_IS_ARC_CONTEXT(obj) (G_TYPE_CHECK_INSTANCE_TYPE((obj), SP_TYPE_ARC_CONTEXT)) #define SP_IS_ARC_CONTEXT_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE((klass), SP_TYPE_ARC_CONTEXT)) -class SPArcContext; -class SPArcContextClass; - struct SPArcContext : public SPEventContext { SPItem *item; Geom::Point center; diff --git a/src/box3d-context.h b/src/box3d-context.h index ccf0ef712..70ff87ad1 100644 --- a/src/box3d-context.h +++ b/src/box3d-context.h @@ -27,9 +27,6 @@ #define SP_IS_BOX3D_CONTEXT(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), SP_TYPE_BOX3D_CONTEXT)) #define SP_IS_BOX3D_CONTEXT_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), SP_TYPE_BOX3D_CONTEXT)) -class Box3DContext; -class Box3DContextClass; - struct Box3DContext : public SPEventContext { SPItem *item; Geom::Point center; diff --git a/src/box3d-side.h b/src/box3d-side.h index ed4972e29..dee775fca 100644 --- a/src/box3d-side.h +++ b/src/box3d-side.h @@ -23,9 +23,7 @@ #define SP_IS_BOX3D_SIDE_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), SP_TYPE_BOX3D_SIDE)) class SPBox3D; -class Box3DSide; -class Box3DSideClass; -class Persp3D; +struct Persp3D; // FIXME: Would it be better to inherit from SPPath instead? struct Box3DSide : public SPPolygon { diff --git a/src/box3d.h b/src/box3d.h index 5dbf0cf5e..320edadf4 100644 --- a/src/box3d.h +++ b/src/box3d.h @@ -26,8 +26,7 @@ #define SP_IS_BOX3D(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), SP_TYPE_BOX3D)) #define SP_IS_BOX3D_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), SP_TYPE_BOX3D)) -class Box3DSide; -class Persp3D; +struct Persp3D; class Persp3DReference; class SPBox3D : public SPGroup { diff --git a/src/cms-system.h b/src/cms-system.h index c528deb94..ecaba956e 100644 --- a/src/cms-system.h +++ b/src/cms-system.h @@ -15,7 +15,7 @@ class SPDocument; namespace Inkscape { -class ColorProfile; +struct ColorProfile; class CMSSystem { public: diff --git a/src/color-profile.cpp b/src/color-profile.cpp index 42b6e86dd..fe663957c 100644 --- a/src/color-profile.cpp +++ b/src/color-profile.cpp @@ -103,6 +103,8 @@ extern guint update_in_progress; static SPObjectClass *cprof_parent_class; +namespace Inkscape { + class ColorProfileImpl { public: #if defined(HAVE_LIBLCMS1) || defined(HAVE_LIBLCMS2) @@ -129,10 +131,6 @@ public: #endif // defined(HAVE_LIBLCMS1) || defined(HAVE_LIBLCMS2) }; - - -namespace Inkscape { - #if defined(HAVE_LIBLCMS1) || defined(HAVE_LIBLCMS2) cmsColorSpaceSignature asICColorSpaceSig(ColorSpaceSig const & sig) { diff --git a/src/connector-context.h b/src/connector-context.h index e157bbf50..597feac38 100644 --- a/src/connector-context.h +++ b/src/connector-context.h @@ -27,7 +27,7 @@ #define SP_IS_CONNECTOR_CONTEXT_CLASS(k) (G_TYPE_CHECK_CLASS_TYPE((k), SP_TYPE_CONNECTOR_CONTEXT)) struct SPKnot; -struct SPCurve; +class SPCurve; namespace Inkscape { diff --git a/src/desktop-events.h b/src/desktop-events.h index cac7e089f..7123ce91b 100644 --- a/src/desktop-events.h +++ b/src/desktop-events.h @@ -17,7 +17,7 @@ #include <gtk/gtk.h> class SPDesktop; -class SPDesktopWidget; +struct SPDesktopWidget; struct SPCanvasItem; /* Item handlers */ diff --git a/src/desktop-handles.h b/src/desktop-handles.h index 6bf6f87d2..cca929369 100644 --- a/src/desktop-handles.h +++ b/src/desktop-handles.h @@ -16,8 +16,8 @@ class SPDesktop; class SPDocument; -class SPEventContext; -class SPNamedView; +struct SPEventContext; +struct SPNamedView; struct SPCanvas; struct SPCanvasGroup; struct SPCanvasItem; diff --git a/src/desktop-style.h b/src/desktop-style.h index 81485420b..47575de75 100644 --- a/src/desktop-style.h +++ b/src/desktop-style.h @@ -16,13 +16,13 @@ #include <glib.h> class ColorRGBA; -struct SPCSSAttr; +class SPCSSAttr; class SPDesktop; class SPObject; struct SPStyle; namespace Inkscape { namespace XML { -struct Node; +class Node; } } namespace Glib { class ustring; } diff --git a/src/desktop.h b/src/desktop.h index 27176868f..d8d4e151d 100644 --- a/src/desktop.h +++ b/src/desktop.h @@ -61,7 +61,7 @@ struct _GdkEventWindowState; typedef struct _GdkEventWindowState GdkEventWindowState; namespace Inkscape { - class Application; + struct Application; class MessageContext; class Selection; class ObjectHierarchy; diff --git a/src/dialogs/dialog-events.h b/src/dialogs/dialog-events.h index 5ba2d62c9..623058282 100644 --- a/src/dialogs/dialog-events.h +++ b/src/dialogs/dialog-events.h @@ -30,7 +30,7 @@ class Entry; class SPDesktop; namespace Inkscape { -class Application; +struct Application; } // namespace Inkscape typedef struct { diff --git a/src/display/canvas-bpath.h b/src/display/canvas-bpath.h index f0520f012..72eca6eeb 100644 --- a/src/display/canvas-bpath.h +++ b/src/display/canvas-bpath.h @@ -22,7 +22,7 @@ struct SPCanvasBPath; struct SPCanvasBPathClass; struct SPCanvasGroup; -struct SPCurve; +class SPCurve; #define SP_TYPE_CANVAS_BPATH (sp_canvas_bpath_get_type ()) #define SP_CANVAS_BPATH(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), SP_TYPE_CANVAS_BPATH, SPCanvasBPath)) diff --git a/src/display/drawing-group.h b/src/display/drawing-group.h index 974b3c977..775fec8c4 100644 --- a/src/display/drawing-group.h +++ b/src/display/drawing-group.h @@ -14,7 +14,7 @@ #include "display/drawing-item.h" -class SPStyle; +struct SPStyle; namespace Inkscape { diff --git a/src/display/drawing-item.h b/src/display/drawing-item.h index 810a61d9d..4a516512b 100644 --- a/src/display/drawing-item.h +++ b/src/display/drawing-item.h @@ -20,7 +20,7 @@ #include <2geom/rect.h> #include <2geom/affine.h> -class SPStyle; +struct SPStyle; namespace Inkscape { diff --git a/src/display/drawing-shape.h b/src/display/drawing-shape.h index ce9bed2eb..52496d86e 100644 --- a/src/display/drawing-shape.h +++ b/src/display/drawing-shape.h @@ -15,7 +15,7 @@ #include "display/drawing-item.h" #include "display/nr-style.h" -class SPStyle; +struct SPStyle; class SPCurve; namespace Inkscape { diff --git a/src/display/drawing-text.h b/src/display/drawing-text.h index 929d2bf2d..79b1b097c 100644 --- a/src/display/drawing-text.h +++ b/src/display/drawing-text.h @@ -15,7 +15,7 @@ #include "display/drawing-group.h" #include "display/nr-style.h" -class SPStyle; +struct SPStyle; class font_instance; namespace Inkscape { diff --git a/src/display/nr-filter-primitive.h b/src/display/nr-filter-primitive.h index 214b2cfc5..94bd6abb0 100644 --- a/src/display/nr-filter-primitive.h +++ b/src/display/nr-filter-primitive.h @@ -16,7 +16,7 @@ #include "display/nr-filter-types.h" #include "svg/svg-length.h" -class SPStyle; +struct SPStyle; namespace Inkscape { namespace Filters { diff --git a/src/display/nr-style.h b/src/display/nr-style.h index ce154cec0..597ae7a2c 100644 --- a/src/display/nr-style.h +++ b/src/display/nr-style.h @@ -18,7 +18,8 @@ class SPColor; class SPPaintServer; -class SPStyle; +struct SPStyle; + namespace Inkscape { class DrawingContext; } diff --git a/src/document-undo.h b/src/document-undo.h index 087e12b5a..f19ba9bb2 100644 --- a/src/document-undo.h +++ b/src/document-undo.h @@ -7,7 +7,7 @@ class SPDesktop; namespace Inkscape { -class Application; +struct Application; class DocumentUndo { diff --git a/src/document.h b/src/document.h index ca709a8b6..606a83be8 100644 --- a/src/document.h +++ b/src/document.h @@ -31,7 +31,6 @@ namespace Avoid { class Router; } -struct SPDesktop; class SPItem; class SPObject; struct SPGroup; @@ -45,14 +44,14 @@ namespace Inkscape { class EventLog; class ProfileManager; namespace XML { - class Document; + struct Document; class Node; } } class SPDefs; class SP3DBox; -class Persp3D; +struct Persp3D; class Persp3DImpl; class SPItemCtx; @@ -60,7 +59,7 @@ namespace Proj { class TransfMat3x4; } -class SPDocumentPrivate; +struct SPDocumentPrivate; /// Typed SVG document implementation. class SPDocument : public Inkscape::GC::Managed<>, diff --git a/src/draw-anchor.h b/src/draw-anchor.h index fc3ebaffc..89ff8b180 100644 --- a/src/draw-anchor.h +++ b/src/draw-anchor.h @@ -9,7 +9,7 @@ #include <2geom/point.h> struct SPDrawContext; -struct SPCurve; +class SPCurve; struct SPCanvasItem; /// The drawing anchor. diff --git a/src/extension/effect.h b/src/extension/effect.h index 6616a23ec..193b90a97 100644 --- a/src/extension/effect.h +++ b/src/extension/effect.h @@ -20,7 +20,7 @@ namespace Gtk { class VBox; } -struct SPDocument; +class SPDocument; namespace Inkscape { diff --git a/src/extension/extension.h b/src/extension/extension.h index dcabb3df7..b6b4c51ed 100644 --- a/src/extension/extension.h +++ b/src/extension/extension.h @@ -71,7 +71,7 @@ namespace Gtk { #define INKSCAPE_EXTENSION_NS_NC "extension" #define INKSCAPE_EXTENSION_NS "extension:" -struct SPDocument; +class SPDocument; namespace Inkscape { namespace Extension { diff --git a/src/extension/implementation/implementation.h b/src/extension/implementation/implementation.h index fb323cd78..9d679982a 100644 --- a/src/extension/implementation/implementation.h +++ b/src/extension/implementation/implementation.h @@ -29,7 +29,7 @@ namespace Gtk { } class SPDocument; -class SPStyle; +struct SPStyle; namespace Inkscape { diff --git a/src/extension/internal/filter/filter.h b/src/extension/internal/filter/filter.h index 1e8a3be0f..9aaa84aec 100644 --- a/src/extension/internal/filter/filter.h +++ b/src/extension/internal/filter/filter.h @@ -19,7 +19,7 @@ namespace Inkscape { namespace XML { - class Document; + struct Document; } namespace Extension { diff --git a/src/extension/internal/pdfinput/svg-builder.h b/src/extension/internal/pdfinput/svg-builder.h index a550565d6..46cddd73b 100644 --- a/src/extension/internal/pdfinput/svg-builder.h +++ b/src/extension/internal/pdfinput/svg-builder.h @@ -19,7 +19,7 @@ class SPDocument; namespace Inkscape { namespace XML { - class Document; + struct Document; class Node; } } diff --git a/src/extension/output.h b/src/extension/output.h index 5f6785b8b..c5b1beb45 100644 --- a/src/extension/output.h +++ b/src/extension/output.h @@ -15,7 +15,7 @@ #include <gtk/gtk.h> #include "extension.h" -struct SPDocument; +class SPDocument; namespace Inkscape { namespace Extension { diff --git a/src/extension/system.cpp b/src/extension/system.cpp index 56cc6d1af..f7fd48b3f 100644 --- a/src/extension/system.cpp +++ b/src/extension/system.cpp @@ -280,10 +280,9 @@ save(Extension *key, SPDocument *doc, gchar const *filename, bool setextension, // remember attributes in case this is an unofficial save and/or overwrite fails gchar *saved_uri = g_strdup(doc->getURI()); - bool saved_modified = false; gchar *saved_output_extension = NULL; gchar *saved_dataloss = NULL; - saved_modified = doc->isModifiedSinceSave(); + bool saved_modified = doc->isModifiedSinceSave(); saved_output_extension = g_strdup(get_file_save_extension(save_method).c_str()); saved_dataloss = g_strdup(repr->attribute("inkscape:dataloss")); if (official) { diff --git a/src/file.h b/src/file.h index 6ef60469a..b8e15bf3e 100644 --- a/src/file.h +++ b/src/file.h @@ -18,8 +18,8 @@ #include <glibmm/ustring.h> #include "ui/dialog/ocaldialogs.h" -struct SPDesktop; -struct SPDocument; +class SPDesktop; +class SPDocument; class SPObject; namespace Inkscape { diff --git a/src/filter-chemistry.h b/src/filter-chemistry.h index 2ac3ebe8f..751885ad2 100644 --- a/src/filter-chemistry.h +++ b/src/filter-chemistry.h @@ -19,7 +19,7 @@ #include "display/nr-filter-types.h" class SPDocument; -class SPFilter; +struct SPFilter; class SPFilterPrimitive; class SPItem; class SPObject; diff --git a/src/gradient-chemistry.h b/src/gradient-chemistry.h index 66a8e5281..728874f88 100644 --- a/src/gradient-chemistry.h +++ b/src/gradient-chemistry.h @@ -20,6 +20,7 @@ #include "sp-gradient.h" +class SPCSSAttr; class SPItem; /** @@ -96,8 +97,6 @@ Geom::Point getGradientCoords(SPItem *item, GrPointType point_type, guint point_ SPGradient *sp_item_gradient_get_vector(SPItem *item, Inkscape::PaintTarget fill_or_stroke); SPGradientSpread sp_item_gradient_get_spread(SPItem *item, Inkscape::PaintTarget fill_or_stroke); -struct SPCSSAttr; - void sp_item_gradient_stop_set_style(SPItem *item, GrPointType point_type, guint point_i, Inkscape::PaintTarget fill_or_stroke, SPCSSAttr *stop); guint32 sp_item_gradient_stop_query_style(SPItem *item, GrPointType point_type, guint point_i, Inkscape::PaintTarget fill_or_stroke); void sp_item_gradient_edit_stop(SPItem *item, GrPointType point_type, guint point_i, Inkscape::PaintTarget fill_or_stroke); diff --git a/src/gradient-drag.h b/src/gradient-drag.h index c92a5c22f..cd76d8a3c 100644 --- a/src/gradient-drag.h +++ b/src/gradient-drag.h @@ -34,7 +34,7 @@ struct SPKnot; class SPDesktop; class SPCSSAttr; class SPLinearGradient; -class SPMeshGradient; +struct SPMeshGradient; class SPItem; class SPObject; class SPRadialGradient; diff --git a/src/helper/pixbuf-ops.h b/src/helper/pixbuf-ops.h index af573277c..44851d388 100644 --- a/src/helper/pixbuf-ops.h +++ b/src/helper/pixbuf-ops.h @@ -14,7 +14,7 @@ #include <glib.h> -struct SPDocument; +class SPDocument; bool sp_export_jpg_file (SPDocument *doc, gchar const *filename, double x0, double y0, double x1, double y1, unsigned int width, unsigned int height, double xdpi, double ydpi, unsigned long bgcolor, double quality, GSList *items_only = NULL); diff --git a/src/helper/png-write.h b/src/helper/png-write.h index a8658ef88..8c04b25dc 100644 --- a/src/helper/png-write.h +++ b/src/helper/png-write.h @@ -16,7 +16,7 @@ #include <glib.h> #include <2geom/forward.h> -struct SPDocument; +class SPDocument; enum ExportResult { EXPORT_ERROR = 0, diff --git a/src/inkscape.h b/src/inkscape.h index 6ab07be86..368c7fa60 100644 --- a/src/inkscape.h +++ b/src/inkscape.h @@ -15,15 +15,15 @@ #include <list> #include <glib.h> -struct SPDesktop; -struct SPDocument; +class SPDesktop; +class SPDocument; struct SPEventContext; namespace Inkscape { struct Application; namespace XML { class Node; - class Document; + struct Document; } } diff --git a/src/io/bufferstream.h b/src/io/bufferstream.h index ed565572a..af5580efb 100644 --- a/src/io/bufferstream.h +++ b/src/io/bufferstream.h @@ -31,7 +31,7 @@ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */ -#include <vector.h> +#include <vector> #include "inkscapestream.h" diff --git a/src/io/gzipstream.cpp b/src/io/gzipstream.cpp index 8db7155db..380c42411 100644 --- a/src/io/gzipstream.cpp +++ b/src/io/gzipstream.cpp @@ -71,11 +71,11 @@ GzipInputStream::~GzipInputStream() { close(); if ( srcBuf ) { - free(srcBuf); + delete[] srcBuf; srcBuf = NULL; } if ( outputBuf ) { - free(outputBuf); + delete[] outputBuf; outputBuf = NULL; } } @@ -108,11 +108,11 @@ void GzipInputStream::close() } if ( srcBuf ) { - free(srcBuf); + delete[] srcBuf; srcBuf = NULL; } if ( outputBuf ) { - free(outputBuf); + delete[] outputBuf; outputBuf = NULL; } closed = true; @@ -161,7 +161,7 @@ bool GzipInputStream::load() int ch = source.get(); if (ch<0) break; - inputBuf.push_back((Byte)(ch & 0xff)); + inputBuf.push_back(static_cast<Byte>(ch & 0xff)); } long inputBufLen = inputBuf.size(); @@ -171,15 +171,15 @@ bool GzipInputStream::load() } srcLen = inputBuf.size(); - srcBuf = (Bytef *)malloc(srcLen * sizeof(Byte)); + srcBuf = new Byte [srcLen]; if (!srcBuf) { return false; } - outputBuf = (unsigned char *)malloc(OUT_SIZE); + outputBuf = new unsigned char [OUT_SIZE]; if ( !outputBuf ) { - free(srcBuf); - srcBuf = 0; + delete[] srcBuf; + srcBuf = NULL; return false; } outputBufLen = 0; // Not filled in yet @@ -187,33 +187,35 @@ bool GzipInputStream::load() std::vector<unsigned char>::iterator iter; Bytef *p = srcBuf; for (iter=inputBuf.begin() ; iter != inputBuf.end() ; ++iter) + { *p++ = *iter; + } int headerLen = 10; //Magic - int val = (int)srcBuf[0]; - //printf("val:%x\n", val); - val = (int)srcBuf[1]; - //printf("val:%x\n", val); + //int val = (int)srcBuf[0]; + ////printf("val:%x\n", val); + //val = (int)srcBuf[1]; + ////printf("val:%x\n", val); - //Method - val = (int)srcBuf[2]; - //printf("val:%x\n", val); + ////Method + //val = (int)srcBuf[2]; + ////printf("val:%x\n", val); //flags - int flags = (int)srcBuf[3]; + int flags = static_cast<int>(srcBuf[3]); - //time - val = (int)srcBuf[4]; - val = (int)srcBuf[5]; - val = (int)srcBuf[6]; - val = (int)srcBuf[7]; + ////time + //val = (int)srcBuf[4]; + //val = (int)srcBuf[5]; + //val = (int)srcBuf[6]; + //val = (int)srcBuf[7]; - //xflags - val = (int)srcBuf[8]; - //OS - val = (int)srcBuf[9]; + ////xflags + //val = (int)srcBuf[8]; + ////OS + //val = (int)srcBuf[9]; // if ( flags & FEXTRA ) { // headerLen += 2; @@ -272,19 +274,17 @@ bool GzipInputStream::load() int GzipInputStream::fetchMore() { - int zerr = Z_OK; - // TODO assumes we aren't called till the buffer is empty d_stream.next_out = outputBuf; d_stream.avail_out = OUT_SIZE; outputBufLen = 0; outputBufPos = 0; - zerr = inflate( &d_stream, Z_SYNC_FLUSH ); + int zerr = inflate( &d_stream, Z_SYNC_FLUSH ); if ( zerr == Z_OK || zerr == Z_STREAM_END ) { outputBufLen = OUT_SIZE - d_stream.avail_out; if ( outputBufLen ) { - crc = crc32(crc, (const Bytef *)outputBuf, outputBufLen); + crc = crc32(crc, const_cast<const Bytef *>(outputBuf), outputBufLen); } //printf("crc:%lx\n", crc); // } else if ( zerr != Z_STREAM_END ) { @@ -359,14 +359,14 @@ void GzipOutputStream::close() uLong outlong = crc; for (int n = 0; n < 4; n++) { - destination.put((int)(outlong & 0xff)); + destination.put(static_cast<gunichar>(outlong & 0xff)); outlong >>= 8; } //# send the file length outlong = totalIn & 0xffffffffL; for (int n = 0; n < 4; n++) { - destination.put((int)(outlong & 0xff)); + destination.put(static_cast<gunichar>(outlong & 0xff)); outlong >>= 8; } @@ -380,21 +380,23 @@ void GzipOutputStream::close() */ void GzipOutputStream::flush() { - if (closed || inputBuf.size()<1) + if (closed || inputBuf.empty()) + { return; - + } + uLong srclen = inputBuf.size(); - Bytef *srcbuf = (Bytef *)malloc(srclen * sizeof(Byte)); + Bytef *srcbuf = new Bytef [srclen]; if (!srcbuf) { return; } uLong destlen = srclen; - Bytef *destbuf = (Bytef *)malloc((destlen + (srclen/100) + 13) * sizeof(Byte)); + Bytef *destbuf = new Bytef [(destlen + (srclen/100) + 13)]; if (!destbuf) { - free(srcbuf); + delete[] srcbuf; return; } @@ -403,9 +405,9 @@ void GzipOutputStream::flush() for (iter=inputBuf.begin() ; iter != inputBuf.end() ; ++iter) *p++ = *iter; - crc = crc32(crc, (const Bytef *)srcbuf, srclen); + crc = crc32(crc, const_cast<const Bytef *>(srcbuf), srclen); - int zerr = compress(destbuf, (uLongf *)&destlen, srcbuf, srclen); + int zerr = compress(destbuf, static_cast<uLongf *>(&destlen), srcbuf, srclen); if (zerr != Z_OK) { printf("Some kind of problem\n"); @@ -421,11 +423,8 @@ void GzipOutputStream::flush() destination.flush(); inputBuf.clear(); - free(srcbuf); - free(destbuf); - - //printf("done\n"); - + delete[] srcbuf; + delete[] destbuf; } diff --git a/src/io/inkjar.cpp b/src/io/inkjar.cpp index 20b164b99..4af140737 100644 --- a/src/io/inkjar.cpp +++ b/src/io/inkjar.cpp @@ -311,7 +311,7 @@ guint8 *JarFile::get_uncompressed_file(guint32 compressed_size, guint32 crc, in_a -= nbytes; #ifdef DEBUG - std::printf("%d bytes written\n", out_a); + std::printf("%u bytes written\n", out_a); #endif } lseek(fd, eflen, SEEK_CUR); diff --git a/src/knot.h b/src/knot.h index ec640df3a..4d87d703f 100644 --- a/src/knot.h +++ b/src/knot.h @@ -24,8 +24,6 @@ #include "sp-item.h" class SPDesktop; -class SPKnot; -class SPKnotClass; struct SPCanvasItem; #define SP_TYPE_KNOT (sp_knot_get_type()) diff --git a/src/knotholder.h b/src/knotholder.h index 792a0c912..eab981184 100644 --- a/src/knotholder.h +++ b/src/knotholder.h @@ -35,7 +35,7 @@ class PowerStrokePointArrayParamKnotHolderEntity; class KnotHolderEntity; class SPItem; class SPDesktop; -class SPKnot; +struct SPKnot; /* fixme: Think how to make callbacks most sensitive (Lauris) */ typedef void (* SPKnotHolderReleasedFunc) (SPItem *item); diff --git a/src/libnrtype/Layout-TNG.h b/src/libnrtype/Layout-TNG.h index f4a09f25b..488a974ea 100644 --- a/src/libnrtype/Layout-TNG.h +++ b/src/libnrtype/Layout-TNG.h @@ -34,7 +34,7 @@ namespace Inkscape { using Inkscape::Extension::Internal::CairoRenderContext; #endif -class SPStyle; +struct SPStyle; class Shape; class SPPrintContext; class SVGLength; diff --git a/src/libnrtype/font-style-to-pos.h b/src/libnrtype/font-style-to-pos.h index 41ba6cf72..56eb391c2 100644 --- a/src/libnrtype/font-style-to-pos.h +++ b/src/libnrtype/font-style-to-pos.h @@ -3,7 +3,7 @@ #include <libnrtype/nr-type-pos-def.h> -class SPStyle; +struct SPStyle; NRTypePosDef font_style_to_pos(SPStyle const &style); diff --git a/src/line-geometry.h b/src/line-geometry.h index dcd157d47..48baad265 100644 --- a/src/line-geometry.h +++ b/src/line-geometry.h @@ -19,6 +19,8 @@ #include "document.h" #include "ui/view/view.h" +class SPDesktop; + namespace Box3D { class Line { diff --git a/src/live_effects/lpe-angle_bisector.cpp b/src/live_effects/lpe-angle_bisector.cpp index 91f779ef3..2f57b710b 100644 --- a/src/live_effects/lpe-angle_bisector.cpp +++ b/src/live_effects/lpe-angle_bisector.cpp @@ -61,8 +61,6 @@ LPEAngleBisector::doEffect_path (std::vector<Geom::Path> const & path_in) { using namespace Geom; - std::vector<Geom::Path> path_out; - // we assume that the path has >= 3 nodes ptA = path_in[0].pointAt(1); Point B = path_in[0].initialPoint(); diff --git a/src/live_effects/lpe-bspline.cpp b/src/live_effects/lpe-bspline.cpp index f5dff3abe..9e83bbb41 100644 --- a/src/live_effects/lpe-bspline.cpp +++ b/src/live_effects/lpe-bspline.cpp @@ -3,29 +3,48 @@ * Released under GNU GPL, read the file 'COPYING' for more information */ -#include "live_effects/lpe-bspline.h" +#include "xml/repr.h" +#include "svg/svg.h" #include "display/curve.h" +#include <glib.h> +#include <glibmm/i18n.h> +#include "sp-path.h" +#include "style.h" +#include "document.h" +#include "document-undo.h" +#include "selection.h" +#include "desktop.h" +#include "verbs.h" +#include "desktop-handles.h" +#include <gtkmm/box.h> +#include <gtkmm/label.h> +#include <gtkmm/checkbutton.h> +#include <glibmm/listhandle.h> +#include "live_effects/lpe-bspline.h" +#include "live_effects/lpeobject.h" +#include "live_effects/lpeobject-reference.h" +#include "sp-lpe-item.h" +#include "display/sp-canvas.h" #include <typeinfo> -#include <2geom/pathvector.h> -#include <2geom/affine.h> #include <2geom/bezier-curve.h> #include "helper/geom-curves.h" -#include <glibmm/i18n.h> +#include "ui/widget/scalar.h" + + // For handling un-continuous paths: #include "message-stack.h" #include "inkscape.h" #include "desktop.h" + +using Inkscape::DocumentUndo; namespace Inkscape { namespace LivePathEffect { LPEBSpline::LPEBSpline(LivePathEffectObject *lpeobject) : - Effect(lpeobject),unify_weights(_("Unify weights:"), - _("Percent of the with for all poinrs"), "unify_weights", &wr, this, 33.) + Effect(lpeobject),scal,noCusp { - registerParameter( dynamic_cast<Parameter *>(&unify_weights) ); - unify_weights.param_set_range(0, 100.); } LPEBSpline::~LPEBSpline() @@ -33,12 +52,15 @@ LPEBSpline::~LPEBSpline() } void -LPEBSpline::doEffect(SPCurve * curve) +LPEBSpline::doOnApply(SPLPEItem const* lpeitem) { -LPEBSpline::doEffect(curve,NULL) + if (!SP_IS_SHAPE(lpeitem)) { + g_warning("LPE BSpline can only be applied to shapes (not groups)."); + } } + void -LPEBSpline::doEffect(SPCurve * curve,int value) +LPEBSpline::doEffect(SPCurve * curve) { if(curve->get_segment_count() < 2) return; @@ -96,21 +118,11 @@ LPEBSpline::doEffect(SPCurve * curve,int value) cubic = dynamic_cast<Geom::CubicBezier const*>(&*curve_it1); if(cubic){ SBasisIn = in->first_segment()->toSBasis(); - if(value){ - pointAt1 = SBasisIn.valueAt(value); - pointAt2 = SBasisIn.valueAt(1-value); - }else{ - pointAt1 = SBasisIn.valueAt(Geom::nearest_point((*cubic)[1],*in->first_segment())); - pointAt2 = SBasisIn.valueAt(Geom::nearest_point((*cubic)[2],*in->first_segment())); - } + pointAt1 = SBasisIn.valueAt(Geom::nearest_point((*cubic)[1],*in->first_segment())); + pointAt2 = SBasisIn.valueAt(Geom::nearest_point((*cubic)[2],*in->first_segment())); }else{ - if(value){ - pointAt1 = SBasisIn.valueAt(value); - pointAt2 = SBasisIn.valueAt(1-value); - }else{ - pointAt1 = in->first_segment()->initialPoint(); - pointAt2 = in->first_segment()->finalPoint(); - } + pointAt1 = in->first_segment()->initialPoint(); + pointAt2 = in->first_segment()->finalPoint(); } in->reset(); delete in; @@ -122,22 +134,12 @@ LPEBSpline::doEffect(SPCurve * curve,int value) cubic = dynamic_cast<Geom::CubicBezier const*>(&*curve_it2); if(cubic){ SBasisOut = out->first_segment()->toSBasis(); - if(value){ - nextPointAt1 = SBasisIn.valueAt(value); - nextPointAt2 = SBasisIn.valueAt(1-value); - }else{ - nextPointAt1 = SBasisOut.valueAt(Geom::nearest_point((*cubic)[1],*out->first_segment())); - nextPointAt2 = SBasisOut.valueAt(Geom::nearest_point((*cubic)[2],*out->first_segment()));; - ] + nextPointAt1 = SBasisOut.valueAt(Geom::nearest_point((*cubic)[1],*out->first_segment())); + nextPointAt2 = SBasisOut.valueAt(Geom::nearest_point((*cubic)[2],*out->first_segment()));; nextPointAt3 = (*cubic)[3]; }else{ - if(value){ - nextPointAt1 = SBasisIn.valueAt(value); - nextPointAt2 = SBasisIn.valueAt(1-value); - }else{ - nextPointAt1 = out->first_segment()->initialPoint(); - nextPointAt2 = out->first_segment()->finalPoint(); - } + nextPointAt1 = out->first_segment()->initialPoint(); + nextPointAt2 = out->first_segment()->finalPoint(); nextPointAt3 = out->first_segment()->finalPoint(); } out->reset(); @@ -158,13 +160,8 @@ LPEBSpline::doEffect(SPCurve * curve,int value) //Y este hará de final de curva node = SBasisHelper.valueAt(0.5); SPCurve *curveHelper = new SPCurve(); - if(value){ - curveHelper->moveto(*in->first_segment()->initialPoint()); - curveHelper->curveto(pointAt1, pointAt2, *in->first_segment()->finalPoint()); - }else{ - curveHelper->moveto(previousNode); - curveHelper->curveto(pointAt1, pointAt2, node); - } + curveHelper->moveto(previousNode); + curveHelper->curveto(pointAt1, pointAt2, node); //añadimos la curva generada a la curva pricipal nCurve->append_continuous(curveHelper, 0.0625); curveHelper->reset(); @@ -210,11 +207,7 @@ LPEBSpline::doEffect(SPCurve * curve,int value) SBasisHelper = lineHelper->first_segment()->toSBasis(); lineHelper->reset(); delete lineHelper; - //Guardamos el principio de la curva - if(value) - startNode = path_it->begin()->initialPoint(); - else - startNode = SBasisHelper.valueAt(0.5); + startNode = SBasisHelper.valueAt(0.5); curveHelper->curveto(nextPointAt1, nextPointAt2, startNode); nCurve->append_continuous(curveHelper, 0.0625); nCurve->move_endpoints(startNode,startNode); @@ -241,37 +234,219 @@ LPEBSpline::doEffect(SPCurve * curve,int value) } } +Gtk::Widget * +LPEBSpline::newWidget() +{ + Gtk::VBox * vbox = dynamic_cast<Gtk::VBox*>(Effect::newWidget()); + vbox->set_border_width(5); + Glib::ustring title = Glib::ustring(_("Ignore cusp nodes")); + Glib::ustring tip = Glib::ustring(_("Ignore cusp nodes")); + Gtk::Widget *noCuspWidget = new LPEBSpline::newCheckButton(title,tip); + vbox->pack_start(*noCuspWidget,true,true,(guint)2); + title = Glib::ustring(_("Unify weights:")); + tip = Glib::ustring(_("Percent of the with for all poinrs")); + Gtk::Widget *scalWidget = new LPEBSpline::newScalar(title,tip); + vbox->pack_start(*scalWidget, true, true,2); + return dynamic_cast<Gtk::VBox *> (vbox); +} + +Gtk::Widget * +LPEBSpline::newScalar(Glib::ustring title, Glib::ustring tip) +{ + scal = Gtk::manage( new Inkscape::UI::Widget::Scalar(title, tip)); + scal->setValue(33.); + scal->setDigits(2); + scal->setIncrements(1., 5.); + scal->setRange(0, 100.); + scal->setProgrammatically = false; + scal->addSlider(); + scal->signal_value_changed().connect(sigc::mem_fun (*this,&LPEBSpline::updateAllHandles)); + return dynamic_cast<Gtk::Widget *>(scal); +} + +Gtk::Widget * +LPEBSpline::newCheckButton(Glib::ustring title, Glib::ustring tip) +{ + noCusp = Gtk::manage( new Gtk::CheckButton(title,tip)); + return dynamic_cast<Gtk::Widget *>(noCusp); +} + void -LPEBSpline::updateAllHandles(int value) +LPEBSpline::updateAllHandles() { + double value = scal->setValue(33.); + bool noCusp = false; SPDesktop *desktop = inkscape_active_desktop(); // TODO: Is there a better method to find the item's desktop? Inkscape::Selection *selection = sp_desktop_selection(desktop); for (GSList *items = (GSList *) selection->itemList(); items != NULL; items = items->next) { - if (SP_IS_LPE_ITEM(items->data) && sp_lpe_item_has_path_effect(items->data)){ - PathEffectList effect_list = sp_lpe_item_get_effect_list(SP_LPE_ITEM(_path)); - lpe_bsp = dynamic_cast<LivePathEffect::LPEBSpline*>( effect_list.front()->lpeobject->get_lpe()); - if(lpe_bsp) - LPEBSpline::updateHandles((SPItem *) items->data,value); + if (SP_IS_LPE_ITEM((SPLPEItem *)items->data) && sp_lpe_item_has_path_effect((SPLPEItem *)items->data)){ + LivePathEffect::LPEBSpline *lpe_bsp = NULL; + lpe_bsp = dynamic_cast<LivePathEffect::LPEBSpline*>(sp_lpe_item_has_path_effect_of_type(SP_LPE_ITEM((SPLPEItem *)items->data),Inkscape::LivePathEffect::BSPLINE)->getLPEObj()->get_lpe()); + if(lpe_bsp){ + SPItem *item = (SPItem *) items->data; + SPPath *path = SP_PATH(item); + SPCurve *curve = path->get_curve_for_edit(); + LPEBSpline::doBSplineFromWidget(curve,value,noCusp); + gchar *str = sp_svg_write_path(curve->get_pathvector()); + path->getRepr()->setAttribute("inkscape:original-d", str); + g_free(str); + curve->unref(); + SPDesktop *desktop = inkscape_active_desktop(); + desktop->clearWaitingCursor(); + DocumentUndo::done(sp_desktop_document(desktop), SP_VERB_CONTEXT_LPE, + _("Modified the weight of the BSpline")); + } + } } } -void -LPEBSpline::updateHandles(SPItem * item,int value){ - - Inkscape::XML::Node *newitem = item->getRepr(); - Inkscape::XML::Node *path = sp_repr_lookup_child(newitem,"svg:path", -1); //unlimited search depth - if ( path != NULL ){ - gchar const *svgd = path->attribute("d"); + +void +LPEBSpline::doBSplineFromWidget(SPCurve * curve, double value , bool noCusp) +{ + if(curve->get_segment_count() < 2) + return; + // Make copy of old path as it is changed during processing + Geom::PathVector const original_pathv = curve->get_pathvector(); + curve->reset(); + + //Recorremos todos los paths a los que queremos aplicar el efecto, hasta el penúltimo + for(Geom::PathVector::const_iterator path_it = original_pathv.begin(); path_it != original_pathv.end(); ++path_it) { + //Si está vacÃo... + if (path_it->empty()) + continue; + //Itreadores + + Geom::Path::const_iterator curve_it1 = path_it->begin(); // incoming curve + Geom::Path::const_iterator curve_it2 = ++(path_it->begin()); // outgoing curve + Geom::Path::const_iterator curve_endit = path_it->end_default(); // this determines when the loop has to stop + //Creamos las lineas rectas que unen todos los puntos del trazado y donde se calcularán + //los puntos clave para los manejadores. + //Esto hace que la curva BSpline no pierda su condición aunque se trasladen + //dichos manejadores + SPCurve *nCurve = new SPCurve(); + Geom::Point pointAt0(0,0); + Geom::Point pointAt1(0,0); + Geom::Point pointAt2(0,0); + Geom::Point pointAt3(0,0); + Geom::Point nextPointAt1(0,0); + Geom::Point nextPointAt2(0,0); + Geom::Point nextPointAt3(0,0); + Geom::D2< Geom::SBasis > SBasisIn; + Geom::D2< Geom::SBasis > SBasisOut; + Geom::CubicBezier const *cubic = NULL; + if (path_it->closed()) { + // if the path is closed, maybe we have to stop a bit earlier because the closing line segment has zerolength. + const Geom::Curve &closingline = path_it->back_closed(); // the closing line segment is always of type Geom::LineSegment. + if (are_near(closingline.initialPoint(), closingline.finalPoint())) { + // closingline.isDegenerate() did not work, because it only checks for *exact* zero length, which goes wrong for relative coordinates and rounding errors... + // the closing line segment has zero-length. So stop before that one! + curve_endit = path_it->end_open(); + } + } + //Si la curva está cerrada calculamos el punto donde + //deveria estar el nodo BSpline de cierre/inicio de la curva + //en posible caso de que se cierre con una linea recta creando un nodo BSPline + + //Recorremos todos los segmentos menos el último + while ( curve_it2 != curve_endit ) + { + //previousPointAt3 = pointAt3; + //Calculamos los puntos que dividirÃan en tres segmentos iguales el path recto de entrada y de salida + SPCurve * in = new SPCurve(); + in->moveto(curve_it1->initialPoint()); + in->lineto(curve_it1->finalPoint()); + cubic = dynamic_cast<Geom::CubicBezier const*>(&*curve_it1); + pointAt0 = in->first_segment()->initialPoint(); + SBasisIn = in->first_segment()->toSBasis(); + if(cubic){ + if(!noCusp || (*cubic)[1] != in->first_segment()->initialPoint()) + pointAt1 = SBasisIn.valueAt(value); + else + pointAt1 = in->first_segment()->initialPoint(); + if(!noCusp || (*cubic)[2] != in->first_segment()->finalPoint()) + pointAt2 = SBasisIn.valueAt(1-value); + else + pointAt2 = in->first_segment()->finalPoint(); + }else{ + if(!noCusp){ + pointAt1 = SBasisIn.valueAt(value); + pointAt2 = SBasisIn.valueAt(1-value); + }else{ + pointAt1 = in->first_segment()->initialPoint(); + pointAt2 = in->first_segment()->finalPoint(); + } + } + pointAt3 = in->first_segment()->finalPoint(); + in->reset(); + delete in; + //Y hacemos lo propio con el path de salida + //nextPointAt0 = curveOut.valueAt(0); + SPCurve * out = new SPCurve(); + out->moveto(curve_it2->initialPoint()); + out->lineto(curve_it2->finalPoint()); + SBasisOut = out->first_segment()->toSBasis(); + cubic = dynamic_cast<Geom::CubicBezier const*>(&*curve_it2); + if(cubic){ + if(!noCusp || (*cubic)[1] != out->first_segment()->initialPoint()) + nextPointAt1 = SBasisOut.valueAt(value); + else + nextPointAt1 = out->first_segment()->initialPoint(); + if(!noCusp || (*cubic)[2] != out->first_segment()->finalPoint()) + nextPointAt2 = SBasisOut.valueAt(1-value); + else + nextPointAt2 = out->first_segment()->finalPoint(); + }else{ + if(!noCusp){ + nextPointAt1 = SBasisOut.valueAt(value); + nextPointAt2 = SBasisOut.valueAt(1-value); + }else{ + nextPointAt1 = out->first_segment()->initialPoint(); + nextPointAt2 = out->first_segment()->finalPoint(); + } + } + nextPointAt3 = out->first_segment()->finalPoint(); + out->reset(); + delete out; + //La curva BSpline se forma calculando el centro del segmanto de unión + //de el punto situado en las 2/3 partes de el segmento de entrada + //con el punto situado en la posición 1/3 del segmento de salida + //Estos dos puntos ademas estan posicionados en el lugas correspondiente de + //los manejadores de la curva + SPCurve *curveHelper = new SPCurve(); + curveHelper->moveto(pointAt0); + curveHelper->curveto(pointAt1, pointAt2, pointAt3); + //añadimos la curva generada a la curva pricipal + nCurve->append_continuous(curveHelper, 0.0625); + curveHelper->reset(); + delete curveHelper; + //aumentamos los valores para el siguiente paso en el bucle + ++curve_it1; + ++curve_it2; + } + //Aberiguamos la ultima parte de la curva correspondiente al último segmento + SPCurve *curveHelper = new SPCurve(); + curveHelper->moveto(pointAt3); + if (path_it->closed()) { + curveHelper->curveto(nextPointAt1, nextPointAt2, path_it->begin()->initialPoint()); + nCurve->append_continuous(curveHelper, 0.0625); + nCurve->move_endpoints(path_it->begin()->initialPoint(),path_it->begin()->initialPoint()); + }else{ + curveHelper->curveto(nextPointAt1, nextPointAt2, nextPointAt3); + nCurve->append_continuous(curveHelper, 0.0625); + nCurve->move_endpoints(path_it->begin()->initialPoint(),nextPointAt3); + } + curveHelper->reset(); + delete curveHelper; + //y cerramos la curva + if (path_it->closed()) { + nCurve->closepath_current(); + } + curve->append(nCurve,false); + nCurve->reset(); + delete nCurve; } - - SPCurve *original = new SPCurve(); - original = (SPPath *)item->original_curve(); - LPEBSpline::doEffect(original,value); - gchar *str = sp_svg_write_path( original->get_pathvector() ); - g_assert( str != NULL ); - path->setAttribute ("inkscaspe:original-d", str); - item->updateRepr(); } }; //namespace LivePathEffect diff --git a/src/live_effects/lpe-bspline.h b/src/live_effects/lpe-bspline.h index 501b1fdaf..eace58837 100644 --- a/src/live_effects/lpe-bspline.h +++ b/src/live_effects/lpe-bspline.h @@ -9,29 +9,39 @@ #include "live_effects/effect.h" #include "live_effects/parameter/parameter.h" +#include "ui/widget/scalar.h" +#include <gtkmm/checkbutton.h> namespace Inkscape { namespace LivePathEffect { + + class LPEBSpline : public Effect { public: LPEBSpline(LivePathEffectObject *lpeobject); virtual ~LPEBSpline(); - virtual std::vector<Geom::Path> doEffect_path (std::vector<Geom::Path> const & input_path); - virtual LPEPathFlashType pathFlashType() const { return SUPPRESS_FLASH; } + virtual void doOnApply(SPLPEItem const* lpeitem); + virtual void doEffect(SPCurve * curve); - - virtual void doEffect(SPCurve * curve, int value); - - virtual void updateAllHandles(int value); - - virtual void updateHandles(SPItem * item , int value); + + virtual void updateAllHandles(); + + virtual void newScalar(Glib::ustring title, Glib::ustring tip); + + virtual void newCheckButton(Glib::ustring title, Glib::ustring tip); + + virtual void doBSplineFromWidget(SPCurve * curve, double value, bool noCusp); + + virtual Gtk::Widget * newWidget(); + private: - ScalarParam unify_weights; + Inkscape::UI::Widget::Scalar* scal; + Gtk::CheckButton* noCusp; LPEBSpline(const LPEBSpline&); LPEBSpline& operator=(const LPEBSpline&); }; diff --git a/src/live_effects/lpe-dynastroke.cpp b/src/live_effects/lpe-dynastroke.cpp index 467fdfd9c..a5295d269 100644 --- a/src/live_effects/lpe-dynastroke.cpp +++ b/src/live_effects/lpe-dynastroke.cpp @@ -152,7 +152,7 @@ LPEDynastroke::doEffect_pwd2 (Geom::Piecewise<Geom::D2<Geom::SBasis> > const & p double angle_rad = angle*M_PI/180.;//TODO: revert orientation?... Piecewise<SBasis> w; - std::vector<double> corners = find_corners(m); + // std::vector<double> corners = find_corners(m); DynastrokeMethod stroke_method = method.get_value(); if (roundness==1.) { diff --git a/src/live_effects/lpe-extrude.cpp b/src/live_effects/lpe-extrude.cpp index 7f5a00cf8..8b3f4714a 100644 --- a/src/live_effects/lpe-extrude.cpp +++ b/src/live_effects/lpe-extrude.cpp @@ -124,9 +124,9 @@ LPEExtrude::doEffect_pwd2 (Geom::Piecewise<Geom::D2<Geom::SBasis> > const & pwd2 } std::vector<double> connector_pts; - if (rts.size() < 1) { + if (rts.empty()) { connector_pts = cusps; - } else if (cusps.size() < 1) { + } else if (cusps.empty()) { connector_pts = rts; } else { connector_pts = rts; diff --git a/src/live_effects/lpe-recursiveskeleton.cpp b/src/live_effects/lpe-recursiveskeleton.cpp index 906c430c1..452139344 100644 --- a/src/live_effects/lpe-recursiveskeleton.cpp +++ b/src/live_effects/lpe-recursiveskeleton.cpp @@ -49,8 +49,6 @@ LPERecursiveSkeleton::doEffect_pwd2 (Geom::Piecewise<Geom::D2<Geom::SBasis> > co using namespace Geom; Piecewise<D2<SBasis> > output; - std::vector<Piecewise<D2<SBasis> > > pre_output; - double prop_scale = 1.0; D2<Piecewise<SBasis> > patternd2 = make_cuts_independent(pwd2_in); @@ -90,8 +88,7 @@ LPERecursiveSkeleton::doEffect_pwd2 (Geom::Piecewise<Geom::D2<Geom::SBasis> > co Piecewise<D2<SBasis> > n = rot90(derivative(uskeleton)); n = force_continuity(remove_short_cuts(n,.1)); - double scaling = 1; - scaling = (uskeleton.domain().extent() - toffset)/pattBndsX->extent(); + double scaling = (uskeleton.domain().extent() - toffset)/pattBndsX->extent(); // TODO investigate why pattWidth is not being used: double pattWidth = pattBndsX->extent() * scaling; diff --git a/src/live_effects/lpe-ruler.cpp b/src/live_effects/lpe-ruler.cpp index 88743548b..fefdad95a 100644 --- a/src/live_effects/lpe-ruler.cpp +++ b/src/live_effects/lpe-ruler.cpp @@ -80,11 +80,10 @@ LPERuler::ruler_mark(Geom::Point const &A, Geom::Point const &n, MarkType const { using namespace Geom; - gboolean success; double real_mark_length = mark_length; - success = sp_convert_distance(&real_mark_length, unit, &sp_unit_get_by_id(SP_UNIT_PX)); + sp_convert_distance(&real_mark_length, unit, &sp_unit_get_by_id(SP_UNIT_PX)); double real_minor_mark_length = minor_mark_length; - success = sp_convert_distance(&real_minor_mark_length, unit, &sp_unit_get_by_id(SP_UNIT_PX)); + sp_convert_distance(&real_minor_mark_length, unit, &sp_unit_get_by_id(SP_UNIT_PX)); n_major = real_mark_length * n; n_minor = real_minor_mark_length * n; @@ -134,10 +133,10 @@ LPERuler::doEffect_pwd2 (Geom::Piecewise<Geom::D2<Geom::SBasis> > const & pwd2_i std::vector<double> s_cuts; double real_mark_distance = mark_distance; - gboolean success = sp_convert_distance(&real_mark_distance, unit, &sp_unit_get_by_id(SP_UNIT_PX)); + sp_convert_distance(&real_mark_distance, unit, &sp_unit_get_by_id(SP_UNIT_PX)); double real_offset = offset; - success = sp_convert_distance(&real_offset, unit, &sp_unit_get_by_id(SP_UNIT_PX)); + sp_convert_distance(&real_offset, unit, &sp_unit_get_by_id(SP_UNIT_PX)); for (double s = real_offset; s<totlength; s+=real_mark_distance){ s_cuts.push_back(s); } diff --git a/src/live_effects/lpeobject-reference.h b/src/live_effects/lpeobject-reference.h index 571c3b1f1..b1ba1ee4e 100644 --- a/src/live_effects/lpeobject-reference.h +++ b/src/live_effects/lpeobject-reference.h @@ -15,11 +15,11 @@ namespace Inkscape { namespace XML { -struct Node; +class Node; } } -struct LivePathEffectObject; +class LivePathEffectObject; namespace Inkscape { diff --git a/src/live_effects/lpeobject.h b/src/live_effects/lpeobject.h index 3ea1ea9ad..2d04f8842 100644 --- a/src/live_effects/lpeobject.h +++ b/src/live_effects/lpeobject.h @@ -15,7 +15,7 @@ namespace Inkscape { namespace XML { class Node; - class Document; + struct Document; } namespace LivePathEffect { class Effect; diff --git a/src/live_effects/parameter/parameter.cpp b/src/live_effects/parameter/parameter.cpp index 30414842d..7e155cb92 100644 --- a/src/live_effects/parameter/parameter.cpp +++ b/src/live_effects/parameter/parameter.cpp @@ -5,7 +5,7 @@ */ #include <glibmm/i18n.h> - +#include "live_effects/lpe-bspline.h" #include "live_effects/parameter/parameter.h" #include "live_effects/effect.h" #include "svg/svg.h" @@ -128,12 +128,6 @@ ScalarParam::param_newWidget() { Inkscape::UI::Widget::RegisteredScalar *rsu = Gtk::manage( new Inkscape::UI::Widget::RegisteredScalar( param_label, param_tooltip, param_key, *param_wr, param_effect->getRepr(), param_effect->getSPDoc() ) ); - //BSpline - lpe_bsp = dynamic_cast<LivePathEffect::LPEBSpline*>(param_effect->get_lpe()); - if(lpe_bsp){ - lpe_bsp->updateAllHandles(value/100); - } - //BSpline End rsu->setValue(value); rsu->setDigits(digits); rsu->setIncrements(inc_step, inc_page); diff --git a/src/persp3d-reference.h b/src/persp3d-reference.h index 28744b2fa..fa9eca5c9 100644 --- a/src/persp3d-reference.h +++ b/src/persp3d-reference.h @@ -19,7 +19,7 @@ class SPObject; namespace Inkscape { namespace XML { -struct Node; +class Node; } } diff --git a/src/persp3d.h b/src/persp3d.h index db4971635..25db4787c 100644 --- a/src/persp3d.h +++ b/src/persp3d.h @@ -27,7 +27,7 @@ #include "inkscape.h" class SPBox3D; -class Box3DContext; +struct Box3DContext; class Persp3DImpl { public: diff --git a/src/print.h b/src/print.h index bbf95b833..80d0446fd 100644 --- a/src/print.h +++ b/src/print.h @@ -18,7 +18,7 @@ class Window; } class SPDocument; -class SPStyle; +struct SPStyle; namespace Inkscape { namespace Extension { diff --git a/src/profile-manager.h b/src/profile-manager.h index be9446c17..9d361f40c 100644 --- a/src/profile-manager.h +++ b/src/profile-manager.h @@ -17,7 +17,7 @@ class SPDocument; namespace Inkscape { -class ColorProfile; +struct ColorProfile; class ProfileManager : public DocumentSubset, public GC::Finalized diff --git a/src/satisfied-guide-cns.h b/src/satisfied-guide-cns.h index 27fe043d0..73e1e7e7f 100644 --- a/src/satisfied-guide-cns.h +++ b/src/satisfied-guide-cns.h @@ -5,6 +5,7 @@ #include <vector> #include <sp-item.h> +class SPDesktop; class SPGuideConstraint; void satisfied_guide_cns(SPDesktop const &desktop, diff --git a/src/selection-chemistry.h b/src/selection-chemistry.h index 5b35ded09..83dd93bdd 100644 --- a/src/selection-chemistry.h +++ b/src/selection-chemistry.h @@ -29,6 +29,7 @@ namespace LivePathEffect { } class SPCSSAttr; +class SPDesktop; namespace Inkscape { class SelectionHelper { diff --git a/src/selection.h b/src/selection.h index 85e06a5c6..10775dcb5 100644 --- a/src/selection.h +++ b/src/selection.h @@ -27,9 +27,10 @@ #include "sp-item.h" #include "snapped-point.h" +class SPDesktop; class SPItem; class SPBox3D; -class Persp3D; +struct Persp3D; namespace Inkscape { namespace XML { diff --git a/src/snap.h b/src/snap.h index 67af20063..6a87d95cc 100644 --- a/src/snap.h +++ b/src/snap.h @@ -31,7 +31,7 @@ enum SPGuideDragType { // used both here and in desktop-events.cpp }; class SPGuide; -class SPNamedView; +struct SPNamedView; /** * Class to coordinate snapping operations. diff --git a/src/sp-conn-end-pair.h b/src/sp-conn-end-pair.h index 53dd61ccf..9f7f5a5d2 100644 --- a/src/sp-conn-end-pair.h +++ b/src/sp-conn-end-pair.h @@ -21,7 +21,7 @@ class SPConnEnd; -struct SPCurve; +class SPCurve; class SPPath; class SPItem; class SPObject; diff --git a/src/sp-ellipse.h b/src/sp-ellipse.h index 5074be354..d22501f6b 100644 --- a/src/sp-ellipse.h +++ b/src/sp-ellipse.h @@ -27,9 +27,6 @@ G_BEGIN_DECLS #define SP_IS_GENERICELLIPSE(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), SP_TYPE_GENERICELLIPSE)) #define SP_IS_GENERICELLIPSE_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), SP_TYPE_GENERICELLIPSE)) -class SPGenericEllipse; -class SPGenericEllipseClass; - struct SPGenericEllipse : public SPShape { SVGLength cx; SVGLength cy; diff --git a/src/sp-filter-reference.h b/src/sp-filter-reference.h index 5901dca07..7a335aed4 100644 --- a/src/sp-filter-reference.h +++ b/src/sp-filter-reference.h @@ -5,7 +5,7 @@ class SPObject; class SPDocument; -class SPFilter; +struct SPFilter; class SPFilterReference : public Inkscape::URIReference { public: diff --git a/src/sp-filter.h b/src/sp-filter.h index d0529e542..a3e7cd35c 100644 --- a/src/sp-filter.h +++ b/src/sp-filter.h @@ -35,7 +35,7 @@ namespace Filters { class Filter; } } -struct SPFilterReference; +class SPFilterReference; class SPFilterPrimitive; struct ltstr { diff --git a/src/sp-gradient-fns.h b/src/sp-gradient-fns.h index e57877256..165fd3ed8 100644 --- a/src/sp-gradient-fns.h +++ b/src/sp-gradient-fns.h @@ -12,7 +12,7 @@ #include "sp-gradient-units.h" class SPGradient; -class SPMeshGradient; +struct SPMeshGradient; SPGradientSpread sp_gradient_get_spread (SPGradient *gradient); diff --git a/src/sp-guide.h b/src/sp-guide.h index c39252066..45ce405cd 100644 --- a/src/sp-guide.h +++ b/src/sp-guide.h @@ -21,6 +21,7 @@ struct SPCanvas; struct SPCanvasGroup; +class SPDesktop; G_BEGIN_DECLS diff --git a/src/sp-item.h b/src/sp-item.h index 85ef3531e..a3ba1dbe2 100644 --- a/src/sp-item.h +++ b/src/sp-item.h @@ -30,7 +30,7 @@ class SPGuideConstraint; struct SPClipPathReference; struct SPMaskReference; -struct SPAvoidRef; +class SPAvoidRef; struct SPPrintContext; namespace Inkscape { diff --git a/src/sp-lpe-item.h b/src/sp-lpe-item.h index 69fde5d58..5ff1dee26 100644 --- a/src/sp-lpe-item.h +++ b/src/sp-lpe-item.h @@ -24,8 +24,9 @@ #define SP_IS_LPE_ITEM(o) (G_TYPE_CHECK_INSTANCE_TYPE((o), SP_TYPE_LPE_ITEM)) #define SP_IS_LPE_ITEM_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), SP_TYPE_LPE_ITEM)) -struct LivePathEffectObject; -struct SPCurve; +class LivePathEffectObject; +class SPCurve; +class SPDesktop; namespace Inkscape{ namespace Display { diff --git a/src/sp-mesh-gradient-fns.h b/src/sp-mesh-gradient-fns.h index 18f66128a..4196a6de2 100644 --- a/src/sp-mesh-gradient-fns.h +++ b/src/sp-mesh-gradient-fns.h @@ -14,7 +14,7 @@ class Node; } } -class SPMeshGradient; +struct SPMeshGradient; #define SP_TYPE_MESHGRADIENT (sp_meshgradient_get_type()) #define SP_MESHGRADIENT(obj) (G_TYPE_CHECK_INSTANCE_CAST((obj), SP_TYPE_MESHGRADIENT, SPMeshGradient)) diff --git a/src/sp-object.h b/src/sp-object.h index 5828eda13..19df6a554 100644 --- a/src/sp-object.h +++ b/src/sp-object.h @@ -58,15 +58,13 @@ class SPObjectClass; #include "version.h" #include "util/forward-pointer-iterator.h" - -class SPDesktop; -struct SPCSSAttr; +class SPCSSAttr; struct SPStyle; namespace Inkscape { namespace XML { class Node; -class Document; +struct Document; } } @@ -90,8 +88,6 @@ typedef enum { SP_INVALID_ACCESS_ERR } SPExceptionType; -class SPException; - /// An attempt to implement exceptions, unused? struct SPException { SPExceptionType code; @@ -100,8 +96,6 @@ struct SPException { #define SP_EXCEPTION_INIT(ex) {(ex)->code = SP_NO_EXCEPTION;} #define SP_EXCEPTION_IS_OK(ex) (!(ex) || ((ex)->code == SP_NO_EXCEPTION)) -class SPCtx; - /// Unused struct SPCtx { unsigned int flags; @@ -113,8 +107,6 @@ enum { }; class SPDocument; -class SPIXmlSpace; -class SPObject; /// Internal class consisting of two bits. struct SPIXmlSpace { diff --git a/src/sp-use-reference.h b/src/sp-use-reference.h index f40dbb6e5..d99b425f1 100644 --- a/src/sp-use-reference.h +++ b/src/sp-use-reference.h @@ -18,7 +18,7 @@ class Path; namespace Inkscape { namespace XML { - struct Node; +class Node; } } diff --git a/src/style.h b/src/style.h index 7c64ea3d8..1c8cb4774 100644 --- a/src/style.h +++ b/src/style.h @@ -34,17 +34,6 @@ class Node; class SPCSSAttr; -class SPIFloat; -class SPIScale24; -class SPIInt; -class SPIShort; -class SPIEnum; -class SPIString; -class SPILength; -class SPIPaint; -class SPIFontSize; -class SPIBaselineShift; - /// Float type internal to SPStyle. struct SPIFloat { unsigned set : 1; diff --git a/src/text-editing.h b/src/text-editing.h index deb6f8538..04ef6461d 100644 --- a/src/text-editing.h +++ b/src/text-editing.h @@ -19,6 +19,7 @@ #include "text-tag-attributes.h" class SPCSSAttr; +class SPDesktop; class SPItem; class SPObject; struct SPStyle; diff --git a/src/ui/dialog/desktop-tracker.h b/src/ui/dialog/desktop-tracker.h index 0c8af66bf..c219e8d98 100644 --- a/src/ui/dialog/desktop-tracker.h +++ b/src/ui/dialog/desktop-tracker.h @@ -16,7 +16,7 @@ class SPDesktop; namespace Inkscape { -class Application; +struct Application; namespace UI { namespace Dialog { diff --git a/src/ui/dialog/dialog.h b/src/ui/dialog/dialog.h index 025e9eb58..ec5d203bc 100644 --- a/src/ui/dialog/dialog.h +++ b/src/ui/dialog/dialog.h @@ -21,7 +21,7 @@ class SPDesktop; namespace Inkscape { class Selection; -class Application; +struct Application; } namespace Inkscape { diff --git a/src/ui/dialog/document-properties.cpp b/src/ui/dialog/document-properties.cpp index 460e223a3..045b34814 100644 --- a/src/ui/dialog/document-properties.cpp +++ b/src/ui/dialog/document-properties.cpp @@ -22,6 +22,7 @@ # include <config.h> #endif +#include "ui/widget/notebook-page.h" #include "document-properties.h" #include "display/canvas-grid.h" #include "document.h" @@ -50,8 +51,9 @@ #include "color-profile.h" #endif // defined(HAVE_LIBLCMS1) || defined(HAVE_LIBLCMS2) -#include <gtkmm/stock.h> #include <gtkmm/imagemenuitem.h> +#include <gtkmm/stock.h> +#include <gtkmm/table.h> using std::pair; @@ -90,15 +92,15 @@ DocumentProperties& DocumentProperties::getInstance() DocumentProperties::DocumentProperties() : UI::Widget::Panel ("", "/dialogs/documentoptions", SP_VERB_DIALOG_NAMEDVIEW), - _page_page(1, 1, true, true), - _page_guides(1, 1), - _page_snap(1, 1), - _page_cms(1, 1), - _page_scripting(1, 1), - _page_external_scripts(1, 1), - _page_embedded_scripts(1, 1), - _page_metadata1(1, 1), - _page_metadata2(1, 1), + _page_page(Gtk::manage(new UI::Widget::NotebookPage(1, 1, true, true))), + _page_guides(Gtk::manage(new UI::Widget::NotebookPage(1, 1))), + _page_snap(Gtk::manage(new UI::Widget::NotebookPage(1, 1))), + _page_cms(Gtk::manage(new UI::Widget::NotebookPage(1, 1))), + _page_scripting(Gtk::manage(new UI::Widget::NotebookPage(1, 1))), + _page_external_scripts(Gtk::manage(new UI::Widget::NotebookPage(1, 1))), + _page_embedded_scripts(Gtk::manage(new UI::Widget::NotebookPage(1, 1))), + _page_metadata1(Gtk::manage(new UI::Widget::NotebookPage(1, 1))), + _page_metadata2(Gtk::manage(new UI::Widget::NotebookPage(1, 1))), //--------------------------------------------------------------- _rcb_canb(_("Show page _border"), _("If set, rectangular page border is shown"), "showborder", _wr, false), _rcb_bord(_("Border on _top of drawing"), _("If set, border is always on top of the drawing"), "borderlayer", _wr, false), @@ -141,14 +143,14 @@ DocumentProperties::DocumentProperties() _getContents()->set_spacing (4); _getContents()->pack_start(_notebook, true, true); - _notebook.append_page(_page_page, _("Page")); - _notebook.append_page(_page_guides, _("Guides")); + _notebook.append_page(*_page_page, _("Page")); + _notebook.append_page(*_page_guides, _("Guides")); _notebook.append_page(_grids_vbox, _("Grids")); - _notebook.append_page(_page_snap, _("Snap")); - _notebook.append_page(_page_cms, _("Color")); - _notebook.append_page(_page_scripting, _("Scripting")); - _notebook.append_page(_page_metadata1, _("Metadata")); - _notebook.append_page(_page_metadata2, _("License")); + _notebook.append_page(*_page_snap, _("Snap")); + _notebook.append_page(*_page_cms, _("Color")); + _notebook.append_page(*_page_scripting, _("Scripting")); + _notebook.append_page(*_page_metadata1, _("Metadata")); + _notebook.append_page(*_page_metadata2, _("License")); _wr.setUpdating (true); build_page(); @@ -203,12 +205,25 @@ DocumentProperties::~DocumentProperties() * widget in columns 2-3; (non-0, 0) means label in columns 1-3; and * (non-0, non-0) means two widgets in columns 2 and 3. */ +#if WITH_GTKMM_3_0 +inline void attach_all(Gtk::Grid &table, Gtk::Widget *const arr[], unsigned const n, int start = 0, int docum_prop_flag = 0) +#else inline void attach_all(Gtk::Table &table, Gtk::Widget *const arr[], unsigned const n, int start = 0, int docum_prop_flag = 0) +#endif { for (unsigned i = 0, r = start; i < n; i += 2) { if (arr[i] && arr[i+1]) { +#if WITH_GTKMM_3_0 + arr[i]->set_hexpand(); + arr[i+1]->set_hexpand(); + arr[i]->set_valign(Gtk::ALIGN_CENTER); + arr[i+1]->set_valign(Gtk::ALIGN_CENTER); + table.attach(*arr[i], 1, r, 1, 1); + table.attach(*arr[i+1], 2, r, 1, 1); +#else table.attach(*arr[i], 1, 2, r, r+1, Gtk::FILL|Gtk::EXPAND, (Gtk::AttachOptions)0,0,0); table.attach(*arr[i+1], 2, 3, r, r+1, Gtk::FILL|Gtk::EXPAND, (Gtk::AttachOptions)0,0,0); +#endif } else { if (arr[i+1]) { Gtk::AttachOptions yoptions = (Gtk::AttachOptions)0; @@ -218,21 +233,70 @@ inline void attach_all(Gtk::Table &table, Gtk::Widget *const arr[], unsigned con } if (docum_prop_flag) { if( i==(n-4) || i==(n-6) ) { +#if WITH_GTKMM_3_0 + arr[i+1]->set_hexpand(); + arr[i+1]->set_margin_left(20); + arr[i+1]->set_margin_right(20); + + if (yoptions & Gtk::EXPAND) + arr[i+1]->set_vexpand(); + else + arr[i+1]->set_valign(Gtk::ALIGN_CENTER); + + table.attach(*arr[i+1], 1, r, 2, 1); +#else table.attach(*arr[i+1], 1, 3, r, r+1, Gtk::FILL|Gtk::EXPAND, yoptions, 20,0); +#endif } else { +#if WITH_GTKMM_3_0 + arr[i+1]->set_hexpand(); + + if (yoptions & Gtk::EXPAND) + arr[i+1]->set_vexpand(); + else + arr[i+1]->set_valign(Gtk::ALIGN_CENTER); + + table.attach(*arr[i+1], 1, r, 2, 1); +#else table.attach(*arr[i+1], 1, 3, r, r+1, Gtk::FILL|Gtk::EXPAND, yoptions, 0,0); +#endif } } else { +#if WITH_GTKMM_3_0 + arr[i+1]->set_hexpand(); + + if (yoptions & Gtk::EXPAND) + arr[i+1]->set_vexpand(); + else + arr[i+1]->set_valign(Gtk::ALIGN_CENTER); + + table.attach(*arr[i+1], 1, r, 2, 1); +#else table.attach(*arr[i+1], 1, 3, r, r+1, Gtk::FILL|Gtk::EXPAND, yoptions, 0,0); +#endif } } else if (arr[i]) { Gtk::Label& label = reinterpret_cast<Gtk::Label&>(*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; @@ -241,7 +305,7 @@ inline void attach_all(Gtk::Table &table, Gtk::Widget *const arr[], unsigned con void DocumentProperties::build_page() { - _page_page.show(); + _page_page->show(); Gtk::Label* label_gen = manage (new Gtk::Label); label_gen->set_markup (_("<b>General</b>")); @@ -275,12 +339,12 @@ void DocumentProperties::build_page() _slaveList.push_back(&_rcb_shad); _rcb_canb.setSlaveWidgets(_slaveList); - attach_all(_page_page.table(), widget_array, G_N_ELEMENTS(widget_array),0,1); + attach_all(_page_page->table(), widget_array, G_N_ELEMENTS(widget_array),0,1); } void DocumentProperties::build_guides() { - _page_guides.show(); + _page_guides->show(); Gtk::Label *label_gui = manage (new Gtk::Label); label_gui->set_markup (_("<b>Guides</b>")); @@ -293,12 +357,12 @@ void DocumentProperties::build_guides() _rcp_hgui._label, &_rcp_hgui }; - attach_all(_page_guides.table(), widget_array, G_N_ELEMENTS(widget_array)); + attach_all(_page_guides->table(), widget_array, G_N_ELEMENTS(widget_array)); } void DocumentProperties::build_snap() { - _page_snap.show(); + _page_snap->show(); Gtk::Label *label_o = manage (new Gtk::Label); label_o->set_markup (_("<b>Snap to objects</b>")); @@ -327,7 +391,7 @@ void DocumentProperties::build_snap() 0, &_rcb_tang }; - attach_all(_page_snap.table(), array, G_N_ELEMENTS(array)); + attach_all(_page_snap->table(), array, G_N_ELEMENTS(array)); } #if defined(HAVE_LIBLCMS1) || defined(HAVE_LIBLCMS2) @@ -532,7 +596,7 @@ void DocumentProperties::removeSelectedProfile(){ void DocumentProperties::build_cms() { - _page_cms.show(); + _page_cms->show(); Gtk::Label *label_link= manage (new Gtk::Label("", Gtk::ALIGN_START)); label_link->set_markup (_("<b>Linked Color Profiles:</b>")); Gtk::Label *label_avail = manage (new Gtk::Label("", Gtk::ALIGN_START)); @@ -544,26 +608,75 @@ void DocumentProperties::build_cms() _unlink_btn.set_tooltip_text(_("Unlink Profile")); _unlink_btn.set_image(*manage(Glib::wrap(gtk_image_new_from_stock ( GTK_STOCK_REMOVE, GTK_ICON_SIZE_SMALL_TOOLBAR ) ))); - _page_cms.set_spacing(4); + _page_cms->set_spacing(4); gint row = 0; label_link->set_alignment(0.0); - _page_cms.table().attach(*label_link, 0, 3, row, row + 1, Gtk::FILL|Gtk::EXPAND, (Gtk::AttachOptions)0, 0, 0); + +#if WITH_GTKMM_3_0 + label_link->set_hexpand(); + label_link->set_valign(Gtk::ALIGN_CENTER); + _page_cms->table().attach(*label_link, 0, row, 3, 1); +#else + _page_cms->table().attach(*label_link, 0, 3, row, row + 1, Gtk::FILL|Gtk::EXPAND, (Gtk::AttachOptions)0, 0, 0); +#endif + row++; - _page_cms.table().attach(_LinkedProfilesListScroller, 0, 3, row, row + 1, Gtk::FILL|Gtk::EXPAND, (Gtk::AttachOptions)0, 0, 0); + +#if WITH_GTKMM_3_0 + _LinkedProfilesListScroller.set_hexpand(); + _LinkedProfilesListScroller.set_valign(Gtk::ALIGN_CENTER); + _page_cms->table().attach(_LinkedProfilesListScroller, 0, row, 3, 1); +#else + _page_cms->table().attach(_LinkedProfilesListScroller, 0, 3, row, row + 1, Gtk::FILL|Gtk::EXPAND, (Gtk::AttachOptions)0, 0, 0); +#endif + row++; Gtk::HBox* spacer = Gtk::manage(new Gtk::HBox()); spacer->set_size_request(SPACE_SIZE_X, SPACE_SIZE_Y); - _page_cms.table().attach(*spacer, 0, 3, row, row + 1, Gtk::FILL|Gtk::EXPAND, (Gtk::AttachOptions)0, 0, 0); + +#if WITH_GTKMM_3_0 + spacer->set_hexpand(); + spacer->set_valign(Gtk::ALIGN_CENTER); + _page_cms->table().attach(*spacer, 0, row, 3, 1); +#else + _page_cms->table().attach(*spacer, 0, 3, row, row + 1, Gtk::FILL|Gtk::EXPAND, (Gtk::AttachOptions)0, 0, 0); +#endif + row++; label_avail->set_alignment(0.0); - _page_cms.table().attach(*label_avail, 0, 3, row, row + 1, Gtk::FILL|Gtk::EXPAND, (Gtk::AttachOptions)0, 0, 0); + +#if WITH_GTKMM_3_0 + label_avail->set_hexpand(); + label_avail->set_valign(Gtk::ALIGN_CENTER); + _page_cms->table().attach(*label_avail, 0, row, 3, 1); +#else + _page_cms->table().attach(*label_avail, 0, 3, row, row + 1, Gtk::FILL|Gtk::EXPAND, (Gtk::AttachOptions)0, 0, 0); +#endif + row++; - _page_cms.table().attach(_combo_avail, 0, 1, row, row + 1, Gtk::FILL|Gtk::EXPAND, (Gtk::AttachOptions)0, 0, 0); - _page_cms.table().attach(_link_btn, 1, 2, row, row + 1, (Gtk::AttachOptions)0, (Gtk::AttachOptions)0, 2, 0); - _page_cms.table().attach(_unlink_btn, 2, 3, row, row + 1, (Gtk::AttachOptions)0, (Gtk::AttachOptions)0, 0, 0); + +#if WITH_GTKMM_3_0 + _combo_avail.set_hexpand(); + _combo_avail.set_valign(Gtk::ALIGN_CENTER); + _page_cms->table().attach(_combo_avail, 0, row, 1, 1); + + _link_btn.set_halign(Gtk::ALIGN_CENTER); + _link_btn.set_valign(Gtk::ALIGN_CENTER); + _link_btn.set_margin_left(2); + _link_btn.set_margin_right(2); + _page_cms->table().attach(_link_btn, 1, row, 1, 1); + + _unlink_btn.set_halign(Gtk::ALIGN_CENTER); + _unlink_btn.set_valign(Gtk::ALIGN_CENTER); + _page_cms->table().attach(_unlink_btn, 2, row, 1, 1); +#else + _page_cms->table().attach(_combo_avail, 0, 1, row, row + 1, Gtk::FILL|Gtk::EXPAND, (Gtk::AttachOptions)0, 0, 0); + _page_cms->table().attach(_link_btn, 1, 2, row, row + 1, (Gtk::AttachOptions)0, (Gtk::AttachOptions)0, 2, 0); + _page_cms->table().attach(_unlink_btn, 2, 3, row, row + 1, (Gtk::AttachOptions)0, (Gtk::AttachOptions)0, 0, 0); +#endif populate_available_profiles(); @@ -601,16 +714,16 @@ void DocumentProperties::build_cms() void DocumentProperties::build_scripting() { - _page_scripting.show(); + _page_scripting->show(); - _page_scripting.set_spacing (4); - _page_scripting.pack_start(_scripting_notebook, true, true); + _page_scripting->set_spacing (4); + _page_scripting->pack_start(_scripting_notebook, true, true); - _scripting_notebook.append_page(_page_external_scripts, _("External scripts")); - _scripting_notebook.append_page(_page_embedded_scripts, _("Embedded scripts")); + _scripting_notebook.append_page(*_page_external_scripts, _("External scripts")); + _scripting_notebook.append_page(*_page_embedded_scripts, _("Embedded scripts")); //# External scripts tab - _page_external_scripts.show(); + _page_external_scripts->show(); Gtk::Label *label_external= manage (new Gtk::Label("", Gtk::ALIGN_START)); label_external->set_markup (_("<b>External script files:</b>")); @@ -621,23 +734,64 @@ void DocumentProperties::build_scripting() _external_remove_btn.set_image(*manage(Glib::wrap(gtk_image_new_from_stock ( GTK_STOCK_REMOVE, GTK_ICON_SIZE_SMALL_TOOLBAR ) ))); - _page_external_scripts.set_spacing(4); + _page_external_scripts->set_spacing(4); gint row = 0; label_external->set_alignment(0.0); - _page_external_scripts.table().attach(*label_external, 0, 3, row, row + 1, Gtk::FILL|Gtk::EXPAND, (Gtk::AttachOptions)0, 0, 0); + +#if WITH_GTKMM_3_0 + label_external->set_hexpand(); + label_external->set_valign(Gtk::ALIGN_CENTER); + _page_external_scripts->table().attach(*label_external, 0, row, 3, 1); +#else + _page_external_scripts->table().attach(*label_external, 0, 3, row, row + 1, Gtk::FILL|Gtk::EXPAND, (Gtk::AttachOptions)0, 0, 0); +#endif + row++; - _page_external_scripts.table().attach(_ExternalScriptsListScroller, 0, 3, row, row + 1, Gtk::FILL|Gtk::EXPAND, (Gtk::AttachOptions)0, 0, 0); + +#if WITH_GTKMM_3_0 + _ExternalScriptsListScroller.set_hexpand(); + _ExternalScriptsListScroller.set_valign(Gtk::ALIGN_CENTER); + _page_external_scripts->table().attach(_ExternalScriptsListScroller, 0, row, 3, 1); +#else + _page_external_scripts->table().attach(_ExternalScriptsListScroller, 0, 3, row, row + 1, Gtk::FILL|Gtk::EXPAND, (Gtk::AttachOptions)0, 0, 0); +#endif + row++; Gtk::HBox* spacer_external = Gtk::manage(new Gtk::HBox()); spacer_external->set_size_request(SPACE_SIZE_X, SPACE_SIZE_Y); - _page_external_scripts.table().attach(*spacer_external, 0, 3, row, row + 1, Gtk::FILL|Gtk::EXPAND, (Gtk::AttachOptions)0, 0, 0); + +#if WITH_GTKMM_3_0 + spacer_external->set_hexpand(); + spacer_external->set_valign(Gtk::ALIGN_CENTER); + _page_external_scripts->table().attach(*spacer_external, 0, row, 3, 1); +#else + _page_external_scripts->table().attach(*spacer_external, 0, 3, row, row + 1, Gtk::FILL|Gtk::EXPAND, (Gtk::AttachOptions)0, 0, 0); +#endif + row++; - _page_external_scripts.table().attach(_script_entry, 0, 1, row, row + 1, Gtk::FILL|Gtk::EXPAND, (Gtk::AttachOptions)0, 0, 0); - _page_external_scripts.table().attach(_external_add_btn, 1, 2, row, row + 1, (Gtk::AttachOptions)0, (Gtk::AttachOptions)0, 2, 0); - _page_external_scripts.table().attach(_external_remove_btn, 2, 3, row, row + 1, (Gtk::AttachOptions)0, (Gtk::AttachOptions)0, 0, 0); +#if WITH_GTKMM_3_0 + _script_entry.set_hexpand(); + _script_entry.set_valign(Gtk::ALIGN_CENTER); + _page_external_scripts->table().attach(_script_entry, 0, row, 1, 1); + + _external_add_btn.set_halign(Gtk::ALIGN_CENTER); + _external_add_btn.set_valign(Gtk::ALIGN_CENTER); + _external_add_btn.set_margin_left(2); + _external_add_btn.set_margin_right(2); + _page_external_scripts->table().attach(_external_add_btn, 1, row, 1, 1); + + _external_remove_btn.set_halign(Gtk::ALIGN_CENTER); + _external_remove_btn.set_valign(Gtk::ALIGN_CENTER); + _page_external_scripts->table().attach(_external_remove_btn, 2, row, 1, 1); +#else + _page_external_scripts->table().attach(_script_entry, 0, 1, row, row + 1, Gtk::FILL|Gtk::EXPAND, (Gtk::AttachOptions)0, 0, 0); + _page_external_scripts->table().attach(_external_add_btn, 1, 2, row, row + 1, (Gtk::AttachOptions)0, (Gtk::AttachOptions)0, 2, 0); + _page_external_scripts->table().attach(_external_remove_btn, 2, 3, row, row + 1, (Gtk::AttachOptions)0, (Gtk::AttachOptions)0, 0, 0); +#endif + row++; //# Set up the External Scripts box @@ -649,7 +803,7 @@ void DocumentProperties::build_scripting() //# Embedded scripts tab - _page_embedded_scripts.show(); + _page_embedded_scripts->show(); Gtk::Label *label_embedded= manage (new Gtk::Label("", Gtk::ALIGN_START)); label_embedded->set_markup (_("<b>Embedded script files:</b>")); @@ -669,21 +823,52 @@ void DocumentProperties::build_scripting() _embed_button_box.add(_embed_new_btn); _embed_button_box.add(_embed_remove_btn); - _page_embedded_scripts.set_spacing(4); + _page_embedded_scripts->set_spacing(4); row = 0; label_embedded->set_alignment(0.0); - _page_embedded_scripts.table().attach(*label_embedded, 0, 3, row, row + 1, Gtk::FILL|Gtk::EXPAND, (Gtk::AttachOptions)0, 0, 0); + +#if WITH_GTKMM_3_0 + label_embedded->set_hexpand(); + label_embedded->set_valign(Gtk::ALIGN_CENTER); + _page_embedded_scripts->table().attach(*label_embedded, 0, row, 3, 1); +#else + _page_embedded_scripts->table().attach(*label_embedded, 0, 3, row, row + 1, Gtk::FILL|Gtk::EXPAND, (Gtk::AttachOptions)0, 0, 0); +#endif + row++; - _page_embedded_scripts.table().attach(_EmbeddedScriptsListScroller, 0, 3, row, row + 1, Gtk::FILL|Gtk::EXPAND, (Gtk::AttachOptions)0, 0, 0); + +#if WITH_GTKMM_3_0 + _EmbeddedScriptsListScroller.set_hexpand(); + _EmbeddedScriptsListScroller.set_valign(Gtk::ALIGN_CENTER); + _page_embedded_scripts->table().attach(_EmbeddedScriptsListScroller, 0, row, 3, 1); +#else + _page_embedded_scripts->table().attach(_EmbeddedScriptsListScroller, 0, 3, row, row + 1, Gtk::FILL|Gtk::EXPAND, (Gtk::AttachOptions)0, 0, 0); +#endif + row++; - _page_embedded_scripts.table().attach(_embed_button_box, 0, 1, row, row + 1, Gtk::FILL|Gtk::EXPAND, (Gtk::AttachOptions)0, 0, 0); +#if WITH_GTKMM_3_0 + _embed_button_box.set_hexpand(); + _embed_button_box.set_valign(Gtk::ALIGN_CENTER); + _page_embedded_scripts->table().attach(_embed_button_box, 0, row, 1, 1); +#else + _page_embedded_scripts->table().attach(_embed_button_box, 0, 1, row, row + 1, Gtk::FILL|Gtk::EXPAND, (Gtk::AttachOptions)0, 0, 0); +#endif + row++; Gtk::HBox* spacer_embedded = Gtk::manage(new Gtk::HBox()); spacer_embedded->set_size_request(SPACE_SIZE_X, SPACE_SIZE_Y); - _page_embedded_scripts.table().attach(*spacer_embedded, 0, 3, row, row + 1, Gtk::FILL|Gtk::EXPAND, (Gtk::AttachOptions)0, 0, 0); + +#if WITH_GTKMM_3_0 + spacer_embedded->set_hexpand(); + spacer_embedded->set_valign(Gtk::ALIGN_CENTER); + _page_embedded_scripts->table().attach(*spacer_embedded, 0, row, 3, 1); +#else + _page_embedded_scripts->table().attach(*spacer_embedded, 0, 3, row, row + 1, Gtk::FILL|Gtk::EXPAND, (Gtk::AttachOptions)0, 0, 0); +#endif + row++; //# Set up the Embedded Scripts box @@ -698,10 +883,24 @@ void DocumentProperties::build_scripting() label_embedded_content->set_markup (_("<b>Content:</b>")); label_embedded_content->set_alignment(0.0); - _page_embedded_scripts.table().attach(*label_embedded_content, 0, 3, row, row + 1, Gtk::FILL|Gtk::EXPAND, (Gtk::AttachOptions)0, 0, 0); + +#if WITH_GTKMM_3_0 + label_embedded_content->set_hexpand(); + label_embedded_content->set_valign(Gtk::ALIGN_CENTER); + _page_embedded_scripts->table().attach(*label_embedded_content, 0, row, 3, 1); +#else + _page_embedded_scripts->table().attach(*label_embedded_content, 0, 3, row, row + 1, Gtk::FILL|Gtk::EXPAND, (Gtk::AttachOptions)0, 0, 0); +#endif + row++; - _page_embedded_scripts.table().attach(_EmbeddedContentScroller, 0, 3, row, row + 1, Gtk::FILL|Gtk::EXPAND, (Gtk::AttachOptions)0, 0, 0); +#if WITH_GTKMM_3_0 + _EmbeddedContentScroller.set_hexpand(); + _EmbeddedContentScroller.set_valign(Gtk::ALIGN_CENTER); + _page_embedded_scripts->table().attach(_EmbeddedContentScroller, 0, row, 3, 1); +#else + _page_embedded_scripts->table().attach(_EmbeddedContentScroller, 0, 3, row, row + 1, Gtk::FILL|Gtk::EXPAND, (Gtk::AttachOptions)0, 0, 0); +#endif _EmbeddedContentScroller.add(_EmbeddedContent); _EmbeddedContentScroller.set_shadow_type(Gtk::SHADOW_IN); @@ -757,12 +956,19 @@ void DocumentProperties::build_metadata() { using Inkscape::UI::Widget::EntityEntry; - _page_metadata1.show(); + _page_metadata1->show(); Gtk::Label *label = manage (new Gtk::Label); label->set_markup (_("<b>Dublin Core Entities</b>")); label->set_alignment (0.0); - _page_metadata1.table().attach (*label, 0,3,0,1, Gtk::FILL, (Gtk::AttachOptions)0,0,0); + +#if WITH_GTKMM_3_0 + label->set_valign(Gtk::ALIGN_CENTER); + _page_metadata1->table().attach (*label, 0,0,3,1); +#else + _page_metadata1->table().attach (*label, 0,3,0,1, Gtk::FILL, (Gtk::AttachOptions)0,0,0); +#endif + /* add generic metadata entry areas */ struct rdf_work_entity_t * entity; int row = 1; @@ -772,9 +978,22 @@ void DocumentProperties::build_metadata() _rdflist.push_back (w); Gtk::HBox *space = manage (new Gtk::HBox); space->set_size_request (SPACE_SIZE_X, SPACE_SIZE_Y); - _page_metadata1.table().attach (*space, 0,1, row, row+1, Gtk::FILL, (Gtk::AttachOptions)0,0,0); - _page_metadata1.table().attach (w->_label, 1,2, row, row+1, Gtk::FILL, (Gtk::AttachOptions)0,0,0); - _page_metadata1.table().attach (*w->_packable, 2,3, row, row+1, Gtk::FILL|Gtk::EXPAND, (Gtk::AttachOptions)0,0,0); + +#if WITH_GTKMM_3_0 + space->set_valign(Gtk::ALIGN_CENTER); + _page_metadata1->table().attach(*space, 0, row, 1, 1); + + w->_label.set_valign(Gtk::ALIGN_CENTER); + _page_metadata1->table().attach(w->_label, 1, row, 1, 1); + + w->_packable->set_hexpand(); + w->_packable->set_valign(Gtk::ALIGN_CENTER); + _page_metadata1->table().attach(*w->_packable, 2, row, 1, 1); +#else + _page_metadata1->table().attach (*space, 0,1, row, row+1, Gtk::FILL, (Gtk::AttachOptions)0,0,0); + _page_metadata1->table().attach (w->_label, 1,2, row, row+1, Gtk::FILL, (Gtk::AttachOptions)0,0,0); + _page_metadata1->table().attach (*w->_packable, 2,3, row, row+1, Gtk::FILL|Gtk::EXPAND, (Gtk::AttachOptions)0,0,0); +#endif } } @@ -782,30 +1001,53 @@ void DocumentProperties::build_metadata() button_save->set_tooltip_text(_("Save this metadata as the default metadata")); Gtk::Button *button_load = manage (new Gtk::Button(_("Use _default"),1)); button_load->set_tooltip_text(_("Use the previously saved default metadata here")); + +#if WITH_GTKMM_3_0 + Gtk::ButtonBox *box_buttons = manage (new Gtk::ButtonBox); +#else Gtk::HButtonBox *box_buttons = manage (new Gtk::HButtonBox); +#endif + box_buttons->set_layout(Gtk::BUTTONBOX_END); box_buttons->set_spacing(4); box_buttons->pack_start(*button_save, true, true, 6); box_buttons->pack_start(*button_load, true, true, 6); - _page_metadata1.pack_end(*box_buttons, false, false, 0); + _page_metadata1->pack_end(*box_buttons, false, false, 0); button_save->signal_clicked().connect(sigc::mem_fun(*this, &DocumentProperties::save_default_metadata)); button_load->signal_clicked().connect(sigc::mem_fun(*this, &DocumentProperties::load_default_metadata)); - _page_metadata2.show(); + _page_metadata2->show(); row = 0; Gtk::Label *llabel = manage (new Gtk::Label); llabel->set_markup (_("<b>License</b>")); llabel->set_alignment (0.0); - _page_metadata2.table().attach (*llabel, 0,3, row, row+1, Gtk::FILL, (Gtk::AttachOptions)0,0,0); + +#if WITH_GTKMM_3_0 + llabel->set_valign(Gtk::ALIGN_CENTER); + _page_metadata2->table().attach(*llabel, 0, row, 3, 1); +#else + _page_metadata2->table().attach (*llabel, 0,3, row, row+1, Gtk::FILL, (Gtk::AttachOptions)0,0,0); +#endif + /* add license selector pull-down and URI */ ++row; _licensor.init (_wr); Gtk::HBox *space = manage (new Gtk::HBox); space->set_size_request (SPACE_SIZE_X, SPACE_SIZE_Y); - _page_metadata2.table().attach (*space, 0,1, row, row+1, Gtk::FILL, (Gtk::AttachOptions)0,0,0); - _page_metadata2.table().attach (_licensor, 1,3, row, row+1, Gtk::EXPAND|Gtk::FILL, (Gtk::AttachOptions)0,0,0); + +#if WITH_GTKMM_3_0 + space->set_valign(Gtk::ALIGN_CENTER); + _page_metadata2->table().attach(*space, 0, row, 1, 1); + + _licensor.set_hexpand(); + _licensor.set_valign(Gtk::ALIGN_CENTER); + _page_metadata2->table().attach(_licensor, 1, row, 3, 1); +#else + _page_metadata2->table().attach (*space, 0,1, row, row+1, Gtk::FILL, (Gtk::AttachOptions)0,0,0); + _page_metadata2->table().attach (_licensor, 1,3, row, row+1, Gtk::EXPAND|Gtk::FILL, (Gtk::AttachOptions)0,0,0); +#endif } void DocumentProperties::addExternalScript(){ diff --git a/src/ui/dialog/document-properties.h b/src/ui/dialog/document-properties.h index 5bafddc32..56fed30c4 100644 --- a/src/ui/dialog/document-properties.h +++ b/src/ui/dialog/document-properties.h @@ -15,8 +15,7 @@ #define INKSCAPE_UI_DIALOG_DOCUMENT_PREFERENCES_H #include <stddef.h> -#include <sigc++/sigc++.h>// -#include "ui/widget/notebook-page.h" +#include <sigc++/sigc++.h> #include <gtkmm/comboboxtext.h> #include <gtkmm/liststore.h> #include <gtkmm/notebook.h> @@ -39,6 +38,7 @@ namespace Inkscape { namespace UI { namespace Widget { class EntityEntry; + class NotebookPage; } namespace Dialog { @@ -100,18 +100,18 @@ protected: Inkscape::XML::SignalObserver _emb_profiles_observer, _scripts_observer; Gtk::Notebook _notebook; - UI::Widget::NotebookPage _page_page; - UI::Widget::NotebookPage _page_guides; - UI::Widget::NotebookPage _page_snap; - UI::Widget::NotebookPage _page_cms; - UI::Widget::NotebookPage _page_scripting; + UI::Widget::NotebookPage *_page_page; + UI::Widget::NotebookPage *_page_guides; + UI::Widget::NotebookPage *_page_snap; + UI::Widget::NotebookPage *_page_cms; + UI::Widget::NotebookPage *_page_scripting; Gtk::Notebook _scripting_notebook; - UI::Widget::NotebookPage _page_external_scripts; - UI::Widget::NotebookPage _page_embedded_scripts; + UI::Widget::NotebookPage *_page_external_scripts; + UI::Widget::NotebookPage *_page_embedded_scripts; - UI::Widget::NotebookPage _page_metadata1; - UI::Widget::NotebookPage _page_metadata2; + UI::Widget::NotebookPage *_page_metadata1; + UI::Widget::NotebookPage *_page_metadata2; Gtk::VBox _grids_vbox; diff --git a/src/ui/dialog/export.cpp b/src/ui/dialog/export.cpp index ecdfd3346..603786742 100644 --- a/src/ui/dialog/export.cpp +++ b/src/ui/dialog/export.cpp @@ -193,9 +193,15 @@ Export::Export (void) : selectiontype_buttons[i]->signal_clicked().connect(sigc::mem_fun(*this, &Export::onAreaToggled)); } +#if WITH_GTKMM_3_0 + Gtk::Grid* t = new Gtk::Grid(); + t->set_row_spacing(4); + t->set_column_spacing(4); +#else Gtk::Table* t = new Gtk::Table(3, 4, false); t->set_row_spacings (4); t->set_col_spacings (4); +#endif x0_adj = createSpinbutton ( "x0", 0.0, -1000000.0, 1000000.0, 0.1, 1.0, unit_selector->gobj(), t, 0, 0, _("_x0:"), "", EXPORT_COORD_PRECISION, 1, @@ -236,9 +242,17 @@ Export::Export (void) : bm_label = new Gtk::Label(_("<b>Image size</b>"), Gtk::ALIGN_START); bm_label->set_use_markup(true); size_box.pack_start(*bm_label, false, false, 0); + +#if WITH_GTKMM_3_0 + Gtk::Grid *t = new Gtk::Grid(); + t->set_row_spacing(4); + t->set_column_spacing(4); +#else Gtk::Table *t = new Gtk::Table(2, 5, false); t->set_row_spacings (4); t->set_col_spacings (4); +#endif + size_box.pack_start(*t); bmwidth_adj = createSpinbutton ( "bmwidth", 16.0, 1.0, 1000000.0, 1.0, 10.0, @@ -442,7 +456,7 @@ void Export::set_default_filename () { #if WITH_GTKMM_3_0 Glib::RefPtr<Gtk::Adjustment> Export::createSpinbutton( gchar const * /*key*/, float val, float min, float max, float step, float page, GtkWidget *us, - Gtk::Table *t, int x, int y, + Gtk::Grid *t, int x, int y, const Glib::ustring ll, const Glib::ustring lr, int digits, unsigned int sensitive, void (Export::*cb)() ) @@ -470,17 +484,29 @@ Gtk::Adjustment * Export::createSpinbutton( gchar const * /*key*/, float val, fl if (!ll.empty()) { l = new Gtk::Label(ll,true); l->set_alignment (1.0, 0.5); + +#if WITH_GTKMM_3_0 + l->set_hexpand(); + l->set_vexpand(); + t->attach(*l, x + pos, y, 1, 1); +#else t->attach (*l, x + pos, x + pos + 1, y, y + 1, Gtk::EXPAND, Gtk::EXPAND, 0, 0 ); +#endif + l->set_sensitive(sensitive); pos++; } #if WITH_GTKMM_3_0 Gtk::SpinButton *sb = new Gtk::SpinButton(adj, 1.0, digits); + sb->set_hexpand(); + sb->set_vexpand(); + t->attach(*sb, x + pos, y, 1, 1); #else Gtk::SpinButton *sb = new Gtk::SpinButton(*adj, 1.0, digits); -#endif t->attach (*sb, x + pos, x + pos + 1, y, y + 1, Gtk::EXPAND, Gtk::EXPAND, 0, 0 ); +#endif + sb->set_width_chars(7); sb->set_sensitive (sensitive); pos++; @@ -490,7 +516,15 @@ Gtk::Adjustment * Export::createSpinbutton( gchar const * /*key*/, float val, fl if (!lr.empty()) { l = new Gtk::Label(lr,true); l->set_alignment (0.0, 0.5); + +#if WITH_GTKMM_3_0 + l->set_hexpand(); + l->set_vexpand(); + t->attach(*l, x + pos, y, 1, 1); +#else t->attach (*l, x + pos, x + pos + 1, y, y + 1, Gtk::EXPAND, Gtk::EXPAND, 0, 0 ); +#endif + l->set_sensitive (sensitive); pos++; l->set_mnemonic_widget (*sb); diff --git a/src/ui/dialog/export.h b/src/ui/dialog/export.h index c5782fabc..5dca9cfa5 100644 --- a/src/ui/dialog/export.h +++ b/src/ui/dialog/export.h @@ -126,7 +126,7 @@ private: #if WITH_GTKMM_3_0 Glib::RefPtr<Gtk::Adjustment> createSpinbutton( gchar const *key, float val, float min, float max, float step, float page, GtkWidget *us, - Gtk::Table *t, int x, int y, + Gtk::Grid *t, int x, int y, const Glib::ustring ll, const Glib::ustring lr, int digits, unsigned int sensitive, void (Export::*cb)() ); diff --git a/src/ui/dialog/fill-and-stroke.cpp b/src/ui/dialog/fill-and-stroke.cpp index 5ba4e7e39..8de2da18b 100644 --- a/src/ui/dialog/fill-and-stroke.cpp +++ b/src/ui/dialog/fill-and-stroke.cpp @@ -15,6 +15,7 @@ * Released under GNU GPL. Read the file 'COPYING' for more information. */ +#include "ui/widget/notebook-page.h" #include "desktop-handles.h" #include "desktop-style.h" #include "document.h" @@ -35,15 +36,17 @@ #include "ui/view/view-widget.h" +#include <gtkmm/table.h> + namespace Inkscape { namespace UI { namespace Dialog { FillAndStroke::FillAndStroke() : UI::Widget::Panel ("", "/dialogs/fillstroke", SP_VERB_DIALOG_FILL_STROKE), - _page_fill(1, 1, true, true), - _page_stroke_paint(1, 1, true, true), - _page_stroke_style(1, 1, true, true), + _page_fill(Gtk::manage(new UI::Widget::NotebookPage(1, 1, true, true))), + _page_stroke_paint(Gtk::manage(new UI::Widget::NotebookPage(1, 1, true, true))), + _page_stroke_style(Gtk::manage(new UI::Widget::NotebookPage(1, 1, true, true))), _composite_settings(SP_VERB_DIALOG_FILL_STROKE, "fillstroke", UI::Widget::SimpleFilterModifier::BLUR), deskTrack(), targetDesktop(0), @@ -56,9 +59,9 @@ FillAndStroke::FillAndStroke() contents->pack_start(_notebook, true, true); - _notebook.append_page(_page_fill, _createPageTabLabel(_("_Fill"), INKSCAPE_ICON("object-fill"))); - _notebook.append_page(_page_stroke_paint, _createPageTabLabel(_("Stroke _paint"), INKSCAPE_ICON("object-stroke"))); - _notebook.append_page(_page_stroke_style, _createPageTabLabel(_("Stroke st_yle"), INKSCAPE_ICON("object-stroke-style"))); + _notebook.append_page(*_page_fill, _createPageTabLabel(_("_Fill"), INKSCAPE_ICON("object-fill"))); + _notebook.append_page(*_page_stroke_paint, _createPageTabLabel(_("Stroke _paint"), INKSCAPE_ICON("object-stroke"))); + _notebook.append_page(*_page_stroke_style, _createPageTabLabel(_("Stroke st_yle"), INKSCAPE_ICON("object-stroke-style"))); _notebook.signal_switch_page().connect(sigc::mem_fun(this, &FillAndStroke::_onSwitchPage)); @@ -129,14 +132,14 @@ void FillAndStroke::_layoutPageFill() { fillWdgt = manage(sp_fill_style_widget_new()); - _page_fill.table().attach(*fillWdgt, 0, 1, 0, 1); + _page_fill->table().attach(*fillWdgt, 0, 0, 1, 1); } void FillAndStroke::_layoutPageStrokePaint() { strokeWdgt = manage(sp_stroke_style_paint_widget_new()); - _page_stroke_paint.table().attach(*strokeWdgt, 0, 1, 0, 1); + _page_stroke_paint->table().attach(*strokeWdgt, 0, 0, 1, 1); } void @@ -145,7 +148,7 @@ FillAndStroke::_layoutPageStrokeStyle() //Gtk::Widget *strokeStyleWdgt = manage(Glib::wrap(sp_stroke_style_line_widget_new())); //Gtk::Widget *strokeStyleWdgt = static_cast<Gtk::Widget *>(sp_stroke_style_line_widget_new()); strokeStyleWdgt = sp_stroke_style_line_widget_new(); - _page_stroke_style.table().attach(*strokeStyleWdgt, 0, 1, 0, 1); + _page_stroke_style->table().attach(*strokeStyleWdgt, 0, 0, 1, 1); } void diff --git a/src/ui/dialog/fill-and-stroke.h b/src/ui/dialog/fill-and-stroke.h index 255cea89a..340cb860f 100644 --- a/src/ui/dialog/fill-and-stroke.h +++ b/src/ui/dialog/fill-and-stroke.h @@ -16,7 +16,6 @@ #define INKSCAPE_UI_DIALOG_FILL_AND_STROKE_H #include "ui/widget/panel.h" -#include "ui/widget/notebook-page.h" #include "ui/widget/object-composite-settings.h" #include "ui/dialog/desktop-tracker.h" @@ -25,6 +24,11 @@ namespace Inkscape { namespace UI { + +namespace Widget { +class NotebookPage; +} + namespace Dialog { class FillAndStroke : public UI::Widget::Panel { @@ -47,9 +51,9 @@ public: protected: Gtk::Notebook _notebook; - UI::Widget::NotebookPage _page_fill; - UI::Widget::NotebookPage _page_stroke_paint; - UI::Widget::NotebookPage _page_stroke_style; + UI::Widget::NotebookPage *_page_fill; + UI::Widget::NotebookPage *_page_stroke_paint; + UI::Widget::NotebookPage *_page_stroke_style; UI::Widget::StyleSubject::Selection _subject; UI::Widget::ObjectCompositeSettings _composite_settings; diff --git a/src/ui/dialog/glyphs.cpp b/src/ui/dialog/glyphs.cpp index be44794d0..9bad90e7c 100644 --- a/src/ui/dialog/glyphs.cpp +++ b/src/ui/dialog/glyphs.cpp @@ -19,7 +19,13 @@ #include <gtkmm/label.h> #include <gtkmm/liststore.h> #include <gtkmm/scrolledwindow.h> -#include <gtkmm/table.h> + +#if WITH_GTKMM_3_0 +# include <gtkmm/grid.h> +#else +# include <gtkmm/table.h> +#endif + #include <gtkmm/treemodelcolumn.h> #include <gtkmm/widget.h> @@ -336,7 +342,12 @@ GlyphsPanel::GlyphsPanel(gchar const *prefsPath) : instanceConns(), desktopConns() { +#if WITH_GTKMM_3_0 + Gtk::Grid *table = new Gtk::Grid(); +#else Gtk::Table *table = new Gtk::Table(3, 1, false); +#endif + _getContents()->pack_start(*Gtk::manage(table), Gtk::PACK_EXPAND_WIDGET); guint row = 0; @@ -349,9 +360,14 @@ GlyphsPanel::GlyphsPanel(gchar const *prefsPath) : gtk_widget_set_size_request (fontsel, 0, 150); g_signal_connect( G_OBJECT(fontsel), "font_set", G_CALLBACK(fontChangeCB), this ); +#if WITH_GTKMM_3_0 + table->attach(*Gtk::manage(Glib::wrap(fontsel)), 0, row, 3, 1); +#else table->attach(*Gtk::manage(Glib::wrap(fontsel)), 0, 3, row, row + 1, Gtk::SHRINK|Gtk::FILL, Gtk::SHRINK|Gtk::FILL); +#endif + row++; @@ -359,9 +375,14 @@ GlyphsPanel::GlyphsPanel(gchar const *prefsPath) : { Gtk::Label *label = new Gtk::Label(_("Script: ")); + +#if WITH_GTKMM_3_0 + table->attach( *Gtk::manage(label), 0, row, 1, 1); +#else table->attach( *Gtk::manage(label), 0, 1, row, row + 1, Gtk::SHRINK, Gtk::SHRINK); +#endif scriptCombo = new Gtk::ComboBoxText(); for (std::map<GUnicodeScript, Glib::ustring>::iterator it = getScriptToName().begin(); it != getScriptToName().end(); ++it) @@ -372,11 +393,17 @@ GlyphsPanel::GlyphsPanel(gchar const *prefsPath) : scriptCombo->set_active_text(getScriptToName()[G_UNICODE_SCRIPT_INVALID_CODE]); sigc::connection conn = scriptCombo->signal_changed().connect(sigc::mem_fun(*this, &GlyphsPanel::rebuild)); instanceConns.push_back(conn); - Gtk::Alignment *align = new Gtk::Alignment(Gtk::ALIGN_START, Gtk::ALIGN_START, 0.0, 0.0); + Gtk::Alignment *align = Gtk::manage(new Gtk::Alignment(Gtk::ALIGN_START, Gtk::ALIGN_START, 0.0, 0.0)); align->add(*Gtk::manage(scriptCombo)); - table->attach( *Gtk::manage(align), + +#if WITH_GTKMM_3_0 + align->set_hexpand(); + table->attach( *align, 1, row, 1, 1); +#else + table->attach( *align, 1, 2, row, row + 1, Gtk::FILL|Gtk::EXPAND, Gtk::SHRINK); +#endif } row++; @@ -385,9 +412,14 @@ GlyphsPanel::GlyphsPanel(gchar const *prefsPath) : { Gtk::Label *label = new Gtk::Label(_("Range: ")); + +#if WITH_GTKMM_3_0 + table->attach( *Gtk::manage(label), 0, row, 1, 1); +#else table->attach( *Gtk::manage(label), 0, 1, row, row + 1, Gtk::SHRINK, Gtk::SHRINK); +#endif rangeCombo = new Gtk::ComboBoxText(); for ( std::vector<NamedRange>::iterator it = getRanges().begin(); it != getRanges().end(); ++it ) { @@ -399,9 +431,15 @@ GlyphsPanel::GlyphsPanel(gchar const *prefsPath) : instanceConns.push_back(conn); Gtk::Alignment *align = new Gtk::Alignment(Gtk::ALIGN_START, Gtk::ALIGN_START, 0.0, 0.0); align->add(*Gtk::manage(rangeCombo)); + +#if WITH_GTKMM_3_0 + align->set_hexpand(); + table->attach( *Gtk::manage(align), 1, row, 1, 1); +#else table->attach( *Gtk::manage(align), 1, 2, row, row + 1, Gtk::FILL|Gtk::EXPAND, Gtk::SHRINK); +#endif } row++; @@ -424,9 +462,17 @@ GlyphsPanel::GlyphsPanel(gchar const *prefsPath) : Gtk::ScrolledWindow *scroller = new Gtk::ScrolledWindow(); scroller->set_policy(Gtk::POLICY_AUTOMATIC, Gtk::POLICY_ALWAYS); scroller->add(*Gtk::manage(iconView)); + +#if WITH_GTKMM_3_0 + scroller->set_hexpand(); + scroller->set_vexpand(); + table->attach(*Gtk::manage(scroller), 0, row, 3, 1); +#else table->attach(*Gtk::manage(scroller), 0, 3, row, row + 1, Gtk::EXPAND|Gtk::FILL, Gtk::EXPAND|Gtk::FILL); +#endif + row++; // ------------------------------- @@ -456,9 +502,15 @@ GlyphsPanel::GlyphsPanel(gchar const *prefsPath) : box->pack_end(*Gtk::manage(insertBtn), Gtk::PACK_SHRINK); +#if WITH_GTKMM_3_0 + box->set_hexpand(); + table->attach( *Gtk::manage(box), 0, row, 3, 1); +#else table->attach( *Gtk::manage(box), 0, 3, row, row + 1, Gtk::EXPAND|Gtk::FILL, Gtk::SHRINK); +#endif + row++; // ------------------------------- diff --git a/src/ui/dialog/input.cpp b/src/ui/dialog/input.cpp index 1df0d606e..9c9f7faa3 100644 --- a/src/ui/dialog/input.cpp +++ b/src/ui/dialog/input.cpp @@ -31,7 +31,13 @@ #include <gtkmm/paned.h> #include <gtkmm/progressbar.h> #include <gtkmm/scrolledwindow.h> -#include <gtkmm/table.h> + +#if WITH_GTKMM_3_0 +# include <gtkmm/grid.h> +#else +# include <gtkmm/table.h> +#endif + #include <gtkmm/treemodel.h> #include <gtkmm/treemodelcolumn.h> #include <gtkmm/treestore.h> @@ -504,7 +510,12 @@ private: Gtk::Label devAxesCount; Gtk::ComboBoxText axesCombo; Gtk::ProgressBar axesValues[6]; + +#if WITH_GTKMM_3_0 + Gtk::Grid axisTable; +#else Gtk::Table axisTable; +#endif Gtk::ComboBoxText buttonCombo; Gtk::ComboBoxText linkCombo; @@ -515,7 +526,13 @@ private: Gtk::Image testThumb; Gtk::Image testButtons[24]; Gtk::Image testAxes[8]; + +#if WITH_GTKMM_3_0 + Gtk::Grid imageTable; +#else Gtk::Table imageTable; +#endif + Gtk::EventBox testDetector; ConfPanel cfgPanel; @@ -603,13 +620,18 @@ InputDialogImpl::InputDialogImpl() : splitter(), #if WITH_GTKMM_3_0 split2(Gtk::ORIENTATION_VERTICAL), + axisTable(), #else split2(), -#endif axisTable(11, 2), +#endif linkCombo(), topHolder(), +#if WITH_GTKMM_3_0 + imageTable(), +#else imageTable(8, 7), +#endif testDetector(), cfgPanel() { @@ -631,13 +653,27 @@ InputDialogImpl::InputDialogImpl() : testFrame.add(testDetector); testThumb.set(getPix(PIX_TABLET)); testThumb.set_padding(24, 24); + +#if WITH_GTKMM_3_0 + testThumb.set_hexpand(); + testThumb.set_vexpand(); + imageTable.attach(testThumb, 0, 0, 8, 1); +#else imageTable.attach(testThumb, 0, 8, 0, 1, ::Gtk::EXPAND, ::Gtk::EXPAND); +#endif + { guint col = 0; guint row = 1; for ( guint num = 0; num < G_N_ELEMENTS(testButtons); num++ ) { testButtons[num].set(getPix(PIX_BUTTONS_NONE)); + +#if WITH_GTKMM_3_0 + imageTable.attach(testButtons[num], col, row, 1, 1); +#else imageTable.attach(testButtons[num], col, col + 1, row, row + 1, ::Gtk::FILL, ::Gtk::FILL); +#endif + col++; if (col > 7) { col = 0; @@ -648,7 +684,13 @@ InputDialogImpl::InputDialogImpl() : col = 0; for ( guint num = 0; num < G_N_ELEMENTS(testAxes); num++ ) { testAxes[num].set(getPix(PIX_AXIS_NONE)); + +#if WITH_GTKMM_3_0 + imageTable.attach(testAxes[num], col * 2, row, 2, 1); +#else imageTable.attach(testAxes[num], col * 2, (col + 1) * 2, row, row + 1, ::Gtk::FILL, ::Gtk::FILL); +#endif + col++; if (col > 3) { col = 0; @@ -686,28 +728,44 @@ InputDialogImpl::InputDialogImpl() : axisFrame.add(axisTable); Gtk::Label *lbl = Gtk::manage(new Gtk::Label(_("Link:"))); + +#if WITH_GTKMM_3_0 + axisTable.attach(*lbl, 0, rowNum, 1, 1); +#else axisTable.attach(*lbl, 0, 1, rowNum, rowNum+ 1, ::Gtk::FILL, ::Gtk::SHRINK); +#endif linkCombo.append(_("None")); linkCombo.set_active_text(_("None")); linkCombo.set_sensitive(false); linkConnection = linkCombo.signal_changed().connect(sigc::mem_fun(*this, &InputDialogImpl::linkComboChanged)); +#if WITH_GTKMM_3_0 + axisTable.attach(linkCombo, 1, rowNum, 1, 1); +#else axisTable.attach(linkCombo, 1, 2, rowNum, rowNum + 1, ::Gtk::FILL, ::Gtk::SHRINK); +#endif + rowNum++; lbl = Gtk::manage(new Gtk::Label(_("Axes count:"))); + +#if WITH_GTKMM_3_0 + axisTable.attach(*lbl, 0, rowNum, 1, 1); + axisTable.attach(devAxesCount, 1, rowNum, 1, 1); +#else axisTable.attach(*lbl, 0, 1, rowNum, rowNum+ 1, ::Gtk::FILL, ::Gtk::SHRINK); axisTable.attach(devAxesCount, 1, 2, rowNum, rowNum + 1, ::Gtk::SHRINK, ::Gtk::SHRINK); +#endif rowNum++; @@ -726,12 +784,22 @@ InputDialogImpl::InputDialogImpl() : for ( guint barNum = 0; barNum < static_cast<guint>(G_N_ELEMENTS(axesValues)); barNum++ ) { lbl = Gtk::manage(new Gtk::Label(_("axis:"))); + +#if WITH_GTKMM_3_0 + lbl->set_hexpand(); + axisTable.attach(*lbl, 0, rowNum, 1, 1); + + axesValues[barNum].set_hexpand(); + axisTable.attach(axesValues[barNum], 1, rowNum, 1, 1); +#else axisTable.attach(*lbl, 0, 1, rowNum, rowNum+ 1, ::Gtk::EXPAND, ::Gtk::SHRINK); axisTable.attach(axesValues[barNum], 1, 2, rowNum, rowNum + 1, ::Gtk::EXPAND, ::Gtk::SHRINK); +#endif + axesValues[barNum].set_sensitive(false); rowNum++; @@ -740,12 +808,18 @@ InputDialogImpl::InputDialogImpl() : } lbl = Gtk::manage(new Gtk::Label(_("Button count:"))); + +#if WITH_GTKMM_3_0 + axisTable.attach(*lbl, 0, rowNum, 1, 1); + axisTable.attach(devKeyCount, 1, rowNum, 1, 1); +#else axisTable.attach(*lbl, 0, 1, rowNum, rowNum+ 1, ::Gtk::FILL, ::Gtk::SHRINK); axisTable.attach(devKeyCount, 1, 2, rowNum, rowNum + 1, ::Gtk::SHRINK, ::Gtk::SHRINK); +#endif rowNum++; @@ -761,9 +835,14 @@ InputDialogImpl::InputDialogImpl() : rowNum++; */ +#if WITH_GTKMM_3_0 + axisTable.attach(keyVal, 0, rowNum, 2, 1); +#else axisTable.attach(keyVal, 0, 2, rowNum, rowNum + 1, ::Gtk::FILL, ::Gtk::SHRINK); +#endif + rowNum++; @@ -781,9 +860,14 @@ InputDialogImpl::InputDialogImpl() : #endif testDetector.add_events(Gdk::POINTER_MOTION_MASK|Gdk::KEY_PRESS_MASK|Gdk::KEY_RELEASE_MASK |Gdk::PROXIMITY_IN_MASK|Gdk::PROXIMITY_OUT_MASK|Gdk::SCROLL_MASK); +#if WITH_GTKMM_3_0 + axisTable.attach(keyEntry, 0, rowNum, 2, 1); +#else axisTable.attach(keyEntry, 0, 2, rowNum, rowNum + 1, ::Gtk::FILL, ::Gtk::SHRINK); +#endif + rowNum++; diff --git a/src/ui/dialog/livepatheffect-editor.cpp b/src/ui/dialog/livepatheffect-editor.cpp index 7ecb6d5cd..e6bb9b43d 100644 --- a/src/ui/dialog/livepatheffect-editor.cpp +++ b/src/ui/dialog/livepatheffect-editor.cpp @@ -48,8 +48,6 @@ #include "livepatheffect-add.h" namespace Inkscape { -class Application; - namespace UI { namespace Dialog { diff --git a/src/ui/dialog/symbols.cpp b/src/ui/dialog/symbols.cpp index 97d8b0523..cc6ddd7de 100644 --- a/src/ui/dialog/symbols.cpp +++ b/src/ui/dialog/symbols.cpp @@ -22,7 +22,13 @@ #include <gtkmm/buttonbox.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 <gtkmm/scrolledwindow.h> #include <gtkmm/comboboxtext.h> #include <gtkmm/iconview.h> @@ -100,20 +106,35 @@ SymbolsDialog::SymbolsDialog( gchar const* prefsPath ) : { /******************** Table *************************/ - // Replace by Grid for GTK 3.0 +#if WITH_GTKMM_3_0 + Gtk::Grid *table = new Gtk::Grid(); +#else Gtk::Table *table = new Gtk::Table(2, 4, false); +#endif + // panel is a cloked Gtk::VBox _getContents()->pack_start(*Gtk::manage(table), Gtk::PACK_EXPAND_WIDGET); guint row = 0; /******************** Symbol Sets *************************/ Gtk::Label* labelSet = new Gtk::Label(_("Symbol set: ")); + +#if WITH_GTKMM_3_0 + table->attach(*Gtk::manage(labelSet),0,row,1,1); +#else table->attach(*Gtk::manage(labelSet),0,1,row,row+1,Gtk::SHRINK,Gtk::SHRINK); +#endif symbolSet = new Gtk::ComboBoxText(); // Fill in later symbolSet->append(_("Current Document")); symbolSet->set_active_text(_("Current Document")); + +#if WITH_GTKMM_3_0 + symbolSet->set_hexpand(); + table->attach(*Gtk::manage(symbolSet),1,row,1,1); +#else table->attach(*Gtk::manage(symbolSet),1,2,row,row+1,Gtk::FILL|Gtk::EXPAND,Gtk::SHRINK); +#endif sigc::connection connSet = symbolSet->signal_changed().connect(sigc::mem_fun(*this, &SymbolsDialog::rebuild)); @@ -143,13 +164,25 @@ SymbolsDialog::SymbolsDialog( gchar const* prefsPath ) : Gtk::ScrolledWindow *scroller = new Gtk::ScrolledWindow(); scroller->set_policy(Gtk::POLICY_AUTOMATIC, Gtk::POLICY_ALWAYS); scroller->add(*Gtk::manage(iconView)); + +#if WITH_GTKMM_3_0 + scroller->set_hexpand(); + scroller->set_vexpand(); + table->attach(*Gtk::manage(scroller),0,row,2,1); +#else table->attach(*Gtk::manage(scroller),0,2,row,row+1,Gtk::EXPAND|Gtk::FILL,Gtk::EXPAND|Gtk::FILL); +#endif ++row; /******************** Preview Scale ***********************/ Gtk::Label* labelScale = new Gtk::Label(_("Preview scale: ")); + +#if WITH_GTKMM_3_0 + table->attach(*Gtk::manage(labelScale),0,row,1,1); +#else table->attach(*Gtk::manage(labelScale),0,1,row,row+1,Gtk::SHRINK,Gtk::SHRINK); +#endif previewScale = new Gtk::ComboBoxText(); const gchar *scales[] = @@ -158,7 +191,13 @@ SymbolsDialog::SymbolsDialog( gchar const* prefsPath ) : previewScale->append(scales[i]); } previewScale->set_active_text(scales[0]); + +#if WITH_GTKMM_3_0 + previewScale->set_hexpand(); + table->attach(*Gtk::manage(previewScale),1,row,1,1); +#else table->attach(*Gtk::manage(previewScale),1,2,row,row+1,Gtk::FILL|Gtk::EXPAND,Gtk::SHRINK); +#endif sigc::connection connScale = previewScale->signal_changed().connect(sigc::mem_fun(*this, &SymbolsDialog::rebuild)); @@ -168,7 +207,12 @@ SymbolsDialog::SymbolsDialog( gchar const* prefsPath ) : /******************** Preview Size ************************/ Gtk::Label* labelSize = new Gtk::Label(_("Preview size: ")); + +#if WITH_GTKMM_3_0 + table->attach(*Gtk::manage(labelSize),0,row,1,1); +#else table->attach(*Gtk::manage(labelSize),0,1,row,row+1,Gtk::SHRINK,Gtk::SHRINK); +#endif previewSize = new Gtk::ComboBoxText(); const gchar *sizes[] = {"16", "24", "32", "48", "64", NULL}; @@ -176,7 +220,13 @@ SymbolsDialog::SymbolsDialog( gchar const* prefsPath ) : previewSize->append(sizes[i]); } previewSize->set_active_text(sizes[2]); + +#if WITH_GTKMM_3_0 + previewSize->set_hexpand(); + table->attach(*Gtk::manage(previewSize),1,row,1,1); +#else table->attach(*Gtk::manage(previewSize),1,2,row,row+1,Gtk::FILL|Gtk::EXPAND,Gtk::SHRINK); +#endif sigc::connection connSize = previewSize->signal_changed().connect(sigc::mem_fun(*this, &SymbolsDialog::rebuild)); diff --git a/src/ui/dialog/tile.cpp b/src/ui/dialog/tile.cpp index 410cdbda9..c35d3b554 100644 --- a/src/ui/dialog/tile.cpp +++ b/src/ui/dialog/tile.cpp @@ -14,14 +14,17 @@ */ //#define DEBUG_GRID_ARRANGE 1 -#ifdef HAVE_CONFIG_H -# include <config.h> -#endif - #include "tile.h" #include <gtk/gtk.h> //for GTK_RESPONSE* types #include <glibmm/i18n.h> #include <gtkmm/stock.h> + +#if WITH_GTKMM_3_0 +# include <gtkmm/grid.h> +#else +# include <gtkmm/table.h> +#endif + #include <2geom/transforms.h> #include "verbs.h" @@ -614,7 +617,11 @@ TileDialog::TileDialog() : UI::Widget::Panel("", "/dialogs/gridtiler", SP_VERB_SELECTION_GRIDTILE), XPadding(_("X:"), _("Horizontal spacing between columns."), UNIT_TYPE_LINEAR, "", "object-columns", &PaddingUnitMenu), YPadding(_("Y:"), _("Vertical spacing between rows."), UNIT_TYPE_LINEAR, "", "object-rows", &PaddingUnitMenu), - PaddingTable(2, 2, false) +#if WITH_GTKMM_3_0 + PaddingTable(Gtk::manage(new Gtk::Grid())) +#else + PaddingTable(Gtk::manage(new Gtk::Table(2, 2, false))) +#endif { // bool used by spin button callbacks to stop loops where they change each other. updating = false; @@ -834,13 +841,23 @@ TileDialog::TileDialog() XPadding.signal_value_changed().connect(sigc::mem_fun(*this, &TileDialog::on_xpad_spinbutton_changed)); } - PaddingTable.set_border_width(MARGIN); - PaddingTable.set_row_spacings(MARGIN); - PaddingTable.set_col_spacings(MARGIN); - PaddingTable.attach(XPadding, 0, 1, 0, 1, Gtk::SHRINK, Gtk::SHRINK); - PaddingTable.attach(PaddingUnitMenu, 1, 2, 0, 1, Gtk::SHRINK, Gtk::SHRINK); - PaddingTable.attach(YPadding, 0, 1, 1, 2, Gtk::SHRINK, Gtk::SHRINK); - TileBox.pack_start(PaddingTable, false, false, MARGIN); + PaddingTable->set_border_width(MARGIN); + +#if WITH_GTKMM_3_0 + PaddingTable->set_row_spacing(MARGIN); + PaddingTable->set_column_spacing(MARGIN); + PaddingTable->attach(XPadding, 0, 0, 1, 1); + PaddingTable->attach(PaddingUnitMenu, 1, 0, 1, 1); + PaddingTable->attach(YPadding, 0, 1, 1, 1); +#else + PaddingTable->set_row_spacings(MARGIN); + PaddingTable->set_col_spacings(MARGIN); + PaddingTable->attach(XPadding, 0, 1, 0, 1, Gtk::SHRINK, Gtk::SHRINK); + PaddingTable->attach(PaddingUnitMenu, 1, 2, 0, 1, Gtk::SHRINK, Gtk::SHRINK); + PaddingTable->attach(YPadding, 0, 1, 1, 2, Gtk::SHRINK, Gtk::SHRINK); +#endif + + TileBox.pack_start(*PaddingTable, false, false, MARGIN); contents->pack_start(TileBox); diff --git a/src/ui/dialog/tile.h b/src/ui/dialog/tile.h index 884cd3bae..86dbd25a9 100644 --- a/src/ui/dialog/tile.h +++ b/src/ui/dialog/tile.h @@ -15,11 +15,14 @@ #ifndef SEEN_UI_DIALOG_TILE_H #define SEEN_UI_DIALOG_TILE_H +#ifdef HAVE_CONFIG_H +# include <config.h> +#endif + #include <gtkmm/box.h> #include <gtkmm/notebook.h> #include <gtkmm/checkbutton.h> #include <gtkmm/radiobutton.h> -#include <gtkmm/table.h> #include "ui/widget/panel.h" #include "ui/widget/spinbutton.h" @@ -27,6 +30,12 @@ namespace Gtk { class Button; + +#if WITH_GTKMM_3_0 +class Grid; +#else +class Table; +#endif } namespace Inkscape { @@ -133,7 +142,12 @@ private: Inkscape::UI::Widget::UnitMenu PaddingUnitMenu; Inkscape::UI::Widget::ScalarUnit XPadding; Inkscape::UI::Widget::ScalarUnit YPadding; - Gtk::Table PaddingTable; + +#if WITH_GTKMM_3_0 + Gtk::Grid *PaddingTable; +#else + Gtk::Table *PaddingTable; +#endif // BBox or manual spacing Gtk::VBox SpacingVBox; diff --git a/src/ui/dialog/transformation.cpp b/src/ui/dialog/transformation.cpp index 329450b52..c071fcf95 100644 --- a/src/ui/dialog/transformation.cpp +++ b/src/ui/dialog/transformation.cpp @@ -216,25 +216,40 @@ void Transformation::layoutPageMove() _scalar_move_vertical.setIncrements(0.1, 1.0); //_scalar_move_vertical.set_label_image( INKSCAPE_STOCK_ARROWS_HOR ); + +#if WITH_GTKMM_3_0 + _page_move.table().attach(_scalar_move_horizontal, 0, 0, 2, 1); + _page_move.table().attach(_units_move, 2, 0, 1, 1); +#else _page_move.table() .attach(_scalar_move_horizontal, 0, 2, 0, 1, Gtk::FILL, Gtk::SHRINK); _page_move.table() .attach(_units_move, 2, 3, 0, 1, Gtk::SHRINK, Gtk::SHRINK); +#endif _scalar_move_horizontal.signal_value_changed() .connect(sigc::mem_fun(*this, &Transformation::onMoveValueChanged)); //_scalar_move_vertical.set_label_image( INKSCAPE_STOCK_ARROWS_VER ); +#if WITH_GTKMM_3_0 + _page_move.table().attach(_scalar_move_vertical, 0, 1, 2, 1); +#else _page_move.table() .attach(_scalar_move_vertical, 0, 2, 1, 2, Gtk::FILL, Gtk::SHRINK); +#endif _scalar_move_vertical.signal_value_changed() .connect(sigc::mem_fun(*this, &Transformation::onMoveValueChanged)); // Relative moves +#if WITH_GTKMM_3_0 + _page_move.table().attach(_check_move_relative, 0, 2, 2, 1); +#else _page_move.table() .attach(_check_move_relative, 0, 2, 2, 3, Gtk::FILL, Gtk::SHRINK); +#endif + _check_move_relative.set_active(true); _check_move_relative.signal_toggled() .connect(sigc::mem_fun(*this, &Transformation::onMoveRelativeToggled)); @@ -259,21 +274,37 @@ void Transformation::layoutPageScale() _scalar_scale_vertical.setAbsoluteIsIncrement(true); _scalar_scale_vertical.setPercentageIsIncrement(true); +#if WITH_GTKMM_3_0 + _page_scale.table().attach(_scalar_scale_horizontal, 0, 0, 2, 1); +#else _page_scale.table() .attach(_scalar_scale_horizontal, 0, 2, 0, 1, Gtk::FILL, Gtk::SHRINK); +#endif + _scalar_scale_horizontal.signal_value_changed() .connect(sigc::mem_fun(*this, &Transformation::onScaleXValueChanged)); +#if WITH_GTKMM_3_0 + _page_scale.table().attach(_units_scale, 2, 0, 1, 1); + _page_scale.table().attach(_scalar_scale_vertical, 0, 1, 2, 1); +#else _page_scale.table() .attach(_units_scale, 2, 3, 0, 1, Gtk::SHRINK, Gtk::SHRINK); _page_scale.table() .attach(_scalar_scale_vertical, 0, 2, 1, 2, Gtk::FILL, Gtk::SHRINK); +#endif + _scalar_scale_vertical.signal_value_changed() .connect(sigc::mem_fun(*this, &Transformation::onScaleYValueChanged)); +#if WITH_GTKMM_3_0 + _page_scale.table().attach(_check_scale_proportional, 0, 2, 2, 1); +#else _page_scale.table() .attach(_check_scale_proportional, 0, 2, 2, 3, Gtk::FILL, Gtk::SHRINK); +#endif + _check_scale_proportional.set_active(false); _check_scale_proportional.signal_toggled() .connect(sigc::mem_fun(*this, &Transformation::onScaleProportionalToggled)); @@ -304,6 +335,12 @@ void Transformation::layoutPageRotate() Gtk::RadioButton::Group group = _counterclockwise_rotate.get_group(); _clockwise_rotate.set_group(group); +#if WITH_GTKMM_3_0 + _page_rotate.table().attach(_scalar_rotate, 0, 0, 2, 1); + _page_rotate.table().attach(_units_rotate, 2, 0, 1, 1); + _page_rotate.table().attach(_counterclockwise_rotate, 3, 0, 1, 1); + _page_rotate.table().attach(_clockwise_rotate, 4, 0, 1, 1); +#else _page_rotate.table() .attach(_scalar_rotate, 0, 2, 0, 1, Gtk::FILL, Gtk::SHRINK); @@ -315,6 +352,7 @@ void Transformation::layoutPageRotate() _page_rotate.table() .attach(_clockwise_rotate, 4, 5, 0, 1, Gtk::SHRINK, Gtk::SHRINK); +#endif Inkscape::Preferences *prefs = Inkscape::Preferences::get(); if (prefs->getBool("/dialogs/transformation/rotateCounterClockwise", TRUE)) { @@ -348,16 +386,27 @@ void Transformation::layoutPageSkew() _scalar_skew_vertical.setDigits(3); _scalar_skew_vertical.setIncrements(0.1, 1.0); +#if WITH_GTKMM_3_0 + _page_skew.table().attach(_scalar_skew_horizontal, 0, 0, 2, 1); +#else _page_skew.table() .attach(_scalar_skew_horizontal, 0, 2, 0, 1, Gtk::FILL, Gtk::SHRINK); +#endif + _scalar_skew_horizontal.signal_value_changed() .connect(sigc::mem_fun(*this, &Transformation::onSkewValueChanged)); +#if WITH_GTKMM_3_0 + _page_skew.table().attach(_units_skew, 2, 0, 1, 1); + _page_skew.table().attach(_scalar_skew_vertical, 0, 1, 2, 1); +#else _page_skew.table() .attach(_units_skew, 2, 3, 0, 1, Gtk::SHRINK, Gtk::SHRINK); _page_skew.table() .attach(_scalar_skew_vertical, 0, 2, 1, 2, Gtk::FILL, Gtk::SHRINK); +#endif + _scalar_skew_vertical.signal_value_changed() .connect(sigc::mem_fun(*this, &Transformation::onSkewValueChanged)); @@ -373,30 +422,46 @@ void Transformation::layoutPageTransform() _scalar_transform_a.setDigits(3); _scalar_transform_a.setIncrements(0.1, 1.0); _scalar_transform_a.setValue(1.0); + +#if WITH_GTKMM_3_0 + _page_transform.table().attach(_scalar_transform_a, 0, 0, 1, 1); +#else _page_transform.table() .attach(_scalar_transform_a, 0, 1, 0, 1, Gtk::SHRINK, Gtk::SHRINK); +#endif + _scalar_transform_a.signal_value_changed() .connect(sigc::mem_fun(*this, &Transformation::onTransformValueChanged)); - _scalar_transform_b.setWidgetSizeRequest(65, -1); _scalar_transform_b.setRange(-1e10, 1e10); _scalar_transform_b.setDigits(3); _scalar_transform_b.setIncrements(0.1, 1.0); _scalar_transform_b.setValue(0.0); + +#if WITH_GTKMM_3_0 + _page_transform.table().attach(_scalar_transform_b, 0, 1, 1, 1); +#else _page_transform.table() .attach(_scalar_transform_b, 0, 1, 1, 2, Gtk::SHRINK, Gtk::SHRINK); +#endif + _scalar_transform_b.signal_value_changed() .connect(sigc::mem_fun(*this, &Transformation::onTransformValueChanged)); - _scalar_transform_c.setWidgetSizeRequest(65, -1); _scalar_transform_c.setRange(-1e10, 1e10); _scalar_transform_c.setDigits(3); _scalar_transform_c.setIncrements(0.1, 1.0); _scalar_transform_c.setValue(0.0); + +#if WITH_GTKMM_3_0 + _page_transform.table().attach(_scalar_transform_c, 1, 0, 1, 1); +#else _page_transform.table() .attach(_scalar_transform_c, 1, 2, 0, 1, Gtk::SHRINK, Gtk::SHRINK); +#endif + _scalar_transform_c.signal_value_changed() .connect(sigc::mem_fun(*this, &Transformation::onTransformValueChanged)); @@ -406,8 +471,14 @@ void Transformation::layoutPageTransform() _scalar_transform_d.setDigits(3); _scalar_transform_d.setIncrements(0.1, 1.0); _scalar_transform_d.setValue(1.0); + +#if WITH_GTKMM_3_0 + _page_transform.table().attach(_scalar_transform_d, 1, 1, 1, 1); +#else _page_transform.table() .attach(_scalar_transform_d, 1, 2, 1, 2, Gtk::SHRINK, Gtk::SHRINK); +#endif + _scalar_transform_d.signal_value_changed() .connect(sigc::mem_fun(*this, &Transformation::onTransformValueChanged)); @@ -417,8 +488,14 @@ void Transformation::layoutPageTransform() _scalar_transform_e.setDigits(3); _scalar_transform_e.setIncrements(0.1, 1.0); _scalar_transform_e.setValue(0.0); + +#if WITH_GTKMM_3_0 + _page_transform.table().attach(_scalar_transform_e, 2, 0, 1, 1); +#else _page_transform.table() .attach(_scalar_transform_e, 2, 3, 0, 1, Gtk::SHRINK, Gtk::SHRINK); +#endif + _scalar_transform_e.signal_value_changed() .connect(sigc::mem_fun(*this, &Transformation::onTransformValueChanged)); @@ -428,14 +505,25 @@ void Transformation::layoutPageTransform() _scalar_transform_f.setDigits(3); _scalar_transform_f.setIncrements(0.1, 1.0); _scalar_transform_f.setValue(0.0); + +#if WITH_GTKMM_3_0 + _page_transform.table().attach(_scalar_transform_f, 2, 1, 1, 1); +#else _page_transform.table() .attach(_scalar_transform_f, 2, 3, 1, 2, Gtk::SHRINK, Gtk::SHRINK); +#endif + _scalar_transform_f.signal_value_changed() .connect(sigc::mem_fun(*this, &Transformation::onTransformValueChanged)); // Edit existing matrix +#if WITH_GTKMM_3_0 + _page_transform.table().attach(_check_replace_matrix, 0, 2, 2, 1); +#else _page_transform.table() .attach(_check_replace_matrix, 0, 2, 2, 3, Gtk::FILL, Gtk::SHRINK); +#endif + _check_replace_matrix.set_active(false); _check_replace_matrix.signal_toggled() .connect(sigc::mem_fun(*this, &Transformation::onReplaceMatrixToggled)); diff --git a/src/ui/dialog/xml-tree.h b/src/ui/dialog/xml-tree.h index 9d2fac71f..0a6e3a786 100644 --- a/src/ui/dialog/xml-tree.h +++ b/src/ui/dialog/xml-tree.h @@ -28,7 +28,7 @@ #include "ui/dialog/desktop-tracker.h" #include "message.h" -struct SPDesktop; +class SPDesktop; struct SPObject; struct SPXMLViewAttrList; struct SPXMLViewContent; diff --git a/src/ui/tool/control-point.h b/src/ui/tool/control-point.h index 30efe8a27..27a0f8074 100644 --- a/src/ui/tool/control-point.h +++ b/src/ui/tool/control-point.h @@ -23,7 +23,7 @@ #include "enums.h" class SPDesktop; -class SPEventContext; +struct SPEventContext; namespace Inkscape { namespace UI { diff --git a/src/ui/tool/path-manipulator.h b/src/ui/tool/path-manipulator.h index 55958530d..a235a3b05 100644 --- a/src/ui/tool/path-manipulator.h +++ b/src/ui/tool/path-manipulator.h @@ -21,7 +21,7 @@ #include "ui/tool/manipulator.h" struct SPCanvasItem; -struct SPCurve; +class SPCurve; struct SPPath; namespace Inkscape { diff --git a/src/ui/view/view-widget.h b/src/ui/view/view-widget.h index 668f9d19a..295e7932b 100644 --- a/src/ui/view/view-widget.h +++ b/src/ui/view/view-widget.h @@ -23,7 +23,7 @@ class View; } // namespace Inkscape class SPViewWidget; -class SPNamedView; +struct SPNamedView; #define SP_TYPE_VIEW_WIDGET (sp_view_widget_get_type ()) #define SP_VIEW_WIDGET(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), SP_TYPE_VIEW_WIDGET, SPViewWidget)) diff --git a/src/ui/widget/notebook-page.cpp b/src/ui/widget/notebook-page.cpp index 92bcb6937..6653499b8 100644 --- a/src/ui/widget/notebook-page.cpp +++ b/src/ui/widget/notebook-page.cpp @@ -9,22 +9,35 @@ * Released under GNU GPL. Read the file 'COPYING' for more information */ -#ifdef HAVE_CONFIG_H -# include <config.h> -#endif - #include "notebook-page.h" +#if WITH_GTKMM_3_0 +# include <gtkmm/grid.h> +#else +# include <gtkmm/table.h> +#endif + namespace Inkscape { namespace UI { namespace Widget { NotebookPage::NotebookPage(int n_rows, int n_columns, bool expand, bool fill, guint padding) - :_table(n_rows, n_columns) +#if WITH_GTKMM_3_0 + :_table(Gtk::manage(new Gtk::Grid())) +#else + :_table(Gtk::manage(new Gtk::Table(n_rows, n_columns))) +#endif { set_border_width(2); - _table.set_spacings(2); - pack_start(_table, expand, fill, padding); + +#if WITH_GTKMM_3_0 + _table->set_row_spacing(2); + _table->set_column_spacing(2); +#else + _table->set_spacings(2); +#endif + + pack_start(*_table, expand, fill, padding); } } // namespace Widget diff --git a/src/ui/widget/notebook-page.h b/src/ui/widget/notebook-page.h index 140b7cb33..d8b8fb0c4 100644 --- a/src/ui/widget/notebook-page.h +++ b/src/ui/widget/notebook-page.h @@ -10,8 +10,19 @@ #ifndef INKSCAPE_UI_WIDGET_NOTEBOOK_PAGE_H #define INKSCAPE_UI_WIDGET_NOTEBOOK_PAGE_H +#ifdef HAVE_CONFIG_H +# include <config.h> +#endif + #include <gtkmm/box.h> -#include <gtkmm/table.h> + +namespace Gtk { +#if WITH_GTKMM_3_0 +class Grid; +#else +class Table; +#endif +} namespace Inkscape { namespace UI { @@ -31,10 +42,19 @@ public: */ NotebookPage(int n_rows, int n_columns, bool expand=false, bool fill=false, guint padding=0); - Gtk::Table& table() { return _table; } +#if WITH_GTKMM_3_0 + Gtk::Grid& table() { return *_table; } +#else + Gtk::Table& table() { return *_table; } +#endif protected: - Gtk::Table _table; + +#if WITH_GTKMM_3_0 + Gtk::Grid *_table; +#else + Gtk::Table *_table; +#endif }; } // namespace Widget diff --git a/src/ui/widget/object-composite-settings.h b/src/ui/widget/object-composite-settings.h index d3a208525..bee9f09b9 100644 --- a/src/ui/widget/object-composite-settings.h +++ b/src/ui/widget/object-composite-settings.h @@ -21,8 +21,10 @@ #include "ui/widget/filter-effect-chooser.h" #include "ui/widget/spinbutton.h" +class SPDesktop; + namespace Inkscape { -class Application; +struct Application; namespace UI { namespace Widget { diff --git a/src/ui/widget/style-subject.h b/src/ui/widget/style-subject.h index 47da91732..c2941d995 100644 --- a/src/ui/widget/style-subject.h +++ b/src/ui/widget/style-subject.h @@ -20,7 +20,7 @@ class SPDesktop; class SPObject; class SPCSSAttr; -class SPStyle; +struct SPStyle; namespace Inkscape { class Selection; diff --git a/src/ui/widget/style-swatch.cpp b/src/ui/widget/style-swatch.cpp index 44bceb826..a89f42575 100644 --- a/src/ui/widget/style-swatch.cpp +++ b/src/ui/widget/style-swatch.cpp @@ -11,15 +11,11 @@ * Released under GNU GPL. Read the file 'COPYING' for more information. */ -#ifdef HAVE_CONFIG_H -# include <config.h> -#endif +#include "style-swatch.h" #include <cstring> #include <string> -#include "style-swatch.h" - #include "widgets/spw-utilities.h" #include "ui/widget/color-preview.h" @@ -37,6 +33,12 @@ #include "verbs.h" #include <glibmm/i18n.h> +#if WITH_GTKMM_3_0 +# include <gtkmm/grid.h> +#else +# include <gtkmm/table.h> +#endif + enum { SS_FILL, SS_STROKE @@ -114,7 +116,11 @@ StyleSwatch::StyleSwatch(SPCSSAttr *css, gchar const *main_tip) _css(NULL), _tool_obs(NULL), _style_obs(NULL), - _table(2, 6), +#if WITH_GTKMM_3_0 + _table(Gtk::manage(new Gtk::Grid())), +#else + _table(Gtk::manage(new Gtk::Table(2, 6))), +#endif _sw_unit(NULL) { _label[SS_FILL].set_markup(_("Fill:")); @@ -130,23 +136,35 @@ StyleSwatch::StyleSwatch(SPCSSAttr *css, gchar const *main_tip) _opacity_value.set_alignment(0.0, 0.5); _opacity_value.set_padding(0, 0); - _table.set_col_spacings (2); - _table.set_row_spacings (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 _stroke.pack_start(_place[SS_STROKE]); _stroke_width_place.add(_stroke_width); _stroke.pack_start(_stroke_width_place, Gtk::PACK_SHRINK); - - _table.attach(_label[SS_FILL], 0,1, 0,1, Gtk::FILL, Gtk::SHRINK); - _table.attach(_label[SS_STROKE], 0,1, 1,2, Gtk::FILL, Gtk::SHRINK); - - _table.attach(_place[SS_FILL], 1,2, 0,1); - _table.attach(_stroke, 1,2, 1,2); - + _opacity_place.add(_opacity_value); - _table.attach(_opacity_place, 2,3, 0,2, Gtk::SHRINK, Gtk::SHRINK); - _swatch.add(_table); +#if WITH_GTKMM_3_0 + _table->attach(_label[SS_FILL], 0, 0, 1, 1); + _table->attach(_label[SS_STROKE], 0, 1, 1, 1); + _table->attach(_place[SS_FILL], 1, 0, 1, 1); + _table->attach(_stroke, 1, 1, 1, 1); + _table->attach(_opacity_place, 2, 0, 1, 2); +#else + _table->attach(_label[SS_FILL], 0,1, 0,1, Gtk::FILL, Gtk::SHRINK); + _table->attach(_label[SS_STROKE], 0,1, 1,2, Gtk::FILL, Gtk::SHRINK); + _table->attach(_place[SS_FILL], 1,2, 0,1); + _table->attach(_stroke, 1,2, 1,2); + _table->attach(_opacity_place, 2,3, 0,2, Gtk::SHRINK, Gtk::SHRINK); +#endif + + _swatch.add(*_table); pack_start(_swatch, true, true, 0); set_size_request (STYLE_SWATCH_WIDTH, -1); diff --git a/src/ui/widget/style-swatch.h b/src/ui/widget/style-swatch.h index 999bbd4ca..2b9c32b2e 100644 --- a/src/ui/widget/style-swatch.h +++ b/src/ui/widget/style-swatch.h @@ -13,8 +13,11 @@ #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> #include <gtkmm/label.h> #include <gtkmm/eventbox.h> #include <gtkmm/enums.h> @@ -24,9 +27,17 @@ #include "preferences.h" class SPUnit; -class SPStyle; +struct SPStyle; class SPCSSAttr; +namespace Gtk { +#if WITH_GTKMM_3_0 +class Grid; +#else +class Table; +#endif +} + namespace Inkscape { namespace UI { namespace Widget { @@ -60,7 +71,13 @@ private: Glib::ustring _tool_path; Gtk::EventBox _swatch; - Gtk::Table _table; + +#if WITH_GTKMM_3_0 + Gtk::Grid *_table; +#else + Gtk::Table *_table; +#endif + Gtk::Label _label[2]; Gtk::EventBox _place[2]; Gtk::EventBox _opacity_place; diff --git a/src/vanishing-point.h b/src/vanishing-point.h index d55dc13a1..17e3a4aa9 100644 --- a/src/vanishing-point.h +++ b/src/vanishing-point.h @@ -113,7 +113,7 @@ private: Proj::Axis _axis; }; -class VPDrag; +struct VPDrag; struct less_ptr : public std::binary_function<VanishingPoint *, VanishingPoint *, bool> { bool operator()(VanishingPoint *vp1, VanishingPoint *vp2) { diff --git a/src/widgets/arc-toolbar.h b/src/widgets/arc-toolbar.h index 69d7b8a17..dba2fcd5a 100644 --- a/src/widgets/arc-toolbar.h +++ b/src/widgets/arc-toolbar.h @@ -28,7 +28,7 @@ */ #include <gtk/gtk.h> -struct SPDesktop; +class SPDesktop; void sp_arc_toolbox_prep(SPDesktop *desktop, GtkActionGroup* mainActions, GObject* holder); diff --git a/src/widgets/box3d-toolbar.h b/src/widgets/box3d-toolbar.h index 50535b8de..d80934b01 100644 --- a/src/widgets/box3d-toolbar.h +++ b/src/widgets/box3d-toolbar.h @@ -28,7 +28,7 @@ */ #include <gtk/gtk.h> -struct SPDesktop; +class SPDesktop; void box3d_toolbox_prep(SPDesktop *desktop, GtkActionGroup* mainActions, GObject* holder); diff --git a/src/widgets/calligraphy-toolbar.h b/src/widgets/calligraphy-toolbar.h index 5b2e3c5d4..9650e03b1 100644 --- a/src/widgets/calligraphy-toolbar.h +++ b/src/widgets/calligraphy-toolbar.h @@ -28,7 +28,7 @@ */ #include <gtk/gtk.h> -struct SPDesktop; +class SPDesktop; void sp_calligraphy_toolbox_prep(SPDesktop *desktop, GtkActionGroup* mainActions, GObject* holder); void update_presets_list(GObject *tbl); diff --git a/src/widgets/connector-toolbar.h b/src/widgets/connector-toolbar.h index 6e69cf047..2ab26e56c 100644 --- a/src/widgets/connector-toolbar.h +++ b/src/widgets/connector-toolbar.h @@ -28,7 +28,7 @@ */ #include <gtk/gtk.h> -struct SPDesktop; +class SPDesktop; void sp_connector_toolbox_prep(SPDesktop *desktop, GtkActionGroup* mainActions, GObject* holder); diff --git a/src/widgets/desktop-widget.h b/src/widgets/desktop-widget.h index 0ffedd112..9188838b3 100644 --- a/src/widgets/desktop-widget.h +++ b/src/widgets/desktop-widget.h @@ -25,7 +25,7 @@ typedef struct _EgeColorProfTracker EgeColorProfTracker; struct SPCanvas; class SPDesktop; -class SPDesktopWidget; +struct SPDesktopWidget; class SPObject; diff --git a/src/widgets/dropper-toolbar.h b/src/widgets/dropper-toolbar.h index eee50ae5c..aa2116daf 100644 --- a/src/widgets/dropper-toolbar.h +++ b/src/widgets/dropper-toolbar.h @@ -28,7 +28,7 @@ */ #include <gtk/gtk.h> -struct SPDesktop; +class SPDesktop; void sp_dropper_toolbox_prep(SPDesktop *desktop, GtkActionGroup* mainActions, GObject* holder); diff --git a/src/widgets/erasor-toolbar.h b/src/widgets/erasor-toolbar.h index f00ceebe4..b1bb3a3fa 100644 --- a/src/widgets/erasor-toolbar.h +++ b/src/widgets/erasor-toolbar.h @@ -28,7 +28,7 @@ */ #include <gtk/gtk.h> -struct SPDesktop; +class SPDesktop; void sp_eraser_toolbox_prep(SPDesktop *desktop, GtkActionGroup* mainActions, GObject* holder); diff --git a/src/widgets/gradient-toolbar.h b/src/widgets/gradient-toolbar.h index 980a41a83..74cfb2886 100644 --- a/src/widgets/gradient-toolbar.h +++ b/src/widgets/gradient-toolbar.h @@ -13,7 +13,7 @@ */ #include <gtk/gtk.h> -struct SPDesktop; +class SPDesktop; void sp_gradient_toolbox_prep(SPDesktop * /*desktop*/, GtkActionGroup* mainActions, GObject* holder); diff --git a/src/widgets/lpe-toolbar.h b/src/widgets/lpe-toolbar.h index 837ef4c1e..1796f8027 100644 --- a/src/widgets/lpe-toolbar.h +++ b/src/widgets/lpe-toolbar.h @@ -28,7 +28,7 @@ */ #include <gtk/gtk.h> -struct SPDesktop; +class SPDesktop; void sp_lpetool_toolbox_prep(SPDesktop *desktop, GtkActionGroup* mainActions, GObject* holder); diff --git a/src/widgets/measure-toolbar.h b/src/widgets/measure-toolbar.h index 7ec6cd6c3..4b90ccb9f 100644 --- a/src/widgets/measure-toolbar.h +++ b/src/widgets/measure-toolbar.h @@ -28,7 +28,7 @@ */ #include <gtk/gtk.h> -struct SPDesktop; +class SPDesktop; void sp_measure_toolbox_prep(SPDesktop *desktop, GtkActionGroup* mainActions, GObject* holder); diff --git a/src/widgets/mesh-toolbar.h b/src/widgets/mesh-toolbar.h index 277525804..f84cff59b 100644 --- a/src/widgets/mesh-toolbar.h +++ b/src/widgets/mesh-toolbar.h @@ -15,7 +15,7 @@ */ #include <gtk/gtk.h> -struct SPDesktop; +class SPDesktop; void sp_mesh_toolbox_prep( SPDesktop * /*desktop*/, GtkActionGroup* mainActions, GObject* holder); diff --git a/src/widgets/node-toolbar.h b/src/widgets/node-toolbar.h index ac57a0f80..dcccf1712 100644 --- a/src/widgets/node-toolbar.h +++ b/src/widgets/node-toolbar.h @@ -28,7 +28,7 @@ */ #include <gtk/gtk.h> -struct SPDesktop; +class SPDesktop; void sp_node_toolbox_prep(SPDesktop *desktop, GtkActionGroup* mainActions, GObject* holder); diff --git a/src/widgets/paint-selector.h b/src/widgets/paint-selector.h index d6ad3f50c..d3b3f4116 100644 --- a/src/widgets/paint-selector.h +++ b/src/widgets/paint-selector.h @@ -23,7 +23,7 @@ class SPGradient; class SPDesktop; class SPPattern; -class SPStyle; +struct SPStyle; #define SP_TYPE_PAINT_SELECTOR (sp_paint_selector_get_type ()) #define SP_PAINT_SELECTOR(o) (G_TYPE_CHECK_INSTANCE_CAST ((o), SP_TYPE_PAINT_SELECTOR, SPPaintSelector)) diff --git a/src/widgets/paintbucket-toolbar.h b/src/widgets/paintbucket-toolbar.h index f49861e1f..fe25c7fe2 100644 --- a/src/widgets/paintbucket-toolbar.h +++ b/src/widgets/paintbucket-toolbar.h @@ -28,7 +28,7 @@ */ #include <gtk/gtk.h> -struct SPDesktop; +class SPDesktop; void sp_paintbucket_toolbox_prep(SPDesktop *desktop, GtkActionGroup* mainActions, GObject* holder); diff --git a/src/widgets/pencil-toolbar.h b/src/widgets/pencil-toolbar.h index 89269d668..14f1e8930 100644 --- a/src/widgets/pencil-toolbar.h +++ b/src/widgets/pencil-toolbar.h @@ -28,7 +28,7 @@ */ #include <gtk/gtk.h> -struct SPDesktop; +class SPDesktop; void sp_pencil_toolbox_prep(SPDesktop *desktop, GtkActionGroup* mainActions, GObject* holder); void sp_pen_toolbox_prep(SPDesktop * /*desktop*/, GtkActionGroup* mainActions, GObject* holder); diff --git a/src/widgets/rect-toolbar.h b/src/widgets/rect-toolbar.h index 2f22d7e27..e123c095b 100644 --- a/src/widgets/rect-toolbar.h +++ b/src/widgets/rect-toolbar.h @@ -28,7 +28,7 @@ */ #include <gtk/gtk.h> -struct SPDesktop; +class SPDesktop; void sp_rect_toolbox_prep(SPDesktop *desktop, GtkActionGroup* mainActions, GObject* holder); diff --git a/src/widgets/sp-attribute-widget.cpp b/src/widgets/sp-attribute-widget.cpp index a1702a864..1f0fcd94e 100644 --- a/src/widgets/sp-attribute-widget.cpp +++ b/src/widgets/sp-attribute-widget.cpp @@ -12,9 +12,18 @@ * Released under GNU GPL, read the file 'COPYING' for more information */ +#include "sp-attribute-widget.h" + #include <glibmm/i18n.h> #include <gtkmm/entry.h> #include <gtkmm/label.h> + +#if WITH_GTKMM_3_0 +# include <gtkmm/grid.h> +#else +# include <gtkmm/table.h> +#endif + #include <sigc++/functors/ptr_fun.h> #include <sigc++/adaptors/bind.h> @@ -24,7 +33,6 @@ #include "document.h" #include "document-undo.h" #include "verbs.h" -#include "sp-attribute-widget.h" using Inkscape::DocumentUndo; @@ -150,11 +158,14 @@ void SPAttributeTable::set_object(SPObject *object, release_connection = object->connectRelease (sigc::bind<1>(sigc::ptr_fun(&sp_attribute_table_object_release), this)); // Create table - table = new Gtk::Table (attributes.size(), 2, false); +#if WITH_GTKMM_3_0 + table = new Gtk::Grid(); +#else + table = new Gtk::Table(attributes.size(), 2, false); +#endif + if (!(parent == NULL)) - { - gtk_container_add (GTK_CONTAINER (parent),(GtkWidget*)table->gobj()); - } + gtk_container_add(GTK_CONTAINER(parent), (GtkWidget*)table->gobj()); // Fill rows _attributes = attributes; @@ -162,18 +173,41 @@ void SPAttributeTable::set_object(SPObject *object, Gtk::Label *ll = new Gtk::Label (_(labels[i].c_str())); ll->show(); ll->set_alignment (1.0, 0.5); + +#if WITH_GTKMM_3_0 + ll->set_vexpand(); + ll->set_margin_left(XPAD); + ll->set_margin_right(XPAD); + ll->set_margin_top(XPAD); + ll->set_margin_bottom(XPAD); + table->attach(*ll, 0, i, 1, 1); +#else table->attach (*ll, 0, 1, i, i + 1, Gtk::FILL, (Gtk::EXPAND | Gtk::FILL), XPAD, YPAD ); +#endif + Gtk::Entry *ee = new Gtk::Entry(); ee->show(); const gchar *val = object->getRepr()->attribute(attributes[i].c_str()); ee->set_text (val ? val : (const gchar *) ""); + +#if WITH_GTKMM_3_0 + ee->set_hexpand(); + ee->set_vexpand(); + ee->set_margin_left(XPAD); + ee->set_margin_right(XPAD); + ee->set_margin_top(XPAD); + ee->set_margin_bottom(XPAD); + table->attach(*ee, 1, i, 1, 1); +#else table->attach (*ee, 1, 2, i, i + 1, (Gtk::EXPAND | Gtk::FILL), (Gtk::EXPAND | Gtk::FILL), XPAD, YPAD ); +#endif + _entries.push_back(ee); g_signal_connect ( ee->gobj(), "changed", G_CALLBACK (sp_attribute_table_entry_changed), diff --git a/src/widgets/sp-attribute-widget.h b/src/widgets/sp-attribute-widget.h index fb8a74632..d9b972201 100644 --- a/src/widgets/sp-attribute-widget.h +++ b/src/widgets/sp-attribute-widget.h @@ -15,13 +15,22 @@ #ifndef SEEN_DIALOGS_SP_ATTRIBUTE_WIDGET_H #define SEEN_DIALOGS_SP_ATTRIBUTE_WIDGET_H -#include <gtkmm/table.h> +#if HAVE_CONFIG_H +# include "config.h" +#endif + #include <gtkmm/widget.h> #include <stddef.h> #include <sigc++/connection.h> namespace Gtk { class Entry; + +#if WITH_GTKMM_3_0 +class Grid; +#else +class Table; +#endif } namespace Inkscape { @@ -126,12 +135,16 @@ public: bool blocked; private: - /** + /** * Container widget for the dynamically created child widgets (labels and entry boxes). */ +#if WITH_GTKMM_3_0 + Gtk::Grid *table; +#else Gtk::Table *table; +#endif - /** + /** * List of attributes. * * _attributes stores the attribute names of the selected object that diff --git a/src/widgets/sp-widget.h b/src/widgets/sp-widget.h index d2177f486..3a23a92c5 100644 --- a/src/widgets/sp-widget.h +++ b/src/widgets/sp-widget.h @@ -27,7 +27,7 @@ namespace Inkscape { -class Application; +struct Application; class Selection; class SPWidgetImpl; diff --git a/src/widgets/spiral-toolbar.h b/src/widgets/spiral-toolbar.h index 3e4d7b46f..194b54bce 100644 --- a/src/widgets/spiral-toolbar.h +++ b/src/widgets/spiral-toolbar.h @@ -28,7 +28,7 @@ */ #include <gtk/gtk.h> -struct SPDesktop; +class SPDesktop; void sp_spiral_toolbox_prep(SPDesktop *desktop, GtkActionGroup* mainActions, GObject* holder); diff --git a/src/widgets/spray-toolbar.h b/src/widgets/spray-toolbar.h index 8ac0ec9af..170b6bb8e 100644 --- a/src/widgets/spray-toolbar.h +++ b/src/widgets/spray-toolbar.h @@ -28,7 +28,7 @@ */ #include <gtk/gtk.h> -struct SPDesktop; +class SPDesktop; void sp_spray_toolbox_prep(SPDesktop *desktop, GtkActionGroup* mainActions, GObject* holder); diff --git a/src/widgets/star-toolbar.h b/src/widgets/star-toolbar.h index 793f73f8b..6f91d5570 100644 --- a/src/widgets/star-toolbar.h +++ b/src/widgets/star-toolbar.h @@ -28,7 +28,7 @@ */ #include <gtk/gtk.h> -struct SPDesktop; +class SPDesktop; void sp_star_toolbox_prep(SPDesktop *desktop, GtkActionGroup* mainActions, GObject* holder); diff --git a/src/widgets/text-toolbar.h b/src/widgets/text-toolbar.h index 34109c022..68158d201 100644 --- a/src/widgets/text-toolbar.h +++ b/src/widgets/text-toolbar.h @@ -28,7 +28,7 @@ */ #include <gtk/gtk.h> -struct SPDesktop; +class SPDesktop; void sp_text_toolbox_prep(SPDesktop *desktop, GtkActionGroup* mainActions, GObject* holder); diff --git a/src/widgets/toolbox.h b/src/widgets/toolbox.h index d520d393d..9c839a8fe 100644 --- a/src/widgets/toolbox.h +++ b/src/widgets/toolbox.h @@ -23,7 +23,7 @@ #define TOOLBAR_SLIDER_HINT "full" class SPDesktop; -class SPEventContext; +struct SPEventContext; namespace Inkscape { namespace UI { diff --git a/src/widgets/tweak-toolbar.h b/src/widgets/tweak-toolbar.h index 64608de70..6f840f2c1 100644 --- a/src/widgets/tweak-toolbar.h +++ b/src/widgets/tweak-toolbar.h @@ -28,7 +28,7 @@ */ #include <gtk/gtk.h> -struct SPDesktop; +class SPDesktop; void sp_tweak_toolbox_prep(SPDesktop *desktop, GtkActionGroup* mainActions, GObject* holder); diff --git a/src/widgets/zoom-toolbar.h b/src/widgets/zoom-toolbar.h index 9f1af4e5e..b8d6a42af 100644 --- a/src/widgets/zoom-toolbar.h +++ b/src/widgets/zoom-toolbar.h @@ -28,7 +28,7 @@ */ #include <gtk/gtk.h> -struct SPDesktop; +class SPDesktop; void sp_zoom_toolbox_prep(SPDesktop *desktop, GtkActionGroup* mainActions, GObject* holder); diff --git a/src/xml/event-fns.h b/src/xml/event-fns.h index 65c65c48c..5e3b43ad8 100644 --- a/src/xml/event-fns.h +++ b/src/xml/event-fns.h @@ -4,7 +4,7 @@ namespace Inkscape { namespace XML { -class Document; +struct Document; class Event; class NodeObserver; diff --git a/src/xml/rebase-hrefs.h b/src/xml/rebase-hrefs.h index adb09e52a..5baf96516 100644 --- a/src/xml/rebase-hrefs.h +++ b/src/xml/rebase-hrefs.h @@ -4,7 +4,7 @@ #include <glib.h> #include "util/list.h" #include "xml/attribute-record.h" -struct SPDocument; +class SPDocument; namespace Inkscape { namespace XML { |
