]> git.tokkee.org Git - inkscape.git/commitdiff

Code

(no commit message)
authorgouldtj <gouldtj@users.sourceforge.net>
Tue, 2 May 2006 05:29:03 +0000 (05:29 +0000)
committergouldtj <gouldtj@users.sourceforge.net>
Tue, 2 May 2006 05:29:03 +0000 (05:29 +0000)
14 files changed:
ChangeLog
src/Makefile.am
src/Makefile_insert
src/dialogs/guidelinedialog.cpp
src/dialogs/guidelinedialog.h
src/dom/domimpl.cpp
src/dom/xpathtoken.cpp
src/dom/xpathtoken.h
src/gc-anchored.cpp
src/sp-object.cpp
src/ui/widget/page-sizer.cpp
src/ui/widget/style-swatch.cpp
src/ui/widget/style-swatch.h
src/util/format.h

index e98b0264e6624886047d9f5222b612f3bb238841..a44b9d39ccca1db53099622b825b89c773af5508 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,83 +1,3 @@
-2006-05-01  Jon A. Cruz  <jon@joncruz.org>
-
-       * src/Makefile.am, src/Makefile_insert, src/attributes-test.h,
-         src/color-profile-test.h, src/mod360-test.cpp, src/mod360-test.h,
-         src/round-test.cpp, src/round-test.h, src/sp-gradient-test.cpp,
-         src/sp-gradient-test.h, src/sp-style-elem-test.cpp,
-         src/sp-style-elem-test.h, src/style-test.h, src/test-helpers.h:
-         Replaced four more tests with CxxTest versions.
-
-2006-05-01  MenTaLguY  <mental@rydia.net>
-
-       * src/display/nr-arena-item.cpp:
-
-         use GC allocator for bitmap cache and transform
-
-2006-05-01  Marco Scholten  <mscholtn@xs4all.nl>
-
-       * src/dialogs/inkscape-preferences.cpp: Moved 'compass like
-    display of angles' from 'windows' to 'steps'.
-
-2006-04-30  MenTaLguY  <mental@rydia.net>
-
-       * src/libnr/nr-object.cpp:
-
-         log finalization of NRObjects
-
-2006-04-29  Jon Phillips  <jon@rejon.org>
-
-       * src/dialogs/rdf.cpp: Updated cc licenses to 2.5 by default.
-
-       * src/ui/dialog/document-metadata.cpp: Made metadata window
-       resizable so that one can see the licenses and enter long entries.
-
-2006-04-29  MenTaLguY  <mental@rydia.net>
-
-       * src/display/nr-arena-group.cpp, src/display/nr-arena-item.cpp,
-         src/display/nr-arena-item.h, src/display/nr-arena-shape.cpp:
-
-         rationalize function names and remove spurious soft_ptr
-
-2006-04-29  MenTaLguY  <mental@rydia.net>
-
-       * src/document.cpp:
-       
-         use proper unref function on SPRoot to avoid appearance of leak
-
-2006-04-29  MenTaLguY  <mental@rydia.net>
-
-       * src/gc-anchored.cpp, src/xml/simple-node.cpp, src/sp-object.cpp:
-
-         switch everyone to simpler debug event API
-
-2006-04-29  MenTaLguY  <mental@rydia.net>
-
-       * src/Makefile_insert, src/gc-finalized.cpp, src/gc-finalized.h:
-
-         add finalizer logging
-
-2006-04-29  MenTaLguY  <mental@rydia.net>
-
-       * src/debug/simple-event.h: simplify the SimpleEvent API more
-
-2006-04-29  MenTaLguY  <mental@rydia.net>
-
-       * src/debug/simple-event.h: make Debug::SimpleEvent more convenient
-
-       * src/debug/event.h, src/debug/logger.cpp: add FINALIZERS category
-
-2006-04-29  MenTaLguY  <mental@rydia.net>
-
-       * src/debug/logger.cpp:
-       
-       finish interrupted refactoring of log filter configuration
-
-2006-04-29  MenTaLguY  <mental@rydia.net>
-
-       * src/doc/Makefile.am, src/doc/refcounting.txt:
-       
-         some developer documentation about refcounting
-
 2006-04-29  MenTaLguY  <mental@rydia.net>
 
        * src/ui/view/view.cpp:
index 6155568a23bd141a1d12e5385da0b2021acee91c..1f6bcefab4ef3219d04a5c4b6fd66c06322e01ae 100644 (file)
@@ -166,6 +166,10 @@ EXTRA_PROGRAMS =   \
 
 TESTS =        \
        test-all$(EXEEXT)       \
+       mod360-test$(EXEEXT)    \
+       round-test$(EXEEXT)     \
+       sp-gradient-test$(EXEEXT)       \
+       sp-style-elem-test$(EXEEXT)     \
        style-test$(EXEEXT)     \
        display/bezier-utils-test$(EXEEXT)      \
        helper/units-test$(EXEEXT)      \
@@ -194,6 +198,10 @@ TESTS =    \
 
 check_PROGRAMS =       \
        test-all        \
+       mod360-test     \
+       round-test      \
+       sp-gradient-test        \
+       sp-style-elem-test      \
        style-test      \
        display/bezier-utils-test       \
        helper/units-test       \
index 531882f8d295cef41ebc666e4fba60fbdac030bd..18f6b7b039b442fd3a75fc78c5155d6e07fb23a1 100644 (file)
@@ -319,6 +319,18 @@ inkscape_LDFLAGS = --export-dynamic $(kdeldflags)
 inkview_SOURCES = inkview.cpp $(win32_sources)
 inkview_LDADD = $(all_libs)
 
+mod360_test_SOURCES = mod360-test.cpp
+mod360_test_LDADD = libinkpre.a -lglib-2.0
+
+round_test_SOURCES = round-test.cpp
+round_test_LDADD = libinkpost.a
+
+sp_gradient_test_SOURCES = sp-gradient-test.cpp
+sp_gradient_test_LDADD = $(all_libs) 
+
+sp_style_elem_test_SOURCES = sp-style-elem-test.cpp
+sp_style_elem_test_LDADD = $(all_libs)
+
 style_test_SOURCES = style-test.cpp
 style_test_LDADD = $(all_libs)
 
@@ -330,9 +342,4 @@ test_all_includes = \
                color-profile-test.h    \
                dir-util-test.h \
                extract-uri-test.h      \
-               mod360-test.h   \
-               round-test.h    \
-               sp-gradient-test.h      \
-               sp-style-elem-test.h    \
-               style-test.h    \
                verbs-test.h
index 7be2545f0d56a4304f99473e6d2bae41e24cf3e5..6fab6c1c67d51dcf6574052b9dddd261f74bacdc 100644 (file)
@@ -39,35 +39,43 @@ namespace Dialogs {
 
 GuidelinePropertiesDialog::GuidelinePropertiesDialog(SPGuide *guide, SPDesktop *desktop)
 : _desktop(desktop), _guide(guide),
-  _relative_toggle(_("Rela_tive move"), _("Move guide relative to current position")),
-  _adjustment(0.0, -SP_DESKTOP_SCROLL_LIMIT, SP_DESKTOP_SCROLL_LIMIT, 1.0, 10.0, 10.0),  
+  _adjustment(0.0, -SP_DESKTOP_SCROLL_LIMIT, SP_DESKTOP_SCROLL_LIMIT, 1.0, 10.0, 10.0),
   _unit_selector(NULL), _mode(true), _oldpos(0.0)
 {
 }
 
 GuidelinePropertiesDialog::~GuidelinePropertiesDialog() {
+    if ( NULL != _unit_selector) {
+        //g_free(_unit_selector);
+    }
 }
 
 void GuidelinePropertiesDialog::showDialog(SPGuide *guide, SPDesktop *desktop) {
-    GuidelinePropertiesDialog dialog(guide, desktop);
-    dialog._setup();
-    dialog.run();
+    GuidelinePropertiesDialog *dialog = new GuidelinePropertiesDialog(guide, desktop);
+    dialog->_setup();
+    dialog->run();
+    delete dialog;
 }
 
 void GuidelinePropertiesDialog::_modeChanged()
 {
-    _mode = !_relative_toggle.get_active();
-    if (!_mode) {
-        _label_move.set_label(_("Move by:"));
+    if (_mode) {
+        // TRANSLATORS: This string appears when double-clicking on a guide.
+        // This is the distance by which the guide is to be moved.
+        _m.set_label(_(" relative by "));
+        _mode = false;
     } else {
-        _label_move.set_label(_("Move to:"));
+        // TRANSLATORS: This string appears when double-clicking on a guide.
+        // This is the target location where the guide is to be moved.
+        _m.set_label(_(" absolute to "));
+        _mode = true;
     }
 }
 
 void GuidelinePropertiesDialog::_onApply()
 {
     gdouble const raw_dist = _spin_button.get_value();
-    SPUnit const &unit = *sp_unit_selector_get_unit(SP_UNIT_SELECTOR(_unit_selector->gobj()));
+    SPUnit const &unit = *sp_unit_selector_get_unit(SP_UNIT_SELECTOR(_unit_selector));
     gdouble const points = sp_units_get_pixels(raw_dist, unit);
     gdouble const newpos = ( _mode
                              ? points
@@ -118,48 +126,54 @@ void GuidelinePropertiesDialog::_setup() {
 
     Gtk::VBox *mainVBox = get_vbox();
 
-    _layout_table.set_spacings(4);
-    _layout_table.resize (3, 4);
+    _b1.set_homogeneous(false);
+    _b1.set_spacing(4);
+    mainVBox->pack_start(_b1, false, false, 0);
+    _b1.set_border_width(4);
+
+    _b2.set_homogeneous(false);
+    _b2.set_spacing(4);
+    _b1.pack_start(_b2, true, true, 0);
 
-    mainVBox->pack_start(_layout_table, false, false, 0);
+    //labels
+    _b3.set_homogeneous(false);
+    _b3.set_spacing(4);
+    _b2.pack_start(_b3, true, true, 0);
 
-    _label_descr.set_label("foo1");
-    _layout_table.attach(_label_descr,
-                         0, 3, 0, 1, Gtk::FILL, Gtk::FILL);
-    _label_descr.set_alignment(0, 0.5);
+    _label.set_label("foo1");
+    _b3.pack_start(_label, true, true, 0);
+    _label.set_alignment(1.0, 0.5);
 
-    _layout_table.attach(_label_move,
-                         0, 2, 1, 2, Gtk::FILL, Gtk::FILL);
-    _label_move.set_alignment(0, 0.5);
-    _modeChanged();
+    _label_id.set_label("foo2");
+    _b3.pack_start(_label_id, true, true, 0);
+    _label_id.set_alignment(0.0, 0.5);
 
-    // indent
-    _layout_table.attach(*manage(new Gtk::Label(" ")),
-                         0, 1, 2, 3, Gtk::FILL, Gtk::FILL, 10);
+    _b4.set_homogeneous(false);
+    _b4.set_spacing(4);
+    _b2.pack_start(_b4, false, false, 0);
 
-    // mode radio button
-    _layout_table.attach(_relative_toggle,
-                         1, 3, 3, 4, Gtk::EXPAND | Gtk::FILL, Gtk::FILL);
-    _relative_toggle.signal_toggled().connect(sigc::mem_fun(*this, &GuidelinePropertiesDialog::_modeChanged));
+    // mode button
+    _but.set_relief(Gtk::RELIEF_NONE);
+    _b4.pack_start(_but, false, true, 0);
+    _but.signal_clicked().connect(sigc::mem_fun(*this, &GuidelinePropertiesDialog::_modeChanged));
+    _m.set_label(_(" absolute to "));
+    _but.add(_m);
 
     // unitmenu
     /* fixme: We should allow percents here too, as percents of the canvas size */
-    GtkWidget *unit_selector = sp_unit_selector_new(SP_UNIT_ABSOLUTE | SP_UNIT_DEVICE);
-    sp_unit_selector_set_unit(SP_UNIT_SELECTOR(unit_selector), _desktop->namedview->doc_units);
-    _unit_selector = Gtk::manage(Glib::wrap(unit_selector));
+    _unit_selector = sp_unit_selector_new(SP_UNIT_ABSOLUTE | SP_UNIT_DEVICE);
+    sp_unit_selector_set_unit(SP_UNIT_SELECTOR(_unit_selector), _desktop->namedview->doc_units);
 
     // spinbutton
-    sp_unit_selector_add_adjustment(SP_UNIT_SELECTOR(unit_selector), GTK_ADJUSTMENT(_adjustment.gobj()));
+    sp_unit_selector_add_adjustment(SP_UNIT_SELECTOR(_unit_selector), GTK_ADJUSTMENT(_adjustment.gobj()));
     _spin_button.configure(_adjustment, 1.0 , 2);
     _spin_button.set_numeric(TRUE);
-    _layout_table.attach(_spin_button,
-                         1, 2, 2, 3, Gtk::EXPAND | Gtk::FILL, Gtk::FILL);
+    _b4.pack_start(_spin_button, true, true, 0);
     gtk_signal_connect_object(GTK_OBJECT(_spin_button.gobj()), "activate",
                               GTK_SIGNAL_FUNC(gtk_window_activate_default),
                               gobj());
 
-    _layout_table.attach(*_unit_selector,
-                         2, 3, 2, 3, Gtk::FILL, Gtk::FILL);
+    gtk_box_pack_start(GTK_BOX(_b4.gobj()), _unit_selector, FALSE, FALSE, 0);
 
 
     // dialog
@@ -170,15 +184,17 @@ void GuidelinePropertiesDialog::_setup() {
     _oldpos = _guide->position;
     {
         gchar *guide_description = sp_guide_description(_guide);
-        Inkscape::XML::Node *repr = SP_OBJECT_REPR (_guide);
-        const gchar *guide_id = repr->attribute("id");
-        gchar *label = g_strdup_printf(_("Moving %s %s"), guide_description, guide_id);
+        gchar *label = g_strdup_printf(_("Move %s"), guide_description);
         g_free(guide_description);
-        _label_descr.set_label(label);
+        _label.set_label(label);
         g_free(label);
+
+        Inkscape::XML::Node *repr = SP_OBJECT_REPR (_guide);
+        const gchar *guide_id = repr->attribute("id");
+        _label_id.set_label(guide_id);
     }
 
-    SPUnit const &unit = *sp_unit_selector_get_unit(SP_UNIT_SELECTOR(unit_selector));
+    SPUnit const &unit = *sp_unit_selector_get_unit(SP_UNIT_SELECTOR(_unit_selector));
     gdouble const val = sp_pixels_get_units(_oldpos, unit);
     _spin_button.set_value(val);
     _spin_button.grab_focus();
index d12e34042fd03b6371e5871479677ad40d047d99..d68ca4044ce69dc81309f2e4e90f186cc0abe44c 100644 (file)
 #define INKSCAPE_DIALOG_GUIDELINE_H
 
 #include <gtkmm/dialog.h>
-#include <gtkmm/table.h>
 #include <gtkmm/spinbutton.h>
 #include <gtkmm/label.h>
 #include <gtkmm/stock.h>
 #include <gtkmm/adjustment.h>
-#include "ui/widget/button.h"
 
 namespace Inkscape {
 namespace UI {
@@ -50,14 +48,18 @@ private:
 
     SPDesktop *_desktop;
     SPGuide *_guide;
-    Gtk::Table  _layout_table;
-    Gtk::Label  _label_descr;
-    Gtk::Label  _label_move;
-    Inkscape::UI::Widget::CheckButton _relative_toggle;
+    Gtk::HBox   _b1;
+    Gtk::VBox   _b2;
+    Gtk::HBox   _b3;
+    Gtk::HBox   _b4;
+    Gtk::Label  _label;
+    Gtk::Label  _label_id;
+    Gtk::Button _but;
+    Gtk::Label  _m;
     Gtk::Adjustment _adjustment;
     Gtk::SpinButton _spin_button;
 
-    Gtk::Widget *_unit_selector;
+    GtkWidget *_unit_selector;
     bool _mode;
     gdouble _oldpos;
 };
index ecbfd123d364da4775ef7287c7b04a9c998c7444..026dc37c6e0a09e993c53b1f6f81fe6e746a831c 100644 (file)
@@ -936,7 +936,7 @@ NodeImpl::NodeImpl() : Node()
 /**
  *
  */
-NodeImpl::NodeImpl(const NodeImpl &other) : Node()
+NodeImpl::NodeImpl(const NodeImpl &other)
 {
     init();
     assign(other);
index c9d4898d78a723e9705b52e483b2077ef17ba59f..2d5dfc1d7eab8cd4df627f6a3dbcabff44852dcf 100644 (file)
@@ -131,12 +131,12 @@ static TokenStringPair tokenStrings[] =
 \r
 \r
 /**\r
- *  Return the string TokenType of this token\r
+ *  Return the enumerated TokenType of this token\r
  *  (in the .cpp file)\r
  */\r
 DOMString Token::getTypeString()\r
 {\r
-    DOMString ret = "unknown";\r
+    DOMString ret;\r
     for (TokenStringPair *pair = tokenStrings ; pair->sval ; pair++)\r
         {\r
         if (pair->ival == type)\r
@@ -148,8 +148,6 @@ DOMString Token::getTypeString()
     return ret;\r
 }\r
 \r
-\r
-\r
 //########################################################################\r
 //# X P A T H    A X I S\r
 //########################################################################\r
@@ -168,8 +166,7 @@ Axis::Axis()
  */\r
 Axis::Axis(int tokPos)\r
 {\r
-    init();\r
-    tokenPosition = tokPos;\r
+    assign(other);\r
 }\r
 \r
 \r
@@ -186,15 +183,7 @@ Axis::Axis(const Axis &other)
 /**\r
  *\r
  */\r
-Axis::~Axis()\r
-{\r
-}\r
-\r
-\r
-/**\r
- *\r
- */\r
-Axis &Axis::operator=(const Axis &other)\r
+StackItem &StackItem::operator=(const StackItem &other)\r
 {\r
     assign(other);\r
     return *this;\r
@@ -203,82 +192,72 @@ Axis &Axis::operator=(const Axis &other)
 /**\r
  *\r
  */\r
-void Axis::init()\r
+void StackItem::assign(const StackItem &other)\r
 {\r
-    tokenPosition = 0;\r
+    sval = other.sval;\r
+    ival = other.ival;\r
+    dval = other.dval;\r
 }\r
 \r
-/**\r
- *\r
- */\r
-void Axis::assign(const Axis &other)\r
-{\r
-    tokenPosition = other.tokenPosition;\r
-}\r
 \r
-/**\r
- *\r
- */\r
-void Axis::setPosition(unsigned int val)\r
-{\r
-    tokenPosition = val;\r
-}\r
+//########################################################################\r
+//# X P A T H    S T A C K    I T E M\r
+//########################################################################\r
 \r
 /**\r
  *\r
  */\r
-unsigned int Axis::getPosition()\r
+StackItem::StackItem()\r
 {\r
-    return tokenPosition;\r
+    ival = 0L;\r
+    dval = 0.0;\r
 }\r
 \r
-/**\r
- *\r
- */\r
-void Axis::setNode(const Node *val)\r
-{\r
-    node = (Node *)val;\r
-}\r
 \r
 /**\r
  *\r
  */\r
-Node *Axis::getNode()\r
+StackItem::StackItem(const StackItem &other)\r
 {\r
-    return node;\r
+    assign(other);\r
 }\r
 \r
-//########################################################################\r
-//# X P A T H    S T A C K    I T E M\r
-//########################################################################\r
 \r
 /**\r
  *\r
  */\r
-StackItem::StackItem()\r
+Stack::~Stack()\r
 {\r
-    ival = 0L;\r
-    dval = 0.0;\r
 }\r
 \r
 \r
 /**\r
  *\r
  */\r
-StackItem::StackItem(const StackItem &other)\r
+void Stack::assign(const Stack &other)\r
 {\r
-    assign(other);\r
+    root = other.root;\r
+    nodeList = other.nodeList;\r
+    size = other.size;\r
+    for (int i=0 ; i<size ; i++)\r
+        items[i] = other.items[i];\r
 }\r
 \r
 \r
 /**\r
  *\r
  */\r
-StackItem::~StackItem()\r
+void Stack::reset()\r
 {\r
+    root = NULL;\r
+    NodeList n; /*no "clear" in api*/\r
+    nodeList = n;\r
+    size = 0;\r
 }\r
 \r
 \r
+\r
+\r
 /**\r
  *\r
  */\r
@@ -298,6 +277,22 @@ void StackItem::assign(const StackItem &other)
     dval = other.dval;\r
 }\r
 \r
+/**\r
+ * Set the root node\r
+ */\r
+void Stack::setRootNode(const Node *node)\r
+{\r
+    root = (Node *)node;\r
+}\r
+\r
+/**\r
+ * Get the current node list;\r
+ */\r
+NodeList &Stack::getNodeList()\r
+{\r
+    return nodeList;\r
+}\r
+\r
 \r
 //########################################################################\r
 //# T O K E N    L I S T\r
@@ -375,31 +370,22 @@ unsigned int TokenList::size() const
 }\r
 \r
 \r
-/**\r
- *\r
- */\r
-void TokenList::dump()\r
-{\r
+    Stack stack;\r
+    stack.setRootNode(root);\r
+\r
+    //### Execute the token list\r
     std::vector<Token *>::iterator iter;\r
     printf("############# TOKENS\n");\r
     for (iter = tokens.begin() ; iter != tokens.end() ; iter++)\r
         {\r
         Token *tok = *iter;\r
-        tok->dump();\r
+        tok->execute(stack);\r
         }\r
 }\r
 \r
+    list = stack.getNodeList();\r
 \r
-//########################################################################\r
-//# X P A T H    E X E C U T O R\r
-//########################################################################\r
-\r
-/**\r
- *\r
- */\r
-TokenExecutor::TokenExecutor()\r
-{\r
-    reset();\r
+    return list;\r
 }\r
 \r
 \r
index d595ad43c7aac9a3d4833607a954778064e91c14..03175efb1c7050796f7cd9f42955c848b707040c 100644 (file)
@@ -199,7 +199,7 @@ public:
     /**\r
      *  Assign our values to those of the other\r
      */\r
-    virtual void assign(const TokenExecutor &other);\r
+    virtual void assign(const Stack &other);\r
 \r
     /**\r
      * Reset the stack to its original settings\r
@@ -217,38 +217,23 @@ public:
     virtual StackItem pop();\r
 \r
     /**\r
-     * Execute a token list on the stack\r
+     * Set the root node\r
      */\r
-    NodeList execute(const TokenList &list, const Node *node);\r
+    virtual void setRootNode(const Node *node);\r
 \r
     /**\r
-     *\r
+     * Get the current node list;\r
      */\r
-    Axis axis;\r
+    virtual NodeList &getNodeList();\r
 \r
-    /**\r
-     *\r
-     */\r
-    std::vector<Axis> axisStack;\r
 \r
 private:\r
 \r
-    /**\r
-     * Contains the StackItem stack;\r
-     */\r
-    StackItem stack[STACK_SIZE];\r
-\r
-    /**\r
-     * Marks the head of the stack, for push() and pop()\r
-     */\r
-    int stackSize;\r
-\r
-    /**\r
-     *  Current list of nodes found by the expression\r
-     */\r
+    Node *root;\r
     NodeList nodeList;\r
 \r
-\r
+    StackItem items[STACK_SIZE];\r
+    int size;\r
 };\r
 \r
 \r
@@ -387,7 +372,8 @@ public:
     virtual int getType()\r
         { return type; }\r
     /**\r
-     *  Return the string TokenType of this token\r
+     *  Return the enumerated TokenType of this token\r
+     *  (in the .cpp file)\r
      */\r
     virtual DOMString getTypeString();\r
 \r
@@ -395,7 +381,7 @@ public:
      *  Let this token execute itself on the given stack,\r
      *  possibly adding Nodes to the node list.\r
      */\r
-    virtual bool execute(TokenExecutor &stack)\r
+    virtual bool execute(Stack &stack)\r
         { return true; }\r
 \r
     /**\r
@@ -456,7 +442,7 @@ public:
         type = TOK_STR;\r
         sval = val;\r
         }\r
-    virtual bool execute(TokenExecutor &exec)\r
+    virtual bool execute(Stack &stack)\r
         {\r
         StackItem item;\r
         item.sval = sval;\r
@@ -473,7 +459,7 @@ public:
         type = TOK_FLOAT;\r
         dval = val;\r
         }\r
-    virtual bool execute(TokenExecutor &exec)\r
+    virtual bool execute(Stack &stack)\r
         {\r
         StackItem item;\r
         item.dval = dval;\r
@@ -490,7 +476,7 @@ public:
         type = TOK_INT;\r
         ival = val;\r
         }\r
-    virtual bool execute(TokenExecutor &exec)\r
+    virtual bool execute(Stack &stack)\r
         {\r
         StackItem item;\r
         item.ival = ival;\r
@@ -506,7 +492,7 @@ public:
         {\r
         type = TOK_AND;\r
         }\r
-    virtual bool execute(TokenExecutor &exec)\r
+    virtual bool execute(Stack &stack)\r
         {\r
         StackItem item1 = exec.pop();\r
         StackItem item2 = exec.pop();\r
@@ -523,7 +509,7 @@ public:
         {\r
         type = TOK_OR;\r
         }\r
-    virtual bool execute(TokenExecutor &exec)\r
+    virtual bool execute(Stack &stack)\r
         {\r
         StackItem item1 = exec.pop();\r
         StackItem item2 = exec.pop();\r
@@ -540,7 +526,7 @@ public:
         {\r
         type = TOK_MOD;\r
         }\r
-    virtual bool execute(TokenExecutor &exec)\r
+    virtual bool execute(Stack &stack)\r
         {\r
         StackItem item1 = exec.pop();\r
         StackItem item2 = exec.pop();\r
@@ -557,7 +543,7 @@ public:
         {\r
         type = TOK_DIV;\r
         }\r
-    virtual bool execute(TokenExecutor &exec)\r
+    virtual bool execute(Stack &stack)\r
         {\r
         StackItem item1 = exec.pop();\r
         StackItem item2 = exec.pop();\r
@@ -574,7 +560,7 @@ public:
         {\r
         type = TOK_MULTIPLY;\r
         }\r
-    virtual bool execute(TokenExecutor &exec)\r
+    virtual bool execute(Stack &stack)\r
         {\r
         StackItem item1 = exec.pop();\r
         StackItem item2 = exec.pop();\r
@@ -591,7 +577,7 @@ public:
         {\r
         type = TOK_PLUS;\r
         }\r
-    virtual bool execute(TokenExecutor &exec)\r
+    virtual bool execute(Stack &stack)\r
         {\r
         StackItem item1 = exec.pop();\r
         StackItem item2 = exec.pop();\r
@@ -608,7 +594,7 @@ public:
         {\r
         type = TOK_MINUS;\r
         }\r
-    virtual bool execute(TokenExecutor &exec)\r
+    virtual bool execute(Stack &stack)\r
         {\r
         StackItem item1 = exec.pop();\r
         StackItem item2 = exec.pop();\r
@@ -625,7 +611,7 @@ public:
         {\r
         type = TOK_NEG;\r
         }\r
-    virtual bool execute(TokenExecutor &exec)\r
+    virtual bool execute(Stack &stack)\r
         {\r
         StackItem item = exec.pop();\r
         item.dval = -item.dval;\r
@@ -642,7 +628,7 @@ public:
         {\r
         type = TOK_EQUALS;\r
         }\r
-    virtual bool execute(TokenExecutor &exec)\r
+    virtual bool execute(Stack &stack)\r
         {\r
         StackItem item1 = exec.pop();\r
         StackItem item2 = exec.pop();\r
@@ -659,7 +645,7 @@ public:
         {\r
         type = TOK_NOT_EQUALS;\r
         }\r
-    virtual bool execute(TokenExecutor &exec)\r
+    virtual bool execute(Stack &stack)\r
         {\r
         StackItem item1 = exec.pop();\r
         StackItem item2 = exec.pop();\r
@@ -676,7 +662,7 @@ public:
         {\r
         type = TOK_LESS_THAN_EQUALS;\r
         }\r
-    virtual bool execute(TokenExecutor &exec)\r
+    virtual bool execute(Stack &stack)\r
         {\r
         StackItem item1 = exec.pop();\r
         StackItem item2 = exec.pop();\r
@@ -693,7 +679,7 @@ public:
         {\r
         type = TOK_LESS_THAN;\r
         }\r
-    virtual bool execute(TokenExecutor &exec)\r
+    virtual bool execute(Stack &stack)\r
         {\r
         StackItem item1 = exec.pop();\r
         StackItem item2 = exec.pop();\r
@@ -710,7 +696,7 @@ public:
         {\r
         type = TOK_GREATER_THAN_EQUALS;\r
         }\r
-    virtual bool execute(TokenExecutor &exec)\r
+    virtual bool execute(Stack &stack)\r
         {\r
         StackItem item1 = exec.pop();\r
         StackItem item2 = exec.pop();\r
@@ -727,7 +713,7 @@ public:
         {\r
         type = TOK_GREATER_THAN;\r
         }\r
-    virtual bool execute(TokenExecutor &exec)\r
+    virtual bool execute(Stack &stack)\r
         {\r
         StackItem item1 = exec.pop();\r
         StackItem item2 = exec.pop();\r
@@ -749,7 +735,7 @@ public:
         {\r
         type = TOK_ABSOLUTE;\r
         }\r
-    virtual bool execute(TokenExecutor &exec)\r
+    virtual bool execute(Stack &stack)\r
         {\r
         Node *n = exec.axis.getNode();\r
         while (n->getParentNode())\r
@@ -766,7 +752,7 @@ public:
         {\r
         type = TOK_RELATIVE;\r
         }\r
-    virtual bool execute(TokenExecutor &exec)\r
+    virtual bool execute(Stack &stack)\r
         {\r
         ///exec.axis.currentNode = stack.rootNode;\r
         return true;\r
@@ -780,7 +766,7 @@ public:
         {\r
         type = TOK_STEP;\r
         }\r
-    virtual bool execute(TokenExecutor &exec)\r
+    virtual bool execute(Stack &stack)\r
         {\r
         return true;\r
         }\r
@@ -794,7 +780,7 @@ public:
         type  = TOK_NAME_TEST;\r
         sval  = name;\r
         }\r
-    virtual bool execute(TokenExecutor &exec)\r
+    virtual bool execute(Stack &stack)\r
         {\r
         return true;\r
         }\r
@@ -807,7 +793,7 @@ public:
         {\r
         type = TOK_EXPR;\r
         }\r
-    virtual bool execute(TokenExecutor &exec)\r
+    virtual bool execute(Stack &stack)\r
         {\r
         return true;\r
         }\r
@@ -820,7 +806,7 @@ public:
         {\r
         type = TOK_UNION;\r
         }\r
-    virtual bool execute(TokenExecutor &exec)\r
+    virtual bool execute(Stack &stack)\r
         {\r
         return true;\r
         }\r
@@ -841,7 +827,7 @@ public:
         {\r
         type = TOK_AXIS_ANCESTOR_OR_SELF;\r
         }\r
-    virtual bool execute(TokenExecutor &exec)\r
+    virtual bool execute(Stack &stack)\r
         {\r
         return true;\r
         }\r
@@ -854,7 +840,7 @@ public:
         {\r
         type = TOK_AXIS_ANCESTOR;\r
         }\r
-    virtual bool execute(TokenExecutor &exec)\r
+    virtual bool execute(Stack &stack)\r
         {\r
         return true;\r
         }\r
@@ -867,7 +853,7 @@ public:
         {\r
         type = TOK_AXIS_ATTRIBUTE;\r
         }\r
-    virtual bool execute(TokenExecutor &exec)\r
+    virtual bool execute(Stack &stack)\r
         {\r
         return true;\r
         }\r
@@ -880,7 +866,7 @@ public:
         {\r
         type = TOK_AXIS_CHILD;\r
         }\r
-    virtual bool execute(TokenExecutor &exec)\r
+    virtual bool execute(Stack &stack)\r
         {\r
         return true;\r
         }\r
@@ -893,7 +879,7 @@ public:
         {\r
         type = TOK_AXIS_DESCENDANT_OR_SELF;\r
         }\r
-    virtual bool execute(TokenExecutor &exec)\r
+    virtual bool execute(Stack &stack)\r
         {\r
         return true;\r
         }\r
@@ -906,7 +892,7 @@ public:
         {\r
         type = TOK_AXIS_DESCENDANT;\r
         }\r
-    virtual bool execute(TokenExecutor &exec)\r
+    virtual bool execute(Stack &stack)\r
         {\r
         return true;\r
         }\r
@@ -919,7 +905,7 @@ public:
         {\r
         type = TOK_AXIS_FOLLOWING_SIBLING;\r
         }\r
-    virtual bool execute(TokenExecutor &exec)\r
+    virtual bool execute(Stack &stack)\r
         {\r
         return true;\r
         }\r
@@ -932,7 +918,7 @@ public:
         {\r
         type = TOK_AXIS_FOLLOWING;\r
         }\r
-    virtual bool execute(TokenExecutor &exec)\r
+    virtual bool execute(Stack &stack)\r
         {\r
         return true;\r
         }\r
@@ -945,7 +931,7 @@ public:
         {\r
         type = TOK_AXIS_NAMESPACE;\r
         }\r
-    virtual bool execute(TokenExecutor &exec)\r
+    virtual bool execute(Stack &stack)\r
         {\r
         return true;\r
         }\r
@@ -958,7 +944,7 @@ public:
         {\r
         type = TOK_AXIS_PARENT;\r
         }\r
-    virtual bool execute(TokenExecutor &exec)\r
+    virtual bool execute(Stack &stack)\r
         {\r
         return true;\r
         }\r
@@ -971,7 +957,7 @@ public:
         {\r
         type = TOK_AXIS_PRECEDING_SIBLING;\r
         }\r
-    virtual bool execute(TokenExecutor &exec)\r
+    virtual bool execute(Stack &stack)\r
         {\r
         return true;\r
         }\r
@@ -984,7 +970,7 @@ public:
         {\r
         type = TOK_AXIS_PRECEDING;\r
         }\r
-    virtual bool execute(TokenExecutor &exec)\r
+    virtual bool execute(Stack &stack)\r
         {\r
         return true;\r
         }\r
@@ -997,7 +983,7 @@ public:
         {\r
         type = TOK_AXIS_SELF;\r
         }\r
-    virtual bool execute(TokenExecutor &exec)\r
+    virtual bool execute(Stack &stack)\r
         {\r
         return true;\r
         }\r
@@ -1016,7 +1002,7 @@ public:
         {\r
         type = TOK_FUNC_LAST;\r
         }\r
-    virtual bool execute(TokenExecutor &exec)\r
+    virtual bool execute(Stack &stack)\r
         {\r
         return true;\r
         }\r
@@ -1029,7 +1015,7 @@ public:
         {\r
         type = TOK_FUNC_POSITION;\r
         }\r
-    virtual bool execute(TokenExecutor &exec)\r
+    virtual bool execute(Stack &stack)\r
         {\r
         return true;\r
         }\r
@@ -1042,7 +1028,7 @@ public:
         {\r
         type = TOK_FUNC_COUNT;\r
         }\r
-    virtual bool execute(TokenExecutor &exec)\r
+    virtual bool execute(Stack &stack)\r
         {\r
         return true;\r
         }\r
@@ -1055,7 +1041,7 @@ public:
         {\r
         type = TOK_FUNC_ID;\r
         }\r
-    virtual bool execute(TokenExecutor &exec)\r
+    virtual bool execute(Stack &stack)\r
         {\r
         return true;\r
         }\r
@@ -1068,7 +1054,7 @@ public:
         {\r
         type = TOK_FUNC_LOCAL_NAME;\r
         }\r
-    virtual bool execute(TokenExecutor &exec)\r
+    virtual bool execute(Stack &stack)\r
         {\r
         return true;\r
         }\r
@@ -1081,7 +1067,7 @@ public:
         {\r
         type = TOK_FUNC_NAMESPACE_URI;\r
         }\r
-    virtual bool execute(TokenExecutor &exec)\r
+    virtual bool execute(Stack &stack)\r
         {\r
         return true;\r
         }\r
@@ -1094,7 +1080,7 @@ public:
         {\r
         type = TOK_FUNC_NAME;\r
         }\r
-    virtual bool execute(TokenExecutor &exec)\r
+    virtual bool execute(Stack &stack)\r
         {\r
         return true;\r
         }\r
@@ -1107,7 +1093,7 @@ public:
         {\r
         type = TOK_FUNC_STRING;\r
         }\r
-    virtual bool execute(TokenExecutor &exec)\r
+    virtual bool execute(Stack &stack)\r
         {\r
         return true;\r
         }\r
@@ -1120,7 +1106,7 @@ public:
         {\r
         type = TOK_FUNC_CONCAT;\r
         }\r
-    virtual bool execute(TokenExecutor &exec)\r
+    virtual bool execute(Stack &stack)\r
         {\r
         return true;\r
         }\r
@@ -1133,7 +1119,7 @@ public:
         {\r
         type = TOK_FUNC_STARTS_WITH;\r
         }\r
-    virtual bool execute(TokenExecutor &exec)\r
+    virtual bool execute(Stack &stack)\r
         {\r
         return true;\r
         }\r
@@ -1146,7 +1132,7 @@ public:
         {\r
         type = TOK_FUNC_CONTAINS;\r
         }\r
-    virtual bool execute(TokenExecutor &exec)\r
+    virtual bool execute(Stack &stack)\r
         {\r
         return true;\r
         }\r
@@ -1159,7 +1145,7 @@ public:
         {\r
         type = TOK_FUNC_SUBSTRING_BEFORE;\r
         }\r
-    virtual bool execute(TokenExecutor &exec)\r
+    virtual bool execute(Stack &stack)\r
         {\r
         return true;\r
         }\r
@@ -1172,7 +1158,7 @@ public:
         {\r
         type = TOK_FUNC_SUBSTRING_AFTER;\r
         }\r
-    virtual bool execute(TokenExecutor &exec)\r
+    virtual bool execute(Stack &stack)\r
         {\r
         return true;\r
         }\r
@@ -1185,7 +1171,7 @@ public:
         {\r
         type = TOK_FUNC_SUBSTRING;\r
         }\r
-    virtual bool execute(TokenExecutor &exec)\r
+    virtual bool execute(Stack &stack)\r
         {\r
         return true;\r
         }\r
@@ -1198,7 +1184,7 @@ public:
         {\r
         type = TOK_FUNC_STRING_LENGTH;\r
         }\r
-    virtual bool execute(TokenExecutor &exec)\r
+    virtual bool execute(Stack &stack)\r
         {\r
         return true;\r
         }\r
@@ -1211,7 +1197,7 @@ public:
         {\r
         type = TOK_FUNC_NORMALIZE_SPACE;\r
         }\r
-    virtual bool execute(TokenExecutor &exec)\r
+    virtual bool execute(Stack &stack)\r
         {\r
         return true;\r
         }\r
@@ -1224,7 +1210,7 @@ public:
         {\r
         type = TOK_FUNC_TRANSLATE;\r
         }\r
-    virtual bool execute(TokenExecutor &exec)\r
+    virtual bool execute(Stack &stack)\r
         {\r
         return true;\r
         }\r
@@ -1237,7 +1223,7 @@ public:
         {\r
         type = TOK_FUNC_BOOLEAN;\r
         }\r
-    virtual bool execute(TokenExecutor &exec)\r
+    virtual bool execute(Stack &stack)\r
         {\r
         return true;\r
         }\r
@@ -1250,7 +1236,7 @@ public:
         {\r
         type = TOK_FUNC_NOT;\r
         }\r
-    virtual bool execute(TokenExecutor &exec)\r
+    virtual bool execute(Stack &stack)\r
         {\r
         return true;\r
         }\r
@@ -1263,7 +1249,7 @@ public:
         {\r
         type = TOK_FUNC_TRUE;\r
         }\r
-    virtual bool execute(TokenExecutor &exec)\r
+    virtual bool execute(Stack &stack)\r
         {\r
         return true;\r
         }\r
@@ -1276,7 +1262,7 @@ public:
         {\r
         type = TOK_FUNC_FALSE;\r
         }\r
-    virtual bool execute(TokenExecutor &exec)\r
+    virtual bool execute(Stack &stack)\r
         {\r
         return true;\r
         }\r
@@ -1289,7 +1275,7 @@ public:
         {\r
         type = TOK_FUNC_LANG;\r
         }\r
-    virtual bool execute(TokenExecutor &exec)\r
+    virtual bool execute(Stack &stack)\r
         {\r
         return true;\r
         }\r
@@ -1302,7 +1288,7 @@ public:
         {\r
         type = TOK_FUNC_NUMBER;\r
         }\r
-    virtual bool execute(TokenExecutor &exec)\r
+    virtual bool execute(Stack &stack)\r
         {\r
         return true;\r
         }\r
@@ -1315,7 +1301,7 @@ public:
         {\r
         type = TOK_FUNC_SUM;\r
         }\r
-    virtual bool execute(TokenExecutor &exec)\r
+    virtual bool execute(Stack &stack)\r
         {\r
         return true;\r
         }\r
@@ -1328,7 +1314,7 @@ public:
         {\r
         type = TOK_FUNC_FLOOR;\r
         }\r
-    virtual bool execute(TokenExecutor &exec)\r
+    virtual bool execute(Stack &stack)\r
         {\r
         return true;\r
         }\r
@@ -1341,7 +1327,7 @@ public:
         {\r
         type = TOK_FUNC_CEILING;\r
         }\r
-    virtual bool execute(TokenExecutor &exec)\r
+    virtual bool execute(Stack &stack)\r
         {\r
         return true;\r
         }\r
@@ -1354,7 +1340,7 @@ public:
         {\r
         type = TOK_FUNC_ROUND;\r
         }\r
-    virtual bool execute(TokenExecutor &exec)\r
+    virtual bool execute(Stack &stack)\r
         {\r
         return true;\r
         }\r
index baf36c0c95c51ffb4670565939b54c2620b36586..285efd69d909767ff742c376de960c31cdc375b9 100644 (file)
@@ -12,7 +12,7 @@
 #include <typeinfo>
 #include "gc-anchored.h"
 #include "debug/event-tracker.h"
-#include "debug/simple-event.h"
+#include "debug/event.h"
 #include "util/share.h"
 #include "util/format.h"
 
@@ -20,39 +20,51 @@ namespace Inkscape {
 
 namespace GC {
 
-namespace {
+class AnchorEvent : public Debug::Event {
+public:
+    enum Type { ANCHOR, RELEASE };
+
+    AnchorEvent(GC::Anchored const *object, Type type)
+    : _base(Util::format("%p", Core::base(const_cast<Anchored *>(object)))),
+      _object(Util::format("%p", object)),
+      _class_name(Util::share_static_string(typeid(*object).name())),
+      _refcount(Util::format("%d", ( type == ANCHOR ? object->_anchored_refcount() + 1 : object->_anchored_refcount() - 1 ))),
+      _type(type)
+    {}
 
-typedef Debug::SimpleEvent<Debug::Event::REFCOUNT> RefCountEvent;
+    static Category category() { return REFCOUNT; }
 
-class BaseAnchorEvent : public RefCountEvent {
-public:
-    BaseAnchorEvent(Anchored const *object, int bias,
-                    Util::ptr_shared<char> name)
-    : RefCountEvent(name)
-    {
-        _addProperty("base", Util::format("%p", Core::base(const_cast<Anchored *>(object))));
-        _addProperty("pointer", Util::format("%p", object));
-        _addProperty("class", Util::share_static_string(typeid(*object).name()));
-        _addProperty("new-refcount", Util::format("%d", object->_anchored_refcount() + bias));
+    Util::ptr_shared<char> name() const {
+        if ( _type == ANCHOR ) {
+            return Util::share_static_string("gc-anchor");
+        } else {
+            return Util::share_static_string("gc-release");
+        }
+    }
+    unsigned propertyCount() const { return 4; }
+    PropertyPair property(unsigned index) const {
+        switch (index) {
+            case 0:
+                return PropertyPair("base", _base);
+            case 1:
+                return PropertyPair("pointer", _object);
+            case 2:
+                return PropertyPair("class", _class_name);
+            case 3:
+                return PropertyPair("new-refcount", _refcount);
+            default:
+                return PropertyPair();
+        }
     }
-};
-
-class AnchorEvent : public BaseAnchorEvent {
-public:
-    AnchorEvent(Anchored const *object)
-    : BaseAnchorEvent(object, 1, Util::share_static_string("gc-anchor"))
-    {}
-};
 
-class ReleaseEvent : public BaseAnchorEvent {
-public:
-    ReleaseEvent(Anchored const *object)
-    : BaseAnchorEvent(object, -1, Util::share_static_string("gc-release"))
-    {}
+private:
+    Util::ptr_shared<char> _base;
+    Util::ptr_shared<char> _object;
+    Util::ptr_shared<char> _class_name;
+    Util::ptr_shared<char> _refcount;
+    Type _type;
 };
 
-}
-
 Anchored::Anchor *Anchored::_new_anchor() const {
     return new Anchor(this);
 }
@@ -62,7 +74,7 @@ void Anchored::_free_anchor(Anchored::Anchor *anchor) const {
 }
 
 void Anchored::anchor() const {
-    Debug::EventTracker<AnchorEvent> tracker(this);
+    Debug::EventTracker<AnchorEvent> tracker(this, AnchorEvent::ANCHOR);
     if (!_anchor) {
         _anchor = _new_anchor();
     }
@@ -70,7 +82,7 @@ void Anchored::anchor() const {
 }
 
 void Anchored::release() const {
-    Debug::EventTracker<ReleaseEvent> tracker(this);
+    Debug::EventTracker<AnchorEvent> tracker(this, AnchorEvent::RELEASE);
     if (!--_anchor->refcount) {
         _free_anchor(_anchor);
         _anchor = NULL;
index fbe16e957b826874d0657b99eb1b70eb532457d7..68865fb0e5a9ed8625d10bee2cb6e11cd1938128 100644 (file)
@@ -246,18 +246,42 @@ public:
     }
 };
 
-class RefEvent : public RefCountEvent {
-public:
-    RefEvent(SPObject *object)
-    : RefCountEvent(object, 1, Util::share_static_string("sp-object-ref"))
+    RefEvent(SPObject *object, Type type)
+        : _object(stringify(object)),
+          _class_name(Inkscape::Util::share_static_string(g_type_name(G_TYPE_FROM_INSTANCE(object)))),
+          _refcount(G_OBJECT(object)->ref_count),
+          _type(type)
     {}
 };
 
-class UnrefEvent : public RefCountEvent {
-public:
-    UnrefEvent(SPObject *object)
-    : RefCountEvent(object, -1, Util::share_static_string("sp-object-unref"))
-    {}
+    static Category category() { return REFCOUNT; }
+
+    Inkscape::Util::ptr_shared<char> name() const {
+        if ( _type == REF) {
+            return Inkscape::Util::share_static_string("sp-object-ref");
+        } else {
+            return Inkscape::Util::share_static_string("sp-object-unref");
+        }
+    }
+    unsigned propertyCount() const { return 3; }
+    PropertyPair property(unsigned index) const {
+        switch (index) {
+            case 0:
+                return PropertyPair("object", _object);
+            case 1:
+                return PropertyPair("class", _class_name);
+            case 2:
+                return PropertyPair("new-refcount", stringify( _type == REF ? _refcount + 1 : _refcount - 1 ));
+            default:
+                return PropertyPair();
+        }
+    }
+
+private:
+    Inkscape::Util::ptr_shared<char> _object;
+    Inkscape::Util::ptr_shared<char> _class_name;
+    unsigned _refcount;
+    Type _type;
 };
 
 }
@@ -276,7 +300,7 @@ sp_object_ref(SPObject *object, SPObject *owner)
     g_return_val_if_fail(SP_IS_OBJECT(object), NULL);
     g_return_val_if_fail(!owner || SP_IS_OBJECT(owner), NULL);
 
-    Inkscape::Debug::EventTracker<RefEvent> tracker(object);
+    Inkscape::Debug::EventTracker<RefEvent> tracker(object, RefEvent::REF);
     g_object_ref(G_OBJECT(object));
     return object;
 }
@@ -296,7 +320,7 @@ sp_object_unref(SPObject *object, SPObject *owner)
     g_return_val_if_fail(SP_IS_OBJECT(object), NULL);
     g_return_val_if_fail(!owner || SP_IS_OBJECT(owner), NULL);
 
-    Inkscape::Debug::EventTracker<UnrefEvent> tracker(object);
+    Inkscape::Debug::EventTracker<RefEvent> tracker(object, RefEvent::UNREF);
     g_object_unref(G_OBJECT(object));
     return NULL;
 }
index 4fb77bbdd4e4c427b51b6546913559dcbc283454..1f3749bda0e6b2763e2e545dc503b001544f2d0a 100644 (file)
@@ -243,7 +243,7 @@ PageSizer::init (Registry& reg)
     table->set_row_spacings (4);
     table->set_col_spacings (4);
     
-    Inkscape::UI::Widget::Button* fit_canv = manage(new Inkscape::UI::Widget::Button(_("_Fit page to selection"),
+    Inkscape::UI::Widget::Button* fit_canv = manage(new Inkscape::UI::Widget::Button(_("Fit page to selection"),
                     _("Resize the page to fit the current selection, or the entire drawing if there is no selection")));
     // prevent fit_canv from expanding
     Gtk::Alignment *fit_canv_cont = manage(new Gtk::Alignment(1.0,0.5,0.0,0.0));
index 204833aa56f53e9596ae1b1b0b49abe5e6dba21b..492da2833ae8efa00083d7ff9d49132ccbedba41 100644 (file)
@@ -61,12 +61,12 @@ static void style_swatch_tool_attr_changed(Inkscape::XML::Node *repr, gchar cons
                                        bool is_interactive, gpointer data)
 {
     Inkscape::UI::Widget::StyleSwatch *ss = (Inkscape::UI::Widget::StyleSwatch *) data;
+
     if (!strcmp (name, "usecurrent")) { // FIXME: watching only for the style attr, no CSS attrs
         if (!strcmp (new_value, "1")) {
-            ss->setWatched (inkscape_get_repr(INKSCAPE, "desktop"), inkscape_get_repr(INKSCAPE, ss->_tool_path));
+            ss->setWatched (inkscape_get_repr(INKSCAPE, "desktop"));
         } else {
-            ss->setWatched (inkscape_get_repr(INKSCAPE, ss->_tool_path), NULL);
+            ss->setWatched (inkscape_get_repr(INKSCAPE, ss->_tool_path));
         }
         // UGLY HACK: we have to reconnect to the watched tool repr again, retrieving it from the stored
         // tool_path, because the actual repr keeps shifting with each change, no idea why
@@ -161,6 +161,7 @@ StyleSwatch::~StyleSwatch()
     }
 
     if (_watched_tool) {
+        std::cout << " =============remove\n";
         sp_repr_remove_listener_by_data(_watched_tool, this);
         Inkscape::GC::release(_watched_tool);
         _watched_tool = NULL;
@@ -169,7 +170,7 @@ StyleSwatch::~StyleSwatch()
 }
 
 void
-StyleSwatch::setWatched(Inkscape::XML::Node *watched, Inkscape::XML::Node *secondary)
+StyleSwatch::setWatched(Inkscape::XML::Node *watched)
 {
     if (_watched) {
         sp_repr_remove_listener_by_data(_watched, this);
@@ -182,18 +183,6 @@ StyleSwatch::setWatched(Inkscape::XML::Node *watched, Inkscape::XML::Node *secon
         Inkscape::GC::anchor(_watched);
         sp_repr_add_listener(_watched, &style_swatch_repr_events, this);
         sp_repr_synthesize_events(_watched, &style_swatch_repr_events, this);
-
-        // If desktop's last-set style is empty, a tool uses its own fixed style even if set to use
-        // last-set (so long as it's empty). To correctly show this, we're passed the second repr,
-        // that of the tool prefs node, from which we now setStyle if the watched repr's style is
-        // empty.
-        if (secondary) {
-            SPCSSAttr *css = sp_repr_css_attr_inherited(watched, "style");
-            if (sp_repr_children((Inkscape::XML::Node *) css) == NULL) { // is css empty?
-                SPCSSAttr *css_secondary = sp_repr_css_attr_inherited(secondary, "style");
-                this->setStyle (css_secondary);
-            }
-        }
     }
 }
 
index 1f7dd2e377e1470030e51f64c71d85b1c89aa62d..a21d6202fab46a1ad9fdb3cf86eafd420cb4240d 100644 (file)
@@ -49,7 +49,7 @@ public:
     void setStyle(SPCSSAttr *attr);
     SPCSSAttr *getStyle();
 
-    void setWatched (Inkscape::XML::Node *watched, Inkscape::XML::Node *secondary);
+    void setWatched (Inkscape::XML::Node *watched);
     void setWatchedTool (const char *path, bool synthesize);
 
     char *_tool_path;
index 3066173e1aad984632efa7f5e8c570d974217a9b..1b8e9e2e2e32e9492b9b434a5b9557682c248e3b 100644 (file)
@@ -4,7 +4,7 @@
  * Authors:
  *   MenTaLguY <mental@rydia.net>
  *
- * Copyright (C) 2006 MenTaLguY
+ * Copyright (C) 2004 MenTaLguY
  *
  * Released under GNU GPL, read the file 'COPYING' for more information
  */