From 94dd2a9c8f6a1c7c3d11151b53f7728417613739 Mon Sep 17 00:00:00 2001 From: gouldtj Date: Wed, 27 Jun 2007 06:20:42 +0000 Subject: [PATCH] r15380@tres: ted | 2007-05-10 19:24:35 -0700 Can now hit the cancel key and have it mean something. --- src/extension/effect.cpp | 36 +++++++++++++++++++++++++++++++++++- src/extension/effect.h | 4 ++++ 2 files changed, 39 insertions(+), 1 deletion(-) 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 #include +#include #include #include "verbs.h" @@ -108,6 +109,9 @@ public: private: static gchar * remove_ (gchar * instr); + + bool _canceled; + void workingCanceled (const int resp); }; } } /* namespace Inkscape, Extension */ -- 2.30.2