summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: 02940c8)
raw | patch | inline | side by side (parent: 02940c8)
author | gouldtj <gouldtj@users.sourceforge.net> | |
Thu, 1 Mar 2007 07:21:46 +0000 (07:21 +0000) | ||
committer | gouldtj <gouldtj@users.sourceforge.net> | |
Thu, 1 Mar 2007 07:21:46 +0000 (07:21 +0000) |
Somehow that didn't get deleted.
src/main.cpp | patch | blob | history |
diff --git a/src/main.cpp b/src/main.cpp
index dbca3f74ca7c65fbe34f5435ebfa18a787e71a9d..d3433756c2f6644fb7791d0e214dbb6c08f41638 100644 (file)
--- a/src/main.cpp
+++ b/src/main.cpp
POPT_AUTOHELP POPT_TABLEEND
};
-#include <ui/view/view.h>
-#include <desktop.h>
-#include <desktop-handles.h>
-#include <helper/action.h>
-#include <selection.h>
-
-class CmdLineAction {
- gint _type;
- gchar * _arg;
-
- static std::list <CmdLineAction *> _list;
-
-public:
- CmdLineAction (gint type, gchar const * arg) : _type(type), _arg(NULL) {
- if (arg != NULL) {
- _arg = g_strdup(arg);
- }
-
- _list.insert(_list.end(), this);
-
- return;
- }
-
- ~CmdLineAction () {
- if (_arg != NULL) {
- g_free(_arg);
- }
- }
-
- 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);
- break;
- }
- SPAction * action = verb->get_action(view);
- sp_action_perform(action, NULL);
- break;
- }
- case SP_ARG_SELECT: {
- SPDesktop * desktop = dynamic_cast<SPDesktop *>(view);
- if (desktop == NULL) { break; }
-
- SPDocument * doc = view->doc();
- SPObject * obj = doc->getObjectById(_arg);
- if (obj == NULL) {
- printf("Unable to find node ID: '%s'\n", _arg);
- break;
- }
-
- Inkscape::Selection * selection = sp_desktop_selection(desktop);
- selection->add(obj, false);
- break;
- }
- }
- }
-
- 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(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;
-
-
static bool needToRecodeParams = true;
gchar* blankParam = "";