From 1602477dfd4371a17639b0b6e4f59f5a5ea9565a Mon Sep 17 00:00:00 2001 From: Tavmjong Bah Date: Fri, 15 Mar 2019 15:21:30 +0100 Subject: Make InkscapeApplication responsible for managing documents and windows. Any change from previous behavior is a bug. --- src/inkscape-application.h | 33 ++++++++++++++++++++++++--------- 1 file changed, 24 insertions(+), 9 deletions(-) (limited to 'src/inkscape-application.h') diff --git a/src/inkscape-application.h b/src/inkscape-application.h index 7c53b2795..05fbafb89 100644 --- a/src/inkscape-application.h +++ b/src/inkscape-application.h @@ -59,22 +59,34 @@ public: Inkscape::UI::View::View* get_active_view() { return _active_view; } void set_active_view(Inkscape::UI::View::View* view) { _active_view = view; } - SPDocument* open_document(const Glib::RefPtr& file); - void close_document(SPDocument* document); + /****** Document ******/ + /* Except for document_fix(), these should not require a GUI! */ + void document_add(SPDocument* document); - void fix_document(SPDocument* document); + SPDocument* document_new(const std::string &Template); + SPDocument* document_open(const Glib::RefPtr& file); + bool document_swap(InkscapeWindow* window, SPDocument* document); + bool document_revert(SPDocument* document); + void document_close(SPDocument* document); + unsigned document_window_count(SPDocument* document); - InkscapeWindow* open_window(SPDocument* document); - void close_window(InkscapeWindow* window); + void document_fix(InkscapeWindow* window); + + /******* Window *******/ + InkscapeWindow* window_open(SPDocument* document); + void window_close(InkscapeWindow* window); // Update all windows connected to a document. - void update_windows(SPDocument* document); + void windows_update(SPDocument* document); + + /******* Debug ********/ + void dump(); // These are needed to cast Glib::RefPtr to Glib::RefPtr, // Presumably, Gtk/Gio::Application takes care of ref counting in ConcreteInkscapeApplication // so we just provide dummies (and there is only one application in the application!). - void reference() { /*printf("reference()\n" );*/ } - void unreference() { /*printf("unreference()\n");*/ } + // void reference() { /*printf("reference()\n" );*/ } + // void unreference() { /*printf("unreference()\n");*/ } protected: bool _with_gui; @@ -111,13 +123,16 @@ private: public: InkFileExportCmd* file_export() override { return &_file_export; } + SPDesktop* create_window(const Glib::RefPtr& file = Glib::RefPtr(), + bool add_to_recent = true, bool replace_empty = true); + bool destroy_window(InkscapeWindow* window); + void destroy_all(); protected: void on_startup() override; void on_startup2() override; void on_activate() override; void on_open(const Gio::Application::type_vec_files& files, const Glib::ustring& hint) override; - SPDesktop* create_window(const Glib::RefPtr& file = Glib::RefPtr()); void parse_actions(const Glib::ustring& input, action_vector_t& action_vector); private: -- cgit v1.2.3