index deabcf3839438e6df6f64730e5e82079fbcf66f1..b5992ab5cecfa7d762c8f35c1a609dfe444e5057 100644 (file)
-#define __DIALOG_EVENTS_C__
-
-/**
- * \brief Event handler for dialog windows
- *
- * Authors:
+/** @file
+ * @brief Event handler for dialog windows
+ */
+/* Authors:
* bulia byak <bulia@dr.com>
+ * Johan Engelen <j.b.c.engelen@ewi.utwente.nl>
*
- * Copyright (C) 2003 authors
+ * Copyright (C) 2003-2007 Authors
*
* Released under GNU GPL, read the file 'COPYING' for more information
*/
#include <gtk/gtk.h>
#include "desktop.h"
#include "inkscape-private.h"
-#include "prefs-utils.h"
+#include "preferences.h"
#include "event-context.h"
#include "dialog-events.h"
-
-/**
-* \brief This function is called to zero the transientize semaphore by a
-* timeout.
-*/
-gboolean
-sp_allow_again (gpointer *wd)
-{
- ((win_data *) wd)->stop = 0;
- return FALSE; // so that it is only called once
-}
+#include <gtkmm/entry.h>
* \brief Remove focus from window to whoever it is transient for...
*
*/
+void
+sp_dialog_defocus_cpp (Gtk::Window *win)
+{
+ Gtk::Window *w;
+ //find out the document window we're transient for
+ w = win->get_transient_for();
+
+ //switch to it
+ if (w) {
+ w->present();
+ }
+}
+
void
sp_dialog_defocus (GtkWindow *win)
{
}
-
/**
* \brief Callback to defocus a widget's parent dialog.
*
*/
void
-sp_dialog_defocus_callback (GtkWindow *win, gpointer data)
+sp_dialog_defocus_callback_cpp (Gtk::Entry *e)
+{
+ sp_dialog_defocus_cpp(dynamic_cast<Gtk::Window *>(e->get_toplevel()));
+}
+
+void
+sp_dialog_defocus_callback (GtkWindow */*win*/, gpointer data)
{
sp_dialog_defocus ((GtkWindow *)
gtk_widget_get_toplevel ((GtkWidget *) data));
+void
+sp_dialog_defocus_on_enter_cpp (Gtk::Entry *e)
+{
+ e->signal_activate().connect(sigc::bind(sigc::ptr_fun(&sp_dialog_defocus_callback_cpp), e));
+}
+
void
sp_dialog_defocus_on_enter (GtkWidget *w)
{
void
sp_transientize (GtkWidget *dialog)
{
- if (prefs_get_int_attribute ( "options.dialogsskiptaskbar", "value", 0)) {
+ Inkscape::Preferences *prefs = Inkscape::Preferences::get();
+#ifndef WIN32 // FIXME: Temporary Win32 special code to enable transient dialogs
+ // _set_skip_taskbar_hint makes transient dialogs NON-transient! When dialogs
+ // are made transient (_set_transient_for), they are already removed from
+ // the taskbar in Win32.
+ if (prefs->getBool( "/options/dialogsskiptaskbar/value")) {
gtk_window_set_skip_taskbar_hint (GTK_WINDOW (dialog), TRUE);
}
+#endif
+
+ gint transient_policy = prefs->getIntLimited("/options/transientpolicy/value", 1, 0, 2);
- gint transient_policy = prefs_get_int_attribute_limited ( "options.transientpolicy", "value", 1, 0, 2 );
+#ifdef WIN32 // Win32 special code to enable transient dialogs
+ transient_policy = 2;
+#endif
if (transient_policy) {
-
+
// if there's an active document window, attach dialog to it as a transient:
-
+
if ( SP_ACTIVE_DESKTOP )
{
SP_ACTIVE_DESKTOP->setWindowTransient (dialog, transient_policy);
}
void
-sp_transientize_callback ( Inkscape::Application * /*inkscape*/,
+sp_transientize_callback ( Inkscape::Application * /*inkscape*/,
SPDesktop *desktop, win_data *wd )
{
- gint transient_policy =
- prefs_get_int_attribute_limited ( "options.transientpolicy", "value",
- 1, 0, 2);
+ Inkscape::Preferences *prefs = Inkscape::Preferences::get();
+ gint transient_policy = prefs->getIntLimited( "/options/transientpolicy/value", 1, 0, 2);
- if (!transient_policy)
- return;
+#ifdef WIN32 // Win32 special code to enable transient dialogs
+ transient_policy = 1;
+#endif
- if (wd->stop) {
- /*
- * if retransientizing of this dialog is still forbidden after
- * previous call warning turned off because it was confusingly fired
- * when loading many files from command line
- */
- // g_warning("Retranzientize aborted! You're switching windows too fast!");
+ if (!transient_policy)
return;
- }
-
+
if (wd->win)
{
- wd->stop = 1; // disallow other attempts to retranzientize this dialog
desktop->setWindowTransient (wd->win, transient_policy);
}
-
- // we're done, allow next retransientizing not sooner than after 6 msec
- gtk_timeout_add (6, (GtkFunction) sp_allow_again, (gpointer) wd);
}
void on_dialog_hide (GtkWidget *w)
}
gboolean
-sp_dialog_hide (GtkObject *object, gpointer data)
+sp_dialog_hide (GtkObject */*object*/, gpointer data)
{
GtkWidget *dlg = (GtkWidget *) data;
gboolean
-sp_dialog_unhide (GtkObject *object, gpointer data)
+sp_dialog_unhide (GtkObject */*object*/, gpointer data)
{
GtkWidget *dlg = (GtkWidget *) data;