summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: 9328497)
raw | patch | inline | side by side (parent: 9328497)
author | gouldtj <gouldtj@users.sourceforge.net> | |
Tue, 2 May 2006 05:49:17 +0000 (05:49 +0000) | ||
committer | gouldtj <gouldtj@users.sourceforge.net> | |
Tue, 2 May 2006 05:49:17 +0000 (05:49 +0000) |
Backing out version 11530. SVK is so liberating and so frustrating all
at the same time.
at the same time.
14 files changed:
diff --git a/ChangeLog b/ChangeLog
index a44b9d39ccca1db53099622b825b89c773af5508..e98b0264e6624886047d9f5222b612f3bb238841 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
+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:
diff --git a/src/Makefile.am b/src/Makefile.am
index 1f6bcefab4ef3219d04a5c4b6fd66c06322e01ae..6155568a23bd141a1d12e5385da0b2021acee91c 100644 (file)
--- a/src/Makefile.am
+++ b/src/Makefile.am
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) \
check_PROGRAMS = \
test-all \
- mod360-test \
- round-test \
- sp-gradient-test \
- sp-style-elem-test \
style-test \
display/bezier-utils-test \
helper/units-test \
diff --git a/src/Makefile_insert b/src/Makefile_insert
index 18f6b7b039b442fd3a75fc78c5155d6e07fb23a1..531882f8d295cef41ebc666e4fba60fbdac030bd 100644 (file)
--- a/src/Makefile_insert
+++ b/src/Makefile_insert
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)
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 6fab6c1c67d51dcf6574052b9dddd261f74bacdc..7be2545f0d56a4304f99473e6d2bae41e24cf3e5 100644 (file)
GuidelinePropertiesDialog::GuidelinePropertiesDialog(SPGuide *guide, SPDesktop *desktop)
: _desktop(desktop), _guide(guide),
- _adjustment(0.0, -SP_DESKTOP_SCROLL_LIMIT, SP_DESKTOP_SCROLL_LIMIT, 1.0, 10.0, 10.0),
+ _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),
_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 = new GuidelinePropertiesDialog(guide, desktop);
- dialog->_setup();
- dialog->run();
- delete dialog;
+ GuidelinePropertiesDialog dialog(guide, desktop);
+ dialog._setup();
+ dialog.run();
}
void GuidelinePropertiesDialog::_modeChanged()
{
- 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;
+ _mode = !_relative_toggle.get_active();
+ if (!_mode) {
+ _label_move.set_label(_("Move by:"));
} else {
- // 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;
+ _label_move.set_label(_("Move to:"));
}
}
void GuidelinePropertiesDialog::_onApply()
{
gdouble const raw_dist = _spin_button.get_value();
- 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->gobj()));
gdouble const points = sp_units_get_pixels(raw_dist, unit);
gdouble const newpos = ( _mode
? points
Gtk::VBox *mainVBox = get_vbox();
- _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);
+ _layout_table.set_spacings(4);
+ _layout_table.resize (3, 4);
- //labels
- _b3.set_homogeneous(false);
- _b3.set_spacing(4);
- _b2.pack_start(_b3, true, true, 0);
+ mainVBox->pack_start(_layout_table, false, false, 0);
- _label.set_label("foo1");
- _b3.pack_start(_label, true, true, 0);
- _label.set_alignment(1.0, 0.5);
+ _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_id.set_label("foo2");
- _b3.pack_start(_label_id, true, true, 0);
- _label_id.set_alignment(0.0, 0.5);
+ _layout_table.attach(_label_move,
+ 0, 2, 1, 2, Gtk::FILL, Gtk::FILL);
+ _label_move.set_alignment(0, 0.5);
+ _modeChanged();
- _b4.set_homogeneous(false);
- _b4.set_spacing(4);
- _b2.pack_start(_b4, false, false, 0);
+ // indent
+ _layout_table.attach(*manage(new Gtk::Label(" ")),
+ 0, 1, 2, 3, Gtk::FILL, Gtk::FILL, 10);
- // 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);
+ // 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));
// unitmenu
/* fixme: We should allow percents here too, as percents of the canvas size */
- _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);
+ 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));
// 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);
- _b4.pack_start(_spin_button, true, true, 0);
+ _layout_table.attach(_spin_button,
+ 1, 2, 2, 3, Gtk::EXPAND | Gtk::FILL, Gtk::FILL);
gtk_signal_connect_object(GTK_OBJECT(_spin_button.gobj()), "activate",
GTK_SIGNAL_FUNC(gtk_window_activate_default),
gobj());
- gtk_box_pack_start(GTK_BOX(_b4.gobj()), _unit_selector, FALSE, FALSE, 0);
+ _layout_table.attach(*_unit_selector,
+ 2, 3, 2, 3, Gtk::FILL, Gtk::FILL);
// dialog
_oldpos = _guide->position;
{
gchar *guide_description = sp_guide_description(_guide);
- gchar *label = g_strdup_printf(_("Move %s"), guide_description);
- g_free(guide_description);
- _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);
+ gchar *label = g_strdup_printf(_("Moving %s %s"), guide_description, guide_id);
+ g_free(guide_description);
+ _label_descr.set_label(label);
+ g_free(label);
}
- 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 d68ca4044ce69dc81309f2e4e90f186cc0abe44c..d12e34042fd03b6371e5871479677ad40d047d99 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 {
SPDesktop *_desktop;
SPGuide *_guide;
- 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::Table _layout_table;
+ Gtk::Label _label_descr;
+ Gtk::Label _label_move;
+ Inkscape::UI::Widget::CheckButton _relative_toggle;
Gtk::Adjustment _adjustment;
Gtk::SpinButton _spin_button;
- GtkWidget *_unit_selector;
+ Gtk::Widget *_unit_selector;
bool _mode;
gdouble _oldpos;
};
diff --git a/src/dom/domimpl.cpp b/src/dom/domimpl.cpp
index 026dc37c6e0a09e993c53b1f6f81fe6e746a831c..ecbfd123d364da4775ef7287c7b04a9c998c7444 100644 (file)
--- a/src/dom/domimpl.cpp
+++ b/src/dom/domimpl.cpp
/**
*
*/
-NodeImpl::NodeImpl(const NodeImpl &other)
+NodeImpl::NodeImpl(const NodeImpl &other) : Node()
{
init();
assign(other);
diff --git a/src/dom/xpathtoken.cpp b/src/dom/xpathtoken.cpp
index 2d5dfc1d7eab8cd4df627f6a3dbcabff44852dcf..c9d4898d78a723e9705b52e483b2077ef17ba59f 100644 (file)
--- a/src/dom/xpathtoken.cpp
+++ b/src/dom/xpathtoken.cpp
\r
\r
/**\r
- * Return the enumerated TokenType of this token\r
+ * Return the string TokenType of this token\r
* (in the .cpp file)\r
*/\r
DOMString Token::getTypeString()\r
{\r
- DOMString ret;\r
+ DOMString ret = "unknown";\r
for (TokenStringPair *pair = tokenStrings ; pair->sval ; pair++)\r
{\r
if (pair->ival == type)\r
return ret;\r
}\r
\r
+\r
+\r
//########################################################################\r
//# X P A T H A X I S\r
//########################################################################\r
*/\r
Axis::Axis(int tokPos)\r
{\r
- assign(other);\r
+ init();\r
+ tokenPosition = tokPos;\r
}\r
\r
\r
/**\r
*\r
*/\r
-StackItem &StackItem::operator=(const StackItem &other)\r
+Axis::~Axis()\r
+{\r
+}\r
+\r
+\r
+/**\r
+ *\r
+ */\r
+Axis &Axis::operator=(const Axis &other)\r
{\r
assign(other);\r
return *this;\r
/**\r
*\r
*/\r
-void StackItem::assign(const StackItem &other)\r
+void Axis::init()\r
{\r
- sval = other.sval;\r
- ival = other.ival;\r
- dval = other.dval;\r
+ tokenPosition = 0;\r
}\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
+void Axis::assign(const Axis &other)\r
{\r
- ival = 0L;\r
- dval = 0.0;\r
+ tokenPosition = other.tokenPosition;\r
}\r
\r
-\r
/**\r
*\r
*/\r
-StackItem::StackItem(const StackItem &other)\r
+void Axis::setPosition(unsigned int val)\r
{\r
- assign(other);\r
+ tokenPosition = val;\r
}\r
\r
-\r
/**\r
*\r
*/\r
-Stack::~Stack()\r
+unsigned int Axis::getPosition()\r
{\r
+ return tokenPosition;\r
}\r
\r
-\r
/**\r
*\r
*/\r
-void Stack::assign(const Stack &other)\r
+void Axis::setNode(const Node *val)\r
{\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
+ node = (Node *)val;\r
}\r
\r
-\r
/**\r
*\r
*/\r
-void Stack::reset()\r
+Node *Axis::getNode()\r
{\r
- root = NULL;\r
- NodeList n; /*no "clear" in api*/\r
- nodeList = n;\r
- size = 0;\r
+ return node;\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
+{\r
+ ival = 0L;\r
+ dval = 0.0;\r
+}\r
\r
\r
/**\r
*\r
*/\r
-StackItem &StackItem::operator=(const StackItem &other)\r
+StackItem::StackItem(const StackItem &other)\r
{\r
assign(other);\r
- return *this;\r
}\r
\r
+\r
/**\r
*\r
*/\r
-void StackItem::assign(const StackItem &other)\r
+StackItem::~StackItem()\r
{\r
- sval = other.sval;\r
- ival = other.ival;\r
- dval = other.dval;\r
}\r
\r
+\r
/**\r
- * Set the root node\r
+ *\r
*/\r
-void Stack::setRootNode(const Node *node)\r
+StackItem &StackItem::operator=(const StackItem &other)\r
{\r
- root = (Node *)node;\r
+ assign(other);\r
+ return *this;\r
}\r
\r
/**\r
- * Get the current node list;\r
+ *\r
*/\r
-NodeList &Stack::getNodeList()\r
+void StackItem::assign(const StackItem &other)\r
{\r
- return nodeList;\r
+ sval = other.sval;\r
+ ival = other.ival;\r
+ dval = other.dval;\r
}\r
\r
\r
}\r
\r
\r
- Stack stack;\r
- stack.setRootNode(root);\r
-\r
- //### Execute the token list\r
+/**\r
+ *\r
+ */\r
+void TokenList::dump()\r
+{\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->execute(stack);\r
+ tok->dump();\r
}\r
}\r
\r
- list = stack.getNodeList();\r
\r
- return list;\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
}\r
\r
\r
diff --git a/src/dom/xpathtoken.h b/src/dom/xpathtoken.h
index 03175efb1c7050796f7cd9f42955c848b707040c..d595ad43c7aac9a3d4833607a954778064e91c14 100644 (file)
--- a/src/dom/xpathtoken.h
+++ b/src/dom/xpathtoken.h
/**\r
* Assign our values to those of the other\r
*/\r
- virtual void assign(const Stack &other);\r
+ virtual void assign(const TokenExecutor &other);\r
\r
/**\r
* Reset the stack to its original settings\r
virtual StackItem pop();\r
\r
/**\r
- * Set the root node\r
+ * Execute a token list on the stack\r
*/\r
- virtual void setRootNode(const Node *node);\r
+ NodeList execute(const TokenList &list, const Node *node);\r
\r
/**\r
- * Get the current node list;\r
+ *\r
*/\r
- virtual NodeList &getNodeList();\r
+ Axis axis;\r
\r
+ /**\r
+ *\r
+ */\r
+ std::vector<Axis> axisStack;\r
\r
private:\r
\r
- Node *root;\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
NodeList nodeList;\r
\r
- StackItem items[STACK_SIZE];\r
- int size;\r
+\r
};\r
\r
\r
virtual int getType()\r
{ return type; }\r
/**\r
- * Return the enumerated TokenType of this token\r
- * (in the .cpp file)\r
+ * Return the string TokenType of this token\r
*/\r
virtual DOMString getTypeString();\r
\r
* Let this token execute itself on the given stack,\r
* possibly adding Nodes to the node list.\r
*/\r
- virtual bool execute(Stack &stack)\r
+ virtual bool execute(TokenExecutor &stack)\r
{ return true; }\r
\r
/**\r
type = TOK_STR;\r
sval = val;\r
}\r
- virtual bool execute(Stack &stack)\r
+ virtual bool execute(TokenExecutor &exec)\r
{\r
StackItem item;\r
item.sval = sval;\r
type = TOK_FLOAT;\r
dval = val;\r
}\r
- virtual bool execute(Stack &stack)\r
+ virtual bool execute(TokenExecutor &exec)\r
{\r
StackItem item;\r
item.dval = dval;\r
type = TOK_INT;\r
ival = val;\r
}\r
- virtual bool execute(Stack &stack)\r
+ virtual bool execute(TokenExecutor &exec)\r
{\r
StackItem item;\r
item.ival = ival;\r
{\r
type = TOK_AND;\r
}\r
- virtual bool execute(Stack &stack)\r
+ virtual bool execute(TokenExecutor &exec)\r
{\r
StackItem item1 = exec.pop();\r
StackItem item2 = exec.pop();\r
{\r
type = TOK_OR;\r
}\r
- virtual bool execute(Stack &stack)\r
+ virtual bool execute(TokenExecutor &exec)\r
{\r
StackItem item1 = exec.pop();\r
StackItem item2 = exec.pop();\r
{\r
type = TOK_MOD;\r
}\r
- virtual bool execute(Stack &stack)\r
+ virtual bool execute(TokenExecutor &exec)\r
{\r
StackItem item1 = exec.pop();\r
StackItem item2 = exec.pop();\r
{\r
type = TOK_DIV;\r
}\r
- virtual bool execute(Stack &stack)\r
+ virtual bool execute(TokenExecutor &exec)\r
{\r
StackItem item1 = exec.pop();\r
StackItem item2 = exec.pop();\r
{\r
type = TOK_MULTIPLY;\r
}\r
- virtual bool execute(Stack &stack)\r
+ virtual bool execute(TokenExecutor &exec)\r
{\r
StackItem item1 = exec.pop();\r
StackItem item2 = exec.pop();\r
{\r
type = TOK_PLUS;\r
}\r
- virtual bool execute(Stack &stack)\r
+ virtual bool execute(TokenExecutor &exec)\r
{\r
StackItem item1 = exec.pop();\r
StackItem item2 = exec.pop();\r
{\r
type = TOK_MINUS;\r
}\r
- virtual bool execute(Stack &stack)\r
+ virtual bool execute(TokenExecutor &exec)\r
{\r
StackItem item1 = exec.pop();\r
StackItem item2 = exec.pop();\r
{\r
type = TOK_NEG;\r
}\r
- virtual bool execute(Stack &stack)\r
+ virtual bool execute(TokenExecutor &exec)\r
{\r
StackItem item = exec.pop();\r
item.dval = -item.dval;\r
{\r
type = TOK_EQUALS;\r
}\r
- virtual bool execute(Stack &stack)\r
+ virtual bool execute(TokenExecutor &exec)\r
{\r
StackItem item1 = exec.pop();\r
StackItem item2 = exec.pop();\r
{\r
type = TOK_NOT_EQUALS;\r
}\r
- virtual bool execute(Stack &stack)\r
+ virtual bool execute(TokenExecutor &exec)\r
{\r
StackItem item1 = exec.pop();\r
StackItem item2 = exec.pop();\r
{\r
type = TOK_LESS_THAN_EQUALS;\r
}\r
- virtual bool execute(Stack &stack)\r
+ virtual bool execute(TokenExecutor &exec)\r
{\r
StackItem item1 = exec.pop();\r
StackItem item2 = exec.pop();\r
{\r
type = TOK_LESS_THAN;\r
}\r
- virtual bool execute(Stack &stack)\r
+ virtual bool execute(TokenExecutor &exec)\r
{\r
StackItem item1 = exec.pop();\r
StackItem item2 = exec.pop();\r
{\r
type = TOK_GREATER_THAN_EQUALS;\r
}\r
- virtual bool execute(Stack &stack)\r
+ virtual bool execute(TokenExecutor &exec)\r
{\r
StackItem item1 = exec.pop();\r
StackItem item2 = exec.pop();\r
{\r
type = TOK_GREATER_THAN;\r
}\r
- virtual bool execute(Stack &stack)\r
+ virtual bool execute(TokenExecutor &exec)\r
{\r
StackItem item1 = exec.pop();\r
StackItem item2 = exec.pop();\r
{\r
type = TOK_ABSOLUTE;\r
}\r
- virtual bool execute(Stack &stack)\r
+ virtual bool execute(TokenExecutor &exec)\r
{\r
Node *n = exec.axis.getNode();\r
while (n->getParentNode())\r
{\r
type = TOK_RELATIVE;\r
}\r
- virtual bool execute(Stack &stack)\r
+ virtual bool execute(TokenExecutor &exec)\r
{\r
///exec.axis.currentNode = stack.rootNode;\r
return true;\r
{\r
type = TOK_STEP;\r
}\r
- virtual bool execute(Stack &stack)\r
+ virtual bool execute(TokenExecutor &exec)\r
{\r
return true;\r
}\r
type = TOK_NAME_TEST;\r
sval = name;\r
}\r
- virtual bool execute(Stack &stack)\r
+ virtual bool execute(TokenExecutor &exec)\r
{\r
return true;\r
}\r
{\r
type = TOK_EXPR;\r
}\r
- virtual bool execute(Stack &stack)\r
+ virtual bool execute(TokenExecutor &exec)\r
{\r
return true;\r
}\r
{\r
type = TOK_UNION;\r
}\r
- virtual bool execute(Stack &stack)\r
+ virtual bool execute(TokenExecutor &exec)\r
{\r
return true;\r
}\r
{\r
type = TOK_AXIS_ANCESTOR_OR_SELF;\r
}\r
- virtual bool execute(Stack &stack)\r
+ virtual bool execute(TokenExecutor &exec)\r
{\r
return true;\r
}\r
{\r
type = TOK_AXIS_ANCESTOR;\r
}\r
- virtual bool execute(Stack &stack)\r
+ virtual bool execute(TokenExecutor &exec)\r
{\r
return true;\r
}\r
{\r
type = TOK_AXIS_ATTRIBUTE;\r
}\r
- virtual bool execute(Stack &stack)\r
+ virtual bool execute(TokenExecutor &exec)\r
{\r
return true;\r
}\r
{\r
type = TOK_AXIS_CHILD;\r
}\r
- virtual bool execute(Stack &stack)\r
+ virtual bool execute(TokenExecutor &exec)\r
{\r
return true;\r
}\r
{\r
type = TOK_AXIS_DESCENDANT_OR_SELF;\r
}\r
- virtual bool execute(Stack &stack)\r
+ virtual bool execute(TokenExecutor &exec)\r
{\r
return true;\r
}\r
{\r
type = TOK_AXIS_DESCENDANT;\r
}\r
- virtual bool execute(Stack &stack)\r
+ virtual bool execute(TokenExecutor &exec)\r
{\r
return true;\r
}\r
{\r
type = TOK_AXIS_FOLLOWING_SIBLING;\r
}\r
- virtual bool execute(Stack &stack)\r
+ virtual bool execute(TokenExecutor &exec)\r
{\r
return true;\r
}\r
{\r
type = TOK_AXIS_FOLLOWING;\r
}\r
- virtual bool execute(Stack &stack)\r
+ virtual bool execute(TokenExecutor &exec)\r
{\r
return true;\r
}\r
{\r
type = TOK_AXIS_NAMESPACE;\r
}\r
- virtual bool execute(Stack &stack)\r
+ virtual bool execute(TokenExecutor &exec)\r
{\r
return true;\r
}\r
{\r
type = TOK_AXIS_PARENT;\r
}\r
- virtual bool execute(Stack &stack)\r
+ virtual bool execute(TokenExecutor &exec)\r
{\r
return true;\r
}\r
{\r
type = TOK_AXIS_PRECEDING_SIBLING;\r
}\r
- virtual bool execute(Stack &stack)\r
+ virtual bool execute(TokenExecutor &exec)\r
{\r
return true;\r
}\r
{\r
type = TOK_AXIS_PRECEDING;\r
}\r
- virtual bool execute(Stack &stack)\r
+ virtual bool execute(TokenExecutor &exec)\r
{\r
return true;\r
}\r
{\r
type = TOK_AXIS_SELF;\r
}\r
- virtual bool execute(Stack &stack)\r
+ virtual bool execute(TokenExecutor &exec)\r
{\r
return true;\r
}\r
{\r
type = TOK_FUNC_LAST;\r
}\r
- virtual bool execute(Stack &stack)\r
+ virtual bool execute(TokenExecutor &exec)\r
{\r
return true;\r
}\r
{\r
type = TOK_FUNC_POSITION;\r
}\r
- virtual bool execute(Stack &stack)\r
+ virtual bool execute(TokenExecutor &exec)\r
{\r
return true;\r
}\r
{\r
type = TOK_FUNC_COUNT;\r
}\r
- virtual bool execute(Stack &stack)\r
+ virtual bool execute(TokenExecutor &exec)\r
{\r
return true;\r
}\r
{\r
type = TOK_FUNC_ID;\r
}\r
- virtual bool execute(Stack &stack)\r
+ virtual bool execute(TokenExecutor &exec)\r
{\r
return true;\r
}\r
{\r
type = TOK_FUNC_LOCAL_NAME;\r
}\r
- virtual bool execute(Stack &stack)\r
+ virtual bool execute(TokenExecutor &exec)\r
{\r
return true;\r
}\r
{\r
type = TOK_FUNC_NAMESPACE_URI;\r
}\r
- virtual bool execute(Stack &stack)\r
+ virtual bool execute(TokenExecutor &exec)\r
{\r
return true;\r
}\r
{\r
type = TOK_FUNC_NAME;\r
}\r
- virtual bool execute(Stack &stack)\r
+ virtual bool execute(TokenExecutor &exec)\r
{\r
return true;\r
}\r
{\r
type = TOK_FUNC_STRING;\r
}\r
- virtual bool execute(Stack &stack)\r
+ virtual bool execute(TokenExecutor &exec)\r
{\r
return true;\r
}\r
{\r
type = TOK_FUNC_CONCAT;\r
}\r
- virtual bool execute(Stack &stack)\r
+ virtual bool execute(TokenExecutor &exec)\r
{\r
return true;\r
}\r
{\r
type = TOK_FUNC_STARTS_WITH;\r
}\r
- virtual bool execute(Stack &stack)\r
+ virtual bool execute(TokenExecutor &exec)\r
{\r
return true;\r
}\r
{\r
type = TOK_FUNC_CONTAINS;\r
}\r
- virtual bool execute(Stack &stack)\r
+ virtual bool execute(TokenExecutor &exec)\r
{\r
return true;\r
}\r
{\r
type = TOK_FUNC_SUBSTRING_BEFORE;\r
}\r
- virtual bool execute(Stack &stack)\r
+ virtual bool execute(TokenExecutor &exec)\r
{\r
return true;\r
}\r
{\r
type = TOK_FUNC_SUBSTRING_AFTER;\r
}\r
- virtual bool execute(Stack &stack)\r
+ virtual bool execute(TokenExecutor &exec)\r
{\r
return true;\r
}\r
{\r
type = TOK_FUNC_SUBSTRING;\r
}\r
- virtual bool execute(Stack &stack)\r
+ virtual bool execute(TokenExecutor &exec)\r
{\r
return true;\r
}\r
{\r
type = TOK_FUNC_STRING_LENGTH;\r
}\r
- virtual bool execute(Stack &stack)\r
+ virtual bool execute(TokenExecutor &exec)\r
{\r
return true;\r
}\r
{\r
type = TOK_FUNC_NORMALIZE_SPACE;\r
}\r
- virtual bool execute(Stack &stack)\r
+ virtual bool execute(TokenExecutor &exec)\r
{\r
return true;\r
}\r
{\r
type = TOK_FUNC_TRANSLATE;\r
}\r
- virtual bool execute(Stack &stack)\r
+ virtual bool execute(TokenExecutor &exec)\r
{\r
return true;\r
}\r
{\r
type = TOK_FUNC_BOOLEAN;\r
}\r
- virtual bool execute(Stack &stack)\r
+ virtual bool execute(TokenExecutor &exec)\r
{\r
return true;\r
}\r
{\r
type = TOK_FUNC_NOT;\r
}\r
- virtual bool execute(Stack &stack)\r
+ virtual bool execute(TokenExecutor &exec)\r
{\r
return true;\r
}\r
{\r
type = TOK_FUNC_TRUE;\r
}\r
- virtual bool execute(Stack &stack)\r
+ virtual bool execute(TokenExecutor &exec)\r
{\r
return true;\r
}\r
{\r
type = TOK_FUNC_FALSE;\r
}\r
- virtual bool execute(Stack &stack)\r
+ virtual bool execute(TokenExecutor &exec)\r
{\r
return true;\r
}\r
{\r
type = TOK_FUNC_LANG;\r
}\r
- virtual bool execute(Stack &stack)\r
+ virtual bool execute(TokenExecutor &exec)\r
{\r
return true;\r
}\r
{\r
type = TOK_FUNC_NUMBER;\r
}\r
- virtual bool execute(Stack &stack)\r
+ virtual bool execute(TokenExecutor &exec)\r
{\r
return true;\r
}\r
{\r
type = TOK_FUNC_SUM;\r
}\r
- virtual bool execute(Stack &stack)\r
+ virtual bool execute(TokenExecutor &exec)\r
{\r
return true;\r
}\r
{\r
type = TOK_FUNC_FLOOR;\r
}\r
- virtual bool execute(Stack &stack)\r
+ virtual bool execute(TokenExecutor &exec)\r
{\r
return true;\r
}\r
{\r
type = TOK_FUNC_CEILING;\r
}\r
- virtual bool execute(Stack &stack)\r
+ virtual bool execute(TokenExecutor &exec)\r
{\r
return true;\r
}\r
{\r
type = TOK_FUNC_ROUND;\r
}\r
- virtual bool execute(Stack &stack)\r
+ virtual bool execute(TokenExecutor &exec)\r
{\r
return true;\r
}\r
diff --git a/src/gc-anchored.cpp b/src/gc-anchored.cpp
index 285efd69d909767ff742c376de960c31cdc375b9..baf36c0c95c51ffb4670565939b54c2620b36586 100644 (file)
--- a/src/gc-anchored.cpp
+++ b/src/gc-anchored.cpp
#include <typeinfo>
#include "gc-anchored.h"
#include "debug/event-tracker.h"
-#include "debug/event.h"
+#include "debug/simple-event.h"
#include "util/share.h"
#include "util/format.h"
namespace GC {
-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)
- {}
+namespace {
- static Category category() { return REFCOUNT; }
+typedef Debug::SimpleEvent<Debug::Event::REFCOUNT> RefCountEvent;
- 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 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));
}
+};
-private:
- Util::ptr_shared<char> _base;
- Util::ptr_shared<char> _object;
- Util::ptr_shared<char> _class_name;
- Util::ptr_shared<char> _refcount;
- Type _type;
+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"))
+ {}
+};
+
+}
+
Anchored::Anchor *Anchored::_new_anchor() const {
return new Anchor(this);
}
}
void Anchored::anchor() const {
- Debug::EventTracker<AnchorEvent> tracker(this, AnchorEvent::ANCHOR);
+ Debug::EventTracker<AnchorEvent> tracker(this);
if (!_anchor) {
_anchor = _new_anchor();
}
}
void Anchored::release() const {
- Debug::EventTracker<AnchorEvent> tracker(this, AnchorEvent::RELEASE);
+ Debug::EventTracker<ReleaseEvent> tracker(this);
if (!--_anchor->refcount) {
_free_anchor(_anchor);
_anchor = NULL;
diff --git a/src/sp-object.cpp b/src/sp-object.cpp
index 68865fb0e5a9ed8625d10bee2cb6e11cd1938128..fbe16e957b826874d0657b99eb1b70eb532457d7 100644 (file)
--- a/src/sp-object.cpp
+++ b/src/sp-object.cpp
}
};
- 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 RefEvent : public RefCountEvent {
+public:
+ RefEvent(SPObject *object)
+ : RefCountEvent(object, 1, Util::share_static_string("sp-object-ref"))
{}
};
- 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;
+class UnrefEvent : public RefCountEvent {
+public:
+ UnrefEvent(SPObject *object)
+ : RefCountEvent(object, -1, Util::share_static_string("sp-object-unref"))
+ {}
};
}
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, RefEvent::REF);
+ Inkscape::Debug::EventTracker<RefEvent> tracker(object);
g_object_ref(G_OBJECT(object));
return object;
}
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, RefEvent::UNREF);
+ Inkscape::Debug::EventTracker<UnrefEvent> tracker(object);
g_object_unref(G_OBJECT(object));
return NULL;
}
index 1f3749bda0e6b2763e2e545dc503b001544f2d0a..4fb77bbdd4e4c427b51b6546913559dcbc283454 100644 (file)
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 492da2833ae8efa00083d7ff9d49132ccbedba41..204833aa56f53e9596ae1b1b0b49abe5e6dba21b 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"));
+ ss->setWatched (inkscape_get_repr(INKSCAPE, "desktop"), inkscape_get_repr(INKSCAPE, ss->_tool_path));
} else {
- ss->setWatched (inkscape_get_repr(INKSCAPE, ss->_tool_path));
+ ss->setWatched (inkscape_get_repr(INKSCAPE, ss->_tool_path), NULL);
}
// 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
}
if (_watched_tool) {
- std::cout << " =============remove\n";
sp_repr_remove_listener_by_data(_watched_tool, this);
Inkscape::GC::release(_watched_tool);
_watched_tool = NULL;
}
void
-StyleSwatch::setWatched(Inkscape::XML::Node *watched)
+StyleSwatch::setWatched(Inkscape::XML::Node *watched, Inkscape::XML::Node *secondary)
{
if (_watched) {
sp_repr_remove_listener_by_data(_watched, this);
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 a21d6202fab46a1ad9fdb3cf86eafd420cb4240d..1f7dd2e377e1470030e51f64c71d85b1c89aa62d 100644 (file)
void setStyle(SPCSSAttr *attr);
SPCSSAttr *getStyle();
- void setWatched (Inkscape::XML::Node *watched);
+ void setWatched (Inkscape::XML::Node *watched, Inkscape::XML::Node *secondary);
void setWatchedTool (const char *path, bool synthesize);
char *_tool_path;
diff --git a/src/util/format.h b/src/util/format.h
index 1b8e9e2e2e32e9492b9b434a5b9557682c248e3b..3066173e1aad984632efa7f5e8c570d974217a9b 100644 (file)
--- a/src/util/format.h
+++ b/src/util/format.h
* Authors:
* MenTaLguY <mental@rydia.net>
*
- * Copyright (C) 2004 MenTaLguY
+ * Copyright (C) 2006 MenTaLguY
*
* Released under GNU GPL, read the file 'COPYING' for more information
*/