diff options
| author | Markus Engel <markus.engel@tum.de> | 2013-09-24 22:17:24 +0000 |
|---|---|---|
| committer | Markus Engel <markus.engel@tum.de> | 2013-09-24 22:17:24 +0000 |
| commit | bcca22a25ae98f70c36fff6292f0a8fe4e578d89 (patch) | |
| tree | a18d382d32f471b7119b9b7b2782cec04d6da43f /src/file.cpp | |
| parent | Refactored SPUse. (diff) | |
| parent | Fix my email address through codebase (diff) | |
| download | inkscape-bcca22a25ae98f70c36fff6292f0a8fe4e578d89.tar.gz inkscape-bcca22a25ae98f70c36fff6292f0a8fe4e578d89.zip | |
Merged from trunk (r12588).
(bzr r11608.1.129)
Diffstat (limited to 'src/file.cpp')
| -rw-r--r-- | src/file.cpp | 37 |
1 files changed, 18 insertions, 19 deletions
diff --git a/src/file.cpp b/src/file.cpp index 68e229e62..b19fe21ff 100644 --- a/src/file.cpp +++ b/src/file.cpp @@ -74,6 +74,8 @@ #include <glibmm/i18n.h> #include <glibmm/miscutils.h> +#include <string> + using Inkscape::DocumentUndo; #ifdef WITH_GNOME_VFS @@ -124,7 +126,7 @@ static void sp_file_add_recent(gchar const *uri) /** * Create a blank document and add it to the desktop */ -SPDesktop *sp_file_new(const Glib::ustring &templ) +SPDesktop *sp_file_new(const std::string &templ) { SPDocument *doc = SPDocument::createNewDoc( !templ.empty() ? templ.c_str() : 0 , TRUE, true ); g_return_val_if_fail(doc != NULL, NULL); @@ -138,25 +140,19 @@ SPDesktop *sp_file_new(const Glib::ustring &templ) DocumentUndo::clearUndo(doc); } + // Set viewBox if it doesn't exist + if (!doc->getRoot()->viewBox_set) { + doc->setViewBox(Geom::Rect::from_xywh(0, 0, doc->getWidth().quantity, doc->getHeight().quantity)); + } + SPDesktop *desktop = SP_ACTIVE_DESKTOP; - if (desktop) { + if (desktop) desktop->setWaitingCursor(); - } - SPDocument *existing = desktop ? sp_desktop_document(desktop) : NULL; - - if (existing && existing->virgin) { - // If the current desktop is empty, open the document there - doc->ensureUpToDate(); // TODO this will trigger broken link warnings, etc. - desktop->change_document(doc); - doc->emitResizedSignal(doc->getWidth(), doc->getHeight()); - } else { - // create a whole new desktop and window - SPViewWidget *dtw = sp_desktop_widget_new(sp_document_namedview(doc, NULL)); // TODO this will trigger broken link warnings, etc. - g_return_val_if_fail(dtw != NULL, NULL); - sp_create_window(dtw, TRUE); - desktop = static_cast<SPDesktop *>(dtw->view); - } + SPViewWidget *dtw = sp_desktop_widget_new(sp_document_namedview(doc, NULL)); // TODO this will trigger broken link warnings, etc. + g_return_val_if_fail(dtw != NULL, NULL); + sp_create_window(dtw, TRUE); + desktop = static_cast<SPDesktop *>(dtw->view); doc->doUnref(); @@ -166,6 +162,9 @@ SPDesktop *sp_file_new(const Glib::ustring &templ) #ifdef WITH_DBUS Inkscape::Extension::Dbus::dbus_init_desktop_interface(desktop); #endif + + if (desktop) + desktop->clearWaitingCursor(); return desktop; } @@ -220,7 +219,7 @@ SPDesktop* sp_file_new_default() { Glib::ustring templateUri = sp_file_default_template_uri(); SPDesktop* desk = sp_file_new(sp_file_default_template_uri()); - rdf_add_from_preferences( SP_ACTIVE_DOCUMENT ); + //rdf_add_from_preferences( SP_ACTIVE_DOCUMENT ); return desk; } @@ -291,7 +290,7 @@ bool sp_file_open(const Glib::ustring &uri, // If the current desktop is empty, open the document there doc->ensureUpToDate(); // TODO this will trigger broken link warnings, etc. desktop->change_document(doc); - doc->emitResizedSignal(doc->getWidth(), doc->getHeight()); + doc->emitResizedSignal(doc->getWidth().value("px"), doc->getHeight().value("px")); } else { // create a whole new desktop and window SPViewWidget *dtw = sp_desktop_widget_new(sp_document_namedview(doc, NULL)); // TODO this will trigger broken link warnings, etc. |
