summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: 1969fd5)
raw | patch | inline | side by side (parent: 1969fd5)
author | Jon A. Cruz <jon@joncruz.org> | |
Sun, 4 Apr 2010 00:17:51 +0000 (17:17 -0700) | ||
committer | Jon A. Cruz <jon@joncruz.org> | |
Sun, 4 Apr 2010 00:17:51 +0000 (17:17 -0700) |
index 2b39eb3c9a21856aaa0614545159622b37decefc..2483dc50e6b20388ad600baf92086bf2d89e8e96 100644 (file)
--- a/src/ui/dialog/dialog.cpp
+++ b/src/ui/dialog/dialog.cpp
save_geometry();
delete _behavior;
+ _behavior = 0;
}
diff --git a/src/ui/dialog/dialog.h b/src/ui/dialog/dialog.h
index 1a59a236cade797bfbd79207dd74c305df9d47d8..f07c1bc867c66a8c9ae8184d4ca2c8f98105de6f 100644 (file)
--- a/src/ui/dialog/dialog.h
+++ b/src/ui/dialog/dialog.h
class SPDesktop;
-namespace Inkscape {
-class Selection;
-class Application;
+namespace Inkscape {
+class Selection;
+class Application;
}
namespace Inkscape {
gboolean sp_retransientize_again(gpointer dlgPtr);
void sp_dialog_shutdown(GtkObject *object, gpointer dlgPtr);
-/**
+/**
* @brief Base class for Inkscape dialogs
* This class provides certain common behaviors and styles wanted of all dialogs
* in the application. Fundamental parts of the dialog's behavior are controlled by
public:
- Dialog(Behavior::BehaviorFactory behavior_factory, const char *prefs_path = NULL,
+ Dialog(Behavior::BehaviorFactory behavior_factory, const char *prefs_path = NULL,
int verb_num = 0, Glib::ustring const &apply_label = "");
virtual ~Dialog();
index 19147f2c7cfddd277140816722b1d4f9f1ad60ed..85f078439735f52dd670912c4205688a1ffb17b3 100644 (file)
Behavior(dialog),
_d (new Gtk::Dialog(_dialog._title))
#if GTK_VERSION_GE(2, 12)
- ,_dialog_active(_d->property_is_active())
- ,_steps(0)
- ,_trans_focus(Inkscape::Preferences::get()->getDoubleLimited("/dialogs/transparency/on-focus", 0.95, 0.0, 1.0))
- ,_trans_blur(Inkscape::Preferences::get()->getDoubleLimited("/dialogs/transparency/on-blur", 0.50, 0.0, 1.0))
- ,_trans_time(Inkscape::Preferences::get()->getIntLimited("/dialogs/transparency/animate-time", 100, 0, 5000))
+ ,_dialog_active(_d->property_is_active())
+ ,_steps(0)
+ ,_trans_focus(Inkscape::Preferences::get()->getDoubleLimited("/dialogs/transparency/on-focus", 0.95, 0.0, 1.0))
+ ,_trans_blur(Inkscape::Preferences::get()->getDoubleLimited("/dialogs/transparency/on-blur", 0.50, 0.0, 1.0))
+ ,_trans_time(Inkscape::Preferences::get()->getIntLimited("/dialogs/transparency/animate-time", 100, 0, 5000))
#endif
{
hide();
_dialog.retransientize_suppress = false;
#if GTK_VERSION_GE(2, 12)
- _focus_event();
- _dialog_active.signal_changed().connect(sigc::mem_fun(this, &FloatingBehavior::_focus_event));
+ _focus_event();
+ _dialog_active.signal_changed().connect(sigc::mem_fun(this, &FloatingBehavior::_focus_event));
#endif
}
#if GTK_VERSION_GE(2, 12)
/** \brief A function called when the window gets focus
- This function gets called on a focus event. It figures out how much
- time is required for a transition, and the number of steps that'll take,
- and sets up the _trans_timer function to do the work. If the transition
- time is set to 0 ms it just calls _trans_timer once with _steps equal to
- zero so that the transition happens instantaneously. This occurs on
- windows as opacity changes cause flicker there.
+ This function gets called on a focus event. It figures out how much
+ time is required for a transition, and the number of steps that'll take,
+ and sets up the _trans_timer function to do the work. If the transition
+ time is set to 0 ms it just calls _trans_timer once with _steps equal to
+ zero so that the transition happens instantaneously. This occurs on
+ windows as opacity changes cause flicker there.
*/
void FloatingBehavior::_focus_event (void)
{
/** \brief Move the opacity of a window towards our goal
- This is a timer function that is set up by _focus_event to slightly
- move the opacity of the window along in an animated fashion. It moves
- the opacity half way to the goal until it runs out of steps, and then
- it just forces the goal.
+ This is a timer function that is set up by _focus_event to slightly
+ move the opacity of the window along in an animated fashion. It moves
+ the opacity half way to the goal until it runs out of steps, and then
+ it just forces the goal.
*/
bool FloatingBehavior::_trans_timer (void) {
- // printf("Go go gadget timer: %d\n", _steps);
- if (_steps == 0) {
- if (_dialog_active.get_value()) {
- _d->set_opacity(_trans_focus);
- } else {
- _d->set_opacity(_trans_blur);
- }
-
- return false;
- }
-
- float goal, current;
- goal = current = _d->get_opacity();
-
- if (_dialog_active.get_value()) {
- goal = _trans_focus;
- } else {
- goal = _trans_blur;
- }
-
- _d->set_opacity(current - ((current - goal) / 2));
- _steps--;
- return true;
+ // printf("Go go gadget timer: %d\n", _steps);
+ if (_steps == 0) {
+ if (_dialog_active.get_value()) {
+ _d->set_opacity(_trans_focus);
+ } else {
+ _d->set_opacity(_trans_blur);
+ }
+
+ return false;
+ }
+
+ float goal, current;
+ goal = current = _d->get_opacity();
+
+ if (_dialog_active.get_value()) {
+ goal = _trans_focus;
+ } else {
+ goal = _trans_blur;
+ }
+
+ _d->set_opacity(current - ((current - goal) / 2));
+ _steps--;
+ return true;
}
#endif
-FloatingBehavior::~FloatingBehavior()
-{
+FloatingBehavior::~FloatingBehavior()
+{
delete _d;
+ _d = 0;
}
Behavior *
#ifdef WIN32 // Win32 special code to enable transient dialogs
transient_policy = 2;
-#endif
+#endif
- if (!transient_policy)
+ if (!transient_policy)
return;
GtkWindow *dialog_win = GTK_WINDOW(_d->gobj());
index 0360ccf494fcd012ca4a5d6b286e615949b86335..30ecaa053c0fc95b49763750046a266021d2ef69 100644 (file)
Gtk::Dialog *_d; //< the actual dialog
#if GTK_VERSION_GE(2, 12)
- void _focus_event (void);
- bool _trans_timer (void);
-
- Glib::PropertyProxy_ReadOnly<bool> _dialog_active; //< Variable proxy to track whether the dialog is the active window
- int _steps; //< Number of steps for the timer to animate the transparent dialog
- float _trans_focus; //< The percentage opacity when the dialog is focused
- float _trans_blur; //< The percentage opactiy when the dialog is not focused
- int _trans_time; //< The amount of time (in ms) for the dialog to change it's transparency
+ void _focus_event (void);
+ bool _trans_timer (void);
+
+ Glib::PropertyProxy_ReadOnly<bool> _dialog_active; //< Variable proxy to track whether the dialog is the active window
+ int _steps; //< Number of steps for the timer to animate the transparent dialog
+ float _trans_focus; //< The percentage opacity when the dialog is focused
+ float _trans_blur; //< The percentage opactiy when the dialog is not focused
+ int _trans_time; //< The amount of time (in ms) for the dialog to change it's transparency
#endif
};