From: johanengelen Date: Thu, 29 Nov 2007 22:42:44 +0000 (+0000) Subject: show gridtype name in document properties X-Git-Url: https://git.tokkee.org/?a=commitdiff_plain;h=96fa6baaa98f98273b869f3ed812f0756fa34815;p=inkscape.git show gridtype name in document properties --- diff --git a/src/display/canvas-axonomgrid.cpp b/src/display/canvas-axonomgrid.cpp index cb83900bb..654dcf903 100644 --- a/src/display/canvas-axonomgrid.cpp +++ b/src/display/canvas-axonomgrid.cpp @@ -191,7 +191,7 @@ attach_all(Gtk::Table &table, Gtk::Widget const *const arr[], unsigned size, int } CanvasAxonomGrid::CanvasAxonomGrid (SPNamedView * nv, Inkscape::XML::Node * in_repr, SPDocument * in_doc) - : CanvasGrid(nv, in_repr, in_doc), table(1, 1) + : CanvasGrid(nv, in_repr, in_doc, GRID_AXONOMETRIC), table(1, 1) { origin[NR::X] = origin[NR::Y] = 0.0; color = 0xff3f3f20; diff --git a/src/display/canvas-grid.cpp b/src/display/canvas-grid.cpp index b58a53297..92e0c5096 100644 --- a/src/display/canvas-grid.cpp +++ b/src/display/canvas-grid.cpp @@ -150,7 +150,8 @@ grid_canvasitem_update (SPCanvasItem *item, NR::Matrix const &affine, unsigned i NULL /* order_changed */ }; -CanvasGrid::CanvasGrid(SPNamedView * nv, Inkscape::XML::Node * in_repr, SPDocument *in_doc) +CanvasGrid::CanvasGrid(SPNamedView * nv, Inkscape::XML::Node * in_repr, SPDocument *in_doc, GridType type) + : namelabel("", Gtk::ALIGN_LEFT), gridtype(type) { repr = in_repr; doc = in_doc; @@ -160,6 +161,12 @@ CanvasGrid::CanvasGrid(SPNamedView * nv, Inkscape::XML::Node * in_repr, SPDocume namedview = nv; canvasitems = NULL; + + Glib::ustring str(""); + str += getName(); + str += ""; + namelabel.set_markup(str); + vbox.pack_start(namelabel,true,true); } CanvasGrid::~CanvasGrid() @@ -174,6 +181,23 @@ CanvasGrid::~CanvasGrid() } } +const char * +CanvasGrid::getName() +{ + return _(grid_name[gridtype]); +} + +const char * +CanvasGrid::getSVGName() +{ + return grid_svgname[gridtype]; +} + +GridType +CanvasGrid::getGridType() +{ + return gridtype; +} char const * @@ -342,7 +366,7 @@ attach_all(Gtk::Table &table, Gtk::Widget const *const arr[], unsigned size, int } CanvasXYGrid::CanvasXYGrid (SPNamedView * nv, Inkscape::XML::Node * in_repr, SPDocument * in_doc) - : CanvasGrid(nv, in_repr, in_doc), table(1, 1) + : CanvasGrid(nv, in_repr, in_doc, GRID_RECTANGULAR), table(1, 1) { origin[NR::X] = origin[NR::Y] = 0.0; color = DEFAULTGRIDCOLOR; diff --git a/src/display/canvas-grid.h b/src/display/canvas-grid.h index 3c19d39d8..f05d3b5cb 100644 --- a/src/display/canvas-grid.h +++ b/src/display/canvas-grid.h @@ -6,7 +6,7 @@ * * Generic (and quite unintelligent) grid item for gnome canvas * - * Copyright (C) Johan Engelen 2006 + * Copyright (C) Johan Engelen 2006-2007 * Copyright (C) Lauris Kaplinski 2000 * */ @@ -67,9 +67,12 @@ GtkType grid_canvasitem_get_type (void); class CanvasGrid { public: - CanvasGrid(SPNamedView * nv, Inkscape::XML::Node * in_repr, SPDocument *in_doc); virtual ~CanvasGrid(); + // TODO: see effect.h and effect.cpp from live_effects how to link enums to SVGname to typename properly. (johan) + const char * getName(); + const char * getSVGName(); + GridType getGridType(); static const char * getName(GridType type); static const char * getSVGName(GridType type); static GridType getGridTypeFromSVGName(const char * typestr); @@ -96,16 +99,20 @@ public: static void on_repr_attr_changed (Inkscape::XML::Node * repr, const gchar *key, const gchar *oldval, const gchar *newval, bool is_interactive, void * data); protected: + CanvasGrid(SPNamedView * nv, Inkscape::XML::Node * in_repr, SPDocument *in_doc, GridType type); + GSList * canvasitems; // list of created canvasitems SPNamedView * namedview; Gtk::VBox vbox; + Gtk::Label namelabel; + + GridType gridtype; private: CanvasGrid(const CanvasGrid&); CanvasGrid& operator=(const CanvasGrid&); - };