summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLiam P. White <inkscapebrony@gmail.com>2014-06-27 01:40:01 +0000
committerLiam P. White <inkscapebrony@gmail.com>2014-06-27 01:40:01 +0000
commita65c95ff4739e2803e28d64b2a3b3774dd1f45aa (patch)
tree96ea7df357bc76c5e50dc89b416a73c0646c5c82
parentConvert accidental member accesses into static function accesses (diff)
downloadinkscape-a65c95ff4739e2803e28d64b2a3b3774dd1f45aa.tar.gz
inkscape-a65c95ff4739e2803e28d64b2a3b3774dd1f45aa.zip
Move constructor/destructor into private section, remove protected section. Rename init(). Add to-do list.
(bzr r13341.5.8)
-rw-r--r--src/inkscape.cpp17
-rw-r--r--src/inkscape.h13
-rw-r--r--src/inkview.cpp2
-rw-r--r--src/main.cpp4
-rw-r--r--src/ui/dialog/filedialogimpl-gtkmm.cpp2
-rw-r--r--src/ui/widget/imageicon.cpp2
6 files changed, 26 insertions, 14 deletions
diff --git a/src/inkscape.cpp b/src/inkscape.cpp
index 60f950636..89501c646 100644
--- a/src/inkscape.cpp
+++ b/src/inkscape.cpp
@@ -9,7 +9,7 @@
*
* Copyright (C) 1999-2014 authors
* c++ port Copyright (C) 2003 Nathan Hurst
- * c++ification copyright (C) 2014 Liam P. White
+ * c++ification Copyright (C) 2014 Liam P. White
*
* Released under GNU GPL, read the file 'COPYING' for more information
*/
@@ -103,6 +103,19 @@ typedef int uid_t;
#define getuid() 0
#endif
+/** C++ification TODO list
+ * - _S_inst should NOT need to be assigned inside the constructor, but if it isn't the Filters+Extensions menus break.
+ * - Application::_deskops has to be a pointer because of a signal bug somewhere else. Basically, it will attempt to access a deleted object in sp_ui_close_all(),
+ * but if it's a pointer we can stop and return NULL in Application::active_desktop()
+ * - These functions are calling Application::create for no good reason I can determine:
+ *
+ * Inkscape::UI::Dialog::SVGPreview::SVGPreview()
+ * src/ui/dialog/filedialogimpl-gtkmm.cpp:542:9
+ * void Inkscape::UI::Widget::ImageIcon::init()
+ * src/ui/widget/imageicon.cpp:93:9
+ */
+
+
class InkErrorHandler : public Inkscape::ErrorReporter {
public:
InkErrorHandler(bool useGui) : Inkscape::ErrorReporter(),
@@ -157,7 +170,7 @@ int inkscape_autosave(gpointer) {
namespace Inkscape {
void
-Application::init (const char *argv0, bool use_gui)
+Application::create(const char *argv0, bool use_gui)
{
if (!Application::instance()) {
new Application(argv0, use_gui);
diff --git a/src/inkscape.h b/src/inkscape.h
index 821970748..966b6ee87 100644
--- a/src/inkscape.h
+++ b/src/inkscape.h
@@ -76,15 +76,9 @@ public:
namespace Inkscape {
class Application {
-protected:
- static Inkscape::Application * _S_inst;
-
- Application(const char* argv0, bool use_gui);
- ~Application();
-
public:
static Application* instance();
- static void init(const char* argv0, bool use_gui);
+ static void create(const char* argv0, bool use_gui);
// returns the mask of the keyboard modifier to map to Alt, zero if no mapping
// Needs to be a guint because gdktypes.h does not define a 'no-modifier' value
@@ -207,6 +201,11 @@ public:
sigc::signal<void> signal_external_change;
private:
+ static Inkscape::Application * _S_inst;
+
+ Application(const char* argv0, bool use_gui);
+ ~Application();
+
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 1ec8393ba..721b4784f 100644
--- a/src/inkview.cpp
+++ b/src/inkview.cpp
@@ -232,7 +232,7 @@ main (int argc, const char **argv)
ss.view = NULL;
ss.fullscreen = false;
- Inkscape::Application::init(argv[0], true);
+ Inkscape::Application::create(argv[0], true);
inkscape = Inkscape::Application::instance();
// starting at where the commandline options stopped parsing because
diff --git a/src/main.cpp b/src/main.cpp
index 499285a7b..2e36e3d50 100644
--- a/src/main.cpp
+++ b/src/main.cpp
@@ -1059,7 +1059,7 @@ sp_main_gui(int argc, char const **argv)
gboolean create_new = TRUE;
/// \todo FIXME BROKEN - non-UTF-8 sneaks in here.
- Inkscape::Application::init(argv[0], true);
+ Inkscape::Application::create(argv[0], true);
while (fl) {
if (sp_file_open((gchar *)fl->data,NULL)) {
@@ -1335,7 +1335,7 @@ int sp_main_console(int argc, char const **argv)
exit(0);
}
- Inkscape::Application::init(argv[0], false);
+ Inkscape::Application::create(argv[0], false);
if (sp_shell) {
int retVal = sp_main_shell(argv[0]); // Run as interactive shell
diff --git a/src/ui/dialog/filedialogimpl-gtkmm.cpp b/src/ui/dialog/filedialogimpl-gtkmm.cpp
index 50a883612..014c85bd7 100644
--- a/src/ui/dialog/filedialogimpl-gtkmm.cpp
+++ b/src/ui/dialog/filedialogimpl-gtkmm.cpp
@@ -539,7 +539,7 @@ bool SVGPreview::set(Glib::ustring &fileName, int dialogType)
SVGPreview::SVGPreview()
{
if (!INKSCAPE)
- Inkscape::Application::init("", false);
+ Inkscape::Application::create("", false);
document = NULL;
viewerGtk = NULL;
set_size_request(150, 150);
diff --git a/src/ui/widget/imageicon.cpp b/src/ui/widget/imageicon.cpp
index 0ccff0c9e..8c1e44434 100644
--- a/src/ui/widget/imageicon.cpp
+++ b/src/ui/widget/imageicon.cpp
@@ -90,7 +90,7 @@ void ImageIcon::init()
{
// \FIXME Why?
if (!INKSCAPE)
- Inkscape::Application::init("", false);
+ Inkscape::Application::create("", false);
document = NULL;
viewerGtkmm = NULL;
//set_size_request(150,150);