app/gdisplay.c app/gdisplay.h app/gimprc.h app/gimprc.c app/nav_window.c

Sat Sep  4 23:21:10 BST 1999 Andy Thomas <alt@gimp.org>

	* app/gdisplay.c
	* app/gdisplay.h
	* app/gimprc.h
	* app/gimprc.c
	* app/nav_window.c
	* app/nav_window.h
	* app/preferences_dialog.c

	The nav preview size can now be configured. The size applies
	to both the "popup" and dialog window.
This commit is contained in:
BST 1999 Andy Thomas 1999-09-04 22:27:20 +00:00 committed by Andy Thomas
parent 6f3d37b52d
commit 56f506a780
16 changed files with 377 additions and 136 deletions

View File

@ -1,3 +1,16 @@
Sat Sep 4 23:21:10 BST 1999 Andy Thomas <alt@gimp.org>
* app/gdisplay.c
* app/gdisplay.h
* app/gimprc.h
* app/gimprc.c
* app/nav_window.c
* app/nav_window.h
* app/preferences_dialog.c
The nav preview size can now be configured. The size applies
to both the "popup" and dialog window.
Sat Sep 4 20:45:02 CEST 1999 Olof S Kylander <olof@frozenriver.com>
-Fix of cut&paste error in pp/paint_core.c

View File

@ -2025,6 +2025,26 @@ gdisplays_expose_full ()
}
}
void
gdisplays_nav_preview_resized ()
{
GDisplay *gdisp;
GSList *list = display_list;
/* traverse the linked list of displays, handling each one */
while (list)
{
gdisp = (GDisplay *) list->data;
if(gdisp->window_nav_dialog)
nav_window_preview_resized(gdisp->window_nav_dialog);
if(gdisp->nav_popup)
nav_window_popup_preview_resized(&gdisp->nav_popup);
list = g_slist_next (list);
}
}
void
gdisplays_selection_visibility (GimpImage* gimage,

View File

@ -213,6 +213,7 @@ void gdisplays_delete (void);
void gdisplays_flush (void);
void gdisplays_flush_now (void);
void gdisplay_flush_displays_only (GDisplay *gdisp); /* no rerender! */
void gdisplays_nav_preview_resized (void);

View File

@ -21,6 +21,7 @@
#include "colormaps.h"
#include "context_manager.h"
#include "gdisplay_ops.h"
#include "gdisplay.h"
#include "gimprc.h"
#include "image_render.h"
#include "interface.h"
@ -43,6 +44,7 @@ static void file_prefs_cancel_callback (GtkWidget *, GtkWidget *);
static void file_prefs_toggle_callback (GtkWidget *, gpointer);
static void file_prefs_preview_size_callback (GtkWidget *, gpointer);
static void file_prefs_nav_preview_size_callback (GtkWidget *, gpointer);
static void file_prefs_mem_size_callback (GtkWidget *, gpointer);
static void file_prefs_mem_size_unit_callback (GtkWidget *, gpointer);
static void file_prefs_int_adjustment_callback (GtkAdjustment *, gpointer);
@ -64,6 +66,7 @@ static int old_marching_speed;
static int old_allow_resize_windows;
static int old_auto_save;
static int old_preview_size;
static int old_nav_preview_size;
static int old_no_cursor_updating;
static int old_show_tool_tips;
static int old_show_rulers;
@ -404,6 +407,8 @@ file_prefs_save_callback (GtkWidget *widget,
update = g_list_append (update, "default-image-type");
if (preview_size != old_preview_size)
update = g_list_append (update, "preview-size");
if (nav_preview_size != old_nav_preview_size)
update = g_list_append (update, "nav-preview-size");
if (perfectmouse != old_perfectmouse)
update = g_list_append (update, "perfect-mouse");
if (transparency_type != old_transparency_type)
@ -592,6 +597,12 @@ file_prefs_cancel_callback (GtkWidget *widget,
layer_select_update_preview_size ();
}
if (nav_preview_size != old_nav_preview_size)
{
nav_preview_size = old_nav_preview_size;
gdisplays_nav_preview_resized();
}
if ((transparency_type != old_transparency_type) ||
(transparency_size != old_transparency_size))
{
@ -701,6 +712,14 @@ file_prefs_preview_size_callback (GtkWidget *widget,
layer_select_update_preview_size ();
}
static void
file_prefs_nav_preview_size_callback (GtkWidget *widget,
gpointer data)
{
nav_preview_size = (gint)data;
gdisplays_nav_preview_resized();
}
static void
file_prefs_mem_size_callback (GtkWidget *widget,
gpointer data)
@ -1433,6 +1452,7 @@ file_pref_cmd_callback (GtkWidget *widget,
old_allow_resize_windows = allow_resize_windows;
old_auto_save = auto_save;
old_preview_size = preview_size;
old_nav_preview_size = nav_preview_size;
old_no_cursor_updating = no_cursor_updating;
old_show_tool_tips = show_tool_tips;
old_show_rulers = show_rulers;
@ -1751,7 +1771,7 @@ file_pref_cmd_callback (GtkWidget *widget,
gtk_container_add (GTK_CONTAINER (frame), hbox);
gtk_widget_show (hbox);
table = gtk_table_new (3, 2, FALSE);
table = gtk_table_new (4, 2, FALSE);
gtk_container_set_border_width (GTK_CONTAINER (table), 2);
gtk_table_set_row_spacings (GTK_TABLE (table), 2);
gtk_table_set_col_spacings (GTK_TABLE (table), 4);
@ -1782,13 +1802,23 @@ file_pref_cmd_callback (GtkWidget *widget,
gimp_table_attach_aligned (GTK_TABLE (table), 0,
_("Preview Size:"), 1.0, 0.5, optionmenu, TRUE);
optionmenu =
gimp_option_menu_new (file_prefs_nav_preview_size_callback,
(gpointer) nav_preview_size,
_("Small"), (gpointer) 48, (gpointer) 48,
_("Medium"), (gpointer) 80, (gpointer) 80,
_("Large"), (gpointer) 112, (gpointer) 112,
NULL);
gimp_table_attach_aligned (GTK_TABLE (table), 1,
_("Nav Preview Size:"), 1.0, 0.5, optionmenu, TRUE);
spinbutton =
gimp_spin_button_new (&adjustment,
levels_of_undo, 0.0, 255.0, 1.0, 5.0, 0.0, 1.0, 0.0);
gtk_signal_connect (GTK_OBJECT (adjustment), "value_changed",
(GtkSignalFunc) file_prefs_int_adjustment_callback,
&levels_of_undo);
gimp_table_attach_aligned (GTK_TABLE (table), 1,
gimp_table_attach_aligned (GTK_TABLE (table), 2,
_("Levels of Undo:"), 1.0, 0.5, spinbutton, TRUE);
spinbutton =
@ -1797,7 +1827,7 @@ file_pref_cmd_callback (GtkWidget *widget,
gtk_signal_connect (GTK_OBJECT (adjustment), "value_changed",
(GtkSignalFunc) file_prefs_int_adjustment_callback,
&edit_last_opened_size);
gimp_table_attach_aligned (GTK_TABLE (table), 2,
gimp_table_attach_aligned (GTK_TABLE (table), 3,
_("Recent Documents List Size:"), 1.0, 0.5,
spinbutton, TRUE);

View File

@ -2025,6 +2025,26 @@ gdisplays_expose_full ()
}
}
void
gdisplays_nav_preview_resized ()
{
GDisplay *gdisp;
GSList *list = display_list;
/* traverse the linked list of displays, handling each one */
while (list)
{
gdisp = (GDisplay *) list->data;
if(gdisp->window_nav_dialog)
nav_window_preview_resized(gdisp->window_nav_dialog);
if(gdisp->nav_popup)
nav_window_popup_preview_resized(&gdisp->nav_popup);
list = g_slist_next (list);
}
}
void
gdisplays_selection_visibility (GimpImage* gimage,

View File

@ -213,6 +213,7 @@ void gdisplays_delete (void);
void gdisplays_flush (void);
void gdisplays_flush_now (void);
void gdisplay_flush_displays_only (GDisplay *gdisp); /* no rerender! */
void gdisplays_nav_preview_resized (void);

View File

@ -26,6 +26,7 @@
#include "info_dialog.h"
#include "info_window.h"
#include "gdisplay.h"
#include "gimprc.h"
#include "gximage.h"
#include "interface.h"
#include "scroll.h"
@ -46,15 +47,9 @@
GDK_KEY_RELEASE_MASK
/* Navigation preview sizes */
#if 0
#define NAV_PREVIEW_WIDTH 48
#define NAV_PREVIEW_HEIGHT 48
#define BORDER_PEN_WIDTH 2
#else
#define NAV_PREVIEW_WIDTH 112
#define NAV_PREVIEW_HEIGHT 112
#define BORDER_PEN_WIDTH 3
#endif /* 0 */
#define MAX_SCALE_BUF 20
@ -110,14 +105,6 @@ nav_window_expose_events (GtkWidget *,
GdkEvent *,
gpointer *);
#if 0
static gint
nav_window_preview_resized (GtkWidget *,
GtkAllocation *,
gpointer *);
#endif /* 0 */
static void
nav_window_update_preview (NavWinData *);
@ -424,7 +411,7 @@ nav_window_update_preview(NavWinData *iwd)
gint xoff = 0;
gint yoff = 0;
gimp_add_busy_cursors();
gimp_add_busy_cursors();
gdisp = (GDisplay *) iwd->gdisp_ptr;
@ -728,18 +715,8 @@ nav_window_preview_events (GtkWidget *widget,
iwd->motion_offsety = ty - iwd->dispy;
}
#if 0
/* Now grab the square */
iwd->sq_grabbed = TRUE;
gtk_grab_add(widget);
gdk_pointer_grab (widget->window, TRUE,
GDK_BUTTON_RELEASE_MASK |
GDK_POINTER_MOTION_HINT_MASK |
GDK_BUTTON_MOTION_MASK,
widget->window, NULL, 0);
#else
nav_window_grab_pointer(iwd,widget);
#endif /* 0 */
break;
default:
break;
@ -1135,8 +1112,10 @@ create_dummy_iwd(void *gdisp_ptr,NavWinType ptype)
iwd->sq_grabbed = FALSE;
iwd->ratio = 1.0;
iwd->block_window_marker = FALSE;
iwd->nav_preview_width = NAV_PREVIEW_WIDTH;
iwd->nav_preview_height = NAV_PREVIEW_HEIGHT;
iwd->nav_preview_width =
(nav_preview_size < 0 || nav_preview_size > 256)?NAV_PREVIEW_WIDTH:nav_preview_size;
iwd->nav_preview_height =
(nav_preview_size < 0 || nav_preview_size > 256)?NAV_PREVIEW_HEIGHT:nav_preview_size;
iwd->block_adj_sig = FALSE;
return(iwd);
@ -1166,8 +1145,6 @@ nav_window_create (void *gdisp_ptr)
(GtkSignalFunc) nav_window_destroy_callback,
info_win);
g_free (title_buf);
/* gtk_window_set_policy (GTK_WINDOW (info_win->shell), */
/* FALSE,FALSE,FALSE); */
iwd = create_dummy_iwd(gdisp_ptr,NAV_WINDOW);
info_win->user_data = iwd;
@ -1175,8 +1152,6 @@ nav_window_create (void *gdisp_ptr)
/* Add preview */
container = info_window_image_preview_new(info_win);
/* gtk_container_set_focus_child(GTK_CONTAINER(container),iwd->preview); */
gtk_window_set_focus(GTK_WINDOW (info_win->shell),iwd->preview);
gtk_table_attach_defaults (GTK_TABLE (info_win->info_table), container,
0, 2, 0, 1);
/* Create the action area */
@ -1219,16 +1194,6 @@ nav_window_update_window_marker(InfoDialog *info_win)
/* Update to new size */
nav_window_disp_area(iwd,iwd->gdisp_ptr);
#if 0
/* do the same for the popup widget..*/
if(((GDisplay *)iwd->gdisp_ptr)->nav_popup)
{
NavWinData *iwp; /* dummy shorter version for the popups */
iwp = (NavWinData *)gtk_object_get_data(GTK_OBJECT(((GDisplay *)iwd->gdisp_ptr)->nav_popup),"navpop_prt");
nav_window_disp_area(iwp,iwp->gdisp_ptr);
}
#endif /* 0 */
/* and redraw */
nav_window_draw_sqr(iwd,
FALSE,
@ -1354,3 +1319,42 @@ nav_popup_free(GtkWidget *nav_popup)
{
gtk_widget_destroy(nav_popup);
}
void
nav_window_preview_resized(InfoDialog *idialog)
{
NavWinData *iwd;
if (!idialog)
return;
iwd = (NavWinData *)idialog->user_data;
/* force regeneration of the widgets */
/* bit of a fiddle... could cause if the image really is 1x1
* but the preview would not really matter in that case.
*/
iwd->imagewidth = 1;
iwd->imageheight = 1;
iwd->nav_preview_width =
(nav_preview_size < 0 || nav_preview_size > 256)?NAV_PREVIEW_WIDTH:nav_preview_size;
iwd->nav_preview_height =
(nav_preview_size < 0 || nav_preview_size > 256)?NAV_PREVIEW_HEIGHT:nav_preview_size;
nav_window_update_window_marker(idialog);
}
void
nav_window_popup_preview_resized (GtkWidget **widget)
{
NavWinData *iwp; /* dummy shorter version for the popups */
iwp = (NavWinData *)gtk_object_get_data(GTK_OBJECT(*widget),"navpop_prt");
g_free(iwp);
gtk_widget_destroy(*widget);
*widget = NULL;
}

View File

@ -26,6 +26,7 @@
#include "info_dialog.h"
#include "info_window.h"
#include "gdisplay.h"
#include "gimprc.h"
#include "gximage.h"
#include "interface.h"
#include "scroll.h"
@ -46,15 +47,9 @@
GDK_KEY_RELEASE_MASK
/* Navigation preview sizes */
#if 0
#define NAV_PREVIEW_WIDTH 48
#define NAV_PREVIEW_HEIGHT 48
#define BORDER_PEN_WIDTH 2
#else
#define NAV_PREVIEW_WIDTH 112
#define NAV_PREVIEW_HEIGHT 112
#define BORDER_PEN_WIDTH 3
#endif /* 0 */
#define MAX_SCALE_BUF 20
@ -110,14 +105,6 @@ nav_window_expose_events (GtkWidget *,
GdkEvent *,
gpointer *);
#if 0
static gint
nav_window_preview_resized (GtkWidget *,
GtkAllocation *,
gpointer *);
#endif /* 0 */
static void
nav_window_update_preview (NavWinData *);
@ -424,7 +411,7 @@ nav_window_update_preview(NavWinData *iwd)
gint xoff = 0;
gint yoff = 0;
gimp_add_busy_cursors();
gimp_add_busy_cursors();
gdisp = (GDisplay *) iwd->gdisp_ptr;
@ -728,18 +715,8 @@ nav_window_preview_events (GtkWidget *widget,
iwd->motion_offsety = ty - iwd->dispy;
}
#if 0
/* Now grab the square */
iwd->sq_grabbed = TRUE;
gtk_grab_add(widget);
gdk_pointer_grab (widget->window, TRUE,
GDK_BUTTON_RELEASE_MASK |
GDK_POINTER_MOTION_HINT_MASK |
GDK_BUTTON_MOTION_MASK,
widget->window, NULL, 0);
#else
nav_window_grab_pointer(iwd,widget);
#endif /* 0 */
break;
default:
break;
@ -1135,8 +1112,10 @@ create_dummy_iwd(void *gdisp_ptr,NavWinType ptype)
iwd->sq_grabbed = FALSE;
iwd->ratio = 1.0;
iwd->block_window_marker = FALSE;
iwd->nav_preview_width = NAV_PREVIEW_WIDTH;
iwd->nav_preview_height = NAV_PREVIEW_HEIGHT;
iwd->nav_preview_width =
(nav_preview_size < 0 || nav_preview_size > 256)?NAV_PREVIEW_WIDTH:nav_preview_size;
iwd->nav_preview_height =
(nav_preview_size < 0 || nav_preview_size > 256)?NAV_PREVIEW_HEIGHT:nav_preview_size;
iwd->block_adj_sig = FALSE;
return(iwd);
@ -1166,8 +1145,6 @@ nav_window_create (void *gdisp_ptr)
(GtkSignalFunc) nav_window_destroy_callback,
info_win);
g_free (title_buf);
/* gtk_window_set_policy (GTK_WINDOW (info_win->shell), */
/* FALSE,FALSE,FALSE); */
iwd = create_dummy_iwd(gdisp_ptr,NAV_WINDOW);
info_win->user_data = iwd;
@ -1175,8 +1152,6 @@ nav_window_create (void *gdisp_ptr)
/* Add preview */
container = info_window_image_preview_new(info_win);
/* gtk_container_set_focus_child(GTK_CONTAINER(container),iwd->preview); */
gtk_window_set_focus(GTK_WINDOW (info_win->shell),iwd->preview);
gtk_table_attach_defaults (GTK_TABLE (info_win->info_table), container,
0, 2, 0, 1);
/* Create the action area */
@ -1219,16 +1194,6 @@ nav_window_update_window_marker(InfoDialog *info_win)
/* Update to new size */
nav_window_disp_area(iwd,iwd->gdisp_ptr);
#if 0
/* do the same for the popup widget..*/
if(((GDisplay *)iwd->gdisp_ptr)->nav_popup)
{
NavWinData *iwp; /* dummy shorter version for the popups */
iwp = (NavWinData *)gtk_object_get_data(GTK_OBJECT(((GDisplay *)iwd->gdisp_ptr)->nav_popup),"navpop_prt");
nav_window_disp_area(iwp,iwp->gdisp_ptr);
}
#endif /* 0 */
/* and redraw */
nav_window_draw_sqr(iwd,
FALSE,
@ -1354,3 +1319,42 @@ nav_popup_free(GtkWidget *nav_popup)
{
gtk_widget_destroy(nav_popup);
}
void
nav_window_preview_resized(InfoDialog *idialog)
{
NavWinData *iwd;
if (!idialog)
return;
iwd = (NavWinData *)idialog->user_data;
/* force regeneration of the widgets */
/* bit of a fiddle... could cause if the image really is 1x1
* but the preview would not really matter in that case.
*/
iwd->imagewidth = 1;
iwd->imageheight = 1;
iwd->nav_preview_width =
(nav_preview_size < 0 || nav_preview_size > 256)?NAV_PREVIEW_WIDTH:nav_preview_size;
iwd->nav_preview_height =
(nav_preview_size < 0 || nav_preview_size > 256)?NAV_PREVIEW_HEIGHT:nav_preview_size;
nav_window_update_window_marker(idialog);
}
void
nav_window_popup_preview_resized (GtkWidget **widget)
{
NavWinData *iwp; /* dummy shorter version for the popups */
iwp = (NavWinData *)gtk_object_get_data(GTK_OBJECT(*widget),"navpop_prt");
g_free(iwp);
gtk_widget_destroy(*widget);
*widget = NULL;
}

View File

@ -2025,6 +2025,26 @@ gdisplays_expose_full ()
}
}
void
gdisplays_nav_preview_resized ()
{
GDisplay *gdisp;
GSList *list = display_list;
/* traverse the linked list of displays, handling each one */
while (list)
{
gdisp = (GDisplay *) list->data;
if(gdisp->window_nav_dialog)
nav_window_preview_resized(gdisp->window_nav_dialog);
if(gdisp->nav_popup)
nav_window_popup_preview_resized(&gdisp->nav_popup);
list = g_slist_next (list);
}
}
void
gdisplays_selection_visibility (GimpImage* gimage,

View File

@ -213,6 +213,7 @@ void gdisplays_delete (void);
void gdisplays_flush (void);
void gdisplays_flush_now (void);
void gdisplay_flush_displays_only (GDisplay *gdisp); /* no rerender! */
void gdisplays_nav_preview_resized (void);

View File

@ -74,7 +74,8 @@ typedef enum {
TT_XDEVICE,
TT_XSESSIONINFO,
TT_XUNITINFO,
TT_XPARASITE
TT_XPARASITE,
TT_XNAVPREVSIZE
} TokenType;
typedef struct _ParseFunc ParseFunc;
@ -127,6 +128,7 @@ int stingy_memory_use = 0;
int allow_resize_windows = 0;
int no_cursor_updating = 0;
int preview_size = 64;
int nav_preview_size = 112;
int show_rulers = TRUE;
int show_statusbar = TRUE;
GUnit default_units = UNIT_INCH;
@ -173,6 +175,7 @@ static int parse_image_type (gpointer val1p, gpointer val2p);
static int parse_interpolation_type (gpointer val1p, gpointer val2p);
static int parse_color_cube (gpointer val1p, gpointer val2p);
static int parse_preview_size (gpointer val1p, gpointer val2p);
static int parse_nav_preview_size (gpointer val1p, gpointer val2p);
static int parse_units (gpointer val1p, gpointer val2p);
static int parse_plug_in (gpointer val1p, gpointer val2p);
static int parse_plug_in_def (gpointer val1p, gpointer val2p);
@ -201,6 +204,7 @@ static inline char* image_type_to_str (gpointer val1p, gpointer val2p);
static inline char* interpolation_type_to_str (gpointer val1p, gpointer val2p);
static inline char* color_cube_to_str (gpointer val1p, gpointer val2p);
static inline char* preview_size_to_str (gpointer val1p, gpointer val2p);
static inline char* nav_preview_size_to_str (gpointer val1p, gpointer val2p);
static inline char* units_to_str (gpointer val1p, gpointer val2p);
static char* transform_path (char *path, int destroy);
@ -257,6 +261,7 @@ static ParseFunc funcs[] =
{ "cursor-updating", TT_BOOLEAN, NULL, &no_cursor_updating },
{ "no-cursor-updating", TT_BOOLEAN, &no_cursor_updating, NULL },
{ "preview-size", TT_XPREVSIZE, NULL, NULL },
{ "nav-preview-size", TT_XNAVPREVSIZE, NULL, NULL },
{ "show-rulers", TT_BOOLEAN, &show_rulers, NULL },
{ "dont-show-rulers", TT_BOOLEAN, NULL, &show_rulers },
{ "show-statusbar", TT_BOOLEAN, &show_statusbar, NULL },
@ -779,6 +784,8 @@ parse_statement ()
return parse_color_cube (funcs[i].val1p, funcs[i].val2p);
case TT_XPREVSIZE:
return parse_preview_size (funcs[i].val1p, funcs[i].val2p);
case TT_XNAVPREVSIZE:
return parse_nav_preview_size (funcs[i].val1p, funcs[i].val2p);
case TT_XUNIT:
return parse_units (funcs[i].val1p, funcs[i].val2p);
case TT_XPLUGIN:
@ -1221,6 +1228,42 @@ parse_preview_size (gpointer val1p,
return OK;
}
static int
parse_nav_preview_size (gpointer val1p,
gpointer val2p)
{
int token;
token = peek_next_token ();
if (!token || (token != TOKEN_SYMBOL && token != TOKEN_NUMBER))
return ERROR;
token = get_next_token ();
if (token == TOKEN_SYMBOL)
{
/* if (strcmp (token_sym, "none") == 0) */
/* preview_size = 0; */
/* else */
if (strcmp (token_sym, "small") == 0)
nav_preview_size = 48;
else if (strcmp (token_sym, "medium") == 0)
nav_preview_size = 80;
else if (strcmp (token_sym, "large") == 0)
nav_preview_size = 112;
else
nav_preview_size = 112;
}
else if (token == TOKEN_NUMBER)
nav_preview_size = token_num;
token = peek_next_token ();
if (!token || (token != TOKEN_RIGHT_PAREN))
return ERROR;
token = get_next_token ();
return OK;
}
static int
parse_units (gpointer val1p,
gpointer val2p)
@ -2352,6 +2395,8 @@ value_to_str (char *name)
return color_cube_to_str (funcs[i].val1p, funcs[i].val2p);
case TT_XPREVSIZE:
return preview_size_to_str (funcs[i].val1p, funcs[i].val2p);
case TT_XNAVPREVSIZE:
return nav_preview_size_to_str (funcs[i].val1p, funcs[i].val2p);
case TT_XUNIT:
return units_to_str (funcs[i].val1p, funcs[i].val2p);
case TT_XPLUGIN:
@ -2505,6 +2550,21 @@ preview_size_to_str (gpointer val1p,
return g_strdup ("none");
}
static inline char *
nav_preview_size_to_str (gpointer val1p,
gpointer val2p)
{
if (nav_preview_size >= 112)
return g_strdup ("large");
else if (nav_preview_size >= 80)
return g_strdup ("medium");
else if (nav_preview_size >= 48)
return g_strdup ("small");
else
return g_strdup ("large");
}
static inline char *
units_to_str (gpointer val1p,
gpointer val2p)

View File

@ -53,6 +53,7 @@ extern int stingy_memory_use;
extern int allow_resize_windows;
extern int no_cursor_updating;
extern int preview_size;
extern int nav_preview_size;
extern int show_rulers;
extern GUnit default_units;
extern int show_statusbar;

View File

@ -21,6 +21,7 @@
#include "colormaps.h"
#include "context_manager.h"
#include "gdisplay_ops.h"
#include "gdisplay.h"
#include "gimprc.h"
#include "image_render.h"
#include "interface.h"
@ -43,6 +44,7 @@ static void file_prefs_cancel_callback (GtkWidget *, GtkWidget *);
static void file_prefs_toggle_callback (GtkWidget *, gpointer);
static void file_prefs_preview_size_callback (GtkWidget *, gpointer);
static void file_prefs_nav_preview_size_callback (GtkWidget *, gpointer);
static void file_prefs_mem_size_callback (GtkWidget *, gpointer);
static void file_prefs_mem_size_unit_callback (GtkWidget *, gpointer);
static void file_prefs_int_adjustment_callback (GtkAdjustment *, gpointer);
@ -64,6 +66,7 @@ static int old_marching_speed;
static int old_allow_resize_windows;
static int old_auto_save;
static int old_preview_size;
static int old_nav_preview_size;
static int old_no_cursor_updating;
static int old_show_tool_tips;
static int old_show_rulers;
@ -404,6 +407,8 @@ file_prefs_save_callback (GtkWidget *widget,
update = g_list_append (update, "default-image-type");
if (preview_size != old_preview_size)
update = g_list_append (update, "preview-size");
if (nav_preview_size != old_nav_preview_size)
update = g_list_append (update, "nav-preview-size");
if (perfectmouse != old_perfectmouse)
update = g_list_append (update, "perfect-mouse");
if (transparency_type != old_transparency_type)
@ -592,6 +597,12 @@ file_prefs_cancel_callback (GtkWidget *widget,
layer_select_update_preview_size ();
}
if (nav_preview_size != old_nav_preview_size)
{
nav_preview_size = old_nav_preview_size;
gdisplays_nav_preview_resized();
}
if ((transparency_type != old_transparency_type) ||
(transparency_size != old_transparency_size))
{
@ -701,6 +712,14 @@ file_prefs_preview_size_callback (GtkWidget *widget,
layer_select_update_preview_size ();
}
static void
file_prefs_nav_preview_size_callback (GtkWidget *widget,
gpointer data)
{
nav_preview_size = (gint)data;
gdisplays_nav_preview_resized();
}
static void
file_prefs_mem_size_callback (GtkWidget *widget,
gpointer data)
@ -1433,6 +1452,7 @@ file_pref_cmd_callback (GtkWidget *widget,
old_allow_resize_windows = allow_resize_windows;
old_auto_save = auto_save;
old_preview_size = preview_size;
old_nav_preview_size = nav_preview_size;
old_no_cursor_updating = no_cursor_updating;
old_show_tool_tips = show_tool_tips;
old_show_rulers = show_rulers;
@ -1751,7 +1771,7 @@ file_pref_cmd_callback (GtkWidget *widget,
gtk_container_add (GTK_CONTAINER (frame), hbox);
gtk_widget_show (hbox);
table = gtk_table_new (3, 2, FALSE);
table = gtk_table_new (4, 2, FALSE);
gtk_container_set_border_width (GTK_CONTAINER (table), 2);
gtk_table_set_row_spacings (GTK_TABLE (table), 2);
gtk_table_set_col_spacings (GTK_TABLE (table), 4);
@ -1782,13 +1802,23 @@ file_pref_cmd_callback (GtkWidget *widget,
gimp_table_attach_aligned (GTK_TABLE (table), 0,
_("Preview Size:"), 1.0, 0.5, optionmenu, TRUE);
optionmenu =
gimp_option_menu_new (file_prefs_nav_preview_size_callback,
(gpointer) nav_preview_size,
_("Small"), (gpointer) 48, (gpointer) 48,
_("Medium"), (gpointer) 80, (gpointer) 80,
_("Large"), (gpointer) 112, (gpointer) 112,
NULL);
gimp_table_attach_aligned (GTK_TABLE (table), 1,
_("Nav Preview Size:"), 1.0, 0.5, optionmenu, TRUE);
spinbutton =
gimp_spin_button_new (&adjustment,
levels_of_undo, 0.0, 255.0, 1.0, 5.0, 0.0, 1.0, 0.0);
gtk_signal_connect (GTK_OBJECT (adjustment), "value_changed",
(GtkSignalFunc) file_prefs_int_adjustment_callback,
&levels_of_undo);
gimp_table_attach_aligned (GTK_TABLE (table), 1,
gimp_table_attach_aligned (GTK_TABLE (table), 2,
_("Levels of Undo:"), 1.0, 0.5, spinbutton, TRUE);
spinbutton =
@ -1797,7 +1827,7 @@ file_pref_cmd_callback (GtkWidget *widget,
gtk_signal_connect (GTK_OBJECT (adjustment), "value_changed",
(GtkSignalFunc) file_prefs_int_adjustment_callback,
&edit_last_opened_size);
gimp_table_attach_aligned (GTK_TABLE (table), 2,
gimp_table_attach_aligned (GTK_TABLE (table), 3,
_("Recent Documents List Size:"), 1.0, 0.5,
spinbutton, TRUE);

View File

@ -26,6 +26,7 @@
#include "info_dialog.h"
#include "info_window.h"
#include "gdisplay.h"
#include "gimprc.h"
#include "gximage.h"
#include "interface.h"
#include "scroll.h"
@ -46,15 +47,9 @@
GDK_KEY_RELEASE_MASK
/* Navigation preview sizes */
#if 0
#define NAV_PREVIEW_WIDTH 48
#define NAV_PREVIEW_HEIGHT 48
#define BORDER_PEN_WIDTH 2
#else
#define NAV_PREVIEW_WIDTH 112
#define NAV_PREVIEW_HEIGHT 112
#define BORDER_PEN_WIDTH 3
#endif /* 0 */
#define MAX_SCALE_BUF 20
@ -110,14 +105,6 @@ nav_window_expose_events (GtkWidget *,
GdkEvent *,
gpointer *);
#if 0
static gint
nav_window_preview_resized (GtkWidget *,
GtkAllocation *,
gpointer *);
#endif /* 0 */
static void
nav_window_update_preview (NavWinData *);
@ -424,7 +411,7 @@ nav_window_update_preview(NavWinData *iwd)
gint xoff = 0;
gint yoff = 0;
gimp_add_busy_cursors();
gimp_add_busy_cursors();
gdisp = (GDisplay *) iwd->gdisp_ptr;
@ -728,18 +715,8 @@ nav_window_preview_events (GtkWidget *widget,
iwd->motion_offsety = ty - iwd->dispy;
}
#if 0
/* Now grab the square */
iwd->sq_grabbed = TRUE;
gtk_grab_add(widget);
gdk_pointer_grab (widget->window, TRUE,
GDK_BUTTON_RELEASE_MASK |
GDK_POINTER_MOTION_HINT_MASK |
GDK_BUTTON_MOTION_MASK,
widget->window, NULL, 0);
#else
nav_window_grab_pointer(iwd,widget);
#endif /* 0 */
break;
default:
break;
@ -1135,8 +1112,10 @@ create_dummy_iwd(void *gdisp_ptr,NavWinType ptype)
iwd->sq_grabbed = FALSE;
iwd->ratio = 1.0;
iwd->block_window_marker = FALSE;
iwd->nav_preview_width = NAV_PREVIEW_WIDTH;
iwd->nav_preview_height = NAV_PREVIEW_HEIGHT;
iwd->nav_preview_width =
(nav_preview_size < 0 || nav_preview_size > 256)?NAV_PREVIEW_WIDTH:nav_preview_size;
iwd->nav_preview_height =
(nav_preview_size < 0 || nav_preview_size > 256)?NAV_PREVIEW_HEIGHT:nav_preview_size;
iwd->block_adj_sig = FALSE;
return(iwd);
@ -1166,8 +1145,6 @@ nav_window_create (void *gdisp_ptr)
(GtkSignalFunc) nav_window_destroy_callback,
info_win);
g_free (title_buf);
/* gtk_window_set_policy (GTK_WINDOW (info_win->shell), */
/* FALSE,FALSE,FALSE); */
iwd = create_dummy_iwd(gdisp_ptr,NAV_WINDOW);
info_win->user_data = iwd;
@ -1175,8 +1152,6 @@ nav_window_create (void *gdisp_ptr)
/* Add preview */
container = info_window_image_preview_new(info_win);
/* gtk_container_set_focus_child(GTK_CONTAINER(container),iwd->preview); */
gtk_window_set_focus(GTK_WINDOW (info_win->shell),iwd->preview);
gtk_table_attach_defaults (GTK_TABLE (info_win->info_table), container,
0, 2, 0, 1);
/* Create the action area */
@ -1219,16 +1194,6 @@ nav_window_update_window_marker(InfoDialog *info_win)
/* Update to new size */
nav_window_disp_area(iwd,iwd->gdisp_ptr);
#if 0
/* do the same for the popup widget..*/
if(((GDisplay *)iwd->gdisp_ptr)->nav_popup)
{
NavWinData *iwp; /* dummy shorter version for the popups */
iwp = (NavWinData *)gtk_object_get_data(GTK_OBJECT(((GDisplay *)iwd->gdisp_ptr)->nav_popup),"navpop_prt");
nav_window_disp_area(iwp,iwp->gdisp_ptr);
}
#endif /* 0 */
/* and redraw */
nav_window_draw_sqr(iwd,
FALSE,
@ -1354,3 +1319,42 @@ nav_popup_free(GtkWidget *nav_popup)
{
gtk_widget_destroy(nav_popup);
}
void
nav_window_preview_resized(InfoDialog *idialog)
{
NavWinData *iwd;
if (!idialog)
return;
iwd = (NavWinData *)idialog->user_data;
/* force regeneration of the widgets */
/* bit of a fiddle... could cause if the image really is 1x1
* but the preview would not really matter in that case.
*/
iwd->imagewidth = 1;
iwd->imageheight = 1;
iwd->nav_preview_width =
(nav_preview_size < 0 || nav_preview_size > 256)?NAV_PREVIEW_WIDTH:nav_preview_size;
iwd->nav_preview_height =
(nav_preview_size < 0 || nav_preview_size > 256)?NAV_PREVIEW_HEIGHT:nav_preview_size;
nav_window_update_window_marker(idialog);
}
void
nav_window_popup_preview_resized (GtkWidget **widget)
{
NavWinData *iwp; /* dummy shorter version for the popups */
iwp = (NavWinData *)gtk_object_get_data(GTK_OBJECT(*widget),"navpop_prt");
g_free(iwp);
gtk_widget_destroy(*widget);
*widget = NULL;
}

View File

@ -25,6 +25,8 @@ InfoDialog *nav_window_create (void *);
void nav_window_free (InfoDialog *);
void nav_window_update_window_marker(InfoDialog *);
void nav_dialog_popup (InfoDialog *idialog);
void nav_window_preview_resized (InfoDialog *idialog);
void nav_window_popup_preview_resized (GtkWidget **widget);
/* popup functions */
void nav_popup_click_handler(GtkWidget *widget, GdkEventButton *event, gpointer data);

View File

@ -21,6 +21,7 @@
#include "colormaps.h"
#include "context_manager.h"
#include "gdisplay_ops.h"
#include "gdisplay.h"
#include "gimprc.h"
#include "image_render.h"
#include "interface.h"
@ -43,6 +44,7 @@ static void file_prefs_cancel_callback (GtkWidget *, GtkWidget *);
static void file_prefs_toggle_callback (GtkWidget *, gpointer);
static void file_prefs_preview_size_callback (GtkWidget *, gpointer);
static void file_prefs_nav_preview_size_callback (GtkWidget *, gpointer);
static void file_prefs_mem_size_callback (GtkWidget *, gpointer);
static void file_prefs_mem_size_unit_callback (GtkWidget *, gpointer);
static void file_prefs_int_adjustment_callback (GtkAdjustment *, gpointer);
@ -64,6 +66,7 @@ static int old_marching_speed;
static int old_allow_resize_windows;
static int old_auto_save;
static int old_preview_size;
static int old_nav_preview_size;
static int old_no_cursor_updating;
static int old_show_tool_tips;
static int old_show_rulers;
@ -404,6 +407,8 @@ file_prefs_save_callback (GtkWidget *widget,
update = g_list_append (update, "default-image-type");
if (preview_size != old_preview_size)
update = g_list_append (update, "preview-size");
if (nav_preview_size != old_nav_preview_size)
update = g_list_append (update, "nav-preview-size");
if (perfectmouse != old_perfectmouse)
update = g_list_append (update, "perfect-mouse");
if (transparency_type != old_transparency_type)
@ -592,6 +597,12 @@ file_prefs_cancel_callback (GtkWidget *widget,
layer_select_update_preview_size ();
}
if (nav_preview_size != old_nav_preview_size)
{
nav_preview_size = old_nav_preview_size;
gdisplays_nav_preview_resized();
}
if ((transparency_type != old_transparency_type) ||
(transparency_size != old_transparency_size))
{
@ -701,6 +712,14 @@ file_prefs_preview_size_callback (GtkWidget *widget,
layer_select_update_preview_size ();
}
static void
file_prefs_nav_preview_size_callback (GtkWidget *widget,
gpointer data)
{
nav_preview_size = (gint)data;
gdisplays_nav_preview_resized();
}
static void
file_prefs_mem_size_callback (GtkWidget *widget,
gpointer data)
@ -1433,6 +1452,7 @@ file_pref_cmd_callback (GtkWidget *widget,
old_allow_resize_windows = allow_resize_windows;
old_auto_save = auto_save;
old_preview_size = preview_size;
old_nav_preview_size = nav_preview_size;
old_no_cursor_updating = no_cursor_updating;
old_show_tool_tips = show_tool_tips;
old_show_rulers = show_rulers;
@ -1751,7 +1771,7 @@ file_pref_cmd_callback (GtkWidget *widget,
gtk_container_add (GTK_CONTAINER (frame), hbox);
gtk_widget_show (hbox);
table = gtk_table_new (3, 2, FALSE);
table = gtk_table_new (4, 2, FALSE);
gtk_container_set_border_width (GTK_CONTAINER (table), 2);
gtk_table_set_row_spacings (GTK_TABLE (table), 2);
gtk_table_set_col_spacings (GTK_TABLE (table), 4);
@ -1782,13 +1802,23 @@ file_pref_cmd_callback (GtkWidget *widget,
gimp_table_attach_aligned (GTK_TABLE (table), 0,
_("Preview Size:"), 1.0, 0.5, optionmenu, TRUE);
optionmenu =
gimp_option_menu_new (file_prefs_nav_preview_size_callback,
(gpointer) nav_preview_size,
_("Small"), (gpointer) 48, (gpointer) 48,
_("Medium"), (gpointer) 80, (gpointer) 80,
_("Large"), (gpointer) 112, (gpointer) 112,
NULL);
gimp_table_attach_aligned (GTK_TABLE (table), 1,
_("Nav Preview Size:"), 1.0, 0.5, optionmenu, TRUE);
spinbutton =
gimp_spin_button_new (&adjustment,
levels_of_undo, 0.0, 255.0, 1.0, 5.0, 0.0, 1.0, 0.0);
gtk_signal_connect (GTK_OBJECT (adjustment), "value_changed",
(GtkSignalFunc) file_prefs_int_adjustment_callback,
&levels_of_undo);
gimp_table_attach_aligned (GTK_TABLE (table), 1,
gimp_table_attach_aligned (GTK_TABLE (table), 2,
_("Levels of Undo:"), 1.0, 0.5, spinbutton, TRUE);
spinbutton =
@ -1797,7 +1827,7 @@ file_pref_cmd_callback (GtkWidget *widget,
gtk_signal_connect (GTK_OBJECT (adjustment), "value_changed",
(GtkSignalFunc) file_prefs_int_adjustment_callback,
&edit_last_opened_size);
gimp_table_attach_aligned (GTK_TABLE (table), 2,
gimp_table_attach_aligned (GTK_TABLE (table), 3,
_("Recent Documents List Size:"), 1.0, 0.5,
spinbutton, TRUE);