From 93c30ceaf35665178fe7fcebc6900c136dfebc6c Mon Sep 17 00:00:00 2001 From: johanengelen Date: Mon, 27 Nov 2006 15:01:13 +0000 Subject: [PATCH] non-gtkmm dialogs are now always opened ON-screen --- src/dialogs/clonetiler.cpp | 23 +++++++++++++---------- src/dialogs/find.cpp | 16 +++++++++------- src/dialogs/input.cpp | 20 +++++++++++--------- src/dialogs/item-properties.cpp | 20 +++++++++++--------- src/dialogs/object-properties.cpp | 17 ++++++++++------- src/dialogs/text-edit.cpp | 20 +++++++++++--------- src/dialogs/xml-tree.cpp | 21 ++++++++++++--------- 7 files changed, 77 insertions(+), 60 deletions(-) diff --git a/src/dialogs/clonetiler.cpp b/src/dialogs/clonetiler.cpp index 2bed7b399..172f4f677 100644 --- a/src/dialogs/clonetiler.cpp +++ b/src/dialogs/clonetiler.cpp @@ -4,9 +4,10 @@ * Clone tiling dialog * * Authors: - * bulia byak + * bulia byak + * Johan Engelen * - * Copyright (C) 2004-2005 Authors + * Copyright (C) 2004-2006 Authors * Released under GNU GPL */ @@ -60,6 +61,8 @@ #include "../sp-filter.h" #include "../filter-chemistry.h" +#define MIN_ONSCREEN_DISTANCE 50 + static GtkWidget *dlg = NULL; static win_data wd; @@ -1629,8 +1632,8 @@ clonetiler_dialog (void) dlg = sp_window_new (title, TRUE); if (x == -1000 || y == -1000) { - x = prefs_get_int_attribute (prefs_path, "x", 0); - y = prefs_get_int_attribute (prefs_path, "y", 0); + x = prefs_get_int_attribute (prefs_path, "x", -1000); + y = prefs_get_int_attribute (prefs_path, "y", -1000); } if (w ==0 || h == 0) { @@ -1638,19 +1641,19 @@ clonetiler_dialog (void) h = prefs_get_int_attribute (prefs_path, "h", 0); } - if (x<0) x=0; - if (y<0) y=0; +// if (x<0) x=0; +// if (y<0) y=0; - if (x != 0 || y != 0) { + if (w && h) { + gtk_window_resize ((GtkWindow *) dlg, w, h); + } + if (x >= 0 && y >= 0 && (x < (gdk_screen_width()-MIN_ONSCREEN_DISTANCE)) && (y < (gdk_screen_height()-MIN_ONSCREEN_DISTANCE))) { gtk_window_move ((GtkWindow *) dlg, x, y); } else { gtk_window_set_position(GTK_WINDOW(dlg), GTK_WIN_POS_CENTER); } - if (w && h) { - gtk_window_resize ((GtkWindow *) dlg, w, h); - } sp_transientize (dlg); wd.win = dlg; diff --git a/src/dialogs/find.cpp b/src/dialogs/find.cpp index f3efeed81..257abb138 100644 --- a/src/dialogs/find.cpp +++ b/src/dialogs/find.cpp @@ -66,6 +66,8 @@ sp_find_dialog(){ #include "../sp-offset.h" #include +#define MIN_ONSCREEN_DISTANCE 50 + using NR::X; using NR::Y; @@ -645,24 +647,24 @@ sp_find_dialog_old (void) dlg = sp_window_new (title, TRUE); if (x == -1000 || y == -1000) { - x = prefs_get_int_attribute (prefs_path, "x", 0); - y = prefs_get_int_attribute (prefs_path, "y", 0); + x = prefs_get_int_attribute (prefs_path, "x", -1000); + y = prefs_get_int_attribute (prefs_path, "y", -1000); } if (w ==0 || h == 0) { w = prefs_get_int_attribute (prefs_path, "w", 0); h = prefs_get_int_attribute (prefs_path, "h", 0); } - if (x<0) x=0; - if (y<0) y=0; +// if (x<0) x=0; +// if (y<0) y=0; - if (x != 0 || y != 0) { + if (w && h) + gtk_window_resize ((GtkWindow *) dlg, w, h); + if (x >= 0 && y >= 0 && (x < (gdk_screen_width()-MIN_ONSCREEN_DISTANCE)) && (y < (gdk_screen_height()-MIN_ONSCREEN_DISTANCE))) { gtk_window_move ((GtkWindow *) dlg, x, y); } else { gtk_window_set_position(GTK_WINDOW(dlg), GTK_WIN_POS_CENTER); } - if (w && h) - gtk_window_resize ((GtkWindow *) dlg, w, h); sp_transientize (dlg); wd.win = dlg; diff --git a/src/dialogs/input.cpp b/src/dialogs/input.cpp index eac3a0c5a..8d6ff399d 100644 --- a/src/dialogs/input.cpp +++ b/src/dialogs/input.cpp @@ -5,8 +5,9 @@ * * Authors: * Nicklas Lindgren + * Johan Engelen * - * Copyright (C) 2005 Authors + * Copyright (C) 2005-2006 Authors * * Released under GNU GPL, read the file 'COPYING' for more information */ @@ -27,6 +28,7 @@ #include "dialog-events.h" #include "../prefs-utils.h" +#define MIN_ONSCREEN_DISTANCE 50 static GtkWidget *dlg = NULL; static win_data wd; @@ -221,8 +223,8 @@ sp_input_dialog (void) dlg = gtk_input_dialog_new(); if (x == -1000 || y == -1000) { - x = prefs_get_int_attribute (prefs_path, "x", 0); - y = prefs_get_int_attribute (prefs_path, "y", 0); + x = prefs_get_int_attribute (prefs_path, "x", -1000); + y = prefs_get_int_attribute (prefs_path, "y", -1000); } if (w ==0 || h == 0) { @@ -230,18 +232,18 @@ sp_input_dialog (void) h = prefs_get_int_attribute (prefs_path, "h", 0); } - if (x<0) x=0; - if (y<0) y=0; +// if (x<0) x=0; +// if (y<0) y=0; - if (x != 0 || y != 0) { + if (w && h) { + gtk_window_resize ((GtkWindow *) dlg, w, h); + } + if (x >= 0 && y >= 0 && (x < (gdk_screen_width()-MIN_ONSCREEN_DISTANCE)) && (y < (gdk_screen_height()-MIN_ONSCREEN_DISTANCE))) { gtk_window_move ((GtkWindow *) dlg, x, y); } else { gtk_window_set_position(GTK_WINDOW(dlg), GTK_WIN_POS_CENTER); } - if (w && h) { - gtk_window_resize ((GtkWindow *) dlg, w, h); - } sp_transientize (dlg); wd.win = dlg; diff --git a/src/dialogs/item-properties.cpp b/src/dialogs/item-properties.cpp index 3bb7f7d84..db4eb34fc 100644 --- a/src/dialogs/item-properties.cpp +++ b/src/dialogs/item-properties.cpp @@ -6,8 +6,9 @@ * Authors: * Lauris Kaplinski * bulia byak + * Johan Engelen * - * Copyright (C) 1999-2005 Authors + * Copyright (C) 1999-2006 Authors * Copyright (C) 2001 Ximian, Inc. * * Released under GNU GPL, read the file 'COPYING' for more information @@ -41,6 +42,7 @@ #include "dialog-events.h" #include "../prefs-utils.h" +#define MIN_ONSCREEN_DISTANCE 50 static GtkWidget *dlg = NULL; static win_data wd; @@ -452,8 +454,8 @@ sp_item_dialog (void) dlg = sp_window_new (title, TRUE); if (x == -1000 || y == -1000) { - x = prefs_get_int_attribute (prefs_path, "x", 0); - y = prefs_get_int_attribute (prefs_path, "y", 0); + x = prefs_get_int_attribute (prefs_path, "x", -1000); + y = prefs_get_int_attribute (prefs_path, "y", -1000); } if (w ==0 || h == 0) { @@ -461,18 +463,18 @@ sp_item_dialog (void) h = prefs_get_int_attribute (prefs_path, "h", 0); } - if (x<0) x=0; - if (y<0) y=0; +// if (x<0) x=0; +// if (y<0) y=0; - if (x != 0 || y != 0) { + if (w && h) { + gtk_window_resize ((GtkWindow *) dlg, w, h); + } + if (x >= 0 && y >= 0 && (x < (gdk_screen_width()-MIN_ONSCREEN_DISTANCE)) && (y < (gdk_screen_height()-MIN_ONSCREEN_DISTANCE))) { gtk_window_move ((GtkWindow *) dlg, x, y); } else { gtk_window_set_position(GTK_WINDOW(dlg), GTK_WIN_POS_CENTER); } - if (w && h) { - gtk_window_resize ((GtkWindow *) dlg, w, h); - } sp_transientize (dlg); wd.win = dlg; diff --git a/src/dialogs/object-properties.cpp b/src/dialogs/object-properties.cpp index 3cb670805..ce65edbeb 100644 --- a/src/dialogs/object-properties.cpp +++ b/src/dialogs/object-properties.cpp @@ -7,8 +7,9 @@ * Lauris Kaplinski * Frank Felfe * bulia byak + * Johan Engelen * - * Copyright (C) 1999-2005 authors + * Copyright (C) 1999-2006 authors * Copyright (C) 2001-2002 Ximian, Inc. * * Released under GNU GPL, read the file 'COPYING' for more information @@ -46,6 +47,8 @@ #include "xml/repr.h" #include "display/sp-canvas.h" +#define MIN_ONSCREEN_DISTANCE 50 + static GtkWidget *dlg = NULL; static win_data wd; @@ -122,22 +125,22 @@ sp_object_properties_dialog (void) dlg = sp_window_new (title, TRUE); if (x == -1000 || y == -1000) { - x = prefs_get_int_attribute (prefs_path, "x", 0); - y = prefs_get_int_attribute (prefs_path, "y", 0); + x = prefs_get_int_attribute (prefs_path, "x", -1000); + y = prefs_get_int_attribute (prefs_path, "y", -1000); } if (w ==0 || h == 0) { w = prefs_get_int_attribute (prefs_path, "w", 0); h = prefs_get_int_attribute (prefs_path, "h", 0); } - if (x<0) x=0; - if (y<0) y=0; +// if (x<0) x=0; +// if (y<0) y=0; - if (x != 0 || y != 0) + if (w && h) gtk_window_resize ((GtkWindow *) dlg, w, h); + if (x >= 0 && y >= 0 && (x < (gdk_screen_width()-MIN_ONSCREEN_DISTANCE)) && (y < (gdk_screen_height()-MIN_ONSCREEN_DISTANCE))) gtk_window_move ((GtkWindow *) dlg, x, y); else gtk_window_set_position(GTK_WINDOW(dlg), GTK_WIN_POS_CENTER); - if (w && h) gtk_window_resize ((GtkWindow *) dlg, w, h); sp_transientize (dlg); wd.win = dlg; wd.stop = 0; diff --git a/src/dialogs/text-edit.cpp b/src/dialogs/text-edit.cpp index 85237c7cb..a44860ee3 100644 --- a/src/dialogs/text-edit.cpp +++ b/src/dialogs/text-edit.cpp @@ -3,11 +3,12 @@ /** * \brief Text editing dialog * - * Author: + * Authors: * Lauris Kaplinski * bulia byak + * Johan Engelen * - * Copyright (C) 1999-2002 Lauris Kaplinski + * Copyright (C) 1999-2006 Authors * Copyright (C) 2000-2001 Ximian, Inc. * * Released under GNU GPL, read the file 'COPYING' for more information @@ -52,6 +53,7 @@ extern "C" { #include #define VB_MARGIN 4 +#define MIN_ONSCREEN_DISTANCE 50 static void sp_text_edit_dialog_selection_modified (Inkscape::Application *inkscape, Inkscape::Selection *sel, guint flags, GtkWidget *dlg); static void sp_text_edit_dialog_selection_changed (Inkscape::Application *inkscape, Inkscape::Selection *sel, GtkWidget *dlg); @@ -143,8 +145,8 @@ sp_text_edit_dialog (void) dlg = sp_window_new (title, TRUE); if (x == -1000 || y == -1000) { - x = prefs_get_int_attribute (prefs_path, "x", 0); - y = prefs_get_int_attribute (prefs_path, "y", 0); + x = prefs_get_int_attribute (prefs_path, "x", -1000); + y = prefs_get_int_attribute (prefs_path, "y", -1000); } if (w ==0 || h == 0) { @@ -152,17 +154,17 @@ sp_text_edit_dialog (void) h = prefs_get_int_attribute (prefs_path, "h", 0); } - if (x<0) x=0; - if (y<0) y=0; +// if (x<0) x=0; +// if (y<0) y=0; - if (x != 0 || y != 0) { + if (w && h) + gtk_window_resize ((GtkWindow *) dlg, w, h); + if (x >= 0 && y >= 0 && (x < (gdk_screen_width()-MIN_ONSCREEN_DISTANCE)) && (y < (gdk_screen_height()-MIN_ONSCREEN_DISTANCE))) { gtk_window_move ((GtkWindow *) dlg, x, y); } else { gtk_window_set_position(GTK_WINDOW(dlg), GTK_WIN_POS_CENTER); } - if (w && h) - gtk_window_resize ((GtkWindow *) dlg, w, h); sp_transientize (dlg); wd.win = dlg; diff --git a/src/dialogs/xml-tree.cpp b/src/dialogs/xml-tree.cpp index b84381989..3402e72b5 100644 --- a/src/dialogs/xml-tree.cpp +++ b/src/dialogs/xml-tree.cpp @@ -7,8 +7,9 @@ * Lauris Kaplinski * MenTaLguY * bulia byak + * Johan Engelen * - * Copyright (C) 1999-2005 Authors + * Copyright (C) 1999-2006 Authors * Copyright (C) 2004 David Turner * * Released under GNU GPL, read the file 'COPYING' for more information @@ -63,6 +64,8 @@ #include "message-stack.h" #include "message-context.h" +#define MIN_ONSCREEN_DISTANCE 50 + struct EditableDest { GtkEditable *editable; gchar *text; @@ -210,26 +213,26 @@ void sp_xml_tree_dialog() dlg = sp_window_new("", TRUE); if (x == -1000 || y == -1000) { - x = prefs_get_int_attribute(prefs_path, "x", 0); - y = prefs_get_int_attribute(prefs_path, "y", 0); + x = prefs_get_int_attribute(prefs_path, "x", -1000); + y = prefs_get_int_attribute(prefs_path, "y", -1000); } if (w ==0 || h == 0) { w = prefs_get_int_attribute(prefs_path, "w", 0); h = prefs_get_int_attribute(prefs_path, "h", 0); } - if (x<0) x=0; - if (y<0) y=0; +// if (x<0) x=0; +// if (y<0) y=0; - if (x != 0 || y != 0) { + if (w && h) { + gtk_window_resize((GtkWindow *) dlg, w, h); + } + if (x >= 0 && y >= 0 && (x < (gdk_screen_width()-MIN_ONSCREEN_DISTANCE)) && (y < (gdk_screen_height()-MIN_ONSCREEN_DISTANCE))) { gtk_window_move((GtkWindow *) dlg, x, y); } else { gtk_window_set_position(GTK_WINDOW(dlg), GTK_WIN_POS_CENTER); } - if (w && h) { - gtk_window_resize((GtkWindow *) dlg, w, h); - } sp_transientize(dlg); wd.win = dlg; wd.stop = 0; -- 2.30.2