summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: 3784fb0)
raw | patch | inline | side by side (parent: 3784fb0)
author | joncruz <joncruz@users.sourceforge.net> | |
Sat, 22 Mar 2008 18:29:40 +0000 (18:29 +0000) | ||
committer | joncruz <joncruz@users.sourceforge.net> | |
Sat, 22 Mar 2008 18:29:40 +0000 (18:29 +0000) |
diff --git a/src/display/canvas-temporary-item-list.cpp b/src/display/canvas-temporary-item-list.cpp
index 54e81a1f0fb0dd83543e990ec8d795c53bd18049..c324a5ddf0138bee9860991bcd0ac79e594b6320 100644 (file)
-/** \file\r
- * Provides a class that can contain active TemporaryItem's on a desktop\r
- * Code inspired by message-stack.cpp\r
- *\r
- * Authors:\r
- * Johan Engelen\r
- *\r
- * Copyright (C) Johan Engelen 2008 <j.b.c.engelen@utwente.nl>\r
- *\r
- * Released under GNU GPL, read the file 'COPYING' for more information\r
- */\r
-\r
-#include "display/canvas-temporary-item-list.h"\r
-\r
-#include "display/canvas-temporary-item.h"\r
-\r
-namespace Inkscape {\r
-namespace Display {\r
-\r
-TemporaryItemList::TemporaryItemList(SPDesktop *desktop)\r
- : desktop(desktop)\r
-{\r
-\r
-}\r
-\r
-TemporaryItemList::~TemporaryItemList()\r
-{\r
- // delete all items in list so the timeouts are removed\r
- for ( std::list<TemporaryItem*>::iterator it = itemlist.begin(); it != itemlist.end(); ++it ) {\r
- TemporaryItem * tempitem = *it;\r
- delete tempitem;\r
- }\r
- itemlist.clear();\r
-}\r
-\r
-/* Note that TemporaryItem or TemporaryItemList is responsible for deletion and such, so this return pointer can safely be ignored. */\r
-TemporaryItem *\r
-TemporaryItemList::add_item(SPCanvasItem *item, guint lifetime)\r
-{\r
- // beware of strange things happening due to very short timeouts\r
- TemporaryItem * tempitem = new TemporaryItem(item, lifetime);\r
- itemlist.push_back(tempitem);\r
- tempitem->signal_timeout.connect( sigc::mem_fun(*this, &TemporaryItemList::_item_timeout) );\r
- return tempitem;\r
-}\r
-\r
-void\r
-TemporaryItemList::delete_item( TemporaryItem * tempitem )\r
-{\r
- // check if the item is in the list, if so, delete it. (in other words, don't wait for the item to delete itself)\r
- bool in_list = false;\r
- for ( std::list<TemporaryItem*>::iterator it = itemlist.begin(); it != itemlist.end(); ++it ) {\r
- if ( *it == tempitem ) {\r
- in_list = true;\r
- break;\r
- }\r
- }\r
- if (in_list) {\r
- itemlist.remove(tempitem);\r
- delete tempitem;\r
- }\r
-}\r
-\r
-void\r
-TemporaryItemList::_item_timeout(TemporaryItem * tempitem)\r
-{\r
- itemlist.remove(tempitem);\r
- // no need to delete the item, it does that itself after signal_timeout.emit() completes\r
-}\r
-\r
-} //namespace Display\r
-} /* namespace Inkscape */\r
-\r
-/*\r
- Local Variables:\r
- mode:c++\r
- c-file-style:"stroustrup"\r
- c-file-offsets:((innamespace . 0)(inline-open . 0)(case-label . +))\r
- indent-tabs-mode:nil\r
- fill-column:99\r
- End:\r
-*/\r
-// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4 :\r
+/** \file
+ * Provides a class that can contain active TemporaryItem's on a desktop
+ * Code inspired by message-stack.cpp
+ *
+ * Authors:
+ * Johan Engelen
+ *
+ * Copyright (C) Johan Engelen 2008 <j.b.c.engelen@utwente.nl>
+ *
+ * Released under GNU GPL, read the file 'COPYING' for more information
+ */
+
+#include "display/canvas-temporary-item-list.h"
+
+#include "display/canvas-temporary-item.h"
+
+namespace Inkscape {
+namespace Display {
+
+TemporaryItemList::TemporaryItemList(SPDesktop *desktop)
+ : desktop(desktop)
+{
+
+}
+
+TemporaryItemList::~TemporaryItemList()
+{
+ // delete all items in list so the timeouts are removed
+ for ( std::list<TemporaryItem*>::iterator it = itemlist.begin(); it != itemlist.end(); ++it ) {
+ TemporaryItem * tempitem = *it;
+ delete tempitem;
+ }
+ itemlist.clear();
+}
+
+/* Note that TemporaryItem or TemporaryItemList is responsible for deletion and such, so this return pointer can safely be ignored. */
+TemporaryItem *
+TemporaryItemList::add_item(SPCanvasItem *item, guint lifetime)
+{
+ // beware of strange things happening due to very short timeouts
+ TemporaryItem * tempitem = new TemporaryItem(item, lifetime);
+ itemlist.push_back(tempitem);
+ tempitem->signal_timeout.connect( sigc::mem_fun(*this, &TemporaryItemList::_item_timeout) );
+ return tempitem;
+}
+
+void
+TemporaryItemList::delete_item( TemporaryItem * tempitem )
+{
+ // check if the item is in the list, if so, delete it. (in other words, don't wait for the item to delete itself)
+ bool in_list = false;
+ for ( std::list<TemporaryItem*>::iterator it = itemlist.begin(); it != itemlist.end(); ++it ) {
+ if ( *it == tempitem ) {
+ in_list = true;
+ break;
+ }
+ }
+ if (in_list) {
+ itemlist.remove(tempitem);
+ delete tempitem;
+ }
+}
+
+void
+TemporaryItemList::_item_timeout(TemporaryItem * tempitem)
+{
+ itemlist.remove(tempitem);
+ // no need to delete the item, it does that itself after signal_timeout.emit() completes
+}
+
+} //namespace Display
+} /* namespace Inkscape */
+
+/*
+ Local Variables:
+ mode:c++
+ c-file-style:"stroustrup"
+ c-file-offsets:((innamespace . 0)(inline-open . 0)(case-label . +))
+ indent-tabs-mode:nil
+ fill-column:99
+ End:
+*/
+// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4 :
index cd4bcfe995ff04d9f28fea2b17125b194588868f..4d712e2163bc94d176e63c02096db8a16efae2fb 100644 (file)
-#ifndef INKSCAPE_CANVAS_TEMPORARY_ITEM_LIST_H\r
-#define INKSCAPE_CANVAS_TEMPORARY_ITEM_LIST_H\r
-\r
-/** \file\r
- * Provides a class that can contain active TemporaryItem's on a desktop\r
- *\r
- * Authors:\r
- * Johan Engelen\r
- *\r
- * Copyright (C) Johan Engelen 2008 <j.b.c.engelen@utwente.nl>\r
- *\r
- * Released under GNU GPL, read the file 'COPYING' for more information\r
- */\r
-\r
-#include "forward.h"\r
-#include "display/display-forward.h"\r
-#include <list>\r
-\r
-namespace Inkscape {\r
-namespace Display {\r
-\r
-class TemporaryItem;\r
-\r
-class TemporaryItemList {\r
-public:\r
- TemporaryItemList(SPDesktop *desktop);\r
- virtual ~TemporaryItemList();\r
-\r
- TemporaryItem* add_item (SPCanvasItem *item, guint lifetime);\r
- void delete_item (TemporaryItem * tempitem);\r
-\r
-protected:\r
- SPDesktop *desktop; /** Desktop we are on. */\r
-\r
- std::list<TemporaryItem *> itemlist; /** list of temp items */ \r
-\r
- void _item_timeout (TemporaryItem * tempitem);\r
-\r
-private:\r
- TemporaryItemList(const TemporaryItemList&);\r
- TemporaryItemList& operator=(const TemporaryItemList&);\r
-};\r
-\r
-} //namespace Display\r
-} //namespace Inkscape\r
-\r
-#endif\r
-\r
-/*\r
- Local Variables:\r
- mode:c++\r
- c-file-style:"stroustrup"\r
- c-file-offsets:((innamespace . 0)(inline-open . 0)(case-label . +))\r
- indent-tabs-mode:nil\r
- fill-column:99\r
- End:\r
-*/\r
-// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4 :\r
+#ifndef INKSCAPE_CANVAS_TEMPORARY_ITEM_LIST_H
+#define INKSCAPE_CANVAS_TEMPORARY_ITEM_LIST_H
+
+/** \file
+ * Provides a class that can contain active TemporaryItem's on a desktop
+ *
+ * Authors:
+ * Johan Engelen
+ *
+ * Copyright (C) Johan Engelen 2008 <j.b.c.engelen@utwente.nl>
+ *
+ * Released under GNU GPL, read the file 'COPYING' for more information
+ */
+
+#include "forward.h"
+#include "display/display-forward.h"
+#include <list>
+
+namespace Inkscape {
+namespace Display {
+
+class TemporaryItem;
+
+class TemporaryItemList {
+public:
+ TemporaryItemList(SPDesktop *desktop);
+ virtual ~TemporaryItemList();
+
+ TemporaryItem* add_item (SPCanvasItem *item, guint lifetime);
+ void delete_item (TemporaryItem * tempitem);
+
+protected:
+ SPDesktop *desktop; /** Desktop we are on. */
+
+ std::list<TemporaryItem *> itemlist; /** list of temp items */
+
+ void _item_timeout (TemporaryItem * tempitem);
+
+private:
+ TemporaryItemList(const TemporaryItemList&);
+ TemporaryItemList& operator=(const TemporaryItemList&);
+};
+
+} //namespace Display
+} //namespace Inkscape
+
+#endif
+
+/*
+ Local Variables:
+ mode:c++
+ c-file-style:"stroustrup"
+ c-file-offsets:((innamespace . 0)(inline-open . 0)(case-label . +))
+ indent-tabs-mode:nil
+ fill-column:99
+ End:
+*/
+// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4 :
index 7d7f8087c04e8ef45b901fb6dbf1eb0e5dbb664a..d31323b72a190f7c43cdc8207f865dc64178ca91 100644 (file)
-/** \file\r
- * Provides a class that can contain active TemporaryItem's on a desktop\r
- * When the object is deleted, it also deletes the canvasitem it contains!\r
- * This object should be created/managed by a TemporaryItemList.\r
- * After its lifetime, it fires the timeout signal, afterwards *it deletes itself*.\r
- *\r
- * (part of code inspired by message-stack.cpp)\r
- *\r
- * Authors:\r
- * Johan Engelen\r
- *\r
- * Copyright (C) Johan Engelen 2008 <j.b.c.engelen@utwente.nl>\r
- *\r
- * Released under GNU GPL, read the file 'COPYING' for more information\r
- */\r
-\r
-#include "display/canvas-temporary-item.h"\r
-\r
-#include <gtk/gtkobject.h>\r
-\r
-namespace Inkscape {\r
-namespace Display {\r
-\r
-/** lifetime is measured in milliseconds\r
- */\r
-TemporaryItem::TemporaryItem(SPCanvasItem *item, guint lifetime)\r
- : canvasitem(item),\r
- timeout_id(0)\r
-{\r
- // zero lifetime means stay forever, so do not add timeout event.\r
- if (lifetime > 0) {\r
- timeout_id = g_timeout_add(lifetime, &TemporaryItem::_timeout, this);\r
- }\r
-}\r
-\r
-TemporaryItem::~TemporaryItem()\r
-{\r
- // when it has not expired yet...\r
- if (timeout_id) {\r
- g_source_remove(timeout_id);\r
- timeout_id = 0;\r
- }\r
-\r
- if (canvasitem) {\r
- // destroying the item automatically hides it\r
- gtk_object_destroy (GTK_OBJECT (canvasitem));\r
- canvasitem = NULL;\r
- }\r
-}\r
-\r
-/* static method*/\r
-gboolean TemporaryItem::_timeout(gpointer data) {\r
- TemporaryItem *tempitem = reinterpret_cast<TemporaryItem *>(data);\r
- tempitem->timeout_id = 0;\r
- tempitem->signal_timeout.emit(tempitem);\r
- delete tempitem;\r
- return FALSE;\r
-}\r
-\r
-\r
-} //namespace Display\r
-} /* namespace Inkscape */\r
-\r
-/*\r
- Local Variables:\r
- mode:c++\r
- c-file-style:"stroustrup"\r
- c-file-offsets:((innamespace . 0)(inline-open . 0)(case-label . +))\r
- indent-tabs-mode:nil\r
- fill-column:99\r
- End:\r
-*/\r
-// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4 :\r
+/** \file
+ * Provides a class that can contain active TemporaryItem's on a desktop
+ * When the object is deleted, it also deletes the canvasitem it contains!
+ * This object should be created/managed by a TemporaryItemList.
+ * After its lifetime, it fires the timeout signal, afterwards *it deletes itself*.
+ *
+ * (part of code inspired by message-stack.cpp)
+ *
+ * Authors:
+ * Johan Engelen
+ *
+ * Copyright (C) Johan Engelen 2008 <j.b.c.engelen@utwente.nl>
+ *
+ * Released under GNU GPL, read the file 'COPYING' for more information
+ */
+
+#include "display/canvas-temporary-item.h"
+
+#include <gtk/gtkobject.h>
+
+namespace Inkscape {
+namespace Display {
+
+/** lifetime is measured in milliseconds
+ */
+TemporaryItem::TemporaryItem(SPCanvasItem *item, guint lifetime)
+ : canvasitem(item),
+ timeout_id(0)
+{
+ // zero lifetime means stay forever, so do not add timeout event.
+ if (lifetime > 0) {
+ timeout_id = g_timeout_add(lifetime, &TemporaryItem::_timeout, this);
+ }
+}
+
+TemporaryItem::~TemporaryItem()
+{
+ // when it has not expired yet...
+ if (timeout_id) {
+ g_source_remove(timeout_id);
+ timeout_id = 0;
+ }
+
+ if (canvasitem) {
+ // destroying the item automatically hides it
+ gtk_object_destroy (GTK_OBJECT (canvasitem));
+ canvasitem = NULL;
+ }
+}
+
+/* static method*/
+gboolean TemporaryItem::_timeout(gpointer data) {
+ TemporaryItem *tempitem = reinterpret_cast<TemporaryItem *>(data);
+ tempitem->timeout_id = 0;
+ tempitem->signal_timeout.emit(tempitem);
+ delete tempitem;
+ return FALSE;
+}
+
+
+} //namespace Display
+} /* namespace Inkscape */
+
+/*
+ Local Variables:
+ mode:c++
+ c-file-style:"stroustrup"
+ c-file-offsets:((innamespace . 0)(inline-open . 0)(case-label . +))
+ indent-tabs-mode:nil
+ fill-column:99
+ End:
+*/
+// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4 :
index 0caa0d94307008d0ac5538a43c2d5bdecc6006a4..ec1e3b999ae85adcd1407f880cb019f01789b252 100644 (file)
-#ifndef INKSCAPE_CANVAS_TEMPORARY_ITEM_H\r
-#define INKSCAPE_CANVAS_TEMPORARY_ITEM_H\r
-\r
-/** \file\r
- * Provides a class to put a canvasitem temporarily on-canvas.\r
- *\r
- * Authors:\r
- * Johan Engelen\r
- *\r
- * Copyright (C) Johan Engelen 2008 <j.b.c.engelen@utwente.nl>\r
- *\r
- * Released under GNU GPL, read the file 'COPYING' for more information\r
- */\r
-\r
-#include "display/display-forward.h"\r
-\r
-#include <sigc++/sigc++.h>\r
-\r
-namespace Inkscape {\r
-namespace Display {\r
-\r
-class TemporaryItem {\r
-public:\r
- TemporaryItem(SPCanvasItem *item, guint lifetime);\r
- virtual ~TemporaryItem();\r
-\r
- sigc::signal<void, TemporaryItem *> signal_timeout;\r
-\r
-protected:\r
- friend class TemporaryItemList;\r
-\r
- SPCanvasItem * canvasitem; /** The item we are holding on to */\r
- guint timeout_id; /** ID by which glib knows the timeout event */\r
-\r
- static gboolean _timeout(gpointer data); ///< callback for when lifetime expired\r
-\r
-private:\r
- TemporaryItem(const TemporaryItem&);\r
- TemporaryItem& operator=(const TemporaryItem&);\r
-};\r
-\r
-} //namespace Display\r
-} //namespace Inkscape\r
-\r
-#endif\r
-\r
-/*\r
- Local Variables:\r
- mode:c++\r
- c-file-style:"stroustrup"\r
- c-file-offsets:((innamespace . 0)(inline-open . 0)(case-label . +))\r
- indent-tabs-mode:nil\r
- fill-column:99\r
- End:\r
-*/\r
-// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4 :\r
+#ifndef INKSCAPE_CANVAS_TEMPORARY_ITEM_H
+#define INKSCAPE_CANVAS_TEMPORARY_ITEM_H
+
+/** \file
+ * Provides a class to put a canvasitem temporarily on-canvas.
+ *
+ * Authors:
+ * Johan Engelen
+ *
+ * Copyright (C) Johan Engelen 2008 <j.b.c.engelen@utwente.nl>
+ *
+ * Released under GNU GPL, read the file 'COPYING' for more information
+ */
+
+#include "display/display-forward.h"
+
+#include <sigc++/sigc++.h>
+
+namespace Inkscape {
+namespace Display {
+
+class TemporaryItem {
+public:
+ TemporaryItem(SPCanvasItem *item, guint lifetime);
+ virtual ~TemporaryItem();
+
+ sigc::signal<void, TemporaryItem *> signal_timeout;
+
+protected:
+ friend class TemporaryItemList;
+
+ SPCanvasItem * canvasitem; /** The item we are holding on to */
+ guint timeout_id; /** ID by which glib knows the timeout event */
+
+ static gboolean _timeout(gpointer data); ///< callback for when lifetime expired
+
+private:
+ TemporaryItem(const TemporaryItem&);
+ TemporaryItem& operator=(const TemporaryItem&);
+};
+
+} //namespace Display
+} //namespace Inkscape
+
+#endif
+
+/*
+ Local Variables:
+ mode:c++
+ c-file-style:"stroustrup"
+ c-file-offsets:((innamespace . 0)(inline-open . 0)(case-label . +))
+ indent-tabs-mode:nil
+ fill-column:99
+ End:
+*/
+// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4 :
index b6046e88c5ea504f60515c6474e4c53267b64084..f5e754d902bd452c3999c65d5249d27f10b60c51 100644 (file)
-/** \file\r
- * Provides a class that shows a temporary indicator on the canvas of where the snap was, and what kind of snap\r
- *\r
- * Authors:\r
- * Johan Engelen\r
- *\r
- * Copyright (C) Johan Engelen 2008 <j.b.c.engelen@utwente.nl>\r
- *\r
- * Released under GNU GPL, read the file 'COPYING' for more information\r
- */\r
-\r
-#include "display/snap-indicator.h"\r
-\r
-#include "desktop.h"\r
-#include "desktop-handles.h"\r
-#include "display/sodipodi-ctrl.h"\r
-#include "knot.h"\r
-\r
-namespace Inkscape {\r
-namespace Display {\r
-\r
-SnapIndicator::SnapIndicator(SPDesktop * desktop)\r
- : tempitem(NULL),\r
- desktop(desktop)\r
-{\r
-}\r
-\r
-SnapIndicator::~SnapIndicator()\r
-{\r
- // remove item that might be present\r
- remove_snappoint();\r
-}\r
-\r
-void\r
-SnapIndicator::set_new_snappoint(Geom::Point p)\r
-{\r
- remove_snappoint();\r
-\r
- bool enabled = false; // TODO add preference for snap indicator.\r
- if (enabled) {\r
- // TODO add many different kinds of snap indicator :-)\r
- SPCanvasItem * canvasitem = sp_canvas_item_new( sp_desktop_tempgroup (desktop),\r
- SP_TYPE_CTRL,\r
- "anchor", GTK_ANCHOR_CENTER,\r
- "size", 10.0,\r
- "stroked", TRUE,\r
- "stroke_color", 0xf000f0ff,\r
- "mode", SP_KNOT_MODE_XOR,\r
- "shape", SP_KNOT_SHAPE_CROSS,\r
- NULL );\r
- SP_CTRL(canvasitem)->moveto ( p );\r
- tempitem = desktop->add_temporary_canvasitem(canvasitem, 1000); // TODO add preference for snap indicator timeout\r
- }\r
-}\r
-\r
-void\r
-SnapIndicator::remove_snappoint()\r
-{\r
- if (tempitem) {\r
- desktop->remove_temporary_canvasitem(tempitem);\r
- tempitem = NULL;\r
- }\r
-}\r
-\r
-\r
-} //namespace Display\r
-} /* namespace Inkscape */\r
-\r
-/*\r
- Local Variables:\r
- mode:c++\r
- c-file-style:"stroustrup"\r
- c-file-offsets:((innamespace . 0)(inline-open . 0)(case-label . +))\r
- indent-tabs-mode:nil\r
- fill-column:99\r
- End:\r
-*/\r
-// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4 :\r
+/** \file
+ * Provides a class that shows a temporary indicator on the canvas of where the snap was, and what kind of snap
+ *
+ * Authors:
+ * Johan Engelen
+ *
+ * Copyright (C) Johan Engelen 2008 <j.b.c.engelen@utwente.nl>
+ *
+ * Released under GNU GPL, read the file 'COPYING' for more information
+ */
+
+#include "display/snap-indicator.h"
+
+#include "desktop.h"
+#include "desktop-handles.h"
+#include "display/sodipodi-ctrl.h"
+#include "knot.h"
+
+namespace Inkscape {
+namespace Display {
+
+SnapIndicator::SnapIndicator(SPDesktop * desktop)
+ : tempitem(NULL),
+ desktop(desktop)
+{
+}
+
+SnapIndicator::~SnapIndicator()
+{
+ // remove item that might be present
+ remove_snappoint();
+}
+
+void
+SnapIndicator::set_new_snappoint(Geom::Point p)
+{
+ remove_snappoint();
+
+ bool enabled = false; // TODO add preference for snap indicator.
+ if (enabled) {
+ // TODO add many different kinds of snap indicator :-)
+ SPCanvasItem * canvasitem = sp_canvas_item_new( sp_desktop_tempgroup (desktop),
+ SP_TYPE_CTRL,
+ "anchor", GTK_ANCHOR_CENTER,
+ "size", 10.0,
+ "stroked", TRUE,
+ "stroke_color", 0xf000f0ff,
+ "mode", SP_KNOT_MODE_XOR,
+ "shape", SP_KNOT_SHAPE_CROSS,
+ NULL );
+ SP_CTRL(canvasitem)->moveto ( p );
+ tempitem = desktop->add_temporary_canvasitem(canvasitem, 1000); // TODO add preference for snap indicator timeout
+ }
+}
+
+void
+SnapIndicator::remove_snappoint()
+{
+ if (tempitem) {
+ desktop->remove_temporary_canvasitem(tempitem);
+ tempitem = NULL;
+ }
+}
+
+
+} //namespace Display
+} /* namespace Inkscape */
+
+/*
+ Local Variables:
+ mode:c++
+ c-file-style:"stroustrup"
+ c-file-offsets:((innamespace . 0)(inline-open . 0)(case-label . +))
+ indent-tabs-mode:nil
+ fill-column:99
+ End:
+*/
+// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4 :
index bedeb492b74f276fefbd4e8e2381ae52ab2dab9b..0395d400081da696e96021034b26d43098d88714 100644 (file)
-#ifndef INKSCAPE_DISPLAY_SNAP_INDICATOR_H\r
-#define INKSCAPE_DISPLAY_SNAP_INDICATOR_H\r
-\r
-/** \file\r
- * Provides a class that shows a temporary indicator on the canvas of where the snap was, and what kind of snap\r
- *\r
- * Authors:\r
- * Johan Engelen\r
- *\r
- * Copyright (C) Johan Engelen 2008 <j.b.c.engelen@utwente.nl>\r
- *\r
- * Released under GNU GPL, read the file 'COPYING' for more information\r
- */\r
-\r
-#include "forward.h"\r
-#include "display/display-forward.h"\r
-#include <2geom/point.h>\r
-\r
-namespace Inkscape {\r
-namespace Display {\r
-\r
-class SnapIndicator {\r
-public:\r
- SnapIndicator(SPDesktop *desktop);\r
- virtual ~SnapIndicator();\r
-\r
- void set_new_snappoint(Geom::Point p);\r
- void remove_snappoint();\r
-\r
-protected:\r
- TemporaryItem * tempitem;\r
- SPDesktop *desktop;\r
-\r
-private:\r
- SnapIndicator(const SnapIndicator&);\r
- SnapIndicator& operator=(const SnapIndicator&);\r
-};\r
-\r
-} //namespace Display\r
-} //namespace Inkscape\r
-\r
-#endif\r
-\r
-/*\r
- Local Variables:\r
- mode:c++\r
- c-file-style:"stroustrup"\r
- c-file-offsets:((innamespace . 0)(inline-open . 0)(case-label . +))\r
- indent-tabs-mode:nil\r
- fill-column:99\r
- End:\r
-*/\r
-// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4 :\r
+#ifndef INKSCAPE_DISPLAY_SNAP_INDICATOR_H
+#define INKSCAPE_DISPLAY_SNAP_INDICATOR_H
+
+/** \file
+ * Provides a class that shows a temporary indicator on the canvas of where the snap was, and what kind of snap
+ *
+ * Authors:
+ * Johan Engelen
+ *
+ * Copyright (C) Johan Engelen 2008 <j.b.c.engelen@utwente.nl>
+ *
+ * Released under GNU GPL, read the file 'COPYING' for more information
+ */
+
+#include "forward.h"
+#include "display/display-forward.h"
+#include <2geom/point.h>
+
+namespace Inkscape {
+namespace Display {
+
+class SnapIndicator {
+public:
+ SnapIndicator(SPDesktop *desktop);
+ virtual ~SnapIndicator();
+
+ void set_new_snappoint(Geom::Point p);
+ void remove_snappoint();
+
+protected:
+ TemporaryItem * tempitem;
+ SPDesktop *desktop;
+
+private:
+ SnapIndicator(const SnapIndicator&);
+ SnapIndicator& operator=(const SnapIndicator&);
+};
+
+} //namespace Display
+} //namespace Inkscape
+
+#endif
+
+/*
+ Local Variables:
+ mode:c++
+ c-file-style:"stroustrup"
+ c-file-offsets:((innamespace . 0)(inline-open . 0)(case-label . +))
+ indent-tabs-mode:nil
+ fill-column:99
+ End:
+*/
+// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4 :
diff --git a/src/live_effects/parameter/pointparam-knotholder.cpp b/src/live_effects/parameter/pointparam-knotholder.cpp
index bf8aaf97f95c56bd6ea9214064c9d081a86766f8..12d08170330f825c49b4eb5df47d8ddff6dac21e 100644 (file)
-#define INKSCAPE_LPE_POINTPARAM_KNOTHOLDER_C\r
-\r
-/*\r
- * Container for PointParamKnotHolder visual handles\r
- *\r
- * Authors:\r
- * Johan Engelen <goejendaagh@zonnet.nl>\r
- *\r
- * Copyright (C) 2008 authors\r
- *\r
- * Released under GNU GPL, read the file 'COPYING' for more information\r
- */\r
-\r
-#include "live_effects/parameter/pointparam-knotholder.h"\r
-#include "live_effects/lpeobject.h"\r
-#include "document.h"\r
-#include "sp-shape.h"\r
-#include "knot.h"\r
-#include "knotholder.h"\r
-#include "knot-holder-entity.h"\r
-\r
-#include <libnr/nr-matrix-div.h>\r
-#include <glibmm/i18n.h>\r
-#include <2geom/point.h>\r
-#include <2geom/matrix.h>\r
-#include "svg/stringstream.h"\r
-#include "xml/repr.h"\r
-\r
-class SPDesktop;\r
-\r
-namespace Inkscape {\r
-\r
-static void pointparam_knot_clicked_handler (SPKnot *knot, guint state, PointParamKnotHolder *kh);\r
-static void pointparam_knot_moved_handler(SPKnot *knot, NR::Point const *p, guint state, PointParamKnotHolder *kh);\r
-static void pointparam_knot_ungrabbed_handler (SPKnot *knot, unsigned int state, PointParamKnotHolder *kh);\r
-static void pointparam_knot_holder_class_init(PointParamKnotHolderClass *klass);\r
-\r
-void pointparam_knot_holder_dispose(GObject *object);\r
-\r
-static SPKnotHolderClass *parent_class;\r
-\r
-/**\r
- * Registers PointParamKnotHolder class and returns its type number.\r
- */\r
-GType pointparam_knot_holder_get_type()\r
-{\r
- static GType type = 0;\r
- if (!type) {\r
- GTypeInfo info = {\r
- sizeof(PointParamKnotHolderClass),\r
- NULL, /* base_init */\r
- NULL, /* base_finalize */\r
- (GClassInitFunc) pointparam_knot_holder_class_init,\r
- NULL, /* class_finalize */\r
- NULL, /* class_data */\r
- sizeof (PointParamKnotHolder),\r
- 16, /* n_preallocs */\r
- NULL,\r
- NULL\r
- };\r
- type = g_type_register_static (G_TYPE_OBJECT, "InkscapePointParamKnotHolder", &info, (GTypeFlags) 0);\r
- }\r
- return type;\r
-}\r
-\r
-/**\r
- * PointParamKnotHolder vtable initialization.\r
- */\r
-static void pointparam_knot_holder_class_init(PointParamKnotHolderClass *klass)\r
-{\r
- GObjectClass *gobject_class;\r
- gobject_class = (GObjectClass *) klass;\r
-\r
- parent_class = (SPKnotHolderClass*) g_type_class_peek_parent(klass);\r
- gobject_class->dispose = pointparam_knot_holder_dispose;\r
-}\r
-\r
-PointParamKnotHolder *pointparam_knot_holder_new(SPDesktop *desktop, SPObject *lpeobject, const gchar * key, SPItem *item)\r
-{\r
- g_return_val_if_fail(desktop != NULL, NULL);\r
- g_return_val_if_fail(item != NULL, NULL);\r
- g_return_val_if_fail(SP_IS_ITEM(item), NULL);\r
-\r
- PointParamKnotHolder *knot_holder = (PointParamKnotHolder*)g_object_new (INKSCAPE_TYPE_POINTPARAM_KNOT_HOLDER, 0);\r
- knot_holder->desktop = desktop;\r
- knot_holder->item = item;\r
- knot_holder->lpeobject = LIVEPATHEFFECT(lpeobject);\r
- g_object_ref(G_OBJECT(item));\r
- g_object_ref(G_OBJECT(lpeobject));\r
- knot_holder->entity = NULL;\r
-\r
- knot_holder->released = NULL;\r
-\r
- knot_holder->repr = lpeobject->repr;\r
- knot_holder->repr_key = key;\r
-\r
- knot_holder->local_change = FALSE;\r
-\r
- return knot_holder;\r
-}\r
-\r
-void pointparam_knot_holder_dispose(GObject *object) {\r
- PointParamKnotHolder *kh = G_TYPE_CHECK_INSTANCE_CAST((object), INKSCAPE_TYPE_POINTPARAM_KNOT_HOLDER, PointParamKnotHolder);\r
-\r
- g_object_unref(G_OBJECT(kh->item));\r
- g_object_unref(G_OBJECT(kh->lpeobject));\r
- while (kh->entity) {\r
- SPKnotHolderEntity *e = (SPKnotHolderEntity *) kh->entity->data;\r
- g_signal_handler_disconnect(e->knot, e->_click_handler_id);\r
- g_signal_handler_disconnect(e->knot, e->_ungrab_handler_id);\r
- /* unref should call destroy */\r
- g_object_unref(e->knot);\r
- g_free(e);\r
- kh->entity = g_slist_remove(kh->entity, e);\r
- }\r
-}\r
-\r
-void\r
-PointParamKnotHolder::add_knot (\r
- Geom::Point & p,\r
- PointParamKnotHolderClickedFunc knot_click,\r
- SPKnotShapeType shape,\r
- SPKnotModeType mode,\r
- guint32 color,\r
- const gchar *tip )\r
-{\r
- /* create new SPKnotHolderEntry */\r
- SPKnotHolderEntity *e = g_new(SPKnotHolderEntity, 1);\r
- e->knot = sp_knot_new(desktop, tip);\r
- e->knot_set = NULL;\r
- e->knot_get = NULL;\r
- if (knot_click) {\r
- e->knot_click = knot_click;\r
- } else {\r
- e->knot_click = NULL;\r
- }\r
-\r
- g_object_set(G_OBJECT (e->knot->item), "shape", shape, NULL);\r
- g_object_set(G_OBJECT (e->knot->item), "mode", mode, NULL);\r
-\r
- e->knot->fill [SP_KNOT_STATE_NORMAL] = color;\r
- g_object_set (G_OBJECT (e->knot->item), "fill_color", color, NULL);\r
-\r
- entity = g_slist_append(entity, e);\r
-\r
- /* Move to current point. */\r
- NR::Point dp = p * sp_item_i2d_affine(item);\r
- sp_knot_set_position(e->knot, &dp, SP_KNOT_STATE_NORMAL);\r
-\r
- e->handler_id = g_signal_connect(e->knot, "moved", G_CALLBACK(pointparam_knot_moved_handler), this);\r
- e->_click_handler_id = g_signal_connect(e->knot, "clicked", G_CALLBACK(pointparam_knot_clicked_handler), this);\r
- e->_ungrab_handler_id = g_signal_connect(e->knot, "ungrabbed", G_CALLBACK(pointparam_knot_ungrabbed_handler), this);\r
-\r
- sp_knot_show(e->knot);\r
-}\r
-\r
-static void pointparam_knot_clicked_handler(SPKnot */*knot*/, guint /*state*/, PointParamKnotHolder */*kh*/)\r
-{\r
-\r
-}\r
-\r
-/**\r
- * \param p In desktop coordinates.\r
- * This function does not write to XML, but tries to write directly to the PointParam to quickly live update the effect\r
- */\r
-static void pointparam_knot_moved_handler(SPKnot */*knot*/, NR::Point const *p, guint /*state*/, PointParamKnotHolder *kh)\r
-{\r
- NR::Matrix const i2d(sp_item_i2d_affine(kh->item));\r
- NR::Point pos = (*p) / i2d;\r
-\r
- Inkscape::SVGOStringStream os;\r
- os << pos[0] << "," << pos[1];\r
-\r
- kh->lpeobject->lpe->setParameter(kh->repr_key, os.str().c_str());\r
-}\r
-\r
-static void pointparam_knot_ungrabbed_handler(SPKnot *knot, unsigned int /*state*/, PointParamKnotHolder *kh)\r
-{\r
- NR::Matrix const i2d(sp_item_i2d_affine(kh->item));\r
- NR::Point pos = sp_knot_position(knot) / i2d;\r
-\r
- Inkscape::SVGOStringStream os;\r
- os << pos[0] << "," << pos[1];\r
-\r
- kh->repr->setAttribute(kh->repr_key , os.str().c_str());\r
-\r
- sp_document_done(SP_OBJECT_DOCUMENT (kh->lpeobject), SP_VERB_CONTEXT_NODE, _("Change LPE point parameter"));\r
-}\r
-\r
-} // namespace Inkscape\r
-\r
-/*\r
- Local Variables:\r
- mode:c++\r
- c-file-style:"stroustrup"\r
- c-file-offsets:((innamespace . 0)(inline-open . 0)(case-label . +))\r
- indent-tabs-mode:nil\r
- fill-column:99\r
- End:\r
-*/\r
-// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:encoding=utf-8:textwidth=99 :\r
+#define INKSCAPE_LPE_POINTPARAM_KNOTHOLDER_C
+
+/*
+ * Container for PointParamKnotHolder visual handles
+ *
+ * Authors:
+ * Johan Engelen <goejendaagh@zonnet.nl>
+ *
+ * Copyright (C) 2008 authors
+ *
+ * Released under GNU GPL, read the file 'COPYING' for more information
+ */
+
+#include "live_effects/parameter/pointparam-knotholder.h"
+#include "live_effects/lpeobject.h"
+#include "document.h"
+#include "sp-shape.h"
+#include "knot.h"
+#include "knotholder.h"
+#include "knot-holder-entity.h"
+
+#include <libnr/nr-matrix-div.h>
+#include <glibmm/i18n.h>
+#include <2geom/point.h>
+#include <2geom/matrix.h>
+#include "svg/stringstream.h"
+#include "xml/repr.h"
+
+class SPDesktop;
+
+namespace Inkscape {
+
+static void pointparam_knot_clicked_handler (SPKnot *knot, guint state, PointParamKnotHolder *kh);
+static void pointparam_knot_moved_handler(SPKnot *knot, NR::Point const *p, guint state, PointParamKnotHolder *kh);
+static void pointparam_knot_ungrabbed_handler (SPKnot *knot, unsigned int state, PointParamKnotHolder *kh);
+static void pointparam_knot_holder_class_init(PointParamKnotHolderClass *klass);
+
+void pointparam_knot_holder_dispose(GObject *object);
+
+static SPKnotHolderClass *parent_class;
+
+/**
+ * Registers PointParamKnotHolder class and returns its type number.
+ */
+GType pointparam_knot_holder_get_type()
+{
+ static GType type = 0;
+ if (!type) {
+ GTypeInfo info = {
+ sizeof(PointParamKnotHolderClass),
+ NULL, /* base_init */
+ NULL, /* base_finalize */
+ (GClassInitFunc) pointparam_knot_holder_class_init,
+ NULL, /* class_finalize */
+ NULL, /* class_data */
+ sizeof (PointParamKnotHolder),
+ 16, /* n_preallocs */
+ NULL,
+ NULL
+ };
+ type = g_type_register_static (G_TYPE_OBJECT, "InkscapePointParamKnotHolder", &info, (GTypeFlags) 0);
+ }
+ return type;
+}
+
+/**
+ * PointParamKnotHolder vtable initialization.
+ */
+static void pointparam_knot_holder_class_init(PointParamKnotHolderClass *klass)
+{
+ GObjectClass *gobject_class;
+ gobject_class = (GObjectClass *) klass;
+
+ parent_class = (SPKnotHolderClass*) g_type_class_peek_parent(klass);
+ gobject_class->dispose = pointparam_knot_holder_dispose;
+}
+
+PointParamKnotHolder *pointparam_knot_holder_new(SPDesktop *desktop, SPObject *lpeobject, const gchar * key, SPItem *item)
+{
+ g_return_val_if_fail(desktop != NULL, NULL);
+ g_return_val_if_fail(item != NULL, NULL);
+ g_return_val_if_fail(SP_IS_ITEM(item), NULL);
+
+ PointParamKnotHolder *knot_holder = (PointParamKnotHolder*)g_object_new (INKSCAPE_TYPE_POINTPARAM_KNOT_HOLDER, 0);
+ knot_holder->desktop = desktop;
+ knot_holder->item = item;
+ knot_holder->lpeobject = LIVEPATHEFFECT(lpeobject);
+ g_object_ref(G_OBJECT(item));
+ g_object_ref(G_OBJECT(lpeobject));
+ knot_holder->entity = NULL;
+
+ knot_holder->released = NULL;
+
+ knot_holder->repr = lpeobject->repr;
+ knot_holder->repr_key = key;
+
+ knot_holder->local_change = FALSE;
+
+ return knot_holder;
+}
+
+void pointparam_knot_holder_dispose(GObject *object) {
+ PointParamKnotHolder *kh = G_TYPE_CHECK_INSTANCE_CAST((object), INKSCAPE_TYPE_POINTPARAM_KNOT_HOLDER, PointParamKnotHolder);
+
+ g_object_unref(G_OBJECT(kh->item));
+ g_object_unref(G_OBJECT(kh->lpeobject));
+ while (kh->entity) {
+ SPKnotHolderEntity *e = (SPKnotHolderEntity *) kh->entity->data;
+ g_signal_handler_disconnect(e->knot, e->_click_handler_id);
+ g_signal_handler_disconnect(e->knot, e->_ungrab_handler_id);
+ /* unref should call destroy */
+ g_object_unref(e->knot);
+ g_free(e);
+ kh->entity = g_slist_remove(kh->entity, e);
+ }
+}
+
+void
+PointParamKnotHolder::add_knot (
+ Geom::Point & p,
+ PointParamKnotHolderClickedFunc knot_click,
+ SPKnotShapeType shape,
+ SPKnotModeType mode,
+ guint32 color,
+ const gchar *tip )
+{
+ /* create new SPKnotHolderEntry */
+ SPKnotHolderEntity *e = g_new(SPKnotHolderEntity, 1);
+ e->knot = sp_knot_new(desktop, tip);
+ e->knot_set = NULL;
+ e->knot_get = NULL;
+ if (knot_click) {
+ e->knot_click = knot_click;
+ } else {
+ e->knot_click = NULL;
+ }
+
+ g_object_set(G_OBJECT (e->knot->item), "shape", shape, NULL);
+ g_object_set(G_OBJECT (e->knot->item), "mode", mode, NULL);
+
+ e->knot->fill [SP_KNOT_STATE_NORMAL] = color;
+ g_object_set (G_OBJECT (e->knot->item), "fill_color", color, NULL);
+
+ entity = g_slist_append(entity, e);
+
+ /* Move to current point. */
+ NR::Point dp = p * sp_item_i2d_affine(item);
+ sp_knot_set_position(e->knot, &dp, SP_KNOT_STATE_NORMAL);
+
+ e->handler_id = g_signal_connect(e->knot, "moved", G_CALLBACK(pointparam_knot_moved_handler), this);
+ e->_click_handler_id = g_signal_connect(e->knot, "clicked", G_CALLBACK(pointparam_knot_clicked_handler), this);
+ e->_ungrab_handler_id = g_signal_connect(e->knot, "ungrabbed", G_CALLBACK(pointparam_knot_ungrabbed_handler), this);
+
+ sp_knot_show(e->knot);
+}
+
+static void pointparam_knot_clicked_handler(SPKnot */*knot*/, guint /*state*/, PointParamKnotHolder */*kh*/)
+{
+
+}
+
+/**
+ * \param p In desktop coordinates.
+ * This function does not write to XML, but tries to write directly to the PointParam to quickly live update the effect
+ */
+static void pointparam_knot_moved_handler(SPKnot */*knot*/, NR::Point const *p, guint /*state*/, PointParamKnotHolder *kh)
+{
+ NR::Matrix const i2d(sp_item_i2d_affine(kh->item));
+ NR::Point pos = (*p) / i2d;
+
+ Inkscape::SVGOStringStream os;
+ os << pos[0] << "," << pos[1];
+
+ kh->lpeobject->lpe->setParameter(kh->repr_key, os.str().c_str());
+}
+
+static void pointparam_knot_ungrabbed_handler(SPKnot *knot, unsigned int /*state*/, PointParamKnotHolder *kh)
+{
+ NR::Matrix const i2d(sp_item_i2d_affine(kh->item));
+ NR::Point pos = sp_knot_position(knot) / i2d;
+
+ Inkscape::SVGOStringStream os;
+ os << pos[0] << "," << pos[1];
+
+ kh->repr->setAttribute(kh->repr_key , os.str().c_str());
+
+ sp_document_done(SP_OBJECT_DOCUMENT (kh->lpeobject), SP_VERB_CONTEXT_NODE, _("Change LPE point parameter"));
+}
+
+} // namespace Inkscape
+
+/*
+ Local Variables:
+ mode:c++
+ c-file-style:"stroustrup"
+ c-file-offsets:((innamespace . 0)(inline-open . 0)(case-label . +))
+ indent-tabs-mode:nil
+ fill-column:99
+ End:
+*/
+// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:encoding=utf-8:textwidth=99 :
diff --git a/src/live_effects/parameter/pointparam-knotholder.h b/src/live_effects/parameter/pointparam-knotholder.h
index ef2b2df724d9e89bb047cf7fd7142449575b5d65..156bcaf64f7163d076fb809bb068f75cd0ff3b0c 100644 (file)
-#ifndef INKSCAPE_LPE_POINTPARAM_KNOTHOLDER_H\r
-#define INKSCAPE_LPE_POINTPARAM_KNOTHOLDER_H\r
-\r
-/*\r
- * PointParamKnotHolder - Hold SPKnot list and manage signals for LPE PointParam\r
- *\r
- * Author:\r
- * Johan Engelen <goejendaagh@zonnet.nl>\r
- *\r
- * Copyright (C) 2008 Johan Engelen\r
- *\r
- * Released under GNU GPL\r
- *\r
- */\r
-\r
-#include "knotholder.h"\r
-#include <glib/gtypes.h>\r
-#include "knot-enums.h"\r
-#include "forward.h"\r
-#include "libnr/nr-forward.h"\r
-#include <2geom/point.h>\r
-#include "live_effects/lpeobject.h"\r
-\r
-namespace Inkscape {\r
-namespace XML {\r
-class Node;\r
-}\r
-\r
-\r
-\r
-typedef void (* PointParamKnotHolderSetFunc) (SPItem *item, NR::Point const &p, NR::Point const &origin, guint state);\r
-typedef NR::Point (* PointParamKnotHolderGetFunc) (SPItem *item);\r
-typedef void (* PointParamKnotHolderClickedFunc) (SPItem *item, guint state);\r
-\r
-class PointParamKnotHolder : public SPKnotHolder {\r
-public:\r
- LivePathEffectObject * lpeobject;\r
- Inkscape::XML::Node * repr;\r
- const gchar * repr_key;\r
-\r
- void add_knot ( Geom::Point & p,\r
- PointParamKnotHolderClickedFunc knot_click,\r
- SPKnotShapeType shape,\r
- SPKnotModeType mode,\r
- guint32 color,\r
- const gchar *tip );\r
-};\r
-\r
-struct PointParamKnotHolderClass : SPKnotHolderClass {\r
-};\r
-\r
-PointParamKnotHolder *pointparam_knot_holder_new(SPDesktop *desktop, SPObject *lpeobject, const gchar * key, SPItem *item);\r
-\r
-GType pointparam_knot_holder_get_type();\r
-\r
-\r
-#define INKSCAPE_TYPE_POINTPARAM_KNOT_HOLDER (Inkscape::pointparam_knot_holder_get_type())\r
-\r
-\r
-} // namespace Inkscape\r
-\r
-\r
-#endif /* INKSCAPE_LPE_POINTPARAM_KNOTHOLDER_H */\r
-\r
-/*\r
- Local Variables:\r
- mode:c++\r
- c-file-style:"stroustrup"\r
- c-file-offsets:((innamespace . 0)(inline-open . 0)(case-label . +))\r
- indent-tabs-mode:nil\r
- fill-column:99\r
- End:\r
-*/\r
-// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:encoding=utf-8:textwidth=99 :\r
+#ifndef INKSCAPE_LPE_POINTPARAM_KNOTHOLDER_H
+#define INKSCAPE_LPE_POINTPARAM_KNOTHOLDER_H
+
+/*
+ * PointParamKnotHolder - Hold SPKnot list and manage signals for LPE PointParam
+ *
+ * Author:
+ * Johan Engelen <goejendaagh@zonnet.nl>
+ *
+ * Copyright (C) 2008 Johan Engelen
+ *
+ * Released under GNU GPL
+ *
+ */
+
+#include "knotholder.h"
+#include <glib/gtypes.h>
+#include "knot-enums.h"
+#include "forward.h"
+#include "libnr/nr-forward.h"
+#include <2geom/point.h>
+#include "live_effects/lpeobject.h"
+
+namespace Inkscape {
+namespace XML {
+class Node;
+}
+
+
+
+typedef void (* PointParamKnotHolderSetFunc) (SPItem *item, NR::Point const &p, NR::Point const &origin, guint state);
+typedef NR::Point (* PointParamKnotHolderGetFunc) (SPItem *item);
+typedef void (* PointParamKnotHolderClickedFunc) (SPItem *item, guint state);
+
+class PointParamKnotHolder : public SPKnotHolder {
+public:
+ LivePathEffectObject * lpeobject;
+ Inkscape::XML::Node * repr;
+ const gchar * repr_key;
+
+ void add_knot ( Geom::Point & p,
+ PointParamKnotHolderClickedFunc knot_click,
+ SPKnotShapeType shape,
+ SPKnotModeType mode,
+ guint32 color,
+ const gchar *tip );
+};
+
+struct PointParamKnotHolderClass : SPKnotHolderClass {
+};
+
+PointParamKnotHolder *pointparam_knot_holder_new(SPDesktop *desktop, SPObject *lpeobject, const gchar * key, SPItem *item);
+
+GType pointparam_knot_holder_get_type();
+
+
+#define INKSCAPE_TYPE_POINTPARAM_KNOT_HOLDER (Inkscape::pointparam_knot_holder_get_type())
+
+
+} // namespace Inkscape
+
+
+#endif /* INKSCAPE_LPE_POINTPARAM_KNOTHOLDER_H */
+
+/*
+ Local Variables:
+ mode:c++
+ c-file-style:"stroustrup"
+ c-file-offsets:((innamespace . 0)(inline-open . 0)(case-label . +))
+ indent-tabs-mode:nil
+ fill-column:99
+ End:
+*/
+// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:encoding=utf-8:textwidth=99 :
diff --git a/src/widgets/calligraphic-profile-rename.cpp b/src/widgets/calligraphic-profile-rename.cpp
index ae9a31c0e13fcb5fb030530e167caab47f5ce86c..45ad08aa92134a96a2af151eaf43fb28e3880999 100755 (executable)
-/**\r
- *\r
- * \brief Dialog for naming calligraphic profiles\r
- *\r
- * Author:\r
- * Aubanel MONNIER \r
- *\r
- * Copyright (C) 2007 Aubanel MONNIER\r
- *\r
- * Released under GNU GPL. Read the file 'COPYING' for more information\r
- */\r
-\r
-#ifdef HAVE_CONFIG_H\r
-# include <config.h>\r
-#endif\r
-\r
-#include <glibmm/i18n.h>\r
-#include <gtkmm/stock.h>\r
-\r
-#include "desktop.h"\r
-#include "calligraphic-profile-rename.h"\r
-\r
-\r
-namespace Inkscape {\r
-namespace UI {\r
-namespace Dialogs {\r
-CalligraphicProfileDialog::CalligraphicProfileDialog(): _applied(false){\r
- Gtk::VBox *mainVBox = get_vbox();\r
- _layout_table.set_spacings(4);\r
- _layout_table.resize (1, 2);\r
-\r
- _profile_name_entry.set_activates_default(true);\r
-\r
- _profile_name_label.set_label(_("Profile name:"));\r
- _profile_name_label.set_alignment(1.0, 0.5);\r
- \r
- _layout_table.attach(_profile_name_label,\r
- 0, 1, 0, 1, Gtk::FILL, Gtk::FILL);\r
- _layout_table.attach(_profile_name_entry,\r
- 1, 2, 0, 1, Gtk::FILL | Gtk::EXPAND, Gtk::FILL);\r
- mainVBox->pack_start(_layout_table, false, false, 4);\r
- // Buttons\r
- _close_button.set_use_stock(true);\r
- _close_button.set_label(Gtk::Stock::CANCEL.id);\r
- _close_button.set_flags(Gtk::CAN_DEFAULT);\r
- \r
- _apply_button.set_use_underline(true);\r
- _apply_button.set_label(_("Save"));\r
- _apply_button.set_flags(Gtk::CAN_DEFAULT);\r
- \r
- _close_button.signal_clicked()\r
- .connect(sigc::mem_fun(*this, &CalligraphicProfileDialog::_close));\r
- _apply_button.signal_clicked()\r
- .connect(sigc::mem_fun(*this, &CalligraphicProfileDialog::_apply));\r
- \r
- signal_delete_event().connect(\r
- sigc::bind_return(\r
- sigc::hide(sigc::mem_fun(*this, &CalligraphicProfileDialog::_close)),\r
- true\r
- )\r
- );\r
-\r
- add_action_widget(_close_button, Gtk::RESPONSE_CLOSE);\r
- add_action_widget(_apply_button, Gtk::RESPONSE_APPLY);\r
-\r
- _apply_button.grab_default();\r
-\r
- show_all_children();\r
-\r
-}\r
-\r
-void\r
-CalligraphicProfileDialog::_apply()\r
-{\r
- _profile_name = _profile_name_entry.get_text();\r
- _applied = true;\r
- _close();\r
-}\r
-\r
-void\r
-CalligraphicProfileDialog::_close()\r
-{\r
- this->Gtk::Dialog::hide();\r
- \r
-}\r
-\r
-void CalligraphicProfileDialog::show(SPDesktop *desktop){\r
- CalligraphicProfileDialog &dial = instance();\r
- dial._applied=false;\r
- dial.set_modal(true);\r
- desktop->setWindowTransient (dial.gobj());\r
- dial.property_destroy_with_parent() = true;\r
- // dial.Gtk::Dialog::show();\r
- //dial.present();\r
- dial.run();\r
-}\r
-\r
-\r
-}}}\r
+/**
+ *
+ * \brief Dialog for naming calligraphic profiles
+ *
+ * Author:
+ * Aubanel MONNIER
+ *
+ * Copyright (C) 2007 Aubanel MONNIER
+ *
+ * Released under GNU GPL. Read the file 'COPYING' for more information
+ */
+
+#ifdef HAVE_CONFIG_H
+# include <config.h>
+#endif
+
+#include <glibmm/i18n.h>
+#include <gtkmm/stock.h>
+
+#include "desktop.h"
+#include "calligraphic-profile-rename.h"
+
+
+namespace Inkscape {
+namespace UI {
+namespace Dialogs {
+CalligraphicProfileDialog::CalligraphicProfileDialog(): _applied(false){
+ Gtk::VBox *mainVBox = get_vbox();
+ _layout_table.set_spacings(4);
+ _layout_table.resize (1, 2);
+
+ _profile_name_entry.set_activates_default(true);
+
+ _profile_name_label.set_label(_("Profile name:"));
+ _profile_name_label.set_alignment(1.0, 0.5);
+
+ _layout_table.attach(_profile_name_label,
+ 0, 1, 0, 1, Gtk::FILL, Gtk::FILL);
+ _layout_table.attach(_profile_name_entry,
+ 1, 2, 0, 1, Gtk::FILL | Gtk::EXPAND, Gtk::FILL);
+ mainVBox->pack_start(_layout_table, false, false, 4);
+ // Buttons
+ _close_button.set_use_stock(true);
+ _close_button.set_label(Gtk::Stock::CANCEL.id);
+ _close_button.set_flags(Gtk::CAN_DEFAULT);
+
+ _apply_button.set_use_underline(true);
+ _apply_button.set_label(_("Save"));
+ _apply_button.set_flags(Gtk::CAN_DEFAULT);
+
+ _close_button.signal_clicked()
+ .connect(sigc::mem_fun(*this, &CalligraphicProfileDialog::_close));
+ _apply_button.signal_clicked()
+ .connect(sigc::mem_fun(*this, &CalligraphicProfileDialog::_apply));
+
+ signal_delete_event().connect(
+ sigc::bind_return(
+ sigc::hide(sigc::mem_fun(*this, &CalligraphicProfileDialog::_close)),
+ true
+ )
+ );
+
+ add_action_widget(_close_button, Gtk::RESPONSE_CLOSE);
+ add_action_widget(_apply_button, Gtk::RESPONSE_APPLY);
+
+ _apply_button.grab_default();
+
+ show_all_children();
+
+}
+
+void
+CalligraphicProfileDialog::_apply()
+{
+ _profile_name = _profile_name_entry.get_text();
+ _applied = true;
+ _close();
+}
+
+void
+CalligraphicProfileDialog::_close()
+{
+ this->Gtk::Dialog::hide();
+
+}
+
+void CalligraphicProfileDialog::show(SPDesktop *desktop){
+ CalligraphicProfileDialog &dial = instance();
+ dial._applied=false;
+ dial.set_modal(true);
+ desktop->setWindowTransient (dial.gobj());
+ dial.property_destroy_with_parent() = true;
+ // dial.Gtk::Dialog::show();
+ //dial.present();
+ dial.run();
+}
+
+
+}}}
index 133d94a280c742d586adab238a808acd946158e9..fdac8f208b82df887bb3fad3be839463f790dc29 100755 (executable)
-/**\r
- *\r
- * \brief Dialog for naming calligraphic profiles\r
- *\r
- * Author:\r
- * Aubanel MONNIER \r
- *\r
- * Copyright (C) 2007 Aubanel MONNIER\r
- *\r
- * Released under GNU GPL. Read the file 'COPYING' for more information\r
- */\r
-\r
-#ifndef INKSCAPE_DIALOG_CALLIGRAPHIC_PROFILE_H\r
-#define INKSCAPE_DIALOG_CALLIGRAPHIC_PROFILE_H\r
-\r
-#include <gtkmm/dialog.h>\r
-#include <gtkmm/entry.h>\r
-#include <gtkmm/label.h>\r
-#include <gtkmm/table.h>\r
-\r
-namespace Inkscape {\r
- namespace UI {\r
- namespace Dialogs {\r
- \r
- class CalligraphicProfileDialog: public Gtk::Dialog { \r
- public:\r
- CalligraphicProfileDialog();\r
- virtual ~CalligraphicProfileDialog(){} ;\r
- static void show(SPDesktop *desktop);\r
- static bool applied(){return instance()._applied;}\r
- static Glib::ustring getProfileName() { return instance()._profile_name;}\r
-\r
- Glib::ustring getName() const { return "CalligraphicProfileDialog"; }\r
-\r
- \r
- protected:\r
- void _close();\r
- void _apply();\r
-\r
- Gtk::Label _profile_name_label;\r
- Gtk::Entry _profile_name_entry;\r
- Gtk::Table _layout_table;\r
- Gtk::Button _close_button;\r
- Gtk::Button _apply_button;\r
- Glib::ustring _profile_name;\r
- bool _applied;\r
- private:\r
- static CalligraphicProfileDialog &instance(){static CalligraphicProfileDialog instance; return instance;}\r
- CalligraphicProfileDialog(CalligraphicProfileDialog const &); // no copy\r
- CalligraphicProfileDialog &operator=(CalligraphicProfileDialog const &); // no assign\r
- }; \r
- }\r
- }\r
-}\r
-\r
-#endif INKSCAPE_DIALOG_CALLIGRAPHIC_PROFILE_H\r
+/**
+ *
+ * \brief Dialog for naming calligraphic profiles
+ *
+ * Author:
+ * Aubanel MONNIER
+ *
+ * Copyright (C) 2007 Aubanel MONNIER
+ *
+ * Released under GNU GPL. Read the file 'COPYING' for more information
+ */
+
+#ifndef INKSCAPE_DIALOG_CALLIGRAPHIC_PROFILE_H
+#define INKSCAPE_DIALOG_CALLIGRAPHIC_PROFILE_H
+
+#include <gtkmm/dialog.h>
+#include <gtkmm/entry.h>
+#include <gtkmm/label.h>
+#include <gtkmm/table.h>
+
+namespace Inkscape {
+ namespace UI {
+ namespace Dialogs {
+
+ class CalligraphicProfileDialog: public Gtk::Dialog {
+ public:
+ CalligraphicProfileDialog();
+ virtual ~CalligraphicProfileDialog(){} ;
+ static void show(SPDesktop *desktop);
+ static bool applied(){return instance()._applied;}
+ static Glib::ustring getProfileName() { return instance()._profile_name;}
+
+ Glib::ustring getName() const { return "CalligraphicProfileDialog"; }
+
+
+ protected:
+ void _close();
+ void _apply();
+
+ Gtk::Label _profile_name_label;
+ Gtk::Entry _profile_name_entry;
+ Gtk::Table _layout_table;
+ Gtk::Button _close_button;
+ Gtk::Button _apply_button;
+ Glib::ustring _profile_name;
+ bool _applied;
+ private:
+ static CalligraphicProfileDialog &instance(){static CalligraphicProfileDialog instance; return instance;}
+ CalligraphicProfileDialog(CalligraphicProfileDialog const &); // no copy
+ CalligraphicProfileDialog &operator=(CalligraphicProfileDialog const &); // no assign
+ };
+ }
+ }
+}
+
+#endif INKSCAPE_DIALOG_CALLIGRAPHIC_PROFILE_H