diff options
| author | Jon A. Cruz <jon@joncruz.org> | 2008-03-22 18:29:40 +0000 |
|---|---|---|
| committer | joncruz <joncruz@users.sourceforge.net> | 2008-03-22 18:29:40 +0000 |
| commit | 454a66aa12442146b02bda954fee3ff1077fc238 (patch) | |
| tree | 21dfaabd2c739e7c880fb55ac0ac017ec5617e22 /src | |
| parent | Removed Win32 keep-dialogs-on-top preference, now set permanently to true (diff) | |
| download | inkscape-454a66aa12442146b02bda954fee3ff1077fc238.tar.gz inkscape-454a66aa12442146b02bda954fee3ff1077fc238.zip | |
Line-end fixups
(bzr r5161)
Diffstat (limited to 'src')
| -rw-r--r-- | src/display/canvas-temporary-item-list.cpp | 166 | ||||
| -rw-r--r-- | src/display/canvas-temporary-item-list.h | 116 | ||||
| -rw-r--r-- | src/display/canvas-temporary-item.cpp | 146 | ||||
| -rw-r--r-- | src/display/canvas-temporary-item.h | 112 | ||||
| -rw-r--r-- | src/display/snap-indicator.cpp | 156 | ||||
| -rw-r--r-- | src/display/snap-indicator.h | 106 | ||||
| -rw-r--r-- | src/live_effects/parameter/pointparam-knotholder.cpp | 402 | ||||
| -rw-r--r-- | src/live_effects/parameter/pointparam-knotholder.h | 148 | ||||
| -rwxr-xr-x | src/widgets/calligraphic-profile-rename.cpp | 198 | ||||
| -rwxr-xr-x | src/widgets/calligraphic-profile-rename.h | 112 |
10 files changed, 831 insertions, 831 deletions
diff --git a/src/display/canvas-temporary-item-list.cpp b/src/display/canvas-temporary-item-list.cpp index 54e81a1f0..c324a5ddf 100644 --- a/src/display/canvas-temporary-item-list.cpp +++ b/src/display/canvas-temporary-item-list.cpp @@ -1,83 +1,83 @@ -/** \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 :
+/** \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 : diff --git a/src/display/canvas-temporary-item-list.h b/src/display/canvas-temporary-item-list.h index cd4bcfe99..4d712e216 100644 --- a/src/display/canvas-temporary-item-list.h +++ b/src/display/canvas-temporary-item-list.h @@ -1,58 +1,58 @@ -#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 :
+#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 : diff --git a/src/display/canvas-temporary-item.cpp b/src/display/canvas-temporary-item.cpp index 7d7f8087c..d31323b72 100644 --- a/src/display/canvas-temporary-item.cpp +++ b/src/display/canvas-temporary-item.cpp @@ -1,73 +1,73 @@ -/** \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 :
+/** \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 : diff --git a/src/display/canvas-temporary-item.h b/src/display/canvas-temporary-item.h index 0caa0d943..ec1e3b999 100644 --- a/src/display/canvas-temporary-item.h +++ b/src/display/canvas-temporary-item.h @@ -1,56 +1,56 @@ -#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 :
+#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 : diff --git a/src/display/snap-indicator.cpp b/src/display/snap-indicator.cpp index b6046e88c..f5e754d90 100644 --- a/src/display/snap-indicator.cpp +++ b/src/display/snap-indicator.cpp @@ -1,78 +1,78 @@ -/** \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 :
+/** \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 : diff --git a/src/display/snap-indicator.h b/src/display/snap-indicator.h index bedeb492b..0395d4000 100644 --- a/src/display/snap-indicator.h +++ b/src/display/snap-indicator.h @@ -1,53 +1,53 @@ -#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 :
+#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 bf8aaf97f..12d081703 100644 --- a/src/live_effects/parameter/pointparam-knotholder.cpp +++ b/src/live_effects/parameter/pointparam-knotholder.cpp @@ -1,201 +1,201 @@ -#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 :
+#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 ef2b2df72..156bcaf64 100644 --- a/src/live_effects/parameter/pointparam-knotholder.h +++ b/src/live_effects/parameter/pointparam-knotholder.h @@ -1,74 +1,74 @@ -#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 :
+#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 ae9a31c0e..45ad08aa9 100755 --- a/src/widgets/calligraphic-profile-rename.cpp +++ b/src/widgets/calligraphic-profile-rename.cpp @@ -1,99 +1,99 @@ -/**
- *
- * \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();
-}
-
-
-}}}
+/** + * + * \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(); +} + + +}}} diff --git a/src/widgets/calligraphic-profile-rename.h b/src/widgets/calligraphic-profile-rename.h index 133d94a28..fdac8f208 100755 --- a/src/widgets/calligraphic-profile-rename.h +++ b/src/widgets/calligraphic-profile-rename.h @@ -1,56 +1,56 @@ -/**
- *
- * \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
+/** + * + * \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 |
