summaryrefslogtreecommitdiffstats
path: root/src/main.cpp
diff options
context:
space:
mode:
authorTed Gould <ted@gould.cx>2007-03-01 07:14:26 +0000
committergouldtj <gouldtj@users.sourceforge.net>2007-03-01 07:14:26 +0000
commit3a5a71fb824f94db2bc2c2a90fe197e57a71996f (patch)
treeb1f23399ceeb0b28eb659a7ad85816a258d0b9cb /src/main.cpp
parentr14581@tres: ted | 2007-02-27 19:36:54 -0800 (diff)
downloadinkscape-3a5a71fb824f94db2bc2c2a90fe197e57a71996f.tar.gz
inkscape-3a5a71fb824f94db2bc2c2a90fe197e57a71996f.zip
r14582@tres: ted | 2007-02-28 19:07:35 -0800
Oh Yeah! Verbs work! (bzr r2478)
Diffstat (limited to 'src/main.cpp')
-rw-r--r--src/main.cpp43
1 files changed, 39 insertions, 4 deletions
diff --git a/src/main.cpp b/src/main.cpp
index 778928f4c..9a6dc0b76 100644
--- a/src/main.cpp
+++ b/src/main.cpp
@@ -387,6 +387,10 @@ struct poptOption options[] = {
POPT_AUTOHELP POPT_TABLEEND
};
+#include <ui/view/view.h>
+#include <desktop.h>
+#include <helper/action.h>
+
class CmdLineAction {
gint _type;
gchar * _arg;
@@ -410,16 +414,46 @@ public:
}
}
- void doIt (SPDocument * doc) {
+ void doIt (Inkscape::UI::View::View * view) {
printf("Doing: %s\n", _arg);
+ switch (_type) {
+ case SP_ARG_VERB: {
+ Inkscape::Verb * verb = Inkscape::Verb::getbyid(_arg);
+ if (verb == NULL) {
+ printf(_("Unable to find verb ID '%s' specified on the command line.\n"), _arg);
+ }
+ SPAction * action = verb->get_action(view);
+ sp_action_perform(action, NULL);
+ break;
+ }
+ case SP_ARG_SELECT: {
+
+ break;
+ }
+ }
}
- static void doList (SPDocument * doc) {
+ static void doList (Inkscape::UI::View::View * view) {
for (std::list<CmdLineAction *>::iterator i = _list.begin();
i != _list.end(); i++) {
CmdLineAction * entry = *i;
- entry->doIt(doc);
+ entry->doIt(view);
+ }
+ }
+
+ static bool idle (void) {
+ std::list<SPDesktop *> desktops;
+ inkscape_get_all_desktops(desktops);
+
+ // We're going to assume one desktop per document, because no one
+ // should have had time to make more at this point.
+ for (std::list<SPDesktop *>::iterator i = desktops.begin();
+ i != desktops.end(); i++) {
+ SPDesktop * desktop = *i;
+ //Inkscape::UI::View::View * view = dynamic_cast<Inkscape::UI::View::View *>(desktop);
+ doList(desktop);
}
+ return false;
}
};
std::list <CmdLineAction *> CmdLineAction::_list;
@@ -710,6 +744,7 @@ sp_main_gui(int argc, char const **argv)
}
}
+ Glib::signal_idle().connect(sigc::ptr_fun(&CmdLineAction::idle));
main_instance.run();
#ifdef WIN32
@@ -792,7 +827,7 @@ sp_main_console(int argc, char const **argv)
do_query_dimension (doc, false, sp_query_x? NR::X : NR::Y, sp_query_id);
}
- CmdLineAction::doList(doc);
+ //CmdLineAction::doList(doc);
}
fl = g_slist_remove(fl, fl->data);