diff options
| author | Tavmjong Bah <tavmjong@free.fr> | 2019-02-20 09:50:38 +0000 |
|---|---|---|
| committer | Tavmjong Bah <tavmjong@free.fr> | 2019-02-20 09:50:38 +0000 |
| commit | 774bee47ed685bd666173cb4d1664933217371c9 (patch) | |
| tree | 077955bb8b312b64b308fbd2ab1a32ee5989f605 | |
| parent | Fix Window centering LPEDialog (diff) | |
| download | inkscape-774bee47ed685bd666173cb4d1664933217371c9.tar.gz inkscape-774bee47ed685bd666173cb4d1664933217371c9.zip | |
Give more descriptive names to document file related variables and functions.
Makes searching through code for them easier.
31 files changed, 168 insertions, 168 deletions
diff --git a/src/actions/actions-output.cpp b/src/actions/actions-output.cpp index f10781890..96523f624 100644 --- a/src/actions/actions-output.cpp +++ b/src/actions/actions-output.cpp @@ -204,8 +204,8 @@ export_do(InkscapeApplication *app) { SPDocument* document = app->get_active_document(); std::string filename; - if (document->getURI()) { - filename = document->getURI(); + if (document->getDocumentURI()) { + filename = document->getDocumentURI(); } app->file_export()->do_export(document, filename); } diff --git a/src/desktop.cpp b/src/desktop.cpp index db861b796..dc54ce6c3 100644 --- a/src/desktop.cpp +++ b/src/desktop.cpp @@ -522,7 +522,7 @@ void SPDesktop::_setDisplayMode(Inkscape::RenderMode mode) { _split_canvas = false; } redrawDesktop(); - _widget->setTitle( this->getDocument()->getName() ); + _widget->setTitle( this->getDocument()->getDocumentName() ); } void SPDesktop::_setDisplayColorMode(Inkscape::ColorMode mode) { // reload grayscale matrix from prefs @@ -543,7 +543,7 @@ void SPDesktop::_setDisplayColorMode(Inkscape::ColorMode mode) { canvas->_colorrendermode = mode; _display_color_mode = mode; redrawDesktop(); - _widget->setTitle( this->getDocument()->getName() ); + _widget->setTitle( this->getDocument()->getDocumentName() ); } void SPDesktop::displayModeToggle() { diff --git a/src/display/nr-filter-image.cpp b/src/display/nr-filter-image.cpp index 29c2c475f..bfc2b6bb1 100644 --- a/src/display/nr-filter-image.cpp +++ b/src/display/nr-filter-image.cpp @@ -158,7 +158,7 @@ void FilterImage::render_cairo(FilterSlot &slot) if ( !g_file_test( fullname, G_FILE_TEST_EXISTS ) ) { // Try to load from relative position combined with document base if( document ) { - fullname = g_build_filename( document->getBase(), feImageHref, NULL ); + fullname = g_build_filename( document->getDocumentBase(), feImageHref, NULL ); } } if ( !g_file_test( fullname, G_FILE_TEST_EXISTS ) ) { diff --git a/src/document.cpp b/src/document.cpp index d8871da7d..a6ad44c9d 100644 --- a/src/document.cpp +++ b/src/document.cpp @@ -104,9 +104,9 @@ SPDocument::SPDocument() : style_cascade(cr_cascade_new(nullptr, nullptr, nullptr)), style_sheet(nullptr), ref_count(0), - uri(nullptr), - base(nullptr), - name(nullptr), + document_uri(nullptr), + document_base(nullptr), + document_name(nullptr), actionkey(), modified_id(0), rerouting_handler_id(0), @@ -182,17 +182,17 @@ SPDocument::~SPDocument() { cr_cascade_unref(style_cascade); style_cascade = nullptr; - if (name) { - g_free(name); - name = nullptr; + if (document_name) { + g_free(document_name); + document_name = nullptr; } - if (base) { - g_free(base); - base = nullptr; + if (document_base) { + g_free(document_base); + document_base = nullptr; } - if (uri) { - g_free(uri); - uri = nullptr; + if (document_uri) { + g_free(document_uri); + document_uri = nullptr; } if (modified_id) { @@ -305,9 +305,9 @@ void SPDocument::reset_key (void */*dummy*/) } SPDocument *SPDocument::createDoc(Inkscape::XML::Document *rdoc, - gchar const *uri, - gchar const *base, - gchar const *name, + gchar const *document_uri, + gchar const *document_base, + gchar const *document_name, unsigned int keepalive, SPDocument *parent) { @@ -325,34 +325,34 @@ SPDocument *SPDocument::createDoc(Inkscape::XML::Document *rdoc, parent->_child_documents.push_back(document); } - if (document->uri){ - g_free(document->uri); - document->uri = nullptr; + if (document->document_uri){ + g_free(document->document_uri); + document->document_uri = nullptr; } - if (document->base){ - g_free(document->base); - document->base = nullptr; + if (document->document_base){ + g_free(document->document_base); + document->document_base = nullptr; } - if (document->name){ - g_free(document->name); - document->name = nullptr; + if (document->document_name){ + g_free(document->document_name); + document->document_name = nullptr; } #ifndef _WIN32 - document->uri = prepend_current_dir_if_relative(uri); + document->document_uri = prepend_current_dir_if_relative(document_uri); #else // FIXME: it may be that prepend_current_dir_if_relative works OK on windows too, test! - document->uri = uri? g_strdup(uri) : NULL; + document->document_uri = document_uri? g_strdup(document_uri) : NULL; #endif // base is simply the part of the path before filename; e.g. when running "inkscape ../file.svg" the base is "../" // which is why we use g_get_current_dir() in calculating the abs path above //This is NULL for a new document - if (base) { - document->base = g_strdup(base); + if (document_base) { + document->document_base = g_strdup(document_base); } else { - document->base = nullptr; + document->document_base = nullptr; } - document->name = g_strdup(name); + document->document_name = g_strdup(document_name); // Create SPRoot element const std::string typeString = NodeTraits::get_type_string(*rroot); @@ -482,14 +482,14 @@ SPDocument *SPDocument::createDoc(Inkscape::XML::Document *rdoc, /** * Fetches a document and attaches it to the current document as a child href */ -SPDocument *SPDocument::createChildDoc(std::string const &uri) +SPDocument *SPDocument::createChildDoc(std::string const &document_uri) { SPDocument *parent = this; SPDocument *document = nullptr; - while(parent != nullptr && parent->getURI() != nullptr && document == nullptr) { + while(parent != nullptr && parent->getDocumentURI() != nullptr && document == nullptr) { // Check myself and any parents in the chain - if(uri == parent->getURI()) { + if(document_uri == parent->getDocumentURI()) { document = parent; break; } @@ -497,7 +497,7 @@ SPDocument *SPDocument::createChildDoc(std::string const &uri) boost::ptr_list<SPDocument>::iterator iter; for (iter = parent->_child_documents.begin(); iter != parent->_child_documents.end(); ++iter) { - if(uri == iter->getURI()) { + if(document_uri == iter->getDocumentURI()) { document = &*iter; break; } @@ -508,12 +508,12 @@ SPDocument *SPDocument::createChildDoc(std::string const &uri) // Load a fresh document from the svg source. if(!document) { std::string path; - if(uri.find('/') == -1) { - path = this->getBase() + uri; + if(document_uri.find('/') == -1) { + path = this->getDocumentBase() + document_uri; } else { - path = uri; + path = document_uri; } - std::cout << "Added base: '" << path << std::endl; + std::cout << "Added document_base: '" << path << std::endl; document = createNewDoc(path.c_str(), false, false, this); } return document; @@ -522,54 +522,54 @@ SPDocument *SPDocument::createChildDoc(std::string const &uri) * Fetches document from URI, or creates new, if NULL; public document * appears in document list. */ -SPDocument *SPDocument::createNewDoc(gchar const *uri, unsigned int keepalive, bool make_new, SPDocument *parent) +SPDocument *SPDocument::createNewDoc(gchar const *document_uri, unsigned int keepalive, bool make_new, SPDocument *parent) { Inkscape::XML::Document *rdoc = nullptr; - gchar *base = nullptr; - gchar *name = nullptr; + gchar *document_base = nullptr; + gchar *document_name = nullptr; - if (uri) { + if (document_uri) { Inkscape::XML::Node *rroot; gchar *s, *p; /* Try to fetch repr from file */ - rdoc = sp_repr_read_file(uri, SP_SVG_NS_URI); + rdoc = sp_repr_read_file(document_uri, SP_SVG_NS_URI); /* If file cannot be loaded, return NULL without warning */ if (rdoc == nullptr) return nullptr; rroot = rdoc->root(); /* If xml file is not svg, return NULL without warning */ /* fixme: destroy document */ if (strcmp(rroot->name(), "svg:svg") != 0) return nullptr; - s = g_strdup(uri); + s = g_strdup(document_uri); p = strrchr(s, '/'); if (p) { - name = g_strdup(p + 1); + document_name = g_strdup(p + 1); p[1] = '\0'; - base = g_strdup(s); + document_base = g_strdup(s); } else { - base = nullptr; - name = g_strdup(uri); + document_base = nullptr; + document_name = g_strdup(document_uri); } if (make_new) { - base = nullptr; - uri = nullptr; - name = g_strdup_printf(_("New document %d"), ++doc_count); + document_base = nullptr; + document_uri = nullptr; + document_name = g_strdup_printf(_("New document %d"), ++doc_count); } g_free(s); } else { if (make_new) { - name = g_strdup_printf(_("Memory document %d"), ++doc_mem_count); + document_name = g_strdup_printf(_("Memory document %d"), ++doc_mem_count); } rdoc = sp_repr_document_new("svg:svg"); } //# These should be set by now - g_assert(name); + g_assert(document_name); - SPDocument *doc = createDoc(rdoc, uri, base, name, keepalive, parent); + SPDocument *doc = createDoc(rdoc, document_uri, document_base, document_name, keepalive, parent); - g_free(base); - g_free(name); + g_free(document_base); + g_free(document_name); return doc; } @@ -586,8 +586,8 @@ SPDocument *SPDocument::createNewDocFromMem(gchar const *buffer, gint length, un // If xml file is not svg, return NULL without warning // TODO fixme: destroy document } else { - Glib::ustring name = Glib::ustring::compose( _("Memory document %1"), ++doc_mem_count ); - doc = createDoc(rdoc, nullptr, nullptr, name.c_str(), keepalive, nullptr); + Glib::ustring document_name = Glib::ustring::compose( _("Memory document %1"), ++doc_mem_count ); + doc = createDoc(rdoc, nullptr, nullptr, document_name.c_str(), keepalive, nullptr); } } @@ -868,37 +868,37 @@ void SPDocument::fitToRect(Geom::Rect const &rect, bool with_margins) } } -void SPDocument::setBase( gchar const* base ) +void SPDocument::setDocumentBase( gchar const* document_base ) { - if (this->base) { - g_free(this->base); - this->base = nullptr; + if (this->document_base) { + g_free(this->document_base); + this->document_base = nullptr; } - if (base) { - this->base = g_strdup(base); + if (document_base) { + this->document_base = g_strdup(document_base); } } void SPDocument::do_change_uri(gchar const *const filename, bool const rebase) { - gchar *new_base = nullptr; - gchar *new_name = nullptr; - gchar *new_uri = nullptr; + gchar *new_document_base = nullptr; + gchar *new_document_name = nullptr; + gchar *new_document_uri = nullptr; if (filename) { #ifndef _WIN32 - new_uri = prepend_current_dir_if_relative(filename); + new_document_uri = prepend_current_dir_if_relative(filename); #else // FIXME: it may be that prepend_current_dir_if_relative works OK on windows too, test! - new_uri = g_strdup(filename); + new_document_uri = g_strdup(filename); #endif - new_base = g_path_get_dirname(new_uri); - new_name = g_path_get_basename(new_uri); + new_document_base = g_path_get_dirname(new_document_uri); + new_document_name = g_path_get_basename(new_document_uri); } else { - new_uri = g_strdup_printf(_("Unnamed document %d"), ++doc_count); - new_base = nullptr; - new_name = g_strdup(this->uri); + new_document_uri = g_strdup_printf(_("Unnamed document %d"), ++doc_count); + new_document_base = nullptr; + new_document_name = g_strdup(this->document_uri); } // Update saveable repr attributes. @@ -909,22 +909,22 @@ void SPDocument::do_change_uri(gchar const *const filename, bool const rebase) DocumentUndo::setUndoSensitive(this, false); if (rebase) { - Inkscape::XML::rebase_hrefs(this, new_base, true); + Inkscape::XML::rebase_hrefs(this, new_document_base, true); } - if (strncmp(new_name, "ink_ext_XXXXXX", 14)) // do not use temporary filenames - repr->setAttribute("sodipodi:docname", new_name); + if (strncmp(new_document_name, "ink_ext_XXXXXX", 14)) // do not use temporary filenames + repr->setAttribute("sodipodi:docname", new_document_name); DocumentUndo::setUndoSensitive(this, saved); - g_free(this->name); - g_free(this->base); - g_free(this->uri); - this->name = new_name; - this->base = new_base; - this->uri = new_uri; + g_free(this->document_name); + g_free(this->document_base); + g_free(this->document_uri); + this->document_name = new_document_name; + this->document_base = new_document_base; + this->document_uri = new_document_uri; - this->uri_set_signal.emit(this->uri); + this->uri_set_signal.emit(this->document_uri); } /** @@ -934,7 +934,7 @@ void SPDocument::do_change_uri(gchar const *const filename, bool const rebase) * * \see sp_document_change_uri_and_hrefs */ -void SPDocument::setUri(gchar const *filename) +void SPDocument::setDocumentUri(gchar const *filename) { do_change_uri(filename, false); } @@ -1314,7 +1314,7 @@ gint SPDocument::ensureUpToDate() // Process document updates. while (!_updateDocument()) { if (counter == 0) { - g_warning("More than 32 iteration while updating document '%s'", uri); + g_warning("More than 32 iteration while updating document '%s'", document_uri); break; } counter--; @@ -1829,7 +1829,7 @@ void SPDocument::setModifiedSinceSave(bool modified) { InkscapeWindow *window = SP_ACTIVE_DESKTOP->getInkscapeWindow(); if (window) { // during load, SP_ACTIVE_DESKTOP may be !nullptr, but parent might still be nullptr SPDesktopWidget *dtw = window->get_desktop_widget(); - dtw->updateTitle( this->getName() ); + dtw->updateTitle( this->getDocumentName() ); } } } diff --git a/src/document.h b/src/document.h index e24d2ae12..2c8a8f5ce 100644 --- a/src/document.h +++ b/src/document.h @@ -128,9 +128,9 @@ public: CRStyleSheet *style_sheet; protected: - char *uri; ///< A filename (not a URI yet), or NULL - char *base; ///< To be used for resolving relative hrefs. - char *name; ///< basename(uri) or other human-readable label for the document. + 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. public: @@ -163,15 +163,15 @@ public: Inkscape::XML::Document const *getReprDoc() const { return rdoc; } /** A filename (not a URI yet), or NULL */ - char const *getURI() const { return uri; } - void setUri(char const *uri); + char const *getDocumentURI() const { return document_uri; } + void setDocumentUri(char const *document_uri); /** To be used for resolving relative hrefs. */ - char const *getBase() const { return base; }; - void setBase( char const* base ); + char const *getDocumentBase() const { return document_base; }; + void setDocumentBase( char const* document_base ); /** basename(uri) or other human-readable label for the document. */ - char const* getName() const { return name; } + char const* getDocumentName() const { return document_name; } /** Return the main defs object for the document. */ SPDefs *getDefs(); diff --git a/src/extension/implementation/script.cpp b/src/extension/implementation/script.cpp index 9ff9c0bc2..4bbd9b077 100644 --- a/src/extension/implementation/script.cpp +++ b/src/extension/implementation/script.cpp @@ -522,7 +522,7 @@ SPDocument *Script::open(Inkscape::Extension::Input *module, } // data_read if (mydoc != nullptr) { - mydoc->setBase(nullptr); + mydoc->setDocumentBase(nullptr); mydoc->changeUriAndHrefs(filenameArg); } diff --git a/src/extension/implementation/xslt.cpp b/src/extension/implementation/xslt.cpp index 7841a6506..1f2b79281 100644 --- a/src/extension/implementation/xslt.cpp +++ b/src/extension/implementation/xslt.cpp @@ -179,7 +179,7 @@ void XSLT::save(Inkscape::Extension::Output *module, SPDocument *doc, gchar cons } if (!sp_repr_save_rebased_file(repr->document(), tempfilename_out.c_str(), SP_SVG_NS_URI, - doc->getBase(), filename)) { + doc->getDocumentBase(), filename)) { throw Inkscape::Extension::Output::save_failed(); } diff --git a/src/extension/internal/odf.cpp b/src/extension/internal/odf.cpp index 722826f19..f2192b9af 100644 --- a/src/extension/internal/odf.cpp +++ b/src/extension/internal/odf.cpp @@ -2041,7 +2041,7 @@ void OdfOutput::save(Inkscape::Extension::Output */*mod*/, SPDocument *doc, gcha { reset(); - docBaseUri = Inkscape::URI::from_dirname(doc->getBase()).str(); + docBaseUri = Inkscape::URI::from_dirname(doc->getDocumentBase()).str(); ZipFile zf; preprocess(zf, doc->rroot); diff --git a/src/extension/internal/svg.cpp b/src/extension/internal/svg.cpp index 99f893cd3..50a045a94 100644 --- a/src/extension/internal/svg.cpp +++ b/src/extension/internal/svg.cpp @@ -931,7 +931,7 @@ Svg::save(Inkscape::Extension::Output *mod, SPDocument *doc, gchar const *filena } if (!sp_repr_save_rebased_file(rdoc, filename, SP_SVG_NS_URI, - doc->getBase(), // + doc->getDocumentBase(), // m_detachbase ? nullptr : filename)) { throw Inkscape::Extension::Output::save_failed(); } diff --git a/src/extension/system.cpp b/src/extension/system.cpp index 412e5dcd4..05a62884c 100644 --- a/src/extension/system.cpp +++ b/src/extension/system.cpp @@ -137,7 +137,7 @@ SPDocument *open(Extension *key, gchar const *filename) } } - doc->setUri(filename); + doc->setDocumentUri(filename); if (!show) { imod->set_gui(true); } @@ -288,7 +288,7 @@ save(Extension *key, SPDocument *doc, gchar const *filename, bool setextension, // remember attributes in case this is an unofficial save and/or overwrite fails - gchar *saved_uri = g_strdup(doc->getURI()); + gchar *saved_uri = g_strdup(doc->getDocumentURI()); gchar *saved_output_extension = nullptr; gchar *saved_dataloss = nullptr; bool saved_modified = doc->isModifiedSinceSave(); @@ -618,8 +618,8 @@ get_file_save_path (SPDocument *doc, FileSaveMethod method) { case FILE_SAVE_METHOD_SAVE_AS: { use_current_dir = prefs->getBool("/dialogs/save_as/use_current_dir", true); - if (doc->getURI() && use_current_dir) { - path = Glib::path_get_dirname(doc->getURI()); + if (doc->getDocumentURI() && use_current_dir) { + path = Glib::path_get_dirname(doc->getDocumentURI()); } else { path = prefs->getString("/dialogs/save_as/path"); } @@ -630,15 +630,15 @@ get_file_save_path (SPDocument *doc, FileSaveMethod method) { break; case FILE_SAVE_METHOD_SAVE_COPY: use_current_dir = prefs->getBool("/dialogs/save_copy/use_current_dir", prefs->getBool("/dialogs/save_as/use_current_dir", true)); - if (doc->getURI() && use_current_dir) { - path = Glib::path_get_dirname(doc->getURI()); + if (doc->getDocumentURI() && use_current_dir) { + path = Glib::path_get_dirname(doc->getDocumentURI()); } else { path = prefs->getString("/dialogs/save_copy/path"); } break; case FILE_SAVE_METHOD_INKSCAPE_SVG: - if (doc->getURI()) { - path = Glib::path_get_dirname(doc->getURI()); + if (doc->getDocumentURI()) { + path = Glib::path_get_dirname(doc->getDocumentURI()); } else { // FIXME: should we use the save_as path here or something else? Maybe we should // leave this as a choice to the user. diff --git a/src/file-update.cpp b/src/file-update.cpp index 764ba8b03..22dd022bc 100644 --- a/src/file-update.cpp +++ b/src/file-update.cpp @@ -253,7 +253,7 @@ bool sp_file_save_backup( Glib::ustring uri ) { void sp_file_convert_dpi(SPDocument *doc) { Inkscape::Preferences *prefs = Inkscape::Preferences::get(); - Glib::ustring uri = doc->getURI(); + Glib::ustring uri = doc->getDocumentURI(); SPRoot *root = doc->getRoot(); // See if we need to offer the user a fix for the 90->96 px per inch change. @@ -335,7 +335,7 @@ void sp_file_convert_dpi(SPDocument *doc) scale_dialog.set_border_width(10); scale_dialog.set_resizable(false); Gtk::Label explanation; - explanation.set_markup(Glib::ustring("<b>") + doc->getName() + "</b>\n" + + explanation.set_markup(Glib::ustring("<b>") + doc->getDocumentName() + "</b>\n" + _("was created in an older version of Inkscape (90 DPI) and we need " "to make it compatible with newer versions (96 DPI). Tell us about this file:\n")); explanation.set_line_wrap(true); diff --git a/src/file.cpp b/src/file.cpp index 1e2271d2c..cb672e690 100644 --- a/src/file.cpp +++ b/src/file.cpp @@ -246,7 +246,7 @@ bool sp_file_open(const Glib::ustring &uri, doc->virgin = FALSE; if (add_to_recent) { - sp_file_add_recent( doc->getURI() ); + sp_file_add_recent( doc->getDocumentURI() ); } // --------------- Fix up document ---------------- @@ -307,7 +307,7 @@ void sp_file_revert_dialog() Inkscape::XML::Node *repr = doc->getReprRoot(); g_assert(repr != nullptr); - gchar const *uri = doc->getURI(); + gchar const *uri = doc->getDocumentURI(); if (!uri) { desktop->messageStack()->flash(Inkscape::ERROR_MESSAGE, _("Document not saved yet. Cannot revert.")); return; @@ -696,10 +696,10 @@ file_save(Gtk::Window &parentWindow, SPDocument *doc, const Glib::ustring &uri, SP_ACTIVE_DESKTOP->event_log->rememberFileSave(); Glib::ustring msg; - if (doc->getURI() == nullptr) { + if (doc->getDocumentURI() == nullptr) { msg = Glib::ustring::format(_("Document saved.")); } else { - msg = Glib::ustring::format(_("Document saved."), " ", doc->getURI()); + msg = Glib::ustring::format(_("Document saved."), " ", doc->getDocumentURI()); } SP_ACTIVE_DESKTOP->messageStack()->flash(Inkscape::NORMAL_MESSAGE, msg.c_str()); return true; @@ -755,7 +755,7 @@ sp_file_save_dialog(Gtk::Window &parentWindow, SPDocument *doc, Inkscape::Extens save_loc.append(G_DIR_SEPARATOR_S); int i = 1; - if ( !doc->getURI() ) { + if ( !doc->getDocumentURI() ) { // We are saving for the first time; create a unique default filename save_loc = save_loc + _("drawing") + filename_extension; @@ -765,7 +765,7 @@ sp_file_save_dialog(Gtk::Window &parentWindow, SPDocument *doc, Inkscape::Extens save_loc = save_loc + Glib::ustring::compose(_("drawing-%1"), i++) + filename_extension; } } else { - save_loc.append(Glib::path_get_basename(doc->getURI())); + save_loc.append(Glib::path_get_basename(doc->getDocumentURI())); } // convert save_loc from utf-8 to locale @@ -833,8 +833,8 @@ sp_file_save_dialog(Gtk::Window &parentWindow, SPDocument *doc, Inkscape::Extens // FIXME: does the argument !is_copy really convey the correct meaning here? success = file_save(parentWindow, doc, fileName, selectionType, TRUE, !is_copy, save_method); - if (success && doc->getURI()) { - sp_file_add_recent( doc->getURI() ); + if (success && doc->getDocumentURI()) { + sp_file_add_recent( doc->getDocumentURI() ); } save_path = Glib::path_get_dirname(fileName); @@ -857,7 +857,7 @@ sp_file_save_document(Gtk::Window &parentWindow, SPDocument *doc) bool success = true; if (doc->isModifiedSinceSave()) { - if ( doc->getURI() == nullptr ) + if ( doc->getDocumentURI() == nullptr ) { // Hier sollte in Argument mitgegeben werden, das anzeigt, da� das Dokument das erste // Mal gespeichert wird, so da� als default .svg ausgew�hlt wird und nicht die zuletzt @@ -865,7 +865,7 @@ sp_file_save_document(Gtk::Window &parentWindow, SPDocument *doc) return sp_file_save_dialog(parentWindow, doc, Inkscape::Extension::FILE_SAVE_METHOD_INKSCAPE_SVG); } else { Glib::ustring extension = Inkscape::Extension::get_file_save_extension(Inkscape::Extension::FILE_SAVE_METHOD_SAVE_AS); - Glib::ustring fn = g_strdup(doc->getURI()); + Glib::ustring fn = g_strdup(doc->getDocumentURI()); // Try to determine the extension from the uri; this may not lead to a valid extension, // but this case is caught in the file_save method below (or rather in Extension::save() // further down the line). @@ -884,11 +884,11 @@ sp_file_save_document(Gtk::Window &parentWindow, SPDocument *doc) } } else { Glib::ustring msg; - if ( doc->getURI() == nullptr ) + if ( doc->getDocumentURI() == nullptr ) { msg = Glib::ustring::format(_("No changes need to be saved.")); } else { - msg = Glib::ustring::format(_("No changes need to be saved."), " ", doc->getURI()); + msg = Glib::ustring::format(_("No changes need to be saved."), " ", doc->getDocumentURI()); } SP_ACTIVE_DESKTOP->messageStack()->flash(Inkscape::WARNING_MESSAGE, msg.c_str()); success = TRUE; @@ -1182,7 +1182,7 @@ file_import(SPDocument *in_doc, const Glib::ustring &uri, } if (doc != nullptr) { - Inkscape::XML::rebase_hrefs(doc, in_doc->getBase(), true); + Inkscape::XML::rebase_hrefs(doc, in_doc->getDocumentBase(), true); Inkscape::XML::Document *xml_in_doc = in_doc->getReprDoc(); prevent_id_clashes(doc, in_doc); @@ -1497,7 +1497,7 @@ sp_file_export_dialog(Gtk::Window &parentWindow) if (success) { Glib::RefPtr<Gtk::RecentManager> recent = Gtk::RecentManager::get_default(); - recent->add_item( doc->getURI() ); + recent->add_item( doc->getDocumentURI() ); } export_path = fileName; diff --git a/src/inkscape.cpp b/src/inkscape.cpp index 53536b878..a59f518a0 100644 --- a/src/inkscape.cpp +++ b/src/inkscape.cpp @@ -695,7 +695,7 @@ Application::crash_handler (int /*signum*/) /* originally, the document name was retrieved from * the sodipod:docname attribute */ - docname = doc->getName(); + docname = doc->getDocumentName(); if (docname) { /* Removes an emergency save suffix if present: /(.*)\.[0-9_]*\.[0-9_]*\.[~\.]*$/\1/ */ const char* d0 = strrchr ((char*)docname, '.'); @@ -722,7 +722,7 @@ Application::crash_handler (int /*signum*/) // Find a location const char* locations[] = { - doc->getBase(), + doc->getDocumentBase(), g_get_home_dir(), g_get_tmp_dir(), curdir, @@ -746,7 +746,7 @@ Application::crash_handler (int /*signum*/) savednames.push_back(g_strdup (c)); fclose (file); } else { - failednames.push_back((doc->getName()) ? g_strdup(doc->getName()) : g_strdup (_("Untitled document"))); + failednames.push_back((doc->getDocumentName()) ? g_strdup(doc->getDocumentName()) : g_strdup (_("Untitled document"))); } count++; } diff --git a/src/inkview-window.cpp b/src/inkview-window.cpp index 441d1e3c0..05893dc9b 100644 --- a/src/inkview-window.cpp +++ b/src/inkview-window.cpp @@ -127,7 +127,7 @@ InkviewWindow::create_file_list(const std::vector<Glib::RefPtr<Gio::File > >& fi void InkviewWindow::update_title() { - Glib::ustring title(_documents[_index]->getName()); + Glib::ustring title(_documents[_index]->getDocumentName()); if (_documents.size() > 1) { title += Glib::ustring::compose(" (%1/%2)", _index+1, _documents.size()); diff --git a/src/io/file-export-cmd.cpp b/src/io/file-export-cmd.cpp index d9527f89a..03b738197 100644 --- a/src/io/file-export-cmd.cpp +++ b/src/io/file-export-cmd.cpp @@ -415,8 +415,8 @@ InkFileExportCmd::do_export_png(SPDocument *doc, std::string filename_in) if (filename_from_hint) { //Make relative paths go from the document location, if possible: - if (!Glib::path_is_absolute(filename_out) && doc->getURI()) { - std::string dirname = Glib::path_get_dirname(doc->getURI()); + if (!Glib::path_is_absolute(filename_out) && doc->getDocumentURI()) { + std::string dirname = Glib::path_get_dirname(doc->getDocumentURI()); if (!dirname.empty()) { filename_out = Glib::build_filename(dirname, filename_out); } diff --git a/src/io/resource-manager.cpp b/src/io/resource-manager.cpp index 48ef6ff76..fc742cb80 100644 --- a/src/io/resource-manager.cpp +++ b/src/io/resource-manager.cpp @@ -232,7 +232,7 @@ std::vector<Glib::ustring> ResourceManagerImpl::findBrokenLinks( SPDocument *doc uniques.insert(href); } } else { - std::string combined = Glib::build_filename(doc->getBase(), uri); + std::string combined = Glib::build_filename(doc->getDocumentBase(), uri); if ( !Glib::file_test(combined, Glib::FILE_TEST_EXISTS) ) { result.emplace_back(href); uniques.insert(href); @@ -328,7 +328,7 @@ bool ResourceManagerImpl::fixupBrokenLinks(SPDocument *doc) bool changed = false; if ( doc ) { // TODO debug g_message("FIXUP FIXUP FIXUP FIXUP FIXUP FIXUP FIXUP FIXUP FIXUP FIXUP"); - // TODO debug g_message(" base is [%s]", doc->getBase()); + // TODO debug g_message(" base is [%s]", doc->getDocumentBase()); std::vector<Glib::ustring> brokenHrefs = findBrokenLinks(doc); if ( !brokenHrefs.empty() ) { @@ -338,7 +338,7 @@ bool ResourceManagerImpl::fixupBrokenLinks(SPDocument *doc) } } - std::map<Glib::ustring, Glib::ustring> mapping = locateLinks(doc->getBase(), brokenHrefs); + std::map<Glib::ustring, Glib::ustring> mapping = locateLinks(doc->getDocumentBase(), brokenHrefs); for ( std::map<Glib::ustring, Glib::ustring>::iterator it = mapping.begin(); it != mapping.end(); ++it ) { // TODO debug g_message(" [%s] ==> {%s}", it->first.c_str(), it->second.c_str()); diff --git a/src/object/color-profile.cpp b/src/object/color-profile.cpp index 9b7d25d98..0e6d5e08d 100644 --- a/src/object/color-profile.cpp +++ b/src/object/color-profile.cpp @@ -350,7 +350,7 @@ void ColorProfile::set(SPAttributeEnum key, gchar const *value) { g_warning("this has no document. using active"); } //# 1. Get complete URI of document - gchar const *docbase = doc->getURI(); + gchar const *docbase = doc->getDocumentURI(); Inkscape::URI docUri(""); if (docbase) { // The file has already been saved diff --git a/src/object/sp-image.cpp b/src/object/sp-image.cpp index 45016bd45..6c3854cb4 100644 --- a/src/object/sp-image.cpp +++ b/src/object/sp-image.cpp @@ -345,7 +345,7 @@ void SPImage::update(SPCtx *ctx, unsigned int flags) { } this->dpi = svgdpi; pixbuf = sp_image_repr_read_image(this->getRepr()->attribute("xlink:href"), - this->getRepr()->attribute("sodipodi:absref"), doc->getBase(), svgdpi); + this->getRepr()->attribute("sodipodi:absref"), doc->getDocumentBase(), svgdpi); if (pixbuf) { #if defined(HAVE_LIBLCMS1) || defined(HAVE_LIBLCMS2) @@ -557,7 +557,7 @@ gchar* SPImage::description() const { svgdpi = atof(this->getRepr()->attribute("inkscape:svg-dpi")); } pb = sp_image_repr_read_image(this->getRepr()->attribute("xlink:href"), - this->getRepr()->attribute("sodipodi:absref"), this->document->getBase(), svgdpi); + this->getRepr()->attribute("sodipodi:absref"), this->document->getDocumentBase(), svgdpi); if (pb) { ret = g_strdup_printf(_("%d × %d: %s"), diff --git a/src/object/sp-style-elem.cpp b/src/object/sp-style-elem.cpp index a307b110f..dae679bb4 100644 --- a/src/object/sp-style-elem.cpp +++ b/src/object/sp-style-elem.cpp @@ -192,14 +192,14 @@ import_style_cb (CRDocHandler *a_handler, std::cerr << "import_style_cb: No document style sheet!" << std::endl; return; } - if (!document->getURI()) { + if (!document->getDocumentURI()) { std::cerr << "import_style_cb: Document URI is NULL" << std::endl; return; } // Get file Glib::ustring import_file = - Inkscape::IO::Resource::get_filename (document->getURI(), a_uri->stryng->str); + Inkscape::IO::Resource::get_filename (document->getDocumentURI(), a_uri->stryng->str); // Parse file CRStyleSheet *stylesheet = cr_stylesheet_new (nullptr); @@ -332,7 +332,7 @@ end_font_face_cb(CRDocHandler *a_handler) std::cerr << "end_font_face_cb: No document!" << std::endl; return; } - if (!document->getURI()) { + if (!document->getDocumentURI()) { std::cerr << "end_font_face_cb: Document URI is NULL" << std::endl; return; } @@ -357,7 +357,7 @@ end_font_face_cb(CRDocHandler *a_handler) // Get file Glib::ustring ttf_file = - Inkscape::IO::Resource::get_filename (document->getURI(), value); + Inkscape::IO::Resource::get_filename (document->getDocumentURI(), value); if (!ttf_file.empty()) { font_factory *factory = font_factory::Default(); diff --git a/src/object/uri-references.cpp b/src/object/uri-references.cpp index 69ed140e0..d3550d940 100644 --- a/src/object/uri-references.cpp +++ b/src/object/uri-references.cpp @@ -130,7 +130,7 @@ void URIReference::attach(const URI &uri) // The path contains references to separate document files to load. if (document && uri.getPath() && !skip) { - char const *base = document->getBase(); + char const *base = document->getDocumentBase(); auto absuri = URI::from_href_and_basedir(uri.str().c_str(), base); std::string path; diff --git a/src/selection-chemistry.cpp b/src/selection-chemistry.cpp index ed4c23bbc..e40743635 100755 --- a/src/selection-chemistry.cpp +++ b/src/selection-chemistry.cpp @@ -3634,7 +3634,7 @@ void ObjectSet::createBitmapCopy() // Create the filename. gchar *const basename = g_strdup_printf("%s-%s-%u.png", - doc->getName(), + doc->getDocumentName(), items_[0]->getRepr()->attribute("id"), current); // Imagemagick is known not to handle spaces in filenames, so we replace anything but letters, @@ -3643,8 +3643,8 @@ void ObjectSet::createBitmapCopy() // Build the complete path by adding document base dir, if set, otherwise home dir gchar *directory = nullptr; - if ( doc->getURI() ) { - directory = g_path_get_dirname( doc->getURI() ); + if ( doc->getDocumentURI() ) { + directory = g_path_get_dirname( doc->getDocumentURI() ); } if (directory == nullptr) { directory = Inkscape::IO::Resource::homedir_path(nullptr); diff --git a/src/shortcuts.cpp b/src/shortcuts.cpp index 64bcd811f..9714a61c0 100644 --- a/src/shortcuts.cpp +++ b/src/shortcuts.cpp @@ -375,7 +375,7 @@ Glib::ustring sp_shortcut_get_file_path() if (open_path.empty()) { /* Grab document directory */ - const gchar* docURI = SP_ACTIVE_DOCUMENT->getURI(); + const gchar* docURI = SP_ACTIVE_DOCUMENT->getDocumentURI(); if (docURI) { open_path = Glib::path_get_dirname(docURI); open_path.append(G_DIR_SEPARATOR_S); diff --git a/src/ui/clipboard.cpp b/src/ui/clipboard.cpp index 733d6e8d1..13390545a 100644 --- a/src/ui/clipboard.cpp +++ b/src/ui/clipboard.cpp @@ -1271,7 +1271,7 @@ void ClipboardManagerImpl::_onGet(Gtk::SelectionData &sel, guint /*info*/) } if (SP_ACTIVE_DOCUMENT) { - _clipboardSPDoc->setBase(SP_ACTIVE_DOCUMENT->getBase()); + _clipboardSPDoc->setDocumentBase(SP_ACTIVE_DOCUMENT->getDocumentBase()); } (*out)->save(_clipboardSPDoc, filename, true); diff --git a/src/ui/contextmenu.cpp b/src/ui/contextmenu.cpp index efbe8b0ff..a95cb3c20 100644 --- a/src/ui/contextmenu.cpp +++ b/src/ui/contextmenu.cpp @@ -823,8 +823,8 @@ void ContextMenu::ImageEdit() if (Glib::path_is_absolute(name)) { fullname = name; - } else if (SP_ACTIVE_DOCUMENT->getBase()) { - fullname = Glib::build_filename(SP_ACTIVE_DOCUMENT->getBase(), name); + } else if (SP_ACTIVE_DOCUMENT->getDocumentBase()) { + fullname = Glib::build_filename(SP_ACTIVE_DOCUMENT->getDocumentBase(), name); } else { fullname = Glib::build_filename(Glib::get_current_dir(), name); } diff --git a/src/ui/dialog/export.cpp b/src/ui/dialog/export.cpp index b02fbb5dc..d42d537fd 100644 --- a/src/ui/dialog/export.cpp +++ b/src/ui/dialog/export.cpp @@ -441,10 +441,10 @@ void Export::setTargetDesktop(SPDesktop *desktop) */ void Export::set_default_filename () { - if ( SP_ACTIVE_DOCUMENT && SP_ACTIVE_DOCUMENT->getURI() ) + if ( SP_ACTIVE_DOCUMENT && SP_ACTIVE_DOCUMENT->getDocumentURI() ) { SPDocument * doc = SP_ACTIVE_DOCUMENT; - const gchar *uri = doc->getURI(); + const gchar *uri = doc->getDocumentURI(); const gchar *text_extension = get_file_save_extension (Inkscape::Extension::FILE_SAVE_METHOD_SAVE_AS).c_str(); Inkscape::Extension::Output * oextension = nullptr; @@ -561,7 +561,7 @@ Glib::ustring Export::create_filepath_from_id (Glib::ustring id, const Glib::ust if (directory.empty()) { /* Grab document directory */ - const gchar* docURI = SP_ACTIVE_DOCUMENT->getURI(); + const gchar* docURI = SP_ACTIVE_DOCUMENT->getDocumentURI(); if (docURI) { directory = Glib::path_get_dirname(docURI); } @@ -952,8 +952,8 @@ Glib::ustring Export::absolutize_path_from_document_location (SPDocument *doc, c { Glib::ustring path; //Make relative paths go from the document location, if possible: - if (!Glib::path_is_absolute(filename) && doc->getURI()) { - Glib::ustring dirname = Glib::path_get_dirname(doc->getURI()); + if (!Glib::path_is_absolute(filename) && doc->getDocumentURI()) { + Glib::ustring dirname = Glib::path_get_dirname(doc->getDocumentURI()); if (!dirname.empty()) { path = Glib::build_filename(dirname, filename); } @@ -1236,7 +1236,7 @@ void Export::onExport () Inkscape::XML::Node * repr = *i; const gchar * temp_string; Glib::ustring dir = Glib::path_get_dirname(filename.c_str()); - const gchar* docURI=SP_ACTIVE_DOCUMENT->getURI(); + const gchar* docURI=SP_ACTIVE_DOCUMENT->getDocumentURI(); Glib::ustring docdir; if (docURI) { diff --git a/src/ui/dialog/print.cpp b/src/ui/dialog/print.cpp index 65f1297d5..8d1606a19 100644 --- a/src/ui/dialog/print.cpp +++ b/src/ui/dialog/print.cpp @@ -46,7 +46,7 @@ Print::Print(SPDocument *doc, SPItem *base) : _printop = Gtk::PrintOperation::create(); // set up dialog title, based on document name - const Glib::ustring jobname = _doc->getName() ? _doc->getName() : _("SVG Document"); + const Glib::ustring jobname = _doc->getDocumentName() ? _doc->getDocumentName() : _("SVG Document"); Glib::ustring title = _("Print"); title += " "; title += jobname; diff --git a/src/ui/dialog/xml-tree.cpp b/src/ui/dialog/xml-tree.cpp index 88fab8f18..3756a670a 100644 --- a/src/ui/dialog/xml-tree.cpp +++ b/src/ui/dialog/xml-tree.cpp @@ -284,7 +284,7 @@ void XmlTree::set_tree_document(SPDocument *document) if (current_document) { document_uri_set_connection = current_document->connectURISet(sigc::bind(sigc::ptr_fun(&on_document_uri_set), current_document)); - on_document_uri_set( current_document->getURI(), current_document ); + on_document_uri_set( current_document->getDocumentURI(), current_document ); set_tree_repr(current_document->getReprRoot()); } else { set_tree_repr(nullptr); diff --git a/src/ui/view/view.cpp b/src/ui/view/view.cpp index b595ce1a7..4395357e0 100644 --- a/src/ui/view/view.cpp +++ b/src/ui/view/view.cpp @@ -121,7 +121,7 @@ void View::setDocument(SPDocument *doc) { _doc->connectURISet(sigc::bind(sigc::ptr_fun(&_onDocumentURISet), this)); _document_resized_connection = _doc->connectResized(sigc::bind(sigc::ptr_fun(&_onDocumentResized), this)); - _document_uri_set_signal.emit( _doc->getURI() ); + _document_uri_set_signal.emit( _doc->getDocumentURI() ); } }}} diff --git a/src/widgets/desktop-widget.cpp b/src/widgets/desktop-widget.cpp index 5ebe0c0f3..13a7b649e 100644 --- a/src/widgets/desktop-widget.cpp +++ b/src/widgets/desktop-widget.cpp @@ -930,7 +930,7 @@ void SPDesktopWidget::updateNamedview() modified_connection = desktop->namedview->connectModified(sigc::mem_fun(*this, &SPDesktopWidget::namedviewModified)); namedviewModified(desktop->namedview, SP_OBJECT_MODIFIED_FLAG); - updateTitle( desktop->doc()->getName() ); + updateTitle( desktop->doc()->getDocumentName() ); } /** @@ -1094,7 +1094,7 @@ SPDesktopWidget::shutdown() Glib::ustring message = g_markup_printf_escaped( _("<span weight=\"bold\" size=\"larger\">Save changes to document \"%s\" before closing?</span>\n\n" "If you close without saving, your changes will be discarded."), - doc->getName()); + doc->getDocumentName()); Gtk::MessageDialog dialog = Gtk::MessageDialog(*toplevel_window, message, true, Gtk::MESSAGE_WARNING, Gtk::BUTTONS_NONE); dialog.property_destroy_with_parent() = true; @@ -1141,7 +1141,7 @@ SPDesktopWidget::shutdown() Glib::ustring message = g_markup_printf_escaped( _("<span weight=\"bold\" size=\"larger\">The file \"%s\" was saved with a format that may cause data loss!</span>\n\n" "Do you want to save this file as Inkscape SVG?"), - doc->getName() ? doc->getName() : "Unnamed"); + doc->getDocumentName() ? doc->getDocumentName() : "Unnamed"); Gtk::MessageDialog dialog = Gtk::MessageDialog(*toplevel_window, message, true, Gtk::MESSAGE_WARNING, Gtk::BUTTONS_NONE); dialog.property_destroy_with_parent() = true; diff --git a/src/widgets/stroke-marker-selector.cpp b/src/widgets/stroke-marker-selector.cpp index 095653cb3..634dd7e97 100644 --- a/src/widgets/stroke-marker-selector.cpp +++ b/src/widgets/stroke-marker-selector.cpp @@ -408,7 +408,7 @@ void MarkerComboBox::update_marker_image(gchar const *mname) { gchar *cache_name = g_strconcat(combo_id, mname, NULL); - Glib::ustring key = svg_preview_cache.cache_key(doc->getURI(), cache_name, 24); + Glib::ustring key = svg_preview_cache.cache_key(doc->getDocumentURI(), cache_name, 24); g_free (cache_name); svg_preview_cache.remove_preview_from_cache(key); @@ -519,7 +519,7 @@ MarkerComboBox::create_marker_image(unsigned psize, gchar const *mname, /* Update to renderable state */ gchar *cache_name = g_strconcat(combo_id, mname, NULL); - Glib::ustring key = svg_preview_cache.cache_key(source->getURI(), cache_name, psize); + Glib::ustring key = svg_preview_cache.cache_key(source->getDocumentURI(), cache_name, psize); g_free (cache_name); GdkPixbuf *pixbuf = svg_preview_cache.get_preview_from_cache(key); // no ref created diff --git a/src/xml/rebase-hrefs.cpp b/src/xml/rebase-hrefs.cpp index c93fba380..fb310a770 100644 --- a/src/xml/rebase-hrefs.cpp +++ b/src/xml/rebase-hrefs.cpp @@ -136,7 +136,7 @@ void Inkscape::XML::rebase_hrefs(SPDocument *const doc, gchar const *const new_b { using Inkscape::URI; - std::string old_base_url_str = URI::from_dirname(doc->getBase()).str(); + std::string old_base_url_str = URI::from_dirname(doc->getDocumentBase()).str(); std::string new_base_url_str; if (new_base) { @@ -206,7 +206,7 @@ void Inkscape::XML::rebase_hrefs(SPDocument *const doc, gchar const *const new_b ir->setAttribute("xlink:href", href_str); } - doc->setBase(new_base); + doc->setDocumentBase(new_base); } |
