summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorTed Gould <ted@gould.cx>2007-09-01 04:36:03 +0000
committergouldtj <gouldtj@users.sourceforge.net>2007-09-01 04:36:03 +0000
commit776410582f483ba74ce1068ff0dc0e9f068fb5d7 (patch)
treed71a68250393725e3b54c691fe5939fddd625de3 /src
parentr16441@tres: ted | 2007-08-30 20:44:39 -0700 (diff)
downloadinkscape-776410582f483ba74ce1068ff0dc0e9f068fb5d7.tar.gz
inkscape-776410582f483ba74ce1068ff0dc0e9f068fb5d7.zip
r16442@tres: ted | 2007-08-30 21:51:42 -0700
One preference dialog per effect. Nothing crazy here. Also setting the timer to be ref counted in lock/unlock mode. This way the whole thing stays locked while the dialog is shown. (bzr r3653)
Diffstat (limited to 'src')
-rw-r--r--src/extension/effect.cpp22
-rw-r--r--src/extension/effect.h5
-rw-r--r--src/extension/prefdialog.cpp7
-rw-r--r--src/extension/timer.cpp9
-rw-r--r--src/extension/timer.h6
5 files changed, 39 insertions, 10 deletions
diff --git a/src/extension/effect.cpp b/src/extension/effect.cpp
index a20f1c6e9..7ac4825a3 100644
--- a/src/extension/effect.cpp
+++ b/src/extension/effect.cpp
@@ -35,7 +35,8 @@ Effect::Effect (Inkscape::XML::Node * in_repr, Implementation::Implementation *
_name_noprefs(Glib::ustring(get_name()) + _(" (No preferences)")),
_verb(get_id(), get_name(), NULL, NULL, this, true),
_verb_nopref(_id_noprefs.c_str(), _name_noprefs.c_str(), NULL, NULL, this, false),
- _menu_node(NULL), _workingDialog(true)
+ _menu_node(NULL), _workingDialog(true),
+ _prefDialog(NULL)
{
Inkscape::XML::Node * local_effects_menu = NULL;
@@ -206,6 +207,11 @@ Effect::check (void)
bool
Effect::prefs (Inkscape::UI::View::View * doc)
{
+ if (_prefDialog != NULL) {
+ _prefDialog->raise();
+ return true;
+ }
+
if (!loaded())
set_state(Extension::STATE_LOADED);
if (!loaded()) return false;
@@ -237,7 +243,7 @@ Effect::prefs (Inkscape::UI::View::View * doc)
void
Effect::effect (Inkscape::UI::View::View * doc)
{
- printf("Execute effect\n");
+ //printf("Execute effect\n");
if (!loaded())
set_state(Extension::STATE_LOADED);
if (!loaded()) return;
@@ -300,6 +306,18 @@ Effect::get_info_widget(void)
return Extension::get_info_widget();
}
+void
+Effect::set_pref_dialog (PrefDialog * prefdialog)
+{
+ _prefDialog = prefdialog;
+ if (_prefDialog == NULL) {
+ timer->unlock();
+ } else {
+ timer->lock();
+ }
+ return;
+}
+
/** \brief Create an action for a \c EffectVerb
\param view Which view the action should be created for
\return The built action.
diff --git a/src/extension/effect.h b/src/extension/effect.h
index bebdb1c4f..44d18146a 100644
--- a/src/extension/effect.h
+++ b/src/extension/effect.h
@@ -18,6 +18,7 @@
#include <gtk/gtkdialog.h>
#include "verbs.h"
+#include "prefdialog.h"
#include "extension.h"
struct SPDocument;
@@ -88,6 +89,9 @@ class Effect : public Extension {
Inkscape::XML::Node * _menu_node;
/** \brief Whehter a working dialog should be shown */
bool _workingDialog;
+
+ /** \brief The preference dialog if it is shown */
+ PrefDialog * _prefDialog;
public:
Effect (Inkscape::XML::Node * in_repr,
Implementation::Implementation * in_imp);
@@ -109,6 +113,7 @@ public:
bool no_doc; // if true, the effect does not process SVG document at all, so no need to save, read, and watch for errors
+ void set_pref_dialog (PrefDialog * prefdialog);
private:
static gchar * remove_ (gchar * instr);
};
diff --git a/src/extension/prefdialog.cpp b/src/extension/prefdialog.cpp
index cef642d50..0174fd585 100644
--- a/src/extension/prefdialog.cpp
+++ b/src/extension/prefdialog.cpp
@@ -107,11 +107,18 @@ PrefDialog::PrefDialog (Glib::ustring name, gchar const * help, Gtk::Widget * co
GtkWidget *dlg = GTK_WIDGET(gobj());
sp_transientize(dlg);
+ if (_effect != NULL) {
+ _effect->set_pref_dialog(this);
+ }
+
return;
}
PrefDialog::~PrefDialog ( )
{
+ if (_effect != NULL) {
+ _effect->set_pref_dialog(NULL);
+ }
if (_param_preview != NULL) {
delete _param_preview;
}
diff --git a/src/extension/timer.cpp b/src/extension/timer.cpp
index 0e7a6ad11..c7a9331a0 100644
--- a/src/extension/timer.cpp
+++ b/src/extension/timer.cpp
@@ -33,11 +33,10 @@ bool ExpirationTimer::timer_started = false;
the first timer extension, the timer is kicked off. This function
also sets up teh circularly linked list of all the timers.
*/
-ExpirationTimer::ExpirationTimer (Extension * in_extension)
+ExpirationTimer::ExpirationTimer (Extension * in_extension):
+ locked(0),
+ extension(in_extension)
{
- locked = false;
- extension = in_extension;
-
/* Fix Me! */
if (timer_list == NULL) {
next = this;
@@ -124,7 +123,7 @@ ExpirationTimer::touch (void)
bool
ExpirationTimer::expired (void) const
{
- if (locked) return false;
+ if (locked > 0) return false;
Glib::TimeVal current;
current.assign_current_time();
diff --git a/src/extension/timer.h b/src/extension/timer.h
index b9649e899..7855ed170 100644
--- a/src/extension/timer.h
+++ b/src/extension/timer.h
@@ -31,7 +31,7 @@ class ExpirationTimer {
static bool timer_started;
/** \brief Is this extension locked from being unloaded? */
- bool locked;
+ int locked;
/** \brief Next entry in the list */
ExpirationTimer * next;
/** \brief When this timer expires */
@@ -49,8 +49,8 @@ public:
~ExpirationTimer(void);
void touch (void);
- void lock (void) { locked = true; };
- void unlock (void) { locked = false; };
+ void lock (void) { locked++; };
+ void unlock (void) { locked--; };
/** \brief Set the timeout variable */
static void set_timeout (long in_seconds) { timeout = in_seconds; };