From: John Ellis Date: Thu, 3 Mar 2005 19:32:48 +0000 (+0000) Subject: ##### Note: GQview CVS on sourceforge is not always up to date, please use ##### X-Git-Tag: v1.0.0~1788 X-Git-Url: http://geeqie.org/cgi-bin/gitweb.cgi?p=geeqie.git;a=commitdiff_plain;h=5af90b408c50f8381b619ab1359ea92e1d6e3610 ##### Note: GQview CVS on sourceforge is not always up to date, please use ##### ##### an offical release when making enhancements and translation updates. ##### Thu Mar 3 14:24:58 2005 John Ellis * filelist.c, info.c, preferences.c, utilops.c: Use doubles instead of floats whenever possible. * ui_utildlg.c (generic_dialog_add_message): Enable line wrap for message body so specifying newlines is no longer needed. * pan-view.c: Display info dialog when thumbnail caching settings are not optimal. --- diff --git a/ChangeLog b/ChangeLog index 3e12c69d..bb7ebcfb 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,12 @@ +Thu Mar 3 14:24:58 2005 John Ellis + + * filelist.c, info.c, preferences.c, utilops.c: Use doubles instead of + floats whenever possible. + * ui_utildlg.c (generic_dialog_add_message): Enable line wrap for + message body so specifying newlines is no longer needed. + * pan-view.c: Display info dialog when thumbnail caching settings are + not optimal. + Thu Mar 3 01:16:23 2005 John Ellis * pan-view.c: Add 'dots' image size option, fix up border size at edge diff --git a/TODO b/TODO index dbb50905..8431af70 100644 --- a/TODO +++ b/TODO @@ -6,7 +6,7 @@ Major: > work on pan view: > Pick a better keyboard shortcut than Control + J :) - > Add warning dialog that it will be slow if the standard thumbnail cache is not enabled. + d> Add warning dialog that it will be slow if the standard thumbnail cache is not enabled. > Fix occasional redraw bugs when zoomed out. > Fix occasional odd requests for non-visible tiles when zoomed out (related to above?). > Fix slowness in image.c with huge grid size by changing use of pre-allocated tile array @@ -34,7 +34,7 @@ Major: > the info dialog is not set as a transient of the calling window, this causes it to be behind a full screen window when 'stay above other windows' is enabled. - > use doubles instead of floats wherever possible +d> use doubles instead of floats wherever possible ------------- diff --git a/src/filelist.c b/src/filelist.c index e04322ea..88c01149 100644 --- a/src/filelist.c +++ b/src/filelist.c @@ -514,16 +514,16 @@ gchar *text_from_size_abrev(gint64 size) } if (size < (gint64)1048576) { - return g_strdup_printf(_("%.1f K"), (gfloat)size / 1024.0); + return g_strdup_printf(_("%.1f K"), (double)size / 1024.0); } if (size < (gint64)1073741824) { - return g_strdup_printf(_("%.1f MB"), (gfloat)size / 1048576.0); + return g_strdup_printf(_("%.1f MB"), (double)size / 1048576.0); } - /* to avoid overflowing the float, do division in two steps */ - size /= 1048576.0; - return g_strdup_printf(_("%.1f GB"), (gfloat)size / 1024.0); + /* to avoid overflowing the double, do division in two steps */ + size /= 1048576; + return g_strdup_printf(_("%.1f GB"), (double)size / 1024.0); } /* note: returned string is valid until next call to text_from_time() */ diff --git a/src/info.c b/src/info.c index d5bab4bf..d01ef890 100644 --- a/src/info.c +++ b/src/info.c @@ -232,7 +232,7 @@ static void info_tab_general_image(InfoData *id, gpointer data) if (!tab->compression_done && mem_size > 0) { - buf = g_strdup_printf("%.1f%%", (float)tab->byte_size / mem_size * 100.0); + buf = g_strdup_printf("%.1f%%", (double)tab->byte_size / mem_size * 100.0); gtk_label_set_text(GTK_LABEL(tab->label_compression), buf); g_free(buf); diff --git a/src/pan-view.c b/src/pan-view.c index df036006..9d3b9ce4 100644 --- a/src/pan-view.c +++ b/src/pan-view.c @@ -94,6 +94,10 @@ #define ZOOM_LABEL_WIDTH 64 +#define PAN_PREF_GROUP "pan_view_options" +#define PAN_PREF_HIDE_WARNING "hide_performance_warning" + + typedef enum { LAYOUT_TIMELINE = 0, LAYOUT_FOLDERS_LINEAR, @@ -3679,7 +3683,7 @@ static gint pan_window_delete_cb(GtkWidget *w, GdkEventAny *event, gpointer data return TRUE; } -void pan_window_new(const gchar *path) +static void pan_window_new_real(const gchar *path) { PanWindow *pw; GtkWidget *vbox; @@ -3877,15 +3881,94 @@ void pan_window_new(const gchar *path) pan_window_list = g_list_append(pan_window_list, pw); } +/* + *----------------------------------------------------------------------------- + * peformance warnings + *----------------------------------------------------------------------------- + */ + +static void pan_warning_ok_cb(GenericDialog *gd, gpointer data) +{ + gchar *path = data; + + generic_dialog_close(gd); + + pan_window_new_real(path); + g_free(path); +} + +static void pan_warning_hide_cb(GtkWidget *button, gpointer data) +{ + gint hide_dlg; + + hide_dlg = gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(button)); + pref_list_int_set(PAN_PREF_GROUP, PAN_PREF_HIDE_WARNING, hide_dlg); +} + +static gint pan_warning(const gchar *path) +{ + GenericDialog *gd; + GtkWidget *box; + GtkWidget *group; + GtkWidget *button; + GtkWidget *ct_button; + gint hide_dlg; + + if (enable_thumb_caching && + thumbnail_spec_standard) return FALSE; + + if (!pref_list_int_get(PAN_PREF_GROUP, PAN_PREF_HIDE_WARNING, &hide_dlg)) hide_dlg = FALSE; + if (hide_dlg) return FALSE; + + gd = generic_dialog_new(_("Pan View Performance"), "GQview", "pan_view_warning", NULL, FALSE, + NULL, NULL); + gd->data = g_strdup(path); + generic_dialog_add_button(gd, GTK_STOCK_OK, NULL, + pan_warning_ok_cb, TRUE); + + box = generic_dialog_add_message(gd, GTK_STOCK_DIALOG_INFO, + _("Pan view performance may be poor."), + _("To improve performance of thumbnails in the pan view the" + " following options can be enabled. Note that both options" + " must be enabled to notice a change in performance.")); + + group = pref_box_new(box, FALSE, GTK_ORIENTATION_HORIZONTAL, 0); + pref_spacer(group, PREF_PAD_INDENT); + group = pref_box_new(group, TRUE, GTK_ORIENTATION_VERTICAL, PREF_PAD_GAP); + + ct_button = pref_checkbox_new_int(group, _("Cache thumbnails"), + enable_thumb_caching, &enable_thumb_caching); + button = pref_checkbox_new_int(group, _("Use shared thumbnail cache"), + thumbnail_spec_standard, &thumbnail_spec_standard); + pref_checkbox_link_sensitivity(ct_button, button); + + pref_line(box, 0); + + pref_checkbox_new(box, _("Do not show this dialog again"), hide_dlg, + G_CALLBACK(pan_warning_hide_cb), NULL); + + gtk_widget_show(gd->dialog); + + return TRUE; +} + + /* *----------------------------------------------------------------------------- * public *----------------------------------------------------------------------------- */ +void pan_window_new(const gchar *path) +{ + if (pan_warning(path)) return; + + pan_window_new_real(path); +} + /* *----------------------------------------------------------------------------- - * view window menu routines and callbacks + * menus *----------------------------------------------------------------------------- */ @@ -4056,7 +4139,7 @@ static GtkWidget *pan_popup_menu(PanWindow *pw) /* *----------------------------------------------------------------------------- - * image drag and drop routines + * drag and drop *----------------------------------------------------------------------------- */ diff --git a/src/preferences.c b/src/preferences.c index 8a78eb71..105bf96a 100644 --- a/src/preferences.c +++ b/src/preferences.c @@ -908,7 +908,7 @@ static void config_window_create(void) zoom_increment_c = zoom_increment; spin = pref_spin_new(group, _("Zoom increment:"), NULL, - 0.1, 4.0, 1.0, 1, (float)zoom_increment / 10.0, + 0.1, 4.0, 1.0, 1, (double)zoom_increment / 10.0, G_CALLBACK(zoom_increment_cb), NULL); gtk_spin_button_set_update_policy(GTK_SPIN_BUTTON(spin), GTK_UPDATE_ALWAYS); diff --git a/src/ui_utildlg.c b/src/ui_utildlg.c index 4b2a00c8..0c632180 100644 --- a/src/ui_utildlg.c +++ b/src/ui_utildlg.c @@ -197,6 +197,7 @@ GtkWidget *generic_dialog_add_message(GenericDialog *gd, const gchar *icon_stock { label = pref_label_new(vbox, text); gtk_misc_set_alignment(GTK_MISC(label), 0.0, 0.5); + gtk_label_set_line_wrap(GTK_LABEL(label), TRUE); } return vbox; diff --git a/src/utilops.c b/src/utilops.c index 99f04f58..5bc4ae23 100644 --- a/src/utilops.c +++ b/src/utilops.c @@ -1804,7 +1804,7 @@ static void file_util_rename_multiple_auto(RenameDataMult *rd) gchar *buf; n--; - gtk_spin_button_set_value(GTK_SPIN_BUTTON(rd->auto_spin_start), (float)n); + gtk_spin_button_set_value(GTK_SPIN_BUTTON(rd->auto_spin_start), (gdouble)n); buf = g_strdup_printf(_("Failed to rename\n%s\nThe number was %d."), filename_from_path(rd->fd->source_path), n); file_util_warning_dialog(_("Auto rename"), buf, GTK_STOCK_DIALOG_ERROR, NULL);