index 238c6d9f7675702cc5d71ed7c36e024c86dd3cd3..ac147d65652230b5fbf53e55f01206de641ade64 100644 (file)
--- a/src/ui/dialog/dialog.cpp
+++ b/src/ui/dialog/dialog.cpp
*
* Author:
* Bryce W. Harrington <bryce@bryceharrington.org>
- * buliabyak@gmail.com
+ * buliabyak@gmail.com
+ * Johan Engelen <j.b.c.engelen@ewi.utwente.nl>
*
- * Copyright (C) 2004, 2005 Authors
+ * Copyright (C) 2004-2007 Authors
*
* Released under GNU GPL. Read the file 'COPYING' for more information.
*/
# include <config.h>
#endif
-#include <typeinfo>
#include <gtkmm/stock.h>
#include <gtk/gtk.h>
#include "interface.h"
#include "verbs.h"
+
+#define MIN_ONSCREEN_DISTANCE 50
+
+
+
namespace Inkscape {
namespace UI {
namespace Dialog {
-#ifndef WIN32
static gboolean
sp_retransientize_again (gpointer dlgPtr)
{
dlg->retransientize_suppress = false;
return FALSE; // so that it is only called once
}
-#endif
static void
sp_retransientize (Inkscape::Application *inkscape, SPDesktop *desktop, gpointer dlgPtr)
void
Dialog::present()
{
+ _user_hidden = false;
Gtk::Dialog::present();
}
// g_print ("read %d %d %d %d\n", x, y, w, h);
- if (x<0) x=0;
- if (y<0) y=0;
-
// If there are stored height and width values for the dialog,
// resize the window to match; otherwise we leave it at its default
if (w != 0 && h != 0) {
resize (w, h);
}
-
+
// If there are stored values for where the dialog should be
// located, then restore the dialog to that position.
- if (x != -1000 && y != -1000) {
+ // also check if (x,y) is actually onscreen with the current screen dimensions
+ if ( (x >= 0) && (y >= 0) && (x < (gdk_screen_width()-MIN_ONSCREEN_DISTANCE)) && (y < (gdk_screen_height()-MIN_ONSCREEN_DISTANCE)) ) {
move(x, y);
} else {
// ...otherwise just put it in the middle of the screen
void hideCallback(GtkObject *object, gpointer dlgPtr)
{
- Dialog* example;
- if ((void*)dlgPtr == 0 || typeid(dlgPtr) != typeid(example))
- return;
+ g_return_if_fail( dlgPtr != NULL );
Dialog *dlg = (Dialog *)dlgPtr;
dlg->onHideF12();
void unhideCallback(GtkObject *object, gpointer dlgPtr)
{
- Dialog* example;
- if ((void*)dlgPtr == 0 || typeid(dlgPtr) != typeid(example))
- return;
+ g_return_if_fail( dlgPtr != NULL );
Dialog *dlg = (Dialog *)dlgPtr;
dlg->onShowF12();
set_title(title);
}
- sp_transientize(dlg);
- retransientize_suppress = false;
-
gtk_signal_connect( GTK_OBJECT (dlg), "event", GTK_SIGNAL_FUNC(sp_dialog_event_handler), dlg );
_hiddenF12 = false;
read_geometry();
present();
+ sp_transientize(dlg);
+ retransientize_suppress = false;
}
Dialog::Dialog(BaseObjectType *gobj)
{
gint transient_policy = prefs_get_int_attribute_limited ( "options.transientpolicy", "value", 1, 0, 2);
- if (!transient_policy)
+#ifdef WIN32 // FIXME: Temporary Win32 special code to enable transient dialogs
+ if (prefs_get_int_attribute ( "options.dialogsontopwin32", "value", 0))
+ transient_policy = 2;
+ else
return;
+#endif
+
+ if (!transient_policy)
+ return;
+
+
-#ifndef WIN32
GtkWindow *dialog_win = GTK_WINDOW(gobj());
if (retransientize_suppress) {
// we're done, allow next retransientizing not sooner than after 120 msec
gtk_timeout_add (120, (GtkFunction) sp_retransientize_again, (gpointer) this);
-#endif
}
Inkscape::Selection*
Dialog::_getSelection()
{
- return SP_DT_SELECTION(SP_ACTIVE_DESKTOP);
+ return sp_desktop_selection(SP_ACTIVE_DESKTOP);
}
void