summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: b52e65f)
raw | patch | inline | side by side (parent: b52e65f)
author | gouldtj <gouldtj@users.sourceforge.net> | |
Sat, 1 Sep 2007 04:36:03 +0000 (04:36 +0000) | ||
committer | gouldtj <gouldtj@users.sourceforge.net> | |
Sat, 1 Sep 2007 04:36:03 +0000 (04:36 +0000) |
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.
timer to be ref counted in lock/unlock mode. This way the whole thing
stays locked while the dialog is shown.
index a20f1c6e93dc4ef596e74100448a0137b1a34387..7ac4825a3afdcf274d73beac0185858bd8e1df82 100644 (file)
--- a/src/extension/effect.cpp
+++ b/src/extension/effect.cpp
_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;
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;
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;
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 bebdb1c4f8c544cdc65e9e73d70fe40392dd555c..44d18146af28c533629dcedebe8f1c4df68b9637 100644 (file)
--- a/src/extension/effect.h
+++ b/src/extension/effect.h
#include <gtk/gtkdialog.h>
#include "verbs.h"
+#include "prefdialog.h"
#include "extension.h"
struct SPDocument;
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);
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);
};
index cef642d5018e03ba37b46b9cdb73522cabfdf040..0174fd58505b58d68ec668ee8d6ab79bcd85dc86 100644 (file)
@@ -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;
}
index 0e7a6ad112fd8e70eefd825967888ae38004a229..c7a9331a0ab3dc10bfbc00c9975b74b07d2ad2aa 100644 (file)
--- a/src/extension/timer.cpp
+++ b/src/extension/timer.cpp
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;
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 b9649e899e7cce5c5c296716261ab311d915d79f..7855ed170122417756284a7e738ff36d330023ed 100644 (file)
--- a/src/extension/timer.h
+++ b/src/extension/timer.h
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 */
~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; };