app/commands.c app/crop.c app/file_new_dialog.c app/info_dialog.[ch]
1999-05-31 Michael Natterer <mitschel@cs.tu-berlin.de> * app/commands.c * app/crop.c * app/file_new_dialog.c * app/info_dialog.[ch] * app/interface.c * app/layers_dialog.c * app/resize.[ch] * app/rotate_tool.c * app/scale_tool.c * app/shear_tool.c: finished the float->double migration for resolution values. Standardized the order of function calls which initialize sizeentries. Fixed some off-by-one errors by using correct double->int casting. Use the g* counterparts of int and double in some places. Various code cleanups. * app/preferences_dialog.c: same changes as above plus a cleaner implementation of the mem_size_unit stuff. The whole dialog should behave like before.
This commit is contained in:
parent
95f2f04303
commit
4a13995205
40 changed files with 1868 additions and 1754 deletions
21
ChangeLog
21
ChangeLog
|
|
@ -1,3 +1,24 @@
|
|||
1999-05-31 Michael Natterer <mitschel@cs.tu-berlin.de>
|
||||
|
||||
* app/commands.c
|
||||
* app/crop.c
|
||||
* app/file_new_dialog.c
|
||||
* app/info_dialog.[ch]
|
||||
* app/interface.c
|
||||
* app/layers_dialog.c
|
||||
* app/resize.[ch]
|
||||
* app/rotate_tool.c
|
||||
* app/scale_tool.c
|
||||
* app/shear_tool.c: finished the float->double migration for
|
||||
resolution values. Standardized the order of function calls which
|
||||
initialize sizeentries. Fixed some off-by-one errors by using
|
||||
correct double->int casting. Use the g* counterparts of int and
|
||||
double in some places. Various code cleanups.
|
||||
|
||||
* app/preferences_dialog.c: same changes as above plus a cleaner
|
||||
implementation of the mem_size_unit stuff. The whole dialog should
|
||||
behave like before.
|
||||
|
||||
Sat May 29 23:43:56 PDT 1999 Manish Singh <yosh@gimp.org>
|
||||
|
||||
* libgimp/stdplugins-intl.h: #include <locale.h>
|
||||
|
|
|
|||
|
|
@ -1249,7 +1249,7 @@ gimage_mask_border_callback (GtkWidget *w,
|
|||
double radius_x;
|
||||
double radius_y;
|
||||
|
||||
selection_border_radius = (int) *(double*) call_data;
|
||||
selection_border_radius = (int) (*(double*) call_data + 0.5);
|
||||
g_free (call_data);
|
||||
unit = (GUnit) gtk_object_get_data (GTK_OBJECT (w), "size_query_unit");
|
||||
|
||||
|
|
@ -1283,7 +1283,7 @@ gimage_mask_grow_callback (GtkWidget *w,
|
|||
double radius_x;
|
||||
double radius_y;
|
||||
|
||||
selection_grow_pixels = (int) *(double*) call_data;
|
||||
selection_grow_pixels = (int) (*(double*) call_data + 0.5);
|
||||
g_free (call_data);
|
||||
unit = (GUnit) gtk_object_get_data (GTK_OBJECT (w), "size_query_unit");
|
||||
|
||||
|
|
@ -1317,7 +1317,7 @@ gimage_mask_shrink_callback (GtkWidget *w,
|
|||
int radius_x;
|
||||
int radius_y;
|
||||
|
||||
selection_shrink_pixels = (int) *(double*) call_data;
|
||||
selection_shrink_pixels = (int) (*(double*) call_data + 0.5);
|
||||
g_free (call_data);
|
||||
unit = (GUnit) gtk_object_get_data (GTK_OBJECT (w), "size_query_unit");
|
||||
|
||||
|
|
|
|||
|
|
@ -1249,7 +1249,7 @@ gimage_mask_border_callback (GtkWidget *w,
|
|||
double radius_x;
|
||||
double radius_y;
|
||||
|
||||
selection_border_radius = (int) *(double*) call_data;
|
||||
selection_border_radius = (int) (*(double*) call_data + 0.5);
|
||||
g_free (call_data);
|
||||
unit = (GUnit) gtk_object_get_data (GTK_OBJECT (w), "size_query_unit");
|
||||
|
||||
|
|
@ -1283,7 +1283,7 @@ gimage_mask_grow_callback (GtkWidget *w,
|
|||
double radius_x;
|
||||
double radius_y;
|
||||
|
||||
selection_grow_pixels = (int) *(double*) call_data;
|
||||
selection_grow_pixels = (int) (*(double*) call_data + 0.5);
|
||||
g_free (call_data);
|
||||
unit = (GUnit) gtk_object_get_data (GTK_OBJECT (w), "size_query_unit");
|
||||
|
||||
|
|
@ -1317,7 +1317,7 @@ gimage_mask_shrink_callback (GtkWidget *w,
|
|||
int radius_x;
|
||||
int radius_y;
|
||||
|
||||
selection_shrink_pixels = (int) *(double*) call_data;
|
||||
selection_shrink_pixels = (int) (*(double*) call_data + 0.5);
|
||||
g_free (call_data);
|
||||
unit = (GUnit) gtk_object_get_data (GTK_OBJECT (w), "size_query_unit");
|
||||
|
||||
|
|
|
|||
66
app/crop.c
66
app/crop.c
|
|
@ -97,8 +97,8 @@ static CropOptions *crop_options = NULL;
|
|||
/* the crop tool info dialog */
|
||||
static InfoDialog *crop_info = NULL;
|
||||
|
||||
static gfloat orig_vals[2];
|
||||
static gfloat size_vals[2];
|
||||
static gdouble orig_vals[2];
|
||||
static gdouble size_vals[2];
|
||||
|
||||
static GtkWidget *origin_sizeentry;
|
||||
static GtkWidget *size_sizeentry;
|
||||
|
|
@ -954,30 +954,38 @@ crop_start (Tool *tool,
|
|||
|
||||
gimp_size_entry_set_resolution (GIMP_SIZE_ENTRY (origin_sizeentry), 0,
|
||||
gdisp->gimage->xresolution, FALSE);
|
||||
gimp_size_entry_set_size (GIMP_SIZE_ENTRY (origin_sizeentry), 0,
|
||||
0, gdisp->gimage->width);
|
||||
gimp_size_entry_set_resolution (GIMP_SIZE_ENTRY (origin_sizeentry), 1,
|
||||
gdisp->gimage->yresolution, FALSE);
|
||||
|
||||
gimp_size_entry_set_size (GIMP_SIZE_ENTRY (origin_sizeentry), 0,
|
||||
0, gdisp->gimage->width);
|
||||
gimp_size_entry_set_size (GIMP_SIZE_ENTRY (origin_sizeentry), 1,
|
||||
0, gdisp->gimage->height);
|
||||
|
||||
gimp_size_entry_set_resolution (GIMP_SIZE_ENTRY (size_sizeentry), 0,
|
||||
gdisp->gimage->xresolution, FALSE);
|
||||
gimp_size_entry_set_size (GIMP_SIZE_ENTRY (size_sizeentry), 0,
|
||||
0, gdisp->gimage->width);
|
||||
gimp_size_entry_set_resolution (GIMP_SIZE_ENTRY (size_sizeentry), 1,
|
||||
gdisp->gimage->yresolution, FALSE);
|
||||
|
||||
gimp_size_entry_set_size (GIMP_SIZE_ENTRY (size_sizeentry), 0,
|
||||
0, gdisp->gimage->width);
|
||||
gimp_size_entry_set_size (GIMP_SIZE_ENTRY (size_sizeentry), 1,
|
||||
0, gdisp->gimage->height);
|
||||
|
||||
if (old_gdisp != gdisp)
|
||||
{
|
||||
gimp_size_entry_set_unit (GIMP_SIZE_ENTRY (origin_sizeentry),
|
||||
(gdisp->dot_for_dot ? UNIT_PIXEL :
|
||||
gdisp->gimage->unit));
|
||||
gdisp->gimage->unit) ;
|
||||
gimp_size_entry_set_unit (GIMP_SIZE_ENTRY (size_sizeentry),
|
||||
(gdisp->dot_for_dot ? UNIT_PIXEL :
|
||||
gdisp->gimage->unit));
|
||||
gdisp->gimage->unit);
|
||||
|
||||
if (gdisp->dot_for_dot)
|
||||
{
|
||||
gimp_size_entry_set_unit (GIMP_SIZE_ENTRY (origin_sizeentry),
|
||||
UNIT_PIXEL);
|
||||
gimp_size_entry_set_unit (GIMP_SIZE_ENTRY (size_sizeentry),
|
||||
UNIT_PIXEL);
|
||||
}
|
||||
}
|
||||
|
||||
old_gdisp = gdisp;
|
||||
|
|
@ -1028,21 +1036,23 @@ crop_info_create (Tool *tool)
|
|||
gimp_size_entry_add_field (GIMP_SIZE_ENTRY (origin_sizeentry),
|
||||
GTK_SPIN_BUTTON (spinbutton), NULL);
|
||||
|
||||
gimp_size_entry_set_refval_boundaries (GIMP_SIZE_ENTRY (origin_sizeentry), 0,
|
||||
-65536, 65536);
|
||||
gimp_size_entry_set_resolution (GIMP_SIZE_ENTRY (origin_sizeentry), 0,
|
||||
gdisp->gimage->xresolution, FALSE);
|
||||
gimp_size_entry_set_size (GIMP_SIZE_ENTRY (origin_sizeentry), 0,
|
||||
0, gdisp->gimage->width);
|
||||
gimp_size_entry_set_refval (GIMP_SIZE_ENTRY (origin_sizeentry), 0,
|
||||
orig_vals[0]);
|
||||
|
||||
gimp_size_entry_set_refval_boundaries (GIMP_SIZE_ENTRY (origin_sizeentry), 1,
|
||||
-65536, 65536);
|
||||
gimp_size_entry_set_resolution (GIMP_SIZE_ENTRY (origin_sizeentry), 1,
|
||||
gdisp->gimage->yresolution, FALSE);
|
||||
|
||||
gimp_size_entry_set_refval_boundaries (GIMP_SIZE_ENTRY (origin_sizeentry), 0,
|
||||
-65536, 65536);
|
||||
gimp_size_entry_set_refval_boundaries (GIMP_SIZE_ENTRY (origin_sizeentry), 1,
|
||||
-65536, 65536);
|
||||
|
||||
gimp_size_entry_set_size (GIMP_SIZE_ENTRY (origin_sizeentry), 0,
|
||||
0, gdisp->gimage->width);
|
||||
gimp_size_entry_set_size (GIMP_SIZE_ENTRY (origin_sizeentry), 1,
|
||||
0, gdisp->gimage->height);
|
||||
|
||||
gimp_size_entry_set_refval (GIMP_SIZE_ENTRY (origin_sizeentry), 0,
|
||||
orig_vals[0]);
|
||||
gimp_size_entry_set_refval (GIMP_SIZE_ENTRY (origin_sizeentry), 1,
|
||||
orig_vals[1]);
|
||||
|
||||
|
|
@ -1057,20 +1067,22 @@ crop_info_create (Tool *tool)
|
|||
gimp_size_entry_add_field (GIMP_SIZE_ENTRY (size_sizeentry),
|
||||
GTK_SPIN_BUTTON (spinbutton), NULL);
|
||||
|
||||
gimp_size_entry_set_refval_boundaries (GIMP_SIZE_ENTRY (size_sizeentry), 0,
|
||||
-65536, 65536);
|
||||
gimp_size_entry_set_resolution (GIMP_SIZE_ENTRY (size_sizeentry), 0,
|
||||
gdisp->gimage->xresolution, FALSE);
|
||||
gimp_size_entry_set_size (GIMP_SIZE_ENTRY (size_sizeentry), 0,
|
||||
0, gdisp->gimage->width);
|
||||
gimp_size_entry_set_refval (GIMP_SIZE_ENTRY (size_sizeentry), 0, size_vals[0]);
|
||||
|
||||
gimp_size_entry_set_refval_boundaries (GIMP_SIZE_ENTRY (size_sizeentry), 1,
|
||||
-65536, 65536);
|
||||
gimp_size_entry_set_resolution (GIMP_SIZE_ENTRY (size_sizeentry), 1,
|
||||
gdisp->gimage->yresolution, FALSE);
|
||||
|
||||
gimp_size_entry_set_refval_boundaries (GIMP_SIZE_ENTRY (size_sizeentry), 0,
|
||||
-65536, 65536);
|
||||
gimp_size_entry_set_refval_boundaries (GIMP_SIZE_ENTRY (size_sizeentry), 1,
|
||||
-65536, 65536);
|
||||
|
||||
gimp_size_entry_set_size (GIMP_SIZE_ENTRY (size_sizeentry), 0,
|
||||
0, gdisp->gimage->width);
|
||||
gimp_size_entry_set_size (GIMP_SIZE_ENTRY (size_sizeentry), 1,
|
||||
0, gdisp->gimage->height);
|
||||
|
||||
gimp_size_entry_set_refval (GIMP_SIZE_ENTRY (size_sizeentry), 0, size_vals[0]);
|
||||
gimp_size_entry_set_refval (GIMP_SIZE_ENTRY (size_sizeentry), 1, size_vals[1]);
|
||||
|
||||
gtk_table_set_row_spacing (GTK_TABLE (crop_info->info_table), 0, 0);
|
||||
|
|
|
|||
|
|
@ -158,10 +158,10 @@ file_new_ok_callback (GtkWidget *widget,
|
|||
vals = data;
|
||||
|
||||
/* get the image size in pixels */
|
||||
vals->width =
|
||||
gimp_size_entry_get_refval (GIMP_SIZE_ENTRY (vals->size_se), 0);
|
||||
vals->height =
|
||||
gimp_size_entry_get_refval (GIMP_SIZE_ENTRY (vals->size_se), 1);
|
||||
vals->width = (int)
|
||||
(gimp_size_entry_get_refval (GIMP_SIZE_ENTRY (vals->size_se), 0) + 0.5);
|
||||
vals->height = (int)
|
||||
(gimp_size_entry_get_refval (GIMP_SIZE_ENTRY (vals->size_se), 1) + 0.5);
|
||||
|
||||
/* get the resolution in dpi */
|
||||
vals->xresolution =
|
||||
|
|
@ -422,23 +422,27 @@ file_new_image_size_callback (GtkWidget *widget,
|
|||
gpointer data)
|
||||
{
|
||||
NewImageValues *vals;
|
||||
|
||||
gdouble width, height, size;
|
||||
gchar *text;
|
||||
gchar *label;
|
||||
|
||||
vals = (NewImageValues *) data;
|
||||
vals = data;
|
||||
|
||||
width = gimp_size_entry_get_refval (GIMP_SIZE_ENTRY (vals->size_se), 0);
|
||||
height = gimp_size_entry_get_refval (GIMP_SIZE_ENTRY (vals->size_se), 1);
|
||||
width = (gdouble) (gint)
|
||||
(gimp_size_entry_get_refval (GIMP_SIZE_ENTRY (vals->size_se), 0) + 0.5);
|
||||
height = (gdouble) (gint)
|
||||
(gimp_size_entry_get_refval (GIMP_SIZE_ENTRY (vals->size_se), 1) + 0.5);
|
||||
|
||||
size =
|
||||
width * height *
|
||||
((vals->type == RGB ? 3 : 1) + /* bytes per pixel */
|
||||
(vals->fill_type == TRANSPARENT_FILL ? 1 : 0)); /* alpha channel */
|
||||
|
||||
text = file_new_print_size (size);
|
||||
label = g_strdup_printf (_("Image Size: %s"), text);
|
||||
label = g_strdup_printf (_("Image Size: %s"),
|
||||
text = file_new_print_size (size));
|
||||
gtk_frame_set_label (GTK_FRAME (vals->size_frame), label);
|
||||
|
||||
g_free (label);
|
||||
g_free (text);
|
||||
|
||||
|
|
@ -481,6 +485,8 @@ file_new_cmd_callback (GtkWidget *widget,
|
|||
N_("RGB"),
|
||||
N_("Grayscale")
|
||||
};
|
||||
static gint ntypes = sizeof (type_names) / sizeof (type_names[0]);
|
||||
|
||||
static gchar *fill_type_names[] =
|
||||
{
|
||||
N_("Foreground"),
|
||||
|
|
@ -488,6 +494,8 @@ file_new_cmd_callback (GtkWidget *widget,
|
|||
N_("White"),
|
||||
N_("Transparent")
|
||||
};
|
||||
static gint nfill_types =
|
||||
sizeof (fill_type_names) / sizeof (fill_type_names[0]);
|
||||
|
||||
if(!new_dialog_run)
|
||||
{
|
||||
|
|
@ -796,19 +804,19 @@ file_new_cmd_callback (GtkWidget *widget,
|
|||
gtk_box_pack_start (GTK_BOX (top_vbox), hbox, FALSE, FALSE, 0);
|
||||
gtk_widget_show (hbox);
|
||||
|
||||
/* frame for Image Type */
|
||||
/* frame for Image Type */
|
||||
frame = gtk_frame_new (_("Image Type"));
|
||||
gtk_box_pack_start (GTK_BOX (hbox), frame, TRUE, TRUE, 0);
|
||||
gtk_widget_show (frame);
|
||||
|
||||
/* radio buttons and box */
|
||||
/* radio buttons and box */
|
||||
radio_box = gtk_vbox_new (FALSE, 1);
|
||||
gtk_container_set_border_width (GTK_CONTAINER (radio_box), 2);
|
||||
gtk_container_add (GTK_CONTAINER (frame), radio_box);
|
||||
gtk_widget_show (radio_box);
|
||||
|
||||
group = NULL;
|
||||
for (i = 0; i < 2; i++)
|
||||
for (i = 0; i < ntypes; i++)
|
||||
{
|
||||
button = gtk_radio_button_new_with_label (group, gettext (type_names[i]));
|
||||
group = gtk_radio_button_group (GTK_RADIO_BUTTON (button));
|
||||
|
|
@ -837,7 +845,7 @@ file_new_cmd_callback (GtkWidget *widget,
|
|||
gtk_widget_show (radio_box);
|
||||
|
||||
group = NULL;
|
||||
for (i = 0; i < 4; i++)
|
||||
for (i = 0; i < nfill_types; i++)
|
||||
{
|
||||
button =
|
||||
gtk_radio_button_new_with_label (group, gettext (fill_type_names[i]));
|
||||
|
|
@ -857,6 +865,7 @@ file_new_cmd_callback (GtkWidget *widget,
|
|||
}
|
||||
|
||||
gimp_size_entry_grab_focus (GIMP_SIZE_ENTRY (vals->size_se));
|
||||
|
||||
gtk_widget_show (vals->dlg);
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -34,7 +34,7 @@ static gint info_dialog_delete_callback (GtkWidget *, GdkEvent *, gpointer);
|
|||
static void
|
||||
info_field_new (InfoDialog *idialog,
|
||||
InfoFieldType field_type,
|
||||
char *title,
|
||||
gchar *title,
|
||||
GtkWidget *widget,
|
||||
GtkObject *obj,
|
||||
void *value_ptr,
|
||||
|
|
@ -43,7 +43,7 @@ info_field_new (InfoDialog *idialog,
|
|||
{
|
||||
GtkWidget *label;
|
||||
InfoField *field;
|
||||
int row;
|
||||
int row;
|
||||
|
||||
field = (InfoField *) g_malloc (sizeof (InfoField));
|
||||
|
||||
|
|
@ -52,12 +52,12 @@ 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,
|
||||
gtk_table_attach (GTK_TABLE (idialog->info_table), label,
|
||||
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,
|
||||
gtk_table_attach_defaults (GTK_TABLE (idialog->info_table), widget,
|
||||
1, 2, row - 1, row);
|
||||
gtk_widget_show (widget);
|
||||
|
||||
|
|
@ -105,14 +105,14 @@ update_field (InfoField *field)
|
|||
case INFO_SCALE:
|
||||
case INFO_SPINBUTTON:
|
||||
gtk_adjustment_set_value (GTK_ADJUSTMENT (field->obj),
|
||||
*((gfloat*) field->value_ptr));
|
||||
*((gdouble*) field->value_ptr));
|
||||
break;
|
||||
|
||||
case INFO_SIZEENTRY:
|
||||
num = GIMP_SIZE_ENTRY (field->obj)->number_of_fields;
|
||||
for (i = 0; i < num; i++)
|
||||
gimp_size_entry_set_refval (GIMP_SIZE_ENTRY (field->obj), i,
|
||||
((gfloat*) field->value_ptr)[i]);
|
||||
((gdouble*) field->value_ptr)[i]);
|
||||
break;
|
||||
|
||||
default:
|
||||
|
|
@ -121,7 +121,17 @@ update_field (InfoField *field)
|
|||
}
|
||||
}
|
||||
|
||||
/* function definitions */
|
||||
static gint
|
||||
info_dialog_delete_callback (GtkWidget *w,
|
||||
GdkEvent *e,
|
||||
gpointer client_data)
|
||||
{
|
||||
info_dialog_popdown ((InfoDialog *) client_data);
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
/* public functions */
|
||||
|
||||
InfoDialog *
|
||||
info_dialog_new (char *title)
|
||||
|
|
@ -189,6 +199,45 @@ info_dialog_free (InfoDialog *idialog)
|
|||
g_free (idialog);
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
info_dialog_popup (InfoDialog *idialog)
|
||||
{
|
||||
if (!idialog)
|
||||
return;
|
||||
|
||||
if (!GTK_WIDGET_VISIBLE (idialog->shell))
|
||||
gtk_widget_show (idialog->shell);
|
||||
|
||||
}
|
||||
|
||||
void
|
||||
info_dialog_popdown (InfoDialog *idialog)
|
||||
{
|
||||
if (!idialog)
|
||||
return;
|
||||
|
||||
if (GTK_WIDGET_VISIBLE (idialog->shell))
|
||||
gtk_widget_hide (idialog->shell);
|
||||
}
|
||||
|
||||
void
|
||||
info_dialog_update (InfoDialog *idialog)
|
||||
{
|
||||
GSList *list;
|
||||
|
||||
if (!idialog)
|
||||
return;
|
||||
|
||||
list = idialog->field_list;
|
||||
|
||||
while (list)
|
||||
{
|
||||
update_field ((InfoField *) list->data);
|
||||
list = g_slist_next (list);
|
||||
}
|
||||
}
|
||||
|
||||
GtkWidget *
|
||||
info_dialog_add_label (InfoDialog *idialog,
|
||||
char *title,
|
||||
|
|
@ -234,8 +283,8 @@ info_dialog_add_entry (InfoDialog *idialog,
|
|||
|
||||
GtkWidget *
|
||||
info_dialog_add_scale (InfoDialog *idialog,
|
||||
char *title,
|
||||
float *value_ptr,
|
||||
gchar *title,
|
||||
gdouble *value_ptr,
|
||||
gfloat lower,
|
||||
gfloat upper,
|
||||
gfloat step_increment,
|
||||
|
|
@ -272,7 +321,7 @@ info_dialog_add_scale (InfoDialog *idialog,
|
|||
GtkWidget *
|
||||
info_dialog_add_spinbutton (InfoDialog *idialog,
|
||||
gchar *title,
|
||||
gfloat *value_ptr,
|
||||
gdouble *value_ptr,
|
||||
gfloat lower,
|
||||
gfloat upper,
|
||||
gfloat step_increment,
|
||||
|
|
@ -316,7 +365,7 @@ info_dialog_add_spinbutton (InfoDialog *idialog,
|
|||
GtkWidget *
|
||||
info_dialog_add_sizeentry (InfoDialog *idialog,
|
||||
gchar *title,
|
||||
gfloat *value_ptr,
|
||||
gdouble *value_ptr,
|
||||
gint nfields,
|
||||
GUnit unit,
|
||||
gchar *unit_format,
|
||||
|
|
@ -356,51 +405,3 @@ info_dialog_add_sizeentry (InfoDialog *idialog,
|
|||
|
||||
return sizeentry;
|
||||
}
|
||||
|
||||
void
|
||||
info_dialog_popup (InfoDialog *idialog)
|
||||
{
|
||||
if (!idialog)
|
||||
return;
|
||||
|
||||
if (!GTK_WIDGET_VISIBLE (idialog->shell))
|
||||
gtk_widget_show (idialog->shell);
|
||||
|
||||
}
|
||||
|
||||
void
|
||||
info_dialog_popdown (InfoDialog *idialog)
|
||||
{
|
||||
if (!idialog)
|
||||
return;
|
||||
|
||||
if (GTK_WIDGET_VISIBLE (idialog->shell))
|
||||
gtk_widget_hide (idialog->shell);
|
||||
}
|
||||
|
||||
void
|
||||
info_dialog_update (InfoDialog *idialog)
|
||||
{
|
||||
GSList *list;
|
||||
|
||||
if (!idialog)
|
||||
return;
|
||||
|
||||
list = idialog->field_list;
|
||||
|
||||
while (list)
|
||||
{
|
||||
update_field ((InfoField *) list->data);
|
||||
list = g_slist_next (list);
|
||||
}
|
||||
}
|
||||
|
||||
static gint
|
||||
info_dialog_delete_callback (GtkWidget *w,
|
||||
GdkEvent *e,
|
||||
gpointer client_data)
|
||||
{
|
||||
info_dialog_popdown ((InfoDialog *) client_data);
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -79,7 +79,7 @@ GtkWidget *info_dialog_add_entry (InfoDialog *idialog,
|
|||
|
||||
GtkWidget *info_dialog_add_scale (InfoDialog *idialog,
|
||||
gchar *title,
|
||||
gfloat *value_ptr,
|
||||
gdouble *value_ptr,
|
||||
gfloat lower,
|
||||
gfloat upper,
|
||||
gfloat step_increment,
|
||||
|
|
@ -91,7 +91,7 @@ GtkWidget *info_dialog_add_scale (InfoDialog *idialog,
|
|||
|
||||
GtkWidget *info_dialog_add_spinbutton (InfoDialog *idialog,
|
||||
gchar *title,
|
||||
gfloat *value_ptr,
|
||||
gdouble *value_ptr,
|
||||
gfloat lower,
|
||||
gfloat upper,
|
||||
gfloat step_increment,
|
||||
|
|
@ -104,7 +104,7 @@ GtkWidget *info_dialog_add_spinbutton (InfoDialog *idialog,
|
|||
|
||||
GtkWidget *info_dialog_add_sizeentry (InfoDialog *idialog,
|
||||
gchar *title,
|
||||
gfloat *value_ptr,
|
||||
gdouble *value_ptr,
|
||||
gint nfields,
|
||||
GUnit unit,
|
||||
gchar *unit_format,
|
||||
|
|
|
|||
|
|
@ -56,79 +56,68 @@ static void file_prefs_res_source_callback (GtkWidget *, gpointer);
|
|||
static void file_prefs_monitor_resolution_callback (GtkWidget *, gpointer);
|
||||
|
||||
/* static variables */
|
||||
static int old_perfectmouse;
|
||||
static int old_transparency_type;
|
||||
static int old_transparency_size;
|
||||
static int old_levels_of_undo;
|
||||
static int old_marching_speed;
|
||||
static int old_allow_resize_windows;
|
||||
static int old_auto_save;
|
||||
static int old_preview_size;
|
||||
static int old_no_cursor_updating;
|
||||
static int old_show_tool_tips;
|
||||
static int old_show_rulers;
|
||||
static int old_show_statusbar;
|
||||
static int old_cubic_interpolation;
|
||||
static int old_confirm_on_close;
|
||||
static int old_save_session_info;
|
||||
static int old_save_device_status;
|
||||
static int old_always_restore_session;
|
||||
static int old_default_width;
|
||||
static int old_default_height;
|
||||
static GUnit old_default_units;
|
||||
static double old_default_xresolution;
|
||||
static double old_default_yresolution;
|
||||
static GUnit old_default_resolution_units;
|
||||
static int old_default_type;
|
||||
static int old_stingy_memory_use;
|
||||
static int old_tile_cache_size;
|
||||
static int old_install_cmap;
|
||||
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_gradient_path;
|
||||
static double old_monitor_xres;
|
||||
static double old_monitor_yres;
|
||||
static int old_using_xserver_resolution;
|
||||
static int old_num_processors;
|
||||
static char * old_image_title_format;
|
||||
static int old_global_paint_options;
|
||||
static int old_max_new_image_size;
|
||||
static int old_perfectmouse;
|
||||
static int old_transparency_type;
|
||||
static int old_transparency_size;
|
||||
static int old_levels_of_undo;
|
||||
static int old_marching_speed;
|
||||
static int old_allow_resize_windows;
|
||||
static int old_auto_save;
|
||||
static int old_preview_size;
|
||||
static int old_no_cursor_updating;
|
||||
static int old_show_tool_tips;
|
||||
static int old_show_rulers;
|
||||
static int old_show_statusbar;
|
||||
static int old_cubic_interpolation;
|
||||
static int old_confirm_on_close;
|
||||
static int old_save_session_info;
|
||||
static int old_save_device_status;
|
||||
static int old_always_restore_session;
|
||||
static int old_default_width;
|
||||
static int old_default_height;
|
||||
static GUnit old_default_units;
|
||||
static double old_default_xresolution;
|
||||
static double old_default_yresolution;
|
||||
static GUnit old_default_resolution_units;
|
||||
static int old_default_type;
|
||||
static int old_stingy_memory_use;
|
||||
static int old_tile_cache_size;
|
||||
static int old_install_cmap;
|
||||
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_gradient_path;
|
||||
static double old_monitor_xres;
|
||||
static double old_monitor_yres;
|
||||
static int old_using_xserver_resolution;
|
||||
static int old_num_processors;
|
||||
static char * old_image_title_format;
|
||||
static int old_global_paint_options;
|
||||
static int old_max_new_image_size;
|
||||
|
||||
/* variables which can't be changed on the fly */
|
||||
static int edit_stingy_memory_use;
|
||||
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 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;
|
||||
|
||||
static int divided_tile_cache_size;
|
||||
static int tile_cache_size_unit;
|
||||
|
||||
static int divided_max_new_image_size;
|
||||
static int max_new_image_size_unit;
|
||||
|
||||
static GtkWidget *default_size_sizeentry = NULL;
|
||||
static GtkWidget *default_resolution_sizeentry = NULL;
|
||||
static GtkWidget *resolution_xserver_label = NULL;
|
||||
static GtkWidget *monitor_resolution_sizeentry = NULL;
|
||||
static GtkWidget *prefs_dlg = NULL;
|
||||
|
||||
/* Some information regarding preferences, compiled by Raph Levien 11/3/97.
|
||||
updated by Michael Natterer 27/3/99
|
||||
|
|
@ -278,10 +267,6 @@ file_prefs_ok_callback (GtkWidget *widget,
|
|||
|
||||
gtk_widget_destroy (dlg);
|
||||
prefs_dlg = NULL;
|
||||
default_size_sizeentry = NULL;
|
||||
default_resolution_sizeentry = NULL;
|
||||
resolution_xserver_label = NULL;
|
||||
monitor_resolution_sizeentry = NULL;
|
||||
|
||||
if (show_tool_tips)
|
||||
gtk_tooltips_enable (tool_tips);
|
||||
|
|
@ -545,10 +530,6 @@ file_prefs_cancel_callback (GtkWidget *widget,
|
|||
{
|
||||
gtk_widget_destroy (dlg);
|
||||
prefs_dlg = NULL;
|
||||
default_size_sizeentry = NULL;
|
||||
default_resolution_sizeentry = NULL;
|
||||
resolution_xserver_label = NULL;
|
||||
monitor_resolution_sizeentry = NULL;
|
||||
|
||||
levels_of_undo = old_levels_of_undo;
|
||||
marching_speed = old_marching_speed;
|
||||
|
|
@ -683,22 +664,22 @@ file_prefs_mem_size_callback (GtkWidget *widget,
|
|||
gpointer data)
|
||||
{
|
||||
int *mem_size;
|
||||
int *divided_mem_size;
|
||||
int *mem_size_unit;
|
||||
int divided_mem_size;
|
||||
int mem_size_unit;
|
||||
|
||||
if (! (mem_size = gtk_object_get_data (GTK_OBJECT (widget), "mem_size")))
|
||||
return;
|
||||
|
||||
if (! (divided_mem_size = gtk_object_get_data (GTK_OBJECT (widget),
|
||||
"divided_mem_size")))
|
||||
return;
|
||||
divided_mem_size = (int) gtk_object_get_data (GTK_OBJECT (widget),
|
||||
"divided_mem_size");
|
||||
mem_size_unit = (int) gtk_object_get_data (GTK_OBJECT (widget),
|
||||
"mem_size_unit");
|
||||
|
||||
if (! (mem_size_unit = gtk_object_get_data (GTK_OBJECT (widget),
|
||||
"mem_size_unit")))
|
||||
return;
|
||||
divided_mem_size = GTK_ADJUSTMENT (widget)->value;
|
||||
*mem_size = divided_mem_size * mem_size_unit;
|
||||
|
||||
*divided_mem_size = GTK_ADJUSTMENT (widget)->value;
|
||||
*mem_size = *divided_mem_size * *mem_size_unit;
|
||||
gtk_object_set_data (GTK_OBJECT (widget), "divided_mem_size",
|
||||
(gpointer) divided_mem_size);
|
||||
}
|
||||
|
||||
static void
|
||||
|
|
@ -708,37 +689,35 @@ file_prefs_mem_size_unit_callback (GtkWidget *widget,
|
|||
GtkObject *adjustment;
|
||||
int new_unit;
|
||||
int *mem_size;
|
||||
int *divided_mem_size;
|
||||
int *mem_size_unit;
|
||||
int divided_mem_size;
|
||||
int mem_size_unit;
|
||||
|
||||
adjustment = GTK_OBJECT (data);
|
||||
|
||||
if (! (new_unit = (int) gtk_object_get_user_data (GTK_OBJECT (widget))))
|
||||
return;
|
||||
new_unit = (int) gtk_object_get_user_data (GTK_OBJECT (widget));
|
||||
|
||||
if (! (mem_size = gtk_object_get_data (GTK_OBJECT (adjustment), "mem_size")))
|
||||
return;
|
||||
|
||||
if (! (divided_mem_size = gtk_object_get_data (GTK_OBJECT (adjustment),
|
||||
"divided_mem_size")))
|
||||
return;
|
||||
divided_mem_size = (int) gtk_object_get_data (GTK_OBJECT (adjustment),
|
||||
"divided_mem_size");
|
||||
mem_size_unit = (int) gtk_object_get_data (GTK_OBJECT (adjustment),
|
||||
"mem_size_unit");
|
||||
|
||||
if (! (mem_size_unit = gtk_object_get_data (GTK_OBJECT (adjustment),
|
||||
"mem_size_unit")))
|
||||
return;
|
||||
|
||||
if (new_unit != *mem_size_unit)
|
||||
if (new_unit != mem_size_unit)
|
||||
{
|
||||
*divided_mem_size = *mem_size / new_unit;
|
||||
*mem_size_unit = new_unit;
|
||||
divided_mem_size = *mem_size / new_unit;
|
||||
mem_size_unit = new_unit;
|
||||
|
||||
gtk_signal_handler_block_by_data (GTK_OBJECT (adjustment),
|
||||
divided_mem_size);
|
||||
gtk_adjustment_set_value (GTK_ADJUSTMENT (adjustment),
|
||||
(float) *divided_mem_size);
|
||||
gtk_signal_handler_unblock_by_data (GTK_OBJECT (adjustment),
|
||||
divided_mem_size);
|
||||
gtk_signal_handler_block_by_data (GTK_OBJECT (adjustment), mem_size);
|
||||
gtk_adjustment_set_value (GTK_ADJUSTMENT (adjustment), divided_mem_size);
|
||||
gtk_signal_handler_unblock_by_data (GTK_OBJECT (adjustment), mem_size);
|
||||
}
|
||||
|
||||
gtk_object_set_data (GTK_OBJECT (adjustment), "divided_mem_size",
|
||||
(gpointer) divided_mem_size);
|
||||
gtk_object_set_data (GTK_OBJECT (adjustment), "mem_size_unit",
|
||||
(gpointer) mem_size_unit);
|
||||
}
|
||||
|
||||
static void
|
||||
|
|
@ -793,8 +772,10 @@ static void
|
|||
file_prefs_default_size_callback (GtkWidget *widget,
|
||||
gpointer data)
|
||||
{
|
||||
default_width = gimp_size_entry_get_refval (GIMP_SIZE_ENTRY (widget), 0);
|
||||
default_height = gimp_size_entry_get_refval (GIMP_SIZE_ENTRY (widget), 1);
|
||||
default_width =
|
||||
(int) (gimp_size_entry_get_refval (GIMP_SIZE_ENTRY (widget), 0) + 0.5);
|
||||
default_height =
|
||||
(int) (gimp_size_entry_get_refval (GIMP_SIZE_ENTRY (widget), 1) + 0.5);
|
||||
default_units = gimp_size_entry_get_unit (GIMP_SIZE_ENTRY (widget));
|
||||
}
|
||||
|
||||
|
|
@ -802,6 +783,7 @@ static void
|
|||
file_prefs_default_resolution_callback (GtkWidget *widget,
|
||||
gpointer data)
|
||||
{
|
||||
GtkWidget *size_sizeentry;
|
||||
static gdouble xres = 0.0;
|
||||
static gdouble yres = 0.0;
|
||||
gdouble new_xres;
|
||||
|
|
@ -810,6 +792,8 @@ file_prefs_default_resolution_callback (GtkWidget *widget,
|
|||
new_xres = gimp_size_entry_get_refval (GIMP_SIZE_ENTRY (widget), 0);
|
||||
new_yres = gimp_size_entry_get_refval (GIMP_SIZE_ENTRY (widget), 1);
|
||||
|
||||
size_sizeentry = gtk_object_get_data (GTK_OBJECT (widget), "size_sizeentry");
|
||||
|
||||
if (gimp_chain_button_get_active (GIMP_CHAIN_BUTTON (data)))
|
||||
{
|
||||
if (new_xres != xres)
|
||||
|
|
@ -832,15 +816,15 @@ file_prefs_default_resolution_callback (GtkWidget *widget,
|
|||
yres = new_yres;
|
||||
}
|
||||
|
||||
gimp_size_entry_set_resolution (GIMP_SIZE_ENTRY (default_size_sizeentry),
|
||||
gimp_size_entry_set_resolution (GIMP_SIZE_ENTRY (size_sizeentry),
|
||||
0, xres, FALSE);
|
||||
gimp_size_entry_set_resolution (GIMP_SIZE_ENTRY (default_size_sizeentry),
|
||||
gimp_size_entry_set_resolution (GIMP_SIZE_ENTRY (size_sizeentry),
|
||||
1, yres, FALSE);
|
||||
|
||||
default_width =
|
||||
gimp_size_entry_get_refval (GIMP_SIZE_ENTRY (default_size_sizeentry), 0);
|
||||
default_height =
|
||||
gimp_size_entry_get_refval (GIMP_SIZE_ENTRY (default_size_sizeentry), 1);
|
||||
default_width = (gint)
|
||||
(gimp_size_entry_get_refval (GIMP_SIZE_ENTRY (size_sizeentry), 0) + 0.5);
|
||||
default_height = (gint)
|
||||
(gimp_size_entry_get_refval (GIMP_SIZE_ENTRY (size_sizeentry), 1) + 0.5);
|
||||
default_xresolution = xres;
|
||||
default_yresolution = yres;
|
||||
default_resolution_units = gimp_size_entry_get_unit (GIMP_SIZE_ENTRY (widget));
|
||||
|
|
@ -850,13 +834,18 @@ static void
|
|||
file_prefs_res_source_callback (GtkWidget *widget,
|
||||
gpointer data)
|
||||
{
|
||||
if (resolution_xserver_label)
|
||||
gtk_widget_set_sensitive (resolution_xserver_label,
|
||||
GTK_TOGGLE_BUTTON (widget)->active);
|
||||
GtkWidget *resolution_xserver_label;
|
||||
GtkWidget *monitor_resolution_sizeentry;
|
||||
|
||||
if (monitor_resolution_sizeentry)
|
||||
gtk_widget_set_sensitive (monitor_resolution_sizeentry,
|
||||
! GTK_TOGGLE_BUTTON (widget)->active);
|
||||
resolution_xserver_label =
|
||||
gtk_object_get_data (GTK_OBJECT (widget), "resolution_xserver_label");
|
||||
monitor_resolution_sizeentry =
|
||||
gtk_object_get_data (GTK_OBJECT (widget), "monitor_resolution_sizeentry");
|
||||
|
||||
gtk_widget_set_sensitive (resolution_xserver_label,
|
||||
GTK_TOGGLE_BUTTON (widget)->active);
|
||||
gtk_widget_set_sensitive (monitor_resolution_sizeentry,
|
||||
! GTK_TOGGLE_BUTTON (widget)->active);
|
||||
|
||||
if (GTK_TOGGLE_BUTTON (widget)->active)
|
||||
{
|
||||
|
|
@ -1013,8 +1002,8 @@ gimp_dialog_new (const gchar *title,
|
|||
allow_grow, allow_shrink, auto_shrink);
|
||||
|
||||
/* prepare the action_area */
|
||||
gtk_container_border_width (GTK_CONTAINER (GTK_DIALOG (dialog)->action_area),
|
||||
2);
|
||||
gtk_container_set_border_width
|
||||
(GTK_CONTAINER (GTK_DIALOG (dialog)->action_area), 2);
|
||||
gtk_box_set_homogeneous (GTK_BOX (GTK_DIALOG (dialog)->action_area), FALSE);
|
||||
|
||||
hbbox = gtk_hbutton_box_new ();
|
||||
|
|
@ -1339,31 +1328,35 @@ void
|
|||
file_pref_cmd_callback (GtkWidget *widget,
|
||||
gpointer client_data)
|
||||
{
|
||||
GtkWidget *ctree;
|
||||
gchar *titles[1];
|
||||
GtkCTreeNode *top_insert;
|
||||
GtkCTreeNode *child_insert;
|
||||
gint page_index;
|
||||
GtkWidget *ctree;
|
||||
gchar *titles[1];
|
||||
GtkCTreeNode *top_insert;
|
||||
GtkCTreeNode *child_insert;
|
||||
gint page_index;
|
||||
|
||||
GtkWidget *frame;
|
||||
GtkWidget *notebook;
|
||||
GtkWidget *vbox;
|
||||
GtkWidget *vbox2;
|
||||
GtkWidget *hbox;
|
||||
GtkWidget *abox;
|
||||
GtkWidget *button;
|
||||
GtkWidget *fileselection;
|
||||
GtkWidget *patheditor;
|
||||
GtkWidget *spinbutton;
|
||||
GtkWidget *combo;
|
||||
GtkWidget *comboitem;
|
||||
GtkWidget *optionmenu;
|
||||
GtkWidget *table;
|
||||
GtkWidget *label;
|
||||
GSList *group;
|
||||
GtkObject *adjustment;
|
||||
GtkWidget *frame;
|
||||
GtkWidget *notebook;
|
||||
GtkWidget *vbox;
|
||||
GtkWidget *vbox2;
|
||||
GtkWidget *hbox;
|
||||
GtkWidget *abox;
|
||||
GtkWidget *button;
|
||||
GtkWidget *fileselection;
|
||||
GtkWidget *patheditor;
|
||||
GtkWidget *spinbutton;
|
||||
GtkWidget *combo;
|
||||
GtkWidget *comboitem;
|
||||
GtkWidget *optionmenu;
|
||||
GtkWidget *table;
|
||||
GtkWidget *label;
|
||||
GtkObject *adjustment;
|
||||
GtkWidget *sizeentry;
|
||||
GtkWidget *sizeentry2;
|
||||
GSList *group;
|
||||
|
||||
int i;
|
||||
int i;
|
||||
int divided_mem_size;
|
||||
int mem_size_unit;
|
||||
|
||||
if (prefs_dlg)
|
||||
{
|
||||
|
|
@ -1435,24 +1428,6 @@ file_pref_cmd_callback (GtkWidget *widget,
|
|||
file_prefs_strset (&old_palette_path, edit_palette_path);
|
||||
file_prefs_strset (&old_gradient_path, edit_gradient_path);
|
||||
|
||||
tile_cache_size_unit = 1;
|
||||
for (i = 0; i < 3; i++)
|
||||
{
|
||||
if (edit_tile_cache_size % (tile_cache_size_unit * 1024) != 0)
|
||||
break;
|
||||
tile_cache_size_unit *= 1024;
|
||||
}
|
||||
divided_tile_cache_size = edit_tile_cache_size / tile_cache_size_unit;
|
||||
|
||||
max_new_image_size_unit = 1;
|
||||
for (i = 0; i < 3; i++)
|
||||
{
|
||||
if (max_new_image_size % (max_new_image_size_unit * 1024) != 0)
|
||||
break;
|
||||
max_new_image_size_unit *= 1024;
|
||||
}
|
||||
divided_max_new_image_size = max_new_image_size / max_new_image_size_unit;
|
||||
|
||||
/* Create the dialog */
|
||||
prefs_dlg =
|
||||
gimp_dialog_new (_("Preferences"), "gimp_preferences",
|
||||
|
|
@ -1520,37 +1495,39 @@ file_pref_cmd_callback (GtkWidget *widget,
|
|||
gtk_container_add (GTK_CONTAINER (frame), hbox);
|
||||
gtk_widget_show (hbox);
|
||||
|
||||
default_size_sizeentry = gimp_size_entry_new (2, default_units, "%p",
|
||||
FALSE, FALSE, TRUE, 75,
|
||||
GIMP_SIZE_ENTRY_UPDATE_SIZE);
|
||||
gimp_size_entry_set_resolution (GIMP_SIZE_ENTRY (default_size_sizeentry),
|
||||
0, default_xresolution, FALSE);
|
||||
gimp_size_entry_set_resolution (GIMP_SIZE_ENTRY (default_size_sizeentry),
|
||||
1, default_yresolution, FALSE);
|
||||
gimp_size_entry_set_refval_boundaries
|
||||
(GIMP_SIZE_ENTRY (default_size_sizeentry), 0,
|
||||
GIMP_MIN_IMAGE_SIZE, GIMP_MAX_IMAGE_SIZE);
|
||||
gimp_size_entry_set_refval_boundaries
|
||||
(GIMP_SIZE_ENTRY (default_size_sizeentry), 1,
|
||||
GIMP_MIN_IMAGE_SIZE, GIMP_MAX_IMAGE_SIZE);
|
||||
gimp_size_entry_set_refval (GIMP_SIZE_ENTRY (default_size_sizeentry), 0,
|
||||
default_width);
|
||||
gimp_size_entry_set_refval (GIMP_SIZE_ENTRY (default_size_sizeentry), 1,
|
||||
default_height);
|
||||
gimp_size_entry_attach_label (GIMP_SIZE_ENTRY (default_size_sizeentry),
|
||||
sizeentry =
|
||||
gimp_size_entry_new (2, default_units, "%p", FALSE, FALSE, TRUE, 75,
|
||||
GIMP_SIZE_ENTRY_UPDATE_SIZE);
|
||||
|
||||
gimp_size_entry_attach_label (GIMP_SIZE_ENTRY (sizeentry),
|
||||
_("Width"), 0, 1, 0.0);
|
||||
gimp_size_entry_attach_label (GIMP_SIZE_ENTRY (default_size_sizeentry),
|
||||
gimp_size_entry_attach_label (GIMP_SIZE_ENTRY (sizeentry),
|
||||
_("Height"), 0, 2, 0.0);
|
||||
gimp_size_entry_attach_label (GIMP_SIZE_ENTRY (default_size_sizeentry),
|
||||
gimp_size_entry_attach_label (GIMP_SIZE_ENTRY (sizeentry),
|
||||
_("Pixels"), 1, 4, 0.0);
|
||||
gtk_signal_connect (GTK_OBJECT (default_size_sizeentry), "unit_changed",
|
||||
(GtkSignalFunc)file_prefs_default_size_callback, NULL);
|
||||
gtk_signal_connect (GTK_OBJECT (default_size_sizeentry), "value_changed",
|
||||
(GtkSignalFunc)file_prefs_default_size_callback, NULL);
|
||||
gtk_signal_connect (GTK_OBJECT (default_size_sizeentry), "refval_changed",
|
||||
(GtkSignalFunc)file_prefs_default_size_callback, NULL);
|
||||
gtk_box_pack_start (GTK_BOX (hbox), default_size_sizeentry, FALSE, FALSE, 0);
|
||||
gtk_widget_show (default_size_sizeentry);
|
||||
|
||||
gimp_size_entry_set_resolution (GIMP_SIZE_ENTRY (sizeentry),
|
||||
0, default_xresolution, FALSE);
|
||||
gimp_size_entry_set_resolution (GIMP_SIZE_ENTRY (sizeentry),
|
||||
1, default_yresolution, FALSE);
|
||||
|
||||
gimp_size_entry_set_refval_boundaries
|
||||
(GIMP_SIZE_ENTRY (sizeentry), 0, GIMP_MIN_IMAGE_SIZE, GIMP_MAX_IMAGE_SIZE);
|
||||
gimp_size_entry_set_refval_boundaries
|
||||
(GIMP_SIZE_ENTRY (sizeentry), 1, GIMP_MIN_IMAGE_SIZE, GIMP_MAX_IMAGE_SIZE);
|
||||
|
||||
gimp_size_entry_set_refval (GIMP_SIZE_ENTRY (sizeentry), 0, default_width);
|
||||
gimp_size_entry_set_refval (GIMP_SIZE_ENTRY (sizeentry), 1, default_height);
|
||||
|
||||
gtk_signal_connect (GTK_OBJECT (sizeentry), "unit_changed",
|
||||
(GtkSignalFunc) file_prefs_default_size_callback, NULL);
|
||||
gtk_signal_connect (GTK_OBJECT (sizeentry), "value_changed",
|
||||
(GtkSignalFunc) file_prefs_default_size_callback, NULL);
|
||||
gtk_signal_connect (GTK_OBJECT (sizeentry), "refval_changed",
|
||||
(GtkSignalFunc) file_prefs_default_size_callback, NULL);
|
||||
|
||||
gtk_box_pack_start (GTK_BOX (hbox), sizeentry, FALSE, FALSE, 0);
|
||||
gtk_widget_show (sizeentry);
|
||||
|
||||
frame = gtk_frame_new (_("Default Image Resolution and Resolution Unit"));
|
||||
gtk_box_pack_start (GTK_BOX (vbox), frame, FALSE, FALSE, 0);
|
||||
|
|
@ -1561,49 +1538,49 @@ file_pref_cmd_callback (GtkWidget *widget,
|
|||
gtk_container_add (GTK_CONTAINER (frame), hbox);
|
||||
gtk_widget_show (hbox);
|
||||
|
||||
button = gimp_chain_button_new (GIMP_CHAIN_BOTTOM);
|
||||
default_resolution_sizeentry =
|
||||
sizeentry2 =
|
||||
gimp_size_entry_new (2, default_resolution_units, "Pixels/%s",
|
||||
FALSE, FALSE, TRUE, 75,
|
||||
GIMP_SIZE_ENTRY_UPDATE_RESOLUTION);
|
||||
gimp_size_entry_set_refval_boundaries
|
||||
(GIMP_SIZE_ENTRY (default_resolution_sizeentry), 0,
|
||||
GIMP_MIN_RESOLUTION, GIMP_MAX_RESOLUTION);
|
||||
gimp_size_entry_set_refval_boundaries
|
||||
(GIMP_SIZE_ENTRY (default_resolution_sizeentry), 1,
|
||||
GIMP_MIN_RESOLUTION, GIMP_MAX_RESOLUTION);
|
||||
gimp_size_entry_set_refval (GIMP_SIZE_ENTRY (default_resolution_sizeentry),
|
||||
0, default_xresolution);
|
||||
gimp_size_entry_set_refval (GIMP_SIZE_ENTRY (default_resolution_sizeentry),
|
||||
1, default_yresolution);
|
||||
gimp_size_entry_attach_label (GIMP_SIZE_ENTRY (default_resolution_sizeentry),
|
||||
_("Horizontal"), 0, 1, 0.0);
|
||||
gimp_size_entry_attach_label (GIMP_SIZE_ENTRY (default_resolution_sizeentry),
|
||||
_("Vertical"), 0, 2, 0.0);
|
||||
gimp_size_entry_attach_label (GIMP_SIZE_ENTRY (default_resolution_sizeentry),
|
||||
_("dpi"), 1, 4, 0.0);
|
||||
gtk_signal_connect (GTK_OBJECT (default_resolution_sizeentry),
|
||||
"unit_changed",
|
||||
(GtkSignalFunc)file_prefs_default_resolution_callback,
|
||||
button);
|
||||
gtk_signal_connect (GTK_OBJECT (default_resolution_sizeentry),
|
||||
"value_changed",
|
||||
(GtkSignalFunc)file_prefs_default_resolution_callback,
|
||||
button);
|
||||
gtk_signal_connect (GTK_OBJECT (default_resolution_sizeentry),
|
||||
"refval_changed",
|
||||
(GtkSignalFunc)file_prefs_default_resolution_callback,
|
||||
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),
|
||||
button, 1, 3, 3, 4);
|
||||
button = gimp_chain_button_new (GIMP_CHAIN_BOTTOM);
|
||||
if (ABS (default_xresolution - default_yresolution) < GIMP_MIN_RESOLUTION)
|
||||
gimp_chain_button_set_active (GIMP_CHAIN_BUTTON (button), TRUE);
|
||||
gtk_table_attach_defaults (GTK_TABLE (sizeentry2), button, 1, 3, 3, 4);
|
||||
gtk_widget_show (button);
|
||||
|
||||
gimp_size_entry_attach_label (GIMP_SIZE_ENTRY (sizeentry2),
|
||||
_("Horizontal"), 0, 1, 0.0);
|
||||
gimp_size_entry_attach_label (GIMP_SIZE_ENTRY (sizeentry2),
|
||||
_("Vertical"), 0, 2, 0.0);
|
||||
gimp_size_entry_attach_label (GIMP_SIZE_ENTRY (sizeentry2),
|
||||
_("dpi"), 1, 4, 0.0);
|
||||
|
||||
gtk_object_set_data (GTK_OBJECT (sizeentry2), "size_sizeentry", sizeentry);
|
||||
|
||||
gimp_size_entry_set_refval_boundaries
|
||||
(GIMP_SIZE_ENTRY (sizeentry2), 0, GIMP_MIN_RESOLUTION, GIMP_MAX_RESOLUTION);
|
||||
gimp_size_entry_set_refval_boundaries
|
||||
(GIMP_SIZE_ENTRY (sizeentry2), 1, GIMP_MIN_RESOLUTION, GIMP_MAX_RESOLUTION);
|
||||
|
||||
gimp_size_entry_set_refval (GIMP_SIZE_ENTRY (sizeentry2),
|
||||
0, default_xresolution);
|
||||
gimp_size_entry_set_refval (GIMP_SIZE_ENTRY (sizeentry2),
|
||||
1, default_yresolution);
|
||||
|
||||
gtk_signal_connect (GTK_OBJECT (sizeentry2), "unit_changed",
|
||||
(GtkSignalFunc) file_prefs_default_resolution_callback,
|
||||
button);
|
||||
gtk_signal_connect (GTK_OBJECT (sizeentry2), "value_changed",
|
||||
(GtkSignalFunc) file_prefs_default_resolution_callback,
|
||||
button);
|
||||
gtk_signal_connect (GTK_OBJECT (sizeentry2), "refval_changed",
|
||||
(GtkSignalFunc) file_prefs_default_resolution_callback,
|
||||
button);
|
||||
|
||||
gtk_box_pack_start (GTK_BOX (hbox), sizeentry2, FALSE, FALSE, 0);
|
||||
gtk_widget_show (sizeentry2);
|
||||
|
||||
hbox = gtk_hbox_new (FALSE, 2);
|
||||
gtk_box_pack_start (GTK_BOX (vbox), hbox, FALSE, FALSE, 0);
|
||||
gtk_widget_show (hbox);
|
||||
|
|
@ -1998,15 +1975,23 @@ file_pref_cmd_callback (GtkWidget *widget,
|
|||
gtk_widget_show (table);
|
||||
|
||||
/* The tile cache size */
|
||||
mem_size_unit = 1;
|
||||
for (i = 0; i < 3; i++)
|
||||
{
|
||||
if (edit_tile_cache_size % (mem_size_unit * 1024) != 0)
|
||||
break;
|
||||
mem_size_unit *= 1024;
|
||||
}
|
||||
divided_mem_size = edit_tile_cache_size / mem_size_unit;
|
||||
|
||||
hbox = gtk_hbox_new (FALSE, 2);
|
||||
spinbutton =
|
||||
gimp_spin_button_new (&adjustment,
|
||||
divided_tile_cache_size,
|
||||
gimp_spin_button_new (&adjustment, divided_mem_size,
|
||||
0.0, (4069.0 * 1024 * 1024), 1.0, 16.0, 0.0,
|
||||
1.0, 0.0);
|
||||
gtk_signal_connect (GTK_OBJECT (adjustment), "value_changed",
|
||||
(GtkSignalFunc) file_prefs_mem_size_callback,
|
||||
÷d_tile_cache_size);
|
||||
&edit_tile_cache_size);
|
||||
gtk_box_pack_start (GTK_BOX (hbox), spinbutton, FALSE, FALSE, 0);
|
||||
gtk_widget_show (spinbutton);
|
||||
|
||||
|
|
@ -2014,13 +1999,13 @@ file_pref_cmd_callback (GtkWidget *widget,
|
|||
gtk_object_set_data (GTK_OBJECT (adjustment), "mem_size",
|
||||
&edit_tile_cache_size);
|
||||
gtk_object_set_data (GTK_OBJECT (adjustment), "divided_mem_size",
|
||||
÷d_tile_cache_size);
|
||||
(gpointer) divided_mem_size);
|
||||
gtk_object_set_data (GTK_OBJECT (adjustment), "mem_size_unit",
|
||||
&tile_cache_size_unit);
|
||||
(gpointer) mem_size_unit);
|
||||
|
||||
optionmenu =
|
||||
gimp_option_menu_new (file_prefs_mem_size_unit_callback,
|
||||
(gpointer) tile_cache_size_unit,
|
||||
(gpointer) mem_size_unit,
|
||||
_("Bytes"), adjustment, (gpointer) 1,
|
||||
_("KiloBytes"), adjustment, (gpointer) 1024,
|
||||
_("MegaBytes"), adjustment, (gpointer) (1024*1024),
|
||||
|
|
@ -2031,15 +2016,23 @@ file_pref_cmd_callback (GtkWidget *widget,
|
|||
_("Tile Cache Size:"), 1.0, 0.5, hbox, TRUE);
|
||||
|
||||
/* The maximum size of a new image */
|
||||
mem_size_unit = 1;
|
||||
for (i = 0; i < 3; i++)
|
||||
{
|
||||
if (max_new_image_size % (mem_size_unit * 1024) != 0)
|
||||
break;
|
||||
mem_size_unit *= 1024;
|
||||
}
|
||||
divided_mem_size = max_new_image_size / mem_size_unit;
|
||||
|
||||
hbox = gtk_hbox_new (FALSE, 2);
|
||||
spinbutton =
|
||||
gimp_spin_button_new (&adjustment,
|
||||
divided_max_new_image_size,
|
||||
gimp_spin_button_new (&adjustment, divided_mem_size,
|
||||
0.0, (4069.0 * 1024 * 1024), 1.0, 16.0, 0.0,
|
||||
1.0, 0.0);
|
||||
gtk_signal_connect (GTK_OBJECT (adjustment), "value_changed",
|
||||
(GtkSignalFunc) file_prefs_mem_size_callback,
|
||||
÷d_max_new_image_size);
|
||||
&max_new_image_size);
|
||||
gtk_box_pack_start (GTK_BOX (hbox), spinbutton, FALSE, FALSE, 0);
|
||||
gtk_widget_show (spinbutton);
|
||||
|
||||
|
|
@ -2047,13 +2040,13 @@ file_pref_cmd_callback (GtkWidget *widget,
|
|||
gtk_object_set_data (GTK_OBJECT (adjustment), "mem_size",
|
||||
&max_new_image_size);
|
||||
gtk_object_set_data (GTK_OBJECT (adjustment), "divided_mem_size",
|
||||
÷d_max_new_image_size);
|
||||
(gpointer) divided_mem_size);
|
||||
gtk_object_set_data (GTK_OBJECT (adjustment), "mem_size_unit",
|
||||
&max_new_image_size_unit);
|
||||
(gpointer) mem_size_unit);
|
||||
|
||||
optionmenu =
|
||||
gimp_option_menu_new (file_prefs_mem_size_unit_callback,
|
||||
(gpointer) max_new_image_size_unit,
|
||||
(gpointer) mem_size_unit,
|
||||
_("Bytes"), adjustment, (gpointer) 1,
|
||||
_("KiloBytes"), adjustment, (gpointer) 1024,
|
||||
_("MegaBytes"), adjustment, (gpointer) (1024*1024),
|
||||
|
|
@ -2192,15 +2185,6 @@ file_pref_cmd_callback (GtkWidget *widget,
|
|||
gtk_container_add (GTK_CONTAINER (frame), vbox2);
|
||||
gtk_widget_show (vbox2);
|
||||
|
||||
group = NULL;
|
||||
button = gtk_radio_button_new_with_label (group, _("From X Server"));
|
||||
group = gtk_radio_button_group (GTK_RADIO_BUTTON (button));
|
||||
gtk_signal_connect (GTK_OBJECT (button), "toggled",
|
||||
GTK_SIGNAL_FUNC (file_prefs_res_source_callback),
|
||||
NULL);
|
||||
gtk_box_pack_start (GTK_BOX (vbox2), button, FALSE, FALSE, 0);
|
||||
gtk_widget_show (button);
|
||||
|
||||
{
|
||||
gdouble xres, yres;
|
||||
gchar buf[80];
|
||||
|
|
@ -2209,62 +2193,76 @@ file_pref_cmd_callback (GtkWidget *widget,
|
|||
|
||||
g_snprintf (buf, sizeof (buf), _("(Currently %d x %d dpi)"),
|
||||
(int) (xres + 0.5), (int) (yres + 0.5));
|
||||
resolution_xserver_label = gtk_label_new (buf);
|
||||
gtk_box_pack_start (GTK_BOX (vbox2), resolution_xserver_label,
|
||||
FALSE, FALSE, 0);
|
||||
gtk_widget_show (resolution_xserver_label);
|
||||
label = gtk_label_new (buf);
|
||||
}
|
||||
|
||||
abox = gtk_alignment_new (0.5, 0.5, 0.0, 0.0);
|
||||
|
||||
sizeentry =
|
||||
gimp_size_entry_new (2, UNIT_INCH, "Pixels/%s", FALSE, FALSE, TRUE, 75,
|
||||
GIMP_SIZE_ENTRY_UPDATE_RESOLUTION);
|
||||
|
||||
button = gimp_chain_button_new (GIMP_CHAIN_BOTTOM);
|
||||
if (ABS (monitor_xres - monitor_yres) < GIMP_MIN_RESOLUTION)
|
||||
gimp_chain_button_set_active (GIMP_CHAIN_BUTTON (button), TRUE);
|
||||
gtk_table_attach_defaults (GTK_TABLE (sizeentry), button, 1, 3, 3, 4);
|
||||
gtk_widget_show (button);
|
||||
|
||||
gimp_size_entry_attach_label (GIMP_SIZE_ENTRY (sizeentry),
|
||||
_("Horizontal"), 0, 1, 0.0);
|
||||
gimp_size_entry_attach_label (GIMP_SIZE_ENTRY (sizeentry),
|
||||
_("Vertical"), 0, 2, 0.0);
|
||||
gimp_size_entry_attach_label (GIMP_SIZE_ENTRY (sizeentry),
|
||||
_("dpi"), 1, 4, 0.0);
|
||||
|
||||
gimp_size_entry_set_refval_boundaries (GIMP_SIZE_ENTRY (sizeentry), 0,
|
||||
GIMP_MIN_RESOLUTION,
|
||||
GIMP_MAX_RESOLUTION);
|
||||
gimp_size_entry_set_refval_boundaries (GIMP_SIZE_ENTRY (sizeentry), 1,
|
||||
GIMP_MIN_RESOLUTION,
|
||||
GIMP_MAX_RESOLUTION);
|
||||
|
||||
gimp_size_entry_set_refval (GIMP_SIZE_ENTRY (sizeentry), 0, monitor_xres);
|
||||
gimp_size_entry_set_refval (GIMP_SIZE_ENTRY (sizeentry), 1, monitor_yres);
|
||||
|
||||
gtk_signal_connect (GTK_OBJECT (sizeentry), "value_changed",
|
||||
(GtkSignalFunc) file_prefs_monitor_resolution_callback,
|
||||
button);
|
||||
gtk_signal_connect (GTK_OBJECT (sizeentry), "refval_changed",
|
||||
(GtkSignalFunc) file_prefs_monitor_resolution_callback,
|
||||
button);
|
||||
|
||||
gtk_container_add (GTK_CONTAINER (abox), sizeentry);
|
||||
gtk_widget_show (sizeentry);
|
||||
|
||||
gtk_widget_set_sensitive (sizeentry, !using_xserver_resolution);
|
||||
|
||||
group = NULL;
|
||||
button = gtk_radio_button_new_with_label (group, _("From X Server"));
|
||||
group = gtk_radio_button_group (GTK_RADIO_BUTTON (button));
|
||||
gtk_signal_connect (GTK_OBJECT (button), "toggled",
|
||||
GTK_SIGNAL_FUNC (file_prefs_res_source_callback),
|
||||
NULL);
|
||||
gtk_object_set_data (GTK_OBJECT (button), "resolution_xserver_label",
|
||||
label);
|
||||
gtk_object_set_data (GTK_OBJECT (button), "monitor_resolution_sizeentry",
|
||||
sizeentry);
|
||||
gtk_box_pack_start (GTK_BOX (vbox2), button, FALSE, FALSE, 0);
|
||||
gtk_widget_show (button);
|
||||
|
||||
gtk_box_pack_start (GTK_BOX (vbox2), label, FALSE, FALSE, 0);
|
||||
gtk_widget_show (label);
|
||||
|
||||
button = gtk_radio_button_new_with_label (group, _("Manually:"));
|
||||
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)
|
||||
gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (button), TRUE);
|
||||
|
||||
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);
|
||||
|
||||
button = gimp_chain_button_new (GIMP_CHAIN_BOTTOM);
|
||||
monitor_resolution_sizeentry =
|
||||
gimp_size_entry_new (2, UNIT_INCH, "Pixels/%s", FALSE, FALSE, TRUE, 75,
|
||||
GIMP_SIZE_ENTRY_UPDATE_RESOLUTION);
|
||||
gimp_size_entry_set_refval_boundaries
|
||||
(GIMP_SIZE_ENTRY (monitor_resolution_sizeentry), 0,
|
||||
GIMP_MIN_RESOLUTION, GIMP_MAX_RESOLUTION);
|
||||
gimp_size_entry_set_refval_boundaries
|
||||
(GIMP_SIZE_ENTRY (monitor_resolution_sizeentry), 1,
|
||||
GIMP_MIN_RESOLUTION, GIMP_MAX_RESOLUTION);
|
||||
gimp_size_entry_set_refval (GIMP_SIZE_ENTRY (monitor_resolution_sizeentry),
|
||||
0, monitor_xres);
|
||||
gimp_size_entry_set_refval (GIMP_SIZE_ENTRY (monitor_resolution_sizeentry),
|
||||
1, monitor_yres);
|
||||
gimp_size_entry_attach_label (GIMP_SIZE_ENTRY (monitor_resolution_sizeentry),
|
||||
_("Horizontal"), 0, 1, 0.0);
|
||||
gimp_size_entry_attach_label (GIMP_SIZE_ENTRY (monitor_resolution_sizeentry),
|
||||
_("Vertical"), 0, 2, 0.0);
|
||||
gimp_size_entry_attach_label (GIMP_SIZE_ENTRY (monitor_resolution_sizeentry),
|
||||
_("dpi"), 1, 4, 0.0);
|
||||
gtk_signal_connect (GTK_OBJECT (monitor_resolution_sizeentry),
|
||||
"value_changed",
|
||||
(GtkSignalFunc)file_prefs_monitor_resolution_callback,
|
||||
button);
|
||||
gtk_signal_connect (GTK_OBJECT (monitor_resolution_sizeentry),
|
||||
"refval_changed",
|
||||
(GtkSignalFunc)file_prefs_monitor_resolution_callback,
|
||||
button);
|
||||
gtk_container_add (GTK_CONTAINER (abox), monitor_resolution_sizeentry);
|
||||
gtk_widget_show (monitor_resolution_sizeentry);
|
||||
|
||||
if (ABS (monitor_xres - monitor_yres) < GIMP_MIN_RESOLUTION)
|
||||
gimp_chain_button_set_active (GIMP_CHAIN_BUTTON (button), TRUE);
|
||||
gtk_table_attach_defaults (GTK_TABLE (monitor_resolution_sizeentry),
|
||||
button, 1, 3, 3, 4);
|
||||
gtk_widget_show (button);
|
||||
|
||||
gtk_widget_set_sensitive (monitor_resolution_sizeentry,
|
||||
!using_xserver_resolution);
|
||||
if (!using_xserver_resolution)
|
||||
gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (button), TRUE);
|
||||
|
||||
/* Directories */
|
||||
vbox = file_prefs_notebook_append_page (GTK_NOTEBOOK (notebook),
|
||||
|
|
|
|||
|
|
@ -56,22 +56,22 @@ struct _ResizePrivate
|
|||
GtkObject *object;
|
||||
guint object_destroy_handler;
|
||||
|
||||
double ratio;
|
||||
int old_width, old_height;
|
||||
double old_res_x, old_res_y;
|
||||
int area_width, area_height;
|
||||
int start_x, start_y;
|
||||
int orig_x, orig_y;
|
||||
gdouble ratio;
|
||||
gint old_width, old_height;
|
||||
gdouble old_res_x, old_res_y;
|
||||
gint area_width, area_height;
|
||||
gint start_x, start_y;
|
||||
gint orig_x, orig_y;
|
||||
};
|
||||
|
||||
static void resize_draw (Resize *);
|
||||
static void unit_update (GtkWidget *w, gpointer data);
|
||||
static int resize_bound_off_x (Resize *, int);
|
||||
static int resize_bound_off_y (Resize *, int);
|
||||
static gint resize_bound_off_x (Resize *, gint);
|
||||
static gint resize_bound_off_y (Resize *, gint);
|
||||
static void orig_labels_update (GtkWidget *w, gpointer data);
|
||||
static void size_callback (GtkWidget *w, gpointer data);
|
||||
static void ratio_callback (GtkWidget *w, gpointer data);
|
||||
static void size_update (Resize *, double, double, double, double);
|
||||
static void size_update (Resize *, gdouble, gdouble, gdouble, gdouble);
|
||||
static void offset_update (GtkWidget *w, gpointer data);
|
||||
static gint resize_events (GtkWidget *area, GdkEvent *event);
|
||||
static void printsize_update (GtkWidget *w, gpointer data);
|
||||
|
|
@ -109,7 +109,7 @@ resize_widget_new (ResizeType type,
|
|||
GtkWidget *alignment;
|
||||
GtkObject *adjustment;
|
||||
|
||||
static ActionAreaItem action_items[2] =
|
||||
static ActionAreaItem action_items[] =
|
||||
{
|
||||
{ N_("OK"), NULL, NULL, NULL },
|
||||
{ N_("Cancel"), NULL, NULL, NULL }
|
||||
|
|
@ -196,13 +196,14 @@ resize_widget_new (ResizeType type,
|
|||
|
||||
/* handle the image disappearing under our feet */
|
||||
if (object)
|
||||
{
|
||||
const char *signame;
|
||||
signame = (target == ResizeLayer) ? "removed" : "destroy";
|
||||
private->object = object;
|
||||
private->object_destroy_handler =
|
||||
gtk_signal_connect(GTK_OBJECT (object), signame, cancel_cb, user_data);
|
||||
}
|
||||
{
|
||||
const gchar *signame;
|
||||
|
||||
signame = (target == ResizeLayer) ? "removed" : "destroy";
|
||||
private->object = object;
|
||||
private->object_destroy_handler =
|
||||
gtk_signal_connect(GTK_OBJECT (object), signame, cancel_cb, user_data);
|
||||
}
|
||||
|
||||
/* the action area */
|
||||
action_items[0].user_data = user_data;
|
||||
|
|
@ -292,6 +293,9 @@ resize_widget_new (ResizeType type,
|
|||
GTK_SHRINK | GTK_FILL, GTK_SHRINK | GTK_FILL, 0, 0);
|
||||
gtk_widget_show (private->size_se);
|
||||
|
||||
if (dot_for_dot)
|
||||
gimp_size_entry_set_unit (GIMP_SIZE_ENTRY (private->size_se), UNIT_PIXEL);
|
||||
|
||||
gimp_size_entry_set_resolution (GIMP_SIZE_ENTRY (private->size_se), 0,
|
||||
resolution_x, FALSE);
|
||||
gimp_size_entry_set_resolution (GIMP_SIZE_ENTRY (private->size_se), 1,
|
||||
|
|
@ -310,9 +314,6 @@ resize_widget_new (ResizeType type,
|
|||
gimp_size_entry_set_refval (GIMP_SIZE_ENTRY (private->size_se), 0, width);
|
||||
gimp_size_entry_set_refval (GIMP_SIZE_ENTRY (private->size_se), 1, height);
|
||||
|
||||
if (dot_for_dot)
|
||||
gimp_size_entry_set_unit (GIMP_SIZE_ENTRY (private->size_se), UNIT_PIXEL);
|
||||
|
||||
gtk_signal_connect (GTK_OBJECT (private->size_se), "value_changed",
|
||||
(GtkSignalFunc) size_callback,
|
||||
resize);
|
||||
|
|
@ -441,6 +442,10 @@ resize_widget_new (ResizeType type,
|
|||
GTK_SHRINK | GTK_FILL, GTK_SHRINK | GTK_FILL, 0, 0);
|
||||
gtk_widget_show (private->offset_se);
|
||||
|
||||
if (dot_for_dot)
|
||||
gimp_size_entry_set_unit (GIMP_SIZE_ENTRY (private->offset_se),
|
||||
UNIT_PIXEL);
|
||||
|
||||
gimp_size_entry_set_resolution (GIMP_SIZE_ENTRY (private->offset_se), 0,
|
||||
resolution_x, FALSE);
|
||||
gimp_size_entry_set_resolution (GIMP_SIZE_ENTRY (private->offset_se), 1,
|
||||
|
|
@ -454,13 +459,8 @@ resize_widget_new (ResizeType type,
|
|||
gimp_size_entry_set_refval (GIMP_SIZE_ENTRY (private->offset_se), 0, 0);
|
||||
gimp_size_entry_set_refval (GIMP_SIZE_ENTRY (private->offset_se), 1, 0);
|
||||
|
||||
if (dot_for_dot)
|
||||
gimp_size_entry_set_unit (GIMP_SIZE_ENTRY (private->offset_se),
|
||||
UNIT_PIXEL);
|
||||
|
||||
gtk_signal_connect (GTK_OBJECT (private->offset_se),
|
||||
"value_changed", (GtkSignalFunc) offset_update,
|
||||
resize);
|
||||
gtk_signal_connect (GTK_OBJECT (private->offset_se), "value_changed",
|
||||
(GtkSignalFunc) offset_update, resize);
|
||||
|
||||
gtk_widget_show (table);
|
||||
|
||||
|
|
@ -746,9 +746,9 @@ resize_draw (Resize *resize)
|
|||
}
|
||||
}
|
||||
|
||||
static int
|
||||
static gint
|
||||
resize_bound_off_x (Resize *resize,
|
||||
int off_x)
|
||||
gint off_x)
|
||||
{
|
||||
ResizePrivate *private;
|
||||
|
||||
|
|
@ -762,9 +762,9 @@ resize_bound_off_x (Resize *resize,
|
|||
return off_x;
|
||||
}
|
||||
|
||||
static int
|
||||
static gint
|
||||
resize_bound_off_y (Resize *resize,
|
||||
int off_y)
|
||||
gint off_y)
|
||||
{
|
||||
ResizePrivate *private;
|
||||
|
||||
|
|
@ -800,7 +800,7 @@ orig_labels_update (GtkWidget *w,
|
|||
|
||||
if (label_unit) /* unit != UNIT_PIXEL */
|
||||
{
|
||||
float unit_factor = gimp_unit_get_factor (label_unit);
|
||||
double unit_factor = gimp_unit_get_factor (label_unit);
|
||||
|
||||
g_snprintf (format_buf, 16, "%%.%df %s",
|
||||
gimp_unit_get_digits (label_unit) + 1,
|
||||
|
|
@ -837,18 +837,18 @@ offset_update (GtkWidget *w,
|
|||
{
|
||||
Resize *resize;
|
||||
ResizePrivate *private;
|
||||
int offset_x;
|
||||
int offset_y;
|
||||
gint offset_x;
|
||||
gint offset_y;
|
||||
|
||||
resize = (Resize *) data;
|
||||
private = (ResizePrivate *) resize->private_part;
|
||||
|
||||
offset_x =
|
||||
gimp_size_entry_get_refval (GIMP_SIZE_ENTRY (private->offset_se), 0);
|
||||
offset_x = (gint)
|
||||
(gimp_size_entry_get_refval (GIMP_SIZE_ENTRY (private->offset_se), 0) + 0.5);
|
||||
offset_x = resize_bound_off_x (resize, offset_x);
|
||||
|
||||
offset_y =
|
||||
gimp_size_entry_get_refval (GIMP_SIZE_ENTRY (private->offset_se), 1);
|
||||
offset_y = (gint)
|
||||
(gimp_size_entry_get_refval (GIMP_SIZE_ENTRY (private->offset_se), 1) + 0.5);
|
||||
offset_y = resize_bound_off_y (resize, offset_y);
|
||||
|
||||
if ((offset_x != resize->offset_x) ||
|
||||
|
|
@ -882,8 +882,6 @@ size_callback (GtkWidget *w,
|
|||
|
||||
if (gimp_chain_button_get_active (GIMP_CHAIN_BUTTON (private->constrain)))
|
||||
{
|
||||
/* compare ratios, not sizes because we need float values
|
||||
*/
|
||||
if (ratio_x != resize->ratio_x)
|
||||
{
|
||||
ratio_y = ratio_x;
|
||||
|
|
@ -911,7 +909,7 @@ ratio_callback (GtkWidget *w,
|
|||
double height;
|
||||
double ratio_x;
|
||||
double ratio_y;
|
||||
|
||||
|
||||
resize = (Resize *) data;
|
||||
private = (ResizePrivate *) resize->private_part;
|
||||
|
||||
|
|
@ -952,8 +950,8 @@ size_update (Resize *resize,
|
|||
|
||||
private = (ResizePrivate *) resize->private_part;
|
||||
|
||||
resize->width = width;
|
||||
resize->height = height;
|
||||
resize->width = (gint) (width + 0.5);
|
||||
resize->height = (gint) (height + 0.5);
|
||||
|
||||
resize->ratio_x = ratio_x;
|
||||
resize->ratio_y = ratio_y;
|
||||
|
|
|
|||
|
|
@ -42,21 +42,21 @@ struct _Resize
|
|||
ResizeType type;
|
||||
ResizeTarget target;
|
||||
|
||||
int width;
|
||||
int height;
|
||||
gint width;
|
||||
gint height;
|
||||
|
||||
double resolution_x;
|
||||
double resolution_y;
|
||||
gdouble resolution_x;
|
||||
gdouble resolution_y;
|
||||
GUnit unit;
|
||||
|
||||
double ratio_x;
|
||||
double ratio_y;
|
||||
gdouble ratio_x;
|
||||
gdouble ratio_y;
|
||||
|
||||
int offset_x;
|
||||
int offset_y;
|
||||
gint offset_x;
|
||||
gint offset_y;
|
||||
|
||||
/* Don't touch this :) */
|
||||
void * private_part;
|
||||
void * private_part;
|
||||
};
|
||||
|
||||
/* If resolution_x is zero, then don't show resolution modification
|
||||
|
|
|
|||
|
|
@ -615,9 +615,9 @@ create_display_shell (GDisplay* gdisp,
|
|||
gdisp);
|
||||
|
||||
/* the vbox, table containing all widgets */
|
||||
vbox = gtk_vbox_new(0,2);
|
||||
gtk_container_add(GTK_CONTAINER (gdisp->shell), vbox);
|
||||
gtk_container_set_border_width(GTK_CONTAINER (vbox), 2);
|
||||
vbox = gtk_vbox_new (FALSE, 2);
|
||||
gtk_container_add (GTK_CONTAINER (gdisp->shell), vbox);
|
||||
gtk_container_set_border_width (GTK_CONTAINER (vbox), 2);
|
||||
|
||||
/* the table widget is pretty stupid so we need 2 tables
|
||||
or it treats rulers and canvas with equal weight when
|
||||
|
|
@ -633,8 +633,8 @@ create_display_shell (GDisplay* gdisp,
|
|||
|
||||
|
||||
/* hbox for statusbar area */
|
||||
gdisp->statusarea = gtk_hbox_new(0,2);
|
||||
gtk_box_pack_start(GTK_BOX (vbox), gdisp->statusarea, FALSE, TRUE, 0);
|
||||
gdisp->statusarea = gtk_hbox_new (FALSE, 2);
|
||||
gtk_box_pack_start (GTK_BOX (vbox), gdisp->statusarea, FALSE, TRUE, 0);
|
||||
|
||||
/* scrollbars, rulers, canvas, menu popup button */
|
||||
gdisp->origin = gtk_button_new ();
|
||||
|
|
@ -815,9 +815,7 @@ static void int_query_box_ok_callback (GtkWidget *, gpointer);
|
|||
static void double_query_box_ok_callback (GtkWidget *, gpointer);
|
||||
static void size_query_box_ok_callback (GtkWidget *, gpointer);
|
||||
|
||||
/* create a generic query box without any entry widget
|
||||
*/
|
||||
|
||||
/* create a generic query box without any entry widget */
|
||||
QueryBox *
|
||||
create_query_box (gchar *title,
|
||||
gchar *message,
|
||||
|
|
@ -847,8 +845,7 @@ create_query_box (gchar *title,
|
|||
(GtkSignalFunc) query_box_delete_callback,
|
||||
query_box);
|
||||
|
||||
/* if we are associated with an object, connect to the provided signal
|
||||
*/
|
||||
/* if we are associated with an object, connect to the provided signal */
|
||||
if (object && GTK_IS_OBJECT (object) && signal)
|
||||
gtk_signal_connect (GTK_OBJECT (object), signal,
|
||||
(GtkSignalFunc) query_box_cancel_callback,
|
||||
|
|
@ -865,7 +862,7 @@ create_query_box (gchar *title,
|
|||
gtk_container_add (GTK_CONTAINER (GTK_DIALOG (qbox)->vbox), vbox);
|
||||
gtk_widget_show (vbox);
|
||||
|
||||
label = gtk_label_new (gettext(message));
|
||||
label = gtk_label_new (gettext (message));
|
||||
gtk_box_pack_start (GTK_BOX (vbox), label, TRUE, FALSE, 0);
|
||||
gtk_widget_show (label);
|
||||
|
||||
|
|
@ -901,7 +898,7 @@ query_string_box (gchar *title,
|
|||
entry = gtk_entry_new ();
|
||||
gtk_box_pack_start (GTK_BOX (query_box->vbox), entry, TRUE, TRUE, 0);
|
||||
if (initial)
|
||||
gtk_entry_set_text (GTK_ENTRY (entry), gettext(initial));
|
||||
gtk_entry_set_text (GTK_ENTRY (entry), gettext (initial));
|
||||
gtk_widget_grab_focus (entry);
|
||||
gtk_widget_show (entry);
|
||||
|
||||
|
|
@ -932,9 +929,8 @@ query_int_box (gchar *title,
|
|||
gtk_signal_connect (GTK_OBJECT (query_box->ok_button), "clicked",
|
||||
(GtkSignalFunc) int_query_box_ok_callback,
|
||||
query_box);
|
||||
|
||||
adjustment = GTK_ADJUSTMENT (gtk_adjustment_new (initial, lower, upper,
|
||||
1, 10, 0));
|
||||
adjustment =
|
||||
GTK_ADJUSTMENT (gtk_adjustment_new (initial, lower, upper, 1, 10, 0));
|
||||
spinbutton = gtk_spin_button_new (adjustment, 1.0, 0);
|
||||
gtk_box_pack_start (GTK_BOX (query_box->vbox), spinbutton, TRUE, TRUE, 0);
|
||||
gtk_widget_grab_focus (spinbutton);
|
||||
|
|
@ -948,16 +944,16 @@ query_int_box (gchar *title,
|
|||
}
|
||||
|
||||
GtkWidget *
|
||||
query_double_box (gchar *title,
|
||||
gchar *message,
|
||||
gdouble initial,
|
||||
gdouble lower,
|
||||
gdouble upper,
|
||||
gint digits,
|
||||
GtkObject *object,
|
||||
gchar *signal,
|
||||
QueryFunc callback,
|
||||
gpointer data)
|
||||
query_double_box (gchar *title,
|
||||
gchar *message,
|
||||
gdouble initial,
|
||||
gdouble lower,
|
||||
gdouble upper,
|
||||
gint digits,
|
||||
GtkObject *object,
|
||||
gchar *signal,
|
||||
QueryFunc callback,
|
||||
gpointer data)
|
||||
{
|
||||
QueryBox *query_box;
|
||||
GtkAdjustment* adjustment;
|
||||
|
|
@ -968,9 +964,8 @@ query_double_box (gchar *title,
|
|||
gtk_signal_connect (GTK_OBJECT (query_box->ok_button), "clicked",
|
||||
(GtkSignalFunc) double_query_box_ok_callback,
|
||||
query_box);
|
||||
|
||||
adjustment = GTK_ADJUSTMENT (gtk_adjustment_new (initial, lower, upper,
|
||||
1, 10, 0));
|
||||
adjustment =
|
||||
GTK_ADJUSTMENT (gtk_adjustment_new (initial, lower, upper, 1, 10, 0));
|
||||
spinbutton = gtk_spin_button_new (adjustment, 1.0, digits);
|
||||
gtk_box_pack_start (GTK_BOX (query_box->vbox), spinbutton, TRUE, TRUE, 0);
|
||||
gtk_widget_grab_focus (spinbutton);
|
||||
|
|
@ -984,19 +979,19 @@ query_double_box (gchar *title,
|
|||
}
|
||||
|
||||
GtkWidget *
|
||||
query_size_box (gchar *title,
|
||||
gchar *message,
|
||||
gdouble initial,
|
||||
gdouble lower,
|
||||
gdouble upper,
|
||||
gint digits,
|
||||
GUnit unit,
|
||||
gdouble resolution,
|
||||
gint dot_for_dot,
|
||||
GtkObject *object,
|
||||
gchar *signal,
|
||||
QueryFunc callback,
|
||||
gpointer data)
|
||||
query_size_box (gchar *title,
|
||||
gchar *message,
|
||||
gdouble initial,
|
||||
gdouble lower,
|
||||
gdouble upper,
|
||||
gint digits,
|
||||
GUnit unit,
|
||||
gdouble resolution,
|
||||
gint dot_for_dot,
|
||||
GtkObject *object,
|
||||
gchar *signal,
|
||||
QueryFunc callback,
|
||||
gpointer data)
|
||||
{
|
||||
QueryBox *query_box;
|
||||
GtkWidget *sizeentry;
|
||||
|
|
@ -1009,6 +1004,8 @@ query_size_box (gchar *title,
|
|||
|
||||
sizeentry = gimp_size_entry_new (1, unit, "%p", TRUE, FALSE, FALSE, 100,
|
||||
GIMP_SIZE_ENTRY_UPDATE_SIZE);
|
||||
if (dot_for_dot)
|
||||
gimp_size_entry_set_unit (GIMP_SIZE_ENTRY (sizeentry), UNIT_PIXEL);
|
||||
gimp_size_entry_set_resolution (GIMP_SIZE_ENTRY (sizeentry), 0,
|
||||
resolution, FALSE);
|
||||
gimp_size_entry_set_refval_digits (GIMP_SIZE_ENTRY (sizeentry), 0, digits);
|
||||
|
|
@ -1016,9 +1013,6 @@ query_size_box (gchar *title,
|
|||
lower, upper);
|
||||
gimp_size_entry_set_refval (GIMP_SIZE_ENTRY (sizeentry), 0, initial);
|
||||
|
||||
if (dot_for_dot)
|
||||
gimp_size_entry_set_unit (GIMP_SIZE_ENTRY (sizeentry), UNIT_PIXEL);
|
||||
|
||||
gtk_box_pack_start (GTK_BOX (query_box->vbox), sizeentry, TRUE, TRUE, 0);
|
||||
gimp_size_entry_grab_focus (GIMP_SIZE_ENTRY (sizeentry));
|
||||
gtk_widget_show (sizeentry);
|
||||
|
|
@ -1030,7 +1024,6 @@ query_size_box (gchar *title,
|
|||
return query_box->qbox;
|
||||
}
|
||||
|
||||
|
||||
static gint
|
||||
query_box_delete_callback (GtkWidget *w,
|
||||
GdkEvent *e,
|
||||
|
|
@ -1221,12 +1214,13 @@ message_box (char *message,
|
|||
gtk_signal_connect (GTK_OBJECT (button), "clicked",
|
||||
(GtkSignalFunc) message_box_close_callback,
|
||||
msg_box);
|
||||
gtk_box_pack_start (GTK_BOX (GTK_DIALOG (mbox)->action_area), button, TRUE, TRUE, 0);
|
||||
gtk_box_pack_start (GTK_BOX (GTK_DIALOG (mbox)->action_area), button,
|
||||
TRUE, TRUE, 0);
|
||||
gtk_widget_grab_default (button);
|
||||
gtk_widget_show (button);
|
||||
|
||||
vbox = gtk_vbox_new (FALSE, 1);
|
||||
gtk_container_set_border_width (GTK_CONTAINER (vbox), 1);
|
||||
vbox = gtk_vbox_new (FALSE, 0);
|
||||
gtk_container_set_border_width (GTK_CONTAINER (vbox), 2);
|
||||
gtk_container_add (GTK_CONTAINER (GTK_DIALOG (mbox)->vbox), vbox);
|
||||
gtk_widget_show (vbox);
|
||||
|
||||
|
|
@ -1274,7 +1268,6 @@ message_box_delete_callback (GtkWidget *w, GdkEvent *e, gpointer client_data)
|
|||
return TRUE;
|
||||
}
|
||||
|
||||
|
||||
static void
|
||||
message_box_close_callback (GtkWidget *w,
|
||||
gpointer client_data)
|
||||
|
|
|
|||
|
|
@ -615,9 +615,9 @@ create_display_shell (GDisplay* gdisp,
|
|||
gdisp);
|
||||
|
||||
/* the vbox, table containing all widgets */
|
||||
vbox = gtk_vbox_new(0,2);
|
||||
gtk_container_add(GTK_CONTAINER (gdisp->shell), vbox);
|
||||
gtk_container_set_border_width(GTK_CONTAINER (vbox), 2);
|
||||
vbox = gtk_vbox_new (FALSE, 2);
|
||||
gtk_container_add (GTK_CONTAINER (gdisp->shell), vbox);
|
||||
gtk_container_set_border_width (GTK_CONTAINER (vbox), 2);
|
||||
|
||||
/* the table widget is pretty stupid so we need 2 tables
|
||||
or it treats rulers and canvas with equal weight when
|
||||
|
|
@ -633,8 +633,8 @@ create_display_shell (GDisplay* gdisp,
|
|||
|
||||
|
||||
/* hbox for statusbar area */
|
||||
gdisp->statusarea = gtk_hbox_new(0,2);
|
||||
gtk_box_pack_start(GTK_BOX (vbox), gdisp->statusarea, FALSE, TRUE, 0);
|
||||
gdisp->statusarea = gtk_hbox_new (FALSE, 2);
|
||||
gtk_box_pack_start (GTK_BOX (vbox), gdisp->statusarea, FALSE, TRUE, 0);
|
||||
|
||||
/* scrollbars, rulers, canvas, menu popup button */
|
||||
gdisp->origin = gtk_button_new ();
|
||||
|
|
@ -815,9 +815,7 @@ static void int_query_box_ok_callback (GtkWidget *, gpointer);
|
|||
static void double_query_box_ok_callback (GtkWidget *, gpointer);
|
||||
static void size_query_box_ok_callback (GtkWidget *, gpointer);
|
||||
|
||||
/* create a generic query box without any entry widget
|
||||
*/
|
||||
|
||||
/* create a generic query box without any entry widget */
|
||||
QueryBox *
|
||||
create_query_box (gchar *title,
|
||||
gchar *message,
|
||||
|
|
@ -847,8 +845,7 @@ create_query_box (gchar *title,
|
|||
(GtkSignalFunc) query_box_delete_callback,
|
||||
query_box);
|
||||
|
||||
/* if we are associated with an object, connect to the provided signal
|
||||
*/
|
||||
/* if we are associated with an object, connect to the provided signal */
|
||||
if (object && GTK_IS_OBJECT (object) && signal)
|
||||
gtk_signal_connect (GTK_OBJECT (object), signal,
|
||||
(GtkSignalFunc) query_box_cancel_callback,
|
||||
|
|
@ -865,7 +862,7 @@ create_query_box (gchar *title,
|
|||
gtk_container_add (GTK_CONTAINER (GTK_DIALOG (qbox)->vbox), vbox);
|
||||
gtk_widget_show (vbox);
|
||||
|
||||
label = gtk_label_new (gettext(message));
|
||||
label = gtk_label_new (gettext (message));
|
||||
gtk_box_pack_start (GTK_BOX (vbox), label, TRUE, FALSE, 0);
|
||||
gtk_widget_show (label);
|
||||
|
||||
|
|
@ -901,7 +898,7 @@ query_string_box (gchar *title,
|
|||
entry = gtk_entry_new ();
|
||||
gtk_box_pack_start (GTK_BOX (query_box->vbox), entry, TRUE, TRUE, 0);
|
||||
if (initial)
|
||||
gtk_entry_set_text (GTK_ENTRY (entry), gettext(initial));
|
||||
gtk_entry_set_text (GTK_ENTRY (entry), gettext (initial));
|
||||
gtk_widget_grab_focus (entry);
|
||||
gtk_widget_show (entry);
|
||||
|
||||
|
|
@ -932,9 +929,8 @@ query_int_box (gchar *title,
|
|||
gtk_signal_connect (GTK_OBJECT (query_box->ok_button), "clicked",
|
||||
(GtkSignalFunc) int_query_box_ok_callback,
|
||||
query_box);
|
||||
|
||||
adjustment = GTK_ADJUSTMENT (gtk_adjustment_new (initial, lower, upper,
|
||||
1, 10, 0));
|
||||
adjustment =
|
||||
GTK_ADJUSTMENT (gtk_adjustment_new (initial, lower, upper, 1, 10, 0));
|
||||
spinbutton = gtk_spin_button_new (adjustment, 1.0, 0);
|
||||
gtk_box_pack_start (GTK_BOX (query_box->vbox), spinbutton, TRUE, TRUE, 0);
|
||||
gtk_widget_grab_focus (spinbutton);
|
||||
|
|
@ -948,16 +944,16 @@ query_int_box (gchar *title,
|
|||
}
|
||||
|
||||
GtkWidget *
|
||||
query_double_box (gchar *title,
|
||||
gchar *message,
|
||||
gdouble initial,
|
||||
gdouble lower,
|
||||
gdouble upper,
|
||||
gint digits,
|
||||
GtkObject *object,
|
||||
gchar *signal,
|
||||
QueryFunc callback,
|
||||
gpointer data)
|
||||
query_double_box (gchar *title,
|
||||
gchar *message,
|
||||
gdouble initial,
|
||||
gdouble lower,
|
||||
gdouble upper,
|
||||
gint digits,
|
||||
GtkObject *object,
|
||||
gchar *signal,
|
||||
QueryFunc callback,
|
||||
gpointer data)
|
||||
{
|
||||
QueryBox *query_box;
|
||||
GtkAdjustment* adjustment;
|
||||
|
|
@ -968,9 +964,8 @@ query_double_box (gchar *title,
|
|||
gtk_signal_connect (GTK_OBJECT (query_box->ok_button), "clicked",
|
||||
(GtkSignalFunc) double_query_box_ok_callback,
|
||||
query_box);
|
||||
|
||||
adjustment = GTK_ADJUSTMENT (gtk_adjustment_new (initial, lower, upper,
|
||||
1, 10, 0));
|
||||
adjustment =
|
||||
GTK_ADJUSTMENT (gtk_adjustment_new (initial, lower, upper, 1, 10, 0));
|
||||
spinbutton = gtk_spin_button_new (adjustment, 1.0, digits);
|
||||
gtk_box_pack_start (GTK_BOX (query_box->vbox), spinbutton, TRUE, TRUE, 0);
|
||||
gtk_widget_grab_focus (spinbutton);
|
||||
|
|
@ -984,19 +979,19 @@ query_double_box (gchar *title,
|
|||
}
|
||||
|
||||
GtkWidget *
|
||||
query_size_box (gchar *title,
|
||||
gchar *message,
|
||||
gdouble initial,
|
||||
gdouble lower,
|
||||
gdouble upper,
|
||||
gint digits,
|
||||
GUnit unit,
|
||||
gdouble resolution,
|
||||
gint dot_for_dot,
|
||||
GtkObject *object,
|
||||
gchar *signal,
|
||||
QueryFunc callback,
|
||||
gpointer data)
|
||||
query_size_box (gchar *title,
|
||||
gchar *message,
|
||||
gdouble initial,
|
||||
gdouble lower,
|
||||
gdouble upper,
|
||||
gint digits,
|
||||
GUnit unit,
|
||||
gdouble resolution,
|
||||
gint dot_for_dot,
|
||||
GtkObject *object,
|
||||
gchar *signal,
|
||||
QueryFunc callback,
|
||||
gpointer data)
|
||||
{
|
||||
QueryBox *query_box;
|
||||
GtkWidget *sizeentry;
|
||||
|
|
@ -1009,6 +1004,8 @@ query_size_box (gchar *title,
|
|||
|
||||
sizeentry = gimp_size_entry_new (1, unit, "%p", TRUE, FALSE, FALSE, 100,
|
||||
GIMP_SIZE_ENTRY_UPDATE_SIZE);
|
||||
if (dot_for_dot)
|
||||
gimp_size_entry_set_unit (GIMP_SIZE_ENTRY (sizeentry), UNIT_PIXEL);
|
||||
gimp_size_entry_set_resolution (GIMP_SIZE_ENTRY (sizeentry), 0,
|
||||
resolution, FALSE);
|
||||
gimp_size_entry_set_refval_digits (GIMP_SIZE_ENTRY (sizeentry), 0, digits);
|
||||
|
|
@ -1016,9 +1013,6 @@ query_size_box (gchar *title,
|
|||
lower, upper);
|
||||
gimp_size_entry_set_refval (GIMP_SIZE_ENTRY (sizeentry), 0, initial);
|
||||
|
||||
if (dot_for_dot)
|
||||
gimp_size_entry_set_unit (GIMP_SIZE_ENTRY (sizeentry), UNIT_PIXEL);
|
||||
|
||||
gtk_box_pack_start (GTK_BOX (query_box->vbox), sizeentry, TRUE, TRUE, 0);
|
||||
gimp_size_entry_grab_focus (GIMP_SIZE_ENTRY (sizeentry));
|
||||
gtk_widget_show (sizeentry);
|
||||
|
|
@ -1030,7 +1024,6 @@ query_size_box (gchar *title,
|
|||
return query_box->qbox;
|
||||
}
|
||||
|
||||
|
||||
static gint
|
||||
query_box_delete_callback (GtkWidget *w,
|
||||
GdkEvent *e,
|
||||
|
|
@ -1221,12 +1214,13 @@ message_box (char *message,
|
|||
gtk_signal_connect (GTK_OBJECT (button), "clicked",
|
||||
(GtkSignalFunc) message_box_close_callback,
|
||||
msg_box);
|
||||
gtk_box_pack_start (GTK_BOX (GTK_DIALOG (mbox)->action_area), button, TRUE, TRUE, 0);
|
||||
gtk_box_pack_start (GTK_BOX (GTK_DIALOG (mbox)->action_area), button,
|
||||
TRUE, TRUE, 0);
|
||||
gtk_widget_grab_default (button);
|
||||
gtk_widget_show (button);
|
||||
|
||||
vbox = gtk_vbox_new (FALSE, 1);
|
||||
gtk_container_set_border_width (GTK_CONTAINER (vbox), 1);
|
||||
vbox = gtk_vbox_new (FALSE, 0);
|
||||
gtk_container_set_border_width (GTK_CONTAINER (vbox), 2);
|
||||
gtk_container_add (GTK_CONTAINER (GTK_DIALOG (mbox)->vbox), vbox);
|
||||
gtk_widget_show (vbox);
|
||||
|
||||
|
|
@ -1274,7 +1268,6 @@ message_box_delete_callback (GtkWidget *w, GdkEvent *e, gpointer client_data)
|
|||
return TRUE;
|
||||
}
|
||||
|
||||
|
||||
static void
|
||||
message_box_close_callback (GtkWidget *w,
|
||||
gpointer client_data)
|
||||
|
|
|
|||
|
|
@ -158,10 +158,10 @@ file_new_ok_callback (GtkWidget *widget,
|
|||
vals = data;
|
||||
|
||||
/* get the image size in pixels */
|
||||
vals->width =
|
||||
gimp_size_entry_get_refval (GIMP_SIZE_ENTRY (vals->size_se), 0);
|
||||
vals->height =
|
||||
gimp_size_entry_get_refval (GIMP_SIZE_ENTRY (vals->size_se), 1);
|
||||
vals->width = (int)
|
||||
(gimp_size_entry_get_refval (GIMP_SIZE_ENTRY (vals->size_se), 0) + 0.5);
|
||||
vals->height = (int)
|
||||
(gimp_size_entry_get_refval (GIMP_SIZE_ENTRY (vals->size_se), 1) + 0.5);
|
||||
|
||||
/* get the resolution in dpi */
|
||||
vals->xresolution =
|
||||
|
|
@ -422,23 +422,27 @@ file_new_image_size_callback (GtkWidget *widget,
|
|||
gpointer data)
|
||||
{
|
||||
NewImageValues *vals;
|
||||
|
||||
gdouble width, height, size;
|
||||
gchar *text;
|
||||
gchar *label;
|
||||
|
||||
vals = (NewImageValues *) data;
|
||||
vals = data;
|
||||
|
||||
width = gimp_size_entry_get_refval (GIMP_SIZE_ENTRY (vals->size_se), 0);
|
||||
height = gimp_size_entry_get_refval (GIMP_SIZE_ENTRY (vals->size_se), 1);
|
||||
width = (gdouble) (gint)
|
||||
(gimp_size_entry_get_refval (GIMP_SIZE_ENTRY (vals->size_se), 0) + 0.5);
|
||||
height = (gdouble) (gint)
|
||||
(gimp_size_entry_get_refval (GIMP_SIZE_ENTRY (vals->size_se), 1) + 0.5);
|
||||
|
||||
size =
|
||||
width * height *
|
||||
((vals->type == RGB ? 3 : 1) + /* bytes per pixel */
|
||||
(vals->fill_type == TRANSPARENT_FILL ? 1 : 0)); /* alpha channel */
|
||||
|
||||
text = file_new_print_size (size);
|
||||
label = g_strdup_printf (_("Image Size: %s"), text);
|
||||
label = g_strdup_printf (_("Image Size: %s"),
|
||||
text = file_new_print_size (size));
|
||||
gtk_frame_set_label (GTK_FRAME (vals->size_frame), label);
|
||||
|
||||
g_free (label);
|
||||
g_free (text);
|
||||
|
||||
|
|
@ -481,6 +485,8 @@ file_new_cmd_callback (GtkWidget *widget,
|
|||
N_("RGB"),
|
||||
N_("Grayscale")
|
||||
};
|
||||
static gint ntypes = sizeof (type_names) / sizeof (type_names[0]);
|
||||
|
||||
static gchar *fill_type_names[] =
|
||||
{
|
||||
N_("Foreground"),
|
||||
|
|
@ -488,6 +494,8 @@ file_new_cmd_callback (GtkWidget *widget,
|
|||
N_("White"),
|
||||
N_("Transparent")
|
||||
};
|
||||
static gint nfill_types =
|
||||
sizeof (fill_type_names) / sizeof (fill_type_names[0]);
|
||||
|
||||
if(!new_dialog_run)
|
||||
{
|
||||
|
|
@ -796,19 +804,19 @@ file_new_cmd_callback (GtkWidget *widget,
|
|||
gtk_box_pack_start (GTK_BOX (top_vbox), hbox, FALSE, FALSE, 0);
|
||||
gtk_widget_show (hbox);
|
||||
|
||||
/* frame for Image Type */
|
||||
/* frame for Image Type */
|
||||
frame = gtk_frame_new (_("Image Type"));
|
||||
gtk_box_pack_start (GTK_BOX (hbox), frame, TRUE, TRUE, 0);
|
||||
gtk_widget_show (frame);
|
||||
|
||||
/* radio buttons and box */
|
||||
/* radio buttons and box */
|
||||
radio_box = gtk_vbox_new (FALSE, 1);
|
||||
gtk_container_set_border_width (GTK_CONTAINER (radio_box), 2);
|
||||
gtk_container_add (GTK_CONTAINER (frame), radio_box);
|
||||
gtk_widget_show (radio_box);
|
||||
|
||||
group = NULL;
|
||||
for (i = 0; i < 2; i++)
|
||||
for (i = 0; i < ntypes; i++)
|
||||
{
|
||||
button = gtk_radio_button_new_with_label (group, gettext (type_names[i]));
|
||||
group = gtk_radio_button_group (GTK_RADIO_BUTTON (button));
|
||||
|
|
@ -837,7 +845,7 @@ file_new_cmd_callback (GtkWidget *widget,
|
|||
gtk_widget_show (radio_box);
|
||||
|
||||
group = NULL;
|
||||
for (i = 0; i < 4; i++)
|
||||
for (i = 0; i < nfill_types; i++)
|
||||
{
|
||||
button =
|
||||
gtk_radio_button_new_with_label (group, gettext (fill_type_names[i]));
|
||||
|
|
@ -857,6 +865,7 @@ file_new_cmd_callback (GtkWidget *widget,
|
|||
}
|
||||
|
||||
gimp_size_entry_grab_focus (GIMP_SIZE_ENTRY (vals->size_se));
|
||||
|
||||
gtk_widget_show (vals->dlg);
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -1249,7 +1249,7 @@ gimage_mask_border_callback (GtkWidget *w,
|
|||
double radius_x;
|
||||
double radius_y;
|
||||
|
||||
selection_border_radius = (int) *(double*) call_data;
|
||||
selection_border_radius = (int) (*(double*) call_data + 0.5);
|
||||
g_free (call_data);
|
||||
unit = (GUnit) gtk_object_get_data (GTK_OBJECT (w), "size_query_unit");
|
||||
|
||||
|
|
@ -1283,7 +1283,7 @@ gimage_mask_grow_callback (GtkWidget *w,
|
|||
double radius_x;
|
||||
double radius_y;
|
||||
|
||||
selection_grow_pixels = (int) *(double*) call_data;
|
||||
selection_grow_pixels = (int) (*(double*) call_data + 0.5);
|
||||
g_free (call_data);
|
||||
unit = (GUnit) gtk_object_get_data (GTK_OBJECT (w), "size_query_unit");
|
||||
|
||||
|
|
@ -1317,7 +1317,7 @@ gimage_mask_shrink_callback (GtkWidget *w,
|
|||
int radius_x;
|
||||
int radius_y;
|
||||
|
||||
selection_shrink_pixels = (int) *(double*) call_data;
|
||||
selection_shrink_pixels = (int) (*(double*) call_data + 0.5);
|
||||
g_free (call_data);
|
||||
unit = (GUnit) gtk_object_get_data (GTK_OBJECT (w), "size_query_unit");
|
||||
|
||||
|
|
|
|||
|
|
@ -158,10 +158,10 @@ file_new_ok_callback (GtkWidget *widget,
|
|||
vals = data;
|
||||
|
||||
/* get the image size in pixels */
|
||||
vals->width =
|
||||
gimp_size_entry_get_refval (GIMP_SIZE_ENTRY (vals->size_se), 0);
|
||||
vals->height =
|
||||
gimp_size_entry_get_refval (GIMP_SIZE_ENTRY (vals->size_se), 1);
|
||||
vals->width = (int)
|
||||
(gimp_size_entry_get_refval (GIMP_SIZE_ENTRY (vals->size_se), 0) + 0.5);
|
||||
vals->height = (int)
|
||||
(gimp_size_entry_get_refval (GIMP_SIZE_ENTRY (vals->size_se), 1) + 0.5);
|
||||
|
||||
/* get the resolution in dpi */
|
||||
vals->xresolution =
|
||||
|
|
@ -422,23 +422,27 @@ file_new_image_size_callback (GtkWidget *widget,
|
|||
gpointer data)
|
||||
{
|
||||
NewImageValues *vals;
|
||||
|
||||
gdouble width, height, size;
|
||||
gchar *text;
|
||||
gchar *label;
|
||||
|
||||
vals = (NewImageValues *) data;
|
||||
vals = data;
|
||||
|
||||
width = gimp_size_entry_get_refval (GIMP_SIZE_ENTRY (vals->size_se), 0);
|
||||
height = gimp_size_entry_get_refval (GIMP_SIZE_ENTRY (vals->size_se), 1);
|
||||
width = (gdouble) (gint)
|
||||
(gimp_size_entry_get_refval (GIMP_SIZE_ENTRY (vals->size_se), 0) + 0.5);
|
||||
height = (gdouble) (gint)
|
||||
(gimp_size_entry_get_refval (GIMP_SIZE_ENTRY (vals->size_se), 1) + 0.5);
|
||||
|
||||
size =
|
||||
width * height *
|
||||
((vals->type == RGB ? 3 : 1) + /* bytes per pixel */
|
||||
(vals->fill_type == TRANSPARENT_FILL ? 1 : 0)); /* alpha channel */
|
||||
|
||||
text = file_new_print_size (size);
|
||||
label = g_strdup_printf (_("Image Size: %s"), text);
|
||||
label = g_strdup_printf (_("Image Size: %s"),
|
||||
text = file_new_print_size (size));
|
||||
gtk_frame_set_label (GTK_FRAME (vals->size_frame), label);
|
||||
|
||||
g_free (label);
|
||||
g_free (text);
|
||||
|
||||
|
|
@ -481,6 +485,8 @@ file_new_cmd_callback (GtkWidget *widget,
|
|||
N_("RGB"),
|
||||
N_("Grayscale")
|
||||
};
|
||||
static gint ntypes = sizeof (type_names) / sizeof (type_names[0]);
|
||||
|
||||
static gchar *fill_type_names[] =
|
||||
{
|
||||
N_("Foreground"),
|
||||
|
|
@ -488,6 +494,8 @@ file_new_cmd_callback (GtkWidget *widget,
|
|||
N_("White"),
|
||||
N_("Transparent")
|
||||
};
|
||||
static gint nfill_types =
|
||||
sizeof (fill_type_names) / sizeof (fill_type_names[0]);
|
||||
|
||||
if(!new_dialog_run)
|
||||
{
|
||||
|
|
@ -796,19 +804,19 @@ file_new_cmd_callback (GtkWidget *widget,
|
|||
gtk_box_pack_start (GTK_BOX (top_vbox), hbox, FALSE, FALSE, 0);
|
||||
gtk_widget_show (hbox);
|
||||
|
||||
/* frame for Image Type */
|
||||
/* frame for Image Type */
|
||||
frame = gtk_frame_new (_("Image Type"));
|
||||
gtk_box_pack_start (GTK_BOX (hbox), frame, TRUE, TRUE, 0);
|
||||
gtk_widget_show (frame);
|
||||
|
||||
/* radio buttons and box */
|
||||
/* radio buttons and box */
|
||||
radio_box = gtk_vbox_new (FALSE, 1);
|
||||
gtk_container_set_border_width (GTK_CONTAINER (radio_box), 2);
|
||||
gtk_container_add (GTK_CONTAINER (frame), radio_box);
|
||||
gtk_widget_show (radio_box);
|
||||
|
||||
group = NULL;
|
||||
for (i = 0; i < 2; i++)
|
||||
for (i = 0; i < ntypes; i++)
|
||||
{
|
||||
button = gtk_radio_button_new_with_label (group, gettext (type_names[i]));
|
||||
group = gtk_radio_button_group (GTK_RADIO_BUTTON (button));
|
||||
|
|
@ -837,7 +845,7 @@ file_new_cmd_callback (GtkWidget *widget,
|
|||
gtk_widget_show (radio_box);
|
||||
|
||||
group = NULL;
|
||||
for (i = 0; i < 4; i++)
|
||||
for (i = 0; i < nfill_types; i++)
|
||||
{
|
||||
button =
|
||||
gtk_radio_button_new_with_label (group, gettext (fill_type_names[i]));
|
||||
|
|
@ -857,6 +865,7 @@ file_new_cmd_callback (GtkWidget *widget,
|
|||
}
|
||||
|
||||
gimp_size_entry_grab_focus (GIMP_SIZE_ENTRY (vals->size_se));
|
||||
|
||||
gtk_widget_show (vals->dlg);
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -1249,7 +1249,7 @@ gimage_mask_border_callback (GtkWidget *w,
|
|||
double radius_x;
|
||||
double radius_y;
|
||||
|
||||
selection_border_radius = (int) *(double*) call_data;
|
||||
selection_border_radius = (int) (*(double*) call_data + 0.5);
|
||||
g_free (call_data);
|
||||
unit = (GUnit) gtk_object_get_data (GTK_OBJECT (w), "size_query_unit");
|
||||
|
||||
|
|
@ -1283,7 +1283,7 @@ gimage_mask_grow_callback (GtkWidget *w,
|
|||
double radius_x;
|
||||
double radius_y;
|
||||
|
||||
selection_grow_pixels = (int) *(double*) call_data;
|
||||
selection_grow_pixels = (int) (*(double*) call_data + 0.5);
|
||||
g_free (call_data);
|
||||
unit = (GUnit) gtk_object_get_data (GTK_OBJECT (w), "size_query_unit");
|
||||
|
||||
|
|
@ -1317,7 +1317,7 @@ gimage_mask_shrink_callback (GtkWidget *w,
|
|||
int radius_x;
|
||||
int radius_y;
|
||||
|
||||
selection_shrink_pixels = (int) *(double*) call_data;
|
||||
selection_shrink_pixels = (int) (*(double*) call_data + 0.5);
|
||||
g_free (call_data);
|
||||
unit = (GUnit) gtk_object_get_data (GTK_OBJECT (w), "size_query_unit");
|
||||
|
||||
|
|
|
|||
|
|
@ -34,7 +34,7 @@ static gint info_dialog_delete_callback (GtkWidget *, GdkEvent *, gpointer);
|
|||
static void
|
||||
info_field_new (InfoDialog *idialog,
|
||||
InfoFieldType field_type,
|
||||
char *title,
|
||||
gchar *title,
|
||||
GtkWidget *widget,
|
||||
GtkObject *obj,
|
||||
void *value_ptr,
|
||||
|
|
@ -43,7 +43,7 @@ info_field_new (InfoDialog *idialog,
|
|||
{
|
||||
GtkWidget *label;
|
||||
InfoField *field;
|
||||
int row;
|
||||
int row;
|
||||
|
||||
field = (InfoField *) g_malloc (sizeof (InfoField));
|
||||
|
||||
|
|
@ -52,12 +52,12 @@ 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,
|
||||
gtk_table_attach (GTK_TABLE (idialog->info_table), label,
|
||||
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,
|
||||
gtk_table_attach_defaults (GTK_TABLE (idialog->info_table), widget,
|
||||
1, 2, row - 1, row);
|
||||
gtk_widget_show (widget);
|
||||
|
||||
|
|
@ -105,14 +105,14 @@ update_field (InfoField *field)
|
|||
case INFO_SCALE:
|
||||
case INFO_SPINBUTTON:
|
||||
gtk_adjustment_set_value (GTK_ADJUSTMENT (field->obj),
|
||||
*((gfloat*) field->value_ptr));
|
||||
*((gdouble*) field->value_ptr));
|
||||
break;
|
||||
|
||||
case INFO_SIZEENTRY:
|
||||
num = GIMP_SIZE_ENTRY (field->obj)->number_of_fields;
|
||||
for (i = 0; i < num; i++)
|
||||
gimp_size_entry_set_refval (GIMP_SIZE_ENTRY (field->obj), i,
|
||||
((gfloat*) field->value_ptr)[i]);
|
||||
((gdouble*) field->value_ptr)[i]);
|
||||
break;
|
||||
|
||||
default:
|
||||
|
|
@ -121,7 +121,17 @@ update_field (InfoField *field)
|
|||
}
|
||||
}
|
||||
|
||||
/* function definitions */
|
||||
static gint
|
||||
info_dialog_delete_callback (GtkWidget *w,
|
||||
GdkEvent *e,
|
||||
gpointer client_data)
|
||||
{
|
||||
info_dialog_popdown ((InfoDialog *) client_data);
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
/* public functions */
|
||||
|
||||
InfoDialog *
|
||||
info_dialog_new (char *title)
|
||||
|
|
@ -189,6 +199,45 @@ info_dialog_free (InfoDialog *idialog)
|
|||
g_free (idialog);
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
info_dialog_popup (InfoDialog *idialog)
|
||||
{
|
||||
if (!idialog)
|
||||
return;
|
||||
|
||||
if (!GTK_WIDGET_VISIBLE (idialog->shell))
|
||||
gtk_widget_show (idialog->shell);
|
||||
|
||||
}
|
||||
|
||||
void
|
||||
info_dialog_popdown (InfoDialog *idialog)
|
||||
{
|
||||
if (!idialog)
|
||||
return;
|
||||
|
||||
if (GTK_WIDGET_VISIBLE (idialog->shell))
|
||||
gtk_widget_hide (idialog->shell);
|
||||
}
|
||||
|
||||
void
|
||||
info_dialog_update (InfoDialog *idialog)
|
||||
{
|
||||
GSList *list;
|
||||
|
||||
if (!idialog)
|
||||
return;
|
||||
|
||||
list = idialog->field_list;
|
||||
|
||||
while (list)
|
||||
{
|
||||
update_field ((InfoField *) list->data);
|
||||
list = g_slist_next (list);
|
||||
}
|
||||
}
|
||||
|
||||
GtkWidget *
|
||||
info_dialog_add_label (InfoDialog *idialog,
|
||||
char *title,
|
||||
|
|
@ -234,8 +283,8 @@ info_dialog_add_entry (InfoDialog *idialog,
|
|||
|
||||
GtkWidget *
|
||||
info_dialog_add_scale (InfoDialog *idialog,
|
||||
char *title,
|
||||
float *value_ptr,
|
||||
gchar *title,
|
||||
gdouble *value_ptr,
|
||||
gfloat lower,
|
||||
gfloat upper,
|
||||
gfloat step_increment,
|
||||
|
|
@ -272,7 +321,7 @@ info_dialog_add_scale (InfoDialog *idialog,
|
|||
GtkWidget *
|
||||
info_dialog_add_spinbutton (InfoDialog *idialog,
|
||||
gchar *title,
|
||||
gfloat *value_ptr,
|
||||
gdouble *value_ptr,
|
||||
gfloat lower,
|
||||
gfloat upper,
|
||||
gfloat step_increment,
|
||||
|
|
@ -316,7 +365,7 @@ info_dialog_add_spinbutton (InfoDialog *idialog,
|
|||
GtkWidget *
|
||||
info_dialog_add_sizeentry (InfoDialog *idialog,
|
||||
gchar *title,
|
||||
gfloat *value_ptr,
|
||||
gdouble *value_ptr,
|
||||
gint nfields,
|
||||
GUnit unit,
|
||||
gchar *unit_format,
|
||||
|
|
@ -356,51 +405,3 @@ info_dialog_add_sizeentry (InfoDialog *idialog,
|
|||
|
||||
return sizeentry;
|
||||
}
|
||||
|
||||
void
|
||||
info_dialog_popup (InfoDialog *idialog)
|
||||
{
|
||||
if (!idialog)
|
||||
return;
|
||||
|
||||
if (!GTK_WIDGET_VISIBLE (idialog->shell))
|
||||
gtk_widget_show (idialog->shell);
|
||||
|
||||
}
|
||||
|
||||
void
|
||||
info_dialog_popdown (InfoDialog *idialog)
|
||||
{
|
||||
if (!idialog)
|
||||
return;
|
||||
|
||||
if (GTK_WIDGET_VISIBLE (idialog->shell))
|
||||
gtk_widget_hide (idialog->shell);
|
||||
}
|
||||
|
||||
void
|
||||
info_dialog_update (InfoDialog *idialog)
|
||||
{
|
||||
GSList *list;
|
||||
|
||||
if (!idialog)
|
||||
return;
|
||||
|
||||
list = idialog->field_list;
|
||||
|
||||
while (list)
|
||||
{
|
||||
update_field ((InfoField *) list->data);
|
||||
list = g_slist_next (list);
|
||||
}
|
||||
}
|
||||
|
||||
static gint
|
||||
info_dialog_delete_callback (GtkWidget *w,
|
||||
GdkEvent *e,
|
||||
gpointer client_data)
|
||||
{
|
||||
info_dialog_popdown ((InfoDialog *) client_data);
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -79,7 +79,7 @@ GtkWidget *info_dialog_add_entry (InfoDialog *idialog,
|
|||
|
||||
GtkWidget *info_dialog_add_scale (InfoDialog *idialog,
|
||||
gchar *title,
|
||||
gfloat *value_ptr,
|
||||
gdouble *value_ptr,
|
||||
gfloat lower,
|
||||
gfloat upper,
|
||||
gfloat step_increment,
|
||||
|
|
@ -91,7 +91,7 @@ GtkWidget *info_dialog_add_scale (InfoDialog *idialog,
|
|||
|
||||
GtkWidget *info_dialog_add_spinbutton (InfoDialog *idialog,
|
||||
gchar *title,
|
||||
gfloat *value_ptr,
|
||||
gdouble *value_ptr,
|
||||
gfloat lower,
|
||||
gfloat upper,
|
||||
gfloat step_increment,
|
||||
|
|
@ -104,7 +104,7 @@ GtkWidget *info_dialog_add_spinbutton (InfoDialog *idialog,
|
|||
|
||||
GtkWidget *info_dialog_add_sizeentry (InfoDialog *idialog,
|
||||
gchar *title,
|
||||
gfloat *value_ptr,
|
||||
gdouble *value_ptr,
|
||||
gint nfields,
|
||||
GUnit unit,
|
||||
gchar *unit_format,
|
||||
|
|
|
|||
|
|
@ -330,7 +330,9 @@ lc_dialog_create (GimpImage* gimage)
|
|||
gtk_window_set_title (GTK_WINDOW (lc_shell), _("Layers & Channels"));
|
||||
gtk_window_set_wmclass (GTK_WINDOW (lc_shell), "layers_and_channels", "Gimp");
|
||||
session_set_window_geometry (lc_shell, &lc_dialog_session_info, TRUE);
|
||||
gtk_container_border_width (GTK_CONTAINER (GTK_DIALOG (lc_shell)->vbox), 2);
|
||||
gtk_container_set_border_width
|
||||
(GTK_CONTAINER (GTK_DIALOG (lc_shell)->vbox), 2);
|
||||
|
||||
gtk_signal_connect (GTK_OBJECT (lc_shell),
|
||||
"delete_event",
|
||||
GTK_SIGNAL_FUNC (lc_dialog_close_callback),
|
||||
|
|
@ -391,10 +393,13 @@ lc_dialog_create (GimpImage* gimage)
|
|||
|
||||
gtk_widget_show (notebook);
|
||||
|
||||
gtk_container_border_width (GTK_CONTAINER (GTK_DIALOG(lc_shell)->action_area), 1);
|
||||
gtk_container_set_border_width
|
||||
(GTK_CONTAINER (GTK_DIALOG(lc_shell)->action_area), 1);
|
||||
|
||||
/* The close button */
|
||||
button = gtk_button_new_with_label (_("Close"));
|
||||
gtk_box_pack_start (GTK_BOX (GTK_DIALOG(lc_shell)->action_area), button, TRUE, TRUE, 0);
|
||||
gtk_box_pack_start (GTK_BOX (GTK_DIALOG(lc_shell)->action_area), button,
|
||||
TRUE, TRUE, 0);
|
||||
gtk_signal_connect_object (GTK_OBJECT (button), "clicked",
|
||||
(GtkSignalFunc) lc_dialog_close_callback,
|
||||
GTK_OBJECT (lc_shell));
|
||||
|
|
@ -695,7 +700,7 @@ layers_dialog_create ()
|
|||
|
||||
/* The main vbox */
|
||||
layersD->vbox = vbox = gtk_vbox_new (FALSE, 1);
|
||||
gtk_container_border_width (GTK_CONTAINER (vbox), 2);
|
||||
gtk_container_set_border_width (GTK_CONTAINER (vbox), 2);
|
||||
|
||||
/* The layers commands pulldown menu */
|
||||
layersD->ops_menu = build_menu (layers_ops, layersD->accel_group);
|
||||
|
|
@ -3037,15 +3042,15 @@ struct _NewLayerOptions {
|
|||
GtkWidget *query_box;
|
||||
GtkWidget *name_entry;
|
||||
GtkWidget *size_se;
|
||||
int fill_type;
|
||||
int xsize;
|
||||
int ysize;
|
||||
gint fill_type;
|
||||
gint xsize;
|
||||
gint ysize;
|
||||
|
||||
GimpImage* gimage;
|
||||
};
|
||||
|
||||
static int fill_type = TRANSPARENT_FILL;
|
||||
static char *layer_name = NULL;
|
||||
static gint fill_type = TRANSPARENT_FILL;
|
||||
static gchar *layer_name = NULL;
|
||||
|
||||
static void
|
||||
new_layer_query_ok_callback (GtkWidget *w,
|
||||
|
|
@ -3056,14 +3061,17 @@ new_layer_query_ok_callback (GtkWidget *w,
|
|||
GImage *gimage;
|
||||
|
||||
options = (NewLayerOptions *) client_data;
|
||||
|
||||
if (layer_name)
|
||||
g_free (layer_name);
|
||||
layer_name = g_strdup (gtk_entry_get_text (GTK_ENTRY (options->name_entry)));
|
||||
|
||||
options->xsize = (gint)
|
||||
(gimp_size_entry_get_refval (GIMP_SIZE_ENTRY (options->size_se), 0) + 0.5);
|
||||
options->ysize = (gint)
|
||||
(gimp_size_entry_get_refval (GIMP_SIZE_ENTRY (options->size_se), 1) + 0.5);
|
||||
|
||||
fill_type = options->fill_type;
|
||||
options->xsize =
|
||||
gimp_size_entry_get_refval (GIMP_SIZE_ENTRY (options->size_se), 0);
|
||||
options->ysize =
|
||||
gimp_size_entry_get_refval (GIMP_SIZE_ENTRY (options->size_se), 1);
|
||||
|
||||
if ((gimage = options->gimage))
|
||||
{
|
||||
|
|
@ -3100,14 +3108,15 @@ new_layer_query_cancel_callback (GtkWidget *w,
|
|||
NewLayerOptions *options;
|
||||
|
||||
options = (NewLayerOptions *) client_data;
|
||||
|
||||
gtk_widget_destroy (options->query_box);
|
||||
g_free (options);
|
||||
}
|
||||
|
||||
static gint
|
||||
new_layer_query_delete_callback (GtkWidget *w,
|
||||
GdkEvent *e,
|
||||
gpointer client_data)
|
||||
GdkEvent *e,
|
||||
gpointer client_data)
|
||||
{
|
||||
new_layer_query_cancel_callback (w, client_data);
|
||||
|
||||
|
|
@ -3122,6 +3131,7 @@ new_layer_query_fill_type_callback (GtkWidget *w,
|
|||
NewLayerOptions *options;
|
||||
|
||||
options = (NewLayerOptions *) client_data;
|
||||
|
||||
options->fill_type =
|
||||
(int) gtk_object_get_data (GTK_OBJECT (w), "layer_fill_type");
|
||||
}
|
||||
|
|
@ -3138,15 +3148,18 @@ layers_dialog_new_layer_query (GimpImage* gimage)
|
|||
GtkWidget *radio_frame;
|
||||
GtkWidget *radio_box;
|
||||
GtkWidget *radio_button;
|
||||
GSList *group = NULL;
|
||||
int i;
|
||||
char *button_names[] =
|
||||
GSList *group;
|
||||
int i;
|
||||
|
||||
static gchar *button_names[] =
|
||||
{
|
||||
N_("Foreground"),
|
||||
N_("Background"),
|
||||
N_("White"),
|
||||
N_("Transparent")
|
||||
};
|
||||
static gint nbutton_names = sizeof (button_names) / sizeof (button_names[0]);
|
||||
|
||||
static ActionAreaItem action_items[] =
|
||||
{
|
||||
{ N_("OK"), new_layer_query_ok_callback, NULL, NULL },
|
||||
|
|
@ -3165,14 +3178,14 @@ layers_dialog_new_layer_query (GimpImage* gimage)
|
|||
gtk_window_set_title (GTK_WINDOW (options->query_box), _("New Layer Options"));
|
||||
gtk_window_position (GTK_WINDOW (options->query_box), GTK_WIN_POS_MOUSE);
|
||||
|
||||
/* handle the wm close signal */
|
||||
/* handle the wm close signal */
|
||||
gtk_signal_connect (GTK_OBJECT (options->query_box), "delete_event",
|
||||
GTK_SIGNAL_FUNC (new_layer_query_delete_callback),
|
||||
options);
|
||||
|
||||
/* the main vbox */
|
||||
vbox = gtk_vbox_new (FALSE, 2);
|
||||
gtk_container_border_width (GTK_CONTAINER (vbox), 2);
|
||||
gtk_container_set_border_width (GTK_CONTAINER (vbox), 2);
|
||||
gtk_box_pack_start (GTK_BOX (GTK_DIALOG (options->query_box)->vbox), vbox,
|
||||
TRUE, TRUE, 0);
|
||||
|
||||
|
|
@ -3228,6 +3241,8 @@ layers_dialog_new_layer_query (GimpImage* gimage)
|
|||
GTK_SHRINK | GTK_FILL, GTK_SHRINK | GTK_FILL, 0, 0);
|
||||
gtk_widget_show (options->size_se);
|
||||
|
||||
gimp_size_entry_set_unit (GIMP_SIZE_ENTRY (options->size_se), UNIT_PIXEL);
|
||||
|
||||
gimp_size_entry_set_resolution (GIMP_SIZE_ENTRY (options->size_se), 0,
|
||||
gimage->xresolution, FALSE);
|
||||
gimp_size_entry_set_resolution (GIMP_SIZE_ENTRY (options->size_se), 1,
|
||||
|
|
@ -3250,8 +3265,6 @@ layers_dialog_new_layer_query (GimpImage* gimage)
|
|||
gimp_size_entry_set_refval (GIMP_SIZE_ENTRY (options->size_se), 1,
|
||||
gimage->height);
|
||||
|
||||
gimp_size_entry_set_unit (GIMP_SIZE_ENTRY (options->size_se), UNIT_PIXEL);
|
||||
|
||||
gtk_widget_show (table);
|
||||
|
||||
/* the radio frame and box */
|
||||
|
|
@ -3262,7 +3275,8 @@ layers_dialog_new_layer_query (GimpImage* gimage)
|
|||
gtk_container_add (GTK_CONTAINER (radio_frame), radio_box);
|
||||
|
||||
/* the radio buttons */
|
||||
for (i = 0; i < 4; i++)
|
||||
group = NULL;
|
||||
for (i = 0; i < nbutton_names; i++)
|
||||
{
|
||||
radio_button =
|
||||
gtk_radio_button_new_with_label (group, gettext(button_names[i]));
|
||||
|
|
@ -3387,8 +3401,9 @@ layers_dialog_edit_layer_query (LayerWidget *layer_widget)
|
|||
|
||||
/* the main vbox */
|
||||
vbox = gtk_vbox_new (FALSE, 1);
|
||||
gtk_container_border_width (GTK_CONTAINER (vbox), 2);
|
||||
gtk_box_pack_start (GTK_BOX (GTK_DIALOG (options->query_box)->vbox), vbox, TRUE, TRUE, 0);
|
||||
gtk_container_set_border_width (GTK_CONTAINER (vbox), 2);
|
||||
gtk_box_pack_start (GTK_BOX (GTK_DIALOG (options->query_box)->vbox), vbox,
|
||||
TRUE, TRUE, 0);
|
||||
|
||||
/* the name entry hbox, label and entry */
|
||||
hbox = gtk_hbox_new (FALSE, 1);
|
||||
|
|
@ -3545,8 +3560,9 @@ layers_dialog_add_mask_query (Layer *layer)
|
|||
|
||||
/* the main vbox */
|
||||
vbox = gtk_vbox_new (FALSE, 1);
|
||||
gtk_container_border_width (GTK_CONTAINER (vbox), 2);
|
||||
gtk_box_pack_start (GTK_BOX (GTK_DIALOG (options->query_box)->vbox), vbox, TRUE, TRUE, 0);
|
||||
gtk_container_set_border_width (GTK_CONTAINER (vbox), 2);
|
||||
gtk_box_pack_start (GTK_BOX (GTK_DIALOG (options->query_box)->vbox), vbox,
|
||||
TRUE, TRUE, 0);
|
||||
|
||||
/* the name entry hbox, label and entry */
|
||||
label = gtk_label_new (_("Initialize Layer Mask To:"));
|
||||
|
|
@ -3674,8 +3690,9 @@ layers_dialog_apply_mask_query (Layer *layer)
|
|||
|
||||
/* the main vbox */
|
||||
vbox = gtk_vbox_new (FALSE, 1);
|
||||
gtk_container_border_width (GTK_CONTAINER (vbox), 2);
|
||||
gtk_box_pack_start (GTK_BOX (GTK_DIALOG (options->query_box)->vbox), vbox, TRUE, TRUE, 0);
|
||||
gtk_container_set_border_width (GTK_CONTAINER (vbox), 2);
|
||||
gtk_box_pack_start (GTK_BOX (GTK_DIALOG (options->query_box)->vbox), vbox,
|
||||
TRUE, TRUE, 0);
|
||||
|
||||
/* the name entry hbox, label and entry */
|
||||
label = gtk_label_new (_("Apply layer mask?"));
|
||||
|
|
@ -4019,8 +4036,9 @@ layers_dialog_layer_merge_query (GImage *gimage,
|
|||
|
||||
/* the main vbox */
|
||||
vbox = gtk_vbox_new (FALSE, 1);
|
||||
gtk_container_border_width (GTK_CONTAINER (options->query_box), 2);
|
||||
gtk_box_pack_start (GTK_BOX (GTK_DIALOG (options->query_box)->vbox), vbox, TRUE, TRUE, 0);
|
||||
gtk_container_set_border_width (GTK_CONTAINER (options->query_box), 2);
|
||||
gtk_box_pack_start (GTK_BOX (GTK_DIALOG (options->query_box)->vbox), vbox,
|
||||
TRUE, TRUE, 0);
|
||||
|
||||
/* the name entry hbox, label and entry */
|
||||
if (merge_visible)
|
||||
|
|
|
|||
|
|
@ -56,79 +56,68 @@ static void file_prefs_res_source_callback (GtkWidget *, gpointer);
|
|||
static void file_prefs_monitor_resolution_callback (GtkWidget *, gpointer);
|
||||
|
||||
/* static variables */
|
||||
static int old_perfectmouse;
|
||||
static int old_transparency_type;
|
||||
static int old_transparency_size;
|
||||
static int old_levels_of_undo;
|
||||
static int old_marching_speed;
|
||||
static int old_allow_resize_windows;
|
||||
static int old_auto_save;
|
||||
static int old_preview_size;
|
||||
static int old_no_cursor_updating;
|
||||
static int old_show_tool_tips;
|
||||
static int old_show_rulers;
|
||||
static int old_show_statusbar;
|
||||
static int old_cubic_interpolation;
|
||||
static int old_confirm_on_close;
|
||||
static int old_save_session_info;
|
||||
static int old_save_device_status;
|
||||
static int old_always_restore_session;
|
||||
static int old_default_width;
|
||||
static int old_default_height;
|
||||
static GUnit old_default_units;
|
||||
static double old_default_xresolution;
|
||||
static double old_default_yresolution;
|
||||
static GUnit old_default_resolution_units;
|
||||
static int old_default_type;
|
||||
static int old_stingy_memory_use;
|
||||
static int old_tile_cache_size;
|
||||
static int old_install_cmap;
|
||||
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_gradient_path;
|
||||
static double old_monitor_xres;
|
||||
static double old_monitor_yres;
|
||||
static int old_using_xserver_resolution;
|
||||
static int old_num_processors;
|
||||
static char * old_image_title_format;
|
||||
static int old_global_paint_options;
|
||||
static int old_max_new_image_size;
|
||||
static int old_perfectmouse;
|
||||
static int old_transparency_type;
|
||||
static int old_transparency_size;
|
||||
static int old_levels_of_undo;
|
||||
static int old_marching_speed;
|
||||
static int old_allow_resize_windows;
|
||||
static int old_auto_save;
|
||||
static int old_preview_size;
|
||||
static int old_no_cursor_updating;
|
||||
static int old_show_tool_tips;
|
||||
static int old_show_rulers;
|
||||
static int old_show_statusbar;
|
||||
static int old_cubic_interpolation;
|
||||
static int old_confirm_on_close;
|
||||
static int old_save_session_info;
|
||||
static int old_save_device_status;
|
||||
static int old_always_restore_session;
|
||||
static int old_default_width;
|
||||
static int old_default_height;
|
||||
static GUnit old_default_units;
|
||||
static double old_default_xresolution;
|
||||
static double old_default_yresolution;
|
||||
static GUnit old_default_resolution_units;
|
||||
static int old_default_type;
|
||||
static int old_stingy_memory_use;
|
||||
static int old_tile_cache_size;
|
||||
static int old_install_cmap;
|
||||
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_gradient_path;
|
||||
static double old_monitor_xres;
|
||||
static double old_monitor_yres;
|
||||
static int old_using_xserver_resolution;
|
||||
static int old_num_processors;
|
||||
static char * old_image_title_format;
|
||||
static int old_global_paint_options;
|
||||
static int old_max_new_image_size;
|
||||
|
||||
/* variables which can't be changed on the fly */
|
||||
static int edit_stingy_memory_use;
|
||||
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 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;
|
||||
|
||||
static int divided_tile_cache_size;
|
||||
static int tile_cache_size_unit;
|
||||
|
||||
static int divided_max_new_image_size;
|
||||
static int max_new_image_size_unit;
|
||||
|
||||
static GtkWidget *default_size_sizeentry = NULL;
|
||||
static GtkWidget *default_resolution_sizeentry = NULL;
|
||||
static GtkWidget *resolution_xserver_label = NULL;
|
||||
static GtkWidget *monitor_resolution_sizeentry = NULL;
|
||||
static GtkWidget *prefs_dlg = NULL;
|
||||
|
||||
/* Some information regarding preferences, compiled by Raph Levien 11/3/97.
|
||||
updated by Michael Natterer 27/3/99
|
||||
|
|
@ -278,10 +267,6 @@ file_prefs_ok_callback (GtkWidget *widget,
|
|||
|
||||
gtk_widget_destroy (dlg);
|
||||
prefs_dlg = NULL;
|
||||
default_size_sizeentry = NULL;
|
||||
default_resolution_sizeentry = NULL;
|
||||
resolution_xserver_label = NULL;
|
||||
monitor_resolution_sizeentry = NULL;
|
||||
|
||||
if (show_tool_tips)
|
||||
gtk_tooltips_enable (tool_tips);
|
||||
|
|
@ -545,10 +530,6 @@ file_prefs_cancel_callback (GtkWidget *widget,
|
|||
{
|
||||
gtk_widget_destroy (dlg);
|
||||
prefs_dlg = NULL;
|
||||
default_size_sizeentry = NULL;
|
||||
default_resolution_sizeentry = NULL;
|
||||
resolution_xserver_label = NULL;
|
||||
monitor_resolution_sizeentry = NULL;
|
||||
|
||||
levels_of_undo = old_levels_of_undo;
|
||||
marching_speed = old_marching_speed;
|
||||
|
|
@ -683,22 +664,22 @@ file_prefs_mem_size_callback (GtkWidget *widget,
|
|||
gpointer data)
|
||||
{
|
||||
int *mem_size;
|
||||
int *divided_mem_size;
|
||||
int *mem_size_unit;
|
||||
int divided_mem_size;
|
||||
int mem_size_unit;
|
||||
|
||||
if (! (mem_size = gtk_object_get_data (GTK_OBJECT (widget), "mem_size")))
|
||||
return;
|
||||
|
||||
if (! (divided_mem_size = gtk_object_get_data (GTK_OBJECT (widget),
|
||||
"divided_mem_size")))
|
||||
return;
|
||||
divided_mem_size = (int) gtk_object_get_data (GTK_OBJECT (widget),
|
||||
"divided_mem_size");
|
||||
mem_size_unit = (int) gtk_object_get_data (GTK_OBJECT (widget),
|
||||
"mem_size_unit");
|
||||
|
||||
if (! (mem_size_unit = gtk_object_get_data (GTK_OBJECT (widget),
|
||||
"mem_size_unit")))
|
||||
return;
|
||||
divided_mem_size = GTK_ADJUSTMENT (widget)->value;
|
||||
*mem_size = divided_mem_size * mem_size_unit;
|
||||
|
||||
*divided_mem_size = GTK_ADJUSTMENT (widget)->value;
|
||||
*mem_size = *divided_mem_size * *mem_size_unit;
|
||||
gtk_object_set_data (GTK_OBJECT (widget), "divided_mem_size",
|
||||
(gpointer) divided_mem_size);
|
||||
}
|
||||
|
||||
static void
|
||||
|
|
@ -708,37 +689,35 @@ file_prefs_mem_size_unit_callback (GtkWidget *widget,
|
|||
GtkObject *adjustment;
|
||||
int new_unit;
|
||||
int *mem_size;
|
||||
int *divided_mem_size;
|
||||
int *mem_size_unit;
|
||||
int divided_mem_size;
|
||||
int mem_size_unit;
|
||||
|
||||
adjustment = GTK_OBJECT (data);
|
||||
|
||||
if (! (new_unit = (int) gtk_object_get_user_data (GTK_OBJECT (widget))))
|
||||
return;
|
||||
new_unit = (int) gtk_object_get_user_data (GTK_OBJECT (widget));
|
||||
|
||||
if (! (mem_size = gtk_object_get_data (GTK_OBJECT (adjustment), "mem_size")))
|
||||
return;
|
||||
|
||||
if (! (divided_mem_size = gtk_object_get_data (GTK_OBJECT (adjustment),
|
||||
"divided_mem_size")))
|
||||
return;
|
||||
divided_mem_size = (int) gtk_object_get_data (GTK_OBJECT (adjustment),
|
||||
"divided_mem_size");
|
||||
mem_size_unit = (int) gtk_object_get_data (GTK_OBJECT (adjustment),
|
||||
"mem_size_unit");
|
||||
|
||||
if (! (mem_size_unit = gtk_object_get_data (GTK_OBJECT (adjustment),
|
||||
"mem_size_unit")))
|
||||
return;
|
||||
|
||||
if (new_unit != *mem_size_unit)
|
||||
if (new_unit != mem_size_unit)
|
||||
{
|
||||
*divided_mem_size = *mem_size / new_unit;
|
||||
*mem_size_unit = new_unit;
|
||||
divided_mem_size = *mem_size / new_unit;
|
||||
mem_size_unit = new_unit;
|
||||
|
||||
gtk_signal_handler_block_by_data (GTK_OBJECT (adjustment),
|
||||
divided_mem_size);
|
||||
gtk_adjustment_set_value (GTK_ADJUSTMENT (adjustment),
|
||||
(float) *divided_mem_size);
|
||||
gtk_signal_handler_unblock_by_data (GTK_OBJECT (adjustment),
|
||||
divided_mem_size);
|
||||
gtk_signal_handler_block_by_data (GTK_OBJECT (adjustment), mem_size);
|
||||
gtk_adjustment_set_value (GTK_ADJUSTMENT (adjustment), divided_mem_size);
|
||||
gtk_signal_handler_unblock_by_data (GTK_OBJECT (adjustment), mem_size);
|
||||
}
|
||||
|
||||
gtk_object_set_data (GTK_OBJECT (adjustment), "divided_mem_size",
|
||||
(gpointer) divided_mem_size);
|
||||
gtk_object_set_data (GTK_OBJECT (adjustment), "mem_size_unit",
|
||||
(gpointer) mem_size_unit);
|
||||
}
|
||||
|
||||
static void
|
||||
|
|
@ -793,8 +772,10 @@ static void
|
|||
file_prefs_default_size_callback (GtkWidget *widget,
|
||||
gpointer data)
|
||||
{
|
||||
default_width = gimp_size_entry_get_refval (GIMP_SIZE_ENTRY (widget), 0);
|
||||
default_height = gimp_size_entry_get_refval (GIMP_SIZE_ENTRY (widget), 1);
|
||||
default_width =
|
||||
(int) (gimp_size_entry_get_refval (GIMP_SIZE_ENTRY (widget), 0) + 0.5);
|
||||
default_height =
|
||||
(int) (gimp_size_entry_get_refval (GIMP_SIZE_ENTRY (widget), 1) + 0.5);
|
||||
default_units = gimp_size_entry_get_unit (GIMP_SIZE_ENTRY (widget));
|
||||
}
|
||||
|
||||
|
|
@ -802,6 +783,7 @@ static void
|
|||
file_prefs_default_resolution_callback (GtkWidget *widget,
|
||||
gpointer data)
|
||||
{
|
||||
GtkWidget *size_sizeentry;
|
||||
static gdouble xres = 0.0;
|
||||
static gdouble yres = 0.0;
|
||||
gdouble new_xres;
|
||||
|
|
@ -810,6 +792,8 @@ file_prefs_default_resolution_callback (GtkWidget *widget,
|
|||
new_xres = gimp_size_entry_get_refval (GIMP_SIZE_ENTRY (widget), 0);
|
||||
new_yres = gimp_size_entry_get_refval (GIMP_SIZE_ENTRY (widget), 1);
|
||||
|
||||
size_sizeentry = gtk_object_get_data (GTK_OBJECT (widget), "size_sizeentry");
|
||||
|
||||
if (gimp_chain_button_get_active (GIMP_CHAIN_BUTTON (data)))
|
||||
{
|
||||
if (new_xres != xres)
|
||||
|
|
@ -832,15 +816,15 @@ file_prefs_default_resolution_callback (GtkWidget *widget,
|
|||
yres = new_yres;
|
||||
}
|
||||
|
||||
gimp_size_entry_set_resolution (GIMP_SIZE_ENTRY (default_size_sizeentry),
|
||||
gimp_size_entry_set_resolution (GIMP_SIZE_ENTRY (size_sizeentry),
|
||||
0, xres, FALSE);
|
||||
gimp_size_entry_set_resolution (GIMP_SIZE_ENTRY (default_size_sizeentry),
|
||||
gimp_size_entry_set_resolution (GIMP_SIZE_ENTRY (size_sizeentry),
|
||||
1, yres, FALSE);
|
||||
|
||||
default_width =
|
||||
gimp_size_entry_get_refval (GIMP_SIZE_ENTRY (default_size_sizeentry), 0);
|
||||
default_height =
|
||||
gimp_size_entry_get_refval (GIMP_SIZE_ENTRY (default_size_sizeentry), 1);
|
||||
default_width = (gint)
|
||||
(gimp_size_entry_get_refval (GIMP_SIZE_ENTRY (size_sizeentry), 0) + 0.5);
|
||||
default_height = (gint)
|
||||
(gimp_size_entry_get_refval (GIMP_SIZE_ENTRY (size_sizeentry), 1) + 0.5);
|
||||
default_xresolution = xres;
|
||||
default_yresolution = yres;
|
||||
default_resolution_units = gimp_size_entry_get_unit (GIMP_SIZE_ENTRY (widget));
|
||||
|
|
@ -850,13 +834,18 @@ static void
|
|||
file_prefs_res_source_callback (GtkWidget *widget,
|
||||
gpointer data)
|
||||
{
|
||||
if (resolution_xserver_label)
|
||||
gtk_widget_set_sensitive (resolution_xserver_label,
|
||||
GTK_TOGGLE_BUTTON (widget)->active);
|
||||
GtkWidget *resolution_xserver_label;
|
||||
GtkWidget *monitor_resolution_sizeentry;
|
||||
|
||||
if (monitor_resolution_sizeentry)
|
||||
gtk_widget_set_sensitive (monitor_resolution_sizeentry,
|
||||
! GTK_TOGGLE_BUTTON (widget)->active);
|
||||
resolution_xserver_label =
|
||||
gtk_object_get_data (GTK_OBJECT (widget), "resolution_xserver_label");
|
||||
monitor_resolution_sizeentry =
|
||||
gtk_object_get_data (GTK_OBJECT (widget), "monitor_resolution_sizeentry");
|
||||
|
||||
gtk_widget_set_sensitive (resolution_xserver_label,
|
||||
GTK_TOGGLE_BUTTON (widget)->active);
|
||||
gtk_widget_set_sensitive (monitor_resolution_sizeentry,
|
||||
! GTK_TOGGLE_BUTTON (widget)->active);
|
||||
|
||||
if (GTK_TOGGLE_BUTTON (widget)->active)
|
||||
{
|
||||
|
|
@ -1013,8 +1002,8 @@ gimp_dialog_new (const gchar *title,
|
|||
allow_grow, allow_shrink, auto_shrink);
|
||||
|
||||
/* prepare the action_area */
|
||||
gtk_container_border_width (GTK_CONTAINER (GTK_DIALOG (dialog)->action_area),
|
||||
2);
|
||||
gtk_container_set_border_width
|
||||
(GTK_CONTAINER (GTK_DIALOG (dialog)->action_area), 2);
|
||||
gtk_box_set_homogeneous (GTK_BOX (GTK_DIALOG (dialog)->action_area), FALSE);
|
||||
|
||||
hbbox = gtk_hbutton_box_new ();
|
||||
|
|
@ -1339,31 +1328,35 @@ void
|
|||
file_pref_cmd_callback (GtkWidget *widget,
|
||||
gpointer client_data)
|
||||
{
|
||||
GtkWidget *ctree;
|
||||
gchar *titles[1];
|
||||
GtkCTreeNode *top_insert;
|
||||
GtkCTreeNode *child_insert;
|
||||
gint page_index;
|
||||
GtkWidget *ctree;
|
||||
gchar *titles[1];
|
||||
GtkCTreeNode *top_insert;
|
||||
GtkCTreeNode *child_insert;
|
||||
gint page_index;
|
||||
|
||||
GtkWidget *frame;
|
||||
GtkWidget *notebook;
|
||||
GtkWidget *vbox;
|
||||
GtkWidget *vbox2;
|
||||
GtkWidget *hbox;
|
||||
GtkWidget *abox;
|
||||
GtkWidget *button;
|
||||
GtkWidget *fileselection;
|
||||
GtkWidget *patheditor;
|
||||
GtkWidget *spinbutton;
|
||||
GtkWidget *combo;
|
||||
GtkWidget *comboitem;
|
||||
GtkWidget *optionmenu;
|
||||
GtkWidget *table;
|
||||
GtkWidget *label;
|
||||
GSList *group;
|
||||
GtkObject *adjustment;
|
||||
GtkWidget *frame;
|
||||
GtkWidget *notebook;
|
||||
GtkWidget *vbox;
|
||||
GtkWidget *vbox2;
|
||||
GtkWidget *hbox;
|
||||
GtkWidget *abox;
|
||||
GtkWidget *button;
|
||||
GtkWidget *fileselection;
|
||||
GtkWidget *patheditor;
|
||||
GtkWidget *spinbutton;
|
||||
GtkWidget *combo;
|
||||
GtkWidget *comboitem;
|
||||
GtkWidget *optionmenu;
|
||||
GtkWidget *table;
|
||||
GtkWidget *label;
|
||||
GtkObject *adjustment;
|
||||
GtkWidget *sizeentry;
|
||||
GtkWidget *sizeentry2;
|
||||
GSList *group;
|
||||
|
||||
int i;
|
||||
int i;
|
||||
int divided_mem_size;
|
||||
int mem_size_unit;
|
||||
|
||||
if (prefs_dlg)
|
||||
{
|
||||
|
|
@ -1435,24 +1428,6 @@ file_pref_cmd_callback (GtkWidget *widget,
|
|||
file_prefs_strset (&old_palette_path, edit_palette_path);
|
||||
file_prefs_strset (&old_gradient_path, edit_gradient_path);
|
||||
|
||||
tile_cache_size_unit = 1;
|
||||
for (i = 0; i < 3; i++)
|
||||
{
|
||||
if (edit_tile_cache_size % (tile_cache_size_unit * 1024) != 0)
|
||||
break;
|
||||
tile_cache_size_unit *= 1024;
|
||||
}
|
||||
divided_tile_cache_size = edit_tile_cache_size / tile_cache_size_unit;
|
||||
|
||||
max_new_image_size_unit = 1;
|
||||
for (i = 0; i < 3; i++)
|
||||
{
|
||||
if (max_new_image_size % (max_new_image_size_unit * 1024) != 0)
|
||||
break;
|
||||
max_new_image_size_unit *= 1024;
|
||||
}
|
||||
divided_max_new_image_size = max_new_image_size / max_new_image_size_unit;
|
||||
|
||||
/* Create the dialog */
|
||||
prefs_dlg =
|
||||
gimp_dialog_new (_("Preferences"), "gimp_preferences",
|
||||
|
|
@ -1520,37 +1495,39 @@ file_pref_cmd_callback (GtkWidget *widget,
|
|||
gtk_container_add (GTK_CONTAINER (frame), hbox);
|
||||
gtk_widget_show (hbox);
|
||||
|
||||
default_size_sizeentry = gimp_size_entry_new (2, default_units, "%p",
|
||||
FALSE, FALSE, TRUE, 75,
|
||||
GIMP_SIZE_ENTRY_UPDATE_SIZE);
|
||||
gimp_size_entry_set_resolution (GIMP_SIZE_ENTRY (default_size_sizeentry),
|
||||
0, default_xresolution, FALSE);
|
||||
gimp_size_entry_set_resolution (GIMP_SIZE_ENTRY (default_size_sizeentry),
|
||||
1, default_yresolution, FALSE);
|
||||
gimp_size_entry_set_refval_boundaries
|
||||
(GIMP_SIZE_ENTRY (default_size_sizeentry), 0,
|
||||
GIMP_MIN_IMAGE_SIZE, GIMP_MAX_IMAGE_SIZE);
|
||||
gimp_size_entry_set_refval_boundaries
|
||||
(GIMP_SIZE_ENTRY (default_size_sizeentry), 1,
|
||||
GIMP_MIN_IMAGE_SIZE, GIMP_MAX_IMAGE_SIZE);
|
||||
gimp_size_entry_set_refval (GIMP_SIZE_ENTRY (default_size_sizeentry), 0,
|
||||
default_width);
|
||||
gimp_size_entry_set_refval (GIMP_SIZE_ENTRY (default_size_sizeentry), 1,
|
||||
default_height);
|
||||
gimp_size_entry_attach_label (GIMP_SIZE_ENTRY (default_size_sizeentry),
|
||||
sizeentry =
|
||||
gimp_size_entry_new (2, default_units, "%p", FALSE, FALSE, TRUE, 75,
|
||||
GIMP_SIZE_ENTRY_UPDATE_SIZE);
|
||||
|
||||
gimp_size_entry_attach_label (GIMP_SIZE_ENTRY (sizeentry),
|
||||
_("Width"), 0, 1, 0.0);
|
||||
gimp_size_entry_attach_label (GIMP_SIZE_ENTRY (default_size_sizeentry),
|
||||
gimp_size_entry_attach_label (GIMP_SIZE_ENTRY (sizeentry),
|
||||
_("Height"), 0, 2, 0.0);
|
||||
gimp_size_entry_attach_label (GIMP_SIZE_ENTRY (default_size_sizeentry),
|
||||
gimp_size_entry_attach_label (GIMP_SIZE_ENTRY (sizeentry),
|
||||
_("Pixels"), 1, 4, 0.0);
|
||||
gtk_signal_connect (GTK_OBJECT (default_size_sizeentry), "unit_changed",
|
||||
(GtkSignalFunc)file_prefs_default_size_callback, NULL);
|
||||
gtk_signal_connect (GTK_OBJECT (default_size_sizeentry), "value_changed",
|
||||
(GtkSignalFunc)file_prefs_default_size_callback, NULL);
|
||||
gtk_signal_connect (GTK_OBJECT (default_size_sizeentry), "refval_changed",
|
||||
(GtkSignalFunc)file_prefs_default_size_callback, NULL);
|
||||
gtk_box_pack_start (GTK_BOX (hbox), default_size_sizeentry, FALSE, FALSE, 0);
|
||||
gtk_widget_show (default_size_sizeentry);
|
||||
|
||||
gimp_size_entry_set_resolution (GIMP_SIZE_ENTRY (sizeentry),
|
||||
0, default_xresolution, FALSE);
|
||||
gimp_size_entry_set_resolution (GIMP_SIZE_ENTRY (sizeentry),
|
||||
1, default_yresolution, FALSE);
|
||||
|
||||
gimp_size_entry_set_refval_boundaries
|
||||
(GIMP_SIZE_ENTRY (sizeentry), 0, GIMP_MIN_IMAGE_SIZE, GIMP_MAX_IMAGE_SIZE);
|
||||
gimp_size_entry_set_refval_boundaries
|
||||
(GIMP_SIZE_ENTRY (sizeentry), 1, GIMP_MIN_IMAGE_SIZE, GIMP_MAX_IMAGE_SIZE);
|
||||
|
||||
gimp_size_entry_set_refval (GIMP_SIZE_ENTRY (sizeentry), 0, default_width);
|
||||
gimp_size_entry_set_refval (GIMP_SIZE_ENTRY (sizeentry), 1, default_height);
|
||||
|
||||
gtk_signal_connect (GTK_OBJECT (sizeentry), "unit_changed",
|
||||
(GtkSignalFunc) file_prefs_default_size_callback, NULL);
|
||||
gtk_signal_connect (GTK_OBJECT (sizeentry), "value_changed",
|
||||
(GtkSignalFunc) file_prefs_default_size_callback, NULL);
|
||||
gtk_signal_connect (GTK_OBJECT (sizeentry), "refval_changed",
|
||||
(GtkSignalFunc) file_prefs_default_size_callback, NULL);
|
||||
|
||||
gtk_box_pack_start (GTK_BOX (hbox), sizeentry, FALSE, FALSE, 0);
|
||||
gtk_widget_show (sizeentry);
|
||||
|
||||
frame = gtk_frame_new (_("Default Image Resolution and Resolution Unit"));
|
||||
gtk_box_pack_start (GTK_BOX (vbox), frame, FALSE, FALSE, 0);
|
||||
|
|
@ -1561,49 +1538,49 @@ file_pref_cmd_callback (GtkWidget *widget,
|
|||
gtk_container_add (GTK_CONTAINER (frame), hbox);
|
||||
gtk_widget_show (hbox);
|
||||
|
||||
button = gimp_chain_button_new (GIMP_CHAIN_BOTTOM);
|
||||
default_resolution_sizeentry =
|
||||
sizeentry2 =
|
||||
gimp_size_entry_new (2, default_resolution_units, "Pixels/%s",
|
||||
FALSE, FALSE, TRUE, 75,
|
||||
GIMP_SIZE_ENTRY_UPDATE_RESOLUTION);
|
||||
gimp_size_entry_set_refval_boundaries
|
||||
(GIMP_SIZE_ENTRY (default_resolution_sizeentry), 0,
|
||||
GIMP_MIN_RESOLUTION, GIMP_MAX_RESOLUTION);
|
||||
gimp_size_entry_set_refval_boundaries
|
||||
(GIMP_SIZE_ENTRY (default_resolution_sizeentry), 1,
|
||||
GIMP_MIN_RESOLUTION, GIMP_MAX_RESOLUTION);
|
||||
gimp_size_entry_set_refval (GIMP_SIZE_ENTRY (default_resolution_sizeentry),
|
||||
0, default_xresolution);
|
||||
gimp_size_entry_set_refval (GIMP_SIZE_ENTRY (default_resolution_sizeentry),
|
||||
1, default_yresolution);
|
||||
gimp_size_entry_attach_label (GIMP_SIZE_ENTRY (default_resolution_sizeentry),
|
||||
_("Horizontal"), 0, 1, 0.0);
|
||||
gimp_size_entry_attach_label (GIMP_SIZE_ENTRY (default_resolution_sizeentry),
|
||||
_("Vertical"), 0, 2, 0.0);
|
||||
gimp_size_entry_attach_label (GIMP_SIZE_ENTRY (default_resolution_sizeentry),
|
||||
_("dpi"), 1, 4, 0.0);
|
||||
gtk_signal_connect (GTK_OBJECT (default_resolution_sizeentry),
|
||||
"unit_changed",
|
||||
(GtkSignalFunc)file_prefs_default_resolution_callback,
|
||||
button);
|
||||
gtk_signal_connect (GTK_OBJECT (default_resolution_sizeentry),
|
||||
"value_changed",
|
||||
(GtkSignalFunc)file_prefs_default_resolution_callback,
|
||||
button);
|
||||
gtk_signal_connect (GTK_OBJECT (default_resolution_sizeentry),
|
||||
"refval_changed",
|
||||
(GtkSignalFunc)file_prefs_default_resolution_callback,
|
||||
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),
|
||||
button, 1, 3, 3, 4);
|
||||
button = gimp_chain_button_new (GIMP_CHAIN_BOTTOM);
|
||||
if (ABS (default_xresolution - default_yresolution) < GIMP_MIN_RESOLUTION)
|
||||
gimp_chain_button_set_active (GIMP_CHAIN_BUTTON (button), TRUE);
|
||||
gtk_table_attach_defaults (GTK_TABLE (sizeentry2), button, 1, 3, 3, 4);
|
||||
gtk_widget_show (button);
|
||||
|
||||
gimp_size_entry_attach_label (GIMP_SIZE_ENTRY (sizeentry2),
|
||||
_("Horizontal"), 0, 1, 0.0);
|
||||
gimp_size_entry_attach_label (GIMP_SIZE_ENTRY (sizeentry2),
|
||||
_("Vertical"), 0, 2, 0.0);
|
||||
gimp_size_entry_attach_label (GIMP_SIZE_ENTRY (sizeentry2),
|
||||
_("dpi"), 1, 4, 0.0);
|
||||
|
||||
gtk_object_set_data (GTK_OBJECT (sizeentry2), "size_sizeentry", sizeentry);
|
||||
|
||||
gimp_size_entry_set_refval_boundaries
|
||||
(GIMP_SIZE_ENTRY (sizeentry2), 0, GIMP_MIN_RESOLUTION, GIMP_MAX_RESOLUTION);
|
||||
gimp_size_entry_set_refval_boundaries
|
||||
(GIMP_SIZE_ENTRY (sizeentry2), 1, GIMP_MIN_RESOLUTION, GIMP_MAX_RESOLUTION);
|
||||
|
||||
gimp_size_entry_set_refval (GIMP_SIZE_ENTRY (sizeentry2),
|
||||
0, default_xresolution);
|
||||
gimp_size_entry_set_refval (GIMP_SIZE_ENTRY (sizeentry2),
|
||||
1, default_yresolution);
|
||||
|
||||
gtk_signal_connect (GTK_OBJECT (sizeentry2), "unit_changed",
|
||||
(GtkSignalFunc) file_prefs_default_resolution_callback,
|
||||
button);
|
||||
gtk_signal_connect (GTK_OBJECT (sizeentry2), "value_changed",
|
||||
(GtkSignalFunc) file_prefs_default_resolution_callback,
|
||||
button);
|
||||
gtk_signal_connect (GTK_OBJECT (sizeentry2), "refval_changed",
|
||||
(GtkSignalFunc) file_prefs_default_resolution_callback,
|
||||
button);
|
||||
|
||||
gtk_box_pack_start (GTK_BOX (hbox), sizeentry2, FALSE, FALSE, 0);
|
||||
gtk_widget_show (sizeentry2);
|
||||
|
||||
hbox = gtk_hbox_new (FALSE, 2);
|
||||
gtk_box_pack_start (GTK_BOX (vbox), hbox, FALSE, FALSE, 0);
|
||||
gtk_widget_show (hbox);
|
||||
|
|
@ -1998,15 +1975,23 @@ file_pref_cmd_callback (GtkWidget *widget,
|
|||
gtk_widget_show (table);
|
||||
|
||||
/* The tile cache size */
|
||||
mem_size_unit = 1;
|
||||
for (i = 0; i < 3; i++)
|
||||
{
|
||||
if (edit_tile_cache_size % (mem_size_unit * 1024) != 0)
|
||||
break;
|
||||
mem_size_unit *= 1024;
|
||||
}
|
||||
divided_mem_size = edit_tile_cache_size / mem_size_unit;
|
||||
|
||||
hbox = gtk_hbox_new (FALSE, 2);
|
||||
spinbutton =
|
||||
gimp_spin_button_new (&adjustment,
|
||||
divided_tile_cache_size,
|
||||
gimp_spin_button_new (&adjustment, divided_mem_size,
|
||||
0.0, (4069.0 * 1024 * 1024), 1.0, 16.0, 0.0,
|
||||
1.0, 0.0);
|
||||
gtk_signal_connect (GTK_OBJECT (adjustment), "value_changed",
|
||||
(GtkSignalFunc) file_prefs_mem_size_callback,
|
||||
÷d_tile_cache_size);
|
||||
&edit_tile_cache_size);
|
||||
gtk_box_pack_start (GTK_BOX (hbox), spinbutton, FALSE, FALSE, 0);
|
||||
gtk_widget_show (spinbutton);
|
||||
|
||||
|
|
@ -2014,13 +1999,13 @@ file_pref_cmd_callback (GtkWidget *widget,
|
|||
gtk_object_set_data (GTK_OBJECT (adjustment), "mem_size",
|
||||
&edit_tile_cache_size);
|
||||
gtk_object_set_data (GTK_OBJECT (adjustment), "divided_mem_size",
|
||||
÷d_tile_cache_size);
|
||||
(gpointer) divided_mem_size);
|
||||
gtk_object_set_data (GTK_OBJECT (adjustment), "mem_size_unit",
|
||||
&tile_cache_size_unit);
|
||||
(gpointer) mem_size_unit);
|
||||
|
||||
optionmenu =
|
||||
gimp_option_menu_new (file_prefs_mem_size_unit_callback,
|
||||
(gpointer) tile_cache_size_unit,
|
||||
(gpointer) mem_size_unit,
|
||||
_("Bytes"), adjustment, (gpointer) 1,
|
||||
_("KiloBytes"), adjustment, (gpointer) 1024,
|
||||
_("MegaBytes"), adjustment, (gpointer) (1024*1024),
|
||||
|
|
@ -2031,15 +2016,23 @@ file_pref_cmd_callback (GtkWidget *widget,
|
|||
_("Tile Cache Size:"), 1.0, 0.5, hbox, TRUE);
|
||||
|
||||
/* The maximum size of a new image */
|
||||
mem_size_unit = 1;
|
||||
for (i = 0; i < 3; i++)
|
||||
{
|
||||
if (max_new_image_size % (mem_size_unit * 1024) != 0)
|
||||
break;
|
||||
mem_size_unit *= 1024;
|
||||
}
|
||||
divided_mem_size = max_new_image_size / mem_size_unit;
|
||||
|
||||
hbox = gtk_hbox_new (FALSE, 2);
|
||||
spinbutton =
|
||||
gimp_spin_button_new (&adjustment,
|
||||
divided_max_new_image_size,
|
||||
gimp_spin_button_new (&adjustment, divided_mem_size,
|
||||
0.0, (4069.0 * 1024 * 1024), 1.0, 16.0, 0.0,
|
||||
1.0, 0.0);
|
||||
gtk_signal_connect (GTK_OBJECT (adjustment), "value_changed",
|
||||
(GtkSignalFunc) file_prefs_mem_size_callback,
|
||||
÷d_max_new_image_size);
|
||||
&max_new_image_size);
|
||||
gtk_box_pack_start (GTK_BOX (hbox), spinbutton, FALSE, FALSE, 0);
|
||||
gtk_widget_show (spinbutton);
|
||||
|
||||
|
|
@ -2047,13 +2040,13 @@ file_pref_cmd_callback (GtkWidget *widget,
|
|||
gtk_object_set_data (GTK_OBJECT (adjustment), "mem_size",
|
||||
&max_new_image_size);
|
||||
gtk_object_set_data (GTK_OBJECT (adjustment), "divided_mem_size",
|
||||
÷d_max_new_image_size);
|
||||
(gpointer) divided_mem_size);
|
||||
gtk_object_set_data (GTK_OBJECT (adjustment), "mem_size_unit",
|
||||
&max_new_image_size_unit);
|
||||
(gpointer) mem_size_unit);
|
||||
|
||||
optionmenu =
|
||||
gimp_option_menu_new (file_prefs_mem_size_unit_callback,
|
||||
(gpointer) max_new_image_size_unit,
|
||||
(gpointer) mem_size_unit,
|
||||
_("Bytes"), adjustment, (gpointer) 1,
|
||||
_("KiloBytes"), adjustment, (gpointer) 1024,
|
||||
_("MegaBytes"), adjustment, (gpointer) (1024*1024),
|
||||
|
|
@ -2192,15 +2185,6 @@ file_pref_cmd_callback (GtkWidget *widget,
|
|||
gtk_container_add (GTK_CONTAINER (frame), vbox2);
|
||||
gtk_widget_show (vbox2);
|
||||
|
||||
group = NULL;
|
||||
button = gtk_radio_button_new_with_label (group, _("From X Server"));
|
||||
group = gtk_radio_button_group (GTK_RADIO_BUTTON (button));
|
||||
gtk_signal_connect (GTK_OBJECT (button), "toggled",
|
||||
GTK_SIGNAL_FUNC (file_prefs_res_source_callback),
|
||||
NULL);
|
||||
gtk_box_pack_start (GTK_BOX (vbox2), button, FALSE, FALSE, 0);
|
||||
gtk_widget_show (button);
|
||||
|
||||
{
|
||||
gdouble xres, yres;
|
||||
gchar buf[80];
|
||||
|
|
@ -2209,62 +2193,76 @@ file_pref_cmd_callback (GtkWidget *widget,
|
|||
|
||||
g_snprintf (buf, sizeof (buf), _("(Currently %d x %d dpi)"),
|
||||
(int) (xres + 0.5), (int) (yres + 0.5));
|
||||
resolution_xserver_label = gtk_label_new (buf);
|
||||
gtk_box_pack_start (GTK_BOX (vbox2), resolution_xserver_label,
|
||||
FALSE, FALSE, 0);
|
||||
gtk_widget_show (resolution_xserver_label);
|
||||
label = gtk_label_new (buf);
|
||||
}
|
||||
|
||||
abox = gtk_alignment_new (0.5, 0.5, 0.0, 0.0);
|
||||
|
||||
sizeentry =
|
||||
gimp_size_entry_new (2, UNIT_INCH, "Pixels/%s", FALSE, FALSE, TRUE, 75,
|
||||
GIMP_SIZE_ENTRY_UPDATE_RESOLUTION);
|
||||
|
||||
button = gimp_chain_button_new (GIMP_CHAIN_BOTTOM);
|
||||
if (ABS (monitor_xres - monitor_yres) < GIMP_MIN_RESOLUTION)
|
||||
gimp_chain_button_set_active (GIMP_CHAIN_BUTTON (button), TRUE);
|
||||
gtk_table_attach_defaults (GTK_TABLE (sizeentry), button, 1, 3, 3, 4);
|
||||
gtk_widget_show (button);
|
||||
|
||||
gimp_size_entry_attach_label (GIMP_SIZE_ENTRY (sizeentry),
|
||||
_("Horizontal"), 0, 1, 0.0);
|
||||
gimp_size_entry_attach_label (GIMP_SIZE_ENTRY (sizeentry),
|
||||
_("Vertical"), 0, 2, 0.0);
|
||||
gimp_size_entry_attach_label (GIMP_SIZE_ENTRY (sizeentry),
|
||||
_("dpi"), 1, 4, 0.0);
|
||||
|
||||
gimp_size_entry_set_refval_boundaries (GIMP_SIZE_ENTRY (sizeentry), 0,
|
||||
GIMP_MIN_RESOLUTION,
|
||||
GIMP_MAX_RESOLUTION);
|
||||
gimp_size_entry_set_refval_boundaries (GIMP_SIZE_ENTRY (sizeentry), 1,
|
||||
GIMP_MIN_RESOLUTION,
|
||||
GIMP_MAX_RESOLUTION);
|
||||
|
||||
gimp_size_entry_set_refval (GIMP_SIZE_ENTRY (sizeentry), 0, monitor_xres);
|
||||
gimp_size_entry_set_refval (GIMP_SIZE_ENTRY (sizeentry), 1, monitor_yres);
|
||||
|
||||
gtk_signal_connect (GTK_OBJECT (sizeentry), "value_changed",
|
||||
(GtkSignalFunc) file_prefs_monitor_resolution_callback,
|
||||
button);
|
||||
gtk_signal_connect (GTK_OBJECT (sizeentry), "refval_changed",
|
||||
(GtkSignalFunc) file_prefs_monitor_resolution_callback,
|
||||
button);
|
||||
|
||||
gtk_container_add (GTK_CONTAINER (abox), sizeentry);
|
||||
gtk_widget_show (sizeentry);
|
||||
|
||||
gtk_widget_set_sensitive (sizeentry, !using_xserver_resolution);
|
||||
|
||||
group = NULL;
|
||||
button = gtk_radio_button_new_with_label (group, _("From X Server"));
|
||||
group = gtk_radio_button_group (GTK_RADIO_BUTTON (button));
|
||||
gtk_signal_connect (GTK_OBJECT (button), "toggled",
|
||||
GTK_SIGNAL_FUNC (file_prefs_res_source_callback),
|
||||
NULL);
|
||||
gtk_object_set_data (GTK_OBJECT (button), "resolution_xserver_label",
|
||||
label);
|
||||
gtk_object_set_data (GTK_OBJECT (button), "monitor_resolution_sizeentry",
|
||||
sizeentry);
|
||||
gtk_box_pack_start (GTK_BOX (vbox2), button, FALSE, FALSE, 0);
|
||||
gtk_widget_show (button);
|
||||
|
||||
gtk_box_pack_start (GTK_BOX (vbox2), label, FALSE, FALSE, 0);
|
||||
gtk_widget_show (label);
|
||||
|
||||
button = gtk_radio_button_new_with_label (group, _("Manually:"));
|
||||
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)
|
||||
gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (button), TRUE);
|
||||
|
||||
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);
|
||||
|
||||
button = gimp_chain_button_new (GIMP_CHAIN_BOTTOM);
|
||||
monitor_resolution_sizeentry =
|
||||
gimp_size_entry_new (2, UNIT_INCH, "Pixels/%s", FALSE, FALSE, TRUE, 75,
|
||||
GIMP_SIZE_ENTRY_UPDATE_RESOLUTION);
|
||||
gimp_size_entry_set_refval_boundaries
|
||||
(GIMP_SIZE_ENTRY (monitor_resolution_sizeentry), 0,
|
||||
GIMP_MIN_RESOLUTION, GIMP_MAX_RESOLUTION);
|
||||
gimp_size_entry_set_refval_boundaries
|
||||
(GIMP_SIZE_ENTRY (monitor_resolution_sizeentry), 1,
|
||||
GIMP_MIN_RESOLUTION, GIMP_MAX_RESOLUTION);
|
||||
gimp_size_entry_set_refval (GIMP_SIZE_ENTRY (monitor_resolution_sizeentry),
|
||||
0, monitor_xres);
|
||||
gimp_size_entry_set_refval (GIMP_SIZE_ENTRY (monitor_resolution_sizeentry),
|
||||
1, monitor_yres);
|
||||
gimp_size_entry_attach_label (GIMP_SIZE_ENTRY (monitor_resolution_sizeentry),
|
||||
_("Horizontal"), 0, 1, 0.0);
|
||||
gimp_size_entry_attach_label (GIMP_SIZE_ENTRY (monitor_resolution_sizeentry),
|
||||
_("Vertical"), 0, 2, 0.0);
|
||||
gimp_size_entry_attach_label (GIMP_SIZE_ENTRY (monitor_resolution_sizeentry),
|
||||
_("dpi"), 1, 4, 0.0);
|
||||
gtk_signal_connect (GTK_OBJECT (monitor_resolution_sizeentry),
|
||||
"value_changed",
|
||||
(GtkSignalFunc)file_prefs_monitor_resolution_callback,
|
||||
button);
|
||||
gtk_signal_connect (GTK_OBJECT (monitor_resolution_sizeentry),
|
||||
"refval_changed",
|
||||
(GtkSignalFunc)file_prefs_monitor_resolution_callback,
|
||||
button);
|
||||
gtk_container_add (GTK_CONTAINER (abox), monitor_resolution_sizeentry);
|
||||
gtk_widget_show (monitor_resolution_sizeentry);
|
||||
|
||||
if (ABS (monitor_xres - monitor_yres) < GIMP_MIN_RESOLUTION)
|
||||
gimp_chain_button_set_active (GIMP_CHAIN_BUTTON (button), TRUE);
|
||||
gtk_table_attach_defaults (GTK_TABLE (monitor_resolution_sizeentry),
|
||||
button, 1, 3, 3, 4);
|
||||
gtk_widget_show (button);
|
||||
|
||||
gtk_widget_set_sensitive (monitor_resolution_sizeentry,
|
||||
!using_xserver_resolution);
|
||||
if (!using_xserver_resolution)
|
||||
gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (button), TRUE);
|
||||
|
||||
/* Directories */
|
||||
vbox = file_prefs_notebook_append_page (GTK_NOTEBOOK (notebook),
|
||||
|
|
|
|||
|
|
@ -56,22 +56,22 @@ struct _ResizePrivate
|
|||
GtkObject *object;
|
||||
guint object_destroy_handler;
|
||||
|
||||
double ratio;
|
||||
int old_width, old_height;
|
||||
double old_res_x, old_res_y;
|
||||
int area_width, area_height;
|
||||
int start_x, start_y;
|
||||
int orig_x, orig_y;
|
||||
gdouble ratio;
|
||||
gint old_width, old_height;
|
||||
gdouble old_res_x, old_res_y;
|
||||
gint area_width, area_height;
|
||||
gint start_x, start_y;
|
||||
gint orig_x, orig_y;
|
||||
};
|
||||
|
||||
static void resize_draw (Resize *);
|
||||
static void unit_update (GtkWidget *w, gpointer data);
|
||||
static int resize_bound_off_x (Resize *, int);
|
||||
static int resize_bound_off_y (Resize *, int);
|
||||
static gint resize_bound_off_x (Resize *, gint);
|
||||
static gint resize_bound_off_y (Resize *, gint);
|
||||
static void orig_labels_update (GtkWidget *w, gpointer data);
|
||||
static void size_callback (GtkWidget *w, gpointer data);
|
||||
static void ratio_callback (GtkWidget *w, gpointer data);
|
||||
static void size_update (Resize *, double, double, double, double);
|
||||
static void size_update (Resize *, gdouble, gdouble, gdouble, gdouble);
|
||||
static void offset_update (GtkWidget *w, gpointer data);
|
||||
static gint resize_events (GtkWidget *area, GdkEvent *event);
|
||||
static void printsize_update (GtkWidget *w, gpointer data);
|
||||
|
|
@ -109,7 +109,7 @@ resize_widget_new (ResizeType type,
|
|||
GtkWidget *alignment;
|
||||
GtkObject *adjustment;
|
||||
|
||||
static ActionAreaItem action_items[2] =
|
||||
static ActionAreaItem action_items[] =
|
||||
{
|
||||
{ N_("OK"), NULL, NULL, NULL },
|
||||
{ N_("Cancel"), NULL, NULL, NULL }
|
||||
|
|
@ -196,13 +196,14 @@ resize_widget_new (ResizeType type,
|
|||
|
||||
/* handle the image disappearing under our feet */
|
||||
if (object)
|
||||
{
|
||||
const char *signame;
|
||||
signame = (target == ResizeLayer) ? "removed" : "destroy";
|
||||
private->object = object;
|
||||
private->object_destroy_handler =
|
||||
gtk_signal_connect(GTK_OBJECT (object), signame, cancel_cb, user_data);
|
||||
}
|
||||
{
|
||||
const gchar *signame;
|
||||
|
||||
signame = (target == ResizeLayer) ? "removed" : "destroy";
|
||||
private->object = object;
|
||||
private->object_destroy_handler =
|
||||
gtk_signal_connect(GTK_OBJECT (object), signame, cancel_cb, user_data);
|
||||
}
|
||||
|
||||
/* the action area */
|
||||
action_items[0].user_data = user_data;
|
||||
|
|
@ -292,6 +293,9 @@ resize_widget_new (ResizeType type,
|
|||
GTK_SHRINK | GTK_FILL, GTK_SHRINK | GTK_FILL, 0, 0);
|
||||
gtk_widget_show (private->size_se);
|
||||
|
||||
if (dot_for_dot)
|
||||
gimp_size_entry_set_unit (GIMP_SIZE_ENTRY (private->size_se), UNIT_PIXEL);
|
||||
|
||||
gimp_size_entry_set_resolution (GIMP_SIZE_ENTRY (private->size_se), 0,
|
||||
resolution_x, FALSE);
|
||||
gimp_size_entry_set_resolution (GIMP_SIZE_ENTRY (private->size_se), 1,
|
||||
|
|
@ -310,9 +314,6 @@ resize_widget_new (ResizeType type,
|
|||
gimp_size_entry_set_refval (GIMP_SIZE_ENTRY (private->size_se), 0, width);
|
||||
gimp_size_entry_set_refval (GIMP_SIZE_ENTRY (private->size_se), 1, height);
|
||||
|
||||
if (dot_for_dot)
|
||||
gimp_size_entry_set_unit (GIMP_SIZE_ENTRY (private->size_se), UNIT_PIXEL);
|
||||
|
||||
gtk_signal_connect (GTK_OBJECT (private->size_se), "value_changed",
|
||||
(GtkSignalFunc) size_callback,
|
||||
resize);
|
||||
|
|
@ -441,6 +442,10 @@ resize_widget_new (ResizeType type,
|
|||
GTK_SHRINK | GTK_FILL, GTK_SHRINK | GTK_FILL, 0, 0);
|
||||
gtk_widget_show (private->offset_se);
|
||||
|
||||
if (dot_for_dot)
|
||||
gimp_size_entry_set_unit (GIMP_SIZE_ENTRY (private->offset_se),
|
||||
UNIT_PIXEL);
|
||||
|
||||
gimp_size_entry_set_resolution (GIMP_SIZE_ENTRY (private->offset_se), 0,
|
||||
resolution_x, FALSE);
|
||||
gimp_size_entry_set_resolution (GIMP_SIZE_ENTRY (private->offset_se), 1,
|
||||
|
|
@ -454,13 +459,8 @@ resize_widget_new (ResizeType type,
|
|||
gimp_size_entry_set_refval (GIMP_SIZE_ENTRY (private->offset_se), 0, 0);
|
||||
gimp_size_entry_set_refval (GIMP_SIZE_ENTRY (private->offset_se), 1, 0);
|
||||
|
||||
if (dot_for_dot)
|
||||
gimp_size_entry_set_unit (GIMP_SIZE_ENTRY (private->offset_se),
|
||||
UNIT_PIXEL);
|
||||
|
||||
gtk_signal_connect (GTK_OBJECT (private->offset_se),
|
||||
"value_changed", (GtkSignalFunc) offset_update,
|
||||
resize);
|
||||
gtk_signal_connect (GTK_OBJECT (private->offset_se), "value_changed",
|
||||
(GtkSignalFunc) offset_update, resize);
|
||||
|
||||
gtk_widget_show (table);
|
||||
|
||||
|
|
@ -746,9 +746,9 @@ resize_draw (Resize *resize)
|
|||
}
|
||||
}
|
||||
|
||||
static int
|
||||
static gint
|
||||
resize_bound_off_x (Resize *resize,
|
||||
int off_x)
|
||||
gint off_x)
|
||||
{
|
||||
ResizePrivate *private;
|
||||
|
||||
|
|
@ -762,9 +762,9 @@ resize_bound_off_x (Resize *resize,
|
|||
return off_x;
|
||||
}
|
||||
|
||||
static int
|
||||
static gint
|
||||
resize_bound_off_y (Resize *resize,
|
||||
int off_y)
|
||||
gint off_y)
|
||||
{
|
||||
ResizePrivate *private;
|
||||
|
||||
|
|
@ -800,7 +800,7 @@ orig_labels_update (GtkWidget *w,
|
|||
|
||||
if (label_unit) /* unit != UNIT_PIXEL */
|
||||
{
|
||||
float unit_factor = gimp_unit_get_factor (label_unit);
|
||||
double unit_factor = gimp_unit_get_factor (label_unit);
|
||||
|
||||
g_snprintf (format_buf, 16, "%%.%df %s",
|
||||
gimp_unit_get_digits (label_unit) + 1,
|
||||
|
|
@ -837,18 +837,18 @@ offset_update (GtkWidget *w,
|
|||
{
|
||||
Resize *resize;
|
||||
ResizePrivate *private;
|
||||
int offset_x;
|
||||
int offset_y;
|
||||
gint offset_x;
|
||||
gint offset_y;
|
||||
|
||||
resize = (Resize *) data;
|
||||
private = (ResizePrivate *) resize->private_part;
|
||||
|
||||
offset_x =
|
||||
gimp_size_entry_get_refval (GIMP_SIZE_ENTRY (private->offset_se), 0);
|
||||
offset_x = (gint)
|
||||
(gimp_size_entry_get_refval (GIMP_SIZE_ENTRY (private->offset_se), 0) + 0.5);
|
||||
offset_x = resize_bound_off_x (resize, offset_x);
|
||||
|
||||
offset_y =
|
||||
gimp_size_entry_get_refval (GIMP_SIZE_ENTRY (private->offset_se), 1);
|
||||
offset_y = (gint)
|
||||
(gimp_size_entry_get_refval (GIMP_SIZE_ENTRY (private->offset_se), 1) + 0.5);
|
||||
offset_y = resize_bound_off_y (resize, offset_y);
|
||||
|
||||
if ((offset_x != resize->offset_x) ||
|
||||
|
|
@ -882,8 +882,6 @@ size_callback (GtkWidget *w,
|
|||
|
||||
if (gimp_chain_button_get_active (GIMP_CHAIN_BUTTON (private->constrain)))
|
||||
{
|
||||
/* compare ratios, not sizes because we need float values
|
||||
*/
|
||||
if (ratio_x != resize->ratio_x)
|
||||
{
|
||||
ratio_y = ratio_x;
|
||||
|
|
@ -911,7 +909,7 @@ ratio_callback (GtkWidget *w,
|
|||
double height;
|
||||
double ratio_x;
|
||||
double ratio_y;
|
||||
|
||||
|
||||
resize = (Resize *) data;
|
||||
private = (ResizePrivate *) resize->private_part;
|
||||
|
||||
|
|
@ -952,8 +950,8 @@ size_update (Resize *resize,
|
|||
|
||||
private = (ResizePrivate *) resize->private_part;
|
||||
|
||||
resize->width = width;
|
||||
resize->height = height;
|
||||
resize->width = (gint) (width + 0.5);
|
||||
resize->height = (gint) (height + 0.5);
|
||||
|
||||
resize->ratio_x = ratio_x;
|
||||
resize->ratio_y = ratio_y;
|
||||
|
|
|
|||
|
|
@ -42,21 +42,21 @@ struct _Resize
|
|||
ResizeType type;
|
||||
ResizeTarget target;
|
||||
|
||||
int width;
|
||||
int height;
|
||||
gint width;
|
||||
gint height;
|
||||
|
||||
double resolution_x;
|
||||
double resolution_y;
|
||||
gdouble resolution_x;
|
||||
gdouble resolution_y;
|
||||
GUnit unit;
|
||||
|
||||
double ratio_x;
|
||||
double ratio_y;
|
||||
gdouble ratio_x;
|
||||
gdouble ratio_y;
|
||||
|
||||
int offset_x;
|
||||
int offset_y;
|
||||
gint offset_x;
|
||||
gint offset_y;
|
||||
|
||||
/* Don't touch this :) */
|
||||
void * private_part;
|
||||
void * private_part;
|
||||
};
|
||||
|
||||
/* If resolution_x is zero, then don't show resolution modification
|
||||
|
|
|
|||
|
|
@ -34,7 +34,7 @@ static gint info_dialog_delete_callback (GtkWidget *, GdkEvent *, gpointer);
|
|||
static void
|
||||
info_field_new (InfoDialog *idialog,
|
||||
InfoFieldType field_type,
|
||||
char *title,
|
||||
gchar *title,
|
||||
GtkWidget *widget,
|
||||
GtkObject *obj,
|
||||
void *value_ptr,
|
||||
|
|
@ -43,7 +43,7 @@ info_field_new (InfoDialog *idialog,
|
|||
{
|
||||
GtkWidget *label;
|
||||
InfoField *field;
|
||||
int row;
|
||||
int row;
|
||||
|
||||
field = (InfoField *) g_malloc (sizeof (InfoField));
|
||||
|
||||
|
|
@ -52,12 +52,12 @@ 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,
|
||||
gtk_table_attach (GTK_TABLE (idialog->info_table), label,
|
||||
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,
|
||||
gtk_table_attach_defaults (GTK_TABLE (idialog->info_table), widget,
|
||||
1, 2, row - 1, row);
|
||||
gtk_widget_show (widget);
|
||||
|
||||
|
|
@ -105,14 +105,14 @@ update_field (InfoField *field)
|
|||
case INFO_SCALE:
|
||||
case INFO_SPINBUTTON:
|
||||
gtk_adjustment_set_value (GTK_ADJUSTMENT (field->obj),
|
||||
*((gfloat*) field->value_ptr));
|
||||
*((gdouble*) field->value_ptr));
|
||||
break;
|
||||
|
||||
case INFO_SIZEENTRY:
|
||||
num = GIMP_SIZE_ENTRY (field->obj)->number_of_fields;
|
||||
for (i = 0; i < num; i++)
|
||||
gimp_size_entry_set_refval (GIMP_SIZE_ENTRY (field->obj), i,
|
||||
((gfloat*) field->value_ptr)[i]);
|
||||
((gdouble*) field->value_ptr)[i]);
|
||||
break;
|
||||
|
||||
default:
|
||||
|
|
@ -121,7 +121,17 @@ update_field (InfoField *field)
|
|||
}
|
||||
}
|
||||
|
||||
/* function definitions */
|
||||
static gint
|
||||
info_dialog_delete_callback (GtkWidget *w,
|
||||
GdkEvent *e,
|
||||
gpointer client_data)
|
||||
{
|
||||
info_dialog_popdown ((InfoDialog *) client_data);
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
/* public functions */
|
||||
|
||||
InfoDialog *
|
||||
info_dialog_new (char *title)
|
||||
|
|
@ -189,6 +199,45 @@ info_dialog_free (InfoDialog *idialog)
|
|||
g_free (idialog);
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
info_dialog_popup (InfoDialog *idialog)
|
||||
{
|
||||
if (!idialog)
|
||||
return;
|
||||
|
||||
if (!GTK_WIDGET_VISIBLE (idialog->shell))
|
||||
gtk_widget_show (idialog->shell);
|
||||
|
||||
}
|
||||
|
||||
void
|
||||
info_dialog_popdown (InfoDialog *idialog)
|
||||
{
|
||||
if (!idialog)
|
||||
return;
|
||||
|
||||
if (GTK_WIDGET_VISIBLE (idialog->shell))
|
||||
gtk_widget_hide (idialog->shell);
|
||||
}
|
||||
|
||||
void
|
||||
info_dialog_update (InfoDialog *idialog)
|
||||
{
|
||||
GSList *list;
|
||||
|
||||
if (!idialog)
|
||||
return;
|
||||
|
||||
list = idialog->field_list;
|
||||
|
||||
while (list)
|
||||
{
|
||||
update_field ((InfoField *) list->data);
|
||||
list = g_slist_next (list);
|
||||
}
|
||||
}
|
||||
|
||||
GtkWidget *
|
||||
info_dialog_add_label (InfoDialog *idialog,
|
||||
char *title,
|
||||
|
|
@ -234,8 +283,8 @@ info_dialog_add_entry (InfoDialog *idialog,
|
|||
|
||||
GtkWidget *
|
||||
info_dialog_add_scale (InfoDialog *idialog,
|
||||
char *title,
|
||||
float *value_ptr,
|
||||
gchar *title,
|
||||
gdouble *value_ptr,
|
||||
gfloat lower,
|
||||
gfloat upper,
|
||||
gfloat step_increment,
|
||||
|
|
@ -272,7 +321,7 @@ info_dialog_add_scale (InfoDialog *idialog,
|
|||
GtkWidget *
|
||||
info_dialog_add_spinbutton (InfoDialog *idialog,
|
||||
gchar *title,
|
||||
gfloat *value_ptr,
|
||||
gdouble *value_ptr,
|
||||
gfloat lower,
|
||||
gfloat upper,
|
||||
gfloat step_increment,
|
||||
|
|
@ -316,7 +365,7 @@ info_dialog_add_spinbutton (InfoDialog *idialog,
|
|||
GtkWidget *
|
||||
info_dialog_add_sizeentry (InfoDialog *idialog,
|
||||
gchar *title,
|
||||
gfloat *value_ptr,
|
||||
gdouble *value_ptr,
|
||||
gint nfields,
|
||||
GUnit unit,
|
||||
gchar *unit_format,
|
||||
|
|
@ -356,51 +405,3 @@ info_dialog_add_sizeentry (InfoDialog *idialog,
|
|||
|
||||
return sizeentry;
|
||||
}
|
||||
|
||||
void
|
||||
info_dialog_popup (InfoDialog *idialog)
|
||||
{
|
||||
if (!idialog)
|
||||
return;
|
||||
|
||||
if (!GTK_WIDGET_VISIBLE (idialog->shell))
|
||||
gtk_widget_show (idialog->shell);
|
||||
|
||||
}
|
||||
|
||||
void
|
||||
info_dialog_popdown (InfoDialog *idialog)
|
||||
{
|
||||
if (!idialog)
|
||||
return;
|
||||
|
||||
if (GTK_WIDGET_VISIBLE (idialog->shell))
|
||||
gtk_widget_hide (idialog->shell);
|
||||
}
|
||||
|
||||
void
|
||||
info_dialog_update (InfoDialog *idialog)
|
||||
{
|
||||
GSList *list;
|
||||
|
||||
if (!idialog)
|
||||
return;
|
||||
|
||||
list = idialog->field_list;
|
||||
|
||||
while (list)
|
||||
{
|
||||
update_field ((InfoField *) list->data);
|
||||
list = g_slist_next (list);
|
||||
}
|
||||
}
|
||||
|
||||
static gint
|
||||
info_dialog_delete_callback (GtkWidget *w,
|
||||
GdkEvent *e,
|
||||
gpointer client_data)
|
||||
{
|
||||
info_dialog_popdown ((InfoDialog *) client_data);
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -79,7 +79,7 @@ GtkWidget *info_dialog_add_entry (InfoDialog *idialog,
|
|||
|
||||
GtkWidget *info_dialog_add_scale (InfoDialog *idialog,
|
||||
gchar *title,
|
||||
gfloat *value_ptr,
|
||||
gdouble *value_ptr,
|
||||
gfloat lower,
|
||||
gfloat upper,
|
||||
gfloat step_increment,
|
||||
|
|
@ -91,7 +91,7 @@ GtkWidget *info_dialog_add_scale (InfoDialog *idialog,
|
|||
|
||||
GtkWidget *info_dialog_add_spinbutton (InfoDialog *idialog,
|
||||
gchar *title,
|
||||
gfloat *value_ptr,
|
||||
gdouble *value_ptr,
|
||||
gfloat lower,
|
||||
gfloat upper,
|
||||
gfloat step_increment,
|
||||
|
|
@ -104,7 +104,7 @@ GtkWidget *info_dialog_add_spinbutton (InfoDialog *idialog,
|
|||
|
||||
GtkWidget *info_dialog_add_sizeentry (InfoDialog *idialog,
|
||||
gchar *title,
|
||||
gfloat *value_ptr,
|
||||
gdouble *value_ptr,
|
||||
gint nfields,
|
||||
GUnit unit,
|
||||
gchar *unit_format,
|
||||
|
|
|
|||
|
|
@ -615,9 +615,9 @@ create_display_shell (GDisplay* gdisp,
|
|||
gdisp);
|
||||
|
||||
/* the vbox, table containing all widgets */
|
||||
vbox = gtk_vbox_new(0,2);
|
||||
gtk_container_add(GTK_CONTAINER (gdisp->shell), vbox);
|
||||
gtk_container_set_border_width(GTK_CONTAINER (vbox), 2);
|
||||
vbox = gtk_vbox_new (FALSE, 2);
|
||||
gtk_container_add (GTK_CONTAINER (gdisp->shell), vbox);
|
||||
gtk_container_set_border_width (GTK_CONTAINER (vbox), 2);
|
||||
|
||||
/* the table widget is pretty stupid so we need 2 tables
|
||||
or it treats rulers and canvas with equal weight when
|
||||
|
|
@ -633,8 +633,8 @@ create_display_shell (GDisplay* gdisp,
|
|||
|
||||
|
||||
/* hbox for statusbar area */
|
||||
gdisp->statusarea = gtk_hbox_new(0,2);
|
||||
gtk_box_pack_start(GTK_BOX (vbox), gdisp->statusarea, FALSE, TRUE, 0);
|
||||
gdisp->statusarea = gtk_hbox_new (FALSE, 2);
|
||||
gtk_box_pack_start (GTK_BOX (vbox), gdisp->statusarea, FALSE, TRUE, 0);
|
||||
|
||||
/* scrollbars, rulers, canvas, menu popup button */
|
||||
gdisp->origin = gtk_button_new ();
|
||||
|
|
@ -815,9 +815,7 @@ static void int_query_box_ok_callback (GtkWidget *, gpointer);
|
|||
static void double_query_box_ok_callback (GtkWidget *, gpointer);
|
||||
static void size_query_box_ok_callback (GtkWidget *, gpointer);
|
||||
|
||||
/* create a generic query box without any entry widget
|
||||
*/
|
||||
|
||||
/* create a generic query box without any entry widget */
|
||||
QueryBox *
|
||||
create_query_box (gchar *title,
|
||||
gchar *message,
|
||||
|
|
@ -847,8 +845,7 @@ create_query_box (gchar *title,
|
|||
(GtkSignalFunc) query_box_delete_callback,
|
||||
query_box);
|
||||
|
||||
/* if we are associated with an object, connect to the provided signal
|
||||
*/
|
||||
/* if we are associated with an object, connect to the provided signal */
|
||||
if (object && GTK_IS_OBJECT (object) && signal)
|
||||
gtk_signal_connect (GTK_OBJECT (object), signal,
|
||||
(GtkSignalFunc) query_box_cancel_callback,
|
||||
|
|
@ -865,7 +862,7 @@ create_query_box (gchar *title,
|
|||
gtk_container_add (GTK_CONTAINER (GTK_DIALOG (qbox)->vbox), vbox);
|
||||
gtk_widget_show (vbox);
|
||||
|
||||
label = gtk_label_new (gettext(message));
|
||||
label = gtk_label_new (gettext (message));
|
||||
gtk_box_pack_start (GTK_BOX (vbox), label, TRUE, FALSE, 0);
|
||||
gtk_widget_show (label);
|
||||
|
||||
|
|
@ -901,7 +898,7 @@ query_string_box (gchar *title,
|
|||
entry = gtk_entry_new ();
|
||||
gtk_box_pack_start (GTK_BOX (query_box->vbox), entry, TRUE, TRUE, 0);
|
||||
if (initial)
|
||||
gtk_entry_set_text (GTK_ENTRY (entry), gettext(initial));
|
||||
gtk_entry_set_text (GTK_ENTRY (entry), gettext (initial));
|
||||
gtk_widget_grab_focus (entry);
|
||||
gtk_widget_show (entry);
|
||||
|
||||
|
|
@ -932,9 +929,8 @@ query_int_box (gchar *title,
|
|||
gtk_signal_connect (GTK_OBJECT (query_box->ok_button), "clicked",
|
||||
(GtkSignalFunc) int_query_box_ok_callback,
|
||||
query_box);
|
||||
|
||||
adjustment = GTK_ADJUSTMENT (gtk_adjustment_new (initial, lower, upper,
|
||||
1, 10, 0));
|
||||
adjustment =
|
||||
GTK_ADJUSTMENT (gtk_adjustment_new (initial, lower, upper, 1, 10, 0));
|
||||
spinbutton = gtk_spin_button_new (adjustment, 1.0, 0);
|
||||
gtk_box_pack_start (GTK_BOX (query_box->vbox), spinbutton, TRUE, TRUE, 0);
|
||||
gtk_widget_grab_focus (spinbutton);
|
||||
|
|
@ -948,16 +944,16 @@ query_int_box (gchar *title,
|
|||
}
|
||||
|
||||
GtkWidget *
|
||||
query_double_box (gchar *title,
|
||||
gchar *message,
|
||||
gdouble initial,
|
||||
gdouble lower,
|
||||
gdouble upper,
|
||||
gint digits,
|
||||
GtkObject *object,
|
||||
gchar *signal,
|
||||
QueryFunc callback,
|
||||
gpointer data)
|
||||
query_double_box (gchar *title,
|
||||
gchar *message,
|
||||
gdouble initial,
|
||||
gdouble lower,
|
||||
gdouble upper,
|
||||
gint digits,
|
||||
GtkObject *object,
|
||||
gchar *signal,
|
||||
QueryFunc callback,
|
||||
gpointer data)
|
||||
{
|
||||
QueryBox *query_box;
|
||||
GtkAdjustment* adjustment;
|
||||
|
|
@ -968,9 +964,8 @@ query_double_box (gchar *title,
|
|||
gtk_signal_connect (GTK_OBJECT (query_box->ok_button), "clicked",
|
||||
(GtkSignalFunc) double_query_box_ok_callback,
|
||||
query_box);
|
||||
|
||||
adjustment = GTK_ADJUSTMENT (gtk_adjustment_new (initial, lower, upper,
|
||||
1, 10, 0));
|
||||
adjustment =
|
||||
GTK_ADJUSTMENT (gtk_adjustment_new (initial, lower, upper, 1, 10, 0));
|
||||
spinbutton = gtk_spin_button_new (adjustment, 1.0, digits);
|
||||
gtk_box_pack_start (GTK_BOX (query_box->vbox), spinbutton, TRUE, TRUE, 0);
|
||||
gtk_widget_grab_focus (spinbutton);
|
||||
|
|
@ -984,19 +979,19 @@ query_double_box (gchar *title,
|
|||
}
|
||||
|
||||
GtkWidget *
|
||||
query_size_box (gchar *title,
|
||||
gchar *message,
|
||||
gdouble initial,
|
||||
gdouble lower,
|
||||
gdouble upper,
|
||||
gint digits,
|
||||
GUnit unit,
|
||||
gdouble resolution,
|
||||
gint dot_for_dot,
|
||||
GtkObject *object,
|
||||
gchar *signal,
|
||||
QueryFunc callback,
|
||||
gpointer data)
|
||||
query_size_box (gchar *title,
|
||||
gchar *message,
|
||||
gdouble initial,
|
||||
gdouble lower,
|
||||
gdouble upper,
|
||||
gint digits,
|
||||
GUnit unit,
|
||||
gdouble resolution,
|
||||
gint dot_for_dot,
|
||||
GtkObject *object,
|
||||
gchar *signal,
|
||||
QueryFunc callback,
|
||||
gpointer data)
|
||||
{
|
||||
QueryBox *query_box;
|
||||
GtkWidget *sizeentry;
|
||||
|
|
@ -1009,6 +1004,8 @@ query_size_box (gchar *title,
|
|||
|
||||
sizeentry = gimp_size_entry_new (1, unit, "%p", TRUE, FALSE, FALSE, 100,
|
||||
GIMP_SIZE_ENTRY_UPDATE_SIZE);
|
||||
if (dot_for_dot)
|
||||
gimp_size_entry_set_unit (GIMP_SIZE_ENTRY (sizeentry), UNIT_PIXEL);
|
||||
gimp_size_entry_set_resolution (GIMP_SIZE_ENTRY (sizeentry), 0,
|
||||
resolution, FALSE);
|
||||
gimp_size_entry_set_refval_digits (GIMP_SIZE_ENTRY (sizeentry), 0, digits);
|
||||
|
|
@ -1016,9 +1013,6 @@ query_size_box (gchar *title,
|
|||
lower, upper);
|
||||
gimp_size_entry_set_refval (GIMP_SIZE_ENTRY (sizeentry), 0, initial);
|
||||
|
||||
if (dot_for_dot)
|
||||
gimp_size_entry_set_unit (GIMP_SIZE_ENTRY (sizeentry), UNIT_PIXEL);
|
||||
|
||||
gtk_box_pack_start (GTK_BOX (query_box->vbox), sizeentry, TRUE, TRUE, 0);
|
||||
gimp_size_entry_grab_focus (GIMP_SIZE_ENTRY (sizeentry));
|
||||
gtk_widget_show (sizeentry);
|
||||
|
|
@ -1030,7 +1024,6 @@ query_size_box (gchar *title,
|
|||
return query_box->qbox;
|
||||
}
|
||||
|
||||
|
||||
static gint
|
||||
query_box_delete_callback (GtkWidget *w,
|
||||
GdkEvent *e,
|
||||
|
|
@ -1221,12 +1214,13 @@ message_box (char *message,
|
|||
gtk_signal_connect (GTK_OBJECT (button), "clicked",
|
||||
(GtkSignalFunc) message_box_close_callback,
|
||||
msg_box);
|
||||
gtk_box_pack_start (GTK_BOX (GTK_DIALOG (mbox)->action_area), button, TRUE, TRUE, 0);
|
||||
gtk_box_pack_start (GTK_BOX (GTK_DIALOG (mbox)->action_area), button,
|
||||
TRUE, TRUE, 0);
|
||||
gtk_widget_grab_default (button);
|
||||
gtk_widget_show (button);
|
||||
|
||||
vbox = gtk_vbox_new (FALSE, 1);
|
||||
gtk_container_set_border_width (GTK_CONTAINER (vbox), 1);
|
||||
vbox = gtk_vbox_new (FALSE, 0);
|
||||
gtk_container_set_border_width (GTK_CONTAINER (vbox), 2);
|
||||
gtk_container_add (GTK_CONTAINER (GTK_DIALOG (mbox)->vbox), vbox);
|
||||
gtk_widget_show (vbox);
|
||||
|
||||
|
|
@ -1274,7 +1268,6 @@ message_box_delete_callback (GtkWidget *w, GdkEvent *e, gpointer client_data)
|
|||
return TRUE;
|
||||
}
|
||||
|
||||
|
||||
static void
|
||||
message_box_close_callback (GtkWidget *w,
|
||||
gpointer client_data)
|
||||
|
|
|
|||
|
|
@ -330,7 +330,9 @@ lc_dialog_create (GimpImage* gimage)
|
|||
gtk_window_set_title (GTK_WINDOW (lc_shell), _("Layers & Channels"));
|
||||
gtk_window_set_wmclass (GTK_WINDOW (lc_shell), "layers_and_channels", "Gimp");
|
||||
session_set_window_geometry (lc_shell, &lc_dialog_session_info, TRUE);
|
||||
gtk_container_border_width (GTK_CONTAINER (GTK_DIALOG (lc_shell)->vbox), 2);
|
||||
gtk_container_set_border_width
|
||||
(GTK_CONTAINER (GTK_DIALOG (lc_shell)->vbox), 2);
|
||||
|
||||
gtk_signal_connect (GTK_OBJECT (lc_shell),
|
||||
"delete_event",
|
||||
GTK_SIGNAL_FUNC (lc_dialog_close_callback),
|
||||
|
|
@ -391,10 +393,13 @@ lc_dialog_create (GimpImage* gimage)
|
|||
|
||||
gtk_widget_show (notebook);
|
||||
|
||||
gtk_container_border_width (GTK_CONTAINER (GTK_DIALOG(lc_shell)->action_area), 1);
|
||||
gtk_container_set_border_width
|
||||
(GTK_CONTAINER (GTK_DIALOG(lc_shell)->action_area), 1);
|
||||
|
||||
/* The close button */
|
||||
button = gtk_button_new_with_label (_("Close"));
|
||||
gtk_box_pack_start (GTK_BOX (GTK_DIALOG(lc_shell)->action_area), button, TRUE, TRUE, 0);
|
||||
gtk_box_pack_start (GTK_BOX (GTK_DIALOG(lc_shell)->action_area), button,
|
||||
TRUE, TRUE, 0);
|
||||
gtk_signal_connect_object (GTK_OBJECT (button), "clicked",
|
||||
(GtkSignalFunc) lc_dialog_close_callback,
|
||||
GTK_OBJECT (lc_shell));
|
||||
|
|
@ -695,7 +700,7 @@ layers_dialog_create ()
|
|||
|
||||
/* The main vbox */
|
||||
layersD->vbox = vbox = gtk_vbox_new (FALSE, 1);
|
||||
gtk_container_border_width (GTK_CONTAINER (vbox), 2);
|
||||
gtk_container_set_border_width (GTK_CONTAINER (vbox), 2);
|
||||
|
||||
/* The layers commands pulldown menu */
|
||||
layersD->ops_menu = build_menu (layers_ops, layersD->accel_group);
|
||||
|
|
@ -3037,15 +3042,15 @@ struct _NewLayerOptions {
|
|||
GtkWidget *query_box;
|
||||
GtkWidget *name_entry;
|
||||
GtkWidget *size_se;
|
||||
int fill_type;
|
||||
int xsize;
|
||||
int ysize;
|
||||
gint fill_type;
|
||||
gint xsize;
|
||||
gint ysize;
|
||||
|
||||
GimpImage* gimage;
|
||||
};
|
||||
|
||||
static int fill_type = TRANSPARENT_FILL;
|
||||
static char *layer_name = NULL;
|
||||
static gint fill_type = TRANSPARENT_FILL;
|
||||
static gchar *layer_name = NULL;
|
||||
|
||||
static void
|
||||
new_layer_query_ok_callback (GtkWidget *w,
|
||||
|
|
@ -3056,14 +3061,17 @@ new_layer_query_ok_callback (GtkWidget *w,
|
|||
GImage *gimage;
|
||||
|
||||
options = (NewLayerOptions *) client_data;
|
||||
|
||||
if (layer_name)
|
||||
g_free (layer_name);
|
||||
layer_name = g_strdup (gtk_entry_get_text (GTK_ENTRY (options->name_entry)));
|
||||
|
||||
options->xsize = (gint)
|
||||
(gimp_size_entry_get_refval (GIMP_SIZE_ENTRY (options->size_se), 0) + 0.5);
|
||||
options->ysize = (gint)
|
||||
(gimp_size_entry_get_refval (GIMP_SIZE_ENTRY (options->size_se), 1) + 0.5);
|
||||
|
||||
fill_type = options->fill_type;
|
||||
options->xsize =
|
||||
gimp_size_entry_get_refval (GIMP_SIZE_ENTRY (options->size_se), 0);
|
||||
options->ysize =
|
||||
gimp_size_entry_get_refval (GIMP_SIZE_ENTRY (options->size_se), 1);
|
||||
|
||||
if ((gimage = options->gimage))
|
||||
{
|
||||
|
|
@ -3100,14 +3108,15 @@ new_layer_query_cancel_callback (GtkWidget *w,
|
|||
NewLayerOptions *options;
|
||||
|
||||
options = (NewLayerOptions *) client_data;
|
||||
|
||||
gtk_widget_destroy (options->query_box);
|
||||
g_free (options);
|
||||
}
|
||||
|
||||
static gint
|
||||
new_layer_query_delete_callback (GtkWidget *w,
|
||||
GdkEvent *e,
|
||||
gpointer client_data)
|
||||
GdkEvent *e,
|
||||
gpointer client_data)
|
||||
{
|
||||
new_layer_query_cancel_callback (w, client_data);
|
||||
|
||||
|
|
@ -3122,6 +3131,7 @@ new_layer_query_fill_type_callback (GtkWidget *w,
|
|||
NewLayerOptions *options;
|
||||
|
||||
options = (NewLayerOptions *) client_data;
|
||||
|
||||
options->fill_type =
|
||||
(int) gtk_object_get_data (GTK_OBJECT (w), "layer_fill_type");
|
||||
}
|
||||
|
|
@ -3138,15 +3148,18 @@ layers_dialog_new_layer_query (GimpImage* gimage)
|
|||
GtkWidget *radio_frame;
|
||||
GtkWidget *radio_box;
|
||||
GtkWidget *radio_button;
|
||||
GSList *group = NULL;
|
||||
int i;
|
||||
char *button_names[] =
|
||||
GSList *group;
|
||||
int i;
|
||||
|
||||
static gchar *button_names[] =
|
||||
{
|
||||
N_("Foreground"),
|
||||
N_("Background"),
|
||||
N_("White"),
|
||||
N_("Transparent")
|
||||
};
|
||||
static gint nbutton_names = sizeof (button_names) / sizeof (button_names[0]);
|
||||
|
||||
static ActionAreaItem action_items[] =
|
||||
{
|
||||
{ N_("OK"), new_layer_query_ok_callback, NULL, NULL },
|
||||
|
|
@ -3165,14 +3178,14 @@ layers_dialog_new_layer_query (GimpImage* gimage)
|
|||
gtk_window_set_title (GTK_WINDOW (options->query_box), _("New Layer Options"));
|
||||
gtk_window_position (GTK_WINDOW (options->query_box), GTK_WIN_POS_MOUSE);
|
||||
|
||||
/* handle the wm close signal */
|
||||
/* handle the wm close signal */
|
||||
gtk_signal_connect (GTK_OBJECT (options->query_box), "delete_event",
|
||||
GTK_SIGNAL_FUNC (new_layer_query_delete_callback),
|
||||
options);
|
||||
|
||||
/* the main vbox */
|
||||
vbox = gtk_vbox_new (FALSE, 2);
|
||||
gtk_container_border_width (GTK_CONTAINER (vbox), 2);
|
||||
gtk_container_set_border_width (GTK_CONTAINER (vbox), 2);
|
||||
gtk_box_pack_start (GTK_BOX (GTK_DIALOG (options->query_box)->vbox), vbox,
|
||||
TRUE, TRUE, 0);
|
||||
|
||||
|
|
@ -3228,6 +3241,8 @@ layers_dialog_new_layer_query (GimpImage* gimage)
|
|||
GTK_SHRINK | GTK_FILL, GTK_SHRINK | GTK_FILL, 0, 0);
|
||||
gtk_widget_show (options->size_se);
|
||||
|
||||
gimp_size_entry_set_unit (GIMP_SIZE_ENTRY (options->size_se), UNIT_PIXEL);
|
||||
|
||||
gimp_size_entry_set_resolution (GIMP_SIZE_ENTRY (options->size_se), 0,
|
||||
gimage->xresolution, FALSE);
|
||||
gimp_size_entry_set_resolution (GIMP_SIZE_ENTRY (options->size_se), 1,
|
||||
|
|
@ -3250,8 +3265,6 @@ layers_dialog_new_layer_query (GimpImage* gimage)
|
|||
gimp_size_entry_set_refval (GIMP_SIZE_ENTRY (options->size_se), 1,
|
||||
gimage->height);
|
||||
|
||||
gimp_size_entry_set_unit (GIMP_SIZE_ENTRY (options->size_se), UNIT_PIXEL);
|
||||
|
||||
gtk_widget_show (table);
|
||||
|
||||
/* the radio frame and box */
|
||||
|
|
@ -3262,7 +3275,8 @@ layers_dialog_new_layer_query (GimpImage* gimage)
|
|||
gtk_container_add (GTK_CONTAINER (radio_frame), radio_box);
|
||||
|
||||
/* the radio buttons */
|
||||
for (i = 0; i < 4; i++)
|
||||
group = NULL;
|
||||
for (i = 0; i < nbutton_names; i++)
|
||||
{
|
||||
radio_button =
|
||||
gtk_radio_button_new_with_label (group, gettext(button_names[i]));
|
||||
|
|
@ -3387,8 +3401,9 @@ layers_dialog_edit_layer_query (LayerWidget *layer_widget)
|
|||
|
||||
/* the main vbox */
|
||||
vbox = gtk_vbox_new (FALSE, 1);
|
||||
gtk_container_border_width (GTK_CONTAINER (vbox), 2);
|
||||
gtk_box_pack_start (GTK_BOX (GTK_DIALOG (options->query_box)->vbox), vbox, TRUE, TRUE, 0);
|
||||
gtk_container_set_border_width (GTK_CONTAINER (vbox), 2);
|
||||
gtk_box_pack_start (GTK_BOX (GTK_DIALOG (options->query_box)->vbox), vbox,
|
||||
TRUE, TRUE, 0);
|
||||
|
||||
/* the name entry hbox, label and entry */
|
||||
hbox = gtk_hbox_new (FALSE, 1);
|
||||
|
|
@ -3545,8 +3560,9 @@ layers_dialog_add_mask_query (Layer *layer)
|
|||
|
||||
/* the main vbox */
|
||||
vbox = gtk_vbox_new (FALSE, 1);
|
||||
gtk_container_border_width (GTK_CONTAINER (vbox), 2);
|
||||
gtk_box_pack_start (GTK_BOX (GTK_DIALOG (options->query_box)->vbox), vbox, TRUE, TRUE, 0);
|
||||
gtk_container_set_border_width (GTK_CONTAINER (vbox), 2);
|
||||
gtk_box_pack_start (GTK_BOX (GTK_DIALOG (options->query_box)->vbox), vbox,
|
||||
TRUE, TRUE, 0);
|
||||
|
||||
/* the name entry hbox, label and entry */
|
||||
label = gtk_label_new (_("Initialize Layer Mask To:"));
|
||||
|
|
@ -3674,8 +3690,9 @@ layers_dialog_apply_mask_query (Layer *layer)
|
|||
|
||||
/* the main vbox */
|
||||
vbox = gtk_vbox_new (FALSE, 1);
|
||||
gtk_container_border_width (GTK_CONTAINER (vbox), 2);
|
||||
gtk_box_pack_start (GTK_BOX (GTK_DIALOG (options->query_box)->vbox), vbox, TRUE, TRUE, 0);
|
||||
gtk_container_set_border_width (GTK_CONTAINER (vbox), 2);
|
||||
gtk_box_pack_start (GTK_BOX (GTK_DIALOG (options->query_box)->vbox), vbox,
|
||||
TRUE, TRUE, 0);
|
||||
|
||||
/* the name entry hbox, label and entry */
|
||||
label = gtk_label_new (_("Apply layer mask?"));
|
||||
|
|
@ -4019,8 +4036,9 @@ layers_dialog_layer_merge_query (GImage *gimage,
|
|||
|
||||
/* the main vbox */
|
||||
vbox = gtk_vbox_new (FALSE, 1);
|
||||
gtk_container_border_width (GTK_CONTAINER (options->query_box), 2);
|
||||
gtk_box_pack_start (GTK_BOX (GTK_DIALOG (options->query_box)->vbox), vbox, TRUE, TRUE, 0);
|
||||
gtk_container_set_border_width (GTK_CONTAINER (options->query_box), 2);
|
||||
gtk_box_pack_start (GTK_BOX (GTK_DIALOG (options->query_box)->vbox), vbox,
|
||||
TRUE, TRUE, 0);
|
||||
|
||||
/* the name entry hbox, label and entry */
|
||||
if (merge_visible)
|
||||
|
|
|
|||
|
|
@ -56,79 +56,68 @@ static void file_prefs_res_source_callback (GtkWidget *, gpointer);
|
|||
static void file_prefs_monitor_resolution_callback (GtkWidget *, gpointer);
|
||||
|
||||
/* static variables */
|
||||
static int old_perfectmouse;
|
||||
static int old_transparency_type;
|
||||
static int old_transparency_size;
|
||||
static int old_levels_of_undo;
|
||||
static int old_marching_speed;
|
||||
static int old_allow_resize_windows;
|
||||
static int old_auto_save;
|
||||
static int old_preview_size;
|
||||
static int old_no_cursor_updating;
|
||||
static int old_show_tool_tips;
|
||||
static int old_show_rulers;
|
||||
static int old_show_statusbar;
|
||||
static int old_cubic_interpolation;
|
||||
static int old_confirm_on_close;
|
||||
static int old_save_session_info;
|
||||
static int old_save_device_status;
|
||||
static int old_always_restore_session;
|
||||
static int old_default_width;
|
||||
static int old_default_height;
|
||||
static GUnit old_default_units;
|
||||
static double old_default_xresolution;
|
||||
static double old_default_yresolution;
|
||||
static GUnit old_default_resolution_units;
|
||||
static int old_default_type;
|
||||
static int old_stingy_memory_use;
|
||||
static int old_tile_cache_size;
|
||||
static int old_install_cmap;
|
||||
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_gradient_path;
|
||||
static double old_monitor_xres;
|
||||
static double old_monitor_yres;
|
||||
static int old_using_xserver_resolution;
|
||||
static int old_num_processors;
|
||||
static char * old_image_title_format;
|
||||
static int old_global_paint_options;
|
||||
static int old_max_new_image_size;
|
||||
static int old_perfectmouse;
|
||||
static int old_transparency_type;
|
||||
static int old_transparency_size;
|
||||
static int old_levels_of_undo;
|
||||
static int old_marching_speed;
|
||||
static int old_allow_resize_windows;
|
||||
static int old_auto_save;
|
||||
static int old_preview_size;
|
||||
static int old_no_cursor_updating;
|
||||
static int old_show_tool_tips;
|
||||
static int old_show_rulers;
|
||||
static int old_show_statusbar;
|
||||
static int old_cubic_interpolation;
|
||||
static int old_confirm_on_close;
|
||||
static int old_save_session_info;
|
||||
static int old_save_device_status;
|
||||
static int old_always_restore_session;
|
||||
static int old_default_width;
|
||||
static int old_default_height;
|
||||
static GUnit old_default_units;
|
||||
static double old_default_xresolution;
|
||||
static double old_default_yresolution;
|
||||
static GUnit old_default_resolution_units;
|
||||
static int old_default_type;
|
||||
static int old_stingy_memory_use;
|
||||
static int old_tile_cache_size;
|
||||
static int old_install_cmap;
|
||||
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_gradient_path;
|
||||
static double old_monitor_xres;
|
||||
static double old_monitor_yres;
|
||||
static int old_using_xserver_resolution;
|
||||
static int old_num_processors;
|
||||
static char * old_image_title_format;
|
||||
static int old_global_paint_options;
|
||||
static int old_max_new_image_size;
|
||||
|
||||
/* variables which can't be changed on the fly */
|
||||
static int edit_stingy_memory_use;
|
||||
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 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;
|
||||
|
||||
static int divided_tile_cache_size;
|
||||
static int tile_cache_size_unit;
|
||||
|
||||
static int divided_max_new_image_size;
|
||||
static int max_new_image_size_unit;
|
||||
|
||||
static GtkWidget *default_size_sizeentry = NULL;
|
||||
static GtkWidget *default_resolution_sizeentry = NULL;
|
||||
static GtkWidget *resolution_xserver_label = NULL;
|
||||
static GtkWidget *monitor_resolution_sizeentry = NULL;
|
||||
static GtkWidget *prefs_dlg = NULL;
|
||||
|
||||
/* Some information regarding preferences, compiled by Raph Levien 11/3/97.
|
||||
updated by Michael Natterer 27/3/99
|
||||
|
|
@ -278,10 +267,6 @@ file_prefs_ok_callback (GtkWidget *widget,
|
|||
|
||||
gtk_widget_destroy (dlg);
|
||||
prefs_dlg = NULL;
|
||||
default_size_sizeentry = NULL;
|
||||
default_resolution_sizeentry = NULL;
|
||||
resolution_xserver_label = NULL;
|
||||
monitor_resolution_sizeentry = NULL;
|
||||
|
||||
if (show_tool_tips)
|
||||
gtk_tooltips_enable (tool_tips);
|
||||
|
|
@ -545,10 +530,6 @@ file_prefs_cancel_callback (GtkWidget *widget,
|
|||
{
|
||||
gtk_widget_destroy (dlg);
|
||||
prefs_dlg = NULL;
|
||||
default_size_sizeentry = NULL;
|
||||
default_resolution_sizeentry = NULL;
|
||||
resolution_xserver_label = NULL;
|
||||
monitor_resolution_sizeentry = NULL;
|
||||
|
||||
levels_of_undo = old_levels_of_undo;
|
||||
marching_speed = old_marching_speed;
|
||||
|
|
@ -683,22 +664,22 @@ file_prefs_mem_size_callback (GtkWidget *widget,
|
|||
gpointer data)
|
||||
{
|
||||
int *mem_size;
|
||||
int *divided_mem_size;
|
||||
int *mem_size_unit;
|
||||
int divided_mem_size;
|
||||
int mem_size_unit;
|
||||
|
||||
if (! (mem_size = gtk_object_get_data (GTK_OBJECT (widget), "mem_size")))
|
||||
return;
|
||||
|
||||
if (! (divided_mem_size = gtk_object_get_data (GTK_OBJECT (widget),
|
||||
"divided_mem_size")))
|
||||
return;
|
||||
divided_mem_size = (int) gtk_object_get_data (GTK_OBJECT (widget),
|
||||
"divided_mem_size");
|
||||
mem_size_unit = (int) gtk_object_get_data (GTK_OBJECT (widget),
|
||||
"mem_size_unit");
|
||||
|
||||
if (! (mem_size_unit = gtk_object_get_data (GTK_OBJECT (widget),
|
||||
"mem_size_unit")))
|
||||
return;
|
||||
divided_mem_size = GTK_ADJUSTMENT (widget)->value;
|
||||
*mem_size = divided_mem_size * mem_size_unit;
|
||||
|
||||
*divided_mem_size = GTK_ADJUSTMENT (widget)->value;
|
||||
*mem_size = *divided_mem_size * *mem_size_unit;
|
||||
gtk_object_set_data (GTK_OBJECT (widget), "divided_mem_size",
|
||||
(gpointer) divided_mem_size);
|
||||
}
|
||||
|
||||
static void
|
||||
|
|
@ -708,37 +689,35 @@ file_prefs_mem_size_unit_callback (GtkWidget *widget,
|
|||
GtkObject *adjustment;
|
||||
int new_unit;
|
||||
int *mem_size;
|
||||
int *divided_mem_size;
|
||||
int *mem_size_unit;
|
||||
int divided_mem_size;
|
||||
int mem_size_unit;
|
||||
|
||||
adjustment = GTK_OBJECT (data);
|
||||
|
||||
if (! (new_unit = (int) gtk_object_get_user_data (GTK_OBJECT (widget))))
|
||||
return;
|
||||
new_unit = (int) gtk_object_get_user_data (GTK_OBJECT (widget));
|
||||
|
||||
if (! (mem_size = gtk_object_get_data (GTK_OBJECT (adjustment), "mem_size")))
|
||||
return;
|
||||
|
||||
if (! (divided_mem_size = gtk_object_get_data (GTK_OBJECT (adjustment),
|
||||
"divided_mem_size")))
|
||||
return;
|
||||
divided_mem_size = (int) gtk_object_get_data (GTK_OBJECT (adjustment),
|
||||
"divided_mem_size");
|
||||
mem_size_unit = (int) gtk_object_get_data (GTK_OBJECT (adjustment),
|
||||
"mem_size_unit");
|
||||
|
||||
if (! (mem_size_unit = gtk_object_get_data (GTK_OBJECT (adjustment),
|
||||
"mem_size_unit")))
|
||||
return;
|
||||
|
||||
if (new_unit != *mem_size_unit)
|
||||
if (new_unit != mem_size_unit)
|
||||
{
|
||||
*divided_mem_size = *mem_size / new_unit;
|
||||
*mem_size_unit = new_unit;
|
||||
divided_mem_size = *mem_size / new_unit;
|
||||
mem_size_unit = new_unit;
|
||||
|
||||
gtk_signal_handler_block_by_data (GTK_OBJECT (adjustment),
|
||||
divided_mem_size);
|
||||
gtk_adjustment_set_value (GTK_ADJUSTMENT (adjustment),
|
||||
(float) *divided_mem_size);
|
||||
gtk_signal_handler_unblock_by_data (GTK_OBJECT (adjustment),
|
||||
divided_mem_size);
|
||||
gtk_signal_handler_block_by_data (GTK_OBJECT (adjustment), mem_size);
|
||||
gtk_adjustment_set_value (GTK_ADJUSTMENT (adjustment), divided_mem_size);
|
||||
gtk_signal_handler_unblock_by_data (GTK_OBJECT (adjustment), mem_size);
|
||||
}
|
||||
|
||||
gtk_object_set_data (GTK_OBJECT (adjustment), "divided_mem_size",
|
||||
(gpointer) divided_mem_size);
|
||||
gtk_object_set_data (GTK_OBJECT (adjustment), "mem_size_unit",
|
||||
(gpointer) mem_size_unit);
|
||||
}
|
||||
|
||||
static void
|
||||
|
|
@ -793,8 +772,10 @@ static void
|
|||
file_prefs_default_size_callback (GtkWidget *widget,
|
||||
gpointer data)
|
||||
{
|
||||
default_width = gimp_size_entry_get_refval (GIMP_SIZE_ENTRY (widget), 0);
|
||||
default_height = gimp_size_entry_get_refval (GIMP_SIZE_ENTRY (widget), 1);
|
||||
default_width =
|
||||
(int) (gimp_size_entry_get_refval (GIMP_SIZE_ENTRY (widget), 0) + 0.5);
|
||||
default_height =
|
||||
(int) (gimp_size_entry_get_refval (GIMP_SIZE_ENTRY (widget), 1) + 0.5);
|
||||
default_units = gimp_size_entry_get_unit (GIMP_SIZE_ENTRY (widget));
|
||||
}
|
||||
|
||||
|
|
@ -802,6 +783,7 @@ static void
|
|||
file_prefs_default_resolution_callback (GtkWidget *widget,
|
||||
gpointer data)
|
||||
{
|
||||
GtkWidget *size_sizeentry;
|
||||
static gdouble xres = 0.0;
|
||||
static gdouble yres = 0.0;
|
||||
gdouble new_xres;
|
||||
|
|
@ -810,6 +792,8 @@ file_prefs_default_resolution_callback (GtkWidget *widget,
|
|||
new_xres = gimp_size_entry_get_refval (GIMP_SIZE_ENTRY (widget), 0);
|
||||
new_yres = gimp_size_entry_get_refval (GIMP_SIZE_ENTRY (widget), 1);
|
||||
|
||||
size_sizeentry = gtk_object_get_data (GTK_OBJECT (widget), "size_sizeentry");
|
||||
|
||||
if (gimp_chain_button_get_active (GIMP_CHAIN_BUTTON (data)))
|
||||
{
|
||||
if (new_xres != xres)
|
||||
|
|
@ -832,15 +816,15 @@ file_prefs_default_resolution_callback (GtkWidget *widget,
|
|||
yres = new_yres;
|
||||
}
|
||||
|
||||
gimp_size_entry_set_resolution (GIMP_SIZE_ENTRY (default_size_sizeentry),
|
||||
gimp_size_entry_set_resolution (GIMP_SIZE_ENTRY (size_sizeentry),
|
||||
0, xres, FALSE);
|
||||
gimp_size_entry_set_resolution (GIMP_SIZE_ENTRY (default_size_sizeentry),
|
||||
gimp_size_entry_set_resolution (GIMP_SIZE_ENTRY (size_sizeentry),
|
||||
1, yres, FALSE);
|
||||
|
||||
default_width =
|
||||
gimp_size_entry_get_refval (GIMP_SIZE_ENTRY (default_size_sizeentry), 0);
|
||||
default_height =
|
||||
gimp_size_entry_get_refval (GIMP_SIZE_ENTRY (default_size_sizeentry), 1);
|
||||
default_width = (gint)
|
||||
(gimp_size_entry_get_refval (GIMP_SIZE_ENTRY (size_sizeentry), 0) + 0.5);
|
||||
default_height = (gint)
|
||||
(gimp_size_entry_get_refval (GIMP_SIZE_ENTRY (size_sizeentry), 1) + 0.5);
|
||||
default_xresolution = xres;
|
||||
default_yresolution = yres;
|
||||
default_resolution_units = gimp_size_entry_get_unit (GIMP_SIZE_ENTRY (widget));
|
||||
|
|
@ -850,13 +834,18 @@ static void
|
|||
file_prefs_res_source_callback (GtkWidget *widget,
|
||||
gpointer data)
|
||||
{
|
||||
if (resolution_xserver_label)
|
||||
gtk_widget_set_sensitive (resolution_xserver_label,
|
||||
GTK_TOGGLE_BUTTON (widget)->active);
|
||||
GtkWidget *resolution_xserver_label;
|
||||
GtkWidget *monitor_resolution_sizeentry;
|
||||
|
||||
if (monitor_resolution_sizeentry)
|
||||
gtk_widget_set_sensitive (monitor_resolution_sizeentry,
|
||||
! GTK_TOGGLE_BUTTON (widget)->active);
|
||||
resolution_xserver_label =
|
||||
gtk_object_get_data (GTK_OBJECT (widget), "resolution_xserver_label");
|
||||
monitor_resolution_sizeentry =
|
||||
gtk_object_get_data (GTK_OBJECT (widget), "monitor_resolution_sizeentry");
|
||||
|
||||
gtk_widget_set_sensitive (resolution_xserver_label,
|
||||
GTK_TOGGLE_BUTTON (widget)->active);
|
||||
gtk_widget_set_sensitive (monitor_resolution_sizeentry,
|
||||
! GTK_TOGGLE_BUTTON (widget)->active);
|
||||
|
||||
if (GTK_TOGGLE_BUTTON (widget)->active)
|
||||
{
|
||||
|
|
@ -1013,8 +1002,8 @@ gimp_dialog_new (const gchar *title,
|
|||
allow_grow, allow_shrink, auto_shrink);
|
||||
|
||||
/* prepare the action_area */
|
||||
gtk_container_border_width (GTK_CONTAINER (GTK_DIALOG (dialog)->action_area),
|
||||
2);
|
||||
gtk_container_set_border_width
|
||||
(GTK_CONTAINER (GTK_DIALOG (dialog)->action_area), 2);
|
||||
gtk_box_set_homogeneous (GTK_BOX (GTK_DIALOG (dialog)->action_area), FALSE);
|
||||
|
||||
hbbox = gtk_hbutton_box_new ();
|
||||
|
|
@ -1339,31 +1328,35 @@ void
|
|||
file_pref_cmd_callback (GtkWidget *widget,
|
||||
gpointer client_data)
|
||||
{
|
||||
GtkWidget *ctree;
|
||||
gchar *titles[1];
|
||||
GtkCTreeNode *top_insert;
|
||||
GtkCTreeNode *child_insert;
|
||||
gint page_index;
|
||||
GtkWidget *ctree;
|
||||
gchar *titles[1];
|
||||
GtkCTreeNode *top_insert;
|
||||
GtkCTreeNode *child_insert;
|
||||
gint page_index;
|
||||
|
||||
GtkWidget *frame;
|
||||
GtkWidget *notebook;
|
||||
GtkWidget *vbox;
|
||||
GtkWidget *vbox2;
|
||||
GtkWidget *hbox;
|
||||
GtkWidget *abox;
|
||||
GtkWidget *button;
|
||||
GtkWidget *fileselection;
|
||||
GtkWidget *patheditor;
|
||||
GtkWidget *spinbutton;
|
||||
GtkWidget *combo;
|
||||
GtkWidget *comboitem;
|
||||
GtkWidget *optionmenu;
|
||||
GtkWidget *table;
|
||||
GtkWidget *label;
|
||||
GSList *group;
|
||||
GtkObject *adjustment;
|
||||
GtkWidget *frame;
|
||||
GtkWidget *notebook;
|
||||
GtkWidget *vbox;
|
||||
GtkWidget *vbox2;
|
||||
GtkWidget *hbox;
|
||||
GtkWidget *abox;
|
||||
GtkWidget *button;
|
||||
GtkWidget *fileselection;
|
||||
GtkWidget *patheditor;
|
||||
GtkWidget *spinbutton;
|
||||
GtkWidget *combo;
|
||||
GtkWidget *comboitem;
|
||||
GtkWidget *optionmenu;
|
||||
GtkWidget *table;
|
||||
GtkWidget *label;
|
||||
GtkObject *adjustment;
|
||||
GtkWidget *sizeentry;
|
||||
GtkWidget *sizeentry2;
|
||||
GSList *group;
|
||||
|
||||
int i;
|
||||
int i;
|
||||
int divided_mem_size;
|
||||
int mem_size_unit;
|
||||
|
||||
if (prefs_dlg)
|
||||
{
|
||||
|
|
@ -1435,24 +1428,6 @@ file_pref_cmd_callback (GtkWidget *widget,
|
|||
file_prefs_strset (&old_palette_path, edit_palette_path);
|
||||
file_prefs_strset (&old_gradient_path, edit_gradient_path);
|
||||
|
||||
tile_cache_size_unit = 1;
|
||||
for (i = 0; i < 3; i++)
|
||||
{
|
||||
if (edit_tile_cache_size % (tile_cache_size_unit * 1024) != 0)
|
||||
break;
|
||||
tile_cache_size_unit *= 1024;
|
||||
}
|
||||
divided_tile_cache_size = edit_tile_cache_size / tile_cache_size_unit;
|
||||
|
||||
max_new_image_size_unit = 1;
|
||||
for (i = 0; i < 3; i++)
|
||||
{
|
||||
if (max_new_image_size % (max_new_image_size_unit * 1024) != 0)
|
||||
break;
|
||||
max_new_image_size_unit *= 1024;
|
||||
}
|
||||
divided_max_new_image_size = max_new_image_size / max_new_image_size_unit;
|
||||
|
||||
/* Create the dialog */
|
||||
prefs_dlg =
|
||||
gimp_dialog_new (_("Preferences"), "gimp_preferences",
|
||||
|
|
@ -1520,37 +1495,39 @@ file_pref_cmd_callback (GtkWidget *widget,
|
|||
gtk_container_add (GTK_CONTAINER (frame), hbox);
|
||||
gtk_widget_show (hbox);
|
||||
|
||||
default_size_sizeentry = gimp_size_entry_new (2, default_units, "%p",
|
||||
FALSE, FALSE, TRUE, 75,
|
||||
GIMP_SIZE_ENTRY_UPDATE_SIZE);
|
||||
gimp_size_entry_set_resolution (GIMP_SIZE_ENTRY (default_size_sizeentry),
|
||||
0, default_xresolution, FALSE);
|
||||
gimp_size_entry_set_resolution (GIMP_SIZE_ENTRY (default_size_sizeentry),
|
||||
1, default_yresolution, FALSE);
|
||||
gimp_size_entry_set_refval_boundaries
|
||||
(GIMP_SIZE_ENTRY (default_size_sizeentry), 0,
|
||||
GIMP_MIN_IMAGE_SIZE, GIMP_MAX_IMAGE_SIZE);
|
||||
gimp_size_entry_set_refval_boundaries
|
||||
(GIMP_SIZE_ENTRY (default_size_sizeentry), 1,
|
||||
GIMP_MIN_IMAGE_SIZE, GIMP_MAX_IMAGE_SIZE);
|
||||
gimp_size_entry_set_refval (GIMP_SIZE_ENTRY (default_size_sizeentry), 0,
|
||||
default_width);
|
||||
gimp_size_entry_set_refval (GIMP_SIZE_ENTRY (default_size_sizeentry), 1,
|
||||
default_height);
|
||||
gimp_size_entry_attach_label (GIMP_SIZE_ENTRY (default_size_sizeentry),
|
||||
sizeentry =
|
||||
gimp_size_entry_new (2, default_units, "%p", FALSE, FALSE, TRUE, 75,
|
||||
GIMP_SIZE_ENTRY_UPDATE_SIZE);
|
||||
|
||||
gimp_size_entry_attach_label (GIMP_SIZE_ENTRY (sizeentry),
|
||||
_("Width"), 0, 1, 0.0);
|
||||
gimp_size_entry_attach_label (GIMP_SIZE_ENTRY (default_size_sizeentry),
|
||||
gimp_size_entry_attach_label (GIMP_SIZE_ENTRY (sizeentry),
|
||||
_("Height"), 0, 2, 0.0);
|
||||
gimp_size_entry_attach_label (GIMP_SIZE_ENTRY (default_size_sizeentry),
|
||||
gimp_size_entry_attach_label (GIMP_SIZE_ENTRY (sizeentry),
|
||||
_("Pixels"), 1, 4, 0.0);
|
||||
gtk_signal_connect (GTK_OBJECT (default_size_sizeentry), "unit_changed",
|
||||
(GtkSignalFunc)file_prefs_default_size_callback, NULL);
|
||||
gtk_signal_connect (GTK_OBJECT (default_size_sizeentry), "value_changed",
|
||||
(GtkSignalFunc)file_prefs_default_size_callback, NULL);
|
||||
gtk_signal_connect (GTK_OBJECT (default_size_sizeentry), "refval_changed",
|
||||
(GtkSignalFunc)file_prefs_default_size_callback, NULL);
|
||||
gtk_box_pack_start (GTK_BOX (hbox), default_size_sizeentry, FALSE, FALSE, 0);
|
||||
gtk_widget_show (default_size_sizeentry);
|
||||
|
||||
gimp_size_entry_set_resolution (GIMP_SIZE_ENTRY (sizeentry),
|
||||
0, default_xresolution, FALSE);
|
||||
gimp_size_entry_set_resolution (GIMP_SIZE_ENTRY (sizeentry),
|
||||
1, default_yresolution, FALSE);
|
||||
|
||||
gimp_size_entry_set_refval_boundaries
|
||||
(GIMP_SIZE_ENTRY (sizeentry), 0, GIMP_MIN_IMAGE_SIZE, GIMP_MAX_IMAGE_SIZE);
|
||||
gimp_size_entry_set_refval_boundaries
|
||||
(GIMP_SIZE_ENTRY (sizeentry), 1, GIMP_MIN_IMAGE_SIZE, GIMP_MAX_IMAGE_SIZE);
|
||||
|
||||
gimp_size_entry_set_refval (GIMP_SIZE_ENTRY (sizeentry), 0, default_width);
|
||||
gimp_size_entry_set_refval (GIMP_SIZE_ENTRY (sizeentry), 1, default_height);
|
||||
|
||||
gtk_signal_connect (GTK_OBJECT (sizeentry), "unit_changed",
|
||||
(GtkSignalFunc) file_prefs_default_size_callback, NULL);
|
||||
gtk_signal_connect (GTK_OBJECT (sizeentry), "value_changed",
|
||||
(GtkSignalFunc) file_prefs_default_size_callback, NULL);
|
||||
gtk_signal_connect (GTK_OBJECT (sizeentry), "refval_changed",
|
||||
(GtkSignalFunc) file_prefs_default_size_callback, NULL);
|
||||
|
||||
gtk_box_pack_start (GTK_BOX (hbox), sizeentry, FALSE, FALSE, 0);
|
||||
gtk_widget_show (sizeentry);
|
||||
|
||||
frame = gtk_frame_new (_("Default Image Resolution and Resolution Unit"));
|
||||
gtk_box_pack_start (GTK_BOX (vbox), frame, FALSE, FALSE, 0);
|
||||
|
|
@ -1561,49 +1538,49 @@ file_pref_cmd_callback (GtkWidget *widget,
|
|||
gtk_container_add (GTK_CONTAINER (frame), hbox);
|
||||
gtk_widget_show (hbox);
|
||||
|
||||
button = gimp_chain_button_new (GIMP_CHAIN_BOTTOM);
|
||||
default_resolution_sizeentry =
|
||||
sizeentry2 =
|
||||
gimp_size_entry_new (2, default_resolution_units, "Pixels/%s",
|
||||
FALSE, FALSE, TRUE, 75,
|
||||
GIMP_SIZE_ENTRY_UPDATE_RESOLUTION);
|
||||
gimp_size_entry_set_refval_boundaries
|
||||
(GIMP_SIZE_ENTRY (default_resolution_sizeentry), 0,
|
||||
GIMP_MIN_RESOLUTION, GIMP_MAX_RESOLUTION);
|
||||
gimp_size_entry_set_refval_boundaries
|
||||
(GIMP_SIZE_ENTRY (default_resolution_sizeentry), 1,
|
||||
GIMP_MIN_RESOLUTION, GIMP_MAX_RESOLUTION);
|
||||
gimp_size_entry_set_refval (GIMP_SIZE_ENTRY (default_resolution_sizeentry),
|
||||
0, default_xresolution);
|
||||
gimp_size_entry_set_refval (GIMP_SIZE_ENTRY (default_resolution_sizeentry),
|
||||
1, default_yresolution);
|
||||
gimp_size_entry_attach_label (GIMP_SIZE_ENTRY (default_resolution_sizeentry),
|
||||
_("Horizontal"), 0, 1, 0.0);
|
||||
gimp_size_entry_attach_label (GIMP_SIZE_ENTRY (default_resolution_sizeentry),
|
||||
_("Vertical"), 0, 2, 0.0);
|
||||
gimp_size_entry_attach_label (GIMP_SIZE_ENTRY (default_resolution_sizeentry),
|
||||
_("dpi"), 1, 4, 0.0);
|
||||
gtk_signal_connect (GTK_OBJECT (default_resolution_sizeentry),
|
||||
"unit_changed",
|
||||
(GtkSignalFunc)file_prefs_default_resolution_callback,
|
||||
button);
|
||||
gtk_signal_connect (GTK_OBJECT (default_resolution_sizeentry),
|
||||
"value_changed",
|
||||
(GtkSignalFunc)file_prefs_default_resolution_callback,
|
||||
button);
|
||||
gtk_signal_connect (GTK_OBJECT (default_resolution_sizeentry),
|
||||
"refval_changed",
|
||||
(GtkSignalFunc)file_prefs_default_resolution_callback,
|
||||
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),
|
||||
button, 1, 3, 3, 4);
|
||||
button = gimp_chain_button_new (GIMP_CHAIN_BOTTOM);
|
||||
if (ABS (default_xresolution - default_yresolution) < GIMP_MIN_RESOLUTION)
|
||||
gimp_chain_button_set_active (GIMP_CHAIN_BUTTON (button), TRUE);
|
||||
gtk_table_attach_defaults (GTK_TABLE (sizeentry2), button, 1, 3, 3, 4);
|
||||
gtk_widget_show (button);
|
||||
|
||||
gimp_size_entry_attach_label (GIMP_SIZE_ENTRY (sizeentry2),
|
||||
_("Horizontal"), 0, 1, 0.0);
|
||||
gimp_size_entry_attach_label (GIMP_SIZE_ENTRY (sizeentry2),
|
||||
_("Vertical"), 0, 2, 0.0);
|
||||
gimp_size_entry_attach_label (GIMP_SIZE_ENTRY (sizeentry2),
|
||||
_("dpi"), 1, 4, 0.0);
|
||||
|
||||
gtk_object_set_data (GTK_OBJECT (sizeentry2), "size_sizeentry", sizeentry);
|
||||
|
||||
gimp_size_entry_set_refval_boundaries
|
||||
(GIMP_SIZE_ENTRY (sizeentry2), 0, GIMP_MIN_RESOLUTION, GIMP_MAX_RESOLUTION);
|
||||
gimp_size_entry_set_refval_boundaries
|
||||
(GIMP_SIZE_ENTRY (sizeentry2), 1, GIMP_MIN_RESOLUTION, GIMP_MAX_RESOLUTION);
|
||||
|
||||
gimp_size_entry_set_refval (GIMP_SIZE_ENTRY (sizeentry2),
|
||||
0, default_xresolution);
|
||||
gimp_size_entry_set_refval (GIMP_SIZE_ENTRY (sizeentry2),
|
||||
1, default_yresolution);
|
||||
|
||||
gtk_signal_connect (GTK_OBJECT (sizeentry2), "unit_changed",
|
||||
(GtkSignalFunc) file_prefs_default_resolution_callback,
|
||||
button);
|
||||
gtk_signal_connect (GTK_OBJECT (sizeentry2), "value_changed",
|
||||
(GtkSignalFunc) file_prefs_default_resolution_callback,
|
||||
button);
|
||||
gtk_signal_connect (GTK_OBJECT (sizeentry2), "refval_changed",
|
||||
(GtkSignalFunc) file_prefs_default_resolution_callback,
|
||||
button);
|
||||
|
||||
gtk_box_pack_start (GTK_BOX (hbox), sizeentry2, FALSE, FALSE, 0);
|
||||
gtk_widget_show (sizeentry2);
|
||||
|
||||
hbox = gtk_hbox_new (FALSE, 2);
|
||||
gtk_box_pack_start (GTK_BOX (vbox), hbox, FALSE, FALSE, 0);
|
||||
gtk_widget_show (hbox);
|
||||
|
|
@ -1998,15 +1975,23 @@ file_pref_cmd_callback (GtkWidget *widget,
|
|||
gtk_widget_show (table);
|
||||
|
||||
/* The tile cache size */
|
||||
mem_size_unit = 1;
|
||||
for (i = 0; i < 3; i++)
|
||||
{
|
||||
if (edit_tile_cache_size % (mem_size_unit * 1024) != 0)
|
||||
break;
|
||||
mem_size_unit *= 1024;
|
||||
}
|
||||
divided_mem_size = edit_tile_cache_size / mem_size_unit;
|
||||
|
||||
hbox = gtk_hbox_new (FALSE, 2);
|
||||
spinbutton =
|
||||
gimp_spin_button_new (&adjustment,
|
||||
divided_tile_cache_size,
|
||||
gimp_spin_button_new (&adjustment, divided_mem_size,
|
||||
0.0, (4069.0 * 1024 * 1024), 1.0, 16.0, 0.0,
|
||||
1.0, 0.0);
|
||||
gtk_signal_connect (GTK_OBJECT (adjustment), "value_changed",
|
||||
(GtkSignalFunc) file_prefs_mem_size_callback,
|
||||
÷d_tile_cache_size);
|
||||
&edit_tile_cache_size);
|
||||
gtk_box_pack_start (GTK_BOX (hbox), spinbutton, FALSE, FALSE, 0);
|
||||
gtk_widget_show (spinbutton);
|
||||
|
||||
|
|
@ -2014,13 +1999,13 @@ file_pref_cmd_callback (GtkWidget *widget,
|
|||
gtk_object_set_data (GTK_OBJECT (adjustment), "mem_size",
|
||||
&edit_tile_cache_size);
|
||||
gtk_object_set_data (GTK_OBJECT (adjustment), "divided_mem_size",
|
||||
÷d_tile_cache_size);
|
||||
(gpointer) divided_mem_size);
|
||||
gtk_object_set_data (GTK_OBJECT (adjustment), "mem_size_unit",
|
||||
&tile_cache_size_unit);
|
||||
(gpointer) mem_size_unit);
|
||||
|
||||
optionmenu =
|
||||
gimp_option_menu_new (file_prefs_mem_size_unit_callback,
|
||||
(gpointer) tile_cache_size_unit,
|
||||
(gpointer) mem_size_unit,
|
||||
_("Bytes"), adjustment, (gpointer) 1,
|
||||
_("KiloBytes"), adjustment, (gpointer) 1024,
|
||||
_("MegaBytes"), adjustment, (gpointer) (1024*1024),
|
||||
|
|
@ -2031,15 +2016,23 @@ file_pref_cmd_callback (GtkWidget *widget,
|
|||
_("Tile Cache Size:"), 1.0, 0.5, hbox, TRUE);
|
||||
|
||||
/* The maximum size of a new image */
|
||||
mem_size_unit = 1;
|
||||
for (i = 0; i < 3; i++)
|
||||
{
|
||||
if (max_new_image_size % (mem_size_unit * 1024) != 0)
|
||||
break;
|
||||
mem_size_unit *= 1024;
|
||||
}
|
||||
divided_mem_size = max_new_image_size / mem_size_unit;
|
||||
|
||||
hbox = gtk_hbox_new (FALSE, 2);
|
||||
spinbutton =
|
||||
gimp_spin_button_new (&adjustment,
|
||||
divided_max_new_image_size,
|
||||
gimp_spin_button_new (&adjustment, divided_mem_size,
|
||||
0.0, (4069.0 * 1024 * 1024), 1.0, 16.0, 0.0,
|
||||
1.0, 0.0);
|
||||
gtk_signal_connect (GTK_OBJECT (adjustment), "value_changed",
|
||||
(GtkSignalFunc) file_prefs_mem_size_callback,
|
||||
÷d_max_new_image_size);
|
||||
&max_new_image_size);
|
||||
gtk_box_pack_start (GTK_BOX (hbox), spinbutton, FALSE, FALSE, 0);
|
||||
gtk_widget_show (spinbutton);
|
||||
|
||||
|
|
@ -2047,13 +2040,13 @@ file_pref_cmd_callback (GtkWidget *widget,
|
|||
gtk_object_set_data (GTK_OBJECT (adjustment), "mem_size",
|
||||
&max_new_image_size);
|
||||
gtk_object_set_data (GTK_OBJECT (adjustment), "divided_mem_size",
|
||||
÷d_max_new_image_size);
|
||||
(gpointer) divided_mem_size);
|
||||
gtk_object_set_data (GTK_OBJECT (adjustment), "mem_size_unit",
|
||||
&max_new_image_size_unit);
|
||||
(gpointer) mem_size_unit);
|
||||
|
||||
optionmenu =
|
||||
gimp_option_menu_new (file_prefs_mem_size_unit_callback,
|
||||
(gpointer) max_new_image_size_unit,
|
||||
(gpointer) mem_size_unit,
|
||||
_("Bytes"), adjustment, (gpointer) 1,
|
||||
_("KiloBytes"), adjustment, (gpointer) 1024,
|
||||
_("MegaBytes"), adjustment, (gpointer) (1024*1024),
|
||||
|
|
@ -2192,15 +2185,6 @@ file_pref_cmd_callback (GtkWidget *widget,
|
|||
gtk_container_add (GTK_CONTAINER (frame), vbox2);
|
||||
gtk_widget_show (vbox2);
|
||||
|
||||
group = NULL;
|
||||
button = gtk_radio_button_new_with_label (group, _("From X Server"));
|
||||
group = gtk_radio_button_group (GTK_RADIO_BUTTON (button));
|
||||
gtk_signal_connect (GTK_OBJECT (button), "toggled",
|
||||
GTK_SIGNAL_FUNC (file_prefs_res_source_callback),
|
||||
NULL);
|
||||
gtk_box_pack_start (GTK_BOX (vbox2), button, FALSE, FALSE, 0);
|
||||
gtk_widget_show (button);
|
||||
|
||||
{
|
||||
gdouble xres, yres;
|
||||
gchar buf[80];
|
||||
|
|
@ -2209,62 +2193,76 @@ file_pref_cmd_callback (GtkWidget *widget,
|
|||
|
||||
g_snprintf (buf, sizeof (buf), _("(Currently %d x %d dpi)"),
|
||||
(int) (xres + 0.5), (int) (yres + 0.5));
|
||||
resolution_xserver_label = gtk_label_new (buf);
|
||||
gtk_box_pack_start (GTK_BOX (vbox2), resolution_xserver_label,
|
||||
FALSE, FALSE, 0);
|
||||
gtk_widget_show (resolution_xserver_label);
|
||||
label = gtk_label_new (buf);
|
||||
}
|
||||
|
||||
abox = gtk_alignment_new (0.5, 0.5, 0.0, 0.0);
|
||||
|
||||
sizeentry =
|
||||
gimp_size_entry_new (2, UNIT_INCH, "Pixels/%s", FALSE, FALSE, TRUE, 75,
|
||||
GIMP_SIZE_ENTRY_UPDATE_RESOLUTION);
|
||||
|
||||
button = gimp_chain_button_new (GIMP_CHAIN_BOTTOM);
|
||||
if (ABS (monitor_xres - monitor_yres) < GIMP_MIN_RESOLUTION)
|
||||
gimp_chain_button_set_active (GIMP_CHAIN_BUTTON (button), TRUE);
|
||||
gtk_table_attach_defaults (GTK_TABLE (sizeentry), button, 1, 3, 3, 4);
|
||||
gtk_widget_show (button);
|
||||
|
||||
gimp_size_entry_attach_label (GIMP_SIZE_ENTRY (sizeentry),
|
||||
_("Horizontal"), 0, 1, 0.0);
|
||||
gimp_size_entry_attach_label (GIMP_SIZE_ENTRY (sizeentry),
|
||||
_("Vertical"), 0, 2, 0.0);
|
||||
gimp_size_entry_attach_label (GIMP_SIZE_ENTRY (sizeentry),
|
||||
_("dpi"), 1, 4, 0.0);
|
||||
|
||||
gimp_size_entry_set_refval_boundaries (GIMP_SIZE_ENTRY (sizeentry), 0,
|
||||
GIMP_MIN_RESOLUTION,
|
||||
GIMP_MAX_RESOLUTION);
|
||||
gimp_size_entry_set_refval_boundaries (GIMP_SIZE_ENTRY (sizeentry), 1,
|
||||
GIMP_MIN_RESOLUTION,
|
||||
GIMP_MAX_RESOLUTION);
|
||||
|
||||
gimp_size_entry_set_refval (GIMP_SIZE_ENTRY (sizeentry), 0, monitor_xres);
|
||||
gimp_size_entry_set_refval (GIMP_SIZE_ENTRY (sizeentry), 1, monitor_yres);
|
||||
|
||||
gtk_signal_connect (GTK_OBJECT (sizeentry), "value_changed",
|
||||
(GtkSignalFunc) file_prefs_monitor_resolution_callback,
|
||||
button);
|
||||
gtk_signal_connect (GTK_OBJECT (sizeentry), "refval_changed",
|
||||
(GtkSignalFunc) file_prefs_monitor_resolution_callback,
|
||||
button);
|
||||
|
||||
gtk_container_add (GTK_CONTAINER (abox), sizeentry);
|
||||
gtk_widget_show (sizeentry);
|
||||
|
||||
gtk_widget_set_sensitive (sizeentry, !using_xserver_resolution);
|
||||
|
||||
group = NULL;
|
||||
button = gtk_radio_button_new_with_label (group, _("From X Server"));
|
||||
group = gtk_radio_button_group (GTK_RADIO_BUTTON (button));
|
||||
gtk_signal_connect (GTK_OBJECT (button), "toggled",
|
||||
GTK_SIGNAL_FUNC (file_prefs_res_source_callback),
|
||||
NULL);
|
||||
gtk_object_set_data (GTK_OBJECT (button), "resolution_xserver_label",
|
||||
label);
|
||||
gtk_object_set_data (GTK_OBJECT (button), "monitor_resolution_sizeentry",
|
||||
sizeentry);
|
||||
gtk_box_pack_start (GTK_BOX (vbox2), button, FALSE, FALSE, 0);
|
||||
gtk_widget_show (button);
|
||||
|
||||
gtk_box_pack_start (GTK_BOX (vbox2), label, FALSE, FALSE, 0);
|
||||
gtk_widget_show (label);
|
||||
|
||||
button = gtk_radio_button_new_with_label (group, _("Manually:"));
|
||||
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)
|
||||
gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (button), TRUE);
|
||||
|
||||
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);
|
||||
|
||||
button = gimp_chain_button_new (GIMP_CHAIN_BOTTOM);
|
||||
monitor_resolution_sizeentry =
|
||||
gimp_size_entry_new (2, UNIT_INCH, "Pixels/%s", FALSE, FALSE, TRUE, 75,
|
||||
GIMP_SIZE_ENTRY_UPDATE_RESOLUTION);
|
||||
gimp_size_entry_set_refval_boundaries
|
||||
(GIMP_SIZE_ENTRY (monitor_resolution_sizeentry), 0,
|
||||
GIMP_MIN_RESOLUTION, GIMP_MAX_RESOLUTION);
|
||||
gimp_size_entry_set_refval_boundaries
|
||||
(GIMP_SIZE_ENTRY (monitor_resolution_sizeentry), 1,
|
||||
GIMP_MIN_RESOLUTION, GIMP_MAX_RESOLUTION);
|
||||
gimp_size_entry_set_refval (GIMP_SIZE_ENTRY (monitor_resolution_sizeentry),
|
||||
0, monitor_xres);
|
||||
gimp_size_entry_set_refval (GIMP_SIZE_ENTRY (monitor_resolution_sizeentry),
|
||||
1, monitor_yres);
|
||||
gimp_size_entry_attach_label (GIMP_SIZE_ENTRY (monitor_resolution_sizeentry),
|
||||
_("Horizontal"), 0, 1, 0.0);
|
||||
gimp_size_entry_attach_label (GIMP_SIZE_ENTRY (monitor_resolution_sizeentry),
|
||||
_("Vertical"), 0, 2, 0.0);
|
||||
gimp_size_entry_attach_label (GIMP_SIZE_ENTRY (monitor_resolution_sizeentry),
|
||||
_("dpi"), 1, 4, 0.0);
|
||||
gtk_signal_connect (GTK_OBJECT (monitor_resolution_sizeentry),
|
||||
"value_changed",
|
||||
(GtkSignalFunc)file_prefs_monitor_resolution_callback,
|
||||
button);
|
||||
gtk_signal_connect (GTK_OBJECT (monitor_resolution_sizeentry),
|
||||
"refval_changed",
|
||||
(GtkSignalFunc)file_prefs_monitor_resolution_callback,
|
||||
button);
|
||||
gtk_container_add (GTK_CONTAINER (abox), monitor_resolution_sizeentry);
|
||||
gtk_widget_show (monitor_resolution_sizeentry);
|
||||
|
||||
if (ABS (monitor_xres - monitor_yres) < GIMP_MIN_RESOLUTION)
|
||||
gimp_chain_button_set_active (GIMP_CHAIN_BUTTON (button), TRUE);
|
||||
gtk_table_attach_defaults (GTK_TABLE (monitor_resolution_sizeentry),
|
||||
button, 1, 3, 3, 4);
|
||||
gtk_widget_show (button);
|
||||
|
||||
gtk_widget_set_sensitive (monitor_resolution_sizeentry,
|
||||
!using_xserver_resolution);
|
||||
if (!using_xserver_resolution)
|
||||
gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (button), TRUE);
|
||||
|
||||
/* Directories */
|
||||
vbox = file_prefs_notebook_append_page (GTK_NOTEBOOK (notebook),
|
||||
|
|
|
|||
84
app/resize.c
84
app/resize.c
|
|
@ -56,22 +56,22 @@ struct _ResizePrivate
|
|||
GtkObject *object;
|
||||
guint object_destroy_handler;
|
||||
|
||||
double ratio;
|
||||
int old_width, old_height;
|
||||
double old_res_x, old_res_y;
|
||||
int area_width, area_height;
|
||||
int start_x, start_y;
|
||||
int orig_x, orig_y;
|
||||
gdouble ratio;
|
||||
gint old_width, old_height;
|
||||
gdouble old_res_x, old_res_y;
|
||||
gint area_width, area_height;
|
||||
gint start_x, start_y;
|
||||
gint orig_x, orig_y;
|
||||
};
|
||||
|
||||
static void resize_draw (Resize *);
|
||||
static void unit_update (GtkWidget *w, gpointer data);
|
||||
static int resize_bound_off_x (Resize *, int);
|
||||
static int resize_bound_off_y (Resize *, int);
|
||||
static gint resize_bound_off_x (Resize *, gint);
|
||||
static gint resize_bound_off_y (Resize *, gint);
|
||||
static void orig_labels_update (GtkWidget *w, gpointer data);
|
||||
static void size_callback (GtkWidget *w, gpointer data);
|
||||
static void ratio_callback (GtkWidget *w, gpointer data);
|
||||
static void size_update (Resize *, double, double, double, double);
|
||||
static void size_update (Resize *, gdouble, gdouble, gdouble, gdouble);
|
||||
static void offset_update (GtkWidget *w, gpointer data);
|
||||
static gint resize_events (GtkWidget *area, GdkEvent *event);
|
||||
static void printsize_update (GtkWidget *w, gpointer data);
|
||||
|
|
@ -109,7 +109,7 @@ resize_widget_new (ResizeType type,
|
|||
GtkWidget *alignment;
|
||||
GtkObject *adjustment;
|
||||
|
||||
static ActionAreaItem action_items[2] =
|
||||
static ActionAreaItem action_items[] =
|
||||
{
|
||||
{ N_("OK"), NULL, NULL, NULL },
|
||||
{ N_("Cancel"), NULL, NULL, NULL }
|
||||
|
|
@ -196,13 +196,14 @@ resize_widget_new (ResizeType type,
|
|||
|
||||
/* handle the image disappearing under our feet */
|
||||
if (object)
|
||||
{
|
||||
const char *signame;
|
||||
signame = (target == ResizeLayer) ? "removed" : "destroy";
|
||||
private->object = object;
|
||||
private->object_destroy_handler =
|
||||
gtk_signal_connect(GTK_OBJECT (object), signame, cancel_cb, user_data);
|
||||
}
|
||||
{
|
||||
const gchar *signame;
|
||||
|
||||
signame = (target == ResizeLayer) ? "removed" : "destroy";
|
||||
private->object = object;
|
||||
private->object_destroy_handler =
|
||||
gtk_signal_connect(GTK_OBJECT (object), signame, cancel_cb, user_data);
|
||||
}
|
||||
|
||||
/* the action area */
|
||||
action_items[0].user_data = user_data;
|
||||
|
|
@ -292,6 +293,9 @@ resize_widget_new (ResizeType type,
|
|||
GTK_SHRINK | GTK_FILL, GTK_SHRINK | GTK_FILL, 0, 0);
|
||||
gtk_widget_show (private->size_se);
|
||||
|
||||
if (dot_for_dot)
|
||||
gimp_size_entry_set_unit (GIMP_SIZE_ENTRY (private->size_se), UNIT_PIXEL);
|
||||
|
||||
gimp_size_entry_set_resolution (GIMP_SIZE_ENTRY (private->size_se), 0,
|
||||
resolution_x, FALSE);
|
||||
gimp_size_entry_set_resolution (GIMP_SIZE_ENTRY (private->size_se), 1,
|
||||
|
|
@ -310,9 +314,6 @@ resize_widget_new (ResizeType type,
|
|||
gimp_size_entry_set_refval (GIMP_SIZE_ENTRY (private->size_se), 0, width);
|
||||
gimp_size_entry_set_refval (GIMP_SIZE_ENTRY (private->size_se), 1, height);
|
||||
|
||||
if (dot_for_dot)
|
||||
gimp_size_entry_set_unit (GIMP_SIZE_ENTRY (private->size_se), UNIT_PIXEL);
|
||||
|
||||
gtk_signal_connect (GTK_OBJECT (private->size_se), "value_changed",
|
||||
(GtkSignalFunc) size_callback,
|
||||
resize);
|
||||
|
|
@ -441,6 +442,10 @@ resize_widget_new (ResizeType type,
|
|||
GTK_SHRINK | GTK_FILL, GTK_SHRINK | GTK_FILL, 0, 0);
|
||||
gtk_widget_show (private->offset_se);
|
||||
|
||||
if (dot_for_dot)
|
||||
gimp_size_entry_set_unit (GIMP_SIZE_ENTRY (private->offset_se),
|
||||
UNIT_PIXEL);
|
||||
|
||||
gimp_size_entry_set_resolution (GIMP_SIZE_ENTRY (private->offset_se), 0,
|
||||
resolution_x, FALSE);
|
||||
gimp_size_entry_set_resolution (GIMP_SIZE_ENTRY (private->offset_se), 1,
|
||||
|
|
@ -454,13 +459,8 @@ resize_widget_new (ResizeType type,
|
|||
gimp_size_entry_set_refval (GIMP_SIZE_ENTRY (private->offset_se), 0, 0);
|
||||
gimp_size_entry_set_refval (GIMP_SIZE_ENTRY (private->offset_se), 1, 0);
|
||||
|
||||
if (dot_for_dot)
|
||||
gimp_size_entry_set_unit (GIMP_SIZE_ENTRY (private->offset_se),
|
||||
UNIT_PIXEL);
|
||||
|
||||
gtk_signal_connect (GTK_OBJECT (private->offset_se),
|
||||
"value_changed", (GtkSignalFunc) offset_update,
|
||||
resize);
|
||||
gtk_signal_connect (GTK_OBJECT (private->offset_se), "value_changed",
|
||||
(GtkSignalFunc) offset_update, resize);
|
||||
|
||||
gtk_widget_show (table);
|
||||
|
||||
|
|
@ -746,9 +746,9 @@ resize_draw (Resize *resize)
|
|||
}
|
||||
}
|
||||
|
||||
static int
|
||||
static gint
|
||||
resize_bound_off_x (Resize *resize,
|
||||
int off_x)
|
||||
gint off_x)
|
||||
{
|
||||
ResizePrivate *private;
|
||||
|
||||
|
|
@ -762,9 +762,9 @@ resize_bound_off_x (Resize *resize,
|
|||
return off_x;
|
||||
}
|
||||
|
||||
static int
|
||||
static gint
|
||||
resize_bound_off_y (Resize *resize,
|
||||
int off_y)
|
||||
gint off_y)
|
||||
{
|
||||
ResizePrivate *private;
|
||||
|
||||
|
|
@ -800,7 +800,7 @@ orig_labels_update (GtkWidget *w,
|
|||
|
||||
if (label_unit) /* unit != UNIT_PIXEL */
|
||||
{
|
||||
float unit_factor = gimp_unit_get_factor (label_unit);
|
||||
double unit_factor = gimp_unit_get_factor (label_unit);
|
||||
|
||||
g_snprintf (format_buf, 16, "%%.%df %s",
|
||||
gimp_unit_get_digits (label_unit) + 1,
|
||||
|
|
@ -837,18 +837,18 @@ offset_update (GtkWidget *w,
|
|||
{
|
||||
Resize *resize;
|
||||
ResizePrivate *private;
|
||||
int offset_x;
|
||||
int offset_y;
|
||||
gint offset_x;
|
||||
gint offset_y;
|
||||
|
||||
resize = (Resize *) data;
|
||||
private = (ResizePrivate *) resize->private_part;
|
||||
|
||||
offset_x =
|
||||
gimp_size_entry_get_refval (GIMP_SIZE_ENTRY (private->offset_se), 0);
|
||||
offset_x = (gint)
|
||||
(gimp_size_entry_get_refval (GIMP_SIZE_ENTRY (private->offset_se), 0) + 0.5);
|
||||
offset_x = resize_bound_off_x (resize, offset_x);
|
||||
|
||||
offset_y =
|
||||
gimp_size_entry_get_refval (GIMP_SIZE_ENTRY (private->offset_se), 1);
|
||||
offset_y = (gint)
|
||||
(gimp_size_entry_get_refval (GIMP_SIZE_ENTRY (private->offset_se), 1) + 0.5);
|
||||
offset_y = resize_bound_off_y (resize, offset_y);
|
||||
|
||||
if ((offset_x != resize->offset_x) ||
|
||||
|
|
@ -882,8 +882,6 @@ size_callback (GtkWidget *w,
|
|||
|
||||
if (gimp_chain_button_get_active (GIMP_CHAIN_BUTTON (private->constrain)))
|
||||
{
|
||||
/* compare ratios, not sizes because we need float values
|
||||
*/
|
||||
if (ratio_x != resize->ratio_x)
|
||||
{
|
||||
ratio_y = ratio_x;
|
||||
|
|
@ -911,7 +909,7 @@ ratio_callback (GtkWidget *w,
|
|||
double height;
|
||||
double ratio_x;
|
||||
double ratio_y;
|
||||
|
||||
|
||||
resize = (Resize *) data;
|
||||
private = (ResizePrivate *) resize->private_part;
|
||||
|
||||
|
|
@ -952,8 +950,8 @@ size_update (Resize *resize,
|
|||
|
||||
private = (ResizePrivate *) resize->private_part;
|
||||
|
||||
resize->width = width;
|
||||
resize->height = height;
|
||||
resize->width = (gint) (width + 0.5);
|
||||
resize->height = (gint) (height + 0.5);
|
||||
|
||||
resize->ratio_x = ratio_x;
|
||||
resize->ratio_y = ratio_y;
|
||||
|
|
|
|||
18
app/resize.h
18
app/resize.h
|
|
@ -42,21 +42,21 @@ struct _Resize
|
|||
ResizeType type;
|
||||
ResizeTarget target;
|
||||
|
||||
int width;
|
||||
int height;
|
||||
gint width;
|
||||
gint height;
|
||||
|
||||
double resolution_x;
|
||||
double resolution_y;
|
||||
gdouble resolution_x;
|
||||
gdouble resolution_y;
|
||||
GUnit unit;
|
||||
|
||||
double ratio_x;
|
||||
double ratio_y;
|
||||
gdouble ratio_x;
|
||||
gdouble ratio_y;
|
||||
|
||||
int offset_x;
|
||||
int offset_y;
|
||||
gint offset_x;
|
||||
gint offset_y;
|
||||
|
||||
/* Don't touch this :) */
|
||||
void * private_part;
|
||||
void * private_part;
|
||||
};
|
||||
|
||||
/* If resolution_x is zero, then don't show resolution modification
|
||||
|
|
|
|||
|
|
@ -31,8 +31,8 @@
|
|||
|
||||
#include "tile_manager_pvt.h"
|
||||
|
||||
#include "libgimp/gimpintl.h"
|
||||
#include "libgimp/gimpsizeentry.h"
|
||||
#include "libgimp/gimpintl.h"
|
||||
|
||||
#ifndef M_PI
|
||||
#define M_PI 3.14159265358979323846
|
||||
|
|
@ -48,8 +48,8 @@
|
|||
#define FIFTEEN_DEG (M_PI / 12.0)
|
||||
|
||||
/* variables local to this file */
|
||||
static gfloat angle_val;
|
||||
static gfloat center_vals[2];
|
||||
static gdouble angle_val;
|
||||
static gdouble center_vals[2];
|
||||
|
||||
/* needed for size update */
|
||||
static GtkWidget *sizeentry;
|
||||
|
|
@ -59,7 +59,7 @@ static void * rotate_tool_recalc (Tool *, void *);
|
|||
static void rotate_tool_motion (Tool *, void *);
|
||||
static void rotate_info_update (Tool *);
|
||||
|
||||
/* callback functions for the info dialog entries */
|
||||
/* callback functions for the info dialog sizeentries */
|
||||
static void rotate_angle_changed (GtkWidget *entry, gpointer data);
|
||||
static void rotate_center_changed (GtkWidget *entry, gpointer data);
|
||||
|
||||
|
|
@ -110,25 +110,26 @@ rotate_tool_transform (Tool *tool,
|
|||
gimp_size_entry_add_field (GIMP_SIZE_ENTRY (sizeentry),
|
||||
GTK_SPIN_BUTTON (spinbutton2), NULL);
|
||||
|
||||
gimp_size_entry_set_refval_boundaries (GIMP_SIZE_ENTRY (sizeentry), 0,
|
||||
-4096,
|
||||
4096 + gdisp->gimage->width);
|
||||
gimp_size_entry_set_resolution (GIMP_SIZE_ENTRY (sizeentry), 0,
|
||||
gdisp->gimage->xresolution, FALSE);
|
||||
gimp_size_entry_set_refval (GIMP_SIZE_ENTRY (sizeentry), 0,
|
||||
center_vals[0]);
|
||||
|
||||
gimp_size_entry_set_refval_boundaries (GIMP_SIZE_ENTRY (sizeentry), 1,
|
||||
-4096,
|
||||
4096 + gdisp->gimage->height);
|
||||
gimp_size_entry_set_resolution (GIMP_SIZE_ENTRY (sizeentry), 1,
|
||||
gdisp->gimage->yresolution, FALSE);
|
||||
gimp_size_entry_set_refval (GIMP_SIZE_ENTRY (sizeentry), 1,
|
||||
center_vals[1]);
|
||||
|
||||
if (gdisp->dot_for_dot)
|
||||
gimp_size_entry_set_unit (GIMP_SIZE_ENTRY (sizeentry), UNIT_PIXEL);
|
||||
|
||||
gimp_size_entry_set_resolution (GIMP_SIZE_ENTRY (sizeentry), 0,
|
||||
gdisp->gimage->xresolution, FALSE);
|
||||
gimp_size_entry_set_resolution (GIMP_SIZE_ENTRY (sizeentry), 1,
|
||||
gdisp->gimage->yresolution, FALSE);
|
||||
|
||||
gimp_size_entry_set_refval_boundaries (GIMP_SIZE_ENTRY (sizeentry), 0,
|
||||
-65536,
|
||||
65536 + gdisp->gimage->width);
|
||||
gimp_size_entry_set_refval_boundaries (GIMP_SIZE_ENTRY (sizeentry), 1,
|
||||
-65536,
|
||||
65536 + gdisp->gimage->height);
|
||||
|
||||
gimp_size_entry_set_refval (GIMP_SIZE_ENTRY (sizeentry), 0,
|
||||
center_vals[0]);
|
||||
gimp_size_entry_set_refval (GIMP_SIZE_ENTRY (sizeentry), 1,
|
||||
center_vals[1]);
|
||||
|
||||
gtk_table_set_row_spacing (GTK_TABLE (transform_info->info_table),
|
||||
1, 6);
|
||||
gtk_table_set_row_spacing (GTK_TABLE (transform_info->info_table),
|
||||
|
|
@ -235,7 +236,7 @@ rotate_angle_changed (GtkWidget *w,
|
|||
TransformCore *transform_core;
|
||||
double value;
|
||||
|
||||
tool = (Tool *)data;
|
||||
tool = (Tool *) data;
|
||||
|
||||
if (tool)
|
||||
{
|
||||
|
|
@ -266,15 +267,15 @@ rotate_center_changed (GtkWidget *w,
|
|||
int cx;
|
||||
int cy;
|
||||
|
||||
tool = (Tool *)data;
|
||||
tool = (Tool *) data;
|
||||
|
||||
if (tool)
|
||||
{
|
||||
gdisp = (GDisplay *) tool->gdisp_ptr;
|
||||
transform_core = (TransformCore *) tool->private;
|
||||
|
||||
cx = gimp_size_entry_get_refval (GIMP_SIZE_ENTRY (w), 0);
|
||||
cy = gimp_size_entry_get_refval (GIMP_SIZE_ENTRY (w), 1);
|
||||
cx = (int) (gimp_size_entry_get_refval (GIMP_SIZE_ENTRY (w), 0) + 0.5);
|
||||
cy = (int) (gimp_size_entry_get_refval (GIMP_SIZE_ENTRY (w), 1) + 0.5);
|
||||
|
||||
if ((cx != transform_core->cx) ||
|
||||
(cy != transform_core->cy))
|
||||
|
|
@ -333,16 +334,18 @@ rotate_tool_motion (Tool *tool,
|
|||
|
||||
/* limit the angle to between 0 and 360 degrees */
|
||||
if (transform_core->trans_info[REAL_ANGLE] < - M_PI)
|
||||
transform_core->trans_info[REAL_ANGLE] = 2 * M_PI - transform_core->trans_info[REAL_ANGLE];
|
||||
transform_core->trans_info[REAL_ANGLE] =
|
||||
2 * M_PI - transform_core->trans_info[REAL_ANGLE];
|
||||
else if (transform_core->trans_info[REAL_ANGLE] > M_PI)
|
||||
transform_core->trans_info[REAL_ANGLE] = transform_core->trans_info[REAL_ANGLE] - 2 * M_PI;
|
||||
transform_core->trans_info[REAL_ANGLE] =
|
||||
transform_core->trans_info[REAL_ANGLE] - 2 * M_PI;
|
||||
|
||||
/* constrain the angle to 15-degree multiples if ctrl is held down */
|
||||
|
||||
/* constrain the angle to 15-degree multiples if ctrl is held down */
|
||||
if (transform_core->state & GDK_CONTROL_MASK)
|
||||
transform_core->trans_info[ANGLE] = FIFTEEN_DEG * (int) ((transform_core->trans_info[REAL_ANGLE] +
|
||||
FIFTEEN_DEG / 2.0) /
|
||||
FIFTEEN_DEG);
|
||||
transform_core->trans_info[ANGLE] =
|
||||
FIFTEEN_DEG * (int) ((transform_core->trans_info[REAL_ANGLE] +
|
||||
FIFTEEN_DEG / 2.0) /
|
||||
FIFTEEN_DEG);
|
||||
else
|
||||
transform_core->trans_info[ANGLE] = transform_core->trans_info[REAL_ANGLE];
|
||||
}
|
||||
|
|
@ -364,7 +367,8 @@ rotate_tool_recalc (Tool *tool,
|
|||
/* assemble the transformation matrix */
|
||||
gimp_matrix_identity (transform_core->transform);
|
||||
gimp_matrix_translate (transform_core->transform, -cx, -cy);
|
||||
gimp_matrix_rotate (transform_core->transform, transform_core->trans_info[ANGLE]);
|
||||
gimp_matrix_rotate (transform_core->transform,
|
||||
transform_core->trans_info[ANGLE]);
|
||||
gimp_matrix_translate (transform_core->transform, +cx, +cy);
|
||||
|
||||
/* transform the bounding box */
|
||||
|
|
|
|||
|
|
@ -29,26 +29,27 @@
|
|||
|
||||
#include "tile_manager_pvt.h"
|
||||
|
||||
#include "libgimp/gimplimits.h"
|
||||
#include "libgimp/gimpintl.h"
|
||||
|
||||
/* storage for information dialog fields */
|
||||
static gchar orig_width_buf [MAX_INFO_BUF];
|
||||
static gchar orig_height_buf [MAX_INFO_BUF];
|
||||
static gfloat size_vals[2];
|
||||
static gchar x_ratio_buf [MAX_INFO_BUF];
|
||||
static gchar y_ratio_buf [MAX_INFO_BUF];
|
||||
static gchar orig_width_buf[MAX_INFO_BUF];
|
||||
static gchar orig_height_buf[MAX_INFO_BUF];
|
||||
static gdouble size_vals[2];
|
||||
static gchar x_ratio_buf[MAX_INFO_BUF];
|
||||
static gchar y_ratio_buf[MAX_INFO_BUF];
|
||||
|
||||
/* needed for original size unit update */
|
||||
static GtkWidget *sizeentry;
|
||||
static GtkWidget *sizeentry;
|
||||
|
||||
/* forward function declarations */
|
||||
static void * scale_tool_recalc (Tool *, void *);
|
||||
static void scale_tool_motion (Tool *, void *);
|
||||
static void scale_info_update (Tool *);
|
||||
static void * scale_tool_recalc (Tool *, void *);
|
||||
static void scale_tool_motion (Tool *, void *);
|
||||
static void scale_info_update (Tool *);
|
||||
|
||||
/* callback functions for the info dialog fields */
|
||||
static void scale_size_changed (GtkWidget *w, gpointer data);
|
||||
static void scale_unit_changed (GtkWidget *w, gpointer data);
|
||||
static void scale_size_changed (GtkWidget *w, gpointer data);
|
||||
static void scale_unit_changed (GtkWidget *w, gpointer data);
|
||||
|
||||
void *
|
||||
scale_tool_transform (Tool *tool,
|
||||
|
|
@ -89,23 +90,26 @@ scale_tool_transform (Tool *tool,
|
|||
gtk_signal_connect (GTK_OBJECT (sizeentry), "unit_changed",
|
||||
scale_unit_changed, tool);
|
||||
|
||||
gimp_size_entry_set_refval_boundaries (GIMP_SIZE_ENTRY (sizeentry), 0,
|
||||
1, 65536);
|
||||
gimp_size_entry_set_resolution (GIMP_SIZE_ENTRY (sizeentry), 0,
|
||||
gdisp->gimage->xresolution, FALSE);
|
||||
gimp_size_entry_set_refval (GIMP_SIZE_ENTRY (sizeentry), 0,
|
||||
size_vals[0]);
|
||||
|
||||
gimp_size_entry_set_refval_boundaries (GIMP_SIZE_ENTRY (sizeentry), 1,
|
||||
1, 65536);
|
||||
gimp_size_entry_set_resolution (GIMP_SIZE_ENTRY (sizeentry), 1,
|
||||
gdisp->gimage->yresolution, FALSE);
|
||||
gimp_size_entry_set_refval (GIMP_SIZE_ENTRY (sizeentry), 1,
|
||||
size_vals[1]);
|
||||
|
||||
if (gdisp->dot_for_dot)
|
||||
gimp_size_entry_set_unit (GIMP_SIZE_ENTRY (sizeentry), UNIT_PIXEL);
|
||||
|
||||
gimp_size_entry_set_resolution (GIMP_SIZE_ENTRY (sizeentry), 0,
|
||||
gdisp->gimage->xresolution, FALSE);
|
||||
gimp_size_entry_set_resolution (GIMP_SIZE_ENTRY (sizeentry), 1,
|
||||
gdisp->gimage->yresolution, FALSE);
|
||||
|
||||
gimp_size_entry_set_refval_boundaries (GIMP_SIZE_ENTRY (sizeentry), 0,
|
||||
GIMP_MIN_IMAGE_SIZE,
|
||||
GIMP_MAX_IMAGE_SIZE);
|
||||
gimp_size_entry_set_refval_boundaries (GIMP_SIZE_ENTRY (sizeentry), 1,
|
||||
GIMP_MIN_IMAGE_SIZE,
|
||||
GIMP_MAX_IMAGE_SIZE);
|
||||
|
||||
gimp_size_entry_set_refval (GIMP_SIZE_ENTRY (sizeentry), 0,
|
||||
size_vals[0]);
|
||||
gimp_size_entry_set_refval (GIMP_SIZE_ENTRY (sizeentry), 1,
|
||||
size_vals[1]);
|
||||
|
||||
info_dialog_add_label (transform_info, _("Scale Ratio X:"),
|
||||
x_ratio_buf);
|
||||
info_dialog_add_label (transform_info, _("Y:"),
|
||||
|
|
@ -269,8 +273,8 @@ scale_size_changed (GtkWidget *w,
|
|||
gdisp = (GDisplay *) tool->gdisp_ptr;
|
||||
transform_core = (TransformCore *) tool->private;
|
||||
|
||||
width = gimp_size_entry_get_refval (GIMP_SIZE_ENTRY (w), 0);
|
||||
height = gimp_size_entry_get_refval (GIMP_SIZE_ENTRY (w), 1);
|
||||
width = (int) (gimp_size_entry_get_refval (GIMP_SIZE_ENTRY (w), 0) + 0.5);
|
||||
height = (int) (gimp_size_entry_get_refval (GIMP_SIZE_ENTRY (w), 1) + 0.5);
|
||||
|
||||
if ((width != (transform_core->trans_info[X1] -
|
||||
transform_core->trans_info[X0])) ||
|
||||
|
|
|
|||
|
|
@ -42,9 +42,9 @@
|
|||
#define MIN_MOVE 5
|
||||
|
||||
/* variables local to this file */
|
||||
static int direction_unknown;
|
||||
static float xshear_val;
|
||||
static float yshear_val;
|
||||
static gint direction_unknown;
|
||||
static gdouble xshear_val;
|
||||
static gdouble yshear_val;
|
||||
|
||||
/* forward function declarations */
|
||||
static void * shear_tool_recalc (Tool *, void *);
|
||||
|
|
|
|||
|
|
@ -97,8 +97,8 @@ static CropOptions *crop_options = NULL;
|
|||
/* the crop tool info dialog */
|
||||
static InfoDialog *crop_info = NULL;
|
||||
|
||||
static gfloat orig_vals[2];
|
||||
static gfloat size_vals[2];
|
||||
static gdouble orig_vals[2];
|
||||
static gdouble size_vals[2];
|
||||
|
||||
static GtkWidget *origin_sizeentry;
|
||||
static GtkWidget *size_sizeentry;
|
||||
|
|
@ -954,30 +954,38 @@ crop_start (Tool *tool,
|
|||
|
||||
gimp_size_entry_set_resolution (GIMP_SIZE_ENTRY (origin_sizeentry), 0,
|
||||
gdisp->gimage->xresolution, FALSE);
|
||||
gimp_size_entry_set_size (GIMP_SIZE_ENTRY (origin_sizeentry), 0,
|
||||
0, gdisp->gimage->width);
|
||||
gimp_size_entry_set_resolution (GIMP_SIZE_ENTRY (origin_sizeentry), 1,
|
||||
gdisp->gimage->yresolution, FALSE);
|
||||
|
||||
gimp_size_entry_set_size (GIMP_SIZE_ENTRY (origin_sizeentry), 0,
|
||||
0, gdisp->gimage->width);
|
||||
gimp_size_entry_set_size (GIMP_SIZE_ENTRY (origin_sizeentry), 1,
|
||||
0, gdisp->gimage->height);
|
||||
|
||||
gimp_size_entry_set_resolution (GIMP_SIZE_ENTRY (size_sizeentry), 0,
|
||||
gdisp->gimage->xresolution, FALSE);
|
||||
gimp_size_entry_set_size (GIMP_SIZE_ENTRY (size_sizeentry), 0,
|
||||
0, gdisp->gimage->width);
|
||||
gimp_size_entry_set_resolution (GIMP_SIZE_ENTRY (size_sizeentry), 1,
|
||||
gdisp->gimage->yresolution, FALSE);
|
||||
|
||||
gimp_size_entry_set_size (GIMP_SIZE_ENTRY (size_sizeentry), 0,
|
||||
0, gdisp->gimage->width);
|
||||
gimp_size_entry_set_size (GIMP_SIZE_ENTRY (size_sizeentry), 1,
|
||||
0, gdisp->gimage->height);
|
||||
|
||||
if (old_gdisp != gdisp)
|
||||
{
|
||||
gimp_size_entry_set_unit (GIMP_SIZE_ENTRY (origin_sizeentry),
|
||||
(gdisp->dot_for_dot ? UNIT_PIXEL :
|
||||
gdisp->gimage->unit));
|
||||
gdisp->gimage->unit) ;
|
||||
gimp_size_entry_set_unit (GIMP_SIZE_ENTRY (size_sizeentry),
|
||||
(gdisp->dot_for_dot ? UNIT_PIXEL :
|
||||
gdisp->gimage->unit));
|
||||
gdisp->gimage->unit);
|
||||
|
||||
if (gdisp->dot_for_dot)
|
||||
{
|
||||
gimp_size_entry_set_unit (GIMP_SIZE_ENTRY (origin_sizeentry),
|
||||
UNIT_PIXEL);
|
||||
gimp_size_entry_set_unit (GIMP_SIZE_ENTRY (size_sizeentry),
|
||||
UNIT_PIXEL);
|
||||
}
|
||||
}
|
||||
|
||||
old_gdisp = gdisp;
|
||||
|
|
@ -1028,21 +1036,23 @@ crop_info_create (Tool *tool)
|
|||
gimp_size_entry_add_field (GIMP_SIZE_ENTRY (origin_sizeentry),
|
||||
GTK_SPIN_BUTTON (spinbutton), NULL);
|
||||
|
||||
gimp_size_entry_set_refval_boundaries (GIMP_SIZE_ENTRY (origin_sizeentry), 0,
|
||||
-65536, 65536);
|
||||
gimp_size_entry_set_resolution (GIMP_SIZE_ENTRY (origin_sizeentry), 0,
|
||||
gdisp->gimage->xresolution, FALSE);
|
||||
gimp_size_entry_set_size (GIMP_SIZE_ENTRY (origin_sizeentry), 0,
|
||||
0, gdisp->gimage->width);
|
||||
gimp_size_entry_set_refval (GIMP_SIZE_ENTRY (origin_sizeentry), 0,
|
||||
orig_vals[0]);
|
||||
|
||||
gimp_size_entry_set_refval_boundaries (GIMP_SIZE_ENTRY (origin_sizeentry), 1,
|
||||
-65536, 65536);
|
||||
gimp_size_entry_set_resolution (GIMP_SIZE_ENTRY (origin_sizeentry), 1,
|
||||
gdisp->gimage->yresolution, FALSE);
|
||||
|
||||
gimp_size_entry_set_refval_boundaries (GIMP_SIZE_ENTRY (origin_sizeentry), 0,
|
||||
-65536, 65536);
|
||||
gimp_size_entry_set_refval_boundaries (GIMP_SIZE_ENTRY (origin_sizeentry), 1,
|
||||
-65536, 65536);
|
||||
|
||||
gimp_size_entry_set_size (GIMP_SIZE_ENTRY (origin_sizeentry), 0,
|
||||
0, gdisp->gimage->width);
|
||||
gimp_size_entry_set_size (GIMP_SIZE_ENTRY (origin_sizeentry), 1,
|
||||
0, gdisp->gimage->height);
|
||||
|
||||
gimp_size_entry_set_refval (GIMP_SIZE_ENTRY (origin_sizeentry), 0,
|
||||
orig_vals[0]);
|
||||
gimp_size_entry_set_refval (GIMP_SIZE_ENTRY (origin_sizeentry), 1,
|
||||
orig_vals[1]);
|
||||
|
||||
|
|
@ -1057,20 +1067,22 @@ crop_info_create (Tool *tool)
|
|||
gimp_size_entry_add_field (GIMP_SIZE_ENTRY (size_sizeentry),
|
||||
GTK_SPIN_BUTTON (spinbutton), NULL);
|
||||
|
||||
gimp_size_entry_set_refval_boundaries (GIMP_SIZE_ENTRY (size_sizeentry), 0,
|
||||
-65536, 65536);
|
||||
gimp_size_entry_set_resolution (GIMP_SIZE_ENTRY (size_sizeentry), 0,
|
||||
gdisp->gimage->xresolution, FALSE);
|
||||
gimp_size_entry_set_size (GIMP_SIZE_ENTRY (size_sizeentry), 0,
|
||||
0, gdisp->gimage->width);
|
||||
gimp_size_entry_set_refval (GIMP_SIZE_ENTRY (size_sizeentry), 0, size_vals[0]);
|
||||
|
||||
gimp_size_entry_set_refval_boundaries (GIMP_SIZE_ENTRY (size_sizeentry), 1,
|
||||
-65536, 65536);
|
||||
gimp_size_entry_set_resolution (GIMP_SIZE_ENTRY (size_sizeentry), 1,
|
||||
gdisp->gimage->yresolution, FALSE);
|
||||
|
||||
gimp_size_entry_set_refval_boundaries (GIMP_SIZE_ENTRY (size_sizeentry), 0,
|
||||
-65536, 65536);
|
||||
gimp_size_entry_set_refval_boundaries (GIMP_SIZE_ENTRY (size_sizeentry), 1,
|
||||
-65536, 65536);
|
||||
|
||||
gimp_size_entry_set_size (GIMP_SIZE_ENTRY (size_sizeentry), 0,
|
||||
0, gdisp->gimage->width);
|
||||
gimp_size_entry_set_size (GIMP_SIZE_ENTRY (size_sizeentry), 1,
|
||||
0, gdisp->gimage->height);
|
||||
|
||||
gimp_size_entry_set_refval (GIMP_SIZE_ENTRY (size_sizeentry), 0, size_vals[0]);
|
||||
gimp_size_entry_set_refval (GIMP_SIZE_ENTRY (size_sizeentry), 1, size_vals[1]);
|
||||
|
||||
gtk_table_set_row_spacing (GTK_TABLE (crop_info->info_table), 0, 0);
|
||||
|
|
|
|||
|
|
@ -97,8 +97,8 @@ static CropOptions *crop_options = NULL;
|
|||
/* the crop tool info dialog */
|
||||
static InfoDialog *crop_info = NULL;
|
||||
|
||||
static gfloat orig_vals[2];
|
||||
static gfloat size_vals[2];
|
||||
static gdouble orig_vals[2];
|
||||
static gdouble size_vals[2];
|
||||
|
||||
static GtkWidget *origin_sizeentry;
|
||||
static GtkWidget *size_sizeentry;
|
||||
|
|
@ -954,30 +954,38 @@ crop_start (Tool *tool,
|
|||
|
||||
gimp_size_entry_set_resolution (GIMP_SIZE_ENTRY (origin_sizeentry), 0,
|
||||
gdisp->gimage->xresolution, FALSE);
|
||||
gimp_size_entry_set_size (GIMP_SIZE_ENTRY (origin_sizeentry), 0,
|
||||
0, gdisp->gimage->width);
|
||||
gimp_size_entry_set_resolution (GIMP_SIZE_ENTRY (origin_sizeentry), 1,
|
||||
gdisp->gimage->yresolution, FALSE);
|
||||
|
||||
gimp_size_entry_set_size (GIMP_SIZE_ENTRY (origin_sizeentry), 0,
|
||||
0, gdisp->gimage->width);
|
||||
gimp_size_entry_set_size (GIMP_SIZE_ENTRY (origin_sizeentry), 1,
|
||||
0, gdisp->gimage->height);
|
||||
|
||||
gimp_size_entry_set_resolution (GIMP_SIZE_ENTRY (size_sizeentry), 0,
|
||||
gdisp->gimage->xresolution, FALSE);
|
||||
gimp_size_entry_set_size (GIMP_SIZE_ENTRY (size_sizeentry), 0,
|
||||
0, gdisp->gimage->width);
|
||||
gimp_size_entry_set_resolution (GIMP_SIZE_ENTRY (size_sizeentry), 1,
|
||||
gdisp->gimage->yresolution, FALSE);
|
||||
|
||||
gimp_size_entry_set_size (GIMP_SIZE_ENTRY (size_sizeentry), 0,
|
||||
0, gdisp->gimage->width);
|
||||
gimp_size_entry_set_size (GIMP_SIZE_ENTRY (size_sizeentry), 1,
|
||||
0, gdisp->gimage->height);
|
||||
|
||||
if (old_gdisp != gdisp)
|
||||
{
|
||||
gimp_size_entry_set_unit (GIMP_SIZE_ENTRY (origin_sizeentry),
|
||||
(gdisp->dot_for_dot ? UNIT_PIXEL :
|
||||
gdisp->gimage->unit));
|
||||
gdisp->gimage->unit) ;
|
||||
gimp_size_entry_set_unit (GIMP_SIZE_ENTRY (size_sizeentry),
|
||||
(gdisp->dot_for_dot ? UNIT_PIXEL :
|
||||
gdisp->gimage->unit));
|
||||
gdisp->gimage->unit);
|
||||
|
||||
if (gdisp->dot_for_dot)
|
||||
{
|
||||
gimp_size_entry_set_unit (GIMP_SIZE_ENTRY (origin_sizeentry),
|
||||
UNIT_PIXEL);
|
||||
gimp_size_entry_set_unit (GIMP_SIZE_ENTRY (size_sizeentry),
|
||||
UNIT_PIXEL);
|
||||
}
|
||||
}
|
||||
|
||||
old_gdisp = gdisp;
|
||||
|
|
@ -1028,21 +1036,23 @@ crop_info_create (Tool *tool)
|
|||
gimp_size_entry_add_field (GIMP_SIZE_ENTRY (origin_sizeentry),
|
||||
GTK_SPIN_BUTTON (spinbutton), NULL);
|
||||
|
||||
gimp_size_entry_set_refval_boundaries (GIMP_SIZE_ENTRY (origin_sizeentry), 0,
|
||||
-65536, 65536);
|
||||
gimp_size_entry_set_resolution (GIMP_SIZE_ENTRY (origin_sizeentry), 0,
|
||||
gdisp->gimage->xresolution, FALSE);
|
||||
gimp_size_entry_set_size (GIMP_SIZE_ENTRY (origin_sizeentry), 0,
|
||||
0, gdisp->gimage->width);
|
||||
gimp_size_entry_set_refval (GIMP_SIZE_ENTRY (origin_sizeentry), 0,
|
||||
orig_vals[0]);
|
||||
|
||||
gimp_size_entry_set_refval_boundaries (GIMP_SIZE_ENTRY (origin_sizeentry), 1,
|
||||
-65536, 65536);
|
||||
gimp_size_entry_set_resolution (GIMP_SIZE_ENTRY (origin_sizeentry), 1,
|
||||
gdisp->gimage->yresolution, FALSE);
|
||||
|
||||
gimp_size_entry_set_refval_boundaries (GIMP_SIZE_ENTRY (origin_sizeentry), 0,
|
||||
-65536, 65536);
|
||||
gimp_size_entry_set_refval_boundaries (GIMP_SIZE_ENTRY (origin_sizeentry), 1,
|
||||
-65536, 65536);
|
||||
|
||||
gimp_size_entry_set_size (GIMP_SIZE_ENTRY (origin_sizeentry), 0,
|
||||
0, gdisp->gimage->width);
|
||||
gimp_size_entry_set_size (GIMP_SIZE_ENTRY (origin_sizeentry), 1,
|
||||
0, gdisp->gimage->height);
|
||||
|
||||
gimp_size_entry_set_refval (GIMP_SIZE_ENTRY (origin_sizeentry), 0,
|
||||
orig_vals[0]);
|
||||
gimp_size_entry_set_refval (GIMP_SIZE_ENTRY (origin_sizeentry), 1,
|
||||
orig_vals[1]);
|
||||
|
||||
|
|
@ -1057,20 +1067,22 @@ crop_info_create (Tool *tool)
|
|||
gimp_size_entry_add_field (GIMP_SIZE_ENTRY (size_sizeentry),
|
||||
GTK_SPIN_BUTTON (spinbutton), NULL);
|
||||
|
||||
gimp_size_entry_set_refval_boundaries (GIMP_SIZE_ENTRY (size_sizeentry), 0,
|
||||
-65536, 65536);
|
||||
gimp_size_entry_set_resolution (GIMP_SIZE_ENTRY (size_sizeentry), 0,
|
||||
gdisp->gimage->xresolution, FALSE);
|
||||
gimp_size_entry_set_size (GIMP_SIZE_ENTRY (size_sizeentry), 0,
|
||||
0, gdisp->gimage->width);
|
||||
gimp_size_entry_set_refval (GIMP_SIZE_ENTRY (size_sizeentry), 0, size_vals[0]);
|
||||
|
||||
gimp_size_entry_set_refval_boundaries (GIMP_SIZE_ENTRY (size_sizeentry), 1,
|
||||
-65536, 65536);
|
||||
gimp_size_entry_set_resolution (GIMP_SIZE_ENTRY (size_sizeentry), 1,
|
||||
gdisp->gimage->yresolution, FALSE);
|
||||
|
||||
gimp_size_entry_set_refval_boundaries (GIMP_SIZE_ENTRY (size_sizeentry), 0,
|
||||
-65536, 65536);
|
||||
gimp_size_entry_set_refval_boundaries (GIMP_SIZE_ENTRY (size_sizeentry), 1,
|
||||
-65536, 65536);
|
||||
|
||||
gimp_size_entry_set_size (GIMP_SIZE_ENTRY (size_sizeentry), 0,
|
||||
0, gdisp->gimage->width);
|
||||
gimp_size_entry_set_size (GIMP_SIZE_ENTRY (size_sizeentry), 1,
|
||||
0, gdisp->gimage->height);
|
||||
|
||||
gimp_size_entry_set_refval (GIMP_SIZE_ENTRY (size_sizeentry), 0, size_vals[0]);
|
||||
gimp_size_entry_set_refval (GIMP_SIZE_ENTRY (size_sizeentry), 1, size_vals[1]);
|
||||
|
||||
gtk_table_set_row_spacing (GTK_TABLE (crop_info->info_table), 0, 0);
|
||||
|
|
|
|||
|
|
@ -31,8 +31,8 @@
|
|||
|
||||
#include "tile_manager_pvt.h"
|
||||
|
||||
#include "libgimp/gimpintl.h"
|
||||
#include "libgimp/gimpsizeentry.h"
|
||||
#include "libgimp/gimpintl.h"
|
||||
|
||||
#ifndef M_PI
|
||||
#define M_PI 3.14159265358979323846
|
||||
|
|
@ -48,8 +48,8 @@
|
|||
#define FIFTEEN_DEG (M_PI / 12.0)
|
||||
|
||||
/* variables local to this file */
|
||||
static gfloat angle_val;
|
||||
static gfloat center_vals[2];
|
||||
static gdouble angle_val;
|
||||
static gdouble center_vals[2];
|
||||
|
||||
/* needed for size update */
|
||||
static GtkWidget *sizeentry;
|
||||
|
|
@ -59,7 +59,7 @@ static void * rotate_tool_recalc (Tool *, void *);
|
|||
static void rotate_tool_motion (Tool *, void *);
|
||||
static void rotate_info_update (Tool *);
|
||||
|
||||
/* callback functions for the info dialog entries */
|
||||
/* callback functions for the info dialog sizeentries */
|
||||
static void rotate_angle_changed (GtkWidget *entry, gpointer data);
|
||||
static void rotate_center_changed (GtkWidget *entry, gpointer data);
|
||||
|
||||
|
|
@ -110,25 +110,26 @@ rotate_tool_transform (Tool *tool,
|
|||
gimp_size_entry_add_field (GIMP_SIZE_ENTRY (sizeentry),
|
||||
GTK_SPIN_BUTTON (spinbutton2), NULL);
|
||||
|
||||
gimp_size_entry_set_refval_boundaries (GIMP_SIZE_ENTRY (sizeentry), 0,
|
||||
-4096,
|
||||
4096 + gdisp->gimage->width);
|
||||
gimp_size_entry_set_resolution (GIMP_SIZE_ENTRY (sizeentry), 0,
|
||||
gdisp->gimage->xresolution, FALSE);
|
||||
gimp_size_entry_set_refval (GIMP_SIZE_ENTRY (sizeentry), 0,
|
||||
center_vals[0]);
|
||||
|
||||
gimp_size_entry_set_refval_boundaries (GIMP_SIZE_ENTRY (sizeentry), 1,
|
||||
-4096,
|
||||
4096 + gdisp->gimage->height);
|
||||
gimp_size_entry_set_resolution (GIMP_SIZE_ENTRY (sizeentry), 1,
|
||||
gdisp->gimage->yresolution, FALSE);
|
||||
gimp_size_entry_set_refval (GIMP_SIZE_ENTRY (sizeentry), 1,
|
||||
center_vals[1]);
|
||||
|
||||
if (gdisp->dot_for_dot)
|
||||
gimp_size_entry_set_unit (GIMP_SIZE_ENTRY (sizeentry), UNIT_PIXEL);
|
||||
|
||||
gimp_size_entry_set_resolution (GIMP_SIZE_ENTRY (sizeentry), 0,
|
||||
gdisp->gimage->xresolution, FALSE);
|
||||
gimp_size_entry_set_resolution (GIMP_SIZE_ENTRY (sizeentry), 1,
|
||||
gdisp->gimage->yresolution, FALSE);
|
||||
|
||||
gimp_size_entry_set_refval_boundaries (GIMP_SIZE_ENTRY (sizeentry), 0,
|
||||
-65536,
|
||||
65536 + gdisp->gimage->width);
|
||||
gimp_size_entry_set_refval_boundaries (GIMP_SIZE_ENTRY (sizeentry), 1,
|
||||
-65536,
|
||||
65536 + gdisp->gimage->height);
|
||||
|
||||
gimp_size_entry_set_refval (GIMP_SIZE_ENTRY (sizeentry), 0,
|
||||
center_vals[0]);
|
||||
gimp_size_entry_set_refval (GIMP_SIZE_ENTRY (sizeentry), 1,
|
||||
center_vals[1]);
|
||||
|
||||
gtk_table_set_row_spacing (GTK_TABLE (transform_info->info_table),
|
||||
1, 6);
|
||||
gtk_table_set_row_spacing (GTK_TABLE (transform_info->info_table),
|
||||
|
|
@ -235,7 +236,7 @@ rotate_angle_changed (GtkWidget *w,
|
|||
TransformCore *transform_core;
|
||||
double value;
|
||||
|
||||
tool = (Tool *)data;
|
||||
tool = (Tool *) data;
|
||||
|
||||
if (tool)
|
||||
{
|
||||
|
|
@ -266,15 +267,15 @@ rotate_center_changed (GtkWidget *w,
|
|||
int cx;
|
||||
int cy;
|
||||
|
||||
tool = (Tool *)data;
|
||||
tool = (Tool *) data;
|
||||
|
||||
if (tool)
|
||||
{
|
||||
gdisp = (GDisplay *) tool->gdisp_ptr;
|
||||
transform_core = (TransformCore *) tool->private;
|
||||
|
||||
cx = gimp_size_entry_get_refval (GIMP_SIZE_ENTRY (w), 0);
|
||||
cy = gimp_size_entry_get_refval (GIMP_SIZE_ENTRY (w), 1);
|
||||
cx = (int) (gimp_size_entry_get_refval (GIMP_SIZE_ENTRY (w), 0) + 0.5);
|
||||
cy = (int) (gimp_size_entry_get_refval (GIMP_SIZE_ENTRY (w), 1) + 0.5);
|
||||
|
||||
if ((cx != transform_core->cx) ||
|
||||
(cy != transform_core->cy))
|
||||
|
|
@ -333,16 +334,18 @@ rotate_tool_motion (Tool *tool,
|
|||
|
||||
/* limit the angle to between 0 and 360 degrees */
|
||||
if (transform_core->trans_info[REAL_ANGLE] < - M_PI)
|
||||
transform_core->trans_info[REAL_ANGLE] = 2 * M_PI - transform_core->trans_info[REAL_ANGLE];
|
||||
transform_core->trans_info[REAL_ANGLE] =
|
||||
2 * M_PI - transform_core->trans_info[REAL_ANGLE];
|
||||
else if (transform_core->trans_info[REAL_ANGLE] > M_PI)
|
||||
transform_core->trans_info[REAL_ANGLE] = transform_core->trans_info[REAL_ANGLE] - 2 * M_PI;
|
||||
transform_core->trans_info[REAL_ANGLE] =
|
||||
transform_core->trans_info[REAL_ANGLE] - 2 * M_PI;
|
||||
|
||||
/* constrain the angle to 15-degree multiples if ctrl is held down */
|
||||
|
||||
/* constrain the angle to 15-degree multiples if ctrl is held down */
|
||||
if (transform_core->state & GDK_CONTROL_MASK)
|
||||
transform_core->trans_info[ANGLE] = FIFTEEN_DEG * (int) ((transform_core->trans_info[REAL_ANGLE] +
|
||||
FIFTEEN_DEG / 2.0) /
|
||||
FIFTEEN_DEG);
|
||||
transform_core->trans_info[ANGLE] =
|
||||
FIFTEEN_DEG * (int) ((transform_core->trans_info[REAL_ANGLE] +
|
||||
FIFTEEN_DEG / 2.0) /
|
||||
FIFTEEN_DEG);
|
||||
else
|
||||
transform_core->trans_info[ANGLE] = transform_core->trans_info[REAL_ANGLE];
|
||||
}
|
||||
|
|
@ -364,7 +367,8 @@ rotate_tool_recalc (Tool *tool,
|
|||
/* assemble the transformation matrix */
|
||||
gimp_matrix_identity (transform_core->transform);
|
||||
gimp_matrix_translate (transform_core->transform, -cx, -cy);
|
||||
gimp_matrix_rotate (transform_core->transform, transform_core->trans_info[ANGLE]);
|
||||
gimp_matrix_rotate (transform_core->transform,
|
||||
transform_core->trans_info[ANGLE]);
|
||||
gimp_matrix_translate (transform_core->transform, +cx, +cy);
|
||||
|
||||
/* transform the bounding box */
|
||||
|
|
|
|||
|
|
@ -29,26 +29,27 @@
|
|||
|
||||
#include "tile_manager_pvt.h"
|
||||
|
||||
#include "libgimp/gimplimits.h"
|
||||
#include "libgimp/gimpintl.h"
|
||||
|
||||
/* storage for information dialog fields */
|
||||
static gchar orig_width_buf [MAX_INFO_BUF];
|
||||
static gchar orig_height_buf [MAX_INFO_BUF];
|
||||
static gfloat size_vals[2];
|
||||
static gchar x_ratio_buf [MAX_INFO_BUF];
|
||||
static gchar y_ratio_buf [MAX_INFO_BUF];
|
||||
static gchar orig_width_buf[MAX_INFO_BUF];
|
||||
static gchar orig_height_buf[MAX_INFO_BUF];
|
||||
static gdouble size_vals[2];
|
||||
static gchar x_ratio_buf[MAX_INFO_BUF];
|
||||
static gchar y_ratio_buf[MAX_INFO_BUF];
|
||||
|
||||
/* needed for original size unit update */
|
||||
static GtkWidget *sizeentry;
|
||||
static GtkWidget *sizeentry;
|
||||
|
||||
/* forward function declarations */
|
||||
static void * scale_tool_recalc (Tool *, void *);
|
||||
static void scale_tool_motion (Tool *, void *);
|
||||
static void scale_info_update (Tool *);
|
||||
static void * scale_tool_recalc (Tool *, void *);
|
||||
static void scale_tool_motion (Tool *, void *);
|
||||
static void scale_info_update (Tool *);
|
||||
|
||||
/* callback functions for the info dialog fields */
|
||||
static void scale_size_changed (GtkWidget *w, gpointer data);
|
||||
static void scale_unit_changed (GtkWidget *w, gpointer data);
|
||||
static void scale_size_changed (GtkWidget *w, gpointer data);
|
||||
static void scale_unit_changed (GtkWidget *w, gpointer data);
|
||||
|
||||
void *
|
||||
scale_tool_transform (Tool *tool,
|
||||
|
|
@ -89,23 +90,26 @@ scale_tool_transform (Tool *tool,
|
|||
gtk_signal_connect (GTK_OBJECT (sizeentry), "unit_changed",
|
||||
scale_unit_changed, tool);
|
||||
|
||||
gimp_size_entry_set_refval_boundaries (GIMP_SIZE_ENTRY (sizeentry), 0,
|
||||
1, 65536);
|
||||
gimp_size_entry_set_resolution (GIMP_SIZE_ENTRY (sizeentry), 0,
|
||||
gdisp->gimage->xresolution, FALSE);
|
||||
gimp_size_entry_set_refval (GIMP_SIZE_ENTRY (sizeentry), 0,
|
||||
size_vals[0]);
|
||||
|
||||
gimp_size_entry_set_refval_boundaries (GIMP_SIZE_ENTRY (sizeentry), 1,
|
||||
1, 65536);
|
||||
gimp_size_entry_set_resolution (GIMP_SIZE_ENTRY (sizeentry), 1,
|
||||
gdisp->gimage->yresolution, FALSE);
|
||||
gimp_size_entry_set_refval (GIMP_SIZE_ENTRY (sizeentry), 1,
|
||||
size_vals[1]);
|
||||
|
||||
if (gdisp->dot_for_dot)
|
||||
gimp_size_entry_set_unit (GIMP_SIZE_ENTRY (sizeentry), UNIT_PIXEL);
|
||||
|
||||
gimp_size_entry_set_resolution (GIMP_SIZE_ENTRY (sizeentry), 0,
|
||||
gdisp->gimage->xresolution, FALSE);
|
||||
gimp_size_entry_set_resolution (GIMP_SIZE_ENTRY (sizeentry), 1,
|
||||
gdisp->gimage->yresolution, FALSE);
|
||||
|
||||
gimp_size_entry_set_refval_boundaries (GIMP_SIZE_ENTRY (sizeentry), 0,
|
||||
GIMP_MIN_IMAGE_SIZE,
|
||||
GIMP_MAX_IMAGE_SIZE);
|
||||
gimp_size_entry_set_refval_boundaries (GIMP_SIZE_ENTRY (sizeentry), 1,
|
||||
GIMP_MIN_IMAGE_SIZE,
|
||||
GIMP_MAX_IMAGE_SIZE);
|
||||
|
||||
gimp_size_entry_set_refval (GIMP_SIZE_ENTRY (sizeentry), 0,
|
||||
size_vals[0]);
|
||||
gimp_size_entry_set_refval (GIMP_SIZE_ENTRY (sizeentry), 1,
|
||||
size_vals[1]);
|
||||
|
||||
info_dialog_add_label (transform_info, _("Scale Ratio X:"),
|
||||
x_ratio_buf);
|
||||
info_dialog_add_label (transform_info, _("Y:"),
|
||||
|
|
@ -269,8 +273,8 @@ scale_size_changed (GtkWidget *w,
|
|||
gdisp = (GDisplay *) tool->gdisp_ptr;
|
||||
transform_core = (TransformCore *) tool->private;
|
||||
|
||||
width = gimp_size_entry_get_refval (GIMP_SIZE_ENTRY (w), 0);
|
||||
height = gimp_size_entry_get_refval (GIMP_SIZE_ENTRY (w), 1);
|
||||
width = (int) (gimp_size_entry_get_refval (GIMP_SIZE_ENTRY (w), 0) + 0.5);
|
||||
height = (int) (gimp_size_entry_get_refval (GIMP_SIZE_ENTRY (w), 1) + 0.5);
|
||||
|
||||
if ((width != (transform_core->trans_info[X1] -
|
||||
transform_core->trans_info[X0])) ||
|
||||
|
|
|
|||
|
|
@ -42,9 +42,9 @@
|
|||
#define MIN_MOVE 5
|
||||
|
||||
/* variables local to this file */
|
||||
static int direction_unknown;
|
||||
static float xshear_val;
|
||||
static float yshear_val;
|
||||
static gint direction_unknown;
|
||||
static gdouble xshear_val;
|
||||
static gdouble yshear_val;
|
||||
|
||||
/* forward function declarations */
|
||||
static void * shear_tool_recalc (Tool *, void *);
|
||||
|
|
|
|||
|
|
@ -31,8 +31,8 @@
|
|||
|
||||
#include "tile_manager_pvt.h"
|
||||
|
||||
#include "libgimp/gimpintl.h"
|
||||
#include "libgimp/gimpsizeentry.h"
|
||||
#include "libgimp/gimpintl.h"
|
||||
|
||||
#ifndef M_PI
|
||||
#define M_PI 3.14159265358979323846
|
||||
|
|
@ -48,8 +48,8 @@
|
|||
#define FIFTEEN_DEG (M_PI / 12.0)
|
||||
|
||||
/* variables local to this file */
|
||||
static gfloat angle_val;
|
||||
static gfloat center_vals[2];
|
||||
static gdouble angle_val;
|
||||
static gdouble center_vals[2];
|
||||
|
||||
/* needed for size update */
|
||||
static GtkWidget *sizeentry;
|
||||
|
|
@ -59,7 +59,7 @@ static void * rotate_tool_recalc (Tool *, void *);
|
|||
static void rotate_tool_motion (Tool *, void *);
|
||||
static void rotate_info_update (Tool *);
|
||||
|
||||
/* callback functions for the info dialog entries */
|
||||
/* callback functions for the info dialog sizeentries */
|
||||
static void rotate_angle_changed (GtkWidget *entry, gpointer data);
|
||||
static void rotate_center_changed (GtkWidget *entry, gpointer data);
|
||||
|
||||
|
|
@ -110,25 +110,26 @@ rotate_tool_transform (Tool *tool,
|
|||
gimp_size_entry_add_field (GIMP_SIZE_ENTRY (sizeentry),
|
||||
GTK_SPIN_BUTTON (spinbutton2), NULL);
|
||||
|
||||
gimp_size_entry_set_refval_boundaries (GIMP_SIZE_ENTRY (sizeentry), 0,
|
||||
-4096,
|
||||
4096 + gdisp->gimage->width);
|
||||
gimp_size_entry_set_resolution (GIMP_SIZE_ENTRY (sizeentry), 0,
|
||||
gdisp->gimage->xresolution, FALSE);
|
||||
gimp_size_entry_set_refval (GIMP_SIZE_ENTRY (sizeentry), 0,
|
||||
center_vals[0]);
|
||||
|
||||
gimp_size_entry_set_refval_boundaries (GIMP_SIZE_ENTRY (sizeentry), 1,
|
||||
-4096,
|
||||
4096 + gdisp->gimage->height);
|
||||
gimp_size_entry_set_resolution (GIMP_SIZE_ENTRY (sizeentry), 1,
|
||||
gdisp->gimage->yresolution, FALSE);
|
||||
gimp_size_entry_set_refval (GIMP_SIZE_ENTRY (sizeentry), 1,
|
||||
center_vals[1]);
|
||||
|
||||
if (gdisp->dot_for_dot)
|
||||
gimp_size_entry_set_unit (GIMP_SIZE_ENTRY (sizeentry), UNIT_PIXEL);
|
||||
|
||||
gimp_size_entry_set_resolution (GIMP_SIZE_ENTRY (sizeentry), 0,
|
||||
gdisp->gimage->xresolution, FALSE);
|
||||
gimp_size_entry_set_resolution (GIMP_SIZE_ENTRY (sizeentry), 1,
|
||||
gdisp->gimage->yresolution, FALSE);
|
||||
|
||||
gimp_size_entry_set_refval_boundaries (GIMP_SIZE_ENTRY (sizeentry), 0,
|
||||
-65536,
|
||||
65536 + gdisp->gimage->width);
|
||||
gimp_size_entry_set_refval_boundaries (GIMP_SIZE_ENTRY (sizeentry), 1,
|
||||
-65536,
|
||||
65536 + gdisp->gimage->height);
|
||||
|
||||
gimp_size_entry_set_refval (GIMP_SIZE_ENTRY (sizeentry), 0,
|
||||
center_vals[0]);
|
||||
gimp_size_entry_set_refval (GIMP_SIZE_ENTRY (sizeentry), 1,
|
||||
center_vals[1]);
|
||||
|
||||
gtk_table_set_row_spacing (GTK_TABLE (transform_info->info_table),
|
||||
1, 6);
|
||||
gtk_table_set_row_spacing (GTK_TABLE (transform_info->info_table),
|
||||
|
|
@ -235,7 +236,7 @@ rotate_angle_changed (GtkWidget *w,
|
|||
TransformCore *transform_core;
|
||||
double value;
|
||||
|
||||
tool = (Tool *)data;
|
||||
tool = (Tool *) data;
|
||||
|
||||
if (tool)
|
||||
{
|
||||
|
|
@ -266,15 +267,15 @@ rotate_center_changed (GtkWidget *w,
|
|||
int cx;
|
||||
int cy;
|
||||
|
||||
tool = (Tool *)data;
|
||||
tool = (Tool *) data;
|
||||
|
||||
if (tool)
|
||||
{
|
||||
gdisp = (GDisplay *) tool->gdisp_ptr;
|
||||
transform_core = (TransformCore *) tool->private;
|
||||
|
||||
cx = gimp_size_entry_get_refval (GIMP_SIZE_ENTRY (w), 0);
|
||||
cy = gimp_size_entry_get_refval (GIMP_SIZE_ENTRY (w), 1);
|
||||
cx = (int) (gimp_size_entry_get_refval (GIMP_SIZE_ENTRY (w), 0) + 0.5);
|
||||
cy = (int) (gimp_size_entry_get_refval (GIMP_SIZE_ENTRY (w), 1) + 0.5);
|
||||
|
||||
if ((cx != transform_core->cx) ||
|
||||
(cy != transform_core->cy))
|
||||
|
|
@ -333,16 +334,18 @@ rotate_tool_motion (Tool *tool,
|
|||
|
||||
/* limit the angle to between 0 and 360 degrees */
|
||||
if (transform_core->trans_info[REAL_ANGLE] < - M_PI)
|
||||
transform_core->trans_info[REAL_ANGLE] = 2 * M_PI - transform_core->trans_info[REAL_ANGLE];
|
||||
transform_core->trans_info[REAL_ANGLE] =
|
||||
2 * M_PI - transform_core->trans_info[REAL_ANGLE];
|
||||
else if (transform_core->trans_info[REAL_ANGLE] > M_PI)
|
||||
transform_core->trans_info[REAL_ANGLE] = transform_core->trans_info[REAL_ANGLE] - 2 * M_PI;
|
||||
transform_core->trans_info[REAL_ANGLE] =
|
||||
transform_core->trans_info[REAL_ANGLE] - 2 * M_PI;
|
||||
|
||||
/* constrain the angle to 15-degree multiples if ctrl is held down */
|
||||
|
||||
/* constrain the angle to 15-degree multiples if ctrl is held down */
|
||||
if (transform_core->state & GDK_CONTROL_MASK)
|
||||
transform_core->trans_info[ANGLE] = FIFTEEN_DEG * (int) ((transform_core->trans_info[REAL_ANGLE] +
|
||||
FIFTEEN_DEG / 2.0) /
|
||||
FIFTEEN_DEG);
|
||||
transform_core->trans_info[ANGLE] =
|
||||
FIFTEEN_DEG * (int) ((transform_core->trans_info[REAL_ANGLE] +
|
||||
FIFTEEN_DEG / 2.0) /
|
||||
FIFTEEN_DEG);
|
||||
else
|
||||
transform_core->trans_info[ANGLE] = transform_core->trans_info[REAL_ANGLE];
|
||||
}
|
||||
|
|
@ -364,7 +367,8 @@ rotate_tool_recalc (Tool *tool,
|
|||
/* assemble the transformation matrix */
|
||||
gimp_matrix_identity (transform_core->transform);
|
||||
gimp_matrix_translate (transform_core->transform, -cx, -cy);
|
||||
gimp_matrix_rotate (transform_core->transform, transform_core->trans_info[ANGLE]);
|
||||
gimp_matrix_rotate (transform_core->transform,
|
||||
transform_core->trans_info[ANGLE]);
|
||||
gimp_matrix_translate (transform_core->transform, +cx, +cy);
|
||||
|
||||
/* transform the bounding box */
|
||||
|
|
|
|||
|
|
@ -29,26 +29,27 @@
|
|||
|
||||
#include "tile_manager_pvt.h"
|
||||
|
||||
#include "libgimp/gimplimits.h"
|
||||
#include "libgimp/gimpintl.h"
|
||||
|
||||
/* storage for information dialog fields */
|
||||
static gchar orig_width_buf [MAX_INFO_BUF];
|
||||
static gchar orig_height_buf [MAX_INFO_BUF];
|
||||
static gfloat size_vals[2];
|
||||
static gchar x_ratio_buf [MAX_INFO_BUF];
|
||||
static gchar y_ratio_buf [MAX_INFO_BUF];
|
||||
static gchar orig_width_buf[MAX_INFO_BUF];
|
||||
static gchar orig_height_buf[MAX_INFO_BUF];
|
||||
static gdouble size_vals[2];
|
||||
static gchar x_ratio_buf[MAX_INFO_BUF];
|
||||
static gchar y_ratio_buf[MAX_INFO_BUF];
|
||||
|
||||
/* needed for original size unit update */
|
||||
static GtkWidget *sizeentry;
|
||||
static GtkWidget *sizeentry;
|
||||
|
||||
/* forward function declarations */
|
||||
static void * scale_tool_recalc (Tool *, void *);
|
||||
static void scale_tool_motion (Tool *, void *);
|
||||
static void scale_info_update (Tool *);
|
||||
static void * scale_tool_recalc (Tool *, void *);
|
||||
static void scale_tool_motion (Tool *, void *);
|
||||
static void scale_info_update (Tool *);
|
||||
|
||||
/* callback functions for the info dialog fields */
|
||||
static void scale_size_changed (GtkWidget *w, gpointer data);
|
||||
static void scale_unit_changed (GtkWidget *w, gpointer data);
|
||||
static void scale_size_changed (GtkWidget *w, gpointer data);
|
||||
static void scale_unit_changed (GtkWidget *w, gpointer data);
|
||||
|
||||
void *
|
||||
scale_tool_transform (Tool *tool,
|
||||
|
|
@ -89,23 +90,26 @@ scale_tool_transform (Tool *tool,
|
|||
gtk_signal_connect (GTK_OBJECT (sizeentry), "unit_changed",
|
||||
scale_unit_changed, tool);
|
||||
|
||||
gimp_size_entry_set_refval_boundaries (GIMP_SIZE_ENTRY (sizeentry), 0,
|
||||
1, 65536);
|
||||
gimp_size_entry_set_resolution (GIMP_SIZE_ENTRY (sizeentry), 0,
|
||||
gdisp->gimage->xresolution, FALSE);
|
||||
gimp_size_entry_set_refval (GIMP_SIZE_ENTRY (sizeentry), 0,
|
||||
size_vals[0]);
|
||||
|
||||
gimp_size_entry_set_refval_boundaries (GIMP_SIZE_ENTRY (sizeentry), 1,
|
||||
1, 65536);
|
||||
gimp_size_entry_set_resolution (GIMP_SIZE_ENTRY (sizeentry), 1,
|
||||
gdisp->gimage->yresolution, FALSE);
|
||||
gimp_size_entry_set_refval (GIMP_SIZE_ENTRY (sizeentry), 1,
|
||||
size_vals[1]);
|
||||
|
||||
if (gdisp->dot_for_dot)
|
||||
gimp_size_entry_set_unit (GIMP_SIZE_ENTRY (sizeentry), UNIT_PIXEL);
|
||||
|
||||
gimp_size_entry_set_resolution (GIMP_SIZE_ENTRY (sizeentry), 0,
|
||||
gdisp->gimage->xresolution, FALSE);
|
||||
gimp_size_entry_set_resolution (GIMP_SIZE_ENTRY (sizeentry), 1,
|
||||
gdisp->gimage->yresolution, FALSE);
|
||||
|
||||
gimp_size_entry_set_refval_boundaries (GIMP_SIZE_ENTRY (sizeentry), 0,
|
||||
GIMP_MIN_IMAGE_SIZE,
|
||||
GIMP_MAX_IMAGE_SIZE);
|
||||
gimp_size_entry_set_refval_boundaries (GIMP_SIZE_ENTRY (sizeentry), 1,
|
||||
GIMP_MIN_IMAGE_SIZE,
|
||||
GIMP_MAX_IMAGE_SIZE);
|
||||
|
||||
gimp_size_entry_set_refval (GIMP_SIZE_ENTRY (sizeentry), 0,
|
||||
size_vals[0]);
|
||||
gimp_size_entry_set_refval (GIMP_SIZE_ENTRY (sizeentry), 1,
|
||||
size_vals[1]);
|
||||
|
||||
info_dialog_add_label (transform_info, _("Scale Ratio X:"),
|
||||
x_ratio_buf);
|
||||
info_dialog_add_label (transform_info, _("Y:"),
|
||||
|
|
@ -269,8 +273,8 @@ scale_size_changed (GtkWidget *w,
|
|||
gdisp = (GDisplay *) tool->gdisp_ptr;
|
||||
transform_core = (TransformCore *) tool->private;
|
||||
|
||||
width = gimp_size_entry_get_refval (GIMP_SIZE_ENTRY (w), 0);
|
||||
height = gimp_size_entry_get_refval (GIMP_SIZE_ENTRY (w), 1);
|
||||
width = (int) (gimp_size_entry_get_refval (GIMP_SIZE_ENTRY (w), 0) + 0.5);
|
||||
height = (int) (gimp_size_entry_get_refval (GIMP_SIZE_ENTRY (w), 1) + 0.5);
|
||||
|
||||
if ((width != (transform_core->trans_info[X1] -
|
||||
transform_core->trans_info[X0])) ||
|
||||
|
|
|
|||
|
|
@ -42,9 +42,9 @@
|
|||
#define MIN_MOVE 5
|
||||
|
||||
/* variables local to this file */
|
||||
static int direction_unknown;
|
||||
static float xshear_val;
|
||||
static float yshear_val;
|
||||
static gint direction_unknown;
|
||||
static gdouble xshear_val;
|
||||
static gdouble yshear_val;
|
||||
|
||||
/* forward function declarations */
|
||||
static void * shear_tool_recalc (Tool *, void *);
|
||||
|
|
|
|||
Loading…
Reference in a new issue