diff options
| author | Tavmjong Bah <tavmjong@free.fr> | 2019-04-06 18:54:25 +0000 |
|---|---|---|
| committer | Tavmjong Bah <tavmjong@free.fr> | 2019-04-06 18:54:25 +0000 |
| commit | 87eb273ceca7e4212a4bfbf2e04b616bac73a701 (patch) | |
| tree | 5974d5938b0a71bf48a5486c5d669c4767aa2341 /src | |
| parent | CMake: Fix module FindDoubleConversion.cmake (diff) | |
| download | inkscape-87eb273ceca7e4212a4bfbf2e04b616bac73a701.tar.gz inkscape-87eb273ceca7e4212a4bfbf2e04b616bac73a701.zip | |
More document.h cleanup.
Diffstat (limited to 'src')
| -rw-r--r-- | src/conn-avoid-ref.cpp | 10 | ||||
| -rw-r--r-- | src/document.cpp | 101 | ||||
| -rw-r--r-- | src/document.h | 94 | ||||
| -rw-r--r-- | src/extension/implementation/script.cpp | 2 | ||||
| -rw-r--r-- | src/extension/internal/emf-print.cpp | 2 | ||||
| -rw-r--r-- | src/extension/internal/odf.cpp | 4 | ||||
| -rw-r--r-- | src/extension/internal/pdfinput/svg-builder.cpp | 2 | ||||
| -rw-r--r-- | src/extension/internal/svg.cpp | 2 | ||||
| -rw-r--r-- | src/extension/internal/wmf-print.cpp | 2 | ||||
| -rw-r--r-- | src/gradient-chemistry.cpp | 2 | ||||
| -rw-r--r-- | src/inkscape-application.cpp | 6 | ||||
| -rw-r--r-- | src/io/file-export-cmd.cpp | 2 | ||||
| -rw-r--r-- | src/object/box3d-side.cpp | 2 | ||||
| -rw-r--r-- | src/object/box3d.cpp | 2 | ||||
| -rw-r--r-- | src/object/sp-conn-end-pair.cpp | 4 | ||||
| -rw-r--r-- | src/object/sp-style-elem.cpp | 14 | ||||
| -rw-r--r-- | src/style.cpp | 9 | ||||
| -rw-r--r-- | src/svg/svg-color.cpp | 4 | ||||
| -rw-r--r-- | src/ui/clipboard.cpp | 2 | ||||
| -rw-r--r-- | src/ui/dialog/print.cpp | 2 | ||||
| -rw-r--r-- | src/ui/tools/connector-tool.cpp | 2 | ||||
| -rw-r--r-- | src/ui/widget/color-icc-selector.cpp | 4 | ||||
| -rw-r--r-- | src/ui/widget/color-notebook.cpp | 4 |
23 files changed, 125 insertions, 153 deletions
diff --git a/src/conn-avoid-ref.cpp b/src/conn-avoid-ref.cpp index 32d564fe6..aa7f91cad 100644 --- a/src/conn-avoid-ref.cpp +++ b/src/conn-avoid-ref.cpp @@ -61,7 +61,7 @@ SPAvoidRef::~SPAvoidRef() // If the document is being destroyed then the router instance // and the ShapeRefs will have been destroyed with it. - Router *router = item->document->router; + Router *router = item->document->getRouter(); if (shapeRef && router) { router->deleteShape(shapeRef); @@ -103,7 +103,7 @@ void SPAvoidRef::handleSettingChange() } setting = new_setting; - Router *router = item->document->router; + Router *router = item->document->getRouter(); _transformed_connection.disconnect(); if (new_setting) { @@ -137,7 +137,7 @@ std::vector<SPItem *> SPAvoidRef::getAttachedShapes(const unsigned int type) Avoid::IntList shapes; GQuark shapeId = g_quark_from_string(item->getId()); - item->document->router->attachedShapes(shapes, shapeId, type); + item->document->getRouter()->attachedShapes(shapes, shapeId, type); Avoid::IntList::iterator finish = shapes.end(); for (Avoid::IntList::iterator i = shapes.begin(); i != finish; ++i) { @@ -161,7 +161,7 @@ std::vector<SPItem *> SPAvoidRef::getAttachedConnectors(const unsigned int type) Avoid::IntList conns; GQuark shapeId = g_quark_from_string(item->getId()); - item->document->router->attachedConns(conns, shapeId, type); + item->document->getRouter()->attachedConns(conns, shapeId, type); Avoid::IntList::iterator finish = conns.end(); for (Avoid::IntList::iterator i = conns.begin(); i != finish; ++i) { @@ -351,7 +351,7 @@ void avoid_item_move(Geom::Affine const */*mp*/, SPItem *moved_item) Avoid::ShapeRef *shapeRef = moved_item->avoidRef->shapeRef; g_assert(shapeRef); - Router *router = moved_item->document->router; + Router *router = moved_item->document->getRouter(); Avoid::Polygon poly = avoid_item_poly(moved_item); if (!poly.empty()) { router->moveShape(shapeRef, poly); diff --git a/src/document.cpp b/src/document.cpp index 8c6ba7c86..667bea396 100644 --- a/src/document.cpp +++ b/src/document.cpp @@ -84,8 +84,6 @@ using Inkscape::Util::unit_table; #define SP_DOCUMENT_REROUTING_PRIORITY (G_PRIORITY_HIGH_IDLE - 1) bool sp_no_convert_text_baseline_spacing = false; -static gint sp_document_idle_handler(gpointer data); -static gint sp_document_rerouting_handler(gpointer data); //gboolean sp_document_resource_list_free(gpointer key, gpointer value, gpointer data); @@ -95,9 +93,9 @@ static gint doc_mem_count = 0; static unsigned long next_serial = 0; SPDocument::SPDocument() : - keepalive(FALSE), - virgin(TRUE), - modified_since_save(FALSE), + keepalive(false), + virgin(true), + modified_since_save(false), rdoc(nullptr), rroot(nullptr), root(nullptr), @@ -108,8 +106,6 @@ SPDocument::SPDocument() : document_base(nullptr), document_name(nullptr), actionkey(), - modified_id(0), - rerouting_handler_id(0), profileManager(nullptr), // deferred until after other initialization router(new Avoid::Router(Avoid::PolyLineRouting|Avoid::OrthogonalRouting)), oldSignalsConnected(false), @@ -195,19 +191,12 @@ SPDocument::~SPDocument() { document_uri = nullptr; } - if (modified_id) { - g_source_remove(modified_id); - modified_id = 0; - } - - if (rerouting_handler_id) { - g_source_remove(rerouting_handler_id); - rerouting_handler_id = 0; - } + modified_connection.disconnect(); + rerouting_connection.disconnect(); if (keepalive) { inkscape_unref(INKSCAPE); - keepalive = FALSE; + keepalive = false; } if (this->current_persp3d_impl) @@ -218,6 +207,11 @@ SPDocument::~SPDocument() { collectOrphans(); } +Inkscape::XML::Node *SPDocument::getReprNamedView() +{ + return sp_repr_lookup_name (rroot, "sodipodi:namedview"); +} + SPDefs *SPDocument::getDefs() { if (!root) { @@ -241,10 +235,6 @@ Persp3D *SPDocument::getCurrentPersp3D() { return current_persp3d; } -Persp3DImpl *SPDocument::getCurrentPersp3DImpl() { - return current_persp3d_impl; -} - void SPDocument::setCurrentPersp3D(Persp3D * const persp) { current_persp3d = persp; //current_persp3d_impl = persp->perspective_impl; @@ -269,10 +259,6 @@ void SPDocument::initialize_current_persp3d() } **/ -unsigned long SPDocument::serial() const { - return _serial; -} - void SPDocument::queueForOrphanCollection(SPObject *object) { g_return_if_fail(object != nullptr); g_return_if_fail(object->document == this); @@ -293,16 +279,11 @@ void SPDocument::collectOrphans() { } } -void SPDocument::reset_key (void */*dummy*/) -{ - actionkey.clear(); -} - SPDocument *SPDocument::createDoc(Inkscape::XML::Document *rdoc, gchar const *document_uri, gchar const *document_base, gchar const *document_name, - unsigned int keepalive, + bool keepalive, SPDocument *parent) { SPDocument *document = new SPDocument(); @@ -525,7 +506,7 @@ SPDocument *SPDocument::createChildDoc(std::string const &document_uri) * Fetches document from URI, or creates new, if NULL; public document * appears in document list. */ -SPDocument *SPDocument::createNewDoc(gchar const *document_uri, unsigned int keepalive, bool make_new, SPDocument *parent) +SPDocument *SPDocument::createNewDoc(gchar const *document_uri, bool keepalive, bool make_new, SPDocument *parent) { Inkscape::XML::Document *rdoc = nullptr; gchar *document_base = nullptr; @@ -577,7 +558,7 @@ SPDocument *SPDocument::createNewDoc(gchar const *document_uri, unsigned int kee return doc; } -SPDocument *SPDocument::createNewDocFromMem(gchar const *buffer, gint length, unsigned int keepalive) +SPDocument *SPDocument::createNewDocFromMem(gchar const *buffer, gint length, bool keepalive) { SPDocument *doc = nullptr; @@ -1267,13 +1248,16 @@ Glib::ustring SPDocument::getLanguage() const void SPDocument::requestModified() { - if (!modified_id) { - modified_id = g_idle_add_full(SP_DOCUMENT_UPDATE_PRIORITY, - sp_document_idle_handler, this, nullptr); + if (modified_connection.empty()) { + modified_connection = + Glib::signal_idle().connect(sigc::mem_fun(*this, &SPDocument::idle_handler), + SP_DOCUMENT_UPDATE_PRIORITY); } - if (!rerouting_handler_id) { - rerouting_handler_id = g_idle_add_full(SP_DOCUMENT_REROUTING_PRIORITY, - sp_document_rerouting_handler, this, nullptr); + + if (rerouting_connection.empty()) { + rerouting_connection = + Glib::signal_idle().connect(sigc::mem_fun(*this, &SPDocument::rerouting_handler), + SP_DOCUMENT_REROUTING_PRIORITY); } } @@ -1350,31 +1334,24 @@ gint SPDocument::ensureUpToDate() router->processTransaction(); } } - - if (modified_id) { - // Remove handler - g_source_remove(modified_id); - modified_id = 0; - } - if (rerouting_handler_id) { - // Remove handler - g_source_remove(rerouting_handler_id); - rerouting_handler_id = 0; - } - return counter>0; + + // Remove handlers + modified_connection.disconnect(); + rerouting_connection.disconnect(); + + return (counter > 0); } /** * An idle handler to update the document. Returns true if * the document needs further updates. */ -static gint -sp_document_idle_handler(gpointer data) +bool +SPDocument::idle_handler() { - SPDocument *doc = static_cast<SPDocument *>(data); - bool status = !doc->_updateDocument(); // method TRUE if it does NOT need further modification, so invert + bool status = !_updateDocument(); // method TRUE if it does NOT need further modification, so invert if (!status) { - doc->modified_id = 0; + modified_connection.disconnect(); } return status; } @@ -1382,18 +1359,16 @@ sp_document_idle_handler(gpointer data) /** * An idle handler to reroute connectors in the document. */ -static gint -sp_document_rerouting_handler(gpointer data) +bool +SPDocument::rerouting_handler() { // Process any queued movement actions and determine new routings for // object-avoiding connectors. Callbacks will be used to update and // redraw affected connectors. - SPDocument *doc = static_cast<SPDocument *>(data); - doc->router->processTransaction(); + router->processTransaction(); // We don't need to handle rerouting again until there are further // diagram updates. - doc->rerouting_handler_id = 0; return false; } @@ -1833,10 +1808,6 @@ unsigned int SPDocument::vacuumDocument() return start - newend; } -bool SPDocument::isSeeking() const { - return seeking; -} - /** * Indicate to the user if the document has been modified since the last save by displaying a "*" in front of the name of the file in the window title. * diff --git a/src/document.h b/src/document.h index b8f1aeb43..c0c0d3b81 100644 --- a/src/document.h +++ b/src/document.h @@ -102,8 +102,6 @@ class SPDocument : public Inkscape::GC::Managed<>, public Inkscape::GC::Anchored { -// Note: multiple public and private sections is not a good practice, but happens -// in this class as transitional to fixing encapsulation: public: /************ Functions *****************/ @@ -116,24 +114,30 @@ public: // Document creation ------------------ - static SPDocument *createNewDoc(char const*uri, unsigned int keepalive, - bool make_new = false, SPDocument *parent=nullptr ); - static SPDocument *createNewDocFromMem(char const*buffer, int length, unsigned int keepalive); - SPDocument *createChildDoc(std::string const &uri); - static SPDocument *createDoc(Inkscape::XML::Document *rdoc, char const *uri, - char const *base, char const *name, unsigned int keepalive, + char const *base, char const *name, bool keepalive, SPDocument *parent); + static SPDocument *createNewDoc(char const*uri, bool keepalive, + bool make_new = false, SPDocument *parent=nullptr ); + static SPDocument *createNewDocFromMem(char const*buffer, int length, bool keepalive); + SPDocument *createChildDoc(std::string const &uri); // Document status -------------------- + void setVirgin(bool Virgin) { virgin = Virgin; } + bool getVirgin() { return virgin; } + SPDocument *doRef(); SPDocument *doUnref(); bool isModifiedSinceSave() const { return modified_since_save; } void setModifiedSinceSave(bool const modified = true); + bool idle_handler(); + bool rerouting_handler(); + void requestModified(); + bool _updateDocument(); // Used by stand-alone sp_document_idle_handler int ensureUpToDate(); bool addResource(char const *key, SPObject *object); @@ -143,8 +147,6 @@ public: void do_change_uri(char const *const filename, bool const rebase); void changeUriAndHrefs(char const *uri); - bool _updateDocument(); // Used by stand-alone sp_document_idle_handler - private: void _importDefsNode(SPDocument *source, Inkscape::XML::Node *defs, Inkscape::XML::Node *target_defs); @@ -156,7 +158,10 @@ public: /******** Getters and Setters **********/ // Document structure ----------------- + Inkscape::ProfileManager* getProfileManager() const { return profileManager; } + Avoid::Router* getRouter() const { return router; } + /** Returns our SPRoot */ SPRoot *getRoot() { return root; } SPRoot const *getRoot() const { return root; } @@ -165,22 +170,29 @@ public: SPDefs *getDefs(); Inkscape::XML::Node *getReprRoot() { return rroot; } + Inkscape::XML::Node *getReprNamedView(); /** Our Inkscape::XML::Document. */ Inkscape::XML::Document *getReprDoc() { return rdoc; } Inkscape::XML::Document const *getReprDoc() const { return rdoc; } + Glib::ustring getLanguage() const; + // Styling + CRCascade *getStyleCascade() { return style_cascade; } + CRStyleSheet *getStyleSheet() { return style_sheet; } + void const setStyleSheet(CRStyleSheet* sheet) { style_sheet = sheet; } + // File information -------------------- /** A filename (not a URI yet), or NULL */ - char const *getDocumentURI() const { return document_uri; } void setDocumentUri(char const *document_uri); + char const *getDocumentURI() const { return document_uri; } /** To be used for resolving relative hrefs. */ - char const *getDocumentBase() const { return document_base; }; void setDocumentBase( char const* document_base ); + char const *getDocumentBase() const { return document_base; }; /** basename(uri) or other human-readable label for the document. */ char const* getDocumentName() const { return document_name; } @@ -247,7 +259,7 @@ public: Persp3D * getCurrentPersp3D(); void setCurrentPersp3DImpl(Persp3DImpl * const persp_impl) { current_persp3d_impl = persp_impl; } - Persp3DImpl * getCurrentPersp3DImpl(); + Persp3DImpl * getCurrentPersp3DImpl() { return current_persp3d_impl; } void getPerspectivesInDefs(std::vector<Persp3D*> &list) const; unsigned int numPerspectivesInDefs() const { @@ -258,10 +270,10 @@ public: // Document undo/redo ---------------------- - unsigned long serial() const; // Returns document's unique number. - bool isSeeking() const; // Are we in a transition between two "known good" states of document? - void reset_key(void *dummy); - bool isSensitive() const { return sensitive; }; + unsigned long serial() const { return _serial; } // Returns document's unique number. + bool isSeeking() const {return seeking;} // In a transition between two "good" states of document? + void reset_key(void *dummy) { actionkey.clear(); } + bool isSensitive() const { return sensitive; } // Garbage collecting ---------------------- @@ -269,26 +281,26 @@ public: void collectOrphans(); - /************* Data ***************/ +private: // Document ------------------------------ - Inkscape::ProfileManager* profileManager; + Inkscape::ProfileManager* profileManager; // Color profile. Avoid::Router *router; // Instance of the connector router // Document status ----------------------- int ref_count; // Temp to check refcounting - unsigned int keepalive : 1; - unsigned int virgin : 1; ///< Has the document never been touched? - unsigned int modified_since_save : 1; - unsigned modified_id; /// Handler id + bool keepalive; ///< false if temporary document (e.g. to generate a PNG for display in a dialog). + bool virgin ; ///< Has the document never been touched? + bool modified_since_save; + sigc::connection modified_connection; + sigc::connection rerouting_connection; // Document structure -------------------- Inkscape::XML::Document *rdoc; ///< Our Inkscape::XML::Document Inkscape::XML::Node *rroot; ///< Root element of Inkscape::XML::Document -private: SPRoot *root; ///< Our SPRoot // A list of svg documents being used or shown within this document @@ -296,15 +308,11 @@ private: // Conversely this is a parent document because this is a child. SPDocument *_parent_document; -public: - /// Connector rerouting handler ID - unsigned rerouting_handler_id; - + // Styling CRCascade *style_cascade; CRStyleSheet *style_sheet; // File information ---------------------- -private: char *document_uri; ///< A filename (not a URI yet), or NULL char *document_base; ///< To be used for resolving relative hrefs. char *document_name; ///< basename(uri) or other human-readable label for the document. @@ -322,7 +330,6 @@ private: Persp3DImpl *current_persp3d_impl; // Document undo/redo ---------------------- - friend Inkscape::DocumentUndo; /* Undo/Redo state */ @@ -349,12 +356,6 @@ private: /*********** Signals **************/ - -public: - void addUndoObserver(Inkscape::UndoStackObserver& observer); - void removeUndoObserver(Inkscape::UndoStackObserver& observer); - -private: typedef sigc::signal<void, SPObject *> IDChangedSignal; typedef sigc::signal<void> ResourcesChangedSignal; typedef sigc::signal<void, unsigned> ModifiedSignal; @@ -379,7 +380,17 @@ private: bool oldSignalsConnected; + sigc::connection _selection_changed_connection; + sigc::connection _desktop_activated_connection; + sigc::connection selChangeConnection; + sigc::connection desktopActivatedConnection; + + sigc::signal<void> destroySignal; + public: + void addUndoObserver(Inkscape::UndoStackObserver& observer); + void removeUndoObserver(Inkscape::UndoStackObserver& observer); + sigc::connection connectDestroy(sigc::signal<void>::slot_type slot); sigc::connection connectModified(ModifiedSignal::slot_type slot); sigc::connection connectURISet(URISetSignal::slot_type slot); @@ -390,21 +401,10 @@ public: sigc::connection connectReconstructionStart(ReconstructionStart::slot_type slot); sigc::connection connectReconstructionFinish(ReconstructionFinish::slot_type slot); -private: - sigc::connection _selection_changed_connection; - sigc::connection _desktop_activated_connection; - sigc::connection selChangeConnection; - sigc::connection desktopActivatedConnection; - /* Resources */ std::map<std::string, std::vector<SPObject *> > resources; -public: ResourcesChangedSignalMap resources_changed_signals; // Used by Extension::Internal::Filter -private: - sigc::signal<void> destroySignal; - -public: void _emitModified(); // Used by SPItem void emitReconstructionStart(); void emitReconstructionFinish(); diff --git a/src/extension/implementation/script.cpp b/src/extension/implementation/script.cpp index b87b8cb15..53f082955 100644 --- a/src/extension/implementation/script.cpp +++ b/src/extension/implementation/script.cpp @@ -718,7 +718,7 @@ void Script::effect(Inkscape::Extension::Effect *module, if (vd != nullptr) { vd->emitReconstructionStart(); - copy_doc(vd->rroot, mydoc->rroot); + copy_doc(vd->getReprRoot(), mydoc->getReprRoot()); vd->emitReconstructionFinish(); // Getting the named view from the document generated by the extension diff --git a/src/extension/internal/emf-print.cpp b/src/extension/internal/emf-print.cpp index 880cd00d2..6d330f2ea 100644 --- a/src/extension/internal/emf-print.cpp +++ b/src/extension/internal/emf-print.cpp @@ -149,7 +149,7 @@ unsigned int PrintEmf::begin(Inkscape::Extension::Print *mod, SPDocument *doc) htextalignment = U_TA_BASELINE | U_TA_LEFT; use_stroke = use_fill = simple_shape = usebk = false; - Inkscape::XML::Node *nv = sp_repr_lookup_name(doc->rroot, "sodipodi:namedview"); + Inkscape::XML::Node *nv = doc->getReprNamedView(); if (nv) { const char *p1 = nv->attribute("pagecolor"); char *p2; diff --git a/src/extension/internal/odf.cpp b/src/extension/internal/odf.cpp index f2192b9af..6debd3f28 100644 --- a/src/extension/internal/odf.cpp +++ b/src/extension/internal/odf.cpp @@ -2044,7 +2044,7 @@ void OdfOutput::save(Inkscape::Extension::Output */*mod*/, SPDocument *doc, gcha docBaseUri = Inkscape::URI::from_dirname(doc->getDocumentBase()).str(); ZipFile zf; - preprocess(zf, doc->rroot); + preprocess(zf, doc->getReprRoot()); if (!writeManifest(zf)) { @@ -2052,7 +2052,7 @@ void OdfOutput::save(Inkscape::Extension::Output */*mod*/, SPDocument *doc, gcha return; } - if (!writeContent(zf, doc->rroot)) + if (!writeContent(zf, doc->getReprRoot())) { g_warning("Failed to write content"); return; diff --git a/src/extension/internal/pdfinput/svg-builder.cpp b/src/extension/internal/pdfinput/svg-builder.cpp index 7247536e9..9b4b55e21 100644 --- a/src/extension/internal/pdfinput/svg-builder.cpp +++ b/src/extension/internal/pdfinput/svg-builder.cpp @@ -83,7 +83,7 @@ SvgBuilder::SvgBuilder(SPDocument *document, gchar *docname, XRef *xref) _docname = docname; _xref = xref; _xml_doc = _doc->getReprDoc(); - _container = _root = _doc->rroot; + _container = _root = _doc->getReprRoot(); _root->setAttribute("xml:space", "preserve"); _init(); diff --git a/src/extension/internal/svg.cpp b/src/extension/internal/svg.cpp index 50a045a94..b5acf81a8 100644 --- a/src/extension/internal/svg.cpp +++ b/src/extension/internal/svg.cpp @@ -867,7 +867,7 @@ Svg::save(Inkscape::Extension::Output *mod, SPDocument *doc, gchar const *filena { g_return_if_fail(doc != nullptr); g_return_if_fail(filename != nullptr); - Inkscape::XML::Document *rdoc = doc->rdoc; + Inkscape::XML::Document *rdoc = doc->getReprDoc(); bool const exportExtensions = ( !mod->get_id() || !strcmp (mod->get_id(), SP_MODULE_KEY_OUTPUT_SVG_INKSCAPE) diff --git a/src/extension/internal/wmf-print.cpp b/src/extension/internal/wmf-print.cpp index 7c7e2572e..9eba6cae8 100644 --- a/src/extension/internal/wmf-print.cpp +++ b/src/extension/internal/wmf-print.cpp @@ -142,7 +142,7 @@ unsigned int PrintWmf::begin(Inkscape::Extension::Print *mod, SPDocument *doc) htextalignment = U_TA_BASELINE | U_TA_LEFT; use_stroke = use_fill = simple_shape = usebk = false; - Inkscape::XML::Node *nv = sp_repr_lookup_name(doc->rroot, "sodipodi:namedview"); + Inkscape::XML::Node *nv = doc->getReprNamedView(); if (nv) { const char *p1 = nv->attribute("pagecolor"); char *p2; diff --git a/src/gradient-chemistry.cpp b/src/gradient-chemistry.cpp index 10adb8af8..63bdb397d 100644 --- a/src/gradient-chemistry.cpp +++ b/src/gradient-chemistry.cpp @@ -1535,7 +1535,7 @@ static void addStop( Inkscape::XML::Node *parent, Glib::ustring const &color, gi SPGradient *sp_document_default_gradient_vector( SPDocument *document, SPColor const &color, bool singleStop ) { SPDefs *defs = document->getDefs(); - Inkscape::XML::Document *xml_doc = document->rdoc; + Inkscape::XML::Document *xml_doc = document->getReprDoc(); Inkscape::XML::Node *repr = xml_doc->createElement("svg:linearGradient"); diff --git a/src/inkscape-application.cpp b/src/inkscape-application.cpp index 7ed49179b..1ba4cd0b6 100644 --- a/src/inkscape-application.cpp +++ b/src/inkscape-application.cpp @@ -117,7 +117,7 @@ InkscapeApplication::document_open(const Glib::RefPtr<Gio::File>& file) SPDocument *document = ink_file_open(file, cancelled); if (document) { - document->virgin = false; // Prevents replacing document in same window during file open. + document->setVirgin(false); // Prevents replacing document in same window during file open. document_add (document); } else { @@ -204,7 +204,7 @@ InkscapeApplication::document_revert(SPDocument* document) } // Allow overwriting current document. - document->virgin = true; + document->setVirgin(true); auto it = _documents.find(document); if (it != _documents.end()) { @@ -638,7 +638,7 @@ ConcreteInkscapeApplication<Gtk::Application>::create_window(const Glib::RefPtr< // TODO Remove this code... handle document replacement elsewhere. SPDocument* old_document = _active_document; - if (replace_empty && old_document && old_document->virgin) { + if (replace_empty && old_document && old_document->getVirgin()) { // virgin == true => an empty document (template). // Is there a better place for this? It requires GUI. diff --git a/src/io/file-export-cmd.cpp b/src/io/file-export-cmd.cpp index 03b738197..1582a94ad 100644 --- a/src/io/file-export-cmd.cpp +++ b/src/io/file-export-cmd.cpp @@ -314,7 +314,7 @@ InkFileExportCmd::do_export_png(SPDocument *doc, std::string filename_in) bgcolor |= 0xff; // default is no opacity } else { // read from namedview - Inkscape::XML::Node *nv = sp_repr_lookup_name (doc->rroot, "sodipodi:namedview"); + Inkscape::XML::Node *nv = doc->getReprNamedView(); if (nv && nv->attribute("pagecolor")){ bgcolor = sp_svg_read_color(nv->attribute("pagecolor"), 0xffffff00); } diff --git a/src/object/box3d-side.cpp b/src/object/box3d-side.cpp index 72566e617..6fcf22a9c 100644 --- a/src/object/box3d-side.cpp +++ b/src/object/box3d-side.cpp @@ -122,7 +122,7 @@ void Box3DSide::update(SPCtx* ctx, guint flags) { Box3DSide * Box3DSide::createBox3DSide(SPBox3D *box) { Box3DSide *box3d_side = nullptr; - Inkscape::XML::Document *xml_doc = box->document->rdoc; + Inkscape::XML::Document *xml_doc = box->document->getReprDoc();; Inkscape::XML::Node *repr_side = xml_doc->createElement("svg:path"); repr_side->setAttribute("sodipodi:type", "inkscape:box3dside"); box3d_side = static_cast<Box3DSide *>(box->appendChildRepr(repr_side)); diff --git a/src/object/box3d.cpp b/src/object/box3d.cpp index 26ac9de8a..483e5e7ae 100644 --- a/src/object/box3d.cpp +++ b/src/object/box3d.cpp @@ -431,7 +431,7 @@ box3d_snap (SPBox3D *box, int id, Proj::Pt3 const &pt_proj, Proj::Pt3 const &sta SPBox3D * SPBox3D::createBox3D(SPItem * parent) { SPBox3D *box3d = nullptr; - Inkscape::XML::Document *xml_doc = parent->document->rdoc; + Inkscape::XML::Document *xml_doc = parent->document->getReprDoc(); Inkscape::XML::Node *repr = xml_doc->createElement("svg:g"); repr->setAttribute("sodipodi:type", "inkscape:box3d"); box3d = reinterpret_cast<SPBox3D *>(parent->appendChildRepr(repr)); diff --git a/src/object/sp-conn-end-pair.cpp b/src/object/sp-conn-end-pair.cpp index 2f60e9a9e..899a4f12d 100644 --- a/src/object/sp-conn-end-pair.cpp +++ b/src/object/sp-conn-end-pair.cpp @@ -64,7 +64,7 @@ void SPConnEndPair::release() // If the document is being destroyed then the router instance // and the ConnRefs will have been destroyed with it. - const bool routerInstanceExists = (_path->document->router != nullptr); + const bool routerInstanceExists = (_path->document->getRouter() != nullptr); if (_connRef && routerInstanceExists) { _connRef->router()->deleteConnector(_connRef); @@ -101,7 +101,7 @@ void SPConnEndPair::setAttr(unsigned const key, gchar const *const value) if (!_connRef) { _connType = new_conn_type; - Avoid::Router *router = _path->document->router; + Avoid::Router *router = _path->document->getRouter(); _connRef = new Avoid::ConnRef(router); _connRef->setRoutingType(new_conn_type == SP_CONNECTOR_POLYLINE ? Avoid::ConnType_PolyLine : Avoid::ConnType_Orthogonal); diff --git a/src/object/sp-style-elem.cpp b/src/object/sp-style-elem.cpp index dae679bb4..439a1b3cb 100644 --- a/src/object/sp-style-elem.cpp +++ b/src/object/sp-style-elem.cpp @@ -188,7 +188,7 @@ import_style_cb (CRDocHandler *a_handler, std::cerr << "import_style_cb: No document!" << std::endl; return; } - if (!document->style_sheet) { + if (!document->getStyleSheet()) { std::cerr << "import_style_cb: No document style sheet!" << std::endl; return; } @@ -207,7 +207,7 @@ import_style_cb (CRDocHandler *a_handler, CRStatus const parse_status = cr_parser_parse_file (parser, reinterpret_cast<const guchar *>(import_file.c_str()), CR_UTF_8); if (parse_status == CR_OK) { - cr_stylesheet_append_import (document->style_sheet, stylesheet); + cr_stylesheet_append_import (document->getStyleSheet(), stylesheet); } else { std::cerr << "import_style_cb: Could not parse: " << import_file << std::endl; cr_stylesheet_destroy (stylesheet); @@ -468,14 +468,14 @@ void SPStyleElem::read_content() { cr_parser_parse_buf (parser, reinterpret_cast<const guchar *>(text.c_str()), text.bytes(), CR_UTF_8); if (parse_status == CR_OK) { - if(!document->style_sheet) { + if(!document->getStyleSheet()) { // if the style is the first style sheet that we've seen, set the document's // first style sheet to this style and create a cascade object with it. - document->style_sheet = style_sheet; - cr_cascade_set_sheet (document->style_cascade, document->style_sheet, ORIGIN_AUTHOR); + document->setStyleSheet(style_sheet); + cr_cascade_set_sheet (document->getStyleCascade(), document->getStyleSheet(), ORIGIN_AUTHOR); } else { // If not the first, then chain up this style_sheet - cr_stylesheet_append_import (document->style_sheet, style_sheet); + cr_stylesheet_append_import (document->getStyleSheet(), style_sheet); } } else { cr_stylesheet_destroy (style_sheet); @@ -506,7 +506,7 @@ void SPStyleElem::read_content() { // If style sheet has changed, we need to cascade the entire object tree, top down // Get root, read style, loop through children update_style_recursively( (SPObject *)document->getRoot() ); - // cr_stylesheet_dump (document->style_sheet, stdout); + // cr_stylesheet_dump (document->getStyleSheet(), stdout); } /** diff --git a/src/style.cpp b/src/style.cpp index c87d84a9f..1cece6dbd 100644 --- a/src/style.cpp +++ b/src/style.cpp @@ -917,10 +917,11 @@ SPStyle::_mergeObjectStylesheet( SPObject const *const object ) { CRPropList *props = nullptr; //XML Tree being directly used here while it shouldn't be. - CRStatus status = cr_sel_eng_get_matched_properties_from_cascade(sel_eng, - object->document->style_cascade, - object->getRepr(), - &props); + CRStatus status = + cr_sel_eng_get_matched_properties_from_cascade(sel_eng, + object->document->getStyleCascade(), + object->getRepr(), + &props); g_return_if_fail(status == CR_OK); /// \todo Check what errors can occur, and handle them properly. if (props) { diff --git a/src/svg/svg-color.cpp b/src/svg/svg-color.cpp index 1a0c3d8b8..dbd32b706 100644 --- a/src/svg/svg-color.cpp +++ b/src/svg/svg-color.cpp @@ -513,8 +513,8 @@ sp_svg_create_color_hash() void icc_color_to_sRGB(SVGICCColor* icc, guchar* r, guchar* g, guchar* b) { if (icc) { -g_message("profile name: %s", icc->colorProfile.c_str()); - Inkscape::ColorProfile* prof = SP_ACTIVE_DOCUMENT->profileManager->find(icc->colorProfile.c_str()); + g_message("profile name: %s", icc->colorProfile.c_str()); + Inkscape::ColorProfile* prof = SP_ACTIVE_DOCUMENT->getProfileManager()->find(icc->colorProfile.c_str()); if ( prof ) { guchar color_out[4] = {0,0,0,0}; cmsHTRANSFORM trans = prof->getTransfToSRGB8(); diff --git a/src/ui/clipboard.cpp b/src/ui/clipboard.cpp index 4539c9cc9..4fbf2af62 100644 --- a/src/ui/clipboard.cpp +++ b/src/ui/clipboard.cpp @@ -1251,7 +1251,7 @@ void ClipboardManagerImpl::_onGet(Gtk::SelectionData &sel, guint /*info*/) unsigned long int height = (unsigned long int) (area.height() + 0.5); // read from namedview - Inkscape::XML::Node *nv = sp_repr_lookup_name (_clipboardSPDoc->rroot, "sodipodi:namedview"); + Inkscape::XML::Node *nv = _clipboardSPDoc->getReprNamedView(); if (nv && nv->attribute("pagecolor")) { bgcolor = sp_svg_read_color(nv->attribute("pagecolor"), 0xffffff00); } diff --git a/src/ui/dialog/print.cpp b/src/ui/dialog/print.cpp index 2d908cefe..247f526bb 100644 --- a/src/ui/dialog/print.cpp +++ b/src/ui/dialog/print.cpp @@ -132,7 +132,7 @@ void Print::draw_page(const Glib::RefPtr<Gtk::PrintContext>& context, int /*page close(tmp_fd); guint32 bgcolor = 0x00000000; - Inkscape::XML::Node *nv = sp_repr_lookup_name (_workaround._doc->rroot, "sodipodi:namedview"); + Inkscape::XML::Node *nv = _workaround._doc->getReprNamedView(); if (nv && nv->attribute("pagecolor")){ bgcolor = sp_svg_read_color(nv->attribute("pagecolor"), 0xffffff00); } diff --git a/src/ui/tools/connector-tool.cpp b/src/ui/tools/connector-tool.cpp index 5a1654e2f..d6ce66a9e 100644 --- a/src/ui/tools/connector-tool.cpp +++ b/src/ui/tools/connector-tool.cpp @@ -808,7 +808,7 @@ void ConnectorTool::_setSubsequentPoint(Geom::Point const p) Avoid::Point dst(d[Geom::X], d[Geom::Y]); if (!this->newConnRef) { - Avoid::Router *router = desktop->getDocument()->router; + Avoid::Router *router = desktop->getDocument()->getRouter(); this->newConnRef = new Avoid::ConnRef(router); this->newConnRef->setEndpoint(Avoid::VertID::src, src); if (this->isOrthogonal) diff --git a/src/ui/widget/color-icc-selector.cpp b/src/ui/widget/color-icc-selector.cpp index f55dc5176..0970c779c 100644 --- a/src/ui/widget/color-icc-selector.cpp +++ b/src/ui/widget/color-icc-selector.cpp @@ -570,7 +570,7 @@ void ColorICCSelectorImpl::_switchToProfile(gchar const *name) tmp.icc = new SVGICCColor(); } tmp.icc->colorProfile = name; - Inkscape::ColorProfile *newProf = SP_ACTIVE_DOCUMENT->profileManager->find(name); + Inkscape::ColorProfile *newProf = SP_ACTIVE_DOCUMENT->getProfileManager()->find(name); if (newProf) { cmsHTRANSFORM trans = newProf->getTransfFromSRGB8(); if (trans) { @@ -813,7 +813,7 @@ void ColorICCSelectorImpl::_setProfile(SVGICCColor *profile) } if (profile) { - _prof = SP_ACTIVE_DOCUMENT->profileManager->find(profile->colorProfile.c_str()); + _prof = SP_ACTIVE_DOCUMENT->getProfileManager()->find(profile->colorProfile.c_str()); if (_prof && (asICColorProfileClassSig(_prof->getProfileClass()) != cmsSigNamedColorClass)) { #if HAVE_LIBLCMS1 _profChannelCount = _cmsChannelsOf(asICColorSpaceSig(_prof->getColorSpace())); diff --git a/src/ui/widget/color-notebook.cpp b/src/ui/widget/color-notebook.cpp index f635b0665..963e5093d 100644 --- a/src/ui/widget/color-notebook.cpp +++ b/src/ui/widget/color-notebook.cpp @@ -277,7 +277,7 @@ void ColorNotebook::_updateICCButtons() gtk_widget_set_sensitive(_box_outofgamut, false); if (color.icc) { Inkscape::ColorProfile *target_profile = - SP_ACTIVE_DOCUMENT->profileManager->find(color.icc->colorProfile.c_str()); + SP_ACTIVE_DOCUMENT->getProfileManager()->find(color.icc->colorProfile.c_str()); if (target_profile) gtk_widget_set_sensitive(_box_outofgamut, target_profile->GamutCheck(color)); } @@ -285,7 +285,7 @@ void ColorNotebook::_updateICCButtons() /* update too-much-ink icon */ gtk_widget_set_sensitive(_box_toomuchink, false); if (color.icc) { - Inkscape::ColorProfile *prof = SP_ACTIVE_DOCUMENT->profileManager->find(color.icc->colorProfile.c_str()); + Inkscape::ColorProfile *prof = SP_ACTIVE_DOCUMENT->getProfileManager()->find(color.icc->colorProfile.c_str()); if (prof && CMSSystem::isPrintColorSpace(prof)) { gtk_widget_show(GTK_WIDGET(_box_toomuchink)); double ink_sum = 0; |
