# HG changeset patch # User gqview # Date 1109878368 0 # Node ID 3263965d5f9ef5c37c4a6b6cd47ae12be4baa8b2 # Parent 25335c62cd9b6b5a1795e3486a9c114a8a642a80 ##### 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 -r 25335c62cd9b -r 3263965d5f9e ChangeLog --- a/ChangeLog Thu Mar 03 06:32:53 2005 +0000 +++ b/ChangeLog Thu Mar 03 19:32:48 2005 +0000 @@ -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 -r 25335c62cd9b -r 3263965d5f9e TODO --- a/TODO Thu Mar 03 06:32:53 2005 +0000 +++ b/TODO Thu Mar 03 19:32:48 2005 +0000 @@ -6,7 +6,7 @@ > 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 @@ > 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 -r 25335c62cd9b -r 3263965d5f9e src/filelist.c --- a/src/filelist.c Thu Mar 03 06:32:53 2005 +0000 +++ b/src/filelist.c Thu Mar 03 19:32:48 2005 +0000 @@ -514,16 +514,16 @@ } 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 -r 25335c62cd9b -r 3263965d5f9e src/info.c --- a/src/info.c Thu Mar 03 06:32:53 2005 +0000 +++ b/src/info.c Thu Mar 03 19:32:48 2005 +0000 @@ -232,7 +232,7 @@ 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 -r 25335c62cd9b -r 3263965d5f9e src/pan-view.c --- a/src/pan-view.c Thu Mar 03 06:32:53 2005 +0000 +++ b/src/pan-view.c Thu Mar 03 19:32:48 2005 +0000 @@ -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 @@ return TRUE; } -void pan_window_new(const gchar *path) +static void pan_window_new_real(const gchar *path) { PanWindow *pw; GtkWidget *vbox; @@ -3879,13 +3883,92 @@ /* *----------------------------------------------------------------------------- + * 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 @@ /* *----------------------------------------------------------------------------- - * image drag and drop routines + * drag and drop *----------------------------------------------------------------------------- */ diff -r 25335c62cd9b -r 3263965d5f9e src/preferences.c --- a/src/preferences.c Thu Mar 03 06:32:53 2005 +0000 +++ b/src/preferences.c Thu Mar 03 19:32:48 2005 +0000 @@ -908,7 +908,7 @@ 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 -r 25335c62cd9b -r 3263965d5f9e src/ui_utildlg.c --- a/src/ui_utildlg.c Thu Mar 03 06:32:53 2005 +0000 +++ b/src/ui_utildlg.c Thu Mar 03 19:32:48 2005 +0000 @@ -197,6 +197,7 @@ { 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 -r 25335c62cd9b -r 3263965d5f9e src/utilops.c --- a/src/utilops.c Thu Mar 03 06:32:53 2005 +0000 +++ b/src/utilops.c Thu Mar 03 19:32:48 2005 +0000 @@ -1804,7 +1804,7 @@ 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);