summaryrefslogtreecommitdiffstats
path: root/src/main.cpp
diff options
context:
space:
mode:
authorEric Greveson <eric@greveson.co.uk>2013-07-01 20:04:32 +0000
committerEric Greveson <eric@greveson.co.uk>2013-07-01 20:04:32 +0000
commitc3a160589a9cb41c70a56e5e7b66a65857a0d10e (patch)
tree46860c161eda2e11687aff38141e04b40185798b /src/main.cpp
parentCorrectly ignore symbolic link to ltmain.sh (diff)
downloadinkscape-c3a160589a9cb41c70a56e5e7b66a65857a0d10e.tar.gz
inkscape-c3a160589a9cb41c70a56e5e7b66a65857a0d10e.zip
Factored layer model out into new Inkscape::LayerModel class. This allows
Inkscape::Selection to use a LayerModel that is not associated with a UI. Changed the interface of verbs (SPAction) to use a new ActionContext rather than UI::View::View, again so that verbs may be used in a console mode. Modified boolean operation verbs to work in console-only mode. Fixed up DESKTOP_IS_ACTIVE macro to work in the case of no desktops. Modified main.cpp to process selections and verbs in no-GUI mode. Other changes are all consequences of the SPDesktop, Selection and LayerModel interface changes. (bzr r12387.1.1)
Diffstat (limited to 'src/main.cpp')
-rw-r--r--src/main.cpp18
1 files changed, 17 insertions, 1 deletions
diff --git a/src/main.cpp b/src/main.cpp
index 19ea3f181..49ef33fc9 100644
--- a/src/main.cpp
+++ b/src/main.cpp
@@ -60,6 +60,8 @@
#include "macros.h"
#include "file.h"
#include "document.h"
+#include "layer-model.h"
+#include "selection.h"
#include "sp-object.h"
#include "interface.h"
#include "print.h"
@@ -85,6 +87,7 @@
#include "debug/logger.h"
#include "debug/log-display-config.h"
+#include "helper/action-context.h"
#include "helper/png-write.h"
#include "helper/geom.h"
@@ -1066,7 +1069,20 @@ static int sp_process_file_list(GSList *fl)
if (sp_vacuum_defs) {
doc->vacuumDocument();
}
- if (sp_vacuum_defs && !sp_export_svg) {
+
+ bool has_performed_actions = false;
+ {
+ // Create layer model and selection model so we can run some verbs without a GUI
+ Inkscape::LayerModel layer_model;
+ layer_model.setDocument(doc);
+ Inkscape::Selection *selection = Inkscape::GC::release(new Inkscape::Selection(&layer_model, NULL));
+
+ // Execute command-line actions (selections and verbs) using our local models
+ Inkscape::ActionContext context(selection);
+ has_performed_actions = Inkscape::CmdLineAction::doList(context);
+ }
+
+ if (!sp_export_svg && (sp_vacuum_defs || has_performed_actions)) {
// save under the name given in the command line
sp_repr_save_file(doc->rdoc, filename, SP_SVG_NS_URI);
}