store resolution values as doubles, not floats.

1999-05-18  Michael Natterer  <mitschel@cs.tu-berlin.de>

	* app/app_procs.c (and many of the files below): store resolution
	values as doubles, not floats.

	* app/brush_select.c
	* app/pattern_select.c: hide the "refresh" button in client
	dialogs. Don't know if this is desired but it fixes a SEGV.

	* app/file_new_dialog.c: New ui using code/ideas from Austin,
	Marco and Nick. The "size" frame is still a bit bloated but I
	didn't want to reduce it's functionality right now. It's closer to
	the result of the last discussion but not perfect yet...
	Added a dialog to confirm image sizes larger than the new
	max_new_image_size value.
	The new "reset" button uses the values from gimprc.
	Removed some #include's, added the copyright header.

	* app/gimprc.[ch]: new rc variable max_new_image_size.

	* app/preferences_dialog.c: added the "max image size"
	option. Generalized the mem size unit code.

	* app/resize.c: an additional box lets the offset widget always
	shrink correctly.

	* app/text_tool.c: fixed a minor memory leak.

	* libgimp/Makefile.am: add all widgets to libgimpui.*

	* libgimp/gimpfileselection.c: cosmetic changes.

	* libgimp/gimplimits.h: a maximum image size which should satisfy
	everybody ;)

	* libgimp/gimpsizeentry.c: allow the creation of sizeentries
	without fields. This (finally) enables arbitrary layout of the
	spinbuttons.

	* plug-ins/script-fu/script-fu-scripts.c: use the fileselection
	widget for script parameter SF_FILENAME.
This commit is contained in:
Michael Natterer 1999-05-18 17:33:39 +00:00 committed by Michael Natterer
parent 1c7dcda6aa
commit e494bbd557
30 changed files with 2525 additions and 1396 deletions

View File

@ -1,3 +1,45 @@
1999-05-18 Michael Natterer <mitschel@cs.tu-berlin.de>
* app/app_procs.c (and many of the files below): store resolution
values as doubles, not floats.
* app/brush_select.c
* app/pattern_select.c: hide the "refresh" button in client
dialogs. Don't know if this is desired but it fixes a SEGV.
* app/file_new_dialog.c: New ui using code/ideas from Austin,
Marco and Nick. The "size" frame is still a bit bloated but I
didn't want to reduce it's functionality right now. It's closer to
the result of the last discussion but not perfect yet...
Added a dialog to confirm image sizes larger than the new
max_new_image_size value.
The new "reset" button uses the values from gimprc.
Removed some #include's, added the copyright header.
* app/gimprc.[ch]: new rc variable max_new_image_size.
* app/preferences_dialog.c: added the "max image size"
option. Generalized the mem size unit code.
* app/resize.c: an additional box lets the offset widget always
shrink correctly.
* app/text_tool.c: fixed a minor memory leak.
* libgimp/Makefile.am: add all widgets to libgimpui.*
* libgimp/gimpfileselection.c: cosmetic changes.
* libgimp/gimplimits.h: a maximum image size which should satisfy
everybody ;)
* libgimp/gimpsizeentry.c: allow the creation of sizeentries
without fields. This (finally) enables arbitrary layout of the
spinbuttons.
* plug-ins/script-fu/script-fu-scripts.c: use the fileselection
widget for script parameter SF_FILENAME.
Tue May 18 01:14:55 BST 1999 Austin Donnelly <austin@gimp.org>
* app/app_procs.c: run cleanup code on shutdown in many more

View File

@ -499,7 +499,11 @@ app_init (void)
/* make sure the monitor resolution is valid */
if (monitor_xres < 1e-5 || monitor_yres < 1e-5)
{
gdisplay_xserver_resolution (&monitor_xres, &monitor_yres);
gfloat xres, yres;
gdisplay_xserver_resolution (&xres, &yres);
monitor_xres = xres;
monitor_yres = yres;
using_xserver_resolution = TRUE;
}

View File

@ -358,6 +358,9 @@ brush_select_new (gchar *title,
/* The action area */
action_items[0].user_data = bsp;
action_items[1].user_data = bsp;
if (title)
build_action_area (GTK_DIALOG (bsp->shell), &action_items[1], 1, 0);
else
build_action_area (GTK_DIALOG (bsp->shell), action_items, 2, 1);
gtk_widget_show (bsp->options_box);

File diff suppressed because it is too large Load Diff

View File

@ -42,6 +42,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_mem_size_callback (GtkWidget *, gpointer);
static void file_prefs_mem_size_unit_callback (GtkWidget *, gpointer);
static void file_prefs_int_adjustment_callback (GtkAdjustment *, gpointer);
static void file_prefs_string_callback (GtkWidget *, gpointer);
@ -74,8 +75,8 @@ static int old_always_restore_session;
static int old_default_width;
static int old_default_height;
static GUnit old_default_units;
static float old_default_xresolution;
static float old_default_yresolution;
static double old_default_xresolution;
static double old_default_yresolution;
static GUnit old_default_resolution_units;
static int old_default_type;
static int old_stingy_memory_use;
@ -91,12 +92,13 @@ static char * old_brush_path;
static char * old_pattern_path;
static char * old_palette_path;
static char * old_gradient_path;
static float old_monitor_xres;
static float old_monitor_yres;
static double old_monitor_xres;
static double old_monitor_yres;
static int old_using_xserver_resolution;
static int old_num_processors;
static char * old_image_title_format;
static int old_global_paint_options;
static int old_max_new_image_size;
/* variables which can't be changed on the fly */
static int edit_stingy_memory_use;
@ -116,9 +118,11 @@ static char * edit_gradient_path = NULL;
static GtkWidget *prefs_dlg = NULL;
static GtkObject *tile_cache_size_adjustment = NULL;
static int divided_tile_cache_size;
static int mem_size_unit;
static int tile_cache_size_unit;
static int divided_max_new_image_size;
static int max_new_image_size_unit;
static GtkWidget *default_size_sizeentry = NULL;
static GtkWidget *default_resolution_sizeentry = NULL;
@ -204,8 +208,6 @@ static void
file_prefs_ok_callback (GtkWidget *widget,
GtkWidget *dlg)
{
edit_tile_cache_size = mem_size_unit * divided_tile_cache_size;
if (levels_of_undo < 0)
{
g_message (_("Error: Levels of undo must be zero or greater."));
@ -273,7 +275,6 @@ file_prefs_ok_callback (GtkWidget *widget,
gtk_widget_destroy (dlg);
prefs_dlg = NULL;
tile_cache_size_adjustment = NULL;
default_size_sizeentry = NULL;
default_resolution_sizeentry = NULL;
resolution_xserver_label = NULL;
@ -503,11 +504,19 @@ file_prefs_save_callback (GtkWidget *widget,
update = g_list_append (update, "global-paint-options");
remove = g_list_append (remove, "no-global-paint-options");
}
if (max_new_image_size != old_max_new_image_size)
update = g_list_append (update, "max-new-image-size");
save_gimprc (&update, &remove);
if (using_xserver_resolution)
gdisplay_xserver_resolution (&monitor_xres, &monitor_yres);
{
gfloat xres, yres;
gdisplay_xserver_resolution (&xres, &yres);
monitor_xres = xres;
monitor_yres = yres;
}
/* Restore variables which must not change */
stingy_memory_use = save_stingy_memory_use;
@ -539,7 +548,6 @@ file_prefs_cancel_callback (GtkWidget *widget,
{
gtk_widget_destroy (dlg);
prefs_dlg = NULL;
tile_cache_size_adjustment = NULL;
default_size_sizeentry = NULL;
default_resolution_sizeentry = NULL;
resolution_xserver_label = NULL;
@ -569,6 +577,7 @@ file_prefs_cancel_callback (GtkWidget *widget,
monitor_yres = old_monitor_yres;
using_xserver_resolution = old_using_xserver_resolution;
num_processors = old_num_processors;
max_new_image_size = old_max_new_image_size;
if (preview_size != old_preview_size)
{
@ -672,22 +681,66 @@ file_prefs_preview_size_callback (GtkWidget *widget,
layer_select_update_preview_size ();
}
static void
file_prefs_mem_size_callback (GtkWidget *widget,
gpointer data)
{
int *mem_size;
int *divided_mem_size;
int *mem_size_unit;
if (! (mem_size = gtk_object_get_data (GTK_OBJECT (widget), "mem_size")))
return;
if (! (divided_mem_size = gtk_object_get_data (GTK_OBJECT (widget),
"divided_mem_size")))
return;
if (! (mem_size_unit = gtk_object_get_data (GTK_OBJECT (widget),
"mem_size_unit")))
return;
*divided_mem_size = GTK_ADJUSTMENT (widget)->value;
*mem_size = *divided_mem_size * *mem_size_unit;
}
static void
file_prefs_mem_size_unit_callback (GtkWidget *widget,
gpointer data)
{
GtkObject *adjustment;
int new_unit;
int *mem_size;
int *divided_mem_size;
int *mem_size_unit;
new_unit = (int)data;
adjustment = GTK_OBJECT (data);
if (new_unit != mem_size_unit)
if (! (new_unit = (int) gtk_object_get_user_data (GTK_OBJECT (widget))))
return;
if (! (mem_size = gtk_object_get_data (GTK_OBJECT (adjustment), "mem_size")))
return;
if (! (divided_mem_size = gtk_object_get_data (GTK_OBJECT (adjustment),
"divided_mem_size")))
return;
if (! (mem_size_unit = gtk_object_get_data (GTK_OBJECT (adjustment),
"mem_size_unit")))
return;
if (new_unit != *mem_size_unit)
{
divided_tile_cache_size =
divided_tile_cache_size * mem_size_unit / new_unit;
mem_size_unit = new_unit;
*divided_mem_size = *mem_size / new_unit;
*mem_size_unit = new_unit;
gtk_adjustment_set_value (GTK_ADJUSTMENT (tile_cache_size_adjustment),
(float)divided_tile_cache_size);
gtk_signal_handler_block_by_data (GTK_OBJECT (adjustment),
divided_mem_size);
gtk_adjustment_set_value (GTK_ADJUSTMENT (adjustment),
(float) *divided_mem_size);
gtk_signal_handler_unblock_by_data (GTK_OBJECT (adjustment),
divided_mem_size);
}
}
@ -752,10 +805,10 @@ static void
file_prefs_default_resolution_callback (GtkWidget *widget,
gpointer data)
{
static float xres = 0.0;
static float yres = 0.0;
float new_xres;
float new_yres;
static gdouble xres = 0.0;
static gdouble yres = 0.0;
gdouble new_xres;
gdouble new_yres;
new_xres = gimp_size_entry_get_refval (GIMP_SIZE_ENTRY (widget), 0);
new_yres = gimp_size_entry_get_refval (GIMP_SIZE_ENTRY (widget), 1);
@ -810,7 +863,11 @@ file_prefs_res_source_callback (GtkWidget *widget,
if (GTK_TOGGLE_BUTTON (widget)->active)
{
gdisplay_xserver_resolution (&monitor_xres, &monitor_yres);
gfloat xres, yres;
gdisplay_xserver_resolution (&xres, &yres);
monitor_xres = xres;
monitor_yres = yres;
using_xserver_resolution = TRUE;
}
else
@ -830,10 +887,10 @@ static void
file_prefs_monitor_resolution_callback (GtkWidget *widget,
gpointer data)
{
static float xres = 0.0;
static float yres = 0.0;
float new_xres;
float new_yres;
static gdouble xres = 0.0;
static gdouble yres = 0.0;
gdouble new_xres;
gdouble new_yres;
new_xres = gimp_size_entry_get_refval (GIMP_SIZE_ENTRY (widget), 0);
new_yres = gimp_size_entry_get_refval (GIMP_SIZE_ENTRY (widget), 1);
@ -1191,6 +1248,7 @@ gimp_table_attach_aligned (GtkTable *table,
label = gtk_label_new (text);
gtk_misc_set_alignment (GTK_MISC (label), xalign, yalign);
gtk_label_set_justify (GTK_LABEL (label), GTK_JUSTIFY_RIGHT);
gtk_table_attach (table, GTK_WIDGET (label), 0, 1, row, row + 1,
GTK_SHRINK | GTK_FILL, GTK_SHRINK | GTK_FILL, 0, 0);
gtk_widget_show (label);
@ -1199,7 +1257,7 @@ gimp_table_attach_aligned (GtkTable *table,
{
GtkWidget *alignment;
alignment = gtk_alignment_new (0.0, 0.5, 0.0, 0.0);
alignment = gtk_alignment_new (0.0, 1.0, 0.0, 0.0);
gtk_table_attach_defaults (table, alignment, 1, 2, row, row + 1);
gtk_widget_show (alignment);
gtk_container_add (GTK_CONTAINER (alignment), widget);
@ -1373,6 +1431,7 @@ file_pref_cmd_callback (GtkWidget *widget,
old_num_processors = num_processors;
old_image_title_format = file_prefs_strdup (image_title_format);
old_global_paint_options = global_paint_options;
old_max_new_image_size = max_new_image_size;
file_prefs_strset (&old_temp_path, edit_temp_path);
file_prefs_strset (&old_swap_path, edit_swap_path);
@ -1383,14 +1442,23 @@ file_pref_cmd_callback (GtkWidget *widget,
file_prefs_strset (&old_palette_path, edit_palette_path);
file_prefs_strset (&old_gradient_path, edit_gradient_path);
mem_size_unit = 1;
tile_cache_size_unit = 1;
for (i = 0; i < 3; i++)
{
if (edit_tile_cache_size % (mem_size_unit * 1024) != 0)
if (edit_tile_cache_size % (tile_cache_size_unit * 1024) != 0)
break;
mem_size_unit *= 1024;
tile_cache_size_unit *= 1024;
}
divided_tile_cache_size = edit_tile_cache_size / mem_size_unit;
divided_tile_cache_size = edit_tile_cache_size / tile_cache_size_unit;
max_new_image_size_unit = 1;
for (i = 0; i < 3; i++)
{
if (max_new_image_size % (max_new_image_size_unit * 1024) != 0)
break;
max_new_image_size_unit *= 1024;
}
divided_max_new_image_size = max_new_image_size / max_new_image_size_unit;
/* Create the dialog */
prefs_dlg =
@ -1466,8 +1534,10 @@ file_pref_cmd_callback (GtkWidget *widget,
0, default_xresolution, FALSE);
gimp_size_entry_set_resolution (GIMP_SIZE_ENTRY (default_size_sizeentry),
1, default_yresolution, FALSE);
gimp_size_entry_set_refval_boundaries (GIMP_SIZE_ENTRY (default_size_sizeentry), 0, 1, 32767);
gimp_size_entry_set_refval_boundaries (GIMP_SIZE_ENTRY (default_size_sizeentry), 1, 1, 32767);
gimp_size_entry_set_refval_boundaries
(GIMP_SIZE_ENTRY (default_size_sizeentry), 0, 1, 32767);
gimp_size_entry_set_refval_boundaries
(GIMP_SIZE_ENTRY (default_size_sizeentry), 1, 1, 32767);
gimp_size_entry_set_refval (GIMP_SIZE_ENTRY (default_size_sizeentry), 0,
default_width);
gimp_size_entry_set_refval (GIMP_SIZE_ENTRY (default_size_sizeentry), 1,
@ -1498,11 +1568,13 @@ file_pref_cmd_callback (GtkWidget *widget,
button = gimp_chain_button_new (GIMP_CHAIN_BOTTOM);
default_resolution_sizeentry =
gimp_size_entry_new (2, default_resolution_units, "%s",
gimp_size_entry_new (2, default_resolution_units, "Pixels/%s",
FALSE, FALSE, TRUE, 75,
GIMP_SIZE_ENTRY_UPDATE_RESOLUTION);
gimp_size_entry_set_refval_boundaries (GIMP_SIZE_ENTRY (default_resolution_sizeentry), 0, 1, 32767);
gimp_size_entry_set_refval_boundaries (GIMP_SIZE_ENTRY (default_resolution_sizeentry), 1, 1, 32767);
gimp_size_entry_set_refval_boundaries
(GIMP_SIZE_ENTRY (default_resolution_sizeentry), 0, 1, 32767);
gimp_size_entry_set_refval_boundaries
(GIMP_SIZE_ENTRY (default_resolution_sizeentry), 1, 1, 32767);
gimp_size_entry_set_refval (GIMP_SIZE_ENTRY (default_resolution_sizeentry),
0, default_xresolution);
gimp_size_entry_set_refval (GIMP_SIZE_ENTRY (default_resolution_sizeentry),
@ -1512,9 +1584,7 @@ file_pref_cmd_callback (GtkWidget *widget,
gimp_size_entry_attach_label (GIMP_SIZE_ENTRY (default_resolution_sizeentry),
_("Vertical"), 0, 2, 0.0);
gimp_size_entry_attach_label (GIMP_SIZE_ENTRY (default_resolution_sizeentry),
_("dpi"), 1, 3, 0.0);
gimp_size_entry_attach_label (GIMP_SIZE_ENTRY (default_resolution_sizeentry),
_("Pixels per "), 2, 3, 0.0);
_("dpi"), 1, 4, 0.0);
gtk_signal_connect (GTK_OBJECT (default_resolution_sizeentry),
"unit_changed",
(GtkSignalFunc)file_prefs_default_resolution_callback,
@ -1920,9 +1990,9 @@ file_pref_cmd_callback (GtkWidget *widget,
gtk_widget_show (button);
#ifdef ENABLE_MP
table = gtk_table_new (2, 2, FALSE);
table = gtk_table_new (3, 2, FALSE);
#else
table = gtk_table_new (1, 2, FALSE);
table = gtk_table_new (2, 2, FALSE);
#endif /* ENABLE_MP */
gtk_container_set_border_width (GTK_CONTAINER (table), 2);
gtk_table_set_row_spacings (GTK_TABLE (table), 2);
@ -1930,31 +2000,72 @@ file_pref_cmd_callback (GtkWidget *widget,
gtk_box_pack_start (GTK_BOX (vbox2), table, FALSE, FALSE, 0);
gtk_widget_show (table);
/* The tile cache size */
hbox = gtk_hbox_new (FALSE, 2);
spinbutton =
gimp_spin_button_new (&tile_cache_size_adjustment,
gimp_spin_button_new (&adjustment,
divided_tile_cache_size,
0.0, (4069.0 * 1024 * 1024), 1.0, 16.0, 0.0,
1.0, 0.0);
gtk_signal_connect (GTK_OBJECT (tile_cache_size_adjustment), "value_changed",
(GtkSignalFunc) file_prefs_int_adjustment_callback,
gtk_signal_connect (GTK_OBJECT (adjustment), "value_changed",
(GtkSignalFunc) file_prefs_mem_size_callback,
&divided_tile_cache_size);
gtk_box_pack_start (GTK_BOX (hbox), spinbutton, FALSE, FALSE, 0);
gtk_widget_show (spinbutton);
/* for the mem_size_unit callback */
gtk_object_set_data (GTK_OBJECT (adjustment), "mem_size",
&edit_tile_cache_size);
gtk_object_set_data (GTK_OBJECT (adjustment), "divided_mem_size",
&divided_tile_cache_size);
gtk_object_set_data (GTK_OBJECT (adjustment), "mem_size_unit",
&tile_cache_size_unit);
optionmenu =
gimp_option_menu_new (file_prefs_mem_size_unit_callback,
(gpointer) mem_size_unit,
_("Bytes"), (gpointer) 1, (gpointer) 1,
_("KiloBytes"), (gpointer) 1024, (gpointer) 1024,
_("MegaBytes"),
(gpointer) (1024*1024), (gpointer) (1024*1024),
(gpointer) tile_cache_size_unit,
_("Bytes"), adjustment, (gpointer) 1,
_("KiloBytes"), adjustment, (gpointer) 1024,
_("MegaBytes"), adjustment, (gpointer) (1024*1024),
NULL);
gtk_box_pack_start (GTK_BOX (hbox), optionmenu, FALSE, FALSE, 0);
gtk_widget_show (optionmenu);
gimp_table_attach_aligned (GTK_TABLE (table), 0,
_("Tile Cache Size:"), 1.0, 0.5, hbox, TRUE);
/* The maximum size of a new image */
hbox = gtk_hbox_new (FALSE, 2);
spinbutton =
gimp_spin_button_new (&adjustment,
divided_max_new_image_size,
0.0, (4069.0 * 1024 * 1024), 1.0, 16.0, 0.0,
1.0, 0.0);
gtk_signal_connect (GTK_OBJECT (adjustment), "value_changed",
(GtkSignalFunc) file_prefs_mem_size_callback,
&divided_max_new_image_size);
gtk_box_pack_start (GTK_BOX (hbox), spinbutton, FALSE, FALSE, 0);
gtk_widget_show (spinbutton);
/* for the mem_size_unit callback */
gtk_object_set_data (GTK_OBJECT (adjustment), "mem_size",
&max_new_image_size);
gtk_object_set_data (GTK_OBJECT (adjustment), "divided_mem_size",
&divided_max_new_image_size);
gtk_object_set_data (GTK_OBJECT (adjustment), "mem_size_unit",
&max_new_image_size_unit);
optionmenu =
gimp_option_menu_new (file_prefs_mem_size_unit_callback,
(gpointer) max_new_image_size_unit,
_("Bytes"), adjustment, (gpointer) 1,
_("KiloBytes"), adjustment, (gpointer) 1024,
_("MegaBytes"), adjustment, (gpointer) (1024*1024),
NULL);
gtk_box_pack_start (GTK_BOX (hbox), optionmenu, FALSE, FALSE, 0);
gtk_widget_show (optionmenu);
gimp_table_attach_aligned (GTK_TABLE (table), 1,
_("Maximum Image Size:"), 1.0, 0.5, hbox, TRUE);
#ifdef ENABLE_MP
spinbutton =
gimp_spin_button_new (&adjustment,
@ -1962,7 +2073,7 @@ file_pref_cmd_callback (GtkWidget *widget,
gtk_signal_connect (GTK_OBJECT (adjustment), "value_changed",
(GtkSignalFunc) file_prefs_int_adjustment_callback,
&num_processors);
gimp_table_attach_aligned (GTK_TABLE (table), 1,
gimp_table_attach_aligned (GTK_TABLE (table), 2,
_("Number of Processors to Use:"), 1.0, 0.5,
spinbutton, TRUE);
#endif /* ENABLE_MP */
@ -2094,8 +2205,8 @@ file_pref_cmd_callback (GtkWidget *widget,
gtk_widget_show (button);
{
float xres, yres;
char buf[80];
gfloat xres, yres;
gchar buf[80];
gdisplay_xserver_resolution (&xres, &yres);
@ -2120,10 +2231,12 @@ file_pref_cmd_callback (GtkWidget *widget,
button = gimp_chain_button_new (GIMP_CHAIN_BOTTOM);
monitor_resolution_sizeentry =
gimp_size_entry_new (2, UNIT_INCH, "%s", FALSE, FALSE, TRUE, 75,
gimp_size_entry_new (2, UNIT_INCH, "Pixels/%s", FALSE, FALSE, TRUE, 75,
GIMP_SIZE_ENTRY_UPDATE_RESOLUTION);
gimp_size_entry_set_refval_boundaries (GIMP_SIZE_ENTRY (monitor_resolution_sizeentry), 0, 1, 32767);
gimp_size_entry_set_refval_boundaries (GIMP_SIZE_ENTRY (monitor_resolution_sizeentry), 1, 1, 32767);
gimp_size_entry_set_refval_boundaries
(GIMP_SIZE_ENTRY (monitor_resolution_sizeentry), 0, 1, 32767);
gimp_size_entry_set_refval_boundaries
(GIMP_SIZE_ENTRY (monitor_resolution_sizeentry), 1, 1, 32767);
gimp_size_entry_set_refval (GIMP_SIZE_ENTRY (monitor_resolution_sizeentry),
0, monitor_xres);
gimp_size_entry_set_refval (GIMP_SIZE_ENTRY (monitor_resolution_sizeentry),
@ -2133,9 +2246,7 @@ file_pref_cmd_callback (GtkWidget *widget,
gimp_size_entry_attach_label (GIMP_SIZE_ENTRY (monitor_resolution_sizeentry),
_("Vertical"), 0, 2, 0.0);
gimp_size_entry_attach_label (GIMP_SIZE_ENTRY (monitor_resolution_sizeentry),
_("dpi"), 1, 3, 0.0);
gimp_size_entry_attach_label (GIMP_SIZE_ENTRY (monitor_resolution_sizeentry),
_("Pixels per "), 2, 3, 0.0);
_("dpi"), 1, 4, 0.0);
gtk_signal_connect (GTK_OBJECT (monitor_resolution_sizeentry),
"value_changed",
(GtkSignalFunc)file_prefs_monitor_resolution_callback,

View File

@ -102,6 +102,7 @@ resize_widget_new (ResizeType type,
GtkWidget *table;
GtkWidget *table2;
GtkWidget *hbox;
GtkWidget *hbox2;
GtkWidget *label;
GtkWidget *frame;
GtkWidget *spinbutton;
@ -459,9 +460,12 @@ resize_widget_new (ResizeType type,
gtk_widget_show (table);
/* frame to hold drawing area */
hbox2 = gtk_hbox_new (0, FALSE);
gtk_box_pack_start (GTK_BOX (vbox2), hbox2, FALSE, FALSE, 0);
frame = gtk_frame_new (NULL);
gtk_frame_set_shadow_type (GTK_FRAME (frame), GTK_SHADOW_IN);
gtk_box_pack_start (GTK_BOX (vbox2), frame, TRUE, FALSE, 0);
gtk_box_pack_start (GTK_BOX (hbox2), frame, TRUE, FALSE, 0);
private->drawing_area = gtk_drawing_area_new ();
gtk_drawing_area_size (GTK_DRAWING_AREA (private->drawing_area),
private->area_width, private->area_height);
@ -474,6 +478,7 @@ resize_widget_new (ResizeType type,
gtk_widget_show (private->drawing_area);
gtk_widget_show (frame);
gtk_widget_show (hbox2);
gtk_widget_show (vbox2);
gtk_widget_show (hbox);
}

File diff suppressed because it is too large Load Diff

View File

@ -138,18 +138,19 @@ int always_restore_session = FALSE;
int default_width = 256;
int default_height = 256;
int default_type = RGB;
float default_xresolution = 72.0;
float default_yresolution = 72.0;
double default_xresolution = 72.0;
double default_yresolution = 72.0;
GUnit default_resolution_units = UNIT_INCH;
int show_tips = TRUE;
int last_tip = -1;
int show_tool_tips = TRUE;
float monitor_xres = 72.0;
float monitor_yres = 72.0;
double monitor_xres = 72.0;
double monitor_yres = 72.0;
int using_xserver_resolution = FALSE;
int num_processors = 1;
char * image_title_format = NULL;
int global_paint_options = TRUE;
int max_new_image_size = 33554432; /* 32 MB */
extern char * module_db_load_inhibit;
@ -272,8 +273,8 @@ static ParseFunc funcs[] =
{ "dont-show-tool-tips", TT_BOOLEAN, NULL, &show_tool_tips },
{ "default-image-size", TT_POSITION, &default_width, &default_height },
{ "default-image-type", TT_IMAGETYPE, &default_type, NULL },
{ "default-xresolution", TT_FLOAT, &default_xresolution, NULL },
{ "default-yresolution", TT_FLOAT, &default_yresolution, NULL },
{ "default-xresolution", TT_DOUBLE, &default_xresolution, NULL },
{ "default-yresolution", TT_DOUBLE, &default_yresolution, NULL },
{ "default-resolution-units", TT_XUNIT, &default_resolution_units, NULL },
{ "plug-in", TT_XPLUGIN, NULL, NULL },
{ "plug-in-def", TT_XPLUGINDEF, NULL, NULL },
@ -281,14 +282,15 @@ static ParseFunc funcs[] =
{ "device", TT_XDEVICE, NULL, NULL },
{ "session-info", TT_XSESSIONINFO, NULL, NULL },
{ "unit-info", TT_XUNITINFO, NULL, NULL },
{ "monitor-xresolution", TT_FLOAT, &monitor_xres, NULL },
{ "monitor-yresolution", TT_FLOAT, &monitor_yres, NULL },
{ "monitor-xresolution", TT_DOUBLE, &monitor_xres, NULL },
{ "monitor-yresolution", TT_DOUBLE, &monitor_yres, NULL },
{ "num-processors", TT_INT, &num_processors, NULL },
{ "image-title-format", TT_STRING, &image_title_format, NULL },
{ "parasite", TT_XPARASITE, NULL, NULL },
{ "global-paint-options", TT_BOOLEAN, &global_paint_options, NULL },
{ "no-global-paint-options",TT_BOOLEAN, NULL, &global_paint_options },
{ "module-load-inhibit", TT_PATH, &module_db_load_inhibit, NULL }
{ "module-load-inhibit", TT_PATH, &module_db_load_inhibit, NULL },
{ "max-new-image-size", TT_MEMSIZE, &max_new_image_size, NULL }
};
static int nfuncs = sizeof (funcs) / sizeof (funcs[0]);
@ -2052,7 +2054,7 @@ parse_unit_info (gpointer val1p,
GUnit unit;
gchar *identifier = NULL;
float factor = 1.0;
double factor = 1.0;
int digits = 2.0;
gchar *symbol = NULL;
gchar *abbreviation = NULL;

View File

@ -60,20 +60,21 @@ extern int confirm_on_close;
extern int default_width, default_height;
extern int default_type;
extern GUnit default_resolution_units;
extern float default_xresolution;
extern float default_yresolution;
extern double default_xresolution;
extern double default_yresolution;
extern int save_session_info;
extern int save_device_status;
extern int always_restore_session;
extern int show_tips;
extern int last_tip;
extern int show_tool_tips;
extern float monitor_xres;
extern float monitor_yres;
extern double monitor_xres;
extern double monitor_yres;
extern int using_xserver_resolution;
extern int num_processors;
extern char * image_title_format;
extern int global_paint_options;
extern int max_new_image_size;
/* function prototypes */

View File

@ -358,6 +358,9 @@ brush_select_new (gchar *title,
/* The action area */
action_items[0].user_data = bsp;
action_items[1].user_data = bsp;
if (title)
build_action_area (GTK_DIALOG (bsp->shell), &action_items[1], 1, 0);
else
build_action_area (GTK_DIALOG (bsp->shell), action_items, 2, 1);
gtk_widget_show (bsp->options_box);

File diff suppressed because it is too large Load Diff

View File

@ -196,6 +196,9 @@ pattern_select_new (gchar *title,
/* The action area */
action_items[0].user_data = psp;
action_items[1].user_data = psp;
if (title)
build_action_area (GTK_DIALOG (psp->shell), &action_items[1], 1, 0);
else
build_action_area (GTK_DIALOG (psp->shell), action_items, 2, 1);
gtk_widget_show (psp->options_box);

View File

@ -42,6 +42,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_mem_size_callback (GtkWidget *, gpointer);
static void file_prefs_mem_size_unit_callback (GtkWidget *, gpointer);
static void file_prefs_int_adjustment_callback (GtkAdjustment *, gpointer);
static void file_prefs_string_callback (GtkWidget *, gpointer);
@ -74,8 +75,8 @@ static int old_always_restore_session;
static int old_default_width;
static int old_default_height;
static GUnit old_default_units;
static float old_default_xresolution;
static float old_default_yresolution;
static double old_default_xresolution;
static double old_default_yresolution;
static GUnit old_default_resolution_units;
static int old_default_type;
static int old_stingy_memory_use;
@ -91,12 +92,13 @@ static char * old_brush_path;
static char * old_pattern_path;
static char * old_palette_path;
static char * old_gradient_path;
static float old_monitor_xres;
static float old_monitor_yres;
static double old_monitor_xres;
static double old_monitor_yres;
static int old_using_xserver_resolution;
static int old_num_processors;
static char * old_image_title_format;
static int old_global_paint_options;
static int old_max_new_image_size;
/* variables which can't be changed on the fly */
static int edit_stingy_memory_use;
@ -116,9 +118,11 @@ static char * edit_gradient_path = NULL;
static GtkWidget *prefs_dlg = NULL;
static GtkObject *tile_cache_size_adjustment = NULL;
static int divided_tile_cache_size;
static int mem_size_unit;
static int tile_cache_size_unit;
static int divided_max_new_image_size;
static int max_new_image_size_unit;
static GtkWidget *default_size_sizeentry = NULL;
static GtkWidget *default_resolution_sizeentry = NULL;
@ -204,8 +208,6 @@ static void
file_prefs_ok_callback (GtkWidget *widget,
GtkWidget *dlg)
{
edit_tile_cache_size = mem_size_unit * divided_tile_cache_size;
if (levels_of_undo < 0)
{
g_message (_("Error: Levels of undo must be zero or greater."));
@ -273,7 +275,6 @@ file_prefs_ok_callback (GtkWidget *widget,
gtk_widget_destroy (dlg);
prefs_dlg = NULL;
tile_cache_size_adjustment = NULL;
default_size_sizeentry = NULL;
default_resolution_sizeentry = NULL;
resolution_xserver_label = NULL;
@ -503,11 +504,19 @@ file_prefs_save_callback (GtkWidget *widget,
update = g_list_append (update, "global-paint-options");
remove = g_list_append (remove, "no-global-paint-options");
}
if (max_new_image_size != old_max_new_image_size)
update = g_list_append (update, "max-new-image-size");
save_gimprc (&update, &remove);
if (using_xserver_resolution)
gdisplay_xserver_resolution (&monitor_xres, &monitor_yres);
{
gfloat xres, yres;
gdisplay_xserver_resolution (&xres, &yres);
monitor_xres = xres;
monitor_yres = yres;
}
/* Restore variables which must not change */
stingy_memory_use = save_stingy_memory_use;
@ -539,7 +548,6 @@ file_prefs_cancel_callback (GtkWidget *widget,
{
gtk_widget_destroy (dlg);
prefs_dlg = NULL;
tile_cache_size_adjustment = NULL;
default_size_sizeentry = NULL;
default_resolution_sizeentry = NULL;
resolution_xserver_label = NULL;
@ -569,6 +577,7 @@ file_prefs_cancel_callback (GtkWidget *widget,
monitor_yres = old_monitor_yres;
using_xserver_resolution = old_using_xserver_resolution;
num_processors = old_num_processors;
max_new_image_size = old_max_new_image_size;
if (preview_size != old_preview_size)
{
@ -672,22 +681,66 @@ file_prefs_preview_size_callback (GtkWidget *widget,
layer_select_update_preview_size ();
}
static void
file_prefs_mem_size_callback (GtkWidget *widget,
gpointer data)
{
int *mem_size;
int *divided_mem_size;
int *mem_size_unit;
if (! (mem_size = gtk_object_get_data (GTK_OBJECT (widget), "mem_size")))
return;
if (! (divided_mem_size = gtk_object_get_data (GTK_OBJECT (widget),
"divided_mem_size")))
return;
if (! (mem_size_unit = gtk_object_get_data (GTK_OBJECT (widget),
"mem_size_unit")))
return;
*divided_mem_size = GTK_ADJUSTMENT (widget)->value;
*mem_size = *divided_mem_size * *mem_size_unit;
}
static void
file_prefs_mem_size_unit_callback (GtkWidget *widget,
gpointer data)
{
GtkObject *adjustment;
int new_unit;
int *mem_size;
int *divided_mem_size;
int *mem_size_unit;
new_unit = (int)data;
adjustment = GTK_OBJECT (data);
if (new_unit != mem_size_unit)
if (! (new_unit = (int) gtk_object_get_user_data (GTK_OBJECT (widget))))
return;
if (! (mem_size = gtk_object_get_data (GTK_OBJECT (adjustment), "mem_size")))
return;
if (! (divided_mem_size = gtk_object_get_data (GTK_OBJECT (adjustment),
"divided_mem_size")))
return;
if (! (mem_size_unit = gtk_object_get_data (GTK_OBJECT (adjustment),
"mem_size_unit")))
return;
if (new_unit != *mem_size_unit)
{
divided_tile_cache_size =
divided_tile_cache_size * mem_size_unit / new_unit;
mem_size_unit = new_unit;
*divided_mem_size = *mem_size / new_unit;
*mem_size_unit = new_unit;
gtk_adjustment_set_value (GTK_ADJUSTMENT (tile_cache_size_adjustment),
(float)divided_tile_cache_size);
gtk_signal_handler_block_by_data (GTK_OBJECT (adjustment),
divided_mem_size);
gtk_adjustment_set_value (GTK_ADJUSTMENT (adjustment),
(float) *divided_mem_size);
gtk_signal_handler_unblock_by_data (GTK_OBJECT (adjustment),
divided_mem_size);
}
}
@ -752,10 +805,10 @@ static void
file_prefs_default_resolution_callback (GtkWidget *widget,
gpointer data)
{
static float xres = 0.0;
static float yres = 0.0;
float new_xres;
float new_yres;
static gdouble xres = 0.0;
static gdouble yres = 0.0;
gdouble new_xres;
gdouble new_yres;
new_xres = gimp_size_entry_get_refval (GIMP_SIZE_ENTRY (widget), 0);
new_yres = gimp_size_entry_get_refval (GIMP_SIZE_ENTRY (widget), 1);
@ -810,7 +863,11 @@ file_prefs_res_source_callback (GtkWidget *widget,
if (GTK_TOGGLE_BUTTON (widget)->active)
{
gdisplay_xserver_resolution (&monitor_xres, &monitor_yres);
gfloat xres, yres;
gdisplay_xserver_resolution (&xres, &yres);
monitor_xres = xres;
monitor_yres = yres;
using_xserver_resolution = TRUE;
}
else
@ -830,10 +887,10 @@ static void
file_prefs_monitor_resolution_callback (GtkWidget *widget,
gpointer data)
{
static float xres = 0.0;
static float yres = 0.0;
float new_xres;
float new_yres;
static gdouble xres = 0.0;
static gdouble yres = 0.0;
gdouble new_xres;
gdouble new_yres;
new_xres = gimp_size_entry_get_refval (GIMP_SIZE_ENTRY (widget), 0);
new_yres = gimp_size_entry_get_refval (GIMP_SIZE_ENTRY (widget), 1);
@ -1191,6 +1248,7 @@ gimp_table_attach_aligned (GtkTable *table,
label = gtk_label_new (text);
gtk_misc_set_alignment (GTK_MISC (label), xalign, yalign);
gtk_label_set_justify (GTK_LABEL (label), GTK_JUSTIFY_RIGHT);
gtk_table_attach (table, GTK_WIDGET (label), 0, 1, row, row + 1,
GTK_SHRINK | GTK_FILL, GTK_SHRINK | GTK_FILL, 0, 0);
gtk_widget_show (label);
@ -1199,7 +1257,7 @@ gimp_table_attach_aligned (GtkTable *table,
{
GtkWidget *alignment;
alignment = gtk_alignment_new (0.0, 0.5, 0.0, 0.0);
alignment = gtk_alignment_new (0.0, 1.0, 0.0, 0.0);
gtk_table_attach_defaults (table, alignment, 1, 2, row, row + 1);
gtk_widget_show (alignment);
gtk_container_add (GTK_CONTAINER (alignment), widget);
@ -1373,6 +1431,7 @@ file_pref_cmd_callback (GtkWidget *widget,
old_num_processors = num_processors;
old_image_title_format = file_prefs_strdup (image_title_format);
old_global_paint_options = global_paint_options;
old_max_new_image_size = max_new_image_size;
file_prefs_strset (&old_temp_path, edit_temp_path);
file_prefs_strset (&old_swap_path, edit_swap_path);
@ -1383,14 +1442,23 @@ file_pref_cmd_callback (GtkWidget *widget,
file_prefs_strset (&old_palette_path, edit_palette_path);
file_prefs_strset (&old_gradient_path, edit_gradient_path);
mem_size_unit = 1;
tile_cache_size_unit = 1;
for (i = 0; i < 3; i++)
{
if (edit_tile_cache_size % (mem_size_unit * 1024) != 0)
if (edit_tile_cache_size % (tile_cache_size_unit * 1024) != 0)
break;
mem_size_unit *= 1024;
tile_cache_size_unit *= 1024;
}
divided_tile_cache_size = edit_tile_cache_size / mem_size_unit;
divided_tile_cache_size = edit_tile_cache_size / tile_cache_size_unit;
max_new_image_size_unit = 1;
for (i = 0; i < 3; i++)
{
if (max_new_image_size % (max_new_image_size_unit * 1024) != 0)
break;
max_new_image_size_unit *= 1024;
}
divided_max_new_image_size = max_new_image_size / max_new_image_size_unit;
/* Create the dialog */
prefs_dlg =
@ -1466,8 +1534,10 @@ file_pref_cmd_callback (GtkWidget *widget,
0, default_xresolution, FALSE);
gimp_size_entry_set_resolution (GIMP_SIZE_ENTRY (default_size_sizeentry),
1, default_yresolution, FALSE);
gimp_size_entry_set_refval_boundaries (GIMP_SIZE_ENTRY (default_size_sizeentry), 0, 1, 32767);
gimp_size_entry_set_refval_boundaries (GIMP_SIZE_ENTRY (default_size_sizeentry), 1, 1, 32767);
gimp_size_entry_set_refval_boundaries
(GIMP_SIZE_ENTRY (default_size_sizeentry), 0, 1, 32767);
gimp_size_entry_set_refval_boundaries
(GIMP_SIZE_ENTRY (default_size_sizeentry), 1, 1, 32767);
gimp_size_entry_set_refval (GIMP_SIZE_ENTRY (default_size_sizeentry), 0,
default_width);
gimp_size_entry_set_refval (GIMP_SIZE_ENTRY (default_size_sizeentry), 1,
@ -1498,11 +1568,13 @@ file_pref_cmd_callback (GtkWidget *widget,
button = gimp_chain_button_new (GIMP_CHAIN_BOTTOM);
default_resolution_sizeentry =
gimp_size_entry_new (2, default_resolution_units, "%s",
gimp_size_entry_new (2, default_resolution_units, "Pixels/%s",
FALSE, FALSE, TRUE, 75,
GIMP_SIZE_ENTRY_UPDATE_RESOLUTION);
gimp_size_entry_set_refval_boundaries (GIMP_SIZE_ENTRY (default_resolution_sizeentry), 0, 1, 32767);
gimp_size_entry_set_refval_boundaries (GIMP_SIZE_ENTRY (default_resolution_sizeentry), 1, 1, 32767);
gimp_size_entry_set_refval_boundaries
(GIMP_SIZE_ENTRY (default_resolution_sizeentry), 0, 1, 32767);
gimp_size_entry_set_refval_boundaries
(GIMP_SIZE_ENTRY (default_resolution_sizeentry), 1, 1, 32767);
gimp_size_entry_set_refval (GIMP_SIZE_ENTRY (default_resolution_sizeentry),
0, default_xresolution);
gimp_size_entry_set_refval (GIMP_SIZE_ENTRY (default_resolution_sizeentry),
@ -1512,9 +1584,7 @@ file_pref_cmd_callback (GtkWidget *widget,
gimp_size_entry_attach_label (GIMP_SIZE_ENTRY (default_resolution_sizeentry),
_("Vertical"), 0, 2, 0.0);
gimp_size_entry_attach_label (GIMP_SIZE_ENTRY (default_resolution_sizeentry),
_("dpi"), 1, 3, 0.0);
gimp_size_entry_attach_label (GIMP_SIZE_ENTRY (default_resolution_sizeentry),
_("Pixels per "), 2, 3, 0.0);
_("dpi"), 1, 4, 0.0);
gtk_signal_connect (GTK_OBJECT (default_resolution_sizeentry),
"unit_changed",
(GtkSignalFunc)file_prefs_default_resolution_callback,
@ -1920,9 +1990,9 @@ file_pref_cmd_callback (GtkWidget *widget,
gtk_widget_show (button);
#ifdef ENABLE_MP
table = gtk_table_new (2, 2, FALSE);
table = gtk_table_new (3, 2, FALSE);
#else
table = gtk_table_new (1, 2, FALSE);
table = gtk_table_new (2, 2, FALSE);
#endif /* ENABLE_MP */
gtk_container_set_border_width (GTK_CONTAINER (table), 2);
gtk_table_set_row_spacings (GTK_TABLE (table), 2);
@ -1930,31 +2000,72 @@ file_pref_cmd_callback (GtkWidget *widget,
gtk_box_pack_start (GTK_BOX (vbox2), table, FALSE, FALSE, 0);
gtk_widget_show (table);
/* The tile cache size */
hbox = gtk_hbox_new (FALSE, 2);
spinbutton =
gimp_spin_button_new (&tile_cache_size_adjustment,
gimp_spin_button_new (&adjustment,
divided_tile_cache_size,
0.0, (4069.0 * 1024 * 1024), 1.0, 16.0, 0.0,
1.0, 0.0);
gtk_signal_connect (GTK_OBJECT (tile_cache_size_adjustment), "value_changed",
(GtkSignalFunc) file_prefs_int_adjustment_callback,
gtk_signal_connect (GTK_OBJECT (adjustment), "value_changed",
(GtkSignalFunc) file_prefs_mem_size_callback,
&divided_tile_cache_size);
gtk_box_pack_start (GTK_BOX (hbox), spinbutton, FALSE, FALSE, 0);
gtk_widget_show (spinbutton);
/* for the mem_size_unit callback */
gtk_object_set_data (GTK_OBJECT (adjustment), "mem_size",
&edit_tile_cache_size);
gtk_object_set_data (GTK_OBJECT (adjustment), "divided_mem_size",
&divided_tile_cache_size);
gtk_object_set_data (GTK_OBJECT (adjustment), "mem_size_unit",
&tile_cache_size_unit);
optionmenu =
gimp_option_menu_new (file_prefs_mem_size_unit_callback,
(gpointer) mem_size_unit,
_("Bytes"), (gpointer) 1, (gpointer) 1,
_("KiloBytes"), (gpointer) 1024, (gpointer) 1024,
_("MegaBytes"),
(gpointer) (1024*1024), (gpointer) (1024*1024),
(gpointer) tile_cache_size_unit,
_("Bytes"), adjustment, (gpointer) 1,
_("KiloBytes"), adjustment, (gpointer) 1024,
_("MegaBytes"), adjustment, (gpointer) (1024*1024),
NULL);
gtk_box_pack_start (GTK_BOX (hbox), optionmenu, FALSE, FALSE, 0);
gtk_widget_show (optionmenu);
gimp_table_attach_aligned (GTK_TABLE (table), 0,
_("Tile Cache Size:"), 1.0, 0.5, hbox, TRUE);
/* The maximum size of a new image */
hbox = gtk_hbox_new (FALSE, 2);
spinbutton =
gimp_spin_button_new (&adjustment,
divided_max_new_image_size,
0.0, (4069.0 * 1024 * 1024), 1.0, 16.0, 0.0,
1.0, 0.0);
gtk_signal_connect (GTK_OBJECT (adjustment), "value_changed",
(GtkSignalFunc) file_prefs_mem_size_callback,
&divided_max_new_image_size);
gtk_box_pack_start (GTK_BOX (hbox), spinbutton, FALSE, FALSE, 0);
gtk_widget_show (spinbutton);
/* for the mem_size_unit callback */
gtk_object_set_data (GTK_OBJECT (adjustment), "mem_size",
&max_new_image_size);
gtk_object_set_data (GTK_OBJECT (adjustment), "divided_mem_size",
&divided_max_new_image_size);
gtk_object_set_data (GTK_OBJECT (adjustment), "mem_size_unit",
&max_new_image_size_unit);
optionmenu =
gimp_option_menu_new (file_prefs_mem_size_unit_callback,
(gpointer) max_new_image_size_unit,
_("Bytes"), adjustment, (gpointer) 1,
_("KiloBytes"), adjustment, (gpointer) 1024,
_("MegaBytes"), adjustment, (gpointer) (1024*1024),
NULL);
gtk_box_pack_start (GTK_BOX (hbox), optionmenu, FALSE, FALSE, 0);
gtk_widget_show (optionmenu);
gimp_table_attach_aligned (GTK_TABLE (table), 1,
_("Maximum Image Size:"), 1.0, 0.5, hbox, TRUE);
#ifdef ENABLE_MP
spinbutton =
gimp_spin_button_new (&adjustment,
@ -1962,7 +2073,7 @@ file_pref_cmd_callback (GtkWidget *widget,
gtk_signal_connect (GTK_OBJECT (adjustment), "value_changed",
(GtkSignalFunc) file_prefs_int_adjustment_callback,
&num_processors);
gimp_table_attach_aligned (GTK_TABLE (table), 1,
gimp_table_attach_aligned (GTK_TABLE (table), 2,
_("Number of Processors to Use:"), 1.0, 0.5,
spinbutton, TRUE);
#endif /* ENABLE_MP */
@ -2094,8 +2205,8 @@ file_pref_cmd_callback (GtkWidget *widget,
gtk_widget_show (button);
{
float xres, yres;
char buf[80];
gfloat xres, yres;
gchar buf[80];
gdisplay_xserver_resolution (&xres, &yres);
@ -2120,10 +2231,12 @@ file_pref_cmd_callback (GtkWidget *widget,
button = gimp_chain_button_new (GIMP_CHAIN_BOTTOM);
monitor_resolution_sizeentry =
gimp_size_entry_new (2, UNIT_INCH, "%s", FALSE, FALSE, TRUE, 75,
gimp_size_entry_new (2, UNIT_INCH, "Pixels/%s", FALSE, FALSE, TRUE, 75,
GIMP_SIZE_ENTRY_UPDATE_RESOLUTION);
gimp_size_entry_set_refval_boundaries (GIMP_SIZE_ENTRY (monitor_resolution_sizeentry), 0, 1, 32767);
gimp_size_entry_set_refval_boundaries (GIMP_SIZE_ENTRY (monitor_resolution_sizeentry), 1, 1, 32767);
gimp_size_entry_set_refval_boundaries
(GIMP_SIZE_ENTRY (monitor_resolution_sizeentry), 0, 1, 32767);
gimp_size_entry_set_refval_boundaries
(GIMP_SIZE_ENTRY (monitor_resolution_sizeentry), 1, 1, 32767);
gimp_size_entry_set_refval (GIMP_SIZE_ENTRY (monitor_resolution_sizeentry),
0, monitor_xres);
gimp_size_entry_set_refval (GIMP_SIZE_ENTRY (monitor_resolution_sizeentry),
@ -2133,9 +2246,7 @@ file_pref_cmd_callback (GtkWidget *widget,
gimp_size_entry_attach_label (GIMP_SIZE_ENTRY (monitor_resolution_sizeentry),
_("Vertical"), 0, 2, 0.0);
gimp_size_entry_attach_label (GIMP_SIZE_ENTRY (monitor_resolution_sizeentry),
_("dpi"), 1, 3, 0.0);
gimp_size_entry_attach_label (GIMP_SIZE_ENTRY (monitor_resolution_sizeentry),
_("Pixels per "), 2, 3, 0.0);
_("dpi"), 1, 4, 0.0);
gtk_signal_connect (GTK_OBJECT (monitor_resolution_sizeentry),
"value_changed",
(GtkSignalFunc)file_prefs_monitor_resolution_callback,

View File

@ -102,6 +102,7 @@ resize_widget_new (ResizeType type,
GtkWidget *table;
GtkWidget *table2;
GtkWidget *hbox;
GtkWidget *hbox2;
GtkWidget *label;
GtkWidget *frame;
GtkWidget *spinbutton;
@ -459,9 +460,12 @@ resize_widget_new (ResizeType type,
gtk_widget_show (table);
/* frame to hold drawing area */
hbox2 = gtk_hbox_new (0, FALSE);
gtk_box_pack_start (GTK_BOX (vbox2), hbox2, FALSE, FALSE, 0);
frame = gtk_frame_new (NULL);
gtk_frame_set_shadow_type (GTK_FRAME (frame), GTK_SHADOW_IN);
gtk_box_pack_start (GTK_BOX (vbox2), frame, TRUE, FALSE, 0);
gtk_box_pack_start (GTK_BOX (hbox2), frame, TRUE, FALSE, 0);
private->drawing_area = gtk_drawing_area_new ();
gtk_drawing_area_size (GTK_DRAWING_AREA (private->drawing_area),
private->area_width, private->area_height);
@ -474,6 +478,7 @@ resize_widget_new (ResizeType type,
gtk_widget_show (private->drawing_area);
gtk_widget_show (frame);
gtk_widget_show (hbox2);
gtk_widget_show (vbox2);
gtk_widget_show (hbox);
}

View File

@ -196,6 +196,9 @@ pattern_select_new (gchar *title,
/* The action area */
action_items[0].user_data = psp;
action_items[1].user_data = psp;
if (title)
build_action_area (GTK_DIALOG (psp->shell), &action_items[1], 1, 0);
else
build_action_area (GTK_DIALOG (psp->shell), action_items, 2, 1);
gtk_widget_show (psp->options_box);

View File

@ -42,6 +42,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_mem_size_callback (GtkWidget *, gpointer);
static void file_prefs_mem_size_unit_callback (GtkWidget *, gpointer);
static void file_prefs_int_adjustment_callback (GtkAdjustment *, gpointer);
static void file_prefs_string_callback (GtkWidget *, gpointer);
@ -74,8 +75,8 @@ static int old_always_restore_session;
static int old_default_width;
static int old_default_height;
static GUnit old_default_units;
static float old_default_xresolution;
static float old_default_yresolution;
static double old_default_xresolution;
static double old_default_yresolution;
static GUnit old_default_resolution_units;
static int old_default_type;
static int old_stingy_memory_use;
@ -91,12 +92,13 @@ static char * old_brush_path;
static char * old_pattern_path;
static char * old_palette_path;
static char * old_gradient_path;
static float old_monitor_xres;
static float old_monitor_yres;
static double old_monitor_xres;
static double old_monitor_yres;
static int old_using_xserver_resolution;
static int old_num_processors;
static char * old_image_title_format;
static int old_global_paint_options;
static int old_max_new_image_size;
/* variables which can't be changed on the fly */
static int edit_stingy_memory_use;
@ -116,9 +118,11 @@ static char * edit_gradient_path = NULL;
static GtkWidget *prefs_dlg = NULL;
static GtkObject *tile_cache_size_adjustment = NULL;
static int divided_tile_cache_size;
static int mem_size_unit;
static int tile_cache_size_unit;
static int divided_max_new_image_size;
static int max_new_image_size_unit;
static GtkWidget *default_size_sizeentry = NULL;
static GtkWidget *default_resolution_sizeentry = NULL;
@ -204,8 +208,6 @@ static void
file_prefs_ok_callback (GtkWidget *widget,
GtkWidget *dlg)
{
edit_tile_cache_size = mem_size_unit * divided_tile_cache_size;
if (levels_of_undo < 0)
{
g_message (_("Error: Levels of undo must be zero or greater."));
@ -273,7 +275,6 @@ file_prefs_ok_callback (GtkWidget *widget,
gtk_widget_destroy (dlg);
prefs_dlg = NULL;
tile_cache_size_adjustment = NULL;
default_size_sizeentry = NULL;
default_resolution_sizeentry = NULL;
resolution_xserver_label = NULL;
@ -503,11 +504,19 @@ file_prefs_save_callback (GtkWidget *widget,
update = g_list_append (update, "global-paint-options");
remove = g_list_append (remove, "no-global-paint-options");
}
if (max_new_image_size != old_max_new_image_size)
update = g_list_append (update, "max-new-image-size");
save_gimprc (&update, &remove);
if (using_xserver_resolution)
gdisplay_xserver_resolution (&monitor_xres, &monitor_yres);
{
gfloat xres, yres;
gdisplay_xserver_resolution (&xres, &yres);
monitor_xres = xres;
monitor_yres = yres;
}
/* Restore variables which must not change */
stingy_memory_use = save_stingy_memory_use;
@ -539,7 +548,6 @@ file_prefs_cancel_callback (GtkWidget *widget,
{
gtk_widget_destroy (dlg);
prefs_dlg = NULL;
tile_cache_size_adjustment = NULL;
default_size_sizeentry = NULL;
default_resolution_sizeentry = NULL;
resolution_xserver_label = NULL;
@ -569,6 +577,7 @@ file_prefs_cancel_callback (GtkWidget *widget,
monitor_yres = old_monitor_yres;
using_xserver_resolution = old_using_xserver_resolution;
num_processors = old_num_processors;
max_new_image_size = old_max_new_image_size;
if (preview_size != old_preview_size)
{
@ -672,22 +681,66 @@ file_prefs_preview_size_callback (GtkWidget *widget,
layer_select_update_preview_size ();
}
static void
file_prefs_mem_size_callback (GtkWidget *widget,
gpointer data)
{
int *mem_size;
int *divided_mem_size;
int *mem_size_unit;
if (! (mem_size = gtk_object_get_data (GTK_OBJECT (widget), "mem_size")))
return;
if (! (divided_mem_size = gtk_object_get_data (GTK_OBJECT (widget),
"divided_mem_size")))
return;
if (! (mem_size_unit = gtk_object_get_data (GTK_OBJECT (widget),
"mem_size_unit")))
return;
*divided_mem_size = GTK_ADJUSTMENT (widget)->value;
*mem_size = *divided_mem_size * *mem_size_unit;
}
static void
file_prefs_mem_size_unit_callback (GtkWidget *widget,
gpointer data)
{
GtkObject *adjustment;
int new_unit;
int *mem_size;
int *divided_mem_size;
int *mem_size_unit;
new_unit = (int)data;
adjustment = GTK_OBJECT (data);
if (new_unit != mem_size_unit)
if (! (new_unit = (int) gtk_object_get_user_data (GTK_OBJECT (widget))))
return;
if (! (mem_size = gtk_object_get_data (GTK_OBJECT (adjustment), "mem_size")))
return;
if (! (divided_mem_size = gtk_object_get_data (GTK_OBJECT (adjustment),
"divided_mem_size")))
return;
if (! (mem_size_unit = gtk_object_get_data (GTK_OBJECT (adjustment),
"mem_size_unit")))
return;
if (new_unit != *mem_size_unit)
{
divided_tile_cache_size =
divided_tile_cache_size * mem_size_unit / new_unit;
mem_size_unit = new_unit;
*divided_mem_size = *mem_size / new_unit;
*mem_size_unit = new_unit;
gtk_adjustment_set_value (GTK_ADJUSTMENT (tile_cache_size_adjustment),
(float)divided_tile_cache_size);
gtk_signal_handler_block_by_data (GTK_OBJECT (adjustment),
divided_mem_size);
gtk_adjustment_set_value (GTK_ADJUSTMENT (adjustment),
(float) *divided_mem_size);
gtk_signal_handler_unblock_by_data (GTK_OBJECT (adjustment),
divided_mem_size);
}
}
@ -752,10 +805,10 @@ static void
file_prefs_default_resolution_callback (GtkWidget *widget,
gpointer data)
{
static float xres = 0.0;
static float yres = 0.0;
float new_xres;
float new_yres;
static gdouble xres = 0.0;
static gdouble yres = 0.0;
gdouble new_xres;
gdouble new_yres;
new_xres = gimp_size_entry_get_refval (GIMP_SIZE_ENTRY (widget), 0);
new_yres = gimp_size_entry_get_refval (GIMP_SIZE_ENTRY (widget), 1);
@ -810,7 +863,11 @@ file_prefs_res_source_callback (GtkWidget *widget,
if (GTK_TOGGLE_BUTTON (widget)->active)
{
gdisplay_xserver_resolution (&monitor_xres, &monitor_yres);
gfloat xres, yres;
gdisplay_xserver_resolution (&xres, &yres);
monitor_xres = xres;
monitor_yres = yres;
using_xserver_resolution = TRUE;
}
else
@ -830,10 +887,10 @@ static void
file_prefs_monitor_resolution_callback (GtkWidget *widget,
gpointer data)
{
static float xres = 0.0;
static float yres = 0.0;
float new_xres;
float new_yres;
static gdouble xres = 0.0;
static gdouble yres = 0.0;
gdouble new_xres;
gdouble new_yres;
new_xres = gimp_size_entry_get_refval (GIMP_SIZE_ENTRY (widget), 0);
new_yres = gimp_size_entry_get_refval (GIMP_SIZE_ENTRY (widget), 1);
@ -1191,6 +1248,7 @@ gimp_table_attach_aligned (GtkTable *table,
label = gtk_label_new (text);
gtk_misc_set_alignment (GTK_MISC (label), xalign, yalign);
gtk_label_set_justify (GTK_LABEL (label), GTK_JUSTIFY_RIGHT);
gtk_table_attach (table, GTK_WIDGET (label), 0, 1, row, row + 1,
GTK_SHRINK | GTK_FILL, GTK_SHRINK | GTK_FILL, 0, 0);
gtk_widget_show (label);
@ -1199,7 +1257,7 @@ gimp_table_attach_aligned (GtkTable *table,
{
GtkWidget *alignment;
alignment = gtk_alignment_new (0.0, 0.5, 0.0, 0.0);
alignment = gtk_alignment_new (0.0, 1.0, 0.0, 0.0);
gtk_table_attach_defaults (table, alignment, 1, 2, row, row + 1);
gtk_widget_show (alignment);
gtk_container_add (GTK_CONTAINER (alignment), widget);
@ -1373,6 +1431,7 @@ file_pref_cmd_callback (GtkWidget *widget,
old_num_processors = num_processors;
old_image_title_format = file_prefs_strdup (image_title_format);
old_global_paint_options = global_paint_options;
old_max_new_image_size = max_new_image_size;
file_prefs_strset (&old_temp_path, edit_temp_path);
file_prefs_strset (&old_swap_path, edit_swap_path);
@ -1383,14 +1442,23 @@ file_pref_cmd_callback (GtkWidget *widget,
file_prefs_strset (&old_palette_path, edit_palette_path);
file_prefs_strset (&old_gradient_path, edit_gradient_path);
mem_size_unit = 1;
tile_cache_size_unit = 1;
for (i = 0; i < 3; i++)
{
if (edit_tile_cache_size % (mem_size_unit * 1024) != 0)
if (edit_tile_cache_size % (tile_cache_size_unit * 1024) != 0)
break;
mem_size_unit *= 1024;
tile_cache_size_unit *= 1024;
}
divided_tile_cache_size = edit_tile_cache_size / mem_size_unit;
divided_tile_cache_size = edit_tile_cache_size / tile_cache_size_unit;
max_new_image_size_unit = 1;
for (i = 0; i < 3; i++)
{
if (max_new_image_size % (max_new_image_size_unit * 1024) != 0)
break;
max_new_image_size_unit *= 1024;
}
divided_max_new_image_size = max_new_image_size / max_new_image_size_unit;
/* Create the dialog */
prefs_dlg =
@ -1466,8 +1534,10 @@ file_pref_cmd_callback (GtkWidget *widget,
0, default_xresolution, FALSE);
gimp_size_entry_set_resolution (GIMP_SIZE_ENTRY (default_size_sizeentry),
1, default_yresolution, FALSE);
gimp_size_entry_set_refval_boundaries (GIMP_SIZE_ENTRY (default_size_sizeentry), 0, 1, 32767);
gimp_size_entry_set_refval_boundaries (GIMP_SIZE_ENTRY (default_size_sizeentry), 1, 1, 32767);
gimp_size_entry_set_refval_boundaries
(GIMP_SIZE_ENTRY (default_size_sizeentry), 0, 1, 32767);
gimp_size_entry_set_refval_boundaries
(GIMP_SIZE_ENTRY (default_size_sizeentry), 1, 1, 32767);
gimp_size_entry_set_refval (GIMP_SIZE_ENTRY (default_size_sizeentry), 0,
default_width);
gimp_size_entry_set_refval (GIMP_SIZE_ENTRY (default_size_sizeentry), 1,
@ -1498,11 +1568,13 @@ file_pref_cmd_callback (GtkWidget *widget,
button = gimp_chain_button_new (GIMP_CHAIN_BOTTOM);
default_resolution_sizeentry =
gimp_size_entry_new (2, default_resolution_units, "%s",
gimp_size_entry_new (2, default_resolution_units, "Pixels/%s",
FALSE, FALSE, TRUE, 75,
GIMP_SIZE_ENTRY_UPDATE_RESOLUTION);
gimp_size_entry_set_refval_boundaries (GIMP_SIZE_ENTRY (default_resolution_sizeentry), 0, 1, 32767);
gimp_size_entry_set_refval_boundaries (GIMP_SIZE_ENTRY (default_resolution_sizeentry), 1, 1, 32767);
gimp_size_entry_set_refval_boundaries
(GIMP_SIZE_ENTRY (default_resolution_sizeentry), 0, 1, 32767);
gimp_size_entry_set_refval_boundaries
(GIMP_SIZE_ENTRY (default_resolution_sizeentry), 1, 1, 32767);
gimp_size_entry_set_refval (GIMP_SIZE_ENTRY (default_resolution_sizeentry),
0, default_xresolution);
gimp_size_entry_set_refval (GIMP_SIZE_ENTRY (default_resolution_sizeentry),
@ -1512,9 +1584,7 @@ file_pref_cmd_callback (GtkWidget *widget,
gimp_size_entry_attach_label (GIMP_SIZE_ENTRY (default_resolution_sizeentry),
_("Vertical"), 0, 2, 0.0);
gimp_size_entry_attach_label (GIMP_SIZE_ENTRY (default_resolution_sizeentry),
_("dpi"), 1, 3, 0.0);
gimp_size_entry_attach_label (GIMP_SIZE_ENTRY (default_resolution_sizeentry),
_("Pixels per "), 2, 3, 0.0);
_("dpi"), 1, 4, 0.0);
gtk_signal_connect (GTK_OBJECT (default_resolution_sizeentry),
"unit_changed",
(GtkSignalFunc)file_prefs_default_resolution_callback,
@ -1920,9 +1990,9 @@ file_pref_cmd_callback (GtkWidget *widget,
gtk_widget_show (button);
#ifdef ENABLE_MP
table = gtk_table_new (2, 2, FALSE);
table = gtk_table_new (3, 2, FALSE);
#else
table = gtk_table_new (1, 2, FALSE);
table = gtk_table_new (2, 2, FALSE);
#endif /* ENABLE_MP */
gtk_container_set_border_width (GTK_CONTAINER (table), 2);
gtk_table_set_row_spacings (GTK_TABLE (table), 2);
@ -1930,31 +2000,72 @@ file_pref_cmd_callback (GtkWidget *widget,
gtk_box_pack_start (GTK_BOX (vbox2), table, FALSE, FALSE, 0);
gtk_widget_show (table);
/* The tile cache size */
hbox = gtk_hbox_new (FALSE, 2);
spinbutton =
gimp_spin_button_new (&tile_cache_size_adjustment,
gimp_spin_button_new (&adjustment,
divided_tile_cache_size,
0.0, (4069.0 * 1024 * 1024), 1.0, 16.0, 0.0,
1.0, 0.0);
gtk_signal_connect (GTK_OBJECT (tile_cache_size_adjustment), "value_changed",
(GtkSignalFunc) file_prefs_int_adjustment_callback,
gtk_signal_connect (GTK_OBJECT (adjustment), "value_changed",
(GtkSignalFunc) file_prefs_mem_size_callback,
&divided_tile_cache_size);
gtk_box_pack_start (GTK_BOX (hbox), spinbutton, FALSE, FALSE, 0);
gtk_widget_show (spinbutton);
/* for the mem_size_unit callback */
gtk_object_set_data (GTK_OBJECT (adjustment), "mem_size",
&edit_tile_cache_size);
gtk_object_set_data (GTK_OBJECT (adjustment), "divided_mem_size",
&divided_tile_cache_size);
gtk_object_set_data (GTK_OBJECT (adjustment), "mem_size_unit",
&tile_cache_size_unit);
optionmenu =
gimp_option_menu_new (file_prefs_mem_size_unit_callback,
(gpointer) mem_size_unit,
_("Bytes"), (gpointer) 1, (gpointer) 1,
_("KiloBytes"), (gpointer) 1024, (gpointer) 1024,
_("MegaBytes"),
(gpointer) (1024*1024), (gpointer) (1024*1024),
(gpointer) tile_cache_size_unit,
_("Bytes"), adjustment, (gpointer) 1,
_("KiloBytes"), adjustment, (gpointer) 1024,
_("MegaBytes"), adjustment, (gpointer) (1024*1024),
NULL);
gtk_box_pack_start (GTK_BOX (hbox), optionmenu, FALSE, FALSE, 0);
gtk_widget_show (optionmenu);
gimp_table_attach_aligned (GTK_TABLE (table), 0,
_("Tile Cache Size:"), 1.0, 0.5, hbox, TRUE);
/* The maximum size of a new image */
hbox = gtk_hbox_new (FALSE, 2);
spinbutton =
gimp_spin_button_new (&adjustment,
divided_max_new_image_size,
0.0, (4069.0 * 1024 * 1024), 1.0, 16.0, 0.0,
1.0, 0.0);
gtk_signal_connect (GTK_OBJECT (adjustment), "value_changed",
(GtkSignalFunc) file_prefs_mem_size_callback,
&divided_max_new_image_size);
gtk_box_pack_start (GTK_BOX (hbox), spinbutton, FALSE, FALSE, 0);
gtk_widget_show (spinbutton);
/* for the mem_size_unit callback */
gtk_object_set_data (GTK_OBJECT (adjustment), "mem_size",
&max_new_image_size);
gtk_object_set_data (GTK_OBJECT (adjustment), "divided_mem_size",
&divided_max_new_image_size);
gtk_object_set_data (GTK_OBJECT (adjustment), "mem_size_unit",
&max_new_image_size_unit);
optionmenu =
gimp_option_menu_new (file_prefs_mem_size_unit_callback,
(gpointer) max_new_image_size_unit,
_("Bytes"), adjustment, (gpointer) 1,
_("KiloBytes"), adjustment, (gpointer) 1024,
_("MegaBytes"), adjustment, (gpointer) (1024*1024),
NULL);
gtk_box_pack_start (GTK_BOX (hbox), optionmenu, FALSE, FALSE, 0);
gtk_widget_show (optionmenu);
gimp_table_attach_aligned (GTK_TABLE (table), 1,
_("Maximum Image Size:"), 1.0, 0.5, hbox, TRUE);
#ifdef ENABLE_MP
spinbutton =
gimp_spin_button_new (&adjustment,
@ -1962,7 +2073,7 @@ file_pref_cmd_callback (GtkWidget *widget,
gtk_signal_connect (GTK_OBJECT (adjustment), "value_changed",
(GtkSignalFunc) file_prefs_int_adjustment_callback,
&num_processors);
gimp_table_attach_aligned (GTK_TABLE (table), 1,
gimp_table_attach_aligned (GTK_TABLE (table), 2,
_("Number of Processors to Use:"), 1.0, 0.5,
spinbutton, TRUE);
#endif /* ENABLE_MP */
@ -2094,8 +2205,8 @@ file_pref_cmd_callback (GtkWidget *widget,
gtk_widget_show (button);
{
float xres, yres;
char buf[80];
gfloat xres, yres;
gchar buf[80];
gdisplay_xserver_resolution (&xres, &yres);
@ -2120,10 +2231,12 @@ file_pref_cmd_callback (GtkWidget *widget,
button = gimp_chain_button_new (GIMP_CHAIN_BOTTOM);
monitor_resolution_sizeentry =
gimp_size_entry_new (2, UNIT_INCH, "%s", FALSE, FALSE, TRUE, 75,
gimp_size_entry_new (2, UNIT_INCH, "Pixels/%s", FALSE, FALSE, TRUE, 75,
GIMP_SIZE_ENTRY_UPDATE_RESOLUTION);
gimp_size_entry_set_refval_boundaries (GIMP_SIZE_ENTRY (monitor_resolution_sizeentry), 0, 1, 32767);
gimp_size_entry_set_refval_boundaries (GIMP_SIZE_ENTRY (monitor_resolution_sizeentry), 1, 1, 32767);
gimp_size_entry_set_refval_boundaries
(GIMP_SIZE_ENTRY (monitor_resolution_sizeentry), 0, 1, 32767);
gimp_size_entry_set_refval_boundaries
(GIMP_SIZE_ENTRY (monitor_resolution_sizeentry), 1, 1, 32767);
gimp_size_entry_set_refval (GIMP_SIZE_ENTRY (monitor_resolution_sizeentry),
0, monitor_xres);
gimp_size_entry_set_refval (GIMP_SIZE_ENTRY (monitor_resolution_sizeentry),
@ -2133,9 +2246,7 @@ file_pref_cmd_callback (GtkWidget *widget,
gimp_size_entry_attach_label (GIMP_SIZE_ENTRY (monitor_resolution_sizeentry),
_("Vertical"), 0, 2, 0.0);
gimp_size_entry_attach_label (GIMP_SIZE_ENTRY (monitor_resolution_sizeentry),
_("dpi"), 1, 3, 0.0);
gimp_size_entry_attach_label (GIMP_SIZE_ENTRY (monitor_resolution_sizeentry),
_("Pixels per "), 2, 3, 0.0);
_("dpi"), 1, 4, 0.0);
gtk_signal_connect (GTK_OBJECT (monitor_resolution_sizeentry),
"value_changed",
(GtkSignalFunc)file_prefs_monitor_resolution_callback,

View File

@ -102,6 +102,7 @@ resize_widget_new (ResizeType type,
GtkWidget *table;
GtkWidget *table2;
GtkWidget *hbox;
GtkWidget *hbox2;
GtkWidget *label;
GtkWidget *frame;
GtkWidget *spinbutton;
@ -459,9 +460,12 @@ resize_widget_new (ResizeType type,
gtk_widget_show (table);
/* frame to hold drawing area */
hbox2 = gtk_hbox_new (0, FALSE);
gtk_box_pack_start (GTK_BOX (vbox2), hbox2, FALSE, FALSE, 0);
frame = gtk_frame_new (NULL);
gtk_frame_set_shadow_type (GTK_FRAME (frame), GTK_SHADOW_IN);
gtk_box_pack_start (GTK_BOX (vbox2), frame, TRUE, FALSE, 0);
gtk_box_pack_start (GTK_BOX (hbox2), frame, TRUE, FALSE, 0);
private->drawing_area = gtk_drawing_area_new ();
gtk_drawing_area_size (GTK_DRAWING_AREA (private->drawing_area),
private->area_width, private->area_height);
@ -474,6 +478,7 @@ resize_widget_new (ResizeType type,
gtk_widget_show (private->drawing_area);
gtk_widget_show (frame);
gtk_widget_show (hbox2);
gtk_widget_show (vbox2);
gtk_widget_show (hbox);
}

View File

@ -204,7 +204,7 @@ text_options_new (void)
gtk_box_pack_start (GTK_BOX (vbox), sep, FALSE, FALSE, 0);
gtk_widget_show (sep);
/* antialias toggle */
/* the dynamic text toggle */
options->use_dyntext_w =
gtk_check_button_new_with_label (_("Use Dynamic Text"));
gtk_signal_connect (GTK_OBJECT (options->use_dyntext_w), "toggled",
@ -267,6 +267,7 @@ void
tools_free_text (Tool *tool)
{
g_free (tool->private);
the_text_tool = NULL;
if (text_tool_shell && GTK_WIDGET_VISIBLE (text_tool_shell))
gtk_widget_hide (text_tool_shell);
@ -396,7 +397,6 @@ text_control (Tool *tool,
case HALT :
if (text_tool_shell && GTK_WIDGET_VISIBLE (text_tool_shell))
gtk_widget_hide (text_tool_shell);
the_text_tool = NULL;
break;
}
}
@ -880,7 +880,7 @@ text_field_edges(char *fontname,
* *fontname is replaced by a fresh allocation of the correct size.
*/
static void
text_size_multiply(char **fontname,
text_size_multiply (char **fontname,
int mul)
{
char *pixel_str;

View File

@ -204,7 +204,7 @@ text_options_new (void)
gtk_box_pack_start (GTK_BOX (vbox), sep, FALSE, FALSE, 0);
gtk_widget_show (sep);
/* antialias toggle */
/* the dynamic text toggle */
options->use_dyntext_w =
gtk_check_button_new_with_label (_("Use Dynamic Text"));
gtk_signal_connect (GTK_OBJECT (options->use_dyntext_w), "toggled",
@ -267,6 +267,7 @@ void
tools_free_text (Tool *tool)
{
g_free (tool->private);
the_text_tool = NULL;
if (text_tool_shell && GTK_WIDGET_VISIBLE (text_tool_shell))
gtk_widget_hide (text_tool_shell);
@ -396,7 +397,6 @@ text_control (Tool *tool,
case HALT :
if (text_tool_shell && GTK_WIDGET_VISIBLE (text_tool_shell))
gtk_widget_hide (text_tool_shell);
the_text_tool = NULL;
break;
}
}
@ -880,7 +880,7 @@ text_field_edges(char *fontname,
* *fontname is replaced by a fresh allocation of the correct size.
*/
static void
text_size_multiply(char **fontname,
text_size_multiply (char **fontname,
int mul)
{
char *pixel_str;

View File

@ -204,7 +204,7 @@ text_options_new (void)
gtk_box_pack_start (GTK_BOX (vbox), sep, FALSE, FALSE, 0);
gtk_widget_show (sep);
/* antialias toggle */
/* the dynamic text toggle */
options->use_dyntext_w =
gtk_check_button_new_with_label (_("Use Dynamic Text"));
gtk_signal_connect (GTK_OBJECT (options->use_dyntext_w), "toggled",
@ -267,6 +267,7 @@ void
tools_free_text (Tool *tool)
{
g_free (tool->private);
the_text_tool = NULL;
if (text_tool_shell && GTK_WIDGET_VISIBLE (text_tool_shell))
gtk_widget_hide (text_tool_shell);
@ -396,7 +397,6 @@ text_control (Tool *tool,
case HALT :
if (text_tool_shell && GTK_WIDGET_VISIBLE (text_tool_shell))
gtk_widget_hide (text_tool_shell);
the_text_tool = NULL;
break;
}
}
@ -880,7 +880,7 @@ text_field_edges(char *fontname,
* *fontname is replaced by a fresh allocation of the correct size.
*/
static void
text_size_multiply(char **fontname,
text_size_multiply (char **fontname,
int mul)
{
char *pixel_str;

View File

@ -93,7 +93,12 @@ libgimpui_la_SOURCES = \
gimpmenu.c \
gimpbrushmenu.c \
gimpgradientmenu.c \
gimppatternmenu.c
gimppatternmenu.c \
gimpchainbutton.c \
gimpfileselection.c \
gimppatheditor.c \
gimpsizeentry.c \
gimpunitmenu.c
gimpinclude_HEADERS = \
color_selector.h \

View File

@ -83,6 +83,9 @@ gimp_file_selection_class_destroy (GtkObject *object)
if (gfs->file_selection)
gtk_widget_destroy (gfs->file_selection);
if (gfs->title)
g_free (gfs->title);
if (GTK_OBJECT_CLASS (parent_class)->destroy)
(* GTK_OBJECT_CLASS (parent_class)->destroy) (object);
}
@ -118,14 +121,17 @@ gimp_file_selection_init (GimpFileSelection *gfs)
gfs->file_exists = FALSE;
gfs->check_valid = FALSE;
gtk_box_set_spacing (GTK_BOX (gfs), 2);
gtk_box_set_homogeneous (GTK_BOX (gfs), FALSE);
gfs->browse_button = gtk_button_new_with_label (" ... ");
gtk_box_pack_end (GTK_BOX (gfs), gfs->browse_button, FALSE, TRUE, 0);
gtk_box_pack_end (GTK_BOX (gfs), gfs->browse_button, FALSE, FALSE, 0);
gtk_signal_connect (GTK_OBJECT(gfs->browse_button), "clicked",
GTK_SIGNAL_FUNC(gimp_file_selection_browse_callback), gfs);
gtk_widget_show (gfs->browse_button);
gfs->entry = gtk_entry_new ();
gtk_box_pack_end (GTK_BOX (gfs), gfs->entry, TRUE, TRUE, 2);
gtk_box_pack_end (GTK_BOX (gfs), gfs->entry, TRUE, TRUE, 0);
gtk_signal_connect (GTK_OBJECT(gfs->entry), "activate",
(GtkSignalFunc) gimp_file_selection_entry_callback, gfs);
gtk_signal_connect (GTK_OBJECT(gfs->entry), "focus_out_event",
@ -177,7 +183,7 @@ gimp_file_selection_new (gchar *title,
gfs->title = g_strdup (title);
gfs->dir_only = dir_only;
gfs->check_valid = check_valid;
gtk_entry_set_text (GTK_ENTRY (gfs->entry), filename);
gimp_file_selection_set_filename (gfs, filename);
return GTK_WIDGET (gfs);
}
@ -274,6 +280,8 @@ gimp_file_selection_entry_callback (GtkWidget *widget,
gimp_file_selection_check_filename (gfs);
gtk_entry_set_position (GTK_ENTRY (gfs->entry), -1);
gtk_signal_emit (GTK_OBJECT (gfs),
gimp_file_selection_signals[GFS_FILENAME_CHANGED_SIGNAL]);
}

View File

@ -25,7 +25,7 @@
/* pixel sizes
*/
#define GIMP_MIN_IMAGE_SIZE 1
#define GIMP_MAX_IMAGE_SIZE 65536
#define GIMP_MAX_IMAGE_SIZE 16777216
/* dots per inch
*/

View File

@ -183,7 +183,7 @@ gimp_size_entry_new (gint number_of_fields,
GimpSizeEntry *gse;
gint i;
g_return_val_if_fail ((number_of_fields > 0) && (number_of_fields <= 16),
g_return_val_if_fail ((number_of_fields >= 0) && (number_of_fields <= 16),
NULL);
gse = gtk_type_new (gimp_size_entry_get_type ());

View File

@ -25,7 +25,7 @@
/* pixel sizes
*/
#define GIMP_MIN_IMAGE_SIZE 1
#define GIMP_MAX_IMAGE_SIZE 65536
#define GIMP_MAX_IMAGE_SIZE 16777216
/* dots per inch
*/

View File

@ -83,6 +83,9 @@ gimp_file_selection_class_destroy (GtkObject *object)
if (gfs->file_selection)
gtk_widget_destroy (gfs->file_selection);
if (gfs->title)
g_free (gfs->title);
if (GTK_OBJECT_CLASS (parent_class)->destroy)
(* GTK_OBJECT_CLASS (parent_class)->destroy) (object);
}
@ -118,14 +121,17 @@ gimp_file_selection_init (GimpFileSelection *gfs)
gfs->file_exists = FALSE;
gfs->check_valid = FALSE;
gtk_box_set_spacing (GTK_BOX (gfs), 2);
gtk_box_set_homogeneous (GTK_BOX (gfs), FALSE);
gfs->browse_button = gtk_button_new_with_label (" ... ");
gtk_box_pack_end (GTK_BOX (gfs), gfs->browse_button, FALSE, TRUE, 0);
gtk_box_pack_end (GTK_BOX (gfs), gfs->browse_button, FALSE, FALSE, 0);
gtk_signal_connect (GTK_OBJECT(gfs->browse_button), "clicked",
GTK_SIGNAL_FUNC(gimp_file_selection_browse_callback), gfs);
gtk_widget_show (gfs->browse_button);
gfs->entry = gtk_entry_new ();
gtk_box_pack_end (GTK_BOX (gfs), gfs->entry, TRUE, TRUE, 2);
gtk_box_pack_end (GTK_BOX (gfs), gfs->entry, TRUE, TRUE, 0);
gtk_signal_connect (GTK_OBJECT(gfs->entry), "activate",
(GtkSignalFunc) gimp_file_selection_entry_callback, gfs);
gtk_signal_connect (GTK_OBJECT(gfs->entry), "focus_out_event",
@ -177,7 +183,7 @@ gimp_file_selection_new (gchar *title,
gfs->title = g_strdup (title);
gfs->dir_only = dir_only;
gfs->check_valid = check_valid;
gtk_entry_set_text (GTK_ENTRY (gfs->entry), filename);
gimp_file_selection_set_filename (gfs, filename);
return GTK_WIDGET (gfs);
}
@ -274,6 +280,8 @@ gimp_file_selection_entry_callback (GtkWidget *widget,
gimp_file_selection_check_filename (gfs);
gtk_entry_set_position (GTK_ENTRY (gfs->entry), -1);
gtk_signal_emit (GTK_OBJECT (gfs),
gimp_file_selection_signals[GFS_FILENAME_CHANGED_SIGNAL]);
}

View File

@ -83,6 +83,9 @@ gimp_file_selection_class_destroy (GtkObject *object)
if (gfs->file_selection)
gtk_widget_destroy (gfs->file_selection);
if (gfs->title)
g_free (gfs->title);
if (GTK_OBJECT_CLASS (parent_class)->destroy)
(* GTK_OBJECT_CLASS (parent_class)->destroy) (object);
}
@ -118,14 +121,17 @@ gimp_file_selection_init (GimpFileSelection *gfs)
gfs->file_exists = FALSE;
gfs->check_valid = FALSE;
gtk_box_set_spacing (GTK_BOX (gfs), 2);
gtk_box_set_homogeneous (GTK_BOX (gfs), FALSE);
gfs->browse_button = gtk_button_new_with_label (" ... ");
gtk_box_pack_end (GTK_BOX (gfs), gfs->browse_button, FALSE, TRUE, 0);
gtk_box_pack_end (GTK_BOX (gfs), gfs->browse_button, FALSE, FALSE, 0);
gtk_signal_connect (GTK_OBJECT(gfs->browse_button), "clicked",
GTK_SIGNAL_FUNC(gimp_file_selection_browse_callback), gfs);
gtk_widget_show (gfs->browse_button);
gfs->entry = gtk_entry_new ();
gtk_box_pack_end (GTK_BOX (gfs), gfs->entry, TRUE, TRUE, 2);
gtk_box_pack_end (GTK_BOX (gfs), gfs->entry, TRUE, TRUE, 0);
gtk_signal_connect (GTK_OBJECT(gfs->entry), "activate",
(GtkSignalFunc) gimp_file_selection_entry_callback, gfs);
gtk_signal_connect (GTK_OBJECT(gfs->entry), "focus_out_event",
@ -177,7 +183,7 @@ gimp_file_selection_new (gchar *title,
gfs->title = g_strdup (title);
gfs->dir_only = dir_only;
gfs->check_valid = check_valid;
gtk_entry_set_text (GTK_ENTRY (gfs->entry), filename);
gimp_file_selection_set_filename (gfs, filename);
return GTK_WIDGET (gfs);
}
@ -274,6 +280,8 @@ gimp_file_selection_entry_callback (GtkWidget *widget,
gimp_file_selection_check_filename (gfs);
gtk_entry_set_position (GTK_ENTRY (gfs->entry), -1);
gtk_signal_emit (GTK_OBJECT (gfs),
gimp_file_selection_signals[GFS_FILENAME_CHANGED_SIGNAL]);
}

View File

@ -183,7 +183,7 @@ gimp_size_entry_new (gint number_of_fields,
GimpSizeEntry *gse;
gint i;
g_return_val_if_fail ((number_of_fields > 0) && (number_of_fields <= 16),
g_return_val_if_fail ((number_of_fields >= 0) && (number_of_fields <= 16),
NULL);
gse = gtk_type_new (gimp_size_entry_get_type ());

View File

@ -26,6 +26,7 @@
#include "gtk/gtk.h"
#include "libgimp/gimp.h"
#include "libgimp/gimpui.h"
#include "libgimp/gimpfileselection.h"
#include "siod.h"
#include "script-fu-scripts.h"
@ -71,8 +72,7 @@ typedef struct
typedef struct
{
GtkWidget *preview;
GtkWidget *dialog;
GtkWidget *fileselection;
gchar *filename;
} SFFilename;
@ -149,8 +149,6 @@ static void script_fu_disable_cc (gint err_msg);
static void script_fu_interface (SFScript *script);
static void script_fu_color_preview (GtkWidget *preview,
gdouble *color);
static void script_fu_file_preview (GtkWidget *preview,
gchar *fontname);
static void script_fu_font_preview (GtkWidget *preview,
gchar *fontname);
static void script_fu_cleanup_widgets (SFScript *script);
@ -175,14 +173,7 @@ static void script_fu_color_preview_cancel (GtkWidget *widget,
static gint script_fu_color_preview_delete (GtkWidget *widget,
GdkEvent *event,
gpointer data);
static void script_fu_file_preview_callback (GtkWidget *widget,
gpointer data);
static void script_fu_file_dialog_ok (GtkWidget *widget,
gpointer data);
static void script_fu_file_dialog_cancel (GtkWidget *widget,
gpointer data);
static gint script_fu_file_dialog_delete (GtkWidget *widget,
GdkEvent *event,
static void script_fu_file_selection_callback(GtkWidget *widget,
gpointer data);
static void script_fu_font_preview_callback (GtkWidget *widget,
gpointer data);
@ -602,8 +593,7 @@ script_fu_add_script (LISP a)
return my_err ("script-fu-register: filename defaults must be string values", NIL);
script->arg_defaults[i].sfa_file.filename = g_strdup (get_c_string (car (a)));
script->arg_values[i].sfa_file.filename = g_strdup (script->arg_defaults[i].sfa_file.filename);
script->arg_values[i].sfa_file.preview = NULL;
script->arg_values[i].sfa_file.dialog = NULL;
script->arg_values[i].sfa_file.fileselection = NULL;
args[i + 1].type = PARAM_STRING;
args[i + 1].name = "filename";
@ -1239,18 +1229,15 @@ script_fu_interface (SFScript *script)
break;
case SF_FILENAME:
script->args_widgets[i] = gtk_button_new();
script->arg_values[i].sfa_file.preview = gtk_label_new ("");
gtk_widget_set_usize (script->args_widgets[i], TEXT_WIDTH, 0);
gtk_container_add (GTK_CONTAINER (script->args_widgets[i]),
script->arg_values[i].sfa_file.preview);
gtk_widget_show (script->arg_values[i].sfa_file.preview);
script->args_widgets[i] =
gimp_file_selection_new ("Script-Fu File Selection",
script->arg_values[i].sfa_file.filename,
FALSE, TRUE);
script->arg_values[i].sfa_file.fileselection = script->args_widgets[i];
script_fu_file_preview (script->arg_values[i].sfa_file.preview,
script->arg_values[i].sfa_file.filename);
gtk_signal_connect (GTK_OBJECT (script->args_widgets[i]), "clicked",
(GtkSignalFunc) script_fu_file_preview_callback,
gtk_signal_connect (GTK_OBJECT (script->args_widgets[i]),
"filename_changed",
(GtkSignalFunc) script_fu_file_selection_callback,
&script->arg_values[i].sfa_file);
break;
@ -1444,20 +1431,6 @@ script_fu_brush_preview(char * name, /* Name */
brush->paint_mode = paint_mode;
}
static void
script_fu_file_preview (GtkWidget *preview,
gchar *data)
{
if (data == NULL)
return;
gtk_label_set_text (GTK_LABEL (preview), g_basename((gchar *) data));
}
static void
script_fu_font_preview (GtkWidget *preview,
gchar *data)
@ -1518,11 +1491,6 @@ script_fu_cleanup_widgets (SFScript *script)
}
break;
case SF_FILENAME:
if (script->arg_values[i].sfa_file.dialog != NULL)
{
gtk_widget_destroy (script->arg_values[i].sfa_file.dialog);
script->arg_values[i].sfa_file.dialog = NULL;
}
break;
case SF_FONT:
if (script->arg_values[i].sfa_font.dialog != NULL)
@ -1926,12 +1894,7 @@ script_fu_reset_callback (GtkWidget *widget,
case SF_FILENAME:
g_free (script->arg_values[i].sfa_file.filename);
script->arg_values[i].sfa_file.filename = g_strdup (script->arg_defaults[i].sfa_file.filename);
if (script->arg_values[i].sfa_file.dialog)
{
gtk_file_selection_set_filename (GTK_FILE_SELECTION (script->arg_values[i].sfa_file.dialog), script->arg_values[i].sfa_file.filename);
}
script_fu_file_preview (script->arg_values[i].sfa_file.preview,
script->arg_values[i].sfa_file.filename);
gimp_file_selection_set_filename (GIMP_FILE_SELECTION (script->arg_values[i].sfa_file.fileselection), script->arg_values[i].sfa_file.filename);
break;
case SF_FONT:
g_free (script->arg_values[i].sfa_font.fontname);
@ -2068,76 +2031,19 @@ script_fu_color_preview_delete (GtkWidget *widget,
}
static void
script_fu_file_preview_callback (GtkWidget *widget,
script_fu_file_selection_callback (GtkWidget *widget,
gpointer data)
{
GtkFileSelection *fs;
SFFilename *file;
file = (SFFilename *) data;
if (!file->dialog)
{
file->dialog = gtk_file_selection_new ("Script-Fu File Selection");
fs = GTK_FILE_SELECTION (file->dialog);
gtk_signal_connect (GTK_OBJECT (fs->ok_button), "clicked",
(GtkSignalFunc) script_fu_file_dialog_ok,
file);
gtk_signal_connect (GTK_OBJECT (fs), "delete_event",
(GtkSignalFunc) script_fu_file_dialog_delete,
file);
gtk_signal_connect (GTK_OBJECT (fs->cancel_button), "clicked",
(GtkSignalFunc) script_fu_file_dialog_cancel,
file);
}
else
fs = GTK_FILE_SELECTION (file->dialog);
gtk_file_selection_set_filename (GTK_FILE_SELECTION (fs), file->filename);
gtk_window_position (GTK_WINDOW (file->dialog), GTK_WIN_POS_MOUSE);
gtk_widget_show (file->dialog);
}
static void
script_fu_file_dialog_ok (GtkWidget *widget,
gpointer data)
{
SFFilename *file;
gchar *filename;
file = (SFFilename *) data;
filename = gtk_file_selection_get_filename (GTK_FILE_SELECTION (file->dialog));
if (filename != NULL)
{
if (file->filename)
g_free (file->filename);
file->filename = g_strdup(filename);
}
gtk_widget_hide (file->dialog);
script_fu_file_preview (file->preview, file->filename);
file->filename = gimp_file_selection_get_filename (GIMP_FILE_SELECTION (file->fileselection));
}
static void
script_fu_file_dialog_cancel (GtkWidget *widget,
gpointer data)
{
SFFilename *file;
file = (SFFilename *) data;
gtk_widget_hide (file->dialog);
}
static gint
script_fu_file_dialog_delete (GtkWidget *widget,
GdkEvent *event,
gpointer data)
{
script_fu_file_dialog_cancel (widget, data);
return TRUE;
}
static void
script_fu_font_preview_callback (GtkWidget *widget,
gpointer data)
@ -2229,9 +2135,3 @@ script_fu_about_dialog_delete (GtkWidget *widget,
script_fu_about_dialog_close (widget, data);
return TRUE;
}

View File

@ -26,6 +26,7 @@
#include "gtk/gtk.h"
#include "libgimp/gimp.h"
#include "libgimp/gimpui.h"
#include "libgimp/gimpfileselection.h"
#include "siod.h"
#include "script-fu-scripts.h"
@ -71,8 +72,7 @@ typedef struct
typedef struct
{
GtkWidget *preview;
GtkWidget *dialog;
GtkWidget *fileselection;
gchar *filename;
} SFFilename;
@ -149,8 +149,6 @@ static void script_fu_disable_cc (gint err_msg);
static void script_fu_interface (SFScript *script);
static void script_fu_color_preview (GtkWidget *preview,
gdouble *color);
static void script_fu_file_preview (GtkWidget *preview,
gchar *fontname);
static void script_fu_font_preview (GtkWidget *preview,
gchar *fontname);
static void script_fu_cleanup_widgets (SFScript *script);
@ -175,14 +173,7 @@ static void script_fu_color_preview_cancel (GtkWidget *widget,
static gint script_fu_color_preview_delete (GtkWidget *widget,
GdkEvent *event,
gpointer data);
static void script_fu_file_preview_callback (GtkWidget *widget,
gpointer data);
static void script_fu_file_dialog_ok (GtkWidget *widget,
gpointer data);
static void script_fu_file_dialog_cancel (GtkWidget *widget,
gpointer data);
static gint script_fu_file_dialog_delete (GtkWidget *widget,
GdkEvent *event,
static void script_fu_file_selection_callback(GtkWidget *widget,
gpointer data);
static void script_fu_font_preview_callback (GtkWidget *widget,
gpointer data);
@ -602,8 +593,7 @@ script_fu_add_script (LISP a)
return my_err ("script-fu-register: filename defaults must be string values", NIL);
script->arg_defaults[i].sfa_file.filename = g_strdup (get_c_string (car (a)));
script->arg_values[i].sfa_file.filename = g_strdup (script->arg_defaults[i].sfa_file.filename);
script->arg_values[i].sfa_file.preview = NULL;
script->arg_values[i].sfa_file.dialog = NULL;
script->arg_values[i].sfa_file.fileselection = NULL;
args[i + 1].type = PARAM_STRING;
args[i + 1].name = "filename";
@ -1239,18 +1229,15 @@ script_fu_interface (SFScript *script)
break;
case SF_FILENAME:
script->args_widgets[i] = gtk_button_new();
script->arg_values[i].sfa_file.preview = gtk_label_new ("");
gtk_widget_set_usize (script->args_widgets[i], TEXT_WIDTH, 0);
gtk_container_add (GTK_CONTAINER (script->args_widgets[i]),
script->arg_values[i].sfa_file.preview);
gtk_widget_show (script->arg_values[i].sfa_file.preview);
script->args_widgets[i] =
gimp_file_selection_new ("Script-Fu File Selection",
script->arg_values[i].sfa_file.filename,
FALSE, TRUE);
script->arg_values[i].sfa_file.fileselection = script->args_widgets[i];
script_fu_file_preview (script->arg_values[i].sfa_file.preview,
script->arg_values[i].sfa_file.filename);
gtk_signal_connect (GTK_OBJECT (script->args_widgets[i]), "clicked",
(GtkSignalFunc) script_fu_file_preview_callback,
gtk_signal_connect (GTK_OBJECT (script->args_widgets[i]),
"filename_changed",
(GtkSignalFunc) script_fu_file_selection_callback,
&script->arg_values[i].sfa_file);
break;
@ -1444,20 +1431,6 @@ script_fu_brush_preview(char * name, /* Name */
brush->paint_mode = paint_mode;
}
static void
script_fu_file_preview (GtkWidget *preview,
gchar *data)
{
if (data == NULL)
return;
gtk_label_set_text (GTK_LABEL (preview), g_basename((gchar *) data));
}
static void
script_fu_font_preview (GtkWidget *preview,
gchar *data)
@ -1518,11 +1491,6 @@ script_fu_cleanup_widgets (SFScript *script)
}
break;
case SF_FILENAME:
if (script->arg_values[i].sfa_file.dialog != NULL)
{
gtk_widget_destroy (script->arg_values[i].sfa_file.dialog);
script->arg_values[i].sfa_file.dialog = NULL;
}
break;
case SF_FONT:
if (script->arg_values[i].sfa_font.dialog != NULL)
@ -1926,12 +1894,7 @@ script_fu_reset_callback (GtkWidget *widget,
case SF_FILENAME:
g_free (script->arg_values[i].sfa_file.filename);
script->arg_values[i].sfa_file.filename = g_strdup (script->arg_defaults[i].sfa_file.filename);
if (script->arg_values[i].sfa_file.dialog)
{
gtk_file_selection_set_filename (GTK_FILE_SELECTION (script->arg_values[i].sfa_file.dialog), script->arg_values[i].sfa_file.filename);
}
script_fu_file_preview (script->arg_values[i].sfa_file.preview,
script->arg_values[i].sfa_file.filename);
gimp_file_selection_set_filename (GIMP_FILE_SELECTION (script->arg_values[i].sfa_file.fileselection), script->arg_values[i].sfa_file.filename);
break;
case SF_FONT:
g_free (script->arg_values[i].sfa_font.fontname);
@ -2068,76 +2031,19 @@ script_fu_color_preview_delete (GtkWidget *widget,
}
static void
script_fu_file_preview_callback (GtkWidget *widget,
script_fu_file_selection_callback (GtkWidget *widget,
gpointer data)
{
GtkFileSelection *fs;
SFFilename *file;
file = (SFFilename *) data;
if (!file->dialog)
{
file->dialog = gtk_file_selection_new ("Script-Fu File Selection");
fs = GTK_FILE_SELECTION (file->dialog);
gtk_signal_connect (GTK_OBJECT (fs->ok_button), "clicked",
(GtkSignalFunc) script_fu_file_dialog_ok,
file);
gtk_signal_connect (GTK_OBJECT (fs), "delete_event",
(GtkSignalFunc) script_fu_file_dialog_delete,
file);
gtk_signal_connect (GTK_OBJECT (fs->cancel_button), "clicked",
(GtkSignalFunc) script_fu_file_dialog_cancel,
file);
}
else
fs = GTK_FILE_SELECTION (file->dialog);
gtk_file_selection_set_filename (GTK_FILE_SELECTION (fs), file->filename);
gtk_window_position (GTK_WINDOW (file->dialog), GTK_WIN_POS_MOUSE);
gtk_widget_show (file->dialog);
}
static void
script_fu_file_dialog_ok (GtkWidget *widget,
gpointer data)
{
SFFilename *file;
gchar *filename;
file = (SFFilename *) data;
filename = gtk_file_selection_get_filename (GTK_FILE_SELECTION (file->dialog));
if (filename != NULL)
{
if (file->filename)
g_free (file->filename);
file->filename = g_strdup(filename);
}
gtk_widget_hide (file->dialog);
script_fu_file_preview (file->preview, file->filename);
file->filename = gimp_file_selection_get_filename (GIMP_FILE_SELECTION (file->fileselection));
}
static void
script_fu_file_dialog_cancel (GtkWidget *widget,
gpointer data)
{
SFFilename *file;
file = (SFFilename *) data;
gtk_widget_hide (file->dialog);
}
static gint
script_fu_file_dialog_delete (GtkWidget *widget,
GdkEvent *event,
gpointer data)
{
script_fu_file_dialog_cancel (widget, data);
return TRUE;
}
static void
script_fu_font_preview_callback (GtkWidget *widget,
gpointer data)
@ -2229,9 +2135,3 @@ script_fu_about_dialog_delete (GtkWidget *widget,
script_fu_about_dialog_close (widget, data);
return TRUE;
}