summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorTed Gould <ted@gould.cx>2007-06-27 06:20:42 +0000
committergouldtj <gouldtj@users.sourceforge.net>2007-06-27 06:20:42 +0000
commit60c70f534c4ee27681822d8a63edab17a937b0cf (patch)
tree14bfd4c25c03ef6055c523902170e824141764e7 /src
parentr15379@tres: ted | 2007-05-09 19:13:37 -0700 (diff)
downloadinkscape-60c70f534c4ee27681822d8a63edab17a937b0cf.tar.gz
inkscape-60c70f534c4ee27681822d8a63edab17a937b0cf.zip
r15380@tres: ted | 2007-05-10 19:24:35 -0700
Can now hit the cancel key and have it mean something. (bzr r3122)
Diffstat (limited to 'src')
-rw-r--r--src/extension/effect.cpp36
-rw-r--r--src/extension/effect.h4
2 files changed, 39 insertions, 1 deletions
diff --git a/src/extension/effect.cpp b/src/extension/effect.cpp
index 658861de7..f33ff5154 100644
--- a/src/extension/effect.cpp
+++ b/src/extension/effect.cpp
@@ -247,19 +247,53 @@ Effect::effect (Inkscape::UI::View::View * doc)
Gtk::MESSAGE_INFO,
Gtk::BUTTONS_CANCEL,
true); // modal
+ working.signal_response().connect(sigc::mem_fun(this, &Effect::workingCanceled));
g_free(dlgmessage);
+ _canceled = false;
working.show();
set_last_effect(this);
imp->effect(this, doc);
- sp_document_done(doc->doc(), SP_VERB_NONE, _(this->get_name()));
+ if (!_canceled) {
+ sp_document_done(doc->doc(), SP_VERB_NONE, _(this->get_name()));
+ } else {
+ sp_document_cancel(doc->doc());
+ }
working.hide();
return;
}
+/** \internal
+ \brief A function used by the working dialog to recieve the cancel
+ button press
+ \param resp The key that was pressed (should always be cancel)
+
+ This function recieves the key event and marks the effect as being
+ canceled. It calls the function in the implementation that would
+ cancel the implementation.
+*/
+void
+Effect::workingCanceled (const int resp) {
+ if (resp == Gtk::RESPONSE_CANCEL) {
+ std::cout << "Canceling Effect" << std::endl;
+ _canceled = true;
+ imp->cancelProcessing();
+ }
+ return;
+}
+
+/** \brief Sets which effect was called last
+ \param in_effect The effect that has been called
+
+ This function sets the static variable \c _last_effect and it
+ ensures that the last effect verb is sensitive.
+
+ If the \c in_effect variable is \c NULL then the last effect
+ verb is made insesitive.
+*/
void
Effect::set_last_effect (Effect * in_effect)
{
diff --git a/src/extension/effect.h b/src/extension/effect.h
index b6fc80aa5..53d31cf06 100644
--- a/src/extension/effect.h
+++ b/src/extension/effect.h
@@ -14,6 +14,7 @@
#include <config.h>
#include <glibmm/i18n.h>
+#include <gtkmm/dialog.h>
#include <gtk/gtkdialog.h>
#include "verbs.h"
@@ -108,6 +109,9 @@ public:
private:
static gchar * remove_ (gchar * instr);
+
+ bool _canceled;
+ void workingCanceled (const int resp);
};
} } /* namespace Inkscape, Extension */