summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLiam P. White <inkscapebrony@gmail.com>2014-06-27 19:23:06 +0000
committerLiam P. White <inkscapebrony@gmail.com>2014-06-27 19:23:06 +0000
commit45f373f3319b598d8e0222fb48e9d3a4760b2044 (patch)
tree846a9ec382567267b09e63c3dde2e1f20cbbffb5
parentMove constructor/destructor into private section, remove protected section. R... (diff)
downloadinkscape-45f373f3319b598d8e0222fb48e9d3a4760b2044.tar.gz
inkscape-45f373f3319b598d8e0222fb48e9d3a4760b2044.zip
5. Refactoring of Application class: make copy/assignment operators private, disallow pointers to Application
(bzr r13341.5.9)
-rw-r--r--src/box3d.cpp2
-rw-r--r--src/conn-avoid-ref.cpp4
-rw-r--r--src/desktop.cpp58
-rw-r--r--src/desktop.h2
-rw-r--r--src/dialogs/dialog-events.cpp5
-rw-r--r--src/dialogs/dialog-events.h12
-rw-r--r--src/document-undo.cpp4
-rw-r--r--src/document-undo.h2
-rw-r--r--src/document.cpp4
-rw-r--r--src/document.h1
-rw-r--r--src/extension/effect.cpp8
-rw-r--r--src/extension/implementation/script.cpp2
-rw-r--r--src/extension/internal/cdr-input.cpp2
-rw-r--r--src/extension/internal/pdfinput/pdf-input.cpp2
-rw-r--r--src/extension/internal/vsd-input.cpp2
-rw-r--r--src/extension/system.cpp2
-rw-r--r--src/file.cpp2
-rw-r--r--src/graphlayout.cpp2
-rw-r--r--src/helper/stock-items.cpp4
-rw-r--r--src/inkscape.cpp76
-rw-r--r--src/inkscape.h27
-rw-r--r--src/inkview.cpp6
-rw-r--r--src/interface.cpp10
-rw-r--r--src/line-geometry.cpp4
-rw-r--r--src/live_effects/effect.cpp2
-rw-r--r--src/live_effects/lpe-bspline.cpp4
-rw-r--r--src/live_effects/lpe-envelope-perspective.cpp2
-rw-r--r--src/live_effects/lpe-lattice2.cpp2
-rw-r--r--src/live_effects/parameter/text.cpp2
-rw-r--r--src/main-cmdlineact.cpp2
-rw-r--r--src/main.cpp12
-rw-r--r--src/persp3d.cpp8
-rw-r--r--src/selection-chemistry.cpp2
-rw-r--r--src/selection.cpp4
-rw-r--r--src/sp-item.cpp6
-rw-r--r--src/tools-switch.cpp2
-rw-r--r--src/ui/dialog/align-and-distribute.cpp4
-rw-r--r--src/ui/dialog/clonetiler.cpp4
-rw-r--r--src/ui/dialog/desktop-tracker.cpp2
-rw-r--r--src/ui/dialog/desktop-tracker.h2
-rw-r--r--src/ui/dialog/dialog.cpp8
-rw-r--r--src/ui/dialog/dialog.h2
-rw-r--r--src/ui/dialog/document-metadata.cpp4
-rw-r--r--src/ui/dialog/document-metadata.h5
-rw-r--r--src/ui/dialog/document-properties.cpp4
-rw-r--r--src/ui/dialog/document-properties.h4
-rw-r--r--src/ui/dialog/export.cpp2
-rw-r--r--src/ui/dialog/filedialogimpl-gtkmm.cpp3
-rw-r--r--src/ui/dialog/fill-and-stroke.h3
-rw-r--r--src/ui/dialog/grid-arrange-tab.cpp2
-rw-r--r--src/ui/dialog/panel-dialog.h30
-rw-r--r--src/ui/dialog/symbols.cpp2
-rw-r--r--src/ui/dialog/transformation.cpp4
-rw-r--r--src/ui/tools/connector-tool.cpp2
-rw-r--r--src/ui/view/view.cpp6
-rw-r--r--src/ui/widget/dock.cpp4
-rw-r--r--src/ui/widget/imageicon.cpp2
-rw-r--r--src/ui/widget/object-composite-settings.h5
-rw-r--r--src/ui/widget/panel.cpp6
-rw-r--r--src/ui/widget/panel.h9
-rw-r--r--src/vanishing-point.cpp22
-rw-r--r--src/verbs.cpp18
-rw-r--r--src/widgets/box3d-toolbar.cpp2
-rw-r--r--src/widgets/desktop-widget.cpp8
-rw-r--r--src/widgets/gradient-vector.cpp11
-rw-r--r--src/widgets/select-toolbar.cpp2
-rw-r--r--src/widgets/sp-widget.cpp110
-rw-r--r--src/widgets/sp-widget.h7
-rw-r--r--src/widgets/stroke-marker-selector.cpp2
69 files changed, 286 insertions, 306 deletions
diff --git a/src/box3d.cpp b/src/box3d.cpp
index 080ff2e21..a47dce1b3 100644
--- a/src/box3d.cpp
+++ b/src/box3d.cpp
@@ -403,7 +403,7 @@ box3d_snap (SPBox3D *box, int id, Proj::Pt3 const &pt_proj, Proj::Pt3 const &sta
snap_pts[3] = diag2.closest_to (pt);
}
- gdouble const zoom = INKSCAPE->active_desktop()->current_zoom();
+ gdouble const zoom = INKSCAPE.active_desktop()->current_zoom();
// determine the distances to all potential snapping points
double snap_dists[MAX_POINT_COUNT];
diff --git a/src/conn-avoid-ref.cpp b/src/conn-avoid-ref.cpp
index cb72f65dc..cbc8faf7c 100644
--- a/src/conn-avoid-ref.cpp
+++ b/src/conn-avoid-ref.cpp
@@ -87,7 +87,7 @@ void SPAvoidRef::setAvoid(char const *value)
void SPAvoidRef::handleSettingChange(void)
{
- SPDesktop *desktop = inkscape_active_desktop();
+ SPDesktop *desktop = INKSCAPE.active_desktop();
if (desktop == NULL) {
return;
}
@@ -277,7 +277,7 @@ static std::vector<Geom::Point> approxItemWithPoints(SPItem const *item, const G
}
static Avoid::Polygon avoid_item_poly(SPItem const *item)
{
- SPDesktop *desktop = inkscape_active_desktop();
+ SPDesktop *desktop = INKSCAPE.active_desktop();
g_assert(desktop != NULL);
double spacing = desktop->namedview->connector_spacing;
diff --git a/src/desktop.cpp b/src/desktop.cpp
index 935567462..542f1618b 100644
--- a/src/desktop.cpp
+++ b/src/desktop.cpp
@@ -93,28 +93,28 @@ static void _reconstruction_finish(SPDesktop * desktop);
static void _namedview_modified (SPObject *obj, guint flags, SPDesktop *desktop);
SPDesktop::SPDesktop() :
- _dlg_mgr( 0 ),
- namedview( 0 ),
- canvas( 0 ),
- layers( 0 ),
- selection( 0 ),
- event_context( 0 ),
- layer_manager( 0 ),
- event_log( 0 ),
- temporary_item_list( 0 ),
- snapindicator( 0 ),
- acetate( 0 ),
- main( 0 ),
- gridgroup( 0 ),
- guides( 0 ),
- drawing( 0 ),
- sketch( 0 ),
- controls( 0 ),
- tempgroup ( 0 ),
- table( 0 ),
- page( 0 ),
- page_border( 0 ),
- current( 0 ),
+ _dlg_mgr( NULL ),
+ namedview( NULL ),
+ canvas( NULL ),
+ layers( NULL ),
+ selection( NULL ),
+ event_context( NULL ),
+ layer_manager( NULL ),
+ event_log( NULL ),
+ temporary_item_list( NULL ),
+ snapindicator( NULL ),
+ acetate( NULL ),
+ main( NULL ),
+ gridgroup( NULL ),
+ guides( NULL ),
+ drawing( NULL ),
+ sketch( NULL ),
+ controls( NULL ),
+ tempgroup ( NULL ),
+ table( NULL ),
+ page( NULL ),
+ page_border( NULL ),
+ current( NULL ),
_focusMode(false),
dkey( 0 ),
number( 0 ),
@@ -123,16 +123,15 @@ SPDesktop::SPDesktop() :
waiting_cursor( false ),
showing_dialogs ( false ),
guides_active( false ),
- gr_item( 0 ),
+ gr_item( NULL ),
gr_point_type( POINT_LG_BEGIN ),
gr_point_i( 0 ),
gr_fill_or_stroke( Inkscape::FOR_FILL ),
_reconstruction_old_layer_id(), // an id attribute is not allowed to be the empty string
_display_mode(Inkscape::RENDERMODE_NORMAL),
_display_color_mode(Inkscape::COLORMODE_NORMAL),
- _widget( 0 ),
- _inkscape( 0 ),
- _guides_message_context( 0 ),
+ _widget( NULL ),
+ _guides_message_context( NULL ),
_active( false ),
_w2d(),
_d2w(),
@@ -298,7 +297,6 @@ SPDesktop::init (SPNamedView *nv, SPCanvas *aCanvas, Inkscape::UI::View::EditWid
// ?
// sp_active_desktop_set (desktop);
- _inkscape = INKSCAPE;
_activate_connection = _activate_signal.connect(
sigc::bind(
@@ -384,10 +382,6 @@ void SPDesktop::destroy()
layer_manager = NULL;
}
- if (_inkscape) {
- _inkscape = NULL;
- }
-
if (drawing) {
doc()->getRoot()->invoke_hide(dkey);
g_object_unref(drawing);
@@ -1430,7 +1424,7 @@ void
SPDesktop::emitToolSubselectionChanged(gpointer data)
{
_tool_subselection_changed.emit(data);
- INKSCAPE->subselection_changed (this);
+ INKSCAPE.subselection_changed (this);
}
void SPDesktop::updateNow()
diff --git a/src/desktop.h b/src/desktop.h
index ec240dd40..2c0275b51 100644
--- a/src/desktop.h
+++ b/src/desktop.h
@@ -73,7 +73,6 @@ struct _GdkEventWindowState;
typedef struct _GdkEventWindowState GdkEventWindowState;
namespace Inkscape {
- struct Application;
class LayerModel;
class MessageContext;
class Selection;
@@ -423,7 +422,6 @@ public:
private:
Inkscape::UI::View::EditWidgetInterface *_widget;
- Inkscape::Application *_inkscape;
Inkscape::MessageContext *_guides_message_context;
bool _active;
Geom::Affine _w2d;
diff --git a/src/dialogs/dialog-events.cpp b/src/dialogs/dialog-events.cpp
index 01213f1c7..c1d096197 100644
--- a/src/dialogs/dialog-events.cpp
+++ b/src/dialogs/dialog-events.cpp
@@ -183,12 +183,11 @@ void sp_transientize(GtkWidget *dialog)
void on_transientize (SPDesktop *desktop, win_data *wd )
{
- sp_transientize_callback (0, desktop, wd);
+ sp_transientize_callback (desktop, wd);
}
void
-sp_transientize_callback ( Inkscape::Application * /*inkscape*/,
- SPDesktop *desktop, win_data *wd )
+sp_transientize_callback ( SPDesktop *desktop, win_data *wd )
{
Inkscape::Preferences *prefs = Inkscape::Preferences::get();
gint transient_policy = prefs->getIntLimited( "/options/transientpolicy/value", 1, 0, 2);
diff --git a/src/dialogs/dialog-events.h b/src/dialogs/dialog-events.h
index 5320685b2..b4a5d7c35 100644
--- a/src/dialogs/dialog-events.h
+++ b/src/dialogs/dialog-events.h
@@ -28,10 +28,6 @@ class Entry;
}
class SPDesktop;
-
-namespace Inkscape {
-struct Application;
-} // namespace Inkscape
typedef struct {
GtkWidget *win;
@@ -55,14 +51,14 @@ void sp_transientize ( GtkWidget *win );
void on_transientize ( SPDesktop *desktop,
win_data *wd );
-void sp_transientize_callback ( Inkscape::Application *inkscape,
- SPDesktop *desktop,
+void sp_transientize_callback ( SPDesktop *desktop,
win_data *wd );
void on_dialog_hide (GtkWidget *w);
void on_dialog_unhide (GtkWidget *w);
-gboolean sp_dialog_hide (GObject *object, gpointer data);
-gboolean sp_dialog_unhide (GObject *object, gpointer data);
+
+//gboolean sp_dialog_hide (GObject *object, gpointer data);
+//gboolean sp_dialog_unhide (GObject *object, gpointer data);
#endif
diff --git a/src/document-undo.cpp b/src/document-undo.cpp
index a40b2fb81..0bce4420a 100644
--- a/src/document-undo.cpp
+++ b/src/document-undo.cpp
@@ -270,7 +270,7 @@ gboolean Inkscape::DocumentUndo::undo(SPDocument *doc)
doc->priv->seeking = false;
if (ret)
- INKSCAPE->external_change();
+ INKSCAPE.external_change();
return ret;
}
@@ -315,7 +315,7 @@ gboolean Inkscape::DocumentUndo::redo(SPDocument *doc)
doc->priv->seeking = false;
if (ret)
- INKSCAPE->external_change();
+ INKSCAPE.external_change();
return ret;
}
diff --git a/src/document-undo.h b/src/document-undo.h
index 8333e715a..2236626c8 100644
--- a/src/document-undo.h
+++ b/src/document-undo.h
@@ -12,8 +12,6 @@ class SPDocument;
namespace Inkscape {
-struct Application;
-
class DocumentUndo
{
public:
diff --git a/src/document.cpp b/src/document.cpp
index 000888772..c38cfa4ae 100644
--- a/src/document.cpp
+++ b/src/document.cpp
@@ -462,11 +462,11 @@ SPDocument *SPDocument::createDoc(Inkscape::XML::Document *rdoc,
DocumentUndo::setUndoSensitive(document, true);
// reset undo key when selection changes, so that same-key actions on different objects are not coalesced
- document->priv->selChangeConnection = INKSCAPE->signal_selection_changed.connect(
+ document->priv->selChangeConnection = INKSCAPE.signal_selection_changed.connect(
sigc::hide(sigc::bind(
sigc::ptr_fun(&DocumentUndo::resetKey), document)
));
- document->priv->desktopActivatedConnection = INKSCAPE->signal_activate_desktop.connect(
+ document->priv->desktopActivatedConnection = INKSCAPE.signal_activate_desktop.connect(
sigc::hide(sigc::bind(
sigc::ptr_fun(&DocumentUndo::resetKey), document)
));
diff --git a/src/document.h b/src/document.h
index ee903449d..7574e1bda 100644
--- a/src/document.h
+++ b/src/document.h
@@ -38,7 +38,6 @@ class SPGroup;
class SPRoot;
namespace Inkscape {
- struct Application;
class Selection;
class UndoStackObserver;
class EventLog;
diff --git a/src/extension/effect.cpp b/src/extension/effect.cpp
index c68845d8a..c8f3b2ff9 100644
--- a/src/extension/effect.cpp
+++ b/src/extension/effect.cpp
@@ -89,11 +89,13 @@ Effect::Effect (Inkscape::XML::Node * in_repr, Implementation::Implementation *
} // children of "inkscape-extension"
} // if we have an XML file
- if (INKSCAPE != NULL && INKSCAPE->use_gui()) {
+ // \TODO this gets called from the Inkscape::Application constructor, where it initializes the menus.
+ // But in the constructor, our object isn't quite there yet!
+ if (Inkscape::Application::exists() && INKSCAPE.use_gui()) {
if (_effects_list == NULL)
- _effects_list = find_menu(INKSCAPE->get_menus(), EFFECTS_LIST);
+ _effects_list = find_menu(INKSCAPE.get_menus(), EFFECTS_LIST);
if (_filters_list == NULL)
- _filters_list = find_menu(INKSCAPE->get_menus(), FILTERS_LIST);
+ _filters_list = find_menu(INKSCAPE.get_menus(), FILTERS_LIST);
}
if ((_effects_list != NULL || _filters_list != NULL)) {
diff --git a/src/extension/implementation/script.cpp b/src/extension/implementation/script.cpp
index bacb126ef..976cf42fc 100644
--- a/src/extension/implementation/script.cpp
+++ b/src/extension/implementation/script.cpp
@@ -1031,7 +1031,7 @@ int Script::execute (const std::list<std::string> &in_command,
Glib::ustring stderr_data = fileerr.string();
if (stderr_data.length() != 0 &&
- INKSCAPE->use_gui()
+ INKSCAPE.use_gui()
) {
checkStderr(stderr_data, Gtk::MESSAGE_INFO,
_("Inkscape has received additional data from the script executed. "
diff --git a/src/extension/internal/cdr-input.cpp b/src/extension/internal/cdr-input.cpp
index 6048c232c..ffbfcc5e5 100644
--- a/src/extension/internal/cdr-input.cpp
+++ b/src/extension/internal/cdr-input.cpp
@@ -237,7 +237,7 @@ SPDocument *CdrInput::open(Inkscape::Extension::Input * /*mod*/, const gchar * u
// If only one page is present, import that one without bothering user
if (tmpSVGOutput.size() > 1) {
CdrImportDialog *dlg = 0;
- if (INKSCAPE->use_gui()) {
+ if (INKSCAPE.use_gui()) {
dlg = new CdrImportDialog(tmpSVGOutput);
if (!dlg->showDialog()) {
delete dlg;
diff --git a/src/extension/internal/pdfinput/pdf-input.cpp b/src/extension/internal/pdfinput/pdf-input.cpp
index fbb8b0793..bcaa8712f 100644
--- a/src/extension/internal/pdfinput/pdf-input.cpp
+++ b/src/extension/internal/pdfinput/pdf-input.cpp
@@ -696,7 +696,7 @@ PdfInput::open(::Inkscape::Extension::Input * /*mod*/, const gchar * uri) {
}
PdfImportDialog *dlg = NULL;
- if (INKSCAPE->use_gui()) {
+ if (INKSCAPE.use_gui()) {
dlg = new PdfImportDialog(pdf_doc, uri);
if (!dlg->showDialog()) {
_cancelled = true;
diff --git a/src/extension/internal/vsd-input.cpp b/src/extension/internal/vsd-input.cpp
index 6b435746b..ab51bbd73 100644
--- a/src/extension/internal/vsd-input.cpp
+++ b/src/extension/internal/vsd-input.cpp
@@ -236,7 +236,7 @@ SPDocument *VsdInput::open(Inkscape::Extension::Input * /*mod*/, const gchar * u
// If only one page is present, import that one without bothering user
if (tmpSVGOutput.size() > 1) {
VsdImportDialog *dlg = 0;
- if (INKSCAPE->use_gui()) {
+ if (INKSCAPE.use_gui()) {
dlg = new VsdImportDialog(tmpSVGOutput);
if (!dlg->showDialog()) {
delete dlg;
diff --git a/src/extension/system.cpp b/src/extension/system.cpp
index e81ec0e42..651964912 100644
--- a/src/extension/system.cpp
+++ b/src/extension/system.cpp
@@ -121,7 +121,7 @@ SPDocument *open(Extension *key, gchar const *filename)
}
if (last_chance_svg) {
- if ( INKSCAPE->use_gui() ) {
+ if ( INKSCAPE.use_gui() ) {
sp_ui_error_dialog(_("Format autodetect failed. The file is being opened as SVG."));
} else {
g_warning("%s", _("Format autodetect failed. The file is being opened as SVG."));
diff --git a/src/file.cpp b/src/file.cpp
index 99bfcc77f..be2c8ff2c 100644
--- a/src/file.cpp
+++ b/src/file.cpp
@@ -314,7 +314,7 @@ bool sp_file_open(const Glib::ustring &uri,
sp_file_add_recent( doc->getURI() );
}
- if ( INKSCAPE->use_gui() ) {
+ if ( INKSCAPE.use_gui() ) {
// Perform a fixup pass for hrefs.
if ( Inkscape::ResourceManager::getManager().fixupBrokenLinks(doc) ) {
Glib::ustring msg = _("Broken links have been changed to point to existing files.");
diff --git a/src/graphlayout.cpp b/src/graphlayout.cpp
index 18159cb41..43b424f46 100644
--- a/src/graphlayout.cpp
+++ b/src/graphlayout.cpp
@@ -117,7 +117,7 @@ void graphlayout(GSList const *const items) {
// add the connector spacing to the size of node bounding boxes
// so that connectors can always be routed between shapes
- SPDesktop* desktop = inkscape_active_desktop();
+ SPDesktop* desktop = INKSCAPE.active_desktop();
double spacing = 0;
if(desktop) spacing = desktop->namedview->connector_spacing+0.1;
diff --git a/src/helper/stock-items.cpp b/src/helper/stock-items.cpp
index a12fa377a..58a8a7dfc 100644
--- a/src/helper/stock-items.cpp
+++ b/src/helper/stock-items.cpp
@@ -195,7 +195,7 @@ SPObject *get_stock_item(gchar const *urn, gboolean stock)
gchar * base = g_strndup(e, a);
- SPDesktop *desktop = inkscape_active_desktop();
+ SPDesktop *desktop = INKSCAPE.active_desktop();
SPDocument *doc = sp_desktop_document(desktop);
SPDefs *defs = doc->getDefs();
if (!defs) {
@@ -265,7 +265,7 @@ SPObject *get_stock_item(gchar const *urn, gboolean stock)
else {
- SPDesktop *desktop = inkscape_active_desktop();
+ SPDesktop *desktop = INKSCAPE.active_desktop();
SPDocument *doc = sp_desktop_document(desktop);
SPObject *object = doc->getObjectById(urn);
diff --git a/src/inkscape.cpp b/src/inkscape.cpp
index 89501c646..cca6918e2 100644
--- a/src/inkscape.cpp
+++ b/src/inkscape.cpp
@@ -81,7 +81,7 @@
Inkscape::Application * Inkscape::Application::_S_inst = NULL;
bool Inkscape::Application::_crashIsHappening = false;
-#define DESKTOP_IS_ACTIVE(d) (!INKSCAPE->_desktops->empty() && ((d) == INKSCAPE->_desktops->front()))
+#define DESKTOP_IS_ACTIVE(d) (!INKSCAPE._desktops->empty() && ((d) == INKSCAPE._desktops->front()))
static void (* segv_handler) (int) = SIG_DFL;
static void (* abrt_handler) (int) = SIG_DFL;
@@ -139,53 +139,77 @@ private:
bool _useGui;
};
-Inkscape::Application * inkscape_ref(Inkscape::Application * in)
+void inkscape_ref(Inkscape::Application & in)
{
- g_return_val_if_fail(in != NULL, NULL);
-
- in->refCount++;
- return in;
+ in.refCount++;
}
-Inkscape::Application * inkscape_unref(Inkscape::Application * in)
+void inkscape_unref(Inkscape::Application & in)
{
- g_return_val_if_fail(in != NULL, NULL);
-
- in->refCount--;
+ in.refCount--;
- if (in->refCount <= 0) {
- delete in;
+ if (&in == Inkscape::Application::_S_inst) {
+ if (in.refCount <= 0) {
+ delete Inkscape::Application::_S_inst;
+ }
+ } else {
+ g_error("Attempt to unref an Application (=%p) not the current instance (=%p) (maybe it's already been destroyed?)",
+ &in, Inkscape::Application::_S_inst);
}
-
- return NULL;
}
// Callback passed to g_timeout_add_seconds()
// gets the current instance and calls autosave()
int inkscape_autosave(gpointer) {
- g_assert(INKSCAPE != NULL);
- return INKSCAPE->autosave();
+ g_assert(Inkscape::Application::exists());
+ return INKSCAPE.autosave();
}
namespace Inkscape {
+/**
+ * Defined only for debugging purposes. If we are certain the bugs are gone we can remove this
+ * and the references in inkscape_ref and inkscape_unref.
+ */
+Application*
+Application::operator &() const
+{
+ return const_cast<Application*>(this);
+}
+/**
+ * Creates a new Inkscape::Application global object.
+ */
void
Application::create(const char *argv0, bool use_gui)
{
- if (!Application::instance()) {
+ if (!Application::exists()) {
new Application(argv0, use_gui);
} else {
g_assert_not_reached();
}
}
+
+/**
+ * Checks whether the current Inkscape::Application global object exists.
+ */
+bool
+Application::exists()
+{
+ return Application::_S_inst != NULL;
+}
+
/**
- * Returns the current Inkscape::Application global object
+ * Returns the current Inkscape::Application global object.
+ * \pre Application::_S_inst != NULL
*/
-Application *
+Application&
Application::instance()
{
- return Application::_S_inst;
+ if (!exists()) {
+ g_error("Inkscape::Application does not yet exist.");
+ }
+ return *Application::_S_inst;
}
/**
@@ -469,6 +493,8 @@ Application::~Application()
_argv0 = NULL;
}
+ _S_inst = NULL; // this will probably break things
+
refCount = 0;
gtk_main_quit ();
}
@@ -527,10 +553,10 @@ Application::crash_handler (int /*signum*/)
gint count = 0;
gchar *curdir = g_get_current_dir(); // This one needs to be freed explicitly
- gchar *inkscapedir = g_path_get_dirname(INKSCAPE->_argv0); // Needs to be freed
+ gchar *inkscapedir = g_path_get_dirname(INKSCAPE._argv0); // Needs to be freed
GSList *savednames = NULL;
GSList *failednames = NULL;
- for (std::map<SPDocument*,int>::iterator iter = INKSCAPE->_document_set.begin(), e = INKSCAPE->_document_set.end();
+ for (std::map<SPDocument*,int>::iterator iter = INKSCAPE._document_set.begin(), e = INKSCAPE._document_set.end();
iter != e;
++iter) {
SPDocument *doc = iter->first;
@@ -672,7 +698,7 @@ Application::crash_handler (int /*signum*/)
}
*(b + pos) = '\0';
- if ( instance() && instance()->use_gui() ) {
+ if ( exists() && instance().use_gui() ) {
GtkWidget *msgbox = gtk_message_dialog_new (NULL, GTK_DIALOG_MODAL, GTK_MESSAGE_ERROR, GTK_BUTTONS_CLOSE, "%s", b);
gtk_dialog_run (GTK_DIALOG (msgbox));
gtk_widget_destroy (msgbox);
@@ -1190,8 +1216,8 @@ Application::homedir_path(const char *filename)
homedir = g_get_home_dir();
}
if (!homedir) {
- if (Application::instance()) {
- homedir = g_path_get_dirname(Application::instance()->_argv0);
+ if (Application::exists()) {
+ homedir = g_path_get_dirname(Application::instance()._argv0);
}
}
return g_build_filename(homedir, filename, NULL);
diff --git a/src/inkscape.h b/src/inkscape.h
index 966b6ee87..fe424377c 100644
--- a/src/inkscape.h
+++ b/src/inkscape.h
@@ -45,17 +45,13 @@ struct Document;
} // namespace Inkscape
-Inkscape::Application * inkscape_ref (Inkscape::Application * in);
-Inkscape::Application * inkscape_unref(Inkscape::Application * in);
+void inkscape_ref (Inkscape::Application & in);
+void inkscape_unref(Inkscape::Application & in);
#define INKSCAPE (Inkscape::Application::instance())
-#define SP_INKSCAPE(obj) (dynamic_cast<Inkscape::Application*>(obj))
-#define SP_IS_INKSCAPE(obj) (dynamic_cast<Inkscape::Application*> (obj) != NULL)
-#define SP_ACTIVE_EVENTCONTEXT (INKSCAPE->active_event_context())
-#define SP_ACTIVE_DOCUMENT (INKSCAPE->active_document())
-#define SP_ACTIVE_DESKTOP (INKSCAPE->active_desktop())
-// \TODO hack
-#define inkscape_active_desktop() SP_ACTIVE_DESKTOP
+#define SP_ACTIVE_EVENTCONTEXT (INKSCAPE.active_event_context())
+#define SP_ACTIVE_DOCUMENT (INKSCAPE.active_document())
+#define SP_ACTIVE_DESKTOP (INKSCAPE.active_desktop())
class AppSelectionModel {
Inkscape::LayerModel _layer_model;
@@ -77,7 +73,8 @@ namespace Inkscape {
class Application {
public:
- static Application* instance();
+ static Application& instance();
+ static bool exists();
static void create(const char* argv0, bool use_gui);
// returns the mask of the keyboard modifier to map to Alt, zero if no mapping
@@ -110,8 +107,6 @@ public:
bool save_menus();
Inkscape::XML::Node * get_menus();
- //static Inkscape::Application* get_instance();
-
Inkscape::UI::Tools::ToolBase * active_event_context();
SPDocument * active_document();
SPDesktop * active_desktop();
@@ -166,8 +161,8 @@ public:
int autosave();
// nobody should be accessing our reference count, so it's made private.
- friend Application * ::inkscape_ref (Application * in);
- friend Application * ::inkscape_unref(Application * in);
+ friend void ::inkscape_ref (Application & in);
+ friend void ::inkscape_unref(Application & in);
// signals
@@ -206,6 +201,10 @@ private:
Application(const char* argv0, bool use_gui);
~Application();
+ Application(Application const&); // no copy
+ Application& operator=(Application const&); // no assign
+ Application* operator&() const; // no pointer access
+
Inkscape::XML::Document * _menus;
std::map<SPDocument *, int> _document_set;
std::map<SPDocument *, AppSelectionModel *> _selection_models;
diff --git a/src/inkview.cpp b/src/inkview.cpp
index 721b4784f..a44d755eb 100644
--- a/src/inkview.cpp
+++ b/src/inkview.cpp
@@ -62,8 +62,6 @@
#include "inkscape.h"
-Inkscape::Application *inkscape;
-
#include <iostream>
#ifndef HAVE_BIND_TEXTDOMAIN_CODESET
@@ -233,7 +231,7 @@ main (int argc, const char **argv)
ss.fullscreen = false;
Inkscape::Application::create(argv[0], true);
- inkscape = Inkscape::Application::instance();
+ //Inkscape::Application &inkscape = Inkscape::Application::instance();
// starting at where the commandline options stopped parsing because
// we want all the files to be in the list
@@ -571,7 +569,7 @@ static void usage()
exit(1);
}
-#ifdef XXX
+#if 0
/* TODO !!! make this temporary stub unnecessary */
Inkscape::Application *inkscape_get_instance() { return NULL; }
void inkscape_ref (void) {}
diff --git a/src/interface.cpp b/src/interface.cpp
index 7fd2b6275..85cdbaf84 100644
--- a/src/interface.cpp
+++ b/src/interface.cpp
@@ -270,7 +270,7 @@ sp_create_window(SPViewWidget *vw, gboolean editable)
// needed because the first ACTIVATE_DESKTOP was sent when there was no window yet
if ( SP_IS_DESKTOP_WIDGET(vw) ) {
- INKSCAPE->reactivate_desktop(SP_DESKTOP_WIDGET(vw)->desktop);
+ INKSCAPE.reactivate_desktop(SP_DESKTOP_WIDGET(vw)->desktop);
}
}
@@ -318,7 +318,7 @@ sp_ui_close_view(GtkWidget */*widget*/)
// If closing the last document, open a new document so Inkscape doesn't quit.
std::list<SPDesktop *> desktops;
- INKSCAPE->get_all_desktops(desktops);
+ INKSCAPE.get_all_desktops(desktops);
if (desktops.size() == 1) {
Glib::ustring templateUri = sp_file_default_template_uri();
SPDocument *doc = SPDocument::createNewDoc( templateUri.c_str() , TRUE, true );
@@ -921,7 +921,7 @@ static void sp_ui_build_dyn_menus(Inkscape::XML::Node *menus, GtkWidget *menu, I
GtkWidget *sp_ui_main_menubar(Inkscape::UI::View::View *view)
{
GtkWidget *mbar = gtk_menu_bar_new();
- sp_ui_build_dyn_menus(INKSCAPE->get_menus(), mbar, view);
+ sp_ui_build_dyn_menus(INKSCAPE.get_menus(), mbar, view);
return mbar;
}
@@ -2106,13 +2106,13 @@ void ContextMenu::ImageEdit(void)
void ContextMenu::ImageTraceBitmap(void)
{
- INKSCAPE->dialogs_unhide();
+ INKSCAPE.dialogs_unhide();
_desktop->_dlg_mgr->showDialog("Trace");
}
void ContextMenu::ImageTracePixelArt(void)
{
- INKSCAPE->dialogs_unhide();
+ INKSCAPE.dialogs_unhide();
_desktop->_dlg_mgr->showDialog("PixelArt");
}
diff --git a/src/line-geometry.cpp b/src/line-geometry.cpp
index 566af8840..fe279ae19 100644
--- a/src/line-geometry.cpp
+++ b/src/line-geometry.cpp
@@ -201,7 +201,7 @@ boost::optional<Geom::Point> Line::intersection_with_viewbox (SPDesktop *desktop
void create_canvas_point(Geom::Point const &pos, double size, guint32 rgba)
{
- SPDesktop *desktop = inkscape_active_desktop();
+ SPDesktop *desktop = INKSCAPE.active_desktop();
SPCanvasItem * canvas_pt = sp_canvas_item_new(sp_desktop_controls(desktop), SP_TYPE_CTRL,
"size", size,
"filled", 1,
@@ -214,7 +214,7 @@ void create_canvas_point(Geom::Point const &pos, double size, guint32 rgba)
void create_canvas_line(Geom::Point const &p1, Geom::Point const &p2, guint32 rgba)
{
- SPDesktop *desktop = inkscape_active_desktop();
+ SPDesktop *desktop = INKSCAPE.active_desktop();
SPCtrlLine *line = ControlManager::getManager().createControlLine(sp_desktop_controls(desktop), p1, p2);
line->setRgba32(rgba);
sp_canvas_item_show(line);
diff --git a/src/live_effects/effect.cpp b/src/live_effects/effect.cpp
index d0a168a14..e622ca420 100644
--- a/src/live_effects/effect.cpp
+++ b/src/live_effects/effect.cpp
@@ -356,7 +356,7 @@ void
Effect::doAcceptPathPreparations(SPLPEItem *lpeitem)
{
// switch to pen context
- SPDesktop *desktop = inkscape_active_desktop(); // TODO: Is there a better method to find the item's desktop?
+ SPDesktop *desktop = INKSCAPE.active_desktop(); // TODO: Is there a better method to find the item's desktop?
if (!tools_isactive(desktop, TOOLS_FREEHAND_PEN)) {
tools_switch(desktop, TOOLS_FREEHAND_PEN);
}
diff --git a/src/live_effects/lpe-bspline.cpp b/src/live_effects/lpe-bspline.cpp
index b19b697c0..247496167 100644
--- a/src/live_effects/lpe-bspline.cpp
+++ b/src/live_effects/lpe-bspline.cpp
@@ -392,7 +392,7 @@ void LPEBSpline::toMakeCusp(Gtk::Widget *widgWeight) {
void LPEBSpline::toWeight() { changeWeight(weight); }
void LPEBSpline::changeWeight(double weightValue) {
- SPDesktop *desktop = inkscape_active_desktop();
+ SPDesktop *desktop = INKSCAPE.active_desktop();
Inkscape::Selection *selection = sp_desktop_selection(desktop);
GSList *items = (GSList *)selection->itemList();
SPItem *item = (SPItem *)g_slist_nth(items, 0)->data;
@@ -432,7 +432,7 @@ bool LPEBSpline::nodeIsSelected(Geom::Point nodePoint) {
void LPEBSpline::doBSplineFromWidget(SPCurve *curve, double weightValue) {
using Geom::X;
using Geom::Y;
- SPDesktop *desktop = inkscape_active_desktop();
+ SPDesktop *desktop = INKSCAPE.active_desktop();
if (INK_IS_NODE_TOOL(desktop->event_context)) {
Inkscape::UI::Tools::NodeTool *nt = INK_NODE_TOOL(desktop->event_context);
Inkscape::UI::ControlPointSelection::Set &selection =
diff --git a/src/live_effects/lpe-envelope-perspective.cpp b/src/live_effects/lpe-envelope-perspective.cpp
index bfd6e56d7..a16ed7ab5 100644
--- a/src/live_effects/lpe-envelope-perspective.cpp
+++ b/src/live_effects/lpe-envelope-perspective.cpp
@@ -352,7 +352,7 @@ LPEEnvelopePerspective::resetGrid()
Down_Left_Point.param_set_and_write_default();
//todo:this hack is only to reposition the knots on reser grid button
//Better update path effect in LPEITEM
- SPDesktop * desktop = inkscape_active_desktop();
+ SPDesktop * desktop = INKSCAPE.active_desktop();
tools_switch(desktop, TOOLS_SELECT);
tools_switch(desktop, TOOLS_NODES);
}
diff --git a/src/live_effects/lpe-lattice2.cpp b/src/live_effects/lpe-lattice2.cpp
index db609c9e1..13759f126 100644
--- a/src/live_effects/lpe-lattice2.cpp
+++ b/src/live_effects/lpe-lattice2.cpp
@@ -391,7 +391,7 @@ LPELattice2::resetGrid()
grid_point32x33x34x35.param_set_and_write_default();
//todo:this hack is only to reposition the knots on reser grid button
//Better update path effect in LPEITEM
- SPDesktop * desktop = inkscape_active_desktop();
+ SPDesktop * desktop = INKSCAPE.active_desktop();
tools_switch(desktop, TOOLS_SELECT);
tools_switch(desktop, TOOLS_NODES);
}
diff --git a/src/live_effects/parameter/text.cpp b/src/live_effects/parameter/text.cpp
index fcb2fc9fc..88fc27abd 100644
--- a/src/live_effects/parameter/text.cpp
+++ b/src/live_effects/parameter/text.cpp
@@ -32,7 +32,7 @@ TextParam::TextParam( const Glib::ustring& label, const Glib::ustring& tip,
value(default_value),
defvalue(default_value)
{
- SPDesktop *desktop = inkscape_active_desktop(); // FIXME: we shouldn't use this!
+ SPDesktop *desktop = INKSCAPE.active_desktop(); // FIXME: we shouldn't use this!
canvas_text = (SPCanvasText *) sp_canvastext_new(sp_desktop_tempgroup(desktop), desktop, Geom::Point(0,0), "");
sp_canvastext_set_text (canvas_text, default_value.c_str());
sp_canvastext_set_coords (canvas_text, 0, 0);
diff --git a/src/main-cmdlineact.cpp b/src/main-cmdlineact.cpp
index 9da7f6a79..216953f4f 100644
--- a/src/main-cmdlineact.cpp
+++ b/src/main-cmdlineact.cpp
@@ -82,7 +82,7 @@ CmdLineAction::doList (ActionContext const & context) {
bool
CmdLineAction::idle (void) {
std::list<SPDesktop *> desktops;
- INKSCAPE->get_all_desktops(desktops);
+ INKSCAPE.get_all_desktops(desktops);
// We're going to assume one desktop per document, because no one
// should have had time to make more at this point.
diff --git a/src/main.cpp b/src/main.cpp
index 2e36e3d50..e57231d17 100644
--- a/src/main.cpp
+++ b/src/main.cpp
@@ -933,9 +933,9 @@ guint get_group0_keyval(GdkEventKey const* event);
static void
snooper(GdkEvent *event, gpointer /*data*/) {
- if (INKSCAPE->mapalt()) /* returns the map of the keyboard modifier to map to Alt, zero if no mapping */
+ if (INKSCAPE.mapalt()) /* returns the map of the keyboard modifier to map to Alt, zero if no mapping */
{
- GdkModifierType mapping=(GdkModifierType)INKSCAPE->mapalt();
+ GdkModifierType mapping=(GdkModifierType)INKSCAPE.mapalt();
switch (event->type) {
case GDK_MOTION_NOTIFY:
if(event->motion.state & mapping) {
@@ -957,7 +957,7 @@ snooper(GdkEvent *event, gpointer /*data*/) {
}
}
- if (INKSCAPE->trackalt()) {
+ if (INKSCAPE.trackalt()) {
// MacOS X with X11 has some problem with the default
// xmodmapping. A ~/.xmodmap solution does not work reliably due
// to the way we package our executable in a .app that can launch
@@ -1125,14 +1125,14 @@ static int sp_process_file_list(GSList *fl)
retVal++;
} else {
- INKSCAPE->add_document(doc);
+ INKSCAPE.add_document(doc);
if (sp_vacuum_defs) {
doc->vacuumDocument();
}
// Execute command-line actions (selections and verbs) using our local models
- bool has_performed_actions = Inkscape::CmdLineAction::doList(INKSCAPE->active_action_context());
+ bool has_performed_actions = Inkscape::CmdLineAction::doList(INKSCAPE.active_action_context());
#ifdef WITH_DBUS
// If we've been asked to listen for D-Bus messages, enter a main loop here
@@ -1221,7 +1221,7 @@ static int sp_process_file_list(GSList *fl)
do_query_dimension (doc, false, sp_query_x? Geom::X : Geom::Y, sp_query_id);
}
- INKSCAPE->remove_document(doc);
+ INKSCAPE.remove_document(doc);
delete doc;
}
diff --git a/src/persp3d.cpp b/src/persp3d.cpp
index 1088f098d..7abfd0782 100644
--- a/src/persp3d.cpp
+++ b/src/persp3d.cpp
@@ -140,7 +140,7 @@ void Persp3D::set(unsigned key, gchar const *value) {
}
// FIXME: Is this the right place for resetting the draggers?
- Inkscape::UI::Tools::ToolBase *ec = INKSCAPE->active_event_context();
+ Inkscape::UI::Tools::ToolBase *ec = INKSCAPE.active_event_context();
if (SP_IS_BOX3D_CONTEXT(ec)) {
Inkscape::UI::Tools::Box3dTool *bc = SP_BOX3D_CONTEXT(ec);
bc->_vpdrag->updateDraggers();
@@ -289,7 +289,7 @@ persp3d_toggle_VP (Persp3D *persp, Proj::Axis axis, bool set_undo) {
persp3d_update_box_reprs (persp);
persp->updateRepr(SP_OBJECT_WRITE_EXT);
if (set_undo) {
- DocumentUndo::done(sp_desktop_document(inkscape_active_desktop()), SP_VERB_CONTEXT_3DBOX,
+ DocumentUndo::done(sp_desktop_document(INKSCAPE.active_desktop()), SP_VERB_CONTEXT_3DBOX,
_("Toggle vanishing point"));
}
}
@@ -300,7 +300,7 @@ persp3d_toggle_VPs (std::list<Persp3D *> p, Proj::Axis axis) {
for (std::list<Persp3D *>::iterator i = p.begin(); i != p.end(); ++i) {
persp3d_toggle_VP((*i), axis, false);
}
- DocumentUndo::done(sp_desktop_document(inkscape_active_desktop()), SP_VERB_CONTEXT_3DBOX,
+ DocumentUndo::done(sp_desktop_document(INKSCAPE.active_desktop()), SP_VERB_CONTEXT_3DBOX,
_("Toggle multiple vanishing points"));
}
@@ -527,7 +527,7 @@ persp3d_print_all_selected() {
g_print ("\n======================================\n");
g_print ("Selected perspectives and their boxes:\n");
- std::list<Persp3D *> sel_persps = sp_desktop_selection(inkscape_active_desktop())->perspList();
+ std::list<Persp3D *> sel_persps = sp_desktop_selection(INKSCAPE.active_desktop())->perspList();
for (std::list<Persp3D *>::iterator j = sel_persps.begin(); j != sel_persps.end(); ++j) {
Persp3D *persp = SP_PERSP3D(*j);
diff --git a/src/selection-chemistry.cpp b/src/selection-chemistry.cpp
index ec5bc659c..1ee75e381 100644
--- a/src/selection-chemistry.cpp
+++ b/src/selection-chemistry.cpp
@@ -3512,7 +3512,7 @@ void sp_selection_create_bitmap_copy(SPDesktop *desktop)
directory = g_path_get_dirname( document->getURI() );
}
if (directory == NULL) {
- directory = INKSCAPE->homedir_path(NULL);
+ directory = INKSCAPE.homedir_path(NULL);
}
gchar *filepath = g_build_filename(directory, basename, NULL);
g_free(directory);
diff --git a/src/selection.cpp b/src/selection.cpp
index 48f6e2414..81139d044 100644
--- a/src/selection.cpp
+++ b/src/selection.cpp
@@ -89,7 +89,7 @@ Selection::_emit_modified(Selection *selection)
}
void Selection::_emitModified(guint flags) {
- INKSCAPE->selection_modified(this, flags);
+ INKSCAPE.selection_modified(this, flags);
_modified_signal.emit(this, flags);
}
@@ -104,7 +104,7 @@ void Selection::_emitChanged(bool persist_selection_context/* = false */) {
_releaseContext(_selection_context);
}
- INKSCAPE->selection_changed(this);
+ INKSCAPE.selection_changed(this);
_changed_signal.emit(this);
}
diff --git a/src/sp-item.cpp b/src/sp-item.cpp
index b10aae1c6..0f068a914 100644
--- a/src/sp-item.cpp
+++ b/src/sp-item.cpp
@@ -899,7 +899,7 @@ void SPItem::getSnappoints(std::vector<Inkscape::SnapCandidatePoint> &p, Inkscap
clips_and_masks.push_back(clip_ref->getObject());
clips_and_masks.push_back(mask_ref->getObject());
- SPDesktop *desktop = inkscape_active_desktop();
+ SPDesktop *desktop = INKSCAPE.active_desktop();
for (std::list<SPObject const *>::const_iterator o = clips_and_masks.begin(); o != clips_and_masks.end(); ++o) {
if (*o) {
// obj is a group object, the children are the actual clippers
@@ -1495,7 +1495,7 @@ Geom::Affine SPItem::i2doc_affine() const
Geom::Affine SPItem::i2dt_affine() const
{
Geom::Affine ret;
- SPDesktop const *desktop = inkscape_active_desktop();
+ SPDesktop const *desktop = INKSCAPE.active_desktop();
if ( desktop ) {
ret = i2doc_affine() * desktop->doc2dt();
} else {
@@ -1513,7 +1513,7 @@ void SPItem::set_i2d_affine(Geom::Affine const &i2dt)
if (parent) {
dt2p = static_cast<SPItem *>(parent)->i2dt_affine().inverse();
} else {
- SPDesktop *dt = inkscape_active_desktop();
+ SPDesktop *dt = INKSCAPE.active_desktop();
dt2p = dt->dt2doc();
}
diff --git a/src/tools-switch.cpp b/src/tools-switch.cpp
index 357fe440c..a3e117dfa 100644
--- a/src/tools-switch.cpp
+++ b/src/tools-switch.cpp
@@ -153,7 +153,7 @@ tools_switch(SPDesktop *dt, int num)
/* fixme: This is really ugly hack. We should bind and unbind class methods */
/* First 4 tools use guides, first is undefined but we don't care */
dt->activate_guides(num < 5);
- INKSCAPE->eventcontext_set(dt->getEventContext());
+ INKSCAPE.eventcontext_set(dt->getEventContext());
}
void tools_switch_by_item(SPDesktop *dt, SPItem *item, Geom::Point const p)
diff --git a/src/ui/dialog/align-and-distribute.cpp b/src/ui/dialog/align-and-distribute.cpp
index 4fd2f0f9c..dbb7c1244 100644
--- a/src/ui/dialog/align-and-distribute.cpp
+++ b/src/ui/dialog/align-and-distribute.cpp
@@ -1044,10 +1044,10 @@ AlignAndDistribute::AlignAndDistribute()
contents->pack_start(_nodesFrame, true, true);
//Connect to the global tool change signal
- _toolChangeConn = INKSCAPE->signal_eventcontext_set.connect(sigc::hide<0>(sigc::bind(sigc::ptr_fun(&on_tool_changed), this)));
+ _toolChangeConn = INKSCAPE.signal_eventcontext_set.connect(sigc::hide<0>(sigc::bind(sigc::ptr_fun(&on_tool_changed), this)));
// Connect to the global selection change, to invalidate cached randomize_bbox
- _selChangeConn = INKSCAPE->signal_selection_changed.connect(sigc::hide<0>(sigc::bind(sigc::ptr_fun(&on_selection_changed), this)));
+ _selChangeConn = INKSCAPE.signal_selection_changed.connect(sigc::hide<0>(sigc::bind(sigc::ptr_fun(&on_selection_changed), this)));
randomize_bbox = Geom::OptRect();
_desktopChangeConn = _deskTrack.connectDesktopChanged( sigc::mem_fun(*this, &AlignAndDistribute::setDesktop) );
diff --git a/src/ui/dialog/clonetiler.cpp b/src/ui/dialog/clonetiler.cpp
index 84ef0b5b0..a435c5583 100644
--- a/src/ui/dialog/clonetiler.cpp
+++ b/src/ui/dialog/clonetiler.cpp
@@ -1269,8 +1269,8 @@ CloneTiler::CloneTiler () :
// connect to global selection changed signal (so we can change desktops) and
// external_change (so we're not fooled by undo)
- selectChangedConn = INKSCAPE->signal_selection_changed.connect(sigc::bind(sigc::ptr_fun(&CloneTiler::clonetiler_change_selection), dlg));
- externChangedConn = INKSCAPE->signal_external_change.connect (sigc::bind(sigc::ptr_fun(&CloneTiler::clonetiler_external_change), dlg));
+ selectChangedConn = INKSCAPE.signal_selection_changed.connect(sigc::bind(sigc::ptr_fun(&CloneTiler::clonetiler_change_selection), dlg));
+ externChangedConn = INKSCAPE.signal_external_change.connect (sigc::bind(sigc::ptr_fun(&CloneTiler::clonetiler_external_change), dlg));
g_signal_connect(G_OBJECT(dlg), "destroy", G_CALLBACK(clonetiler_disconnect_gsignal), this);
diff --git a/src/ui/dialog/desktop-tracker.cpp b/src/ui/dialog/desktop-tracker.cpp
index 5eb9ea054..0659de67b 100644
--- a/src/ui/dialog/desktop-tracker.cpp
+++ b/src/ui/dialog/desktop-tracker.cpp
@@ -40,7 +40,7 @@ void DesktopTracker::connect(GtkWidget *widget)
// Use C/gobject callbacks to avoid gtkmm rewrap-during-destruct issues:
hierID = g_signal_connect( G_OBJECT(widget), "hierarchy-changed", G_CALLBACK(hierarchyChangeCB), this );
- inkID = INKSCAPE->signal_activate_desktop.connect(
+ inkID = INKSCAPE.signal_activate_desktop.connect(
sigc::bind(
sigc::ptr_fun(&DesktopTracker::activateDesktopCB), this)
);
diff --git a/src/ui/dialog/desktop-tracker.h b/src/ui/dialog/desktop-tracker.h
index a58666c0d..28f9243c8 100644
--- a/src/ui/dialog/desktop-tracker.h
+++ b/src/ui/dialog/desktop-tracker.h
@@ -15,8 +15,6 @@ class SPDesktop;
namespace Inkscape {
-struct Application;
-
namespace UI {
namespace Dialog {
diff --git a/src/ui/dialog/dialog.cpp b/src/ui/dialog/dialog.cpp
index 72ca117f7..70f9c6a70 100644
--- a/src/ui/dialog/dialog.cpp
+++ b/src/ui/dialog/dialog.cpp
@@ -73,10 +73,10 @@ Dialog::Dialog(Behavior::BehaviorFactory behavior_factory, const char *prefs_pat
_behavior = behavior_factory(*this);
_desktop = SP_ACTIVE_DESKTOP;
- INKSCAPE->signal_activate_desktop.connect(sigc::mem_fun(*this, &Dialog::onDesktopActivated));
- INKSCAPE->signal_dialogs_hide.connect(sigc::mem_fun(*this, &Dialog::onHideF12));
- INKSCAPE->signal_dialogs_unhide.connect(sigc::mem_fun(*this, &Dialog::onShowF12));
- INKSCAPE->signal_shut_down.connect(sigc::mem_fun(*this, &Dialog::onShutdown));
+ INKSCAPE.signal_activate_desktop.connect(sigc::mem_fun(*this, &Dialog::onDesktopActivated));
+ INKSCAPE.signal_dialogs_hide.connect(sigc::mem_fun(*this, &Dialog::onHideF12));
+ INKSCAPE.signal_dialogs_unhide.connect(sigc::mem_fun(*this, &Dialog::onShowF12));
+ INKSCAPE.signal_shut_down.connect(sigc::mem_fun(*this, &Dialog::onShutdown));
Glib::wrap(gobj())->signal_event().connect(sigc::mem_fun(*this, &Dialog::_onEvent));
Glib::wrap(gobj())->signal_key_press_event().connect(sigc::mem_fun(*this, &Dialog::_onKeyPress));
diff --git a/src/ui/dialog/dialog.h b/src/ui/dialog/dialog.h
index ec5d203bc..90501550b 100644
--- a/src/ui/dialog/dialog.h
+++ b/src/ui/dialog/dialog.h
@@ -21,7 +21,6 @@ class SPDesktop;
namespace Inkscape {
class Selection;
-struct Application;
}
namespace Inkscape {
@@ -30,7 +29,6 @@ namespace Dialog {
enum BehaviorType { FLOATING, DOCK };
-void sp_retransientize(Inkscape::Application *inkscape, SPDesktop *desktop, gpointer dlgPtr);
gboolean sp_retransientize_again(gpointer dlgPtr);
void sp_dialog_shutdown(GObject *object, gpointer dlgPtr);
diff --git a/src/ui/dialog/document-metadata.cpp b/src/ui/dialog/document-metadata.cpp
index 09c505860..820d5a8bb 100644
--- a/src/ui/dialog/document-metadata.cpp
+++ b/src/ui/dialog/document-metadata.cpp
@@ -223,7 +223,7 @@ DocumentMetadata::_handleDocumentReplaced(SPDesktop* desktop, SPDocument *)
}
void
-DocumentMetadata::_handleActivateDesktop(Inkscape::Application *, SPDesktop *desktop)
+DocumentMetadata::_handleActivateDesktop(SPDesktop *desktop)
{
Inkscape::XML::Node *repr = sp_desktop_namedview(desktop)->getRepr();
repr->addListener(&_repr_events, this);
@@ -231,7 +231,7 @@ DocumentMetadata::_handleActivateDesktop(Inkscape::Application *, SPDesktop *des
}
void
-DocumentMetadata::_handleDeactivateDesktop(Inkscape::Application *, SPDesktop *desktop)
+DocumentMetadata::_handleDeactivateDesktop(SPDesktop *desktop)
{
Inkscape::XML::Node *repr = sp_desktop_namedview(desktop)->getRepr();
repr->removeListenerByData(this);
diff --git a/src/ui/dialog/document-metadata.h b/src/ui/dialog/document-metadata.h
index 3b7ed1ec8..cde5d92fd 100644
--- a/src/ui/dialog/document-metadata.h
+++ b/src/ui/dialog/document-metadata.h
@@ -28,6 +28,7 @@
# include <gtkmm/table.h>
#endif
+#include "inkscape.h"
#include "ui/widget/licensor.h"
#include "ui/widget/registry.h"
@@ -56,8 +57,8 @@ protected:
void init();
void _handleDocumentReplaced(SPDesktop* desktop, SPDocument *document);
- void _handleActivateDesktop(Inkscape::Application *application, SPDesktop *desktop);
- void _handleDeactivateDesktop(Inkscape::Application *application, SPDesktop *desktop);
+ void _handleActivateDesktop(SPDesktop *desktop);
+ void _handleDeactivateDesktop(SPDesktop *desktop);
Gtk::Notebook _notebook;
diff --git a/src/ui/dialog/document-properties.cpp b/src/ui/dialog/document-properties.cpp
index 2674efc1e..ce3b1314c 100644
--- a/src/ui/dialog/document-properties.cpp
+++ b/src/ui/dialog/document-properties.cpp
@@ -1592,7 +1592,7 @@ void DocumentProperties::_handleDocumentReplaced(SPDesktop* desktop, SPDocument
update();
}
-void DocumentProperties::_handleActivateDesktop(Inkscape::Application *, SPDesktop *desktop)
+void DocumentProperties::_handleActivateDesktop(SPDesktop *desktop)
{
Inkscape::XML::Node *repr = sp_desktop_namedview(desktop)->getRepr();
repr->addListener(&_repr_events, this);
@@ -1601,7 +1601,7 @@ void DocumentProperties::_handleActivateDesktop(Inkscape::Application *, SPDeskt
update();
}
-void DocumentProperties::_handleDeactivateDesktop(Inkscape::Application *, SPDesktop *desktop)
+void DocumentProperties::_handleDeactivateDesktop(SPDesktop *desktop)
{
Inkscape::XML::Node *repr = sp_desktop_namedview(desktop)->getRepr();
repr->removeListenerByData(this);
diff --git a/src/ui/dialog/document-properties.h b/src/ui/dialog/document-properties.h
index 495f3177d..b1f90b4b7 100644
--- a/src/ui/dialog/document-properties.h
+++ b/src/ui/dialog/document-properties.h
@@ -94,8 +94,8 @@ protected:
void save_default_metadata();
void _handleDocumentReplaced(SPDesktop* desktop, SPDocument *document);
- void _handleActivateDesktop(Inkscape::Application *application, SPDesktop *desktop);
- void _handleDeactivateDesktop(Inkscape::Application *application, SPDesktop *desktop);
+ void _handleActivateDesktop(SPDesktop *desktop);
+ void _handleDeactivateDesktop(SPDesktop *desktop);
Inkscape::XML::SignalObserver _emb_profiles_observer, _scripts_observer;
Gtk::Notebook _notebook;
diff --git a/src/ui/dialog/export.cpp b/src/ui/dialog/export.cpp
index 579b6aec7..7ce9fe2ec 100644
--- a/src/ui/dialog/export.cpp
+++ b/src/ui/dialog/export.cpp
@@ -588,7 +588,7 @@ Glib::ustring Export::create_filepath_from_id (Glib::ustring id, const Glib::ust
}
if (directory.empty()) {
- directory = INKSCAPE->homedir_path(NULL);
+ directory = INKSCAPE.homedir_path(NULL);
}
Glib::ustring filename = Glib::build_filename(directory, id+".png");
diff --git a/src/ui/dialog/filedialogimpl-gtkmm.cpp b/src/ui/dialog/filedialogimpl-gtkmm.cpp
index 014c85bd7..2abe78e49 100644
--- a/src/ui/dialog/filedialogimpl-gtkmm.cpp
+++ b/src/ui/dialog/filedialogimpl-gtkmm.cpp
@@ -538,7 +538,8 @@ bool SVGPreview::set(Glib::ustring &fileName, int dialogType)
SVGPreview::SVGPreview()
{
- if (!INKSCAPE)
+ // \FIXME Why?!!??
+ if (!Inkscape::Application::exists())
Inkscape::Application::create("", false);
document = NULL;
viewerGtk = NULL;
diff --git a/src/ui/dialog/fill-and-stroke.h b/src/ui/dialog/fill-and-stroke.h
index 340cb860f..f2a6bf39d 100644
--- a/src/ui/dialog/fill-and-stroke.h
+++ b/src/ui/dialog/fill-and-stroke.h
@@ -41,8 +41,7 @@ public:
virtual void setDesktop(SPDesktop *desktop);
- void selectionChanged(Inkscape::Application *inkscape,
- Inkscape::Selection *selection);
+ //void selectionChanged(Inkscape::Selection *selection);
void showPageFill();
void showPageStrokePaint();
diff --git a/src/ui/dialog/grid-arrange-tab.cpp b/src/ui/dialog/grid-arrange-tab.cpp
index f7c035ebe..2ff647a74 100644
--- a/src/ui/dialog/grid-arrange-tab.cpp
+++ b/src/ui/dialog/grid-arrange-tab.cpp
@@ -594,7 +594,7 @@ GridArrangeTab::GridArrangeTab(ArrangeDialog *parent)
{
// Selection Change signal
- INKSCAPE->signal_selection_changed.connect(sigc::hide<0>(sigc::mem_fun(*this, &GridArrangeTab::updateSelection)));
+ INKSCAPE.signal_selection_changed.connect(sigc::hide<0>(sigc::mem_fun(*this, &GridArrangeTab::updateSelection)));
}
Gtk::Box *contents = this;
diff --git a/src/ui/dialog/panel-dialog.h b/src/ui/dialog/panel-dialog.h
index b3beb73c6..39110f47a 100644
--- a/src/ui/dialog/panel-dialog.h
+++ b/src/ui/dialog/panel-dialog.h
@@ -51,8 +51,8 @@ public:
protected:
inline virtual void _propagateDocumentReplaced(SPDesktop* desktop, SPDocument *document);
- inline virtual void _propagateDesktopActivated(Inkscape::Application *, SPDesktop *);
- inline virtual void _propagateDesktopDeactivated(Inkscape::Application *, SPDesktop *);
+ inline virtual void _propagateDesktopActivated(SPDesktop *);
+ inline virtual void _propagateDesktopDeactivated(SPDesktop *);
UI::Widget::Panel &_panel;
sigc::connection _document_replaced_connection;
@@ -125,17 +125,17 @@ void PanelDialogBase::_propagateDocumentReplaced(SPDesktop *desktop, SPDocument
_panel.signalDocumentReplaced().emit(desktop, document);
}
-void PanelDialogBase::_propagateDesktopActivated(Inkscape::Application *application, SPDesktop *desktop)
+void PanelDialogBase::_propagateDesktopActivated(SPDesktop *desktop)
{
_document_replaced_connection =
desktop->connectDocumentReplaced(sigc::mem_fun(*this, &PanelDialogBase::_propagateDocumentReplaced));
- _panel.signalActivateDesktop().emit(application, desktop);
+ _panel.signalActivateDesktop().emit(desktop);
}
-void PanelDialogBase::_propagateDesktopDeactivated(Inkscape::Application *application, SPDesktop *desktop)
+void PanelDialogBase::_propagateDesktopDeactivated(SPDesktop *desktop)
{
_document_replaced_connection.disconnect();
- _panel.signalDeactiveDesktop().emit(application, desktop);
+ _panel.signalDeactiveDesktop().emit(desktop);
}
@@ -153,7 +153,7 @@ PanelDialog<B>::PanelDialog(Widget::Panel &panel, char const *prefs_path, int co
SPDesktop *desktop = SP_ACTIVE_DESKTOP;
- _propagateDesktopActivated(INKSCAPE, desktop);
+ _propagateDesktopActivated(desktop);
_document_replaced_connection =
desktop->connectDocumentReplaced(sigc::mem_fun(*this, &PanelDialog::_propagateDocumentReplaced));
@@ -202,7 +202,7 @@ PanelDialog<Behavior::FloatingBehavior>::PanelDialog(UI::Widget::Panel &panel, c
SPDesktop *desktop = SP_ACTIVE_DESKTOP;
- _propagateDesktopActivated(INKSCAPE, desktop);
+ _propagateDesktopActivated(desktop);
_document_replaced_connection =
desktop->connectDocumentReplaced(sigc::mem_fun(*this, &PanelDialog::_propagateDocumentReplaced));
@@ -238,14 +238,12 @@ PanelDialog<Behavior::FloatingBehavior> *PanelDialog<Behavior::FloatingBehavior>
new PanelDialog<Behavior::FloatingBehavior>(panel, panel.getPrefsPath(),
panel.getVerb(), panel.getApplyLabel());
- INKSCAPE->signal_activate_desktop.connect(
- sigc::bind<0>(
- sigc::mem_fun(*instance, &PanelDialog<Behavior::FloatingBehavior>::_propagateDesktopActivated), INKSCAPE
- ));
- INKSCAPE->signal_deactivate_desktop.connect(
- sigc::bind<0>(
- sigc::mem_fun(*instance, &PanelDialog<Behavior::FloatingBehavior>::_propagateDesktopDeactivated), INKSCAPE
- ));
+ INKSCAPE.signal_activate_desktop.connect(
+ sigc::mem_fun(*instance, &PanelDialog<Behavior::FloatingBehavior>::_propagateDesktopActivated)
+ );
+ INKSCAPE.signal_deactivate_desktop.connect(
+ sigc::mem_fun(*instance, &PanelDialog<Behavior::FloatingBehavior>::_propagateDesktopDeactivated)
+ );
return instance;
}
diff --git a/src/ui/dialog/symbols.cpp b/src/ui/dialog/symbols.cpp
index 0a35ee760..76532eb7e 100644
--- a/src/ui/dialog/symbols.cpp
+++ b/src/ui/dialog/symbols.cpp
@@ -275,7 +275,7 @@ SymbolsDialog::SymbolsDialog( gchar const* prefsPath ) :
++row;
/**********************************************************/
- currentDesktop = inkscape_active_desktop();
+ currentDesktop = INKSCAPE.active_desktop();
currentDocument = sp_desktop_document(currentDesktop);
previewDocument = symbols_preview_doc(); /* Template to render symbols in */
diff --git a/src/ui/dialog/transformation.cpp b/src/ui/dialog/transformation.cpp
index c36da373f..43f0e8683 100644
--- a/src/ui/dialog/transformation.cpp
+++ b/src/ui/dialog/transformation.cpp
@@ -156,8 +156,8 @@ Transformation::Transformation()
}
// Connect to the global selection changed & modified signals
- _selChangeConn = INKSCAPE->signal_selection_changed.connect(sigc::bind(sigc::ptr_fun(&on_selection_changed), this));
- _selModifyConn = INKSCAPE->signal_selection_modified.connect(sigc::hide<1>(sigc::bind(sigc::ptr_fun(&on_selection_modified), this)));
+ _selChangeConn = INKSCAPE.signal_selection_changed.connect(sigc::bind(sigc::ptr_fun(&on_selection_changed), this));
+ _selModifyConn = INKSCAPE.signal_selection_modified.connect(sigc::hide<1>(sigc::bind(sigc::ptr_fun(&on_selection_modified), this)));
_desktopChangeConn = _deskTrack.connectDesktopChanged( sigc::mem_fun(*this, &Transformation::setDesktop) );
_deskTrack.connect(GTK_WIDGET(gobj()));
diff --git a/src/ui/tools/connector-tool.cpp b/src/ui/tools/connector-tool.cpp
index d1355e807..19759b733 100644
--- a/src/ui/tools/connector-tool.cpp
+++ b/src/ui/tools/connector-tool.cpp
@@ -1304,7 +1304,7 @@ bool cc_item_is_connector(SPItem *item)
void cc_selection_set_avoid(bool const set_avoid)
{
- SPDesktop *desktop = inkscape_active_desktop();
+ SPDesktop *desktop = INKSCAPE.active_desktop();
if (desktop == NULL) {
return;
}
diff --git a/src/ui/view/view.cpp b/src/ui/view/view.cpp
index 2b5ff169d..47e2a1e0d 100644
--- a/src/ui/view/view.cpp
+++ b/src/ui/view/view.cpp
@@ -85,7 +85,7 @@ void View::_close() {
if (_doc) {
_document_uri_set_connection.disconnect();
_document_resized_connection.disconnect();
- if (INKSCAPE->remove_document(_doc)) {
+ if (INKSCAPE.remove_document(_doc)) {
// this was the last view of this document, so delete it
delete _doc;
}
@@ -111,13 +111,13 @@ void View::setDocument(SPDocument *doc) {
if (_doc) {
_document_uri_set_connection.disconnect();
_document_resized_connection.disconnect();
- if (INKSCAPE->remove_document(_doc)) {
+ if (INKSCAPE.remove_document(_doc)) {
// this was the last view of this document, so delete it
delete _doc;
}
}
- INKSCAPE->add_document(doc);
+ INKSCAPE.add_document(doc);
_doc = doc;
_document_uri_set_connection =
diff --git a/src/ui/widget/dock.cpp b/src/ui/widget/dock.cpp
index f23e4bcca..c5e14d4f0 100644
--- a/src/ui/widget/dock.cpp
+++ b/src/ui/widget/dock.cpp
@@ -120,8 +120,8 @@ Dock::Dock(Gtk::Orientation orientation)
gdl_dock_bar_set_style(_gdl_dock_bar, gdl_dock_bar_style);
- INKSCAPE->signal_dialogs_hide.connect(sigc::mem_fun(*this, &Dock::hide));
- INKSCAPE->signal_dialogs_unhide.connect(sigc::mem_fun(*this, &Dock::show));
+ INKSCAPE.signal_dialogs_hide.connect(sigc::mem_fun(*this, &Dock::hide));
+ INKSCAPE.signal_dialogs_unhide.connect(sigc::mem_fun(*this, &Dock::show));
g_signal_connect(_paned->gobj(), "button-press-event", G_CALLBACK(_on_paned_button_event), (void *)this);
g_signal_connect(_paned->gobj(), "button-release-event", G_CALLBACK(_on_paned_button_event), (void *)this);
diff --git a/src/ui/widget/imageicon.cpp b/src/ui/widget/imageicon.cpp
index 8c1e44434..df261b69a 100644
--- a/src/ui/widget/imageicon.cpp
+++ b/src/ui/widget/imageicon.cpp
@@ -89,7 +89,7 @@ ImageIcon::~ImageIcon()
void ImageIcon::init()
{
// \FIXME Why?
- if (!INKSCAPE)
+ if (!Inkscape::Application::exists())
Inkscape::Application::create("", false);
document = NULL;
viewerGtkmm = NULL;
diff --git a/src/ui/widget/object-composite-settings.h b/src/ui/widget/object-composite-settings.h
index 19a6cb2a5..26d83fdc3 100644
--- a/src/ui/widget/object-composite-settings.h
+++ b/src/ui/widget/object-composite-settings.h
@@ -32,7 +32,6 @@
class SPDesktop;
namespace Inkscape {
-struct Application;
namespace UI {
namespace Widget {
@@ -66,8 +65,8 @@ private:
gulong _desktop_activated;
sigc::connection _subject_changed;
- static void _on_desktop_activate(Inkscape::Application *application, SPDesktop *desktop, ObjectCompositeSettings *w);
- static void _on_desktop_deactivate(Inkscape::Application *application, SPDesktop *desktop, ObjectCompositeSettings *w);
+ static void _on_desktop_activate(SPDesktop *desktop, ObjectCompositeSettings *w);
+ static void _on_desktop_deactivate(SPDesktop *desktop, ObjectCompositeSettings *w);
void _subjectChanged();
void _blendBlurValueChanged();
void _opacityValueChanged();
diff --git a/src/ui/widget/panel.cpp b/src/ui/widget/panel.cpp
index b37137228..c96eac838 100644
--- a/src/ui/widget/panel.cpp
+++ b/src/ui/widget/panel.cpp
@@ -293,7 +293,7 @@ void Panel::_init()
signalResponse().connect(sigc::mem_fun(*this, &Panel::_handleResponse));
- signalActivateDesktop().connect(sigc::hide<0>(sigc::mem_fun(*this, &Panel::setDesktop)));
+ signalActivateDesktop().connect(sigc::mem_fun(*this, &Panel::setDesktop));
show_all_children();
@@ -643,13 +643,13 @@ Panel::signalDocumentReplaced()
return _signal_document_replaced;
}
-sigc::signal<void, Inkscape::Application *, SPDesktop *> &
+sigc::signal<void, SPDesktop *> &
Panel::signalActivateDesktop()
{
return _signal_activate_desktop;
}
-sigc::signal<void, Inkscape::Application *, SPDesktop *> &
+sigc::signal<void, SPDesktop *> &
Panel::signalDeactiveDesktop()
{
return _signal_deactive_desktop;
diff --git a/src/ui/widget/panel.h b/src/ui/widget/panel.h
index 0c3d822b8..b9466e07a 100644
--- a/src/ui/widget/panel.h
+++ b/src/ui/widget/panel.h
@@ -47,7 +47,6 @@ namespace Gtk {
namespace Inkscape {
-struct Application;
class Selection;
namespace UI {
@@ -116,8 +115,8 @@ public:
void setResponseSensitive(int response_id, bool setting);
virtual sigc::signal<void, SPDesktop *, SPDocument *> &signalDocumentReplaced();
- virtual sigc::signal<void, Inkscape::Application *, SPDesktop *> &signalActivateDesktop();
- virtual sigc::signal<void, Inkscape::Application *, SPDesktop *> &signalDeactiveDesktop();
+ virtual sigc::signal<void, SPDesktop *> &signalActivateDesktop();
+ virtual sigc::signal<void, SPDesktop *> &signalDeactiveDesktop();
protected:
/**
@@ -147,8 +146,8 @@ protected:
sigc::signal<void, int> _signal_response;
sigc::signal<void> _signal_present;
sigc::signal<void, SPDesktop *, SPDocument *> _signal_document_replaced;
- sigc::signal<void, Inkscape::Application *, SPDesktop *> _signal_activate_desktop;
- sigc::signal<void, Inkscape::Application *, SPDesktop *> _signal_deactive_desktop;
+ sigc::signal<void, SPDesktop *> _signal_activate_desktop;
+ sigc::signal<void, SPDesktop *> _signal_deactive_desktop;
private:
void _init();
diff --git a/src/vanishing-point.cpp b/src/vanishing-point.cpp
index 66e699b41..41f8dfe7d 100644
--- a/src/vanishing-point.cpp
+++ b/src/vanishing-point.cpp
@@ -93,7 +93,7 @@ vp_knot_moved_handler (SPKnot *knot, Geom::Point const &ppointer, guint state, g
Geom::Point p = ppointer;
// FIXME: take from prefs
- double snap_dist = SNAP_DIST / inkscape_active_desktop()->current_zoom();
+ double snap_dist = SNAP_DIST / INKSCAPE.active_desktop()->current_zoom();
/*
* We use dragging_started to indicate if we have already checked for the need to split Draggers up.
@@ -109,7 +109,7 @@ vp_knot_moved_handler (SPKnot *knot, Geom::Point const &ppointer, guint state, g
for (std::set<VanishingPoint*, less_ptr>::iterator vp = sel_vps.begin(); vp != sel_vps.end(); ++vp) {
// for each VP that has selected boxes:
Persp3D *old_persp = (*vp)->get_perspective();
- sel_boxes = (*vp)->selectedBoxes(sp_desktop_selection(inkscape_active_desktop()));
+ sel_boxes = (*vp)->selectedBoxes(sp_desktop_selection(INKSCAPE.active_desktop()));
// we create a new perspective ...
Persp3D *new_persp = persp3d_create_xml_element (dragger->parent->document, old_persp->perspective_impl);
@@ -128,7 +128,7 @@ vp_knot_moved_handler (SPKnot *knot, Geom::Point const &ppointer, guint state, g
}
// FIXME: Do we need to create a new dragger as well?
dragger->updateZOrders ();
- DocumentUndo::done(sp_desktop_document (inkscape_active_desktop()), SP_VERB_CONTEXT_3DBOX,
+ DocumentUndo::done(sp_desktop_document (INKSCAPE.active_desktop()), SP_VERB_CONTEXT_3DBOX,
_("Split vanishing points"));
return;
}
@@ -173,7 +173,7 @@ vp_knot_moved_handler (SPKnot *knot, Geom::Point const &ppointer, guint state, g
// deleted according to changes in the svg representation, not based on any user input
// as is currently the case.
- DocumentUndo::done(sp_desktop_document (inkscape_active_desktop()), SP_VERB_CONTEXT_3DBOX,
+ DocumentUndo::done(sp_desktop_document (INKSCAPE.active_desktop()), SP_VERB_CONTEXT_3DBOX,
_("Merge vanishing points"));
return;
@@ -181,7 +181,7 @@ vp_knot_moved_handler (SPKnot *knot, Geom::Point const &ppointer, guint state, g
}
// We didn't snap to another dragger, so we'll try a regular snap
- SPDesktop *desktop = inkscape_active_desktop();
+ SPDesktop *desktop = INKSCAPE.active_desktop();
SnapManager &m = desktop->namedview->snap_manager;
m.setup(desktop);
Inkscape::SnappedPoint s = m.freeSnap(Inkscape::SnapCandidatePoint(p, Inkscape::SNAPSOURCE_OTHER_HANDLE));
@@ -277,7 +277,7 @@ VPDragger::VPDragger(VPDrag *parent, Geom::Point p, VanishingPoint &vp)
if (vp.is_finite()) {
// create the knot
- this->knot = new SPKnot(inkscape_active_desktop(), NULL);
+ this->knot = new SPKnot(INKSCAPE.active_desktop(), NULL);
this->knot->setMode(SP_KNOT_MODE_XOR);
this->knot->setFill(VP_KNOT_COLOR_NORMAL, VP_KNOT_COLOR_NORMAL, VP_KNOT_COLOR_NORMAL);
this->knot->setStroke(0x000000ff, 0x000000ff, 0x000000ff);
@@ -394,7 +394,7 @@ VPDragger::VPsOfSelectedBoxes() {
std::set<VanishingPoint*, less_ptr> sel_vps;
VanishingPoint *vp;
// FIXME: Should we take the selection from the parent VPDrag? I guess it shouldn't make a difference.
- Inkscape::Selection *sel = sp_desktop_selection(inkscape_active_desktop());
+ Inkscape::Selection *sel = sp_desktop_selection(INKSCAPE.active_desktop());
for (GSList const* i = sel->itemList(); i != NULL; i = i->next) {
if (!SP_IS_BOX3D(i->data))
continue;
@@ -487,7 +487,7 @@ VPDragger::printVPs() {
VPDrag::VPDrag (SPDocument *document)
{
this->document = document;
- this->selection = sp_desktop_selection(inkscape_active_desktop());
+ this->selection = sp_desktop_selection(INKSCAPE.active_desktop());
this->draggers = NULL;
this->lines = NULL;
@@ -633,7 +633,7 @@ VPDrag::updateBoxHandles ()
return;
}
- Inkscape::UI::Tools::ToolBase *ec = INKSCAPE->active_event_context();
+ Inkscape::UI::Tools::ToolBase *ec = INKSCAPE.active_event_context();
g_assert (ec != NULL);
if (ec->shape_editor != NULL) {
ec->shape_editor->update_knotholder();
@@ -706,7 +706,7 @@ void VPDrag::drawLinesForFace(const SPBox3D *box, Proj::Axis axis) //, guint cor
// draw perspective lines for infinite VPs
boost::optional<Geom::Point> pt1, pt2, pt3, pt4;
Persp3D *persp = box3d_get_perspective(box);
- SPDesktop *desktop = inkscape_active_desktop (); // FIXME: Store the desktop in VPDrag
+ SPDesktop *desktop = INKSCAPE.active_desktop (); // FIXME: Store the desktop in VPDrag
Box3D::PerspectiveLine pl (corner1, axis, persp);
pt1 = pl.intersection_with_viewbox(desktop);
@@ -780,7 +780,7 @@ VPDrag::swap_perspectives_of_VPs(Persp3D *persp2, Persp3D *persp1)
void VPDrag::addLine(Geom::Point const &p1, Geom::Point const &p2, Inkscape::CtrlLineType type)
{
- SPCtrlLine *line = ControlManager::getManager().createControlLine(sp_desktop_controls(inkscape_active_desktop()), p1, p2, type);
+ SPCtrlLine *line = ControlManager::getManager().createControlLine(sp_desktop_controls(INKSCAPE.active_desktop()), p1, p2, type);
sp_canvas_item_show(line);
this->lines = g_slist_append(this->lines, line);
}
diff --git a/src/verbs.cpp b/src/verbs.cpp
index 4626621a9..cfda87bb6 100644
--- a/src/verbs.cpp
+++ b/src/verbs.cpp
@@ -873,10 +873,10 @@ void FileVerb::perform(SPAction *action, void *data)
// sp_file_export_to_ocal(*parent);
// break;
case SP_VERB_FILE_NEXT_DESKTOP:
- INKSCAPE->switch_desktops_next();
+ INKSCAPE.switch_desktops_next();
break;
case SP_VERB_FILE_PREV_DESKTOP:
- INKSCAPE->switch_desktops_prev();
+ INKSCAPE.switch_desktops_prev();
break;
case SP_VERB_FILE_CLOSE_VIEW:
sp_ui_close_view(NULL);
@@ -1170,11 +1170,11 @@ void SelectionVerb::perform(SPAction *action, void *data)
SelectionHelper::reverse(dt);
break;
case SP_VERB_SELECTION_TRACE:
- INKSCAPE->dialogs_unhide();
+ INKSCAPE.dialogs_unhide();
dt->_dlg_mgr->showDialog("Trace");
break;
case SP_VERB_SELECTION_PIXEL_ART:
- INKSCAPE->dialogs_unhide();
+ INKSCAPE.dialogs_unhide();
dt->_dlg_mgr->showDialog("PixelArt");
break;
case SP_VERB_SELECTION_CREATE_BITMAP:
@@ -1188,7 +1188,7 @@ void SelectionVerb::perform(SPAction *action, void *data)
sp_selected_path_break_apart(dt);
break;
case SP_VERB_SELECTION_ARRANGE:
- INKSCAPE->dialogs_unhide();
+ INKSCAPE.dialogs_unhide();
dt->_dlg_mgr->showDialog("TileDialog"); //FIXME: denis: What's this string (to be changed)
break;
default:
@@ -1929,7 +1929,7 @@ void ZoomVerb::perform(SPAction *action, void *data)
dt->toggleColorProfAdjust();
break;
case SP_VERB_VIEW_ICON_PREVIEW:
- INKSCAPE->dialogs_unhide();
+ INKSCAPE.dialogs_unhide();
dt->_dlg_mgr->showDialog("IconPreviewPanel");
break;
@@ -1948,7 +1948,7 @@ void DialogVerb::perform(SPAction *action, void *data)
{
if (reinterpret_cast<std::size_t>(data) != SP_VERB_DIALOG_TOGGLE) {
// unhide all when opening a new dialog
- INKSCAPE->dialogs_unhide();
+ INKSCAPE.dialogs_unhide();
}
g_return_if_fail(ensure_desktop_valid(action));
@@ -2011,7 +2011,7 @@ void DialogVerb::perform(SPAction *action, void *data)
dt->_dlg_mgr->showDialog("UndoHistory");
break;
case SP_VERB_DIALOG_TOGGLE:
- INKSCAPE->dialogs_toggle();
+ INKSCAPE.dialogs_toggle();
break;
case SP_VERB_DIALOG_CLONETILER:
//clonetiler_dialog();
@@ -2083,7 +2083,7 @@ void HelpVerb::perform(SPAction *action, void *data)
*/
case SP_VERB_HELP_MEMORY:
- INKSCAPE->dialogs_unhide();
+ INKSCAPE.dialogs_unhide();
dt->_dlg_mgr->showDialog("Memory");
break;
default:
diff --git a/src/widgets/box3d-toolbar.cpp b/src/widgets/box3d-toolbar.cpp
index ecc7890b9..532eecb0f 100644
--- a/src/widgets/box3d-toolbar.cpp
+++ b/src/widgets/box3d-toolbar.cpp
@@ -254,7 +254,7 @@ static void box3d_angle_z_value_changed(GtkAdjustment *adj, GObject *dataKludge)
static void box3d_vp_state_changed( GtkToggleAction *act, GtkAction * /*box3d_angle*/, Proj::Axis axis )
{
// TODO: Take all selected perspectives into account
- std::list<Persp3D *> sel_persps = sp_desktop_selection(inkscape_active_desktop())->perspList();
+ std::list<Persp3D *> sel_persps = sp_desktop_selection(INKSCAPE.active_desktop())->perspList();
if (sel_persps.empty()) {
// this can happen when the document is created; we silently ignore it
return;
diff --git a/src/widgets/desktop-widget.cpp b/src/widgets/desktop-widget.cpp
index 8822416a7..09b5d24a9 100644
--- a/src/widgets/desktop-widget.cpp
+++ b/src/widgets/desktop-widget.cpp
@@ -795,7 +795,7 @@ static void sp_desktop_widget_dispose(GObject *object)
dtw->layer_selector->setDesktop(NULL);
dtw->layer_selector->unreference();
- INKSCAPE->remove_desktop (dtw->desktop); // clears selection too
+ INKSCAPE.remove_desktop (dtw->desktop); // clears selection too
dtw->modified_connection.disconnect();
dtw->desktop->destroy();
Inkscape::GC::release (dtw->desktop);
@@ -1091,7 +1091,7 @@ SPDesktopWidget::shutdown()
{
g_assert(desktop != NULL);
- if (INKSCAPE->sole_desktop_for_document(*desktop)) {
+ if (INKSCAPE.sole_desktop_for_document(*desktop)) {
SPDocument *doc = desktop->doc();
if (doc->isModifiedSinceSave()) {
GtkWidget *dialog;
@@ -1672,7 +1672,7 @@ SPDesktopWidget* SPDesktopWidget::createInstance(SPNamedView *namedview)
dtw->desktop = new SPDesktop();
dtw->stub = new SPDesktopWidget::WidgetStub (dtw);
dtw->desktop->init (namedview, dtw->canvas, dtw->stub);
- INKSCAPE->add_desktop (dtw->desktop);
+ INKSCAPE.add_desktop (dtw->desktop);
// Add the shape geometry to libavoid for autorouting connectors.
// This needs desktop set for its spacing preferences.
@@ -1818,7 +1818,7 @@ bool SPDesktopWidget::onFocusInEvent(GdkEventFocus*)
}
}
- INKSCAPE->activate_desktop (desktop);
+ INKSCAPE.activate_desktop (desktop);
return false;
}
diff --git a/src/widgets/gradient-vector.cpp b/src/widgets/gradient-vector.cpp
index 9c27da1f8..62a6599f2 100644
--- a/src/widgets/gradient-vector.cpp
+++ b/src/widgets/gradient-vector.cpp
@@ -1033,18 +1033,18 @@ GtkWidget * sp_gradient_vector_editor_new(SPGradient *gradient, SPStop *stop)
wd.win = dlg;
wd.stop = 0;
- INKSCAPE->signal_activate_desktop.connect(sigc::bind<0>(sigc::bind(sigc::ptr_fun(&sp_transientize_callback), &wd), INKSCAPE));
+ INKSCAPE.signal_activate_desktop.connect(sigc::bind(sigc::ptr_fun(&sp_transientize_callback), &wd));
g_signal_connect(G_OBJECT(dlg), "event", G_CALLBACK(sp_dialog_event_handler), dlg);
g_signal_connect(G_OBJECT(dlg), "destroy", G_CALLBACK(sp_gradient_vector_dialog_destroy), dlg);
g_signal_connect(G_OBJECT(dlg), "delete_event", G_CALLBACK(sp_gradient_vector_dialog_delete), dlg);
- INKSCAPE->signal_shut_down.connect(
+ INKSCAPE.signal_shut_down.connect(
sigc::hide_return(
sigc::bind(sigc::ptr_fun(&sp_gradient_vector_dialog_delete), (GtkWidget *) NULL, (GdkEvent *) NULL, (GtkWidget *) NULL)
));
- INKSCAPE->signal_dialogs_hide.connect(sigc::bind(sigc::ptr_fun(&gtk_widget_hide), dlg));
- INKSCAPE->signal_dialogs_unhide.connect(sigc::bind(sigc::ptr_fun(&gtk_widget_show), dlg));
+ INKSCAPE.signal_dialogs_hide.connect(sigc::bind(sigc::ptr_fun(&gtk_widget_hide), dlg));
+ INKSCAPE.signal_dialogs_unhide.connect(sigc::bind(sigc::ptr_fun(&gtk_widget_show), dlg));
gtk_container_set_border_width(GTK_CONTAINER(dlg), PAD);
@@ -1161,13 +1161,14 @@ static void sp_gradient_vector_widget_load_gradient(GtkWidget *widget, SPGradien
blocked = FALSE;
}
+// \FIXME this
#if GTK_CHECK_VERSION(3,0,0)
static void sp_gradient_vector_dialog_destroy(GtkWidget * /*object*/, gpointer /*data*/)
#else
static void sp_gradient_vector_dialog_destroy(GtkObject * /*object*/, gpointer /*data*/)
#endif
{
- sp_signal_disconnect_by_data(INKSCAPE, dlg);
+ //sp_signal_disconnect_by_data(INKSCAPE, dlg);
wd.win = dlg = NULL;
wd.stop = 0;
}
diff --git a/src/widgets/select-toolbar.cpp b/src/widgets/select-toolbar.cpp
index 284e436bf..db93c1552 100644
--- a/src/widgets/select-toolbar.cpp
+++ b/src/widgets/select-toolbar.cpp
@@ -468,7 +468,7 @@ void sp_select_toolbox_prep(SPDesktop *desktop, GtkActionGroup* mainActions, GOb
contextActions->push_back( act );
// Create the parent widget for x y w h tracker.
- GtkWidget *spw = sp_widget_new_global(INKSCAPE);
+ GtkWidget *spw = sp_widget_new_global();
// Remember the desktop's canvas widget, to be used for defocusing.
g_object_set_data(G_OBJECT(spw), "dtw", sp_desktop_canvas(desktop));
diff --git a/src/widgets/sp-widget.cpp b/src/widgets/sp-widget.cpp
index 08344d9b2..8feb5b994 100644
--- a/src/widgets/sp-widget.cpp
+++ b/src/widgets/sp-widget.cpp
@@ -58,15 +58,15 @@ public:
#endif
static void sizeAllocate(GtkWidget *widget, GtkAllocation *allocation);
- static void modifySelectionCB(Application *inkscape, Selection *selection, guint flags, SPWidget *spw);
- static void changeSelectionCB(Application *inkscape, Selection *selection, SPWidget *spw);
- static void setSelectionCB(Application *inkscape, Selection *selection, SPWidget *spw);
+ static void modifySelectionCB(Selection *selection, guint flags, SPWidget *spw);
+ static void changeSelectionCB(Selection *selection, SPWidget *spw);
+ static void setSelectionCB(Selection *selection, SPWidget *spw);
- static GtkWidget *constructGlobal(SPWidget *spw, Inkscape::Application *inkscape);
+ static GtkWidget *constructGlobal(SPWidget *spw);
- void modifySelection(Application *inkscape, Selection *selection, guint flags);
- void changeSelection(Application *inkscape, Selection *selection);
- void setSelection(Application *inkscape, Selection *selection);
+ void modifySelection(Selection *selection, guint flags);
+ void changeSelection(Selection *selection);
+ void setSelection(Selection *selection);
private:
static GtkBinClass *parentClass;
@@ -172,8 +172,6 @@ void SPWidgetImpl::classInit(SPWidgetClass *klass)
void SPWidgetImpl::init(SPWidget *spw)
{
- spw->inkscape = NULL;
-
spw->_impl = new SPWidgetImpl(*spw); // ctor invoked after all other init
}
@@ -181,21 +179,12 @@ void SPWidgetImpl::dispose(GObject *object)
{
SPWidget *spw = reinterpret_cast<SPWidget *>(object);
- if (spw->inkscape) {
- // Disconnect signals
-
- // the checks are necessary because when destroy is caused by the program shutting down,
- // the inkscape object may already be (partly?) invalid --bb
- if (dynamic_cast<Inkscape::Application *>(spw->inkscape)) {
- spw->selModified.disconnect();
- spw->selChanged.disconnect();
- spw->selSet.disconnect();
- }
- //if (G_IS_OBJECT(spw->inkscape) && G_OBJECT_GET_CLASS(spw->inkscape)) {
- //sp_signal_disconnect_by_data(spw->inkscape, spw);
- //}
- spw->inkscape = NULL;
- }
+ // Disconnect signals
+ if (Application::exists()) {
+ spw->selModified.disconnect();
+ spw->selChanged.disconnect();
+ spw->selSet.disconnect();
+ }
delete spw->_impl;
spw->_impl = 0;
@@ -209,23 +198,20 @@ void SPWidgetImpl::show(GtkWidget *widget)
{
SPWidget *spw = SP_WIDGET(widget);
- if (spw->inkscape) {
+ if (Application::exists()) {
// Connect signals
- spw->selModified = spw->inkscape->signal_selection_modified.connect(
- sigc::bind<0>(
+ spw->selModified = INKSCAPE.signal_selection_modified.connect(
sigc::bind(
- sigc::ptr_fun(SPWidgetImpl::modifySelectionCB), spw), spw->inkscape
- ));
- spw->selChanged = spw->inkscape->signal_selection_changed.connect(
- sigc::bind<0>(
+ sigc::ptr_fun(SPWidgetImpl::modifySelectionCB), spw)
+ );
+ spw->selChanged = INKSCAPE.signal_selection_changed.connect(
sigc::bind(
- sigc::ptr_fun(SPWidgetImpl::changeSelectionCB), spw), spw->inkscape
- ));
- spw->selSet = spw->inkscape->signal_selection_set.connect(
- sigc::bind<0>(
+ sigc::ptr_fun(SPWidgetImpl::changeSelectionCB), spw)
+ );
+ spw->selSet = INKSCAPE.signal_selection_set.connect(
sigc::bind(
- sigc::ptr_fun(SPWidgetImpl::setSelectionCB), spw), spw->inkscape
- ));
+ sigc::ptr_fun(SPWidgetImpl::setSelectionCB), spw)
+ );
}
if (reinterpret_cast<GtkWidgetClass *>(parentClass)->show) {
@@ -237,7 +223,7 @@ void SPWidgetImpl::hide(GtkWidget *widget)
{
SPWidget *spw = SP_WIDGET (widget);
- if (spw->inkscape) {
+ if (Application::exists()) {
// Disconnect signals
spw->selModified.disconnect();
spw->selChanged.disconnect();
@@ -313,27 +299,21 @@ void SPWidgetImpl::sizeAllocate(GtkWidget *widget, GtkAllocation *allocation)
}
}
-GtkWidget *SPWidgetImpl::constructGlobal(SPWidget *spw, Inkscape::Application *inkscape)
+GtkWidget *SPWidgetImpl::constructGlobal(SPWidget *spw)
{
- g_return_val_if_fail(!spw->inkscape, NULL);
-
- spw->inkscape = inkscape;
if (gtk_widget_get_visible(GTK_WIDGET(spw))) {
- spw->selModified = spw->inkscape->signal_selection_modified.connect(
- sigc::bind<0>(
+ spw->selModified = INKSCAPE.signal_selection_modified.connect(
sigc::bind(
- sigc::ptr_fun(SPWidgetImpl::modifySelectionCB), spw), spw->inkscape
- ));
- spw->selChanged = spw->inkscape->signal_selection_changed.connect(
- sigc::bind<0>(
+ sigc::ptr_fun(SPWidgetImpl::modifySelectionCB), spw)
+ );
+ spw->selChanged = INKSCAPE.signal_selection_changed.connect(
sigc::bind(
- sigc::ptr_fun(SPWidgetImpl::changeSelectionCB), spw), spw->inkscape
- ));
- spw->selSet = spw->inkscape->signal_selection_set.connect(
- sigc::bind<0>(
+ sigc::ptr_fun(SPWidgetImpl::changeSelectionCB), spw)
+ );
+ spw->selSet = INKSCAPE.signal_selection_set.connect(
sigc::bind(
- sigc::ptr_fun(SPWidgetImpl::setSelectionCB), spw), spw->inkscape
- ));
+ sigc::ptr_fun(SPWidgetImpl::setSelectionCB), spw)
+ );
}
g_signal_emit(spw, signals[CONSTRUCT], 0);
@@ -341,32 +321,32 @@ GtkWidget *SPWidgetImpl::constructGlobal(SPWidget *spw, Inkscape::Application *i
return GTK_WIDGET(spw);
}
-void SPWidgetImpl::modifySelectionCB(Application *inkscape, Selection *selection, guint flags, SPWidget *spw)
+void SPWidgetImpl::modifySelectionCB(Selection *selection, guint flags, SPWidget *spw)
{
- spw->_impl->modifySelection(inkscape, selection, flags);
+ spw->_impl->modifySelection(selection, flags);
}
-void SPWidgetImpl::changeSelectionCB(Application *inkscape, Selection *selection, SPWidget *spw)
+void SPWidgetImpl::changeSelectionCB(Selection *selection, SPWidget *spw)
{
- spw->_impl->changeSelection(inkscape, selection);
+ spw->_impl->changeSelection(selection);
}
-void SPWidgetImpl::setSelectionCB(Application *inkscape, Selection *selection, SPWidget *spw)
+void SPWidgetImpl::setSelectionCB(Selection *selection, SPWidget *spw)
{
- spw->_impl->setSelection(inkscape, selection);
+ spw->_impl->setSelection(selection);
}
-void SPWidgetImpl::modifySelection(Application * /*inkscape*/, Selection *selection, guint flags)
+void SPWidgetImpl::modifySelection(Selection *selection, guint flags)
{
g_signal_emit(&_target, signals[MODIFY_SELECTION], 0, selection, flags);
}
-void SPWidgetImpl::changeSelection(Application * /*inkscape*/, Selection *selection)
+void SPWidgetImpl::changeSelection(Selection *selection)
{
g_signal_emit(&_target, signals[CHANGE_SELECTION], 0, selection);
}
-void SPWidgetImpl::setSelection(Application * /*inkscape*/, Selection *selection)
+void SPWidgetImpl::setSelection(Selection *selection)
{
// Emit "set_selection" signal
g_signal_emit(&_target, signals[SET_SELECTION], 0, selection);
@@ -377,11 +357,11 @@ void SPWidgetImpl::setSelection(Application * /*inkscape*/, Selection *selection
// Methods
-GtkWidget *sp_widget_new_global(Inkscape::Application *inkscape)
+GtkWidget *sp_widget_new_global()
{
SPWidget *spw = reinterpret_cast<SPWidget*>(g_object_new(SP_TYPE_WIDGET, NULL));
- if (!SPWidgetImpl::constructGlobal(spw, inkscape)) {
+ if (!SPWidgetImpl::constructGlobal(spw)) {
g_object_unref(spw);
spw = 0;
}
diff --git a/src/widgets/sp-widget.h b/src/widgets/sp-widget.h
index 469ab2d92..b4696e66e 100644
--- a/src/widgets/sp-widget.h
+++ b/src/widgets/sp-widget.h
@@ -17,6 +17,7 @@
#include <glib.h>
#include <gtk/gtk.h>
+#include "inkscape.h"
#define SP_TYPE_WIDGET (SPWidget::getType())
#define SP_WIDGET(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), SP_TYPE_WIDGET, SPWidget))
@@ -27,7 +28,6 @@
namespace Inkscape {
-struct Application;
class Selection;
class SPWidgetImpl;
@@ -38,10 +38,7 @@ struct SPWidget {
static GType getType();
- //
-
GtkBin bin;
- Inkscape::Application *inkscape;
sigc::connection selModified;
sigc::connection selChanged;
@@ -64,7 +61,7 @@ struct SPWidgetClass {
/* fixme: Think (Lauris) */
/** Generic constructor for global widget. */
-GtkWidget *sp_widget_new_global(Inkscape::Application *inkscape);
+GtkWidget *sp_widget_new_global();
#endif // SEEN_SP_WIDGET_H
/*
diff --git a/src/widgets/stroke-marker-selector.cpp b/src/widgets/stroke-marker-selector.cpp
index 00b6b5c91..b5867abaa 100644
--- a/src/widgets/stroke-marker-selector.cpp
+++ b/src/widgets/stroke-marker-selector.cpp
@@ -64,7 +64,7 @@ MarkerComboBox::MarkerComboBox(gchar const *id, int l) :
sp_pixbuf_new( Inkscape::ICON_SIZE_SMALL_TOOLBAR, INKSCAPE_ICON("no-marker") ) ) );
sandbox = ink_markers_preview_doc ();
- desktop = inkscape_active_desktop();
+ desktop = INKSCAPE.active_desktop();
doc = sp_desktop_document(desktop);
modified_connection = doc->getDefs()->connectModified( sigc::hide(sigc::hide(sigc::bind(sigc::ptr_fun(&MarkerComboBox::handleDefsModified), this))) );