X-Git-Url: https://git.tokkee.org/?a=blobdiff_plain;f=src%2Fui%2Fdialog%2Fdialog.cpp;h=ac147d65652230b5fbf53e55f01206de641ade64;hb=972378c933ea8f6089de0605db456024da9a9068;hp=238c6d9f7675702cc5d71ed7c36e024c86dd3cd3;hpb=69d270fec638055afb0f4d6037b1e7d6bd7d10be;p=inkscape.git diff --git a/src/ui/dialog/dialog.cpp b/src/ui/dialog/dialog.cpp index 238c6d9f7..ac147d656 100644 --- a/src/ui/dialog/dialog.cpp +++ b/src/ui/dialog/dialog.cpp @@ -4,9 +4,10 @@ * * Author: * Bryce W. Harrington - * buliabyak@gmail.com + * buliabyak@gmail.com + * Johan Engelen * - * Copyright (C) 2004, 2005 Authors + * Copyright (C) 2004-2007 Authors * * Released under GNU GPL. Read the file 'COPYING' for more information. */ @@ -15,7 +16,6 @@ # include #endif -#include #include #include @@ -32,11 +32,15 @@ #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) { @@ -44,7 +48,6 @@ 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) @@ -63,6 +66,7 @@ sp_dialog_shutdown (GtkObject *object, gpointer dlgPtr) void Dialog::present() { + _user_hidden = false; Gtk::Dialog::present(); } @@ -97,18 +101,16 @@ Dialog::read_geometry() // 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 @@ -118,9 +120,7 @@ Dialog::read_geometry() 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(); @@ -128,9 +128,7 @@ void hideCallback(GtkObject *object, gpointer dlgPtr) 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(); @@ -173,9 +171,6 @@ Dialog::Dialog(const char *prefs_path, int verb_num, const char *apply_label) 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; @@ -198,6 +193,8 @@ Dialog::Dialog(const char *prefs_path, int verb_num, const char *apply_label) read_geometry(); present(); + sp_transientize(dlg); + retransientize_suppress = false; } Dialog::Dialog(BaseObjectType *gobj) @@ -292,10 +289,18 @@ Dialog::onDesktopActivated (SPDesktop *desktop) { 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) { @@ -329,14 +334,13 @@ Dialog::onDesktopActivated (SPDesktop *desktop) // 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