From: gouldtj Date: Thu, 1 Mar 2007 07:14:26 +0000 (+0000) Subject: r14582@tres: ted | 2007-02-28 19:07:35 -0800 X-Git-Url: https://git.tokkee.org/?a=commitdiff_plain;h=c2a4dc2de6f9b9b1725671be102371e3603a2064;p=inkscape.git r14582@tres: ted | 2007-02-28 19:07:35 -0800 Oh Yeah! Verbs work! --- 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 +#include +#include + 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::iterator i = _list.begin(); i != _list.end(); i++) { CmdLineAction * entry = *i; - entry->doIt(doc); + entry->doIt(view); + } + } + + static bool idle (void) { + std::list 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::iterator i = desktops.begin(); + i != desktops.end(); i++) { + SPDesktop * desktop = *i; + //Inkscape::UI::View::View * view = dynamic_cast(desktop); + doList(desktop); } + return false; } }; std::list 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);