summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorJohan B. C. Engelen <jbc.engelen@swissonline.ch>2007-11-29 22:42:44 +0000
committerjohanengelen <johanengelen@users.sourceforge.net>2007-11-29 22:42:44 +0000
commite3795e5386883dc41203d7d8aa23a9ac7daeba71 (patch)
tree7aa0ba8641f5e3e08a545e0bd8de0fe868a7c66d /src
parentAdding icon for color management (diff)
downloadinkscape-e3795e5386883dc41203d7d8aa23a9ac7daeba71.tar.gz
inkscape-e3795e5386883dc41203d7d8aa23a9ac7daeba71.zip
show gridtype name in document properties
(bzr r4145)
Diffstat (limited to 'src')
-rw-r--r--src/display/canvas-axonomgrid.cpp2
-rw-r--r--src/display/canvas-grid.cpp28
-rw-r--r--src/display/canvas-grid.h13
3 files changed, 37 insertions, 6 deletions
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("<b>");
+ str += getName();
+ str += "</b>";
+ 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 <johan@shouraizou.nl>
+ * Copyright (C) Johan Engelen 2006-2007 <johan@shouraizou.nl>
* 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&);
-
};