summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: 63dfc16)
raw | patch | inline | side by side (parent: 63dfc16)
author | gouldtj <gouldtj@users.sourceforge.net> | |
Thu, 1 Mar 2007 07:14:26 +0000 (07:14 +0000) | ||
committer | gouldtj <gouldtj@users.sourceforge.net> | |
Thu, 1 Mar 2007 07:14:26 +0000 (07:14 +0000) |
Oh Yeah! Verbs work!
src/main.cpp | patch | blob | history |
diff --git a/src/main.cpp b/src/main.cpp
index 778928f4c0ff309bb468f1ed744eba420af4bf76..9a6dc0b769394094d51199566c4528657f8eccd9 100644 (file)
--- a/src/main.cpp
+++ b/src/main.cpp
POPT_AUTOHELP POPT_TABLEEND
};
+#include <ui/view/view.h>
+#include <desktop.h>
+#include <helper/action.h>
+
class CmdLineAction {
gint _type;
gchar * _arg;
}
}
- 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;
}
}
+ Glib::signal_idle().connect(sigc::ptr_fun(&CmdLineAction::idle));
main_instance.run();
#ifdef WIN32
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);