execution-env.cpp revision d5642d4e10b170855e5d606bfeb60821a5be93e1
/*
* Authors:
* Ted Gould <ted@gould.cx>
*
* Copyright (C) 2007 Authors
*
* Released under GNU GPL, read the file 'COPYING' for more information
*/
#include <config.h>
#include "gtkmm/messagedialog.h"
#include "execution-env.h"
#include "prefdialog.h"
#include "implementation/implementation.h"
#include "selection.h"
#include "effect.h"
#include "document.h"
#include "desktop.h"
#include "sp-namedview.h"
#include "desktop-handles.h"
#include "util/glib-list-iterators.h"
namespace Inkscape {
namespace Extension {
ExecutionEnv::ExecutionEnv (Effect * effect, Inkscape::UI::View::View * doc, Gtk::Widget * controls, sigc::signal<void> * changeSignal, Gtk::Dialog * prefDialog, Implementation::ImplementationDocumentCache * docCache) :
_prefsVisible(false),
_finished(false),
_humanWait(false),
_canceled(false),
_prefsChanged(false),
_livePreview(true),
_shutdown(false),
_selfdelete(false),
{
//std::cout << "Selected: " << selected_id << std::endl;
++selected;
}
}
if (prefDialog == NULL) {
} else {
}
} else {
_prefsVisible = true;
_dialogsig = _visibleDialog->signal_response().connect(sigc::mem_fun(this, &ExecutionEnv::preferencesResponse));
// We came from a dialog, we'll need to die by ourselves.
_selfdelete = true;
}
if (_changeSignal != NULL) {
}
return;
}
ExecutionEnv::~ExecutionEnv (void) {
if (_prefsVisible) {
}
delete _visibleDialog;
}
delete _changeSignal;
}
killDocCache();
return;
}
void
ExecutionEnv::genDocCache (void) {
// printf("Gen Doc Cache\n");
}
return;
}
void
ExecutionEnv::killDocCache (void) {
// printf("Killed Doc Cache\n");
delete _docCache;
}
return;
}
void
ExecutionEnv::preferencesChange (void) {
if (_livePreview) {
_timersig = Glib::signal_timeout().connect(sigc::mem_fun(this, &ExecutionEnv::preferencesTimer), 100, Glib::PRIORITY_DEFAULT_IDLE);
}
return;
}
bool
ExecutionEnv::preferencesTimer (void) {
//std::cout << "Preferences are a changin'" << std::endl;
_prefsChanged = true;
if (_humanWait) {
_humanWait = false;
} else {
}
return false;
}
void
_visibleDialog = new PrefDialog(_effect->get_name(), _effect->get_help(), controls, this, _effect, _changeSignal);
_visibleDialog->show();
_dialogsig = _visibleDialog->signal_response().connect(sigc::mem_fun(this, &ExecutionEnv::preferencesResponse));
_prefsVisible = true;
return;
}
void
ExecutionEnv::createWorkingDialog (void) {
if (_visibleDialog != NULL) {
delete _visibleDialog;
}
if (_changeSignal != NULL) {
delete _changeSignal;
}
false, // use markup
true); // modal
_dialogsig = _visibleDialog->signal_response().connect(sigc::mem_fun(this, &ExecutionEnv::workingCanceled));
_visibleDialog->show();
_prefsVisible = false;
return;
}
void
printf("Working Canceled\n");
_finished = true;
return;
}
void
if (_humanWait && _livePreview) {
_finished = true;
} else {
if (!_livePreview) {
_humanWait = false;
}
}
} else {
if (_humanWait) {
} else {
}
_finished = true;
}
return;
}
void
ExecutionEnv::processingComplete(void) {
//std::cout << "Processing Complete" << std::endl;
if (_prefsChanged) { return; } // do it all again
if (_prefsVisible) {
_humanWait = true;
} else {
_finished = true;
}
return;
}
void
ExecutionEnv::processingCancel (void) {
return;
}
void
ExecutionEnv::documentCancel (void) {
_canceled = true;
return;
}
void
ExecutionEnv::documentCommit (void) {
return;
}
void
ExecutionEnv::reselect (void) {
}
}
return;
}
void
ExecutionEnv::run (void) {
while (!_finished) {
_canceled = false;
if (_humanWait) {
} else {
_prefsChanged = false;
genDocCache();
}
if (_canceled) {
reselect();
}
}
if (_selfdelete) {
delete this;
}
return;
}
/** \brief Set the state of live preview
\param state The current state
This will cancel the document preview and and configure
whether we should be waiting on the human. It will also
clear the document cache.
*/
void
if (_livePreview && !state) {
_humanWait = true;
}
if (!_livePreview && state) {
_humanWait = false;
}
if (!_livePreview) {
killDocCache();
}
return;
}
void
if (_humanWait) {
} else {
}
_finished = true;
_shutdown = true;
_selfdelete = del;
return;
}
} } /* namespace Inkscape, Extension */
/*
Local Variables:
mode:c++
c-file-style:"stroustrup"
c-file-offsets:((innamespace . 0)(inline-open . 0)(case-label . +))
indent-tabs-mode:nil
fill-column:99
End:
*/
// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4 :