#include <gtk/gtk.h>.

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

	* app/action_area.h: #include <gtk/gtk.h>.

	* app/devices.c: made the "Input Devices" dialog follow the action
	area conventions. Grab pointer in the pattern/brush preview popups.

	* app/errorconsole.c: use the actionarea functions.

	* app/gimpunit.c: had the wrong copyright header.

	* app/info_dialog.c: correctly set the spinbuttons' digits.

	* app/perspectice_tool.c: removed #include <stdio.h> again but
	didn't forget to s/sprintf/g_snprintf/ this time.

	* app/preferences_dialog.c: unified order of varible definitions,
	removed some unused variables.

	* app/crop.c
	* app/file_new_dialog.c
	* app/info_dialog.[ch]
	* app/interface.c
	* app/preferences_dialog.c
	* app/rotate_tool.c
	* app/scale_tool.c
	* libgimp/gimpsizeentry.[ch]
	* libgimp/gimpunitmenu.[ch]: prepared for "percent" in size
	entries.
This commit is contained in:
Michael Natterer 1999-04-05 12:48:48 +00:00 committed by Michael Natterer
parent 1cdbc89620
commit 24ffa60f1b
45 changed files with 835 additions and 693 deletions

View file

@ -1,3 +1,33 @@
1999-04-05 Michael Natterer <mitschel@cs.tu-berlin.de>
* app/action_area.h: #include <gtk/gtk.h>.
* app/devices.c: made the "Input Devices" dialog follow the action
area conventions. Grab pointer in the pattern/brush preview popups.
* app/errorconsole.c: use the actionarea functions.
* app/gimpunit.c: had the wrong copyright header.
* app/info_dialog.c: correctly set the spinbuttons' digits.
* app/perspectice_tool.c: removed #include <stdio.h> again but
didn't forget to s/sprintf/g_snprintf/ this time.
* app/preferences_dialog.c: unified order of varible definitions,
removed some unused variables.
* app/crop.c
* app/file_new_dialog.c
* app/info_dialog.[ch]
* app/interface.c
* app/preferences_dialog.c
* app/rotate_tool.c
* app/scale_tool.c
* libgimp/gimpsizeentry.[ch]
* libgimp/gimpunitmenu.[ch]: prepared for "percent" in size
entries.
Sat Apr 3 22:58:17 PST 1999 Manish Singh <yosh@gimp.org>
* tools.h: #include <gtk/gtk.h>

View file

@ -18,6 +18,7 @@
#ifndef __ACTIONAREA_H__
#define __ACTIONAREA_H__
#include <gtk/gtk.h>
typedef void (*ActionCallback) (GtkWidget *, gpointer);

View file

@ -1,5 +1,5 @@
/* LIBGIMP - The GIMP Library
* Copyright (C) 1995-1997 Peter Mattis and Spencer Kimball
/* The GIMP -- an image manipulation program
* Copyright (C) 1995-1999 Spencer Kimball and Peter Mattis
*
* gimpunit.c
* Copyright (C) 1999 Michael Natterer <mitschel@cs.tu-berlin.de>
@ -268,14 +268,14 @@ void save_unitrc (void)
if (!fp)
return;
fprintf(fp, _("# GIMP unitrc\n"));
fprintf(fp, _("# This file contains your user unit database. You can\n"));
fprintf(fp, _("# modify this list with the unit editor. You are not\n"));
fprintf(fp, _("# supposed to edit it manually, but of course you can do.\n"));
fprintf(fp, _("# This file will be entirely rewritten every time you\n"));
fprintf(fp, _("# quit the gimp.\n\n"));
fprintf (fp, _("# GIMP unitrc\n"));
fprintf (fp, _("# This file contains your user unit database. You can\n"));
fprintf (fp, _("# modify this list with the unit editor. You are not\n"));
fprintf (fp, _("# supposed to edit it manually, but of course you can do.\n"));
fprintf (fp, _("# This file will be entirely rewritten every time you\n"));
fprintf (fp, _("# quit the gimp.\n\n"));
/* save window geometries */
/* save user defined units */
for (i = gimp_unit_get_number_of_built_in_units();
i < gimp_unit_get_number_of_units ();
i++)

View file

@ -827,7 +827,6 @@ crop_info_create (Tool *tool)
GDisplay *gdisp;
GtkWidget *sizeentry;
GtkWidget *spinbutton2;
GtkAdjustment *adjustment2;
gdisp = (GDisplay *) tool->gdisp_ptr;
@ -837,18 +836,14 @@ crop_info_create (Tool *tool)
/* add the information fields */
spinbutton2 = info_dialog_add_spinbutton (crop_info, _("Origin X:"), NULL,
-1, 1, 1, 10, 1, 1, 2, NULL, NULL);
adjustment2 = gtk_spin_button_get_adjustment (GTK_SPIN_BUTTON (spinbutton2));
sizeentry =
info_dialog_add_sizeentry (crop_info, _("Y:"), orig_vals, 1,
gdisp->dot_for_dot ?
UNIT_PIXEL : gdisp->gimage->unit, "%a",
TRUE, FALSE, GIMP_SIZE_ENTRY_UPDATE_SIZE,
TRUE, FALSE, FALSE, GIMP_SIZE_ENTRY_UPDATE_SIZE,
crop_orig_changed, tool);
gimp_size_entry_add_field (GIMP_SIZE_ENTRY (sizeentry),
adjustment2,
GTK_SPIN_BUTTON (spinbutton2),
NULL, NULL);
GTK_SPIN_BUTTON (spinbutton2), NULL);
gimp_size_entry_set_refval_boundaries (GIMP_SIZE_ENTRY (sizeentry), 0,
-65536, 65536);
@ -864,18 +859,14 @@ crop_info_create (Tool *tool)
spinbutton2 = info_dialog_add_spinbutton (crop_info, _("Width:"), NULL,
-1, 1, 1, 10, 1, 1, 2, NULL, NULL);
adjustment2 = gtk_spin_button_get_adjustment (GTK_SPIN_BUTTON (spinbutton2));
sizeentry =
info_dialog_add_sizeentry (crop_info, _("Height:"), size_vals, 1,
gdisp->dot_for_dot ?
UNIT_PIXEL : gdisp->gimage->unit, "%a",
TRUE, FALSE, GIMP_SIZE_ENTRY_UPDATE_SIZE,
TRUE, FALSE, FALSE, GIMP_SIZE_ENTRY_UPDATE_SIZE,
crop_size_changed, tool);
gimp_size_entry_add_field (GIMP_SIZE_ENTRY (sizeentry),
adjustment2,
GTK_SPIN_BUTTON (spinbutton2),
NULL, NULL);
GTK_SPIN_BUTTON (spinbutton2), NULL);
gimp_size_entry_set_refval_boundaries (GIMP_SIZE_ENTRY (sizeentry), 0,
-65536, 65536);

View file

@ -127,6 +127,7 @@ void
create_input_dialog (void)
{
static GtkWidget *inputd = NULL;
GtkWidget *hbbox;
if (!inputd)
{
@ -135,7 +136,24 @@ create_input_dialog (void)
/* register this one only */
dialog_register(inputd);
gtk_container_border_width (GTK_CONTAINER (GTK_DIALOG(inputd)->action_area), 2);
gtk_container_set_border_width (GTK_CONTAINER (GTK_DIALOG(inputd)->action_area), 2);
gtk_box_set_homogeneous (GTK_BOX (GTK_DIALOG (inputd)->action_area),
FALSE);
hbbox = gtk_hbutton_box_new();
gtk_button_box_set_spacing(GTK_BUTTON_BOX (hbbox), 4);
gtk_widget_reparent (GTK_INPUT_DIALOG (inputd)->save_button, hbbox);
GTK_WIDGET_SET_FLAGS (GTK_INPUT_DIALOG (inputd)->save_button,
GTK_CAN_DEFAULT);
gtk_widget_reparent (GTK_INPUT_DIALOG (inputd)->close_button, hbbox);
GTK_WIDGET_SET_FLAGS (GTK_INPUT_DIALOG (inputd)->close_button,
GTK_CAN_DEFAULT);
gtk_box_pack_end(GTK_BOX (GTK_DIALOG (inputd)->action_area), hbbox,
FALSE, FALSE, 0);
gtk_widget_grab_default (GTK_INPUT_DIALOG (inputd)->close_button);
gtk_widget_show(hbbox);
gtk_signal_connect (GTK_OBJECT(GTK_INPUT_DIALOG(inputd)->save_button),
"clicked",
@ -1035,6 +1053,13 @@ device_preview_events (GtkWidget *widget,
break; /* Error no device info */
}
/* Grab the pointer */
gdk_pointer_grab (widget->window, FALSE,
(GDK_POINTER_MOTION_HINT_MASK |
GDK_BUTTON1_MOTION_MASK |
GDK_BUTTON_RELEASE_MASK),
NULL, NULL, bevent->time);
if(type == BRUSH_PREVIEW)
{
brush = device_info->brush;

View file

@ -367,7 +367,7 @@ file_new_cmd_callback (GtkWidget *widget,
gtk_widget_show (hbox);
vals->size_sizeentry = gimp_size_entry_new (2, vals->unit, "%p",
FALSE, TRUE, 75,
FALSE, FALSE, TRUE, 75,
GIMP_SIZE_ENTRY_UPDATE_SIZE);
gimp_size_entry_set_resolution (GIMP_SIZE_ENTRY (vals->size_sizeentry), 0,
vals->xresolution, FALSE);
@ -401,7 +401,7 @@ file_new_cmd_callback (GtkWidget *widget,
gtk_widget_show (hbox);
vals->simple_res = gimp_size_entry_new (1, vals->res_unit, "%s",
FALSE, FALSE, 75,
FALSE, FALSE, FALSE, 75,
GIMP_SIZE_ENTRY_UPDATE_RESOLUTION);
gimp_size_entry_set_refval_boundaries (GIMP_SIZE_ENTRY (vals->simple_res),
0, 1, 32767);
@ -424,7 +424,7 @@ file_new_cmd_callback (GtkWidget *widget,
(not shown by default, but used to keep track of all the variables) */
vals->resolution_sizeentry =
gimp_size_entry_new (2, vals->res_unit, "%s",
FALSE, TRUE, 75,
FALSE, FALSE, TRUE, 75,
GIMP_SIZE_ENTRY_UPDATE_RESOLUTION);
gimp_size_entry_set_refval_boundaries (GIMP_SIZE_ENTRY (vals->resolution_sizeentry),
0, 1, 32767);

View file

@ -53,7 +53,8 @@ info_field_new (InfoDialog *idialog,
label = gtk_label_new (gettext (title));
gtk_misc_set_alignment (GTK_MISC (label), 1.0, 0.5);
gtk_table_attach (GTK_TABLE (idialog->info_table), label,
0, 1, row - 1, row, GTK_SHRINK | GTK_FILL, GTK_SHRINK, 0, 0);
0, 1, row - 1, row,
GTK_SHRINK | GTK_FILL, GTK_SHRINK | GTK_FILL, 0, 0);
gtk_widget_show (label);
gtk_table_attach_defaults (GTK_TABLE (idialog->info_table), widget,
@ -293,7 +294,7 @@ info_dialog_add_spinbutton (InfoDialog *idialog,
adjustment = gtk_adjustment_new (value_ptr ? *value_ptr : 0, lower, upper,
step_increment, page_increment, page_size);
spinbutton = gtk_spin_button_new (GTK_ADJUSTMENT (adjustment),
climb_rate, MIN (MAX (digits, 6), 0));
climb_rate, MAX (MIN (digits, 6), 0));
gtk_spin_button_set_shadow_type (GTK_SPIN_BUTTON (spinbutton),
GTK_SHADOW_NONE);
gtk_spin_button_set_numeric (GTK_SPIN_BUTTON (spinbutton), TRUE);
@ -320,6 +321,7 @@ info_dialog_add_sizeentry (InfoDialog *idialog,
GUnit unit,
gchar *unit_format,
gboolean menu_show_pixels,
gboolean menu_show_percent,
gboolean show_refval,
GimpSizeEntryUP update_policy,
GtkSignalFunc callback,
@ -334,7 +336,8 @@ info_dialog_add_sizeentry (InfoDialog *idialog,
alignment = gtk_alignment_new (0.0, 0.5, 0.0, 1.0);
sizeentry = gimp_size_entry_new (nfields, unit, unit_format,
menu_show_pixels, show_refval, 75,
menu_show_pixels, menu_show_percent,
show_refval, 75,
update_policy);
if (value_ptr)
for (i = 0; i < nfields; i++)

View file

@ -109,6 +109,7 @@ GtkWidget *info_dialog_add_sizeentry (InfoDialog *idialog,
GUnit unit,
gchar *unit_format,
gboolean menu_show_pixels,
gboolean menu_show_percent,
gboolean show_refval,
GimpSizeEntryUP update_policy,
GtkSignalFunc callback,

View file

@ -86,11 +86,11 @@ static int old_cycled_marching_ants;
static int old_last_opened_size;
static char * old_temp_path;
static char * old_swap_path;
static char * old_plug_in_path;
static char * old_module_path;
static char * old_brush_path;
static char * old_pattern_path;
static char * old_palette_path;
static char * old_plug_in_path;
static char * old_module_path;
static char * old_gradient_path;
static float old_monitor_xres;
static float old_monitor_yres;
@ -98,20 +98,21 @@ static int old_using_xserver_resolution;
static int old_num_processors;
static char * old_image_title_format;
static char * edit_temp_path = NULL;
static char * edit_swap_path = NULL;
static char * edit_brush_path = NULL;
static char * edit_pattern_path = NULL;
static char * edit_palette_path = NULL;
static char * edit_plug_in_path = NULL;
static char * edit_module_path = NULL;
static char * edit_gradient_path = NULL;
/* variables which can't be changed on the fly */
static int edit_stingy_memory_use;
static int edit_tile_cache_size;
static int edit_install_cmap;
static int edit_cycled_marching_ants;
static int edit_last_opened_size;
static int edit_num_processors;
static char * edit_temp_path = NULL;
static char * edit_swap_path = NULL;
static char * edit_plug_in_path = NULL;
static char * edit_module_path = NULL;
static char * edit_brush_path = NULL;
static char * edit_pattern_path = NULL;
static char * edit_palette_path = NULL;
static char * edit_gradient_path = NULL;
static GtkWidget *prefs_dlg = NULL;
@ -121,10 +122,8 @@ static int mem_size_unit;
static GtkWidget *default_size_sizeentry = NULL;
static GtkWidget *default_resolution_sizeentry = NULL;
static GtkWidget *default_resolution_force_equal = NULL;
static GtkWidget *resolution_xserver_label = NULL;
static GtkWidget *monitor_resolution_sizeentry = NULL;
static GtkWidget *monitor_resolution_force_equal = NULL;
/* Some information regarding preferences, compiled by Raph Levien 11/3/97.
updated by Michael Natterer 27/3/99
@ -133,20 +132,20 @@ static GtkWidget *monitor_resolution_force_equal = NULL;
according to the existing pref code - it may be that changing them
so they're set on the fly is not hard).
temp-path
swap-path
brush-path
pattern-path
plug-in-path
module-path
palette-path
gradient-path
stingy-memory-use
tile-cache-size
install-cmap
cycled-marching-ants
last-opened-size
num-processors
temp-path
swap-path
plug-in-path
module-path
brush-path
pattern-path
palette-path
gradient-path
All of these now have variables of the form edit_temp_path, which
are copied from the actual variables (e.g. temp_path) the first time
@ -240,7 +239,7 @@ file_prefs_ok_callback (GtkWidget *widget,
if (default_units < UNIT_INCH ||
default_units >= gimp_unit_get_number_of_units ())
{
g_message (_("Error: Default units must be within unit range."));
g_message (_("Error: Default unit must be within unit range."));
default_units = old_default_units;
return;
}
@ -254,32 +253,31 @@ file_prefs_ok_callback (GtkWidget *widget,
if (default_resolution_units < UNIT_INCH ||
default_resolution_units >= gimp_unit_get_number_of_units ())
{
g_message (_("Error: Default units must be within unit range."));
g_message (_("Error: Default resolution unit must be within unit range."));
default_resolution_units = old_default_resolution_units;
return;
}
if (monitor_xres < 1e-5 || monitor_yres < 1e-5)
{
g_message (_("Error: monitor resolution must not be zero."));
g_message (_("Error: Monitor resolution must not be zero."));
monitor_xres = old_monitor_xres;
monitor_yres = old_monitor_yres;
return;
}
if (image_title_format == NULL)
{
g_message (_("Error: image_title_format should never be NULL."));
g_message (_("Error: Image title format must not be NULL."));
image_title_format = old_image_title_format;
return;
}
gtk_widget_destroy (dlg);
prefs_dlg = NULL;
tile_cache_size_adjustment = NULL;
default_size_sizeentry = NULL;
default_resolution_sizeentry = NULL;
default_resolution_force_equal = NULL;
resolution_xserver_label = NULL;
monitor_resolution_sizeentry = NULL;
monitor_resolution_force_equal = NULL;
if (show_tool_tips)
gtk_tooltips_enable (tool_tips);
@ -293,20 +291,22 @@ file_prefs_save_callback (GtkWidget *widget,
{
GList *update = NULL; /* options that should be updated in .gimprc */
GList *remove = NULL; /* options that should be commented out */
int save_stingy_memory_use;
int save_tile_cache_size;
int save_num_processors;
int save_install_cmap;
int save_cycled_marching_ants;
int save_last_opened_size;
int save_num_processors;
gchar *save_temp_path;
gchar *save_swap_path;
gchar *save_plug_in_path;
gchar *save_module_path;
gchar *save_brush_path;
gchar *save_pattern_path;
gchar *save_palette_path;
gchar *save_plug_in_path;
gchar *save_module_path;
gchar *save_gradient_path;
int restart_notification = FALSE;
file_prefs_ok_callback (widget, dlg);
@ -317,15 +317,15 @@ file_prefs_save_callback (GtkWidget *widget,
save_install_cmap = install_cmap;
save_cycled_marching_ants = cycled_marching_ants;
save_last_opened_size = last_opened_size;
save_num_processors = num_processors;
save_temp_path = temp_path;
save_swap_path = swap_path;
save_plug_in_path = plug_in_path;
save_module_path = module_path;
save_brush_path = brush_path;
save_pattern_path = pattern_path;
save_palette_path = palette_path;
save_plug_in_path = plug_in_path;
save_module_path = module_path;
save_gradient_path = gradient_path;
save_num_processors = num_processors;
if (levels_of_undo != old_levels_of_undo)
update = g_list_append (update, "undo-levels");
@ -453,6 +453,18 @@ file_prefs_save_callback (GtkWidget *widget,
swap_path = edit_swap_path;
restart_notification = TRUE;
}
if (file_prefs_strcmp (plug_in_path, edit_plug_in_path))
{
update = g_list_append (update, "plug-in-path");
plug_in_path = edit_plug_in_path;
restart_notification = TRUE;
}
if (file_prefs_strcmp (module_path, edit_module_path))
{
update = g_list_append (update, "module-path");
module_path = edit_module_path;
restart_notification = TRUE;
}
if (file_prefs_strcmp (brush_path, edit_brush_path))
{
update = g_list_append (update, "brush-path");
@ -471,18 +483,6 @@ file_prefs_save_callback (GtkWidget *widget,
palette_path = edit_palette_path;
restart_notification = TRUE;
}
if (file_prefs_strcmp (plug_in_path, edit_plug_in_path))
{
update = g_list_append (update, "plug-in-path");
plug_in_path = edit_plug_in_path;
restart_notification = TRUE;
}
if (file_prefs_strcmp (module_path, edit_module_path))
{
update = g_list_append (update, "module-path");
module_path = edit_module_path;
restart_notification = TRUE;
}
if (file_prefs_strcmp (gradient_path, edit_gradient_path))
{
update = g_list_append (update, "gradient-path");
@ -510,13 +510,14 @@ file_prefs_save_callback (GtkWidget *widget,
install_cmap = save_install_cmap;
cycled_marching_ants = save_cycled_marching_ants;
last_opened_size = save_last_opened_size;
num_processors = save_num_processors;
temp_path = save_temp_path;
swap_path = save_swap_path;
plug_in_path = save_plug_in_path;
module_path = save_module_path;
brush_path = save_brush_path;
pattern_path = save_pattern_path;
palette_path = save_palette_path;
plug_in_path = save_plug_in_path;
module_path = save_module_path;
gradient_path = save_gradient_path;
if (restart_notification)
@ -533,12 +534,11 @@ 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;
default_resolution_force_equal = NULL;
resolution_xserver_label = NULL;
monitor_resolution_sizeentry = NULL;
monitor_resolution_force_equal = NULL;
levels_of_undo = old_levels_of_undo;
marching_speed = old_marching_speed;
@ -592,11 +592,11 @@ file_prefs_cancel_callback (GtkWidget *widget,
file_prefs_strset (&edit_temp_path, old_temp_path);
file_prefs_strset (&edit_swap_path, old_swap_path);
file_prefs_strset (&edit_plug_in_path, old_plug_in_path);
file_prefs_strset (&edit_module_path, old_module_path);
file_prefs_strset (&edit_brush_path, old_brush_path);
file_prefs_strset (&edit_pattern_path, old_pattern_path);
file_prefs_strset (&edit_palette_path, old_palette_path);
file_prefs_strset (&edit_plug_in_path, old_plug_in_path);
file_prefs_strset (&edit_module_path, old_module_path);
file_prefs_strset (&edit_gradient_path, old_gradient_path);
file_prefs_strset (&image_title_format, old_image_title_format);
@ -811,10 +811,6 @@ file_prefs_res_source_callback (GtkWidget *widget,
gtk_widget_set_sensitive (monitor_resolution_sizeentry,
! GTK_TOGGLE_BUTTON (widget)->active);
if (monitor_resolution_force_equal)
gtk_widget_set_sensitive (monitor_resolution_force_equal,
! GTK_TOGGLE_BUTTON (widget)->active);
if (GTK_TOGGLE_BUTTON (widget)->active)
{
gdisplay_xserver_resolution (&monitor_xres, &monitor_yres);
@ -926,10 +922,6 @@ gimp_dialog_realize_callback (GtkWidget *widget,
/* this is an experimental one
* I tried to fold the entire dialog creation and the ActionArea stuff
* into one function. Might be not general enough.
* todo:
* - session management?? (probably not)
* - window placement
* - policy setting
*/
GtkWidget*
gimp_dialog_new (const gchar *title,
@ -967,7 +959,7 @@ gimp_dialog_new (const gchar *title,
gtk_window_set_policy (GTK_WINDOW (dialog),
allow_grow, allow_shrink, auto_shrink);
/* prepare the action_area */
/* prepare the action_area */
gtk_container_border_width (GTK_CONTAINER (GTK_DIALOG (dialog)->action_area),
2);
gtk_box_set_homogeneous (GTK_BOX (GTK_DIALOG (dialog)->action_area), FALSE);
@ -978,6 +970,7 @@ gimp_dialog_new (const gchar *title,
FALSE, FALSE, 0);
gtk_widget_show (hbbox);
/* the action_area buttons */
va_start (args, connect_delete);
while (label)
{
@ -985,7 +978,7 @@ gimp_dialog_new (const gchar *title,
GTK_WIDGET_SET_FLAGS (button, GTK_CAN_DEFAULT);
gtk_box_pack_start (GTK_BOX (hbbox), button, FALSE, FALSE, 0);
/* pass data as user_data if data != NULL, or the dialog otherwise */
/* pass data as user_data if data != NULL, or the dialog otherwise */
if (callback)
gtk_signal_connect (GTK_OBJECT (button), "clicked",
GTK_SIGNAL_FUNC (callback),
@ -1000,7 +993,7 @@ gimp_dialog_new (const gchar *title,
"gimp_dialog_cancel_widget",
button);
/* catch WM delete event */
/* catch the WM delete event */
gtk_signal_connect (GTK_OBJECT (dialog), "delete_event",
(GdkEventFunc) gimp_dialog_delete_callback,
data ? data : dialog);
@ -1023,13 +1016,13 @@ gimp_dialog_new (const gchar *title,
}
va_end (args);
/* catch WM delete event if not already done*/
/* catch the WM delete event if not already done */
if (! delete_connected)
gtk_signal_connect (GTK_OBJECT (dialog), "delete_event",
(GdkEventFunc) gimp_dialog_delete_callback,
NULL);
/* the realize callback sets the wm icon pixmap */
/* the realize callback sets the WM icon */
/*
gtk_signal_connect (GTK_OBJECT (dialog), "realize",
(GtkSignalFunc) gimp_dialog_realize_callback,
@ -1041,7 +1034,7 @@ gimp_dialog_new (const gchar *title,
GtkWidget*
gimp_option_menu_new (GtkSignalFunc menu_item_callback,
gpointer initial,
gpointer initial, /* set_data */
/* this is a menu item */
gchar *label,
@ -1063,6 +1056,7 @@ gimp_option_menu_new (GtkSignalFunc menu_item_callback,
menu = gtk_menu_new ();
/* create the menu items */
initial_index = 0;
va_start (args, set_data);
for (i = 0; label; i++)
@ -1074,7 +1068,7 @@ gimp_option_menu_new (GtkSignalFunc menu_item_callback,
gtk_object_set_user_data (GTK_OBJECT (menuitem), set_data);
gtk_widget_show (menuitem);
/* remember the initial menu item */
/* remember the initial menu item */
if (set_data == initial)
initial_index = i;
@ -1090,7 +1084,7 @@ gimp_option_menu_new (GtkSignalFunc menu_item_callback,
optionmenu = gtk_option_menu_new ();
gtk_option_menu_set_menu (GTK_OPTION_MENU (optionmenu), menu);
/* select the initial menu item */
/* select the initial menu item */
gtk_option_menu_set_history (GTK_OPTION_MENU (optionmenu), initial_index);
return optionmenu;
@ -1098,7 +1092,7 @@ gimp_option_menu_new (GtkSignalFunc menu_item_callback,
GtkWidget*
gimp_radio_group_new (GtkSignalFunc radio_button_callback,
gpointer initial,
gpointer initial, /* set_data */
/* this is a radio button */
gchar *label,
@ -1120,6 +1114,7 @@ gimp_radio_group_new (GtkSignalFunc radio_button_callback,
gtk_container_set_border_width (GTK_CONTAINER (vbox), 2);
group = NULL;
/* create the radio buttons */
va_start (args, set_data);
while (label)
{
@ -1131,7 +1126,7 @@ gimp_radio_group_new (GtkSignalFunc radio_button_callback,
data);
gtk_object_set_user_data (GTK_OBJECT (button), set_data);
/* press the initially active radio button */
/* press the initially active radio button */
if (set_data == initial)
gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (button), TRUE);
@ -1151,7 +1146,7 @@ gimp_radio_group_new (GtkSignalFunc radio_button_callback,
/* this might be the standard gimp spinbutton */
GtkWidget*
gimp_spin_button_new (GtkObject **adjustment, /* return value */
gimp_spin_button_new (GtkObject **adjustment, /* return value */
gfloat value,
gfloat lower,
gfloat upper,
@ -1176,25 +1171,29 @@ gimp_spin_button_new (GtkObject **adjustment, /* return value */
return spinbutton;
}
/* add correctly aligned label & widget to a two-column table */
/* add aligned label & widget to a two-column table */
void
gimp_table_attach_aligned (GtkTable *table,
gint row,
gchar *text,
gfloat xalign,
gfloat yalign,
GtkWidget *widget,
gboolean left_adjust)
{
GtkWidget *label;
label = gtk_label_new (text);
gtk_misc_set_alignment (GTK_MISC (label), 1.0, 0.5);
gtk_misc_set_alignment (GTK_MISC (label), xalign, yalign);
gtk_table_attach (table, GTK_WIDGET (label), 0, 1, row, row + 1,
GTK_SHRINK | GTK_FILL, GTK_SHRINK, 0, 0);
GTK_SHRINK | GTK_FILL, GTK_SHRINK | GTK_FILL, 0, 0);
gtk_widget_show (label);
if (left_adjust)
{
GtkWidget* alignment = gtk_alignment_new (0.0, 0.5, 0.0, 0.0);
GtkWidget *alignment;
alignment = gtk_alignment_new (0.0, 0.5, 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);
@ -1318,6 +1317,11 @@ file_pref_cmd_callback (GtkWidget *widget,
{
/* first time dialog is opened - copy config vals to edit
variables. */
edit_stingy_memory_use = stingy_memory_use;
edit_tile_cache_size = tile_cache_size;
edit_install_cmap = install_cmap;
edit_cycled_marching_ants = cycled_marching_ants;
edit_last_opened_size = last_opened_size;
edit_temp_path = file_prefs_strdup (temp_path);
edit_swap_path = file_prefs_strdup (swap_path);
edit_brush_path = file_prefs_strdup (brush_path);
@ -1326,11 +1330,6 @@ file_pref_cmd_callback (GtkWidget *widget,
edit_plug_in_path = file_prefs_strdup (plug_in_path);
edit_module_path = file_prefs_strdup (module_path);
edit_gradient_path = file_prefs_strdup (gradient_path);
edit_stingy_memory_use = stingy_memory_use;
edit_tile_cache_size = tile_cache_size;
edit_install_cmap = install_cmap;
edit_cycled_marching_ants = cycled_marching_ants;
edit_last_opened_size = last_opened_size;
}
old_perfectmouse = perfectmouse;
old_transparency_type = transparency_type;
@ -1369,11 +1368,11 @@ file_pref_cmd_callback (GtkWidget *widget,
file_prefs_strset (&old_temp_path, edit_temp_path);
file_prefs_strset (&old_swap_path, edit_swap_path);
file_prefs_strset (&old_plug_in_path, edit_plug_in_path);
file_prefs_strset (&old_module_path, edit_module_path);
file_prefs_strset (&old_brush_path, edit_brush_path);
file_prefs_strset (&old_pattern_path, edit_pattern_path);
file_prefs_strset (&old_palette_path, edit_palette_path);
file_prefs_strset (&old_plug_in_path, edit_plug_in_path);
file_prefs_strset (&old_module_path, edit_module_path);
file_prefs_strset (&old_gradient_path, edit_gradient_path);
mem_size_unit = 1;
@ -1387,8 +1386,7 @@ file_pref_cmd_callback (GtkWidget *widget,
/* Create the dialog */
prefs_dlg =
gimp_dialog_new (_("Preferences"),
"gimp_preferences",
gimp_dialog_new (_("Preferences"), "gimp_preferences",
GTK_WIN_POS_NONE, FALSE, FALSE, FALSE,
_("OK"), file_prefs_ok_callback, NULL,
FALSE, FALSE,
@ -1454,7 +1452,7 @@ file_pref_cmd_callback (GtkWidget *widget,
gtk_widget_show (hbox);
default_size_sizeentry = gimp_size_entry_new (2, default_units, "%p",
FALSE, TRUE, 75,
FALSE, FALSE, TRUE, 75,
GIMP_SIZE_ENTRY_UPDATE_SIZE);
gimp_size_entry_set_resolution (GIMP_SIZE_ENTRY (default_size_sizeentry),
0, default_xresolution, FALSE);
@ -1490,10 +1488,10 @@ file_pref_cmd_callback (GtkWidget *widget,
gtk_container_add (GTK_CONTAINER (frame), hbox);
gtk_widget_show (hbox);
default_resolution_force_equal = gimp_chain_button_new (GIMP_CHAIN_BOTTOM);
button = gimp_chain_button_new (GIMP_CHAIN_BOTTOM);
default_resolution_sizeentry =
gimp_size_entry_new (2, default_resolution_units, "%s", FALSE, TRUE, 75,
gimp_size_entry_new (2, default_resolution_units, "%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);
@ -1512,24 +1510,24 @@ file_pref_cmd_callback (GtkWidget *widget,
gtk_signal_connect (GTK_OBJECT (default_resolution_sizeentry),
"unit_changed",
(GtkSignalFunc)file_prefs_default_resolution_callback,
default_resolution_force_equal);
button);
gtk_signal_connect (GTK_OBJECT (default_resolution_sizeentry),
"value_changed",
(GtkSignalFunc)file_prefs_default_resolution_callback,
default_resolution_force_equal);
button);
gtk_signal_connect (GTK_OBJECT (default_resolution_sizeentry),
"refval_changed",
(GtkSignalFunc)file_prefs_default_resolution_callback,
default_resolution_force_equal);
button);
gtk_box_pack_start (GTK_BOX (hbox), default_resolution_sizeentry,
FALSE, FALSE, 0);
gtk_widget_show (default_resolution_sizeentry);
gtk_table_attach_defaults (GTK_TABLE (default_resolution_sizeentry),
default_resolution_force_equal, 1, 3, 3, 4);
button, 1, 3, 3, 4);
if (ABS (default_xresolution - default_yresolution) < 1e-5)
gimp_chain_button_set_active (GIMP_CHAIN_BUTTON (default_resolution_force_equal), TRUE);
gtk_widget_show (default_resolution_force_equal);
gimp_chain_button_set_active (GIMP_CHAIN_BUTTON (button), TRUE);
gtk_widget_show (button);
hbox = gtk_hbox_new (FALSE, 2);
gtk_box_pack_start (GTK_BOX (vbox), hbox, FALSE, FALSE, 0);
@ -1549,7 +1547,8 @@ file_pref_cmd_callback (GtkWidget *widget,
_("Grayscale"), &default_type, (gpointer) GRAY,
NULL);
gimp_table_attach_aligned (GTK_TABLE (table), 0,
_("Default Image Type:"), optionmenu, TRUE);
_("Default Image Type:"), 1.0, 0.5,
optionmenu, TRUE);
/* Display page */
vbox = file_prefs_notebook_append_page (GTK_NOTEBOOK (notebook),
@ -1594,20 +1593,21 @@ file_pref_cmd_callback (GtkWidget *widget,
&transparency_type, (gpointer) BLACK_ONLY,
NULL);
gimp_table_attach_aligned (GTK_TABLE (table), 0,
_("Transparency Type:"), optionmenu, TRUE);
_("Transparency Type:"), 1.0, 0.5,
optionmenu, TRUE);
optionmenu =
gimp_option_menu_new (file_prefs_toggle_callback,
(gpointer) transparency_size,
_("Small Checks"),
_("Small"),
&transparency_size, (gpointer) SMALL_CHECKS,
_("Medium Checks"),
_("Medium"),
&transparency_size, (gpointer) MEDIUM_CHECKS,
_("Large Checks"),
_("Large"),
&transparency_size, (gpointer) LARGE_CHECKS,
NULL);
gimp_table_attach_aligned (GTK_TABLE (table), 1,
_("Check Size:"), optionmenu, TRUE);
_("Check Size:"), 1.0, 0.5, optionmenu, TRUE);
frame = gtk_frame_new (_("Scaling"));
gtk_box_pack_start (GTK_BOX (vbox), frame, FALSE, FALSE, 0);
@ -1675,7 +1675,7 @@ file_pref_cmd_callback (GtkWidget *widget,
_("Large"), (gpointer) 128, (gpointer) 128,
NULL);
gimp_table_attach_aligned (GTK_TABLE (table), 0,
_("Preview Size:"), optionmenu, TRUE);
_("Preview Size:"), 1.0, 0.5, optionmenu, TRUE);
spinbutton =
gimp_spin_button_new (&adjustment,
@ -1684,7 +1684,7 @@ file_pref_cmd_callback (GtkWidget *widget,
(GtkSignalFunc) file_prefs_int_adjustment_callback,
&levels_of_undo);
gimp_table_attach_aligned (GTK_TABLE (table), 1,
_("Levels of Undo:"), spinbutton, TRUE);
_("Levels of Undo:"), 1.0, 0.5, spinbutton, TRUE);
spinbutton =
gimp_spin_button_new (&adjustment,
@ -1693,7 +1693,8 @@ file_pref_cmd_callback (GtkWidget *widget,
(GtkSignalFunc) file_prefs_int_adjustment_callback,
&edit_last_opened_size);
gimp_table_attach_aligned (GTK_TABLE (table), 2,
_("Recent Documents List Size:"), spinbutton, TRUE);
_("Recent Documents List Size:"), 1.0, 0.5,
spinbutton, TRUE);
frame = gtk_frame_new (_("Help System"));
gtk_box_pack_start (GTK_BOX (vbox), frame, FALSE, FALSE, 0);
@ -1769,13 +1770,14 @@ file_pref_cmd_callback (GtkWidget *widget,
spinbutton =
gimp_spin_button_new (&adjustment,
marching_speed, 0.0, 32000.0, 50.0, 100.0, 0.0,
marching_speed, 50.0, 32000.0, 10.0, 100.0, 1.0,
1.0, 0.0);
gtk_signal_connect (GTK_OBJECT (adjustment), "value_changed",
(GtkSignalFunc) file_prefs_int_adjustment_callback,
&marching_speed);
gimp_table_attach_aligned (GTK_TABLE (table), 0,
_("Marching Ants Speed:"), spinbutton, TRUE);
_("Marching Ants Speed:"), 1.0, 0.5,
spinbutton, TRUE);
/* The title format string */
combo = gtk_combo_new ();
@ -1814,7 +1816,7 @@ file_pref_cmd_callback (GtkWidget *widget,
&image_title_format);
gimp_table_attach_aligned (GTK_TABLE (table), 1,
_("Image Title Format:"), combo, FALSE);
_("Image Title Format:"), 1.0, 0.5, combo, FALSE);
/* End of the title format string */
frame = gtk_frame_new (_("Pointer Movement Feedback"));
@ -1907,7 +1909,7 @@ file_pref_cmd_callback (GtkWidget *widget,
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:"), hbox, TRUE);
_("Tile Cache Size:"), 1.0, 0.5, hbox, TRUE);
#ifdef ENABLE_MP
spinbutton =
@ -1917,7 +1919,7 @@ file_pref_cmd_callback (GtkWidget *widget,
(GtkSignalFunc) file_prefs_int_adjustment_callback,
&num_processors);
gimp_table_attach_aligned (GTK_TABLE (table), 1,
_("Number of Processors to Use:"),
_("Number of Processors to Use:"), 1.0, 0.5,
spinbutton, TRUE);
#endif /* ENABLE_MP */
@ -2065,17 +2067,17 @@ file_pref_cmd_callback (GtkWidget *widget,
group = gtk_radio_button_group (GTK_RADIO_BUTTON (button));
gtk_box_pack_start (GTK_BOX (vbox2), button, FALSE, FALSE, 0);
gtk_widget_show (button);
if (!using_xserver_resolution)
if (! using_xserver_resolution)
gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (button), TRUE);
abox = gtk_alignment_new (0.5, 0.5, 0.0, 1.0);
abox = gtk_alignment_new (0.5, 0.5, 0.0, 0.0);
gtk_box_pack_start (GTK_BOX (vbox2), abox, FALSE, FALSE, 0);
gtk_widget_show (abox);
monitor_resolution_force_equal = gimp_chain_button_new (GIMP_CHAIN_BOTTOM);
monitor_resolution_sizeentry = gimp_size_entry_new (2, UNIT_INCH, "%s",
FALSE, TRUE, 75,
GIMP_SIZE_ENTRY_UPDATE_RESOLUTION);
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_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 (GIMP_SIZE_ENTRY (monitor_resolution_sizeentry),
@ -2093,25 +2095,22 @@ file_pref_cmd_callback (GtkWidget *widget,
gtk_signal_connect (GTK_OBJECT (monitor_resolution_sizeentry),
"value_changed",
(GtkSignalFunc)file_prefs_monitor_resolution_callback,
monitor_resolution_force_equal);
button);
gtk_signal_connect (GTK_OBJECT (monitor_resolution_sizeentry),
"refval_changed",
(GtkSignalFunc)file_prefs_monitor_resolution_callback,
monitor_resolution_force_equal);
button);
gtk_container_add (GTK_CONTAINER (abox), monitor_resolution_sizeentry);
gtk_widget_show (monitor_resolution_sizeentry);
if (ABS (monitor_xres - monitor_yres) < 1e-5)
gimp_chain_button_set_active (GIMP_CHAIN_BUTTON (monitor_resolution_force_equal),
TRUE);
gimp_chain_button_set_active (GIMP_CHAIN_BUTTON (button), TRUE);
gtk_table_attach_defaults (GTK_TABLE (monitor_resolution_sizeentry),
monitor_resolution_force_equal, 1, 3, 3, 4);
gtk_widget_show (monitor_resolution_force_equal);
button, 1, 3, 3, 4);
gtk_widget_show (button);
gtk_widget_set_sensitive (monitor_resolution_sizeentry,
!using_xserver_resolution);
gtk_widget_set_sensitive (monitor_resolution_force_equal,
!using_xserver_resolution);
/* Directories */
vbox = file_prefs_notebook_append_page (GTK_NOTEBOOK (notebook),
@ -2150,7 +2149,8 @@ file_pref_cmd_callback (GtkWidget *widget,
(GtkSignalFunc) file_prefs_filename_callback,
dirs[i].mdir);
gimp_table_attach_aligned (GTK_TABLE (table), i,
gettext(dirs[i].label), fileselection, FALSE);
gettext(dirs[i].label), 1.0, 0.5,
fileselection, FALSE);
}
}
@ -2164,12 +2164,12 @@ file_pref_cmd_callback (GtkWidget *widget,
} paths[] = {
{ N_("Brushes"), N_("Brushes Directories"), N_("Select Brushes Dir"),
&edit_brush_path },
{ N_("Gradients"), N_("Gradients Directories"), N_("Select Gradients Dir"),
&edit_gradient_path },
{ N_("Patterns"), N_("Patterns Directories"), N_("Select Patterns Dir"),
&edit_pattern_path },
{ N_("Palettes"), N_("Palettes Directories"), N_("Select Palettes Dir"),
&edit_palette_path },
{ N_("Gradients"), N_("Gradients Directories"), N_("Select Gradients Dir"),
&edit_gradient_path },
{ N_("Plug-Ins"), N_("Plug-Ins Directories"), N_("Select Plug-Ins Dir"),
&edit_plug_in_path },
{ N_("Modules"), N_("Modules Directories"), N_("Select Modules Dir"),

View file

@ -1019,7 +1019,7 @@ query_size_box (gchar *title,
(GtkSignalFunc) size_query_box_ok_callback,
query_box);
sizeentry = gimp_size_entry_new (1, unit, "%p", TRUE, FALSE, 100,
sizeentry = gimp_size_entry_new (1, unit, "%p", TRUE, FALSE, FALSE, 100,
GIMP_SIZE_ENTRY_UPDATE_SIZE);
gimp_size_entry_set_resolution (GIMP_SIZE_ENTRY (sizeentry), 0,
resolution, FALSE);

View file

@ -1019,7 +1019,7 @@ query_size_box (gchar *title,
(GtkSignalFunc) size_query_box_ok_callback,
query_box);
sizeentry = gimp_size_entry_new (1, unit, "%p", TRUE, FALSE, 100,
sizeentry = gimp_size_entry_new (1, unit, "%p", TRUE, FALSE, FALSE, 100,
GIMP_SIZE_ENTRY_UPDATE_SIZE);
gimp_size_entry_set_resolution (GIMP_SIZE_ENTRY (sizeentry), 0,
resolution, FALSE);

View file

@ -44,6 +44,8 @@
#endif
#endif
#include "actionarea.h"
#include <gtk/gtk.h>
#include "commands.h"
@ -63,12 +65,21 @@ static GtkWidget *text;
static void
error_console_close_callback (GtkWidget *widget,
GdkEvent *event,
gpointer data)
gpointer data)
{
gtk_widget_hide (error_console);
}
static gint
error_console_delete_callback (GtkWidget *widget,
GdkEvent *event,
gpointer data)
{
error_console_close_callback (NULL, NULL);
return TRUE;
}
void
error_console_free (void)
{
@ -210,10 +221,15 @@ text_clicked_callback (GtkWidget *widget,
return TRUE;
}
/* the action area structure */
static ActionAreaItem action_items[] =
{
{ N_("Close"), error_console_close_callback, NULL, NULL }
};
static void
error_console_create_window (void)
{
GtkWidget *button;
GtkWidget *table;
GtkWidget *vscrollbar;
GtkWidget *menu;
@ -230,16 +246,12 @@ error_console_create_window (void)
gtk_widget_set_usize (error_console, 250, 300);
gtk_window_set_policy (GTK_WINDOW(error_console), TRUE, TRUE, FALSE);
gtk_signal_connect (GTK_OBJECT (error_console), "delete_event",
(GtkSignalFunc) error_console_close_callback, NULL);
(GdkEventFunc) error_console_delete_callback, NULL);
gtk_container_set_border_width (GTK_CONTAINER (GTK_DIALOG (error_console)->vbox), 2);
gtk_container_set_border_width (GTK_CONTAINER (GTK_DIALOG (error_console)->action_area), 2);
/* Action area */
button = gtk_button_new_with_label (_("Close"));
gtk_signal_connect (GTK_OBJECT (button), "clicked",
(GtkSignalFunc) error_console_close_callback, NULL);
gtk_box_pack_start (GTK_BOX (GTK_DIALOG (error_console)->action_area), button, TRUE, TRUE, 0);
gtk_widget_show (button);
action_items[0].user_data = error_console;
build_action_area (GTK_DIALOG (error_console), action_items, 1, 0);
menu = gtk_menu_new ();

View file

@ -367,7 +367,7 @@ file_new_cmd_callback (GtkWidget *widget,
gtk_widget_show (hbox);
vals->size_sizeentry = gimp_size_entry_new (2, vals->unit, "%p",
FALSE, TRUE, 75,
FALSE, FALSE, TRUE, 75,
GIMP_SIZE_ENTRY_UPDATE_SIZE);
gimp_size_entry_set_resolution (GIMP_SIZE_ENTRY (vals->size_sizeentry), 0,
vals->xresolution, FALSE);
@ -401,7 +401,7 @@ file_new_cmd_callback (GtkWidget *widget,
gtk_widget_show (hbox);
vals->simple_res = gimp_size_entry_new (1, vals->res_unit, "%s",
FALSE, FALSE, 75,
FALSE, FALSE, FALSE, 75,
GIMP_SIZE_ENTRY_UPDATE_RESOLUTION);
gimp_size_entry_set_refval_boundaries (GIMP_SIZE_ENTRY (vals->simple_res),
0, 1, 32767);
@ -424,7 +424,7 @@ file_new_cmd_callback (GtkWidget *widget,
(not shown by default, but used to keep track of all the variables) */
vals->resolution_sizeentry =
gimp_size_entry_new (2, vals->res_unit, "%s",
FALSE, TRUE, 75,
FALSE, FALSE, TRUE, 75,
GIMP_SIZE_ENTRY_UPDATE_RESOLUTION);
gimp_size_entry_set_refval_boundaries (GIMP_SIZE_ENTRY (vals->resolution_sizeentry),
0, 1, 32767);

View file

@ -1,5 +1,5 @@
/* LIBGIMP - The GIMP Library
* Copyright (C) 1995-1997 Peter Mattis and Spencer Kimball
/* The GIMP -- an image manipulation program
* Copyright (C) 1995-1999 Spencer Kimball and Peter Mattis
*
* gimpunit.c
* Copyright (C) 1999 Michael Natterer <mitschel@cs.tu-berlin.de>
@ -268,14 +268,14 @@ void save_unitrc (void)
if (!fp)
return;
fprintf(fp, _("# GIMP unitrc\n"));
fprintf(fp, _("# This file contains your user unit database. You can\n"));
fprintf(fp, _("# modify this list with the unit editor. You are not\n"));
fprintf(fp, _("# supposed to edit it manually, but of course you can do.\n"));
fprintf(fp, _("# This file will be entirely rewritten every time you\n"));
fprintf(fp, _("# quit the gimp.\n\n"));
fprintf (fp, _("# GIMP unitrc\n"));
fprintf (fp, _("# This file contains your user unit database. You can\n"));
fprintf (fp, _("# modify this list with the unit editor. You are not\n"));
fprintf (fp, _("# supposed to edit it manually, but of course you can do.\n"));
fprintf (fp, _("# This file will be entirely rewritten every time you\n"));
fprintf (fp, _("# quit the gimp.\n\n"));
/* save window geometries */
/* save user defined units */
for (i = gimp_unit_get_number_of_built_in_units();
i < gimp_unit_get_number_of_units ();
i++)

View file

@ -127,6 +127,7 @@ void
create_input_dialog (void)
{
static GtkWidget *inputd = NULL;
GtkWidget *hbbox;
if (!inputd)
{
@ -135,7 +136,24 @@ create_input_dialog (void)
/* register this one only */
dialog_register(inputd);
gtk_container_border_width (GTK_CONTAINER (GTK_DIALOG(inputd)->action_area), 2);
gtk_container_set_border_width (GTK_CONTAINER (GTK_DIALOG(inputd)->action_area), 2);
gtk_box_set_homogeneous (GTK_BOX (GTK_DIALOG (inputd)->action_area),
FALSE);
hbbox = gtk_hbutton_box_new();
gtk_button_box_set_spacing(GTK_BUTTON_BOX (hbbox), 4);
gtk_widget_reparent (GTK_INPUT_DIALOG (inputd)->save_button, hbbox);
GTK_WIDGET_SET_FLAGS (GTK_INPUT_DIALOG (inputd)->save_button,
GTK_CAN_DEFAULT);
gtk_widget_reparent (GTK_INPUT_DIALOG (inputd)->close_button, hbbox);
GTK_WIDGET_SET_FLAGS (GTK_INPUT_DIALOG (inputd)->close_button,
GTK_CAN_DEFAULT);
gtk_box_pack_end(GTK_BOX (GTK_DIALOG (inputd)->action_area), hbbox,
FALSE, FALSE, 0);
gtk_widget_grab_default (GTK_INPUT_DIALOG (inputd)->close_button);
gtk_widget_show(hbbox);
gtk_signal_connect (GTK_OBJECT(GTK_INPUT_DIALOG(inputd)->save_button),
"clicked",
@ -1035,6 +1053,13 @@ device_preview_events (GtkWidget *widget,
break; /* Error no device info */
}
/* Grab the pointer */
gdk_pointer_grab (widget->window, FALSE,
(GDK_POINTER_MOTION_HINT_MASK |
GDK_BUTTON1_MOTION_MASK |
GDK_BUTTON_RELEASE_MASK),
NULL, NULL, bevent->time);
if(type == BRUSH_PREVIEW)
{
brush = device_info->brush;

View file

@ -367,7 +367,7 @@ file_new_cmd_callback (GtkWidget *widget,
gtk_widget_show (hbox);
vals->size_sizeentry = gimp_size_entry_new (2, vals->unit, "%p",
FALSE, TRUE, 75,
FALSE, FALSE, TRUE, 75,
GIMP_SIZE_ENTRY_UPDATE_SIZE);
gimp_size_entry_set_resolution (GIMP_SIZE_ENTRY (vals->size_sizeentry), 0,
vals->xresolution, FALSE);
@ -401,7 +401,7 @@ file_new_cmd_callback (GtkWidget *widget,
gtk_widget_show (hbox);
vals->simple_res = gimp_size_entry_new (1, vals->res_unit, "%s",
FALSE, FALSE, 75,
FALSE, FALSE, FALSE, 75,
GIMP_SIZE_ENTRY_UPDATE_RESOLUTION);
gimp_size_entry_set_refval_boundaries (GIMP_SIZE_ENTRY (vals->simple_res),
0, 1, 32767);
@ -424,7 +424,7 @@ file_new_cmd_callback (GtkWidget *widget,
(not shown by default, but used to keep track of all the variables) */
vals->resolution_sizeentry =
gimp_size_entry_new (2, vals->res_unit, "%s",
FALSE, TRUE, 75,
FALSE, FALSE, TRUE, 75,
GIMP_SIZE_ENTRY_UPDATE_RESOLUTION);
gimp_size_entry_set_refval_boundaries (GIMP_SIZE_ENTRY (vals->resolution_sizeentry),
0, 1, 32767);

View file

@ -53,7 +53,8 @@ info_field_new (InfoDialog *idialog,
label = gtk_label_new (gettext (title));
gtk_misc_set_alignment (GTK_MISC (label), 1.0, 0.5);
gtk_table_attach (GTK_TABLE (idialog->info_table), label,
0, 1, row - 1, row, GTK_SHRINK | GTK_FILL, GTK_SHRINK, 0, 0);
0, 1, row - 1, row,
GTK_SHRINK | GTK_FILL, GTK_SHRINK | GTK_FILL, 0, 0);
gtk_widget_show (label);
gtk_table_attach_defaults (GTK_TABLE (idialog->info_table), widget,
@ -293,7 +294,7 @@ info_dialog_add_spinbutton (InfoDialog *idialog,
adjustment = gtk_adjustment_new (value_ptr ? *value_ptr : 0, lower, upper,
step_increment, page_increment, page_size);
spinbutton = gtk_spin_button_new (GTK_ADJUSTMENT (adjustment),
climb_rate, MIN (MAX (digits, 6), 0));
climb_rate, MAX (MIN (digits, 6), 0));
gtk_spin_button_set_shadow_type (GTK_SPIN_BUTTON (spinbutton),
GTK_SHADOW_NONE);
gtk_spin_button_set_numeric (GTK_SPIN_BUTTON (spinbutton), TRUE);
@ -320,6 +321,7 @@ info_dialog_add_sizeentry (InfoDialog *idialog,
GUnit unit,
gchar *unit_format,
gboolean menu_show_pixels,
gboolean menu_show_percent,
gboolean show_refval,
GimpSizeEntryUP update_policy,
GtkSignalFunc callback,
@ -334,7 +336,8 @@ info_dialog_add_sizeentry (InfoDialog *idialog,
alignment = gtk_alignment_new (0.0, 0.5, 0.0, 1.0);
sizeentry = gimp_size_entry_new (nfields, unit, unit_format,
menu_show_pixels, show_refval, 75,
menu_show_pixels, menu_show_percent,
show_refval, 75,
update_policy);
if (value_ptr)
for (i = 0; i < nfields; i++)

View file

@ -109,6 +109,7 @@ GtkWidget *info_dialog_add_sizeentry (InfoDialog *idialog,
GUnit unit,
gchar *unit_format,
gboolean menu_show_pixels,
gboolean menu_show_percent,
gboolean show_refval,
GimpSizeEntryUP update_policy,
GtkSignalFunc callback,

View file

@ -127,6 +127,7 @@ void
create_input_dialog (void)
{
static GtkWidget *inputd = NULL;
GtkWidget *hbbox;
if (!inputd)
{
@ -135,7 +136,24 @@ create_input_dialog (void)
/* register this one only */
dialog_register(inputd);
gtk_container_border_width (GTK_CONTAINER (GTK_DIALOG(inputd)->action_area), 2);
gtk_container_set_border_width (GTK_CONTAINER (GTK_DIALOG(inputd)->action_area), 2);
gtk_box_set_homogeneous (GTK_BOX (GTK_DIALOG (inputd)->action_area),
FALSE);
hbbox = gtk_hbutton_box_new();
gtk_button_box_set_spacing(GTK_BUTTON_BOX (hbbox), 4);
gtk_widget_reparent (GTK_INPUT_DIALOG (inputd)->save_button, hbbox);
GTK_WIDGET_SET_FLAGS (GTK_INPUT_DIALOG (inputd)->save_button,
GTK_CAN_DEFAULT);
gtk_widget_reparent (GTK_INPUT_DIALOG (inputd)->close_button, hbbox);
GTK_WIDGET_SET_FLAGS (GTK_INPUT_DIALOG (inputd)->close_button,
GTK_CAN_DEFAULT);
gtk_box_pack_end(GTK_BOX (GTK_DIALOG (inputd)->action_area), hbbox,
FALSE, FALSE, 0);
gtk_widget_grab_default (GTK_INPUT_DIALOG (inputd)->close_button);
gtk_widget_show(hbbox);
gtk_signal_connect (GTK_OBJECT(GTK_INPUT_DIALOG(inputd)->save_button),
"clicked",
@ -1035,6 +1053,13 @@ device_preview_events (GtkWidget *widget,
break; /* Error no device info */
}
/* Grab the pointer */
gdk_pointer_grab (widget->window, FALSE,
(GDK_POINTER_MOTION_HINT_MASK |
GDK_BUTTON1_MOTION_MASK |
GDK_BUTTON_RELEASE_MASK),
NULL, NULL, bevent->time);
if(type == BRUSH_PREVIEW)
{
brush = device_info->brush;

View file

@ -86,11 +86,11 @@ static int old_cycled_marching_ants;
static int old_last_opened_size;
static char * old_temp_path;
static char * old_swap_path;
static char * old_plug_in_path;
static char * old_module_path;
static char * old_brush_path;
static char * old_pattern_path;
static char * old_palette_path;
static char * old_plug_in_path;
static char * old_module_path;
static char * old_gradient_path;
static float old_monitor_xres;
static float old_monitor_yres;
@ -98,20 +98,21 @@ static int old_using_xserver_resolution;
static int old_num_processors;
static char * old_image_title_format;
static char * edit_temp_path = NULL;
static char * edit_swap_path = NULL;
static char * edit_brush_path = NULL;
static char * edit_pattern_path = NULL;
static char * edit_palette_path = NULL;
static char * edit_plug_in_path = NULL;
static char * edit_module_path = NULL;
static char * edit_gradient_path = NULL;
/* variables which can't be changed on the fly */
static int edit_stingy_memory_use;
static int edit_tile_cache_size;
static int edit_install_cmap;
static int edit_cycled_marching_ants;
static int edit_last_opened_size;
static int edit_num_processors;
static char * edit_temp_path = NULL;
static char * edit_swap_path = NULL;
static char * edit_plug_in_path = NULL;
static char * edit_module_path = NULL;
static char * edit_brush_path = NULL;
static char * edit_pattern_path = NULL;
static char * edit_palette_path = NULL;
static char * edit_gradient_path = NULL;
static GtkWidget *prefs_dlg = NULL;
@ -121,10 +122,8 @@ static int mem_size_unit;
static GtkWidget *default_size_sizeentry = NULL;
static GtkWidget *default_resolution_sizeentry = NULL;
static GtkWidget *default_resolution_force_equal = NULL;
static GtkWidget *resolution_xserver_label = NULL;
static GtkWidget *monitor_resolution_sizeentry = NULL;
static GtkWidget *monitor_resolution_force_equal = NULL;
/* Some information regarding preferences, compiled by Raph Levien 11/3/97.
updated by Michael Natterer 27/3/99
@ -133,20 +132,20 @@ static GtkWidget *monitor_resolution_force_equal = NULL;
according to the existing pref code - it may be that changing them
so they're set on the fly is not hard).
temp-path
swap-path
brush-path
pattern-path
plug-in-path
module-path
palette-path
gradient-path
stingy-memory-use
tile-cache-size
install-cmap
cycled-marching-ants
last-opened-size
num-processors
temp-path
swap-path
plug-in-path
module-path
brush-path
pattern-path
palette-path
gradient-path
All of these now have variables of the form edit_temp_path, which
are copied from the actual variables (e.g. temp_path) the first time
@ -240,7 +239,7 @@ file_prefs_ok_callback (GtkWidget *widget,
if (default_units < UNIT_INCH ||
default_units >= gimp_unit_get_number_of_units ())
{
g_message (_("Error: Default units must be within unit range."));
g_message (_("Error: Default unit must be within unit range."));
default_units = old_default_units;
return;
}
@ -254,32 +253,31 @@ file_prefs_ok_callback (GtkWidget *widget,
if (default_resolution_units < UNIT_INCH ||
default_resolution_units >= gimp_unit_get_number_of_units ())
{
g_message (_("Error: Default units must be within unit range."));
g_message (_("Error: Default resolution unit must be within unit range."));
default_resolution_units = old_default_resolution_units;
return;
}
if (monitor_xres < 1e-5 || monitor_yres < 1e-5)
{
g_message (_("Error: monitor resolution must not be zero."));
g_message (_("Error: Monitor resolution must not be zero."));
monitor_xres = old_monitor_xres;
monitor_yres = old_monitor_yres;
return;
}
if (image_title_format == NULL)
{
g_message (_("Error: image_title_format should never be NULL."));
g_message (_("Error: Image title format must not be NULL."));
image_title_format = old_image_title_format;
return;
}
gtk_widget_destroy (dlg);
prefs_dlg = NULL;
tile_cache_size_adjustment = NULL;
default_size_sizeentry = NULL;
default_resolution_sizeentry = NULL;
default_resolution_force_equal = NULL;
resolution_xserver_label = NULL;
monitor_resolution_sizeentry = NULL;
monitor_resolution_force_equal = NULL;
if (show_tool_tips)
gtk_tooltips_enable (tool_tips);
@ -293,20 +291,22 @@ file_prefs_save_callback (GtkWidget *widget,
{
GList *update = NULL; /* options that should be updated in .gimprc */
GList *remove = NULL; /* options that should be commented out */
int save_stingy_memory_use;
int save_tile_cache_size;
int save_num_processors;
int save_install_cmap;
int save_cycled_marching_ants;
int save_last_opened_size;
int save_num_processors;
gchar *save_temp_path;
gchar *save_swap_path;
gchar *save_plug_in_path;
gchar *save_module_path;
gchar *save_brush_path;
gchar *save_pattern_path;
gchar *save_palette_path;
gchar *save_plug_in_path;
gchar *save_module_path;
gchar *save_gradient_path;
int restart_notification = FALSE;
file_prefs_ok_callback (widget, dlg);
@ -317,15 +317,15 @@ file_prefs_save_callback (GtkWidget *widget,
save_install_cmap = install_cmap;
save_cycled_marching_ants = cycled_marching_ants;
save_last_opened_size = last_opened_size;
save_num_processors = num_processors;
save_temp_path = temp_path;
save_swap_path = swap_path;
save_plug_in_path = plug_in_path;
save_module_path = module_path;
save_brush_path = brush_path;
save_pattern_path = pattern_path;
save_palette_path = palette_path;
save_plug_in_path = plug_in_path;
save_module_path = module_path;
save_gradient_path = gradient_path;
save_num_processors = num_processors;
if (levels_of_undo != old_levels_of_undo)
update = g_list_append (update, "undo-levels");
@ -453,6 +453,18 @@ file_prefs_save_callback (GtkWidget *widget,
swap_path = edit_swap_path;
restart_notification = TRUE;
}
if (file_prefs_strcmp (plug_in_path, edit_plug_in_path))
{
update = g_list_append (update, "plug-in-path");
plug_in_path = edit_plug_in_path;
restart_notification = TRUE;
}
if (file_prefs_strcmp (module_path, edit_module_path))
{
update = g_list_append (update, "module-path");
module_path = edit_module_path;
restart_notification = TRUE;
}
if (file_prefs_strcmp (brush_path, edit_brush_path))
{
update = g_list_append (update, "brush-path");
@ -471,18 +483,6 @@ file_prefs_save_callback (GtkWidget *widget,
palette_path = edit_palette_path;
restart_notification = TRUE;
}
if (file_prefs_strcmp (plug_in_path, edit_plug_in_path))
{
update = g_list_append (update, "plug-in-path");
plug_in_path = edit_plug_in_path;
restart_notification = TRUE;
}
if (file_prefs_strcmp (module_path, edit_module_path))
{
update = g_list_append (update, "module-path");
module_path = edit_module_path;
restart_notification = TRUE;
}
if (file_prefs_strcmp (gradient_path, edit_gradient_path))
{
update = g_list_append (update, "gradient-path");
@ -510,13 +510,14 @@ file_prefs_save_callback (GtkWidget *widget,
install_cmap = save_install_cmap;
cycled_marching_ants = save_cycled_marching_ants;
last_opened_size = save_last_opened_size;
num_processors = save_num_processors;
temp_path = save_temp_path;
swap_path = save_swap_path;
plug_in_path = save_plug_in_path;
module_path = save_module_path;
brush_path = save_brush_path;
pattern_path = save_pattern_path;
palette_path = save_palette_path;
plug_in_path = save_plug_in_path;
module_path = save_module_path;
gradient_path = save_gradient_path;
if (restart_notification)
@ -533,12 +534,11 @@ 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;
default_resolution_force_equal = NULL;
resolution_xserver_label = NULL;
monitor_resolution_sizeentry = NULL;
monitor_resolution_force_equal = NULL;
levels_of_undo = old_levels_of_undo;
marching_speed = old_marching_speed;
@ -592,11 +592,11 @@ file_prefs_cancel_callback (GtkWidget *widget,
file_prefs_strset (&edit_temp_path, old_temp_path);
file_prefs_strset (&edit_swap_path, old_swap_path);
file_prefs_strset (&edit_plug_in_path, old_plug_in_path);
file_prefs_strset (&edit_module_path, old_module_path);
file_prefs_strset (&edit_brush_path, old_brush_path);
file_prefs_strset (&edit_pattern_path, old_pattern_path);
file_prefs_strset (&edit_palette_path, old_palette_path);
file_prefs_strset (&edit_plug_in_path, old_plug_in_path);
file_prefs_strset (&edit_module_path, old_module_path);
file_prefs_strset (&edit_gradient_path, old_gradient_path);
file_prefs_strset (&image_title_format, old_image_title_format);
@ -811,10 +811,6 @@ file_prefs_res_source_callback (GtkWidget *widget,
gtk_widget_set_sensitive (monitor_resolution_sizeentry,
! GTK_TOGGLE_BUTTON (widget)->active);
if (monitor_resolution_force_equal)
gtk_widget_set_sensitive (monitor_resolution_force_equal,
! GTK_TOGGLE_BUTTON (widget)->active);
if (GTK_TOGGLE_BUTTON (widget)->active)
{
gdisplay_xserver_resolution (&monitor_xres, &monitor_yres);
@ -926,10 +922,6 @@ gimp_dialog_realize_callback (GtkWidget *widget,
/* this is an experimental one
* I tried to fold the entire dialog creation and the ActionArea stuff
* into one function. Might be not general enough.
* todo:
* - session management?? (probably not)
* - window placement
* - policy setting
*/
GtkWidget*
gimp_dialog_new (const gchar *title,
@ -967,7 +959,7 @@ gimp_dialog_new (const gchar *title,
gtk_window_set_policy (GTK_WINDOW (dialog),
allow_grow, allow_shrink, auto_shrink);
/* prepare the action_area */
/* prepare the action_area */
gtk_container_border_width (GTK_CONTAINER (GTK_DIALOG (dialog)->action_area),
2);
gtk_box_set_homogeneous (GTK_BOX (GTK_DIALOG (dialog)->action_area), FALSE);
@ -978,6 +970,7 @@ gimp_dialog_new (const gchar *title,
FALSE, FALSE, 0);
gtk_widget_show (hbbox);
/* the action_area buttons */
va_start (args, connect_delete);
while (label)
{
@ -985,7 +978,7 @@ gimp_dialog_new (const gchar *title,
GTK_WIDGET_SET_FLAGS (button, GTK_CAN_DEFAULT);
gtk_box_pack_start (GTK_BOX (hbbox), button, FALSE, FALSE, 0);
/* pass data as user_data if data != NULL, or the dialog otherwise */
/* pass data as user_data if data != NULL, or the dialog otherwise */
if (callback)
gtk_signal_connect (GTK_OBJECT (button), "clicked",
GTK_SIGNAL_FUNC (callback),
@ -1000,7 +993,7 @@ gimp_dialog_new (const gchar *title,
"gimp_dialog_cancel_widget",
button);
/* catch WM delete event */
/* catch the WM delete event */
gtk_signal_connect (GTK_OBJECT (dialog), "delete_event",
(GdkEventFunc) gimp_dialog_delete_callback,
data ? data : dialog);
@ -1023,13 +1016,13 @@ gimp_dialog_new (const gchar *title,
}
va_end (args);
/* catch WM delete event if not already done*/
/* catch the WM delete event if not already done */
if (! delete_connected)
gtk_signal_connect (GTK_OBJECT (dialog), "delete_event",
(GdkEventFunc) gimp_dialog_delete_callback,
NULL);
/* the realize callback sets the wm icon pixmap */
/* the realize callback sets the WM icon */
/*
gtk_signal_connect (GTK_OBJECT (dialog), "realize",
(GtkSignalFunc) gimp_dialog_realize_callback,
@ -1041,7 +1034,7 @@ gimp_dialog_new (const gchar *title,
GtkWidget*
gimp_option_menu_new (GtkSignalFunc menu_item_callback,
gpointer initial,
gpointer initial, /* set_data */
/* this is a menu item */
gchar *label,
@ -1063,6 +1056,7 @@ gimp_option_menu_new (GtkSignalFunc menu_item_callback,
menu = gtk_menu_new ();
/* create the menu items */
initial_index = 0;
va_start (args, set_data);
for (i = 0; label; i++)
@ -1074,7 +1068,7 @@ gimp_option_menu_new (GtkSignalFunc menu_item_callback,
gtk_object_set_user_data (GTK_OBJECT (menuitem), set_data);
gtk_widget_show (menuitem);
/* remember the initial menu item */
/* remember the initial menu item */
if (set_data == initial)
initial_index = i;
@ -1090,7 +1084,7 @@ gimp_option_menu_new (GtkSignalFunc menu_item_callback,
optionmenu = gtk_option_menu_new ();
gtk_option_menu_set_menu (GTK_OPTION_MENU (optionmenu), menu);
/* select the initial menu item */
/* select the initial menu item */
gtk_option_menu_set_history (GTK_OPTION_MENU (optionmenu), initial_index);
return optionmenu;
@ -1098,7 +1092,7 @@ gimp_option_menu_new (GtkSignalFunc menu_item_callback,
GtkWidget*
gimp_radio_group_new (GtkSignalFunc radio_button_callback,
gpointer initial,
gpointer initial, /* set_data */
/* this is a radio button */
gchar *label,
@ -1120,6 +1114,7 @@ gimp_radio_group_new (GtkSignalFunc radio_button_callback,
gtk_container_set_border_width (GTK_CONTAINER (vbox), 2);
group = NULL;
/* create the radio buttons */
va_start (args, set_data);
while (label)
{
@ -1131,7 +1126,7 @@ gimp_radio_group_new (GtkSignalFunc radio_button_callback,
data);
gtk_object_set_user_data (GTK_OBJECT (button), set_data);
/* press the initially active radio button */
/* press the initially active radio button */
if (set_data == initial)
gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (button), TRUE);
@ -1151,7 +1146,7 @@ gimp_radio_group_new (GtkSignalFunc radio_button_callback,
/* this might be the standard gimp spinbutton */
GtkWidget*
gimp_spin_button_new (GtkObject **adjustment, /* return value */
gimp_spin_button_new (GtkObject **adjustment, /* return value */
gfloat value,
gfloat lower,
gfloat upper,
@ -1176,25 +1171,29 @@ gimp_spin_button_new (GtkObject **adjustment, /* return value */
return spinbutton;
}
/* add correctly aligned label & widget to a two-column table */
/* add aligned label & widget to a two-column table */
void
gimp_table_attach_aligned (GtkTable *table,
gint row,
gchar *text,
gfloat xalign,
gfloat yalign,
GtkWidget *widget,
gboolean left_adjust)
{
GtkWidget *label;
label = gtk_label_new (text);
gtk_misc_set_alignment (GTK_MISC (label), 1.0, 0.5);
gtk_misc_set_alignment (GTK_MISC (label), xalign, yalign);
gtk_table_attach (table, GTK_WIDGET (label), 0, 1, row, row + 1,
GTK_SHRINK | GTK_FILL, GTK_SHRINK, 0, 0);
GTK_SHRINK | GTK_FILL, GTK_SHRINK | GTK_FILL, 0, 0);
gtk_widget_show (label);
if (left_adjust)
{
GtkWidget* alignment = gtk_alignment_new (0.0, 0.5, 0.0, 0.0);
GtkWidget *alignment;
alignment = gtk_alignment_new (0.0, 0.5, 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);
@ -1318,6 +1317,11 @@ file_pref_cmd_callback (GtkWidget *widget,
{
/* first time dialog is opened - copy config vals to edit
variables. */
edit_stingy_memory_use = stingy_memory_use;
edit_tile_cache_size = tile_cache_size;
edit_install_cmap = install_cmap;
edit_cycled_marching_ants = cycled_marching_ants;
edit_last_opened_size = last_opened_size;
edit_temp_path = file_prefs_strdup (temp_path);
edit_swap_path = file_prefs_strdup (swap_path);
edit_brush_path = file_prefs_strdup (brush_path);
@ -1326,11 +1330,6 @@ file_pref_cmd_callback (GtkWidget *widget,
edit_plug_in_path = file_prefs_strdup (plug_in_path);
edit_module_path = file_prefs_strdup (module_path);
edit_gradient_path = file_prefs_strdup (gradient_path);
edit_stingy_memory_use = stingy_memory_use;
edit_tile_cache_size = tile_cache_size;
edit_install_cmap = install_cmap;
edit_cycled_marching_ants = cycled_marching_ants;
edit_last_opened_size = last_opened_size;
}
old_perfectmouse = perfectmouse;
old_transparency_type = transparency_type;
@ -1369,11 +1368,11 @@ file_pref_cmd_callback (GtkWidget *widget,
file_prefs_strset (&old_temp_path, edit_temp_path);
file_prefs_strset (&old_swap_path, edit_swap_path);
file_prefs_strset (&old_plug_in_path, edit_plug_in_path);
file_prefs_strset (&old_module_path, edit_module_path);
file_prefs_strset (&old_brush_path, edit_brush_path);
file_prefs_strset (&old_pattern_path, edit_pattern_path);
file_prefs_strset (&old_palette_path, edit_palette_path);
file_prefs_strset (&old_plug_in_path, edit_plug_in_path);
file_prefs_strset (&old_module_path, edit_module_path);
file_prefs_strset (&old_gradient_path, edit_gradient_path);
mem_size_unit = 1;
@ -1387,8 +1386,7 @@ file_pref_cmd_callback (GtkWidget *widget,
/* Create the dialog */
prefs_dlg =
gimp_dialog_new (_("Preferences"),
"gimp_preferences",
gimp_dialog_new (_("Preferences"), "gimp_preferences",
GTK_WIN_POS_NONE, FALSE, FALSE, FALSE,
_("OK"), file_prefs_ok_callback, NULL,
FALSE, FALSE,
@ -1454,7 +1452,7 @@ file_pref_cmd_callback (GtkWidget *widget,
gtk_widget_show (hbox);
default_size_sizeentry = gimp_size_entry_new (2, default_units, "%p",
FALSE, TRUE, 75,
FALSE, FALSE, TRUE, 75,
GIMP_SIZE_ENTRY_UPDATE_SIZE);
gimp_size_entry_set_resolution (GIMP_SIZE_ENTRY (default_size_sizeentry),
0, default_xresolution, FALSE);
@ -1490,10 +1488,10 @@ file_pref_cmd_callback (GtkWidget *widget,
gtk_container_add (GTK_CONTAINER (frame), hbox);
gtk_widget_show (hbox);
default_resolution_force_equal = gimp_chain_button_new (GIMP_CHAIN_BOTTOM);
button = gimp_chain_button_new (GIMP_CHAIN_BOTTOM);
default_resolution_sizeentry =
gimp_size_entry_new (2, default_resolution_units, "%s", FALSE, TRUE, 75,
gimp_size_entry_new (2, default_resolution_units, "%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);
@ -1512,24 +1510,24 @@ file_pref_cmd_callback (GtkWidget *widget,
gtk_signal_connect (GTK_OBJECT (default_resolution_sizeentry),
"unit_changed",
(GtkSignalFunc)file_prefs_default_resolution_callback,
default_resolution_force_equal);
button);
gtk_signal_connect (GTK_OBJECT (default_resolution_sizeentry),
"value_changed",
(GtkSignalFunc)file_prefs_default_resolution_callback,
default_resolution_force_equal);
button);
gtk_signal_connect (GTK_OBJECT (default_resolution_sizeentry),
"refval_changed",
(GtkSignalFunc)file_prefs_default_resolution_callback,
default_resolution_force_equal);
button);
gtk_box_pack_start (GTK_BOX (hbox), default_resolution_sizeentry,
FALSE, FALSE, 0);
gtk_widget_show (default_resolution_sizeentry);
gtk_table_attach_defaults (GTK_TABLE (default_resolution_sizeentry),
default_resolution_force_equal, 1, 3, 3, 4);
button, 1, 3, 3, 4);
if (ABS (default_xresolution - default_yresolution) < 1e-5)
gimp_chain_button_set_active (GIMP_CHAIN_BUTTON (default_resolution_force_equal), TRUE);
gtk_widget_show (default_resolution_force_equal);
gimp_chain_button_set_active (GIMP_CHAIN_BUTTON (button), TRUE);
gtk_widget_show (button);
hbox = gtk_hbox_new (FALSE, 2);
gtk_box_pack_start (GTK_BOX (vbox), hbox, FALSE, FALSE, 0);
@ -1549,7 +1547,8 @@ file_pref_cmd_callback (GtkWidget *widget,
_("Grayscale"), &default_type, (gpointer) GRAY,
NULL);
gimp_table_attach_aligned (GTK_TABLE (table), 0,
_("Default Image Type:"), optionmenu, TRUE);
_("Default Image Type:"), 1.0, 0.5,
optionmenu, TRUE);
/* Display page */
vbox = file_prefs_notebook_append_page (GTK_NOTEBOOK (notebook),
@ -1594,20 +1593,21 @@ file_pref_cmd_callback (GtkWidget *widget,
&transparency_type, (gpointer) BLACK_ONLY,
NULL);
gimp_table_attach_aligned (GTK_TABLE (table), 0,
_("Transparency Type:"), optionmenu, TRUE);
_("Transparency Type:"), 1.0, 0.5,
optionmenu, TRUE);
optionmenu =
gimp_option_menu_new (file_prefs_toggle_callback,
(gpointer) transparency_size,
_("Small Checks"),
_("Small"),
&transparency_size, (gpointer) SMALL_CHECKS,
_("Medium Checks"),
_("Medium"),
&transparency_size, (gpointer) MEDIUM_CHECKS,
_("Large Checks"),
_("Large"),
&transparency_size, (gpointer) LARGE_CHECKS,
NULL);
gimp_table_attach_aligned (GTK_TABLE (table), 1,
_("Check Size:"), optionmenu, TRUE);
_("Check Size:"), 1.0, 0.5, optionmenu, TRUE);
frame = gtk_frame_new (_("Scaling"));
gtk_box_pack_start (GTK_BOX (vbox), frame, FALSE, FALSE, 0);
@ -1675,7 +1675,7 @@ file_pref_cmd_callback (GtkWidget *widget,
_("Large"), (gpointer) 128, (gpointer) 128,
NULL);
gimp_table_attach_aligned (GTK_TABLE (table), 0,
_("Preview Size:"), optionmenu, TRUE);
_("Preview Size:"), 1.0, 0.5, optionmenu, TRUE);
spinbutton =
gimp_spin_button_new (&adjustment,
@ -1684,7 +1684,7 @@ file_pref_cmd_callback (GtkWidget *widget,
(GtkSignalFunc) file_prefs_int_adjustment_callback,
&levels_of_undo);
gimp_table_attach_aligned (GTK_TABLE (table), 1,
_("Levels of Undo:"), spinbutton, TRUE);
_("Levels of Undo:"), 1.0, 0.5, spinbutton, TRUE);
spinbutton =
gimp_spin_button_new (&adjustment,
@ -1693,7 +1693,8 @@ file_pref_cmd_callback (GtkWidget *widget,
(GtkSignalFunc) file_prefs_int_adjustment_callback,
&edit_last_opened_size);
gimp_table_attach_aligned (GTK_TABLE (table), 2,
_("Recent Documents List Size:"), spinbutton, TRUE);
_("Recent Documents List Size:"), 1.0, 0.5,
spinbutton, TRUE);
frame = gtk_frame_new (_("Help System"));
gtk_box_pack_start (GTK_BOX (vbox), frame, FALSE, FALSE, 0);
@ -1769,13 +1770,14 @@ file_pref_cmd_callback (GtkWidget *widget,
spinbutton =
gimp_spin_button_new (&adjustment,
marching_speed, 0.0, 32000.0, 50.0, 100.0, 0.0,
marching_speed, 50.0, 32000.0, 10.0, 100.0, 1.0,
1.0, 0.0);
gtk_signal_connect (GTK_OBJECT (adjustment), "value_changed",
(GtkSignalFunc) file_prefs_int_adjustment_callback,
&marching_speed);
gimp_table_attach_aligned (GTK_TABLE (table), 0,
_("Marching Ants Speed:"), spinbutton, TRUE);
_("Marching Ants Speed:"), 1.0, 0.5,
spinbutton, TRUE);
/* The title format string */
combo = gtk_combo_new ();
@ -1814,7 +1816,7 @@ file_pref_cmd_callback (GtkWidget *widget,
&image_title_format);
gimp_table_attach_aligned (GTK_TABLE (table), 1,
_("Image Title Format:"), combo, FALSE);
_("Image Title Format:"), 1.0, 0.5, combo, FALSE);
/* End of the title format string */
frame = gtk_frame_new (_("Pointer Movement Feedback"));
@ -1907,7 +1909,7 @@ file_pref_cmd_callback (GtkWidget *widget,
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:"), hbox, TRUE);
_("Tile Cache Size:"), 1.0, 0.5, hbox, TRUE);
#ifdef ENABLE_MP
spinbutton =
@ -1917,7 +1919,7 @@ file_pref_cmd_callback (GtkWidget *widget,
(GtkSignalFunc) file_prefs_int_adjustment_callback,
&num_processors);
gimp_table_attach_aligned (GTK_TABLE (table), 1,
_("Number of Processors to Use:"),
_("Number of Processors to Use:"), 1.0, 0.5,
spinbutton, TRUE);
#endif /* ENABLE_MP */
@ -2065,17 +2067,17 @@ file_pref_cmd_callback (GtkWidget *widget,
group = gtk_radio_button_group (GTK_RADIO_BUTTON (button));
gtk_box_pack_start (GTK_BOX (vbox2), button, FALSE, FALSE, 0);
gtk_widget_show (button);
if (!using_xserver_resolution)
if (! using_xserver_resolution)
gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (button), TRUE);
abox = gtk_alignment_new (0.5, 0.5, 0.0, 1.0);
abox = gtk_alignment_new (0.5, 0.5, 0.0, 0.0);
gtk_box_pack_start (GTK_BOX (vbox2), abox, FALSE, FALSE, 0);
gtk_widget_show (abox);
monitor_resolution_force_equal = gimp_chain_button_new (GIMP_CHAIN_BOTTOM);
monitor_resolution_sizeentry = gimp_size_entry_new (2, UNIT_INCH, "%s",
FALSE, TRUE, 75,
GIMP_SIZE_ENTRY_UPDATE_RESOLUTION);
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_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 (GIMP_SIZE_ENTRY (monitor_resolution_sizeentry),
@ -2093,25 +2095,22 @@ file_pref_cmd_callback (GtkWidget *widget,
gtk_signal_connect (GTK_OBJECT (monitor_resolution_sizeentry),
"value_changed",
(GtkSignalFunc)file_prefs_monitor_resolution_callback,
monitor_resolution_force_equal);
button);
gtk_signal_connect (GTK_OBJECT (monitor_resolution_sizeentry),
"refval_changed",
(GtkSignalFunc)file_prefs_monitor_resolution_callback,
monitor_resolution_force_equal);
button);
gtk_container_add (GTK_CONTAINER (abox), monitor_resolution_sizeentry);
gtk_widget_show (monitor_resolution_sizeentry);
if (ABS (monitor_xres - monitor_yres) < 1e-5)
gimp_chain_button_set_active (GIMP_CHAIN_BUTTON (monitor_resolution_force_equal),
TRUE);
gimp_chain_button_set_active (GIMP_CHAIN_BUTTON (button), TRUE);
gtk_table_attach_defaults (GTK_TABLE (monitor_resolution_sizeentry),
monitor_resolution_force_equal, 1, 3, 3, 4);
gtk_widget_show (monitor_resolution_force_equal);
button, 1, 3, 3, 4);
gtk_widget_show (button);
gtk_widget_set_sensitive (monitor_resolution_sizeentry,
!using_xserver_resolution);
gtk_widget_set_sensitive (monitor_resolution_force_equal,
!using_xserver_resolution);
/* Directories */
vbox = file_prefs_notebook_append_page (GTK_NOTEBOOK (notebook),
@ -2150,7 +2149,8 @@ file_pref_cmd_callback (GtkWidget *widget,
(GtkSignalFunc) file_prefs_filename_callback,
dirs[i].mdir);
gimp_table_attach_aligned (GTK_TABLE (table), i,
gettext(dirs[i].label), fileselection, FALSE);
gettext(dirs[i].label), 1.0, 0.5,
fileselection, FALSE);
}
}
@ -2164,12 +2164,12 @@ file_pref_cmd_callback (GtkWidget *widget,
} paths[] = {
{ N_("Brushes"), N_("Brushes Directories"), N_("Select Brushes Dir"),
&edit_brush_path },
{ N_("Gradients"), N_("Gradients Directories"), N_("Select Gradients Dir"),
&edit_gradient_path },
{ N_("Patterns"), N_("Patterns Directories"), N_("Select Patterns Dir"),
&edit_pattern_path },
{ N_("Palettes"), N_("Palettes Directories"), N_("Select Palettes Dir"),
&edit_palette_path },
{ N_("Gradients"), N_("Gradients Directories"), N_("Select Gradients Dir"),
&edit_gradient_path },
{ N_("Plug-Ins"), N_("Plug-Ins Directories"), N_("Select Plug-Ins Dir"),
&edit_plug_in_path },
{ N_("Modules"), N_("Modules Directories"), N_("Select Modules Dir"),

View file

@ -53,7 +53,8 @@ info_field_new (InfoDialog *idialog,
label = gtk_label_new (gettext (title));
gtk_misc_set_alignment (GTK_MISC (label), 1.0, 0.5);
gtk_table_attach (GTK_TABLE (idialog->info_table), label,
0, 1, row - 1, row, GTK_SHRINK | GTK_FILL, GTK_SHRINK, 0, 0);
0, 1, row - 1, row,
GTK_SHRINK | GTK_FILL, GTK_SHRINK | GTK_FILL, 0, 0);
gtk_widget_show (label);
gtk_table_attach_defaults (GTK_TABLE (idialog->info_table), widget,
@ -293,7 +294,7 @@ info_dialog_add_spinbutton (InfoDialog *idialog,
adjustment = gtk_adjustment_new (value_ptr ? *value_ptr : 0, lower, upper,
step_increment, page_increment, page_size);
spinbutton = gtk_spin_button_new (GTK_ADJUSTMENT (adjustment),
climb_rate, MIN (MAX (digits, 6), 0));
climb_rate, MAX (MIN (digits, 6), 0));
gtk_spin_button_set_shadow_type (GTK_SPIN_BUTTON (spinbutton),
GTK_SHADOW_NONE);
gtk_spin_button_set_numeric (GTK_SPIN_BUTTON (spinbutton), TRUE);
@ -320,6 +321,7 @@ info_dialog_add_sizeentry (InfoDialog *idialog,
GUnit unit,
gchar *unit_format,
gboolean menu_show_pixels,
gboolean menu_show_percent,
gboolean show_refval,
GimpSizeEntryUP update_policy,
GtkSignalFunc callback,
@ -334,7 +336,8 @@ info_dialog_add_sizeentry (InfoDialog *idialog,
alignment = gtk_alignment_new (0.0, 0.5, 0.0, 1.0);
sizeentry = gimp_size_entry_new (nfields, unit, unit_format,
menu_show_pixels, show_refval, 75,
menu_show_pixels, menu_show_percent,
show_refval, 75,
update_policy);
if (value_ptr)
for (i = 0; i < nfields; i++)

View file

@ -109,6 +109,7 @@ GtkWidget *info_dialog_add_sizeentry (InfoDialog *idialog,
GUnit unit,
gchar *unit_format,
gboolean menu_show_pixels,
gboolean menu_show_percent,
gboolean show_refval,
GimpSizeEntryUP update_policy,
GtkSignalFunc callback,

View file

@ -1019,7 +1019,7 @@ query_size_box (gchar *title,
(GtkSignalFunc) size_query_box_ok_callback,
query_box);
sizeentry = gimp_size_entry_new (1, unit, "%p", TRUE, FALSE, 100,
sizeentry = gimp_size_entry_new (1, unit, "%p", TRUE, FALSE, FALSE, 100,
GIMP_SIZE_ENTRY_UPDATE_SIZE);
gimp_size_entry_set_resolution (GIMP_SIZE_ENTRY (sizeentry), 0,
resolution, FALSE);

View file

@ -15,8 +15,6 @@
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/
#include <stdio.h>
#include "appenv.h"
#include "drawable.h"
#include "gdisplay.h"
@ -169,7 +167,8 @@ perspective_info_update (Tool *tool)
for (j = 0; j < 3; j++)
{
p += sprintf (p, "%10.3g", transform_core->transform[i][j]);
p += g_snprintf (p, MAX_INFO_BUF - (p - matrix_row_buf[i]),
"%10.3g", transform_core->transform[i][j]);
}
}

View file

@ -86,11 +86,11 @@ static int old_cycled_marching_ants;
static int old_last_opened_size;
static char * old_temp_path;
static char * old_swap_path;
static char * old_plug_in_path;
static char * old_module_path;
static char * old_brush_path;
static char * old_pattern_path;
static char * old_palette_path;
static char * old_plug_in_path;
static char * old_module_path;
static char * old_gradient_path;
static float old_monitor_xres;
static float old_monitor_yres;
@ -98,20 +98,21 @@ static int old_using_xserver_resolution;
static int old_num_processors;
static char * old_image_title_format;
static char * edit_temp_path = NULL;
static char * edit_swap_path = NULL;
static char * edit_brush_path = NULL;
static char * edit_pattern_path = NULL;
static char * edit_palette_path = NULL;
static char * edit_plug_in_path = NULL;
static char * edit_module_path = NULL;
static char * edit_gradient_path = NULL;
/* variables which can't be changed on the fly */
static int edit_stingy_memory_use;
static int edit_tile_cache_size;
static int edit_install_cmap;
static int edit_cycled_marching_ants;
static int edit_last_opened_size;
static int edit_num_processors;
static char * edit_temp_path = NULL;
static char * edit_swap_path = NULL;
static char * edit_plug_in_path = NULL;
static char * edit_module_path = NULL;
static char * edit_brush_path = NULL;
static char * edit_pattern_path = NULL;
static char * edit_palette_path = NULL;
static char * edit_gradient_path = NULL;
static GtkWidget *prefs_dlg = NULL;
@ -121,10 +122,8 @@ static int mem_size_unit;
static GtkWidget *default_size_sizeentry = NULL;
static GtkWidget *default_resolution_sizeentry = NULL;
static GtkWidget *default_resolution_force_equal = NULL;
static GtkWidget *resolution_xserver_label = NULL;
static GtkWidget *monitor_resolution_sizeentry = NULL;
static GtkWidget *monitor_resolution_force_equal = NULL;
/* Some information regarding preferences, compiled by Raph Levien 11/3/97.
updated by Michael Natterer 27/3/99
@ -133,20 +132,20 @@ static GtkWidget *monitor_resolution_force_equal = NULL;
according to the existing pref code - it may be that changing them
so they're set on the fly is not hard).
temp-path
swap-path
brush-path
pattern-path
plug-in-path
module-path
palette-path
gradient-path
stingy-memory-use
tile-cache-size
install-cmap
cycled-marching-ants
last-opened-size
num-processors
temp-path
swap-path
plug-in-path
module-path
brush-path
pattern-path
palette-path
gradient-path
All of these now have variables of the form edit_temp_path, which
are copied from the actual variables (e.g. temp_path) the first time
@ -240,7 +239,7 @@ file_prefs_ok_callback (GtkWidget *widget,
if (default_units < UNIT_INCH ||
default_units >= gimp_unit_get_number_of_units ())
{
g_message (_("Error: Default units must be within unit range."));
g_message (_("Error: Default unit must be within unit range."));
default_units = old_default_units;
return;
}
@ -254,32 +253,31 @@ file_prefs_ok_callback (GtkWidget *widget,
if (default_resolution_units < UNIT_INCH ||
default_resolution_units >= gimp_unit_get_number_of_units ())
{
g_message (_("Error: Default units must be within unit range."));
g_message (_("Error: Default resolution unit must be within unit range."));
default_resolution_units = old_default_resolution_units;
return;
}
if (monitor_xres < 1e-5 || monitor_yres < 1e-5)
{
g_message (_("Error: monitor resolution must not be zero."));
g_message (_("Error: Monitor resolution must not be zero."));
monitor_xres = old_monitor_xres;
monitor_yres = old_monitor_yres;
return;
}
if (image_title_format == NULL)
{
g_message (_("Error: image_title_format should never be NULL."));
g_message (_("Error: Image title format must not be NULL."));
image_title_format = old_image_title_format;
return;
}
gtk_widget_destroy (dlg);
prefs_dlg = NULL;
tile_cache_size_adjustment = NULL;
default_size_sizeentry = NULL;
default_resolution_sizeentry = NULL;
default_resolution_force_equal = NULL;
resolution_xserver_label = NULL;
monitor_resolution_sizeentry = NULL;
monitor_resolution_force_equal = NULL;
if (show_tool_tips)
gtk_tooltips_enable (tool_tips);
@ -293,20 +291,22 @@ file_prefs_save_callback (GtkWidget *widget,
{
GList *update = NULL; /* options that should be updated in .gimprc */
GList *remove = NULL; /* options that should be commented out */
int save_stingy_memory_use;
int save_tile_cache_size;
int save_num_processors;
int save_install_cmap;
int save_cycled_marching_ants;
int save_last_opened_size;
int save_num_processors;
gchar *save_temp_path;
gchar *save_swap_path;
gchar *save_plug_in_path;
gchar *save_module_path;
gchar *save_brush_path;
gchar *save_pattern_path;
gchar *save_palette_path;
gchar *save_plug_in_path;
gchar *save_module_path;
gchar *save_gradient_path;
int restart_notification = FALSE;
file_prefs_ok_callback (widget, dlg);
@ -317,15 +317,15 @@ file_prefs_save_callback (GtkWidget *widget,
save_install_cmap = install_cmap;
save_cycled_marching_ants = cycled_marching_ants;
save_last_opened_size = last_opened_size;
save_num_processors = num_processors;
save_temp_path = temp_path;
save_swap_path = swap_path;
save_plug_in_path = plug_in_path;
save_module_path = module_path;
save_brush_path = brush_path;
save_pattern_path = pattern_path;
save_palette_path = palette_path;
save_plug_in_path = plug_in_path;
save_module_path = module_path;
save_gradient_path = gradient_path;
save_num_processors = num_processors;
if (levels_of_undo != old_levels_of_undo)
update = g_list_append (update, "undo-levels");
@ -453,6 +453,18 @@ file_prefs_save_callback (GtkWidget *widget,
swap_path = edit_swap_path;
restart_notification = TRUE;
}
if (file_prefs_strcmp (plug_in_path, edit_plug_in_path))
{
update = g_list_append (update, "plug-in-path");
plug_in_path = edit_plug_in_path;
restart_notification = TRUE;
}
if (file_prefs_strcmp (module_path, edit_module_path))
{
update = g_list_append (update, "module-path");
module_path = edit_module_path;
restart_notification = TRUE;
}
if (file_prefs_strcmp (brush_path, edit_brush_path))
{
update = g_list_append (update, "brush-path");
@ -471,18 +483,6 @@ file_prefs_save_callback (GtkWidget *widget,
palette_path = edit_palette_path;
restart_notification = TRUE;
}
if (file_prefs_strcmp (plug_in_path, edit_plug_in_path))
{
update = g_list_append (update, "plug-in-path");
plug_in_path = edit_plug_in_path;
restart_notification = TRUE;
}
if (file_prefs_strcmp (module_path, edit_module_path))
{
update = g_list_append (update, "module-path");
module_path = edit_module_path;
restart_notification = TRUE;
}
if (file_prefs_strcmp (gradient_path, edit_gradient_path))
{
update = g_list_append (update, "gradient-path");
@ -510,13 +510,14 @@ file_prefs_save_callback (GtkWidget *widget,
install_cmap = save_install_cmap;
cycled_marching_ants = save_cycled_marching_ants;
last_opened_size = save_last_opened_size;
num_processors = save_num_processors;
temp_path = save_temp_path;
swap_path = save_swap_path;
plug_in_path = save_plug_in_path;
module_path = save_module_path;
brush_path = save_brush_path;
pattern_path = save_pattern_path;
palette_path = save_palette_path;
plug_in_path = save_plug_in_path;
module_path = save_module_path;
gradient_path = save_gradient_path;
if (restart_notification)
@ -533,12 +534,11 @@ 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;
default_resolution_force_equal = NULL;
resolution_xserver_label = NULL;
monitor_resolution_sizeentry = NULL;
monitor_resolution_force_equal = NULL;
levels_of_undo = old_levels_of_undo;
marching_speed = old_marching_speed;
@ -592,11 +592,11 @@ file_prefs_cancel_callback (GtkWidget *widget,
file_prefs_strset (&edit_temp_path, old_temp_path);
file_prefs_strset (&edit_swap_path, old_swap_path);
file_prefs_strset (&edit_plug_in_path, old_plug_in_path);
file_prefs_strset (&edit_module_path, old_module_path);
file_prefs_strset (&edit_brush_path, old_brush_path);
file_prefs_strset (&edit_pattern_path, old_pattern_path);
file_prefs_strset (&edit_palette_path, old_palette_path);
file_prefs_strset (&edit_plug_in_path, old_plug_in_path);
file_prefs_strset (&edit_module_path, old_module_path);
file_prefs_strset (&edit_gradient_path, old_gradient_path);
file_prefs_strset (&image_title_format, old_image_title_format);
@ -811,10 +811,6 @@ file_prefs_res_source_callback (GtkWidget *widget,
gtk_widget_set_sensitive (monitor_resolution_sizeentry,
! GTK_TOGGLE_BUTTON (widget)->active);
if (monitor_resolution_force_equal)
gtk_widget_set_sensitive (monitor_resolution_force_equal,
! GTK_TOGGLE_BUTTON (widget)->active);
if (GTK_TOGGLE_BUTTON (widget)->active)
{
gdisplay_xserver_resolution (&monitor_xres, &monitor_yres);
@ -926,10 +922,6 @@ gimp_dialog_realize_callback (GtkWidget *widget,
/* this is an experimental one
* I tried to fold the entire dialog creation and the ActionArea stuff
* into one function. Might be not general enough.
* todo:
* - session management?? (probably not)
* - window placement
* - policy setting
*/
GtkWidget*
gimp_dialog_new (const gchar *title,
@ -967,7 +959,7 @@ gimp_dialog_new (const gchar *title,
gtk_window_set_policy (GTK_WINDOW (dialog),
allow_grow, allow_shrink, auto_shrink);
/* prepare the action_area */
/* prepare the action_area */
gtk_container_border_width (GTK_CONTAINER (GTK_DIALOG (dialog)->action_area),
2);
gtk_box_set_homogeneous (GTK_BOX (GTK_DIALOG (dialog)->action_area), FALSE);
@ -978,6 +970,7 @@ gimp_dialog_new (const gchar *title,
FALSE, FALSE, 0);
gtk_widget_show (hbbox);
/* the action_area buttons */
va_start (args, connect_delete);
while (label)
{
@ -985,7 +978,7 @@ gimp_dialog_new (const gchar *title,
GTK_WIDGET_SET_FLAGS (button, GTK_CAN_DEFAULT);
gtk_box_pack_start (GTK_BOX (hbbox), button, FALSE, FALSE, 0);
/* pass data as user_data if data != NULL, or the dialog otherwise */
/* pass data as user_data if data != NULL, or the dialog otherwise */
if (callback)
gtk_signal_connect (GTK_OBJECT (button), "clicked",
GTK_SIGNAL_FUNC (callback),
@ -1000,7 +993,7 @@ gimp_dialog_new (const gchar *title,
"gimp_dialog_cancel_widget",
button);
/* catch WM delete event */
/* catch the WM delete event */
gtk_signal_connect (GTK_OBJECT (dialog), "delete_event",
(GdkEventFunc) gimp_dialog_delete_callback,
data ? data : dialog);
@ -1023,13 +1016,13 @@ gimp_dialog_new (const gchar *title,
}
va_end (args);
/* catch WM delete event if not already done*/
/* catch the WM delete event if not already done */
if (! delete_connected)
gtk_signal_connect (GTK_OBJECT (dialog), "delete_event",
(GdkEventFunc) gimp_dialog_delete_callback,
NULL);
/* the realize callback sets the wm icon pixmap */
/* the realize callback sets the WM icon */
/*
gtk_signal_connect (GTK_OBJECT (dialog), "realize",
(GtkSignalFunc) gimp_dialog_realize_callback,
@ -1041,7 +1034,7 @@ gimp_dialog_new (const gchar *title,
GtkWidget*
gimp_option_menu_new (GtkSignalFunc menu_item_callback,
gpointer initial,
gpointer initial, /* set_data */
/* this is a menu item */
gchar *label,
@ -1063,6 +1056,7 @@ gimp_option_menu_new (GtkSignalFunc menu_item_callback,
menu = gtk_menu_new ();
/* create the menu items */
initial_index = 0;
va_start (args, set_data);
for (i = 0; label; i++)
@ -1074,7 +1068,7 @@ gimp_option_menu_new (GtkSignalFunc menu_item_callback,
gtk_object_set_user_data (GTK_OBJECT (menuitem), set_data);
gtk_widget_show (menuitem);
/* remember the initial menu item */
/* remember the initial menu item */
if (set_data == initial)
initial_index = i;
@ -1090,7 +1084,7 @@ gimp_option_menu_new (GtkSignalFunc menu_item_callback,
optionmenu = gtk_option_menu_new ();
gtk_option_menu_set_menu (GTK_OPTION_MENU (optionmenu), menu);
/* select the initial menu item */
/* select the initial menu item */
gtk_option_menu_set_history (GTK_OPTION_MENU (optionmenu), initial_index);
return optionmenu;
@ -1098,7 +1092,7 @@ gimp_option_menu_new (GtkSignalFunc menu_item_callback,
GtkWidget*
gimp_radio_group_new (GtkSignalFunc radio_button_callback,
gpointer initial,
gpointer initial, /* set_data */
/* this is a radio button */
gchar *label,
@ -1120,6 +1114,7 @@ gimp_radio_group_new (GtkSignalFunc radio_button_callback,
gtk_container_set_border_width (GTK_CONTAINER (vbox), 2);
group = NULL;
/* create the radio buttons */
va_start (args, set_data);
while (label)
{
@ -1131,7 +1126,7 @@ gimp_radio_group_new (GtkSignalFunc radio_button_callback,
data);
gtk_object_set_user_data (GTK_OBJECT (button), set_data);
/* press the initially active radio button */
/* press the initially active radio button */
if (set_data == initial)
gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (button), TRUE);
@ -1151,7 +1146,7 @@ gimp_radio_group_new (GtkSignalFunc radio_button_callback,
/* this might be the standard gimp spinbutton */
GtkWidget*
gimp_spin_button_new (GtkObject **adjustment, /* return value */
gimp_spin_button_new (GtkObject **adjustment, /* return value */
gfloat value,
gfloat lower,
gfloat upper,
@ -1176,25 +1171,29 @@ gimp_spin_button_new (GtkObject **adjustment, /* return value */
return spinbutton;
}
/* add correctly aligned label & widget to a two-column table */
/* add aligned label & widget to a two-column table */
void
gimp_table_attach_aligned (GtkTable *table,
gint row,
gchar *text,
gfloat xalign,
gfloat yalign,
GtkWidget *widget,
gboolean left_adjust)
{
GtkWidget *label;
label = gtk_label_new (text);
gtk_misc_set_alignment (GTK_MISC (label), 1.0, 0.5);
gtk_misc_set_alignment (GTK_MISC (label), xalign, yalign);
gtk_table_attach (table, GTK_WIDGET (label), 0, 1, row, row + 1,
GTK_SHRINK | GTK_FILL, GTK_SHRINK, 0, 0);
GTK_SHRINK | GTK_FILL, GTK_SHRINK | GTK_FILL, 0, 0);
gtk_widget_show (label);
if (left_adjust)
{
GtkWidget* alignment = gtk_alignment_new (0.0, 0.5, 0.0, 0.0);
GtkWidget *alignment;
alignment = gtk_alignment_new (0.0, 0.5, 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);
@ -1318,6 +1317,11 @@ file_pref_cmd_callback (GtkWidget *widget,
{
/* first time dialog is opened - copy config vals to edit
variables. */
edit_stingy_memory_use = stingy_memory_use;
edit_tile_cache_size = tile_cache_size;
edit_install_cmap = install_cmap;
edit_cycled_marching_ants = cycled_marching_ants;
edit_last_opened_size = last_opened_size;
edit_temp_path = file_prefs_strdup (temp_path);
edit_swap_path = file_prefs_strdup (swap_path);
edit_brush_path = file_prefs_strdup (brush_path);
@ -1326,11 +1330,6 @@ file_pref_cmd_callback (GtkWidget *widget,
edit_plug_in_path = file_prefs_strdup (plug_in_path);
edit_module_path = file_prefs_strdup (module_path);
edit_gradient_path = file_prefs_strdup (gradient_path);
edit_stingy_memory_use = stingy_memory_use;
edit_tile_cache_size = tile_cache_size;
edit_install_cmap = install_cmap;
edit_cycled_marching_ants = cycled_marching_ants;
edit_last_opened_size = last_opened_size;
}
old_perfectmouse = perfectmouse;
old_transparency_type = transparency_type;
@ -1369,11 +1368,11 @@ file_pref_cmd_callback (GtkWidget *widget,
file_prefs_strset (&old_temp_path, edit_temp_path);
file_prefs_strset (&old_swap_path, edit_swap_path);
file_prefs_strset (&old_plug_in_path, edit_plug_in_path);
file_prefs_strset (&old_module_path, edit_module_path);
file_prefs_strset (&old_brush_path, edit_brush_path);
file_prefs_strset (&old_pattern_path, edit_pattern_path);
file_prefs_strset (&old_palette_path, edit_palette_path);
file_prefs_strset (&old_plug_in_path, edit_plug_in_path);
file_prefs_strset (&old_module_path, edit_module_path);
file_prefs_strset (&old_gradient_path, edit_gradient_path);
mem_size_unit = 1;
@ -1387,8 +1386,7 @@ file_pref_cmd_callback (GtkWidget *widget,
/* Create the dialog */
prefs_dlg =
gimp_dialog_new (_("Preferences"),
"gimp_preferences",
gimp_dialog_new (_("Preferences"), "gimp_preferences",
GTK_WIN_POS_NONE, FALSE, FALSE, FALSE,
_("OK"), file_prefs_ok_callback, NULL,
FALSE, FALSE,
@ -1454,7 +1452,7 @@ file_pref_cmd_callback (GtkWidget *widget,
gtk_widget_show (hbox);
default_size_sizeentry = gimp_size_entry_new (2, default_units, "%p",
FALSE, TRUE, 75,
FALSE, FALSE, TRUE, 75,
GIMP_SIZE_ENTRY_UPDATE_SIZE);
gimp_size_entry_set_resolution (GIMP_SIZE_ENTRY (default_size_sizeentry),
0, default_xresolution, FALSE);
@ -1490,10 +1488,10 @@ file_pref_cmd_callback (GtkWidget *widget,
gtk_container_add (GTK_CONTAINER (frame), hbox);
gtk_widget_show (hbox);
default_resolution_force_equal = gimp_chain_button_new (GIMP_CHAIN_BOTTOM);
button = gimp_chain_button_new (GIMP_CHAIN_BOTTOM);
default_resolution_sizeentry =
gimp_size_entry_new (2, default_resolution_units, "%s", FALSE, TRUE, 75,
gimp_size_entry_new (2, default_resolution_units, "%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);
@ -1512,24 +1510,24 @@ file_pref_cmd_callback (GtkWidget *widget,
gtk_signal_connect (GTK_OBJECT (default_resolution_sizeentry),
"unit_changed",
(GtkSignalFunc)file_prefs_default_resolution_callback,
default_resolution_force_equal);
button);
gtk_signal_connect (GTK_OBJECT (default_resolution_sizeentry),
"value_changed",
(GtkSignalFunc)file_prefs_default_resolution_callback,
default_resolution_force_equal);
button);
gtk_signal_connect (GTK_OBJECT (default_resolution_sizeentry),
"refval_changed",
(GtkSignalFunc)file_prefs_default_resolution_callback,
default_resolution_force_equal);
button);
gtk_box_pack_start (GTK_BOX (hbox), default_resolution_sizeentry,
FALSE, FALSE, 0);
gtk_widget_show (default_resolution_sizeentry);
gtk_table_attach_defaults (GTK_TABLE (default_resolution_sizeentry),
default_resolution_force_equal, 1, 3, 3, 4);
button, 1, 3, 3, 4);
if (ABS (default_xresolution - default_yresolution) < 1e-5)
gimp_chain_button_set_active (GIMP_CHAIN_BUTTON (default_resolution_force_equal), TRUE);
gtk_widget_show (default_resolution_force_equal);
gimp_chain_button_set_active (GIMP_CHAIN_BUTTON (button), TRUE);
gtk_widget_show (button);
hbox = gtk_hbox_new (FALSE, 2);
gtk_box_pack_start (GTK_BOX (vbox), hbox, FALSE, FALSE, 0);
@ -1549,7 +1547,8 @@ file_pref_cmd_callback (GtkWidget *widget,
_("Grayscale"), &default_type, (gpointer) GRAY,
NULL);
gimp_table_attach_aligned (GTK_TABLE (table), 0,
_("Default Image Type:"), optionmenu, TRUE);
_("Default Image Type:"), 1.0, 0.5,
optionmenu, TRUE);
/* Display page */
vbox = file_prefs_notebook_append_page (GTK_NOTEBOOK (notebook),
@ -1594,20 +1593,21 @@ file_pref_cmd_callback (GtkWidget *widget,
&transparency_type, (gpointer) BLACK_ONLY,
NULL);
gimp_table_attach_aligned (GTK_TABLE (table), 0,
_("Transparency Type:"), optionmenu, TRUE);
_("Transparency Type:"), 1.0, 0.5,
optionmenu, TRUE);
optionmenu =
gimp_option_menu_new (file_prefs_toggle_callback,
(gpointer) transparency_size,
_("Small Checks"),
_("Small"),
&transparency_size, (gpointer) SMALL_CHECKS,
_("Medium Checks"),
_("Medium"),
&transparency_size, (gpointer) MEDIUM_CHECKS,
_("Large Checks"),
_("Large"),
&transparency_size, (gpointer) LARGE_CHECKS,
NULL);
gimp_table_attach_aligned (GTK_TABLE (table), 1,
_("Check Size:"), optionmenu, TRUE);
_("Check Size:"), 1.0, 0.5, optionmenu, TRUE);
frame = gtk_frame_new (_("Scaling"));
gtk_box_pack_start (GTK_BOX (vbox), frame, FALSE, FALSE, 0);
@ -1675,7 +1675,7 @@ file_pref_cmd_callback (GtkWidget *widget,
_("Large"), (gpointer) 128, (gpointer) 128,
NULL);
gimp_table_attach_aligned (GTK_TABLE (table), 0,
_("Preview Size:"), optionmenu, TRUE);
_("Preview Size:"), 1.0, 0.5, optionmenu, TRUE);
spinbutton =
gimp_spin_button_new (&adjustment,
@ -1684,7 +1684,7 @@ file_pref_cmd_callback (GtkWidget *widget,
(GtkSignalFunc) file_prefs_int_adjustment_callback,
&levels_of_undo);
gimp_table_attach_aligned (GTK_TABLE (table), 1,
_("Levels of Undo:"), spinbutton, TRUE);
_("Levels of Undo:"), 1.0, 0.5, spinbutton, TRUE);
spinbutton =
gimp_spin_button_new (&adjustment,
@ -1693,7 +1693,8 @@ file_pref_cmd_callback (GtkWidget *widget,
(GtkSignalFunc) file_prefs_int_adjustment_callback,
&edit_last_opened_size);
gimp_table_attach_aligned (GTK_TABLE (table), 2,
_("Recent Documents List Size:"), spinbutton, TRUE);
_("Recent Documents List Size:"), 1.0, 0.5,
spinbutton, TRUE);
frame = gtk_frame_new (_("Help System"));
gtk_box_pack_start (GTK_BOX (vbox), frame, FALSE, FALSE, 0);
@ -1769,13 +1770,14 @@ file_pref_cmd_callback (GtkWidget *widget,
spinbutton =
gimp_spin_button_new (&adjustment,
marching_speed, 0.0, 32000.0, 50.0, 100.0, 0.0,
marching_speed, 50.0, 32000.0, 10.0, 100.0, 1.0,
1.0, 0.0);
gtk_signal_connect (GTK_OBJECT (adjustment), "value_changed",
(GtkSignalFunc) file_prefs_int_adjustment_callback,
&marching_speed);
gimp_table_attach_aligned (GTK_TABLE (table), 0,
_("Marching Ants Speed:"), spinbutton, TRUE);
_("Marching Ants Speed:"), 1.0, 0.5,
spinbutton, TRUE);
/* The title format string */
combo = gtk_combo_new ();
@ -1814,7 +1816,7 @@ file_pref_cmd_callback (GtkWidget *widget,
&image_title_format);
gimp_table_attach_aligned (GTK_TABLE (table), 1,
_("Image Title Format:"), combo, FALSE);
_("Image Title Format:"), 1.0, 0.5, combo, FALSE);
/* End of the title format string */
frame = gtk_frame_new (_("Pointer Movement Feedback"));
@ -1907,7 +1909,7 @@ file_pref_cmd_callback (GtkWidget *widget,
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:"), hbox, TRUE);
_("Tile Cache Size:"), 1.0, 0.5, hbox, TRUE);
#ifdef ENABLE_MP
spinbutton =
@ -1917,7 +1919,7 @@ file_pref_cmd_callback (GtkWidget *widget,
(GtkSignalFunc) file_prefs_int_adjustment_callback,
&num_processors);
gimp_table_attach_aligned (GTK_TABLE (table), 1,
_("Number of Processors to Use:"),
_("Number of Processors to Use:"), 1.0, 0.5,
spinbutton, TRUE);
#endif /* ENABLE_MP */
@ -2065,17 +2067,17 @@ file_pref_cmd_callback (GtkWidget *widget,
group = gtk_radio_button_group (GTK_RADIO_BUTTON (button));
gtk_box_pack_start (GTK_BOX (vbox2), button, FALSE, FALSE, 0);
gtk_widget_show (button);
if (!using_xserver_resolution)
if (! using_xserver_resolution)
gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (button), TRUE);
abox = gtk_alignment_new (0.5, 0.5, 0.0, 1.0);
abox = gtk_alignment_new (0.5, 0.5, 0.0, 0.0);
gtk_box_pack_start (GTK_BOX (vbox2), abox, FALSE, FALSE, 0);
gtk_widget_show (abox);
monitor_resolution_force_equal = gimp_chain_button_new (GIMP_CHAIN_BOTTOM);
monitor_resolution_sizeentry = gimp_size_entry_new (2, UNIT_INCH, "%s",
FALSE, TRUE, 75,
GIMP_SIZE_ENTRY_UPDATE_RESOLUTION);
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_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 (GIMP_SIZE_ENTRY (monitor_resolution_sizeentry),
@ -2093,25 +2095,22 @@ file_pref_cmd_callback (GtkWidget *widget,
gtk_signal_connect (GTK_OBJECT (monitor_resolution_sizeentry),
"value_changed",
(GtkSignalFunc)file_prefs_monitor_resolution_callback,
monitor_resolution_force_equal);
button);
gtk_signal_connect (GTK_OBJECT (monitor_resolution_sizeentry),
"refval_changed",
(GtkSignalFunc)file_prefs_monitor_resolution_callback,
monitor_resolution_force_equal);
button);
gtk_container_add (GTK_CONTAINER (abox), monitor_resolution_sizeentry);
gtk_widget_show (monitor_resolution_sizeentry);
if (ABS (monitor_xres - monitor_yres) < 1e-5)
gimp_chain_button_set_active (GIMP_CHAIN_BUTTON (monitor_resolution_force_equal),
TRUE);
gimp_chain_button_set_active (GIMP_CHAIN_BUTTON (button), TRUE);
gtk_table_attach_defaults (GTK_TABLE (monitor_resolution_sizeentry),
monitor_resolution_force_equal, 1, 3, 3, 4);
gtk_widget_show (monitor_resolution_force_equal);
button, 1, 3, 3, 4);
gtk_widget_show (button);
gtk_widget_set_sensitive (monitor_resolution_sizeentry,
!using_xserver_resolution);
gtk_widget_set_sensitive (monitor_resolution_force_equal,
!using_xserver_resolution);
/* Directories */
vbox = file_prefs_notebook_append_page (GTK_NOTEBOOK (notebook),
@ -2150,7 +2149,8 @@ file_pref_cmd_callback (GtkWidget *widget,
(GtkSignalFunc) file_prefs_filename_callback,
dirs[i].mdir);
gimp_table_attach_aligned (GTK_TABLE (table), i,
gettext(dirs[i].label), fileselection, FALSE);
gettext(dirs[i].label), 1.0, 0.5,
fileselection, FALSE);
}
}
@ -2164,12 +2164,12 @@ file_pref_cmd_callback (GtkWidget *widget,
} paths[] = {
{ N_("Brushes"), N_("Brushes Directories"), N_("Select Brushes Dir"),
&edit_brush_path },
{ N_("Gradients"), N_("Gradients Directories"), N_("Select Gradients Dir"),
&edit_gradient_path },
{ N_("Patterns"), N_("Patterns Directories"), N_("Select Patterns Dir"),
&edit_pattern_path },
{ N_("Palettes"), N_("Palettes Directories"), N_("Select Palettes Dir"),
&edit_palette_path },
{ N_("Gradients"), N_("Gradients Directories"), N_("Select Gradients Dir"),
&edit_gradient_path },
{ N_("Plug-Ins"), N_("Plug-Ins Directories"), N_("Select Plug-Ins Dir"),
&edit_plug_in_path },
{ N_("Modules"), N_("Modules Directories"), N_("Select Modules Dir"),

View file

@ -72,7 +72,6 @@ rotate_tool_transform (Tool *tool,
GDisplay *gdisp;
GtkWidget *widget;
GtkWidget *spinbutton2;
GtkAdjustment *adjustment2;
transform_core = (TransformCore *) tool->private;
gdisp = (GDisplay *) gdisp_ptr;
@ -101,20 +100,16 @@ rotate_tool_transform (Tool *tool,
spinbutton2 =
info_dialog_add_spinbutton (transform_info, _("Center X:"), NULL,
-1, 1, 1, 10, 1, 1, 2, NULL, NULL);
adjustment2 =
gtk_spin_button_get_adjustment (GTK_SPIN_BUTTON (spinbutton2));
widget =
info_dialog_add_sizeentry (transform_info, _("Y:"),
center_vals, 1,
gdisp->dot_for_dot ?
UNIT_PIXEL : gdisp->gimage->unit, "%a",
TRUE, FALSE, GIMP_SIZE_ENTRY_UPDATE_SIZE,
TRUE, FALSE, FALSE,
GIMP_SIZE_ENTRY_UPDATE_SIZE,
rotate_center_changed, tool);
gimp_size_entry_add_field (GIMP_SIZE_ENTRY (widget),
adjustment2,
GTK_SPIN_BUTTON (spinbutton2),
NULL, NULL);
GTK_SPIN_BUTTON (spinbutton2), NULL);
gimp_size_entry_set_refval_boundaries (GIMP_SIZE_ENTRY (widget), 0,
-4096,

View file

@ -66,7 +66,6 @@ scale_tool_transform (Tool *tool,
GDisplay *gdisp;
TransformCore *transform_core;
GtkWidget *spinbutton2;
GtkAdjustment *adjustment2;
gdisp = (GDisplay *) gdisp_ptr;
transform_core = (TransformCore *) tool->private;
@ -86,20 +85,16 @@ scale_tool_transform (Tool *tool,
spinbutton2 =
info_dialog_add_spinbutton (transform_info, _("Current Width:"),
NULL, -1, 1, 1, 10, 1, 1, 2, NULL, NULL);
adjustment2 =
gtk_spin_button_get_adjustment (GTK_SPIN_BUTTON (spinbutton2));
sizeentry =
info_dialog_add_sizeentry (transform_info, _("Height:"),
size_vals, 1,
gdisp->dot_for_dot ?
UNIT_PIXEL : gdisp->gimage->unit, "%a",
TRUE, FALSE, GIMP_SIZE_ENTRY_UPDATE_SIZE,
TRUE, FALSE, FALSE,
GIMP_SIZE_ENTRY_UPDATE_SIZE,
scale_size_changed, tool);
gimp_size_entry_add_field (GIMP_SIZE_ENTRY (sizeentry),
adjustment2,
GTK_SPIN_BUTTON (spinbutton2),
NULL, NULL);
GTK_SPIN_BUTTON (spinbutton2), NULL);
gtk_signal_connect (GTK_OBJECT (sizeentry), "unit_changed",
scale_unit_changed, tool);

View file

@ -827,7 +827,6 @@ crop_info_create (Tool *tool)
GDisplay *gdisp;
GtkWidget *sizeentry;
GtkWidget *spinbutton2;
GtkAdjustment *adjustment2;
gdisp = (GDisplay *) tool->gdisp_ptr;
@ -837,18 +836,14 @@ crop_info_create (Tool *tool)
/* add the information fields */
spinbutton2 = info_dialog_add_spinbutton (crop_info, _("Origin X:"), NULL,
-1, 1, 1, 10, 1, 1, 2, NULL, NULL);
adjustment2 = gtk_spin_button_get_adjustment (GTK_SPIN_BUTTON (spinbutton2));
sizeentry =
info_dialog_add_sizeentry (crop_info, _("Y:"), orig_vals, 1,
gdisp->dot_for_dot ?
UNIT_PIXEL : gdisp->gimage->unit, "%a",
TRUE, FALSE, GIMP_SIZE_ENTRY_UPDATE_SIZE,
TRUE, FALSE, FALSE, GIMP_SIZE_ENTRY_UPDATE_SIZE,
crop_orig_changed, tool);
gimp_size_entry_add_field (GIMP_SIZE_ENTRY (sizeentry),
adjustment2,
GTK_SPIN_BUTTON (spinbutton2),
NULL, NULL);
GTK_SPIN_BUTTON (spinbutton2), NULL);
gimp_size_entry_set_refval_boundaries (GIMP_SIZE_ENTRY (sizeentry), 0,
-65536, 65536);
@ -864,18 +859,14 @@ crop_info_create (Tool *tool)
spinbutton2 = info_dialog_add_spinbutton (crop_info, _("Width:"), NULL,
-1, 1, 1, 10, 1, 1, 2, NULL, NULL);
adjustment2 = gtk_spin_button_get_adjustment (GTK_SPIN_BUTTON (spinbutton2));
sizeentry =
info_dialog_add_sizeentry (crop_info, _("Height:"), size_vals, 1,
gdisp->dot_for_dot ?
UNIT_PIXEL : gdisp->gimage->unit, "%a",
TRUE, FALSE, GIMP_SIZE_ENTRY_UPDATE_SIZE,
TRUE, FALSE, FALSE, GIMP_SIZE_ENTRY_UPDATE_SIZE,
crop_size_changed, tool);
gimp_size_entry_add_field (GIMP_SIZE_ENTRY (sizeentry),
adjustment2,
GTK_SPIN_BUTTON (spinbutton2),
NULL, NULL);
GTK_SPIN_BUTTON (spinbutton2), NULL);
gimp_size_entry_set_refval_boundaries (GIMP_SIZE_ENTRY (sizeentry), 0,
-65536, 65536);

View file

@ -827,7 +827,6 @@ crop_info_create (Tool *tool)
GDisplay *gdisp;
GtkWidget *sizeentry;
GtkWidget *spinbutton2;
GtkAdjustment *adjustment2;
gdisp = (GDisplay *) tool->gdisp_ptr;
@ -837,18 +836,14 @@ crop_info_create (Tool *tool)
/* add the information fields */
spinbutton2 = info_dialog_add_spinbutton (crop_info, _("Origin X:"), NULL,
-1, 1, 1, 10, 1, 1, 2, NULL, NULL);
adjustment2 = gtk_spin_button_get_adjustment (GTK_SPIN_BUTTON (spinbutton2));
sizeentry =
info_dialog_add_sizeentry (crop_info, _("Y:"), orig_vals, 1,
gdisp->dot_for_dot ?
UNIT_PIXEL : gdisp->gimage->unit, "%a",
TRUE, FALSE, GIMP_SIZE_ENTRY_UPDATE_SIZE,
TRUE, FALSE, FALSE, GIMP_SIZE_ENTRY_UPDATE_SIZE,
crop_orig_changed, tool);
gimp_size_entry_add_field (GIMP_SIZE_ENTRY (sizeentry),
adjustment2,
GTK_SPIN_BUTTON (spinbutton2),
NULL, NULL);
GTK_SPIN_BUTTON (spinbutton2), NULL);
gimp_size_entry_set_refval_boundaries (GIMP_SIZE_ENTRY (sizeentry), 0,
-65536, 65536);
@ -864,18 +859,14 @@ crop_info_create (Tool *tool)
spinbutton2 = info_dialog_add_spinbutton (crop_info, _("Width:"), NULL,
-1, 1, 1, 10, 1, 1, 2, NULL, NULL);
adjustment2 = gtk_spin_button_get_adjustment (GTK_SPIN_BUTTON (spinbutton2));
sizeentry =
info_dialog_add_sizeentry (crop_info, _("Height:"), size_vals, 1,
gdisp->dot_for_dot ?
UNIT_PIXEL : gdisp->gimage->unit, "%a",
TRUE, FALSE, GIMP_SIZE_ENTRY_UPDATE_SIZE,
TRUE, FALSE, FALSE, GIMP_SIZE_ENTRY_UPDATE_SIZE,
crop_size_changed, tool);
gimp_size_entry_add_field (GIMP_SIZE_ENTRY (sizeentry),
adjustment2,
GTK_SPIN_BUTTON (spinbutton2),
NULL, NULL);
GTK_SPIN_BUTTON (spinbutton2), NULL);
gimp_size_entry_set_refval_boundaries (GIMP_SIZE_ENTRY (sizeentry), 0,
-65536, 65536);

View file

@ -15,8 +15,6 @@
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/
#include <stdio.h>
#include "appenv.h"
#include "drawable.h"
#include "gdisplay.h"
@ -169,7 +167,8 @@ perspective_info_update (Tool *tool)
for (j = 0; j < 3; j++)
{
p += sprintf (p, "%10.3g", transform_core->transform[i][j]);
p += g_snprintf (p, MAX_INFO_BUF - (p - matrix_row_buf[i]),
"%10.3g", transform_core->transform[i][j]);
}
}

View file

@ -72,7 +72,6 @@ rotate_tool_transform (Tool *tool,
GDisplay *gdisp;
GtkWidget *widget;
GtkWidget *spinbutton2;
GtkAdjustment *adjustment2;
transform_core = (TransformCore *) tool->private;
gdisp = (GDisplay *) gdisp_ptr;
@ -101,20 +100,16 @@ rotate_tool_transform (Tool *tool,
spinbutton2 =
info_dialog_add_spinbutton (transform_info, _("Center X:"), NULL,
-1, 1, 1, 10, 1, 1, 2, NULL, NULL);
adjustment2 =
gtk_spin_button_get_adjustment (GTK_SPIN_BUTTON (spinbutton2));
widget =
info_dialog_add_sizeentry (transform_info, _("Y:"),
center_vals, 1,
gdisp->dot_for_dot ?
UNIT_PIXEL : gdisp->gimage->unit, "%a",
TRUE, FALSE, GIMP_SIZE_ENTRY_UPDATE_SIZE,
TRUE, FALSE, FALSE,
GIMP_SIZE_ENTRY_UPDATE_SIZE,
rotate_center_changed, tool);
gimp_size_entry_add_field (GIMP_SIZE_ENTRY (widget),
adjustment2,
GTK_SPIN_BUTTON (spinbutton2),
NULL, NULL);
GTK_SPIN_BUTTON (spinbutton2), NULL);
gimp_size_entry_set_refval_boundaries (GIMP_SIZE_ENTRY (widget), 0,
-4096,

View file

@ -66,7 +66,6 @@ scale_tool_transform (Tool *tool,
GDisplay *gdisp;
TransformCore *transform_core;
GtkWidget *spinbutton2;
GtkAdjustment *adjustment2;
gdisp = (GDisplay *) gdisp_ptr;
transform_core = (TransformCore *) tool->private;
@ -86,20 +85,16 @@ scale_tool_transform (Tool *tool,
spinbutton2 =
info_dialog_add_spinbutton (transform_info, _("Current Width:"),
NULL, -1, 1, 1, 10, 1, 1, 2, NULL, NULL);
adjustment2 =
gtk_spin_button_get_adjustment (GTK_SPIN_BUTTON (spinbutton2));
sizeentry =
info_dialog_add_sizeentry (transform_info, _("Height:"),
size_vals, 1,
gdisp->dot_for_dot ?
UNIT_PIXEL : gdisp->gimage->unit, "%a",
TRUE, FALSE, GIMP_SIZE_ENTRY_UPDATE_SIZE,
TRUE, FALSE, FALSE,
GIMP_SIZE_ENTRY_UPDATE_SIZE,
scale_size_changed, tool);
gimp_size_entry_add_field (GIMP_SIZE_ENTRY (sizeentry),
adjustment2,
GTK_SPIN_BUTTON (spinbutton2),
NULL, NULL);
GTK_SPIN_BUTTON (spinbutton2), NULL);
gtk_signal_connect (GTK_OBJECT (sizeentry), "unit_changed",
scale_unit_changed, tool);

View file

@ -15,8 +15,6 @@
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/
#include <stdio.h>
#include "appenv.h"
#include "drawable.h"
#include "gdisplay.h"
@ -169,7 +167,8 @@ perspective_info_update (Tool *tool)
for (j = 0; j < 3; j++)
{
p += sprintf (p, "%10.3g", transform_core->transform[i][j]);
p += g_snprintf (p, MAX_INFO_BUF - (p - matrix_row_buf[i]),
"%10.3g", transform_core->transform[i][j]);
}
}

View file

@ -72,7 +72,6 @@ rotate_tool_transform (Tool *tool,
GDisplay *gdisp;
GtkWidget *widget;
GtkWidget *spinbutton2;
GtkAdjustment *adjustment2;
transform_core = (TransformCore *) tool->private;
gdisp = (GDisplay *) gdisp_ptr;
@ -101,20 +100,16 @@ rotate_tool_transform (Tool *tool,
spinbutton2 =
info_dialog_add_spinbutton (transform_info, _("Center X:"), NULL,
-1, 1, 1, 10, 1, 1, 2, NULL, NULL);
adjustment2 =
gtk_spin_button_get_adjustment (GTK_SPIN_BUTTON (spinbutton2));
widget =
info_dialog_add_sizeentry (transform_info, _("Y:"),
center_vals, 1,
gdisp->dot_for_dot ?
UNIT_PIXEL : gdisp->gimage->unit, "%a",
TRUE, FALSE, GIMP_SIZE_ENTRY_UPDATE_SIZE,
TRUE, FALSE, FALSE,
GIMP_SIZE_ENTRY_UPDATE_SIZE,
rotate_center_changed, tool);
gimp_size_entry_add_field (GIMP_SIZE_ENTRY (widget),
adjustment2,
GTK_SPIN_BUTTON (spinbutton2),
NULL, NULL);
GTK_SPIN_BUTTON (spinbutton2), NULL);
gimp_size_entry_set_refval_boundaries (GIMP_SIZE_ENTRY (widget), 0,
-4096,

View file

@ -66,7 +66,6 @@ scale_tool_transform (Tool *tool,
GDisplay *gdisp;
TransformCore *transform_core;
GtkWidget *spinbutton2;
GtkAdjustment *adjustment2;
gdisp = (GDisplay *) gdisp_ptr;
transform_core = (TransformCore *) tool->private;
@ -86,20 +85,16 @@ scale_tool_transform (Tool *tool,
spinbutton2 =
info_dialog_add_spinbutton (transform_info, _("Current Width:"),
NULL, -1, 1, 1, 10, 1, 1, 2, NULL, NULL);
adjustment2 =
gtk_spin_button_get_adjustment (GTK_SPIN_BUTTON (spinbutton2));
sizeentry =
info_dialog_add_sizeentry (transform_info, _("Height:"),
size_vals, 1,
gdisp->dot_for_dot ?
UNIT_PIXEL : gdisp->gimage->unit, "%a",
TRUE, FALSE, GIMP_SIZE_ENTRY_UPDATE_SIZE,
TRUE, FALSE, FALSE,
GIMP_SIZE_ENTRY_UPDATE_SIZE,
scale_size_changed, tool);
gimp_size_entry_add_field (GIMP_SIZE_ENTRY (sizeentry),
adjustment2,
GTK_SPIN_BUTTON (spinbutton2),
NULL, NULL);
GTK_SPIN_BUTTON (spinbutton2), NULL);
gtk_signal_connect (GTK_OBJECT (sizeentry), "unit_changed",
scale_unit_changed, tool);

View file

@ -127,6 +127,7 @@ void
create_input_dialog (void)
{
static GtkWidget *inputd = NULL;
GtkWidget *hbbox;
if (!inputd)
{
@ -135,7 +136,24 @@ create_input_dialog (void)
/* register this one only */
dialog_register(inputd);
gtk_container_border_width (GTK_CONTAINER (GTK_DIALOG(inputd)->action_area), 2);
gtk_container_set_border_width (GTK_CONTAINER (GTK_DIALOG(inputd)->action_area), 2);
gtk_box_set_homogeneous (GTK_BOX (GTK_DIALOG (inputd)->action_area),
FALSE);
hbbox = gtk_hbutton_box_new();
gtk_button_box_set_spacing(GTK_BUTTON_BOX (hbbox), 4);
gtk_widget_reparent (GTK_INPUT_DIALOG (inputd)->save_button, hbbox);
GTK_WIDGET_SET_FLAGS (GTK_INPUT_DIALOG (inputd)->save_button,
GTK_CAN_DEFAULT);
gtk_widget_reparent (GTK_INPUT_DIALOG (inputd)->close_button, hbbox);
GTK_WIDGET_SET_FLAGS (GTK_INPUT_DIALOG (inputd)->close_button,
GTK_CAN_DEFAULT);
gtk_box_pack_end(GTK_BOX (GTK_DIALOG (inputd)->action_area), hbbox,
FALSE, FALSE, 0);
gtk_widget_grab_default (GTK_INPUT_DIALOG (inputd)->close_button);
gtk_widget_show(hbbox);
gtk_signal_connect (GTK_OBJECT(GTK_INPUT_DIALOG(inputd)->save_button),
"clicked",
@ -1035,6 +1053,13 @@ device_preview_events (GtkWidget *widget,
break; /* Error no device info */
}
/* Grab the pointer */
gdk_pointer_grab (widget->window, FALSE,
(GDK_POINTER_MOTION_HINT_MASK |
GDK_BUTTON1_MOTION_MASK |
GDK_BUTTON_RELEASE_MASK),
NULL, NULL, bevent->time);
if(type == BRUSH_PREVIEW)
{
brush = device_info->brush;

View file

@ -127,6 +127,7 @@ void
create_input_dialog (void)
{
static GtkWidget *inputd = NULL;
GtkWidget *hbbox;
if (!inputd)
{
@ -135,7 +136,24 @@ create_input_dialog (void)
/* register this one only */
dialog_register(inputd);
gtk_container_border_width (GTK_CONTAINER (GTK_DIALOG(inputd)->action_area), 2);
gtk_container_set_border_width (GTK_CONTAINER (GTK_DIALOG(inputd)->action_area), 2);
gtk_box_set_homogeneous (GTK_BOX (GTK_DIALOG (inputd)->action_area),
FALSE);
hbbox = gtk_hbutton_box_new();
gtk_button_box_set_spacing(GTK_BUTTON_BOX (hbbox), 4);
gtk_widget_reparent (GTK_INPUT_DIALOG (inputd)->save_button, hbbox);
GTK_WIDGET_SET_FLAGS (GTK_INPUT_DIALOG (inputd)->save_button,
GTK_CAN_DEFAULT);
gtk_widget_reparent (GTK_INPUT_DIALOG (inputd)->close_button, hbbox);
GTK_WIDGET_SET_FLAGS (GTK_INPUT_DIALOG (inputd)->close_button,
GTK_CAN_DEFAULT);
gtk_box_pack_end(GTK_BOX (GTK_DIALOG (inputd)->action_area), hbbox,
FALSE, FALSE, 0);
gtk_widget_grab_default (GTK_INPUT_DIALOG (inputd)->close_button);
gtk_widget_show(hbbox);
gtk_signal_connect (GTK_OBJECT(GTK_INPUT_DIALOG(inputd)->save_button),
"clicked",
@ -1035,6 +1053,13 @@ device_preview_events (GtkWidget *widget,
break; /* Error no device info */
}
/* Grab the pointer */
gdk_pointer_grab (widget->window, FALSE,
(GDK_POINTER_MOTION_HINT_MASK |
GDK_BUTTON1_MOTION_MASK |
GDK_BUTTON_RELEASE_MASK),
NULL, NULL, bevent->time);
if(type == BRUSH_PREVIEW)
{
brush = device_info->brush;

View file

@ -16,11 +16,10 @@
* Free Software Foundation, Inc., 59 Temple Place - Suite 330,
* Boston, MA 02111-1307, USA.
*/
#include "gimpsizeentry.h"
#include "gimpunitmenu.h"
#define SIZE_MAX_VALUE 500000.0 /* is that enough ?? */
#define SIZE_MAX_VALUE 500000.0
static void gimp_size_entry_unit_callback (GtkWidget *widget,
gpointer data);
@ -140,6 +139,7 @@ gimp_size_entry_init (GimpSizeEntry *gse)
gse->unitmenu = NULL;
gse->unit = UNIT_PIXEL;
gse->menu_show_pixels = TRUE;
gse->menu_show_percent = TRUE;
gse->show_refval = FALSE;
gse->update_policy = GIMP_SIZE_ENTRY_UPDATE_NONE;
}
@ -174,9 +174,10 @@ GtkWidget*
gimp_size_entry_new (gint number_of_fields,
GUnit unit,
gchar *unit_format,
guint menu_show_pixels,
guint show_refval,
guint spinbutton_usize,
gboolean menu_show_pixels,
gboolean menu_show_percent,
gboolean show_refval,
gint spinbutton_usize,
GimpSizeEntryUP update_policy)
{
GimpSizeEntry *gse;
@ -189,7 +190,7 @@ gimp_size_entry_new (gint number_of_fields,
gse->number_of_fields = number_of_fields;
gse->unit = unit;
gse->show_refval = show_refval ? 1 : 0;
gse->show_refval = show_refval;
gse->update_policy = update_policy;
gtk_table_resize (GTK_TABLE (gse),
@ -199,13 +200,19 @@ gimp_size_entry_new (gint number_of_fields,
/* show the 'pixels' menu entry only if we are a 'size' sizeentry and
* don't have the reference value spinbutton
*/
if ((update_policy == GIMP_SIZE_ENTRY_UPDATE_SIZE) && menu_show_pixels)
gse->menu_show_pixels = TRUE;
else if (update_policy == GIMP_SIZE_ENTRY_UPDATE_RESOLUTION)
if ((update_policy == GIMP_SIZE_ENTRY_UPDATE_RESOLUTION) ||
(show_refval == TRUE))
gse->menu_show_pixels = FALSE;
else
gse->menu_show_pixels = menu_show_pixels;
/* show the 'percent' menu entry only if we are a 'size' sizeentry
*/
if (update_policy == GIMP_SIZE_ENTRY_UPDATE_RESOLUTION)
gse->menu_show_percent = FALSE;
else
gse->menu_show_percent = menu_show_percent;
for (i = 0; i < number_of_fields; i++)
{
GimpSizeEntryField *gsef;
@ -296,7 +303,7 @@ gimp_size_entry_new (gint number_of_fields,
}
gse->unitmenu = gimp_unit_menu_new (unit_format, unit,
gse->menu_show_pixels, TRUE);
gse->menu_show_pixels, FALSE, TRUE);
gtk_table_attach_defaults (GTK_TABLE (gse), gse->unitmenu,
i+2, i+3,
gse->show_refval+1, gse->show_refval+2);
@ -311,23 +318,17 @@ gimp_size_entry_new (gint number_of_fields,
/* add a field to the sizeentry */
void
gimp_size_entry_add_field (GimpSizeEntry *gse,
GtkAdjustment *value_adjustment,
GtkSpinButton *value_spinbutton,
GtkAdjustment *refval_adjustment,
GtkSpinButton *refval_spinbutton)
{
GimpSizeEntryField *gsef;
g_return_if_fail (gse != NULL);
g_return_if_fail (GIMP_IS_SIZE_ENTRY (gse));
g_return_if_fail (value_adjustment != NULL);
g_return_if_fail (GTK_IS_ADJUSTMENT (value_adjustment));
g_return_if_fail (value_spinbutton != NULL);
g_return_if_fail (GTK_IS_SPIN_BUTTON (value_spinbutton));
if (gse->show_refval)
{
g_return_if_fail (refval_adjustment != NULL);
g_return_if_fail (GTK_IS_ADJUSTMENT (refval_adjustment));
g_return_if_fail (refval_spinbutton != NULL);
g_return_if_fail (GTK_IS_SPIN_BUTTON (refval_spinbutton));
}
@ -348,9 +349,10 @@ gimp_size_entry_add_field (GimpSizeEntry *gse,
gsef->refval_digits =
(gse->update_policy == GIMP_SIZE_ENTRY_UPDATE_SIZE) ? 0 : 3;
gsef->value_adjustment = GTK_OBJECT (value_adjustment);
gsef->value_adjustment =
GTK_OBJECT (gtk_spin_button_get_adjustment (value_spinbutton));
gsef->value_spinbutton = GTK_WIDGET (value_spinbutton);
gtk_signal_connect (GTK_OBJECT (value_adjustment), "value_changed",
gtk_signal_connect (GTK_OBJECT (gsef->value_adjustment), "value_changed",
(GtkSignalFunc) gimp_size_entry_value_callback, gsef);
/* these callbacks are not used
@ -366,9 +368,10 @@ gimp_size_entry_add_field (GimpSizeEntry *gse,
if (gse->show_refval)
{
gsef->refval_adjustment = GTK_OBJECT (refval_adjustment);
gsef->refval_adjustment =
GTK_OBJECT (gtk_spin_button_get_adjustment (refval_spinbutton));
gsef->refval_spinbutton = GTK_WIDGET (refval_spinbutton);
gtk_signal_connect (GTK_OBJECT (refval_adjustment), "value_changed",
gtk_signal_connect (GTK_OBJECT (gsef->refval_adjustment), "value_changed",
(GtkSignalFunc) gimp_size_entry_refval_callback,
gsef);

View file

@ -54,9 +54,10 @@ struct _GimpSizeEntry
GtkWidget *unitmenu;
GUnit unit;
guint menu_show_pixels;
gboolean menu_show_pixels;
gboolean menu_show_percent;
guint show_refval;
gboolean show_refval;
GimpSizeEntryUP update_policy;
};
@ -99,9 +100,10 @@ guint gimp_size_entry_get_type (void);
GtkWidget* gimp_size_entry_new (gint number_of_fields,
GUnit unit,
gchar *unit_format,
guint menu_show_pixels,
guint show_refval,
guint spinbutton_usize,
gboolean menu_show_pixels,
gboolean menu_show_percent,
gboolean show_refval,
gint spinbutton_usize,
GimpSizeEntryUP update_policy);
/* add a field to the sizeentry
@ -110,9 +112,7 @@ GtkWidget* gimp_size_entry_new (gint number_of_fields,
* the new field will have the index 0
*/
void gimp_size_entry_add_field (GimpSizeEntry *gse,
GtkAdjustment *value_adjustment,
GtkSpinButton *value_spinbutton,
GtkAdjustment *refval_adjustment,
GtkSpinButton *refval_spinbutton);
/* this one is just a convenience function if you want to add labels

View file

@ -1,5 +1,5 @@
/* LIBGIMP - The GIMP Library
* Copyright (C) 1995-1997 Peter Mattis and Spencer Kimball
* Copyright (C) 1995-1999 Peter Mattis and Spencer Kimball
*
* gimpunitmenu.c
* Copyright (C) 1999 Michael Natterer <mitschel@cs.tu-berlin.de>
@ -19,14 +19,15 @@
* Free Software Foundation, Inc., 59 Temple Place - Suite 330,
* Boston, MA 02111-1307, USA.
*/
#include "gimpunitmenu.h"
#include "libgimp/gimpintl.h"
static const gchar* gimp_unit_menu_build_string (gchar *format, GUnit unit);
static void gimp_unit_menu_callback (GtkWidget *widget, gpointer data);
/* private functions */
static const gchar * gimp_unit_menu_build_string (gchar *format,
GUnit unit);
static void gimp_unit_menu_callback (GtkWidget *widget,
gpointer data);
enum {
GUM_UNIT_CHANGED_SIGNAL,
@ -84,7 +85,8 @@ gimp_unit_menu_init (GimpUnitMenu *gum)
gum->clist = NULL;
gum->format = NULL;
gum->unit = UNIT_PIXEL;
gum->start = 0;
gum->show_pixels = FALSE;
gum->show_percent = FALSE;
}
@ -117,8 +119,9 @@ gimp_unit_menu_get_type ()
GtkWidget*
gimp_unit_menu_new (gchar *format,
GUnit unit,
gboolean with_pixels,
gboolean with_custom)
gboolean show_pixels,
gboolean show_percent,
gboolean show_custom)
{
GimpUnitMenu *gum;
GtkWidget *menu;
@ -129,19 +132,18 @@ gimp_unit_menu_new (gchar *format,
(unit < gimp_unit_get_number_of_units ()), NULL);
if (unit >= gimp_unit_get_number_of_built_in_units ())
with_custom = TRUE;
show_custom = TRUE;
gum = gtk_type_new (gimp_unit_menu_get_type ());
gum->format = g_strdup (format);
/* if we don't want pixels, start with inches */
gum->start = with_pixels ? UNIT_PIXEL : UNIT_INCH;
if (unit < gum->start)
unit = gum->start;
gum->show_pixels = show_pixels;
gum->show_percent = show_percent;
menu = gtk_menu_new();
for (u = gum->start; u < gimp_unit_get_number_of_built_in_units(); u++)
for (u = show_pixels ? UNIT_PIXEL : UNIT_INCH;
u < gimp_unit_get_number_of_built_in_units();
u++)
{
menuitem =
gtk_menu_item_new_with_label (gimp_unit_menu_build_string (format, u));
@ -151,7 +153,7 @@ gimp_unit_menu_new (gchar *format,
gtk_object_set_data (GTK_OBJECT (menuitem), "gimp_unit_menu", (gpointer)u);
gtk_widget_show (menuitem);
/* add a separator after pixels */
/* add a separator after "pixels" */
if (u == UNIT_PIXEL)
{
menuitem = gtk_menu_item_new ();
@ -175,7 +177,7 @@ gimp_unit_menu_new (gchar *format,
gtk_widget_show(menuitem);
}
if (with_custom)
if (show_custom)
{
menuitem = gtk_menu_item_new ();
gtk_menu_append (GTK_MENU (menu), menuitem);
@ -195,10 +197,10 @@ gimp_unit_menu_new (gchar *format,
gum->unit = unit;
gtk_option_menu_set_history (GTK_OPTION_MENU (gum),
((unit < UNIT_END) ?
(unit - gum->start +
(with_pixels ? 1 : 0)) :
(UNIT_END + (with_pixels ? 2 : 0))));
(unit == UNIT_PIXEL) ? 0 :
(show_pixels ?
((unit < UNIT_END) ? unit + 1 : UNIT_END + 2) :
((unit < UNIT_END) ? unit - 1 : UNIT_END)));
return GTK_WIDGET (gum);
}
@ -214,14 +216,15 @@ gimp_unit_menu_set_unit (GimpUnitMenu *gum,
g_return_if_fail (gum != NULL);
g_return_if_fail (GIMP_IS_UNIT_MENU (gum));
g_return_if_fail ((unit >= gum->start) &&
g_return_if_fail ((unit >= UNIT_PIXEL) &&
((unit > UNIT_PIXEL) || gum->show_pixels) &&
(unit < gimp_unit_get_number_of_units ()));
if (unit == gum->unit)
return;
items = GTK_MENU_SHELL (GTK_OPTION_MENU (gum)->menu)->children;
user_unit = UNIT_END + ((gum->start == UNIT_PIXEL) ? 2 : 0);
user_unit = UNIT_END + (gum->show_pixels ? 2 : 0);
if (unit >= UNIT_END)
{
@ -252,10 +255,10 @@ gimp_unit_menu_set_unit (GimpUnitMenu *gum,
gum->unit = unit;
gtk_option_menu_set_history (GTK_OPTION_MENU (gum),
((unit < UNIT_END) ?
(unit - gum->start +
((gum->start == UNIT_PIXEL) ? 1 : 0)) :
(UNIT_END + ((gum->start == UNIT_PIXEL) ? 2 : 0))));
(unit == UNIT_PIXEL) ? 0 :
(gum->show_pixels ?
((unit < UNIT_END) ? unit + 1 : UNIT_END + 2) :
((unit < UNIT_END) ? unit - 1 : UNIT_END)));
}
GUnit
@ -268,8 +271,7 @@ gimp_unit_menu_get_unit (GimpUnitMenu *gum)
}
/* most of the next two functions is stolen from app/gdisplay.h ;-) */
/* most of the next two functions is stolen from app/gdisplay.c */
static int
print (char *buf, int len, int start, const char *fmt, ...)
{
@ -358,7 +360,7 @@ gimp_unit_menu_build_string (gchar *format, GUnit unit)
}
/* private callbacks of gimp_unit_menu_create_selection ()
/* private callbacks of gimp_unit_menu_create_selection ()
*/
static void
@ -372,8 +374,8 @@ gimp_unit_menu_selection_select_callback (GtkWidget *widget,
if (gum->selection && GTK_CLIST (gum->clist)->selection)
{
unit = (GUnit)gtk_clist_get_row_data (GTK_CLIST (gum->clist),
(int)(GTK_CLIST (gum->clist)->selection->data));
unit = (GUnit) gtk_clist_get_row_data (GTK_CLIST (gum->clist),
(int) (GTK_CLIST (gum->clist)->selection->data));
gimp_unit_menu_set_unit (gum, unit);
gtk_signal_emit (GTK_OBJECT (gum),
gimp_unit_menu_signals[GUM_UNIT_CHANGED_SIGNAL]);
@ -410,7 +412,7 @@ gimp_unit_menu_selection_delete_callback (GtkWidget *widget,
return TRUE;
}
/* private function of gimp_unit_menu_callback ()
/* private function of gimp_unit_menu_callback ()
*/
static void
@ -446,13 +448,14 @@ gimp_unit_menu_create_selection (GimpUnitMenu *gum)
GTK_SIGNAL_FUNC (gimp_unit_menu_selection_close_callback),
gum);
/* build the selection list */
scrolled_win = gtk_scrolled_window_new (NULL, NULL);
gum->clist = gtk_clist_new (2);
gtk_clist_set_shadow_type (GTK_CLIST (gum->clist), GTK_SHADOW_IN);
gtk_clist_set_selection_mode (GTK_CLIST (gum->clist), GTK_SELECTION_BROWSE);
gtk_widget_set_usize (gum->clist, 200, 150);
gtk_clist_set_column_title (GTK_CLIST (gum->clist), 0, _("Unit"));
gtk_clist_set_column_title (GTK_CLIST (gum->clist), 0, _("Unit "));
gtk_clist_set_column_auto_resize (GTK_CLIST (gum->clist), 0, TRUE);
gtk_clist_set_column_title (GTK_CLIST (gum->clist), 1, _("Factor"));
gtk_clist_set_column_auto_resize (GTK_CLIST (gum->clist), 1, TRUE);
@ -472,6 +475,7 @@ gimp_unit_menu_create_selection (GimpUnitMenu *gum)
gtk_widget_show(scrolled_win);
gtk_widget_show(gum->clist);
/* build the action area */
gtk_container_set_border_width (GTK_CONTAINER (GTK_DIALOG (gum->selection)->action_area), 2);
gtk_box_set_homogeneous (GTK_BOX (GTK_DIALOG (gum->selection)->action_area),
FALSE);
@ -479,7 +483,7 @@ gimp_unit_menu_create_selection (GimpUnitMenu *gum)
gtk_button_box_set_spacing (GTK_BUTTON_BOX (hbbox), 4);
gtk_box_pack_end(GTK_BOX (GTK_DIALOG (gum->selection)->action_area), hbbox,
FALSE, FALSE, 0);
gtk_widget_show(hbbox);
gtk_widget_show (hbbox);
button = gtk_button_new_with_label (_("Select"));
gtk_box_pack_start (GTK_BOX (hbbox), button, FALSE, FALSE, 0);
@ -498,8 +502,8 @@ gimp_unit_menu_create_selection (GimpUnitMenu *gum)
gtk_widget_grab_default (button);
gtk_widget_show (button);
/* insert the unit lines */
num_units = gimp_unit_get_number_of_units ();
for (unit = UNIT_END; unit < num_units; unit++)
{
row[0] = g_strdup (gimp_unit_menu_build_string (gum->format, unit));
@ -513,7 +517,7 @@ gimp_unit_menu_create_selection (GimpUnitMenu *gum)
g_free (row[1]);
}
/* Now show the dialog */
/* now show the dialog */
gtk_widget_show(vbox);
gtk_widget_show(gum->selection);
@ -540,15 +544,16 @@ gimp_unit_menu_callback (GtkWidget *widget,
if (gum->unit == new_unit)
return;
/* was "More..." selected? */
/* was "More..." selected? */
if (new_unit == 65536)
{
gtk_option_menu_set_history (GTK_OPTION_MENU (gum),
((gum->unit < UNIT_END) ?
(gum->unit - gum->start +
((gum->start == UNIT_PIXEL) ? 1 : 0)) :
(UNIT_END + ((gum->start == UNIT_PIXEL) ?
2 : 0))));
(gum->unit == UNIT_PIXEL) ? 0 :
(gum->show_pixels ?
((gum->unit < UNIT_END) ?
gum->unit + 1 : UNIT_END + 2) :
((gum->unit < UNIT_END) ?
gum->unit - 1 : UNIT_END)));
if (! gum->selection)
gimp_unit_menu_create_selection (gum);
return;

View file

@ -19,7 +19,6 @@
* Free Software Foundation, Inc., 59 Temple Place - Suite 330,
* Boston, MA 02111-1307, USA.
*/
#ifndef __GIMP_UNIT_MENU_H__
#define __GIMP_UNIT_MENU_H__
@ -44,14 +43,16 @@ struct _GimpUnitMenu
{
GtkOptionMenu optionmenu;
/* private stuff */
/* private */
GtkWidget *selection;
GtkWidget *clist;
/* public */
gchar *format;
GUnit unit;
GUnit start;
gboolean show_pixels;
gboolean show_percent;
};
struct _GimpUnitMenuClass
@ -61,13 +62,14 @@ struct _GimpUnitMenuClass
void (* gimp_unit_menu) (GimpUnitMenu *gum);
};
guint gimp_unit_menu_get_type (void);
guint gimp_unit_menu_get_type (void);
/* format -- a printf-like format string for the menu items
* unit -- the unit selected on widget creation
* with_pixels -- should the menu contain 'pixels' ?
* with_custom -- should the menu contain an item 'More...' to pop up
* the custom unit browser (not yet implemented)
/* format -- a printf-like format string for the menu items
* unit -- the unit selected on widget creation
* show_pixels -- should the menu contain 'pixels' ?
* show_percent -- should the menu contain 'percent' ?
* show_custom -- should the menu contain an item 'More...' to pop up
* the custom unit browser (not yet implemented)
*
* the format string supports the following percent expansions:
*
@ -78,18 +80,19 @@ guint gimp_unit_menu_get_type (void);
* %p -- plural
* %% -- literal percent
*/
GtkWidget* gimp_unit_menu_new (gchar *format,
GUnit unit,
gboolean with_pixels,
gboolean with_custom);
GtkWidget * gimp_unit_menu_new (gchar *format,
GUnit unit,
gboolean show_pixels,
gboolean show_percent,
gboolean show_custom);
void gimp_unit_menu_set_unit (GimpUnitMenu *gum,
GUnit unit);
GUnit gimp_unit_menu_get_unit (GimpUnitMenu *gum);
void gimp_unit_menu_set_unit (GimpUnitMenu *gum,
GUnit unit);
GUnit gimp_unit_menu_get_unit (GimpUnitMenu *gum);
#ifdef __cplusplus
}
#endif /* __cplusplus */
#endif /* __GIMP_UNIT_MENU_H__ */

View file

@ -16,11 +16,10 @@
* Free Software Foundation, Inc., 59 Temple Place - Suite 330,
* Boston, MA 02111-1307, USA.
*/
#include "gimpsizeentry.h"
#include "gimpunitmenu.h"
#define SIZE_MAX_VALUE 500000.0 /* is that enough ?? */
#define SIZE_MAX_VALUE 500000.0
static void gimp_size_entry_unit_callback (GtkWidget *widget,
gpointer data);
@ -140,6 +139,7 @@ gimp_size_entry_init (GimpSizeEntry *gse)
gse->unitmenu = NULL;
gse->unit = UNIT_PIXEL;
gse->menu_show_pixels = TRUE;
gse->menu_show_percent = TRUE;
gse->show_refval = FALSE;
gse->update_policy = GIMP_SIZE_ENTRY_UPDATE_NONE;
}
@ -174,9 +174,10 @@ GtkWidget*
gimp_size_entry_new (gint number_of_fields,
GUnit unit,
gchar *unit_format,
guint menu_show_pixels,
guint show_refval,
guint spinbutton_usize,
gboolean menu_show_pixels,
gboolean menu_show_percent,
gboolean show_refval,
gint spinbutton_usize,
GimpSizeEntryUP update_policy)
{
GimpSizeEntry *gse;
@ -189,7 +190,7 @@ gimp_size_entry_new (gint number_of_fields,
gse->number_of_fields = number_of_fields;
gse->unit = unit;
gse->show_refval = show_refval ? 1 : 0;
gse->show_refval = show_refval;
gse->update_policy = update_policy;
gtk_table_resize (GTK_TABLE (gse),
@ -199,13 +200,19 @@ gimp_size_entry_new (gint number_of_fields,
/* show the 'pixels' menu entry only if we are a 'size' sizeentry and
* don't have the reference value spinbutton
*/
if ((update_policy == GIMP_SIZE_ENTRY_UPDATE_SIZE) && menu_show_pixels)
gse->menu_show_pixels = TRUE;
else if (update_policy == GIMP_SIZE_ENTRY_UPDATE_RESOLUTION)
if ((update_policy == GIMP_SIZE_ENTRY_UPDATE_RESOLUTION) ||
(show_refval == TRUE))
gse->menu_show_pixels = FALSE;
else
gse->menu_show_pixels = menu_show_pixels;
/* show the 'percent' menu entry only if we are a 'size' sizeentry
*/
if (update_policy == GIMP_SIZE_ENTRY_UPDATE_RESOLUTION)
gse->menu_show_percent = FALSE;
else
gse->menu_show_percent = menu_show_percent;
for (i = 0; i < number_of_fields; i++)
{
GimpSizeEntryField *gsef;
@ -296,7 +303,7 @@ gimp_size_entry_new (gint number_of_fields,
}
gse->unitmenu = gimp_unit_menu_new (unit_format, unit,
gse->menu_show_pixels, TRUE);
gse->menu_show_pixels, FALSE, TRUE);
gtk_table_attach_defaults (GTK_TABLE (gse), gse->unitmenu,
i+2, i+3,
gse->show_refval+1, gse->show_refval+2);
@ -311,23 +318,17 @@ gimp_size_entry_new (gint number_of_fields,
/* add a field to the sizeentry */
void
gimp_size_entry_add_field (GimpSizeEntry *gse,
GtkAdjustment *value_adjustment,
GtkSpinButton *value_spinbutton,
GtkAdjustment *refval_adjustment,
GtkSpinButton *refval_spinbutton)
{
GimpSizeEntryField *gsef;
g_return_if_fail (gse != NULL);
g_return_if_fail (GIMP_IS_SIZE_ENTRY (gse));
g_return_if_fail (value_adjustment != NULL);
g_return_if_fail (GTK_IS_ADJUSTMENT (value_adjustment));
g_return_if_fail (value_spinbutton != NULL);
g_return_if_fail (GTK_IS_SPIN_BUTTON (value_spinbutton));
if (gse->show_refval)
{
g_return_if_fail (refval_adjustment != NULL);
g_return_if_fail (GTK_IS_ADJUSTMENT (refval_adjustment));
g_return_if_fail (refval_spinbutton != NULL);
g_return_if_fail (GTK_IS_SPIN_BUTTON (refval_spinbutton));
}
@ -348,9 +349,10 @@ gimp_size_entry_add_field (GimpSizeEntry *gse,
gsef->refval_digits =
(gse->update_policy == GIMP_SIZE_ENTRY_UPDATE_SIZE) ? 0 : 3;
gsef->value_adjustment = GTK_OBJECT (value_adjustment);
gsef->value_adjustment =
GTK_OBJECT (gtk_spin_button_get_adjustment (value_spinbutton));
gsef->value_spinbutton = GTK_WIDGET (value_spinbutton);
gtk_signal_connect (GTK_OBJECT (value_adjustment), "value_changed",
gtk_signal_connect (GTK_OBJECT (gsef->value_adjustment), "value_changed",
(GtkSignalFunc) gimp_size_entry_value_callback, gsef);
/* these callbacks are not used
@ -366,9 +368,10 @@ gimp_size_entry_add_field (GimpSizeEntry *gse,
if (gse->show_refval)
{
gsef->refval_adjustment = GTK_OBJECT (refval_adjustment);
gsef->refval_adjustment =
GTK_OBJECT (gtk_spin_button_get_adjustment (refval_spinbutton));
gsef->refval_spinbutton = GTK_WIDGET (refval_spinbutton);
gtk_signal_connect (GTK_OBJECT (refval_adjustment), "value_changed",
gtk_signal_connect (GTK_OBJECT (gsef->refval_adjustment), "value_changed",
(GtkSignalFunc) gimp_size_entry_refval_callback,
gsef);

View file

@ -54,9 +54,10 @@ struct _GimpSizeEntry
GtkWidget *unitmenu;
GUnit unit;
guint menu_show_pixels;
gboolean menu_show_pixels;
gboolean menu_show_percent;
guint show_refval;
gboolean show_refval;
GimpSizeEntryUP update_policy;
};
@ -99,9 +100,10 @@ guint gimp_size_entry_get_type (void);
GtkWidget* gimp_size_entry_new (gint number_of_fields,
GUnit unit,
gchar *unit_format,
guint menu_show_pixels,
guint show_refval,
guint spinbutton_usize,
gboolean menu_show_pixels,
gboolean menu_show_percent,
gboolean show_refval,
gint spinbutton_usize,
GimpSizeEntryUP update_policy);
/* add a field to the sizeentry
@ -110,9 +112,7 @@ GtkWidget* gimp_size_entry_new (gint number_of_fields,
* the new field will have the index 0
*/
void gimp_size_entry_add_field (GimpSizeEntry *gse,
GtkAdjustment *value_adjustment,
GtkSpinButton *value_spinbutton,
GtkAdjustment *refval_adjustment,
GtkSpinButton *refval_spinbutton);
/* this one is just a convenience function if you want to add labels

View file

@ -1,5 +1,5 @@
/* LIBGIMP - The GIMP Library
* Copyright (C) 1995-1997 Peter Mattis and Spencer Kimball
* Copyright (C) 1995-1999 Peter Mattis and Spencer Kimball
*
* gimpunitmenu.c
* Copyright (C) 1999 Michael Natterer <mitschel@cs.tu-berlin.de>
@ -19,14 +19,15 @@
* Free Software Foundation, Inc., 59 Temple Place - Suite 330,
* Boston, MA 02111-1307, USA.
*/
#include "gimpunitmenu.h"
#include "libgimp/gimpintl.h"
static const gchar* gimp_unit_menu_build_string (gchar *format, GUnit unit);
static void gimp_unit_menu_callback (GtkWidget *widget, gpointer data);
/* private functions */
static const gchar * gimp_unit_menu_build_string (gchar *format,
GUnit unit);
static void gimp_unit_menu_callback (GtkWidget *widget,
gpointer data);
enum {
GUM_UNIT_CHANGED_SIGNAL,
@ -84,7 +85,8 @@ gimp_unit_menu_init (GimpUnitMenu *gum)
gum->clist = NULL;
gum->format = NULL;
gum->unit = UNIT_PIXEL;
gum->start = 0;
gum->show_pixels = FALSE;
gum->show_percent = FALSE;
}
@ -117,8 +119,9 @@ gimp_unit_menu_get_type ()
GtkWidget*
gimp_unit_menu_new (gchar *format,
GUnit unit,
gboolean with_pixels,
gboolean with_custom)
gboolean show_pixels,
gboolean show_percent,
gboolean show_custom)
{
GimpUnitMenu *gum;
GtkWidget *menu;
@ -129,19 +132,18 @@ gimp_unit_menu_new (gchar *format,
(unit < gimp_unit_get_number_of_units ()), NULL);
if (unit >= gimp_unit_get_number_of_built_in_units ())
with_custom = TRUE;
show_custom = TRUE;
gum = gtk_type_new (gimp_unit_menu_get_type ());
gum->format = g_strdup (format);
/* if we don't want pixels, start with inches */
gum->start = with_pixels ? UNIT_PIXEL : UNIT_INCH;
if (unit < gum->start)
unit = gum->start;
gum->show_pixels = show_pixels;
gum->show_percent = show_percent;
menu = gtk_menu_new();
for (u = gum->start; u < gimp_unit_get_number_of_built_in_units(); u++)
for (u = show_pixels ? UNIT_PIXEL : UNIT_INCH;
u < gimp_unit_get_number_of_built_in_units();
u++)
{
menuitem =
gtk_menu_item_new_with_label (gimp_unit_menu_build_string (format, u));
@ -151,7 +153,7 @@ gimp_unit_menu_new (gchar *format,
gtk_object_set_data (GTK_OBJECT (menuitem), "gimp_unit_menu", (gpointer)u);
gtk_widget_show (menuitem);
/* add a separator after pixels */
/* add a separator after "pixels" */
if (u == UNIT_PIXEL)
{
menuitem = gtk_menu_item_new ();
@ -175,7 +177,7 @@ gimp_unit_menu_new (gchar *format,
gtk_widget_show(menuitem);
}
if (with_custom)
if (show_custom)
{
menuitem = gtk_menu_item_new ();
gtk_menu_append (GTK_MENU (menu), menuitem);
@ -195,10 +197,10 @@ gimp_unit_menu_new (gchar *format,
gum->unit = unit;
gtk_option_menu_set_history (GTK_OPTION_MENU (gum),
((unit < UNIT_END) ?
(unit - gum->start +
(with_pixels ? 1 : 0)) :
(UNIT_END + (with_pixels ? 2 : 0))));
(unit == UNIT_PIXEL) ? 0 :
(show_pixels ?
((unit < UNIT_END) ? unit + 1 : UNIT_END + 2) :
((unit < UNIT_END) ? unit - 1 : UNIT_END)));
return GTK_WIDGET (gum);
}
@ -214,14 +216,15 @@ gimp_unit_menu_set_unit (GimpUnitMenu *gum,
g_return_if_fail (gum != NULL);
g_return_if_fail (GIMP_IS_UNIT_MENU (gum));
g_return_if_fail ((unit >= gum->start) &&
g_return_if_fail ((unit >= UNIT_PIXEL) &&
((unit > UNIT_PIXEL) || gum->show_pixels) &&
(unit < gimp_unit_get_number_of_units ()));
if (unit == gum->unit)
return;
items = GTK_MENU_SHELL (GTK_OPTION_MENU (gum)->menu)->children;
user_unit = UNIT_END + ((gum->start == UNIT_PIXEL) ? 2 : 0);
user_unit = UNIT_END + (gum->show_pixels ? 2 : 0);
if (unit >= UNIT_END)
{
@ -252,10 +255,10 @@ gimp_unit_menu_set_unit (GimpUnitMenu *gum,
gum->unit = unit;
gtk_option_menu_set_history (GTK_OPTION_MENU (gum),
((unit < UNIT_END) ?
(unit - gum->start +
((gum->start == UNIT_PIXEL) ? 1 : 0)) :
(UNIT_END + ((gum->start == UNIT_PIXEL) ? 2 : 0))));
(unit == UNIT_PIXEL) ? 0 :
(gum->show_pixels ?
((unit < UNIT_END) ? unit + 1 : UNIT_END + 2) :
((unit < UNIT_END) ? unit - 1 : UNIT_END)));
}
GUnit
@ -268,8 +271,7 @@ gimp_unit_menu_get_unit (GimpUnitMenu *gum)
}
/* most of the next two functions is stolen from app/gdisplay.h ;-) */
/* most of the next two functions is stolen from app/gdisplay.c */
static int
print (char *buf, int len, int start, const char *fmt, ...)
{
@ -358,7 +360,7 @@ gimp_unit_menu_build_string (gchar *format, GUnit unit)
}
/* private callbacks of gimp_unit_menu_create_selection ()
/* private callbacks of gimp_unit_menu_create_selection ()
*/
static void
@ -372,8 +374,8 @@ gimp_unit_menu_selection_select_callback (GtkWidget *widget,
if (gum->selection && GTK_CLIST (gum->clist)->selection)
{
unit = (GUnit)gtk_clist_get_row_data (GTK_CLIST (gum->clist),
(int)(GTK_CLIST (gum->clist)->selection->data));
unit = (GUnit) gtk_clist_get_row_data (GTK_CLIST (gum->clist),
(int) (GTK_CLIST (gum->clist)->selection->data));
gimp_unit_menu_set_unit (gum, unit);
gtk_signal_emit (GTK_OBJECT (gum),
gimp_unit_menu_signals[GUM_UNIT_CHANGED_SIGNAL]);
@ -410,7 +412,7 @@ gimp_unit_menu_selection_delete_callback (GtkWidget *widget,
return TRUE;
}
/* private function of gimp_unit_menu_callback ()
/* private function of gimp_unit_menu_callback ()
*/
static void
@ -446,13 +448,14 @@ gimp_unit_menu_create_selection (GimpUnitMenu *gum)
GTK_SIGNAL_FUNC (gimp_unit_menu_selection_close_callback),
gum);
/* build the selection list */
scrolled_win = gtk_scrolled_window_new (NULL, NULL);
gum->clist = gtk_clist_new (2);
gtk_clist_set_shadow_type (GTK_CLIST (gum->clist), GTK_SHADOW_IN);
gtk_clist_set_selection_mode (GTK_CLIST (gum->clist), GTK_SELECTION_BROWSE);
gtk_widget_set_usize (gum->clist, 200, 150);
gtk_clist_set_column_title (GTK_CLIST (gum->clist), 0, _("Unit"));
gtk_clist_set_column_title (GTK_CLIST (gum->clist), 0, _("Unit "));
gtk_clist_set_column_auto_resize (GTK_CLIST (gum->clist), 0, TRUE);
gtk_clist_set_column_title (GTK_CLIST (gum->clist), 1, _("Factor"));
gtk_clist_set_column_auto_resize (GTK_CLIST (gum->clist), 1, TRUE);
@ -472,6 +475,7 @@ gimp_unit_menu_create_selection (GimpUnitMenu *gum)
gtk_widget_show(scrolled_win);
gtk_widget_show(gum->clist);
/* build the action area */
gtk_container_set_border_width (GTK_CONTAINER (GTK_DIALOG (gum->selection)->action_area), 2);
gtk_box_set_homogeneous (GTK_BOX (GTK_DIALOG (gum->selection)->action_area),
FALSE);
@ -479,7 +483,7 @@ gimp_unit_menu_create_selection (GimpUnitMenu *gum)
gtk_button_box_set_spacing (GTK_BUTTON_BOX (hbbox), 4);
gtk_box_pack_end(GTK_BOX (GTK_DIALOG (gum->selection)->action_area), hbbox,
FALSE, FALSE, 0);
gtk_widget_show(hbbox);
gtk_widget_show (hbbox);
button = gtk_button_new_with_label (_("Select"));
gtk_box_pack_start (GTK_BOX (hbbox), button, FALSE, FALSE, 0);
@ -498,8 +502,8 @@ gimp_unit_menu_create_selection (GimpUnitMenu *gum)
gtk_widget_grab_default (button);
gtk_widget_show (button);
/* insert the unit lines */
num_units = gimp_unit_get_number_of_units ();
for (unit = UNIT_END; unit < num_units; unit++)
{
row[0] = g_strdup (gimp_unit_menu_build_string (gum->format, unit));
@ -513,7 +517,7 @@ gimp_unit_menu_create_selection (GimpUnitMenu *gum)
g_free (row[1]);
}
/* Now show the dialog */
/* now show the dialog */
gtk_widget_show(vbox);
gtk_widget_show(gum->selection);
@ -540,15 +544,16 @@ gimp_unit_menu_callback (GtkWidget *widget,
if (gum->unit == new_unit)
return;
/* was "More..." selected? */
/* was "More..." selected? */
if (new_unit == 65536)
{
gtk_option_menu_set_history (GTK_OPTION_MENU (gum),
((gum->unit < UNIT_END) ?
(gum->unit - gum->start +
((gum->start == UNIT_PIXEL) ? 1 : 0)) :
(UNIT_END + ((gum->start == UNIT_PIXEL) ?
2 : 0))));
(gum->unit == UNIT_PIXEL) ? 0 :
(gum->show_pixels ?
((gum->unit < UNIT_END) ?
gum->unit + 1 : UNIT_END + 2) :
((gum->unit < UNIT_END) ?
gum->unit - 1 : UNIT_END)));
if (! gum->selection)
gimp_unit_menu_create_selection (gum);
return;

View file

@ -19,7 +19,6 @@
* Free Software Foundation, Inc., 59 Temple Place - Suite 330,
* Boston, MA 02111-1307, USA.
*/
#ifndef __GIMP_UNIT_MENU_H__
#define __GIMP_UNIT_MENU_H__
@ -44,14 +43,16 @@ struct _GimpUnitMenu
{
GtkOptionMenu optionmenu;
/* private stuff */
/* private */
GtkWidget *selection;
GtkWidget *clist;
/* public */
gchar *format;
GUnit unit;
GUnit start;
gboolean show_pixels;
gboolean show_percent;
};
struct _GimpUnitMenuClass
@ -61,13 +62,14 @@ struct _GimpUnitMenuClass
void (* gimp_unit_menu) (GimpUnitMenu *gum);
};
guint gimp_unit_menu_get_type (void);
guint gimp_unit_menu_get_type (void);
/* format -- a printf-like format string for the menu items
* unit -- the unit selected on widget creation
* with_pixels -- should the menu contain 'pixels' ?
* with_custom -- should the menu contain an item 'More...' to pop up
* the custom unit browser (not yet implemented)
/* format -- a printf-like format string for the menu items
* unit -- the unit selected on widget creation
* show_pixels -- should the menu contain 'pixels' ?
* show_percent -- should the menu contain 'percent' ?
* show_custom -- should the menu contain an item 'More...' to pop up
* the custom unit browser (not yet implemented)
*
* the format string supports the following percent expansions:
*
@ -78,18 +80,19 @@ guint gimp_unit_menu_get_type (void);
* %p -- plural
* %% -- literal percent
*/
GtkWidget* gimp_unit_menu_new (gchar *format,
GUnit unit,
gboolean with_pixels,
gboolean with_custom);
GtkWidget * gimp_unit_menu_new (gchar *format,
GUnit unit,
gboolean show_pixels,
gboolean show_percent,
gboolean show_custom);
void gimp_unit_menu_set_unit (GimpUnitMenu *gum,
GUnit unit);
GUnit gimp_unit_menu_get_unit (GimpUnitMenu *gum);
void gimp_unit_menu_set_unit (GimpUnitMenu *gum,
GUnit unit);
GUnit gimp_unit_menu_get_unit (GimpUnitMenu *gum);
#ifdef __cplusplus
}
#endif /* __cplusplus */
#endif /* __GIMP_UNIT_MENU_H__ */