mirror of https://github.com/GNOME/gimp.git
app/gui/file-new-dialog.c app/gui/offset-dialog.c
2002-09-07 Michael Natterer <mitch@gimp.org> * app/gui/file-new-dialog.c * app/gui/offset-dialog.c * app/gui/preferences-dialog.c * app/gui/resolution-calibrate-dialog.c * app/gui/user-install-dialog.c: replaced some more pixel sizes by char sizes. Tweaked table spacings. Mnemonics. * app/gui/info-dialog.[ch]: internal cleanup. * app/gui/resize-dialog.[ch]: same here. Removed the "cancel_cb" from the API and simply destroy the dialog on "Cancel". Makes the dialog construction less weird. * app/gui/image-commands.c * app/gui/layers-commands.c: changed accordingly. Same cleanups as above.
This commit is contained in:
parent
b7afbfee4c
commit
991a7e5b5e
19
ChangeLog
19
ChangeLog
|
@ -1,3 +1,22 @@
|
|||
2002-09-07 Michael Natterer <mitch@gimp.org>
|
||||
|
||||
* app/gui/file-new-dialog.c
|
||||
* app/gui/offset-dialog.c
|
||||
* app/gui/preferences-dialog.c
|
||||
* app/gui/resolution-calibrate-dialog.c
|
||||
* app/gui/user-install-dialog.c: replaced some more pixel sizes by
|
||||
char sizes. Tweaked table spacings. Mnemonics.
|
||||
|
||||
* app/gui/info-dialog.[ch]: internal cleanup.
|
||||
|
||||
* app/gui/resize-dialog.[ch]: same here. Removed the "cancel_cb"
|
||||
from the API and simply destroy the dialog on "Cancel". Makes the
|
||||
dialog construction less weird.
|
||||
|
||||
* app/gui/image-commands.c
|
||||
* app/gui/layers-commands.c: changed accordingly. Same cleanups
|
||||
as above.
|
||||
|
||||
2002-09-07 Michael Natterer <mitch@gimp.org>
|
||||
|
||||
* plug-ins/FractalExplorer/Dialogs.c
|
||||
|
|
|
@ -127,20 +127,21 @@ image_resize_cmd_callback (GtkWidget *widget,
|
|||
|
||||
image_resize->gdisp = gdisp;
|
||||
image_resize->gimage = gimage;
|
||||
image_resize->resize = resize_widget_new (gimage,
|
||||
ResizeWidget,
|
||||
ResizeImage,
|
||||
G_OBJECT (gdisp),
|
||||
"disconnect",
|
||||
gimage->width,
|
||||
gimage->height,
|
||||
gimage->xresolution,
|
||||
gimage->yresolution,
|
||||
gimage->unit,
|
||||
GIMP_DISPLAY_SHELL (gdisp->shell)->dot_for_dot,
|
||||
G_CALLBACK (image_resize_callback),
|
||||
NULL,
|
||||
image_resize);
|
||||
|
||||
image_resize->resize =
|
||||
resize_widget_new (gimage,
|
||||
ResizeWidget,
|
||||
ResizeImage,
|
||||
G_OBJECT (gdisp),
|
||||
"disconnect",
|
||||
gimage->width,
|
||||
gimage->height,
|
||||
gimage->xresolution,
|
||||
gimage->yresolution,
|
||||
gimage->unit,
|
||||
GIMP_DISPLAY_SHELL (gdisp->shell)->dot_for_dot,
|
||||
G_CALLBACK (image_resize_callback),
|
||||
image_resize);
|
||||
|
||||
g_object_weak_ref (G_OBJECT (image_resize->resize->resize_shell),
|
||||
(GWeakNotify) g_free,
|
||||
|
@ -164,20 +165,21 @@ image_scale_cmd_callback (GtkWidget *widget,
|
|||
|
||||
image_scale->gdisp = gdisp;
|
||||
image_scale->gimage = gimage;
|
||||
image_scale->resize = resize_widget_new (gimage,
|
||||
ScaleWidget,
|
||||
ResizeImage,
|
||||
G_OBJECT (gdisp),
|
||||
"disconnect",
|
||||
gimage->width,
|
||||
gimage->height,
|
||||
gimage->xresolution,
|
||||
gimage->yresolution,
|
||||
gimage->unit,
|
||||
GIMP_DISPLAY_SHELL (gdisp->shell)->dot_for_dot,
|
||||
G_CALLBACK (image_scale_callback),
|
||||
NULL,
|
||||
image_scale);
|
||||
|
||||
image_scale->resize =
|
||||
resize_widget_new (gimage,
|
||||
ScaleWidget,
|
||||
ResizeImage,
|
||||
G_OBJECT (gdisp),
|
||||
"disconnect",
|
||||
gimage->width,
|
||||
gimage->height,
|
||||
gimage->xresolution,
|
||||
gimage->yresolution,
|
||||
gimage->unit,
|
||||
GIMP_DISPLAY_SHELL (gdisp->shell)->dot_for_dot,
|
||||
G_CALLBACK (image_scale_callback),
|
||||
image_scale);
|
||||
|
||||
g_object_weak_ref (G_OBJECT (image_scale->resize->resize_shell),
|
||||
(GWeakNotify) g_free,
|
||||
|
|
|
@ -617,7 +617,7 @@ layers_new_layer_query (GimpImage *gimage,
|
|||
options);
|
||||
|
||||
/* The main vbox */
|
||||
vbox = gtk_vbox_new (FALSE, 2);
|
||||
vbox = gtk_vbox_new (FALSE, 4);
|
||||
gtk_container_set_border_width (GTK_CONTAINER (vbox), 4);
|
||||
gtk_container_add (GTK_CONTAINER (GTK_DIALOG (options->query_box)->vbox),
|
||||
vbox);
|
||||
|
@ -628,19 +628,12 @@ layers_new_layer_query (GimpImage *gimage,
|
|||
gtk_box_pack_start (GTK_BOX (vbox), table, FALSE, FALSE, 0);
|
||||
|
||||
/* The name label and entry */
|
||||
label = gtk_label_new (_("Layer Name:"));
|
||||
gtk_misc_set_alignment (GTK_MISC (label), 1.0, 0.5);
|
||||
gtk_table_attach (GTK_TABLE (table), label, 0, 1, 0, 1,
|
||||
GTK_SHRINK | GTK_FILL, GTK_SHRINK, 0, 1);
|
||||
gtk_widget_show (label);
|
||||
|
||||
options->name_entry = gtk_entry_new ();
|
||||
gtk_widget_set_size_request (options->name_entry, 75, -1);
|
||||
gtk_table_attach_defaults (GTK_TABLE (table),
|
||||
options->name_entry, 1, 2, 0, 1);
|
||||
gtk_entry_set_text (GTK_ENTRY (options->name_entry),
|
||||
(layer_name ? layer_name : _("New Layer")));
|
||||
gtk_widget_show (options->name_entry);
|
||||
gimp_table_attach_aligned (GTK_TABLE (table), 0, 0,
|
||||
_("Layer _Name:"), 1.0, 0.5,
|
||||
options->name_entry, 1, FALSE);
|
||||
|
||||
/* The size labels */
|
||||
label = gtk_label_new (_("Layer Width:"));
|
||||
|
@ -656,19 +649,23 @@ layers_new_layer_query (GimpImage *gimage,
|
|||
gtk_widget_show (label);
|
||||
|
||||
/* The size sizeentry */
|
||||
adjustment = gtk_adjustment_new (1, 1, 1, 1, 10, 1);
|
||||
spinbutton = gtk_spin_button_new (GTK_ADJUSTMENT (adjustment), 1, 2);
|
||||
gtk_spin_button_set_numeric (GTK_SPIN_BUTTON (spinbutton), TRUE);
|
||||
gtk_widget_set_size_request (spinbutton, 75, -1);
|
||||
|
||||
spinbutton = gimp_spin_button_new (&adjustment,
|
||||
1, 1, 1, 1, 10, 1,
|
||||
1, 2);
|
||||
gtk_entry_set_width_chars (GTK_ENTRY (spinbutton), 10);
|
||||
|
||||
options->size_se = gimp_size_entry_new (1, gimage->unit, "%a",
|
||||
TRUE, TRUE, FALSE, 75,
|
||||
TRUE, TRUE, FALSE, 10,
|
||||
GIMP_SIZE_ENTRY_UPDATE_SIZE);
|
||||
gtk_table_set_col_spacing (GTK_TABLE (options->size_se), 1, 4);
|
||||
gtk_table_set_row_spacing (GTK_TABLE (options->size_se), 0, 2);
|
||||
|
||||
gimp_size_entry_add_field (GIMP_SIZE_ENTRY (options->size_se),
|
||||
GTK_SPIN_BUTTON (spinbutton), NULL);
|
||||
gtk_table_attach_defaults (GTK_TABLE (options->size_se), spinbutton,
|
||||
1, 2, 0, 1);
|
||||
gtk_widget_show (spinbutton);
|
||||
|
||||
gtk_table_attach (GTK_TABLE (table), options->size_se, 1, 2, 1, 3,
|
||||
GTK_SHRINK | GTK_FILL, GTK_SHRINK | GTK_FILL, 0, 0);
|
||||
gtk_widget_show (options->size_se);
|
||||
|
@ -777,8 +774,7 @@ layers_edit_layer_query (GimpLayer *layer)
|
|||
{
|
||||
EditLayerOptions *options;
|
||||
GtkWidget *vbox;
|
||||
GtkWidget *hbox;
|
||||
GtkWidget *label;
|
||||
GtkWidget *table;
|
||||
|
||||
options = g_new0 (EditLayerOptions, 1);
|
||||
|
||||
|
@ -813,33 +809,30 @@ layers_edit_layer_query (GimpLayer *layer)
|
|||
G_CONNECT_SWAPPED);
|
||||
|
||||
/* The main vbox */
|
||||
vbox = gtk_vbox_new (FALSE, 2);
|
||||
vbox = gtk_vbox_new (FALSE, 4);
|
||||
gtk_container_set_border_width (GTK_CONTAINER (vbox), 4);
|
||||
gtk_container_add (GTK_CONTAINER (GTK_DIALOG (options->query_box)->vbox),
|
||||
vbox);
|
||||
|
||||
/* The name hbox, label and entry */
|
||||
hbox = gtk_hbox_new (FALSE, 4);
|
||||
gtk_box_pack_start (GTK_BOX (vbox), hbox, FALSE, FALSE, 0);
|
||||
|
||||
label = gtk_label_new (_("Layer name:"));
|
||||
gtk_box_pack_start (GTK_BOX (hbox), label, FALSE, FALSE, 0);
|
||||
gtk_widget_show (label);
|
||||
/* The name label and entry */
|
||||
table = gtk_table_new (1, 2, FALSE);
|
||||
gtk_table_set_col_spacing (GTK_TABLE (table), 0, 4);
|
||||
gtk_box_pack_start (GTK_BOX (vbox), table, FALSE, FALSE, 0);
|
||||
gtk_widget_show (table);
|
||||
|
||||
options->name_entry = gtk_entry_new ();
|
||||
gtk_box_pack_start (GTK_BOX (hbox), options->name_entry, TRUE, TRUE, 0);
|
||||
gtk_entry_set_text (GTK_ENTRY (options->name_entry),
|
||||
((gimp_layer_is_floating_sel (layer) ?
|
||||
_("Floating Selection") :
|
||||
gimp_object_get_name (GIMP_OBJECT (layer)))));
|
||||
gtk_widget_show (options->name_entry);
|
||||
gimp_table_attach_aligned (GTK_TABLE (table), 0, 0,
|
||||
_("Layer _Name"), 1.0, 0.5,
|
||||
options->name_entry, 1, FALSE);
|
||||
|
||||
g_signal_connect (G_OBJECT (options->name_entry), "activate",
|
||||
G_CALLBACK (edit_layer_query_ok_callback),
|
||||
options);
|
||||
|
||||
gtk_widget_show (hbox);
|
||||
|
||||
gtk_widget_show (vbox);
|
||||
gtk_widget_show (options->query_box);
|
||||
}
|
||||
|
@ -1048,9 +1041,10 @@ layers_scale_layer_query (GimpImage *gimage,
|
|||
{
|
||||
ScaleLayerOptions *options;
|
||||
|
||||
/* the new options structure */
|
||||
options = g_new (ScaleLayerOptions, 1);
|
||||
options->layer = layer;
|
||||
options = g_new0 (ScaleLayerOptions, 1);
|
||||
|
||||
options->layer = layer;
|
||||
|
||||
options->resize =
|
||||
resize_widget_new (gimage,
|
||||
ScaleWidget,
|
||||
|
@ -1064,8 +1058,7 @@ layers_scale_layer_query (GimpImage *gimage,
|
|||
gimage->unit,
|
||||
TRUE,
|
||||
G_CALLBACK (scale_layer_query_ok_callback),
|
||||
NULL,
|
||||
options);
|
||||
options);
|
||||
|
||||
g_object_weak_ref (G_OBJECT (options->resize->resize_shell),
|
||||
(GWeakNotify) g_free,
|
||||
|
@ -1140,9 +1133,10 @@ layers_resize_layer_query (GimpImage *gimage,
|
|||
{
|
||||
ResizeLayerOptions *options;
|
||||
|
||||
/* the new options structure */
|
||||
options = g_new (ResizeLayerOptions, 1);
|
||||
options->layer = layer;
|
||||
options = g_new0 (ResizeLayerOptions, 1);
|
||||
|
||||
options->layer = layer;
|
||||
|
||||
options->resize =
|
||||
resize_widget_new (gimage,
|
||||
ResizeWidget,
|
||||
|
@ -1156,8 +1150,7 @@ layers_resize_layer_query (GimpImage *gimage,
|
|||
gimage->unit,
|
||||
TRUE,
|
||||
G_CALLBACK (resize_layer_query_ok_callback),
|
||||
NULL,
|
||||
options);
|
||||
options);
|
||||
|
||||
g_object_weak_ref (G_OBJECT (options->resize->resize_shell),
|
||||
(GWeakNotify) g_free,
|
||||
|
|
|
@ -41,6 +41,9 @@
|
|||
#include "libgimp/gimpintl.h"
|
||||
|
||||
|
||||
#define SB_WIDTH 10
|
||||
|
||||
|
||||
typedef struct
|
||||
{
|
||||
GtkWidget *dialog;
|
||||
|
@ -89,7 +92,7 @@ file_new_dialog_create (Gimp *gimp,
|
|||
GimpImage *gimage)
|
||||
{
|
||||
NewImageInfo *info;
|
||||
GtkWidget *top_vbox;
|
||||
GtkWidget *main_vbox;
|
||||
GtkWidget *hbox;
|
||||
GtkWidget *vbox;
|
||||
GtkWidget *abox;
|
||||
|
@ -131,15 +134,15 @@ file_new_dialog_create (Gimp *gimp,
|
|||
gtk_window_set_resizable (GTK_WINDOW (info->dialog), FALSE);
|
||||
|
||||
/* vbox holding the rest of the dialog */
|
||||
top_vbox = gtk_vbox_new (FALSE, 4);
|
||||
gtk_container_set_border_width (GTK_CONTAINER (top_vbox), 4);
|
||||
main_vbox = gtk_vbox_new (FALSE, 4);
|
||||
gtk_container_set_border_width (GTK_CONTAINER (main_vbox), 4);
|
||||
gtk_box_pack_start (GTK_BOX (GTK_DIALOG (info->dialog)->vbox),
|
||||
top_vbox, TRUE, TRUE, 0);
|
||||
gtk_widget_show (top_vbox);
|
||||
main_vbox, TRUE, TRUE, 0);
|
||||
gtk_widget_show (main_vbox);
|
||||
|
||||
/* Image size frame */
|
||||
frame = gtk_frame_new (_("Image Size"));
|
||||
gtk_box_pack_start (GTK_BOX (top_vbox), frame, FALSE, FALSE, 0);
|
||||
gtk_box_pack_start (GTK_BOX (main_vbox), frame, FALSE, FALSE, 0);
|
||||
gtk_widget_show (frame);
|
||||
|
||||
vbox = gtk_vbox_new (FALSE, 0);
|
||||
|
@ -149,7 +152,7 @@ file_new_dialog_create (Gimp *gimp,
|
|||
|
||||
table = gtk_table_new (7, 2, FALSE);
|
||||
gtk_table_set_col_spacing (GTK_TABLE (table), 0, 4);
|
||||
gtk_table_set_row_spacing (GTK_TABLE (table), 0, 2);
|
||||
gtk_table_set_row_spacings (GTK_TABLE (table), 2);
|
||||
gtk_table_set_row_spacing (GTK_TABLE (table), 1, 4);
|
||||
gtk_table_set_row_spacing (GTK_TABLE (table), 2, 4);
|
||||
gtk_table_set_row_spacing (GTK_TABLE (table), 4, 4);
|
||||
|
@ -190,30 +193,33 @@ file_new_dialog_create (Gimp *gimp,
|
|||
/* create the sizeentry which keeps it all together */
|
||||
abox = gtk_alignment_new (0.0, 0.5, 0.0, 0.0);
|
||||
gtk_table_attach_defaults (GTK_TABLE (table), abox, 1, 2, 3, 5);
|
||||
info->size_se =
|
||||
gimp_size_entry_new (0, info->values->unit, "%a", FALSE, FALSE, TRUE, 75,
|
||||
GIMP_SIZE_ENTRY_UPDATE_SIZE);
|
||||
gtk_table_set_col_spacing (GTK_TABLE (info->size_se), 1, 2);
|
||||
gtk_container_add (GTK_CONTAINER (abox), info->size_se);
|
||||
gtk_widget_show (info->size_se);
|
||||
gtk_widget_show (abox);
|
||||
|
||||
info->size_se = gimp_size_entry_new (0, info->values->unit, "%a",
|
||||
FALSE, FALSE, TRUE, SB_WIDTH,
|
||||
GIMP_SIZE_ENTRY_UPDATE_SIZE);
|
||||
gtk_table_set_col_spacing (GTK_TABLE (info->size_se), 1, 4);
|
||||
gtk_table_set_row_spacing (GTK_TABLE (info->size_se), 1, 2);
|
||||
gtk_container_add (GTK_CONTAINER (abox), info->size_se);
|
||||
gtk_widget_show (info->size_se);
|
||||
|
||||
/* height in units */
|
||||
adjustment = gtk_adjustment_new (1, 1, 1, 1, 10, 1);
|
||||
spinbutton = gtk_spin_button_new (GTK_ADJUSTMENT (adjustment), 1, 2);
|
||||
gtk_spin_button_set_numeric (GTK_SPIN_BUTTON (spinbutton), TRUE);
|
||||
gtk_widget_set_size_request (spinbutton, 75, -1);
|
||||
spinbutton = gimp_spin_button_new (&adjustment,
|
||||
1, 1, 1, 1, 10, 0,
|
||||
1, 2);
|
||||
gtk_entry_set_width_chars (GTK_ENTRY (spinbutton), SB_WIDTH);
|
||||
/* add the "height in units" spinbutton to the sizeentry */
|
||||
gtk_table_attach_defaults (GTK_TABLE (info->size_se), spinbutton,
|
||||
0, 1, 2, 3);
|
||||
gtk_widget_show (spinbutton);
|
||||
|
||||
/* height in pixels */
|
||||
hbox = gtk_hbox_new (FALSE, 2);
|
||||
adjustment = gtk_adjustment_new (1, 1, 1, 1, 10, 1);
|
||||
spinbutton2 = gtk_spin_button_new (GTK_ADJUSTMENT (adjustment), 1, 0);
|
||||
gtk_spin_button_set_numeric (GTK_SPIN_BUTTON (spinbutton2), TRUE);
|
||||
gtk_widget_set_size_request (spinbutton2, 75, -1);
|
||||
hbox = gtk_hbox_new (FALSE, 4);
|
||||
|
||||
spinbutton2 = gimp_spin_button_new (&adjustment,
|
||||
1, 1, 1, 1, 10, 0,
|
||||
1, 0);
|
||||
gtk_entry_set_width_chars (GTK_ENTRY (spinbutton2), SB_WIDTH);
|
||||
gtk_box_pack_start (GTK_BOX (hbox), spinbutton2, FALSE, FALSE, 0);
|
||||
gtk_widget_show (spinbutton2);
|
||||
|
||||
|
@ -235,10 +241,10 @@ file_new_dialog_create (Gimp *gimp,
|
|||
GTK_SPIN_BUTTON (spinbutton2));
|
||||
|
||||
/* width in units */
|
||||
adjustment = gtk_adjustment_new (1, 1, 1, 1, 10, 1);
|
||||
spinbutton = gtk_spin_button_new (GTK_ADJUSTMENT (adjustment), 1, 2);
|
||||
gtk_spin_button_set_numeric (GTK_SPIN_BUTTON (spinbutton), TRUE);
|
||||
gtk_widget_set_size_request (spinbutton, 75, -1);
|
||||
spinbutton = gimp_spin_button_new (&adjustment,
|
||||
1, 1, 1, 1, 10, 0,
|
||||
1, 2);
|
||||
gtk_entry_set_width_chars (GTK_ENTRY (spinbutton), SB_WIDTH);
|
||||
/* add the "width in units" spinbutton to the sizeentry */
|
||||
gtk_table_attach_defaults (GTK_TABLE (info->size_se), spinbutton,
|
||||
0, 1, 1, 2);
|
||||
|
@ -247,14 +253,15 @@ file_new_dialog_create (Gimp *gimp,
|
|||
/* width in pixels */
|
||||
abox = gtk_alignment_new (0.0, 0.5, 0.0, 0.0);
|
||||
gtk_table_attach_defaults (GTK_TABLE (table), abox, 1, 2, 0, 1);
|
||||
adjustment = gtk_adjustment_new (1, 1, 1, 1, 10, 1);
|
||||
spinbutton2 = gtk_spin_button_new (GTK_ADJUSTMENT (adjustment), 1, 0);
|
||||
gtk_spin_button_set_numeric (GTK_SPIN_BUTTON (spinbutton2), TRUE);
|
||||
gtk_widget_set_size_request (spinbutton2, 75, -1);
|
||||
gtk_widget_show (abox);
|
||||
|
||||
spinbutton2 = gimp_spin_button_new (&adjustment,
|
||||
1, 1, 1, 1, 10, 0,
|
||||
1, 0);
|
||||
gtk_entry_set_width_chars (GTK_ENTRY (spinbutton2), SB_WIDTH);
|
||||
/* add the "width in pixels" spinbutton to the main table */
|
||||
gtk_container_add (GTK_CONTAINER (abox), spinbutton2);
|
||||
gtk_widget_show (spinbutton2);
|
||||
gtk_widget_show (abox);
|
||||
|
||||
/* register the width spinbuttons with the sizeentry */
|
||||
gimp_size_entry_add_field (GIMP_SIZE_ENTRY (info->size_se),
|
||||
|
@ -303,28 +310,30 @@ file_new_dialog_create (Gimp *gimp,
|
|||
gtk_widget_show (label);
|
||||
|
||||
/* the resolution sizeentry */
|
||||
adjustment = gtk_adjustment_new (1, 1, 1, 1, 10, 1);
|
||||
spinbutton = gtk_spin_button_new (GTK_ADJUSTMENT (adjustment), 1, 2);
|
||||
gtk_spin_button_set_numeric (GTK_SPIN_BUTTON (spinbutton), TRUE);
|
||||
gtk_widget_set_size_request (spinbutton, 75, -1);
|
||||
abox = gtk_alignment_new (0.0, 0.5, 0.0, 0.0);
|
||||
gtk_table_attach_defaults (GTK_TABLE (table), abox, 1, 2, 5, 7);
|
||||
gtk_widget_show (abox);
|
||||
|
||||
spinbutton = gimp_spin_button_new (&adjustment,
|
||||
1, 1, 1, 1, 10, 0,
|
||||
1, 2);
|
||||
gtk_entry_set_width_chars (GTK_ENTRY (spinbutton), SB_WIDTH);
|
||||
|
||||
info->resolution_se =
|
||||
gimp_size_entry_new (1, gimp->config->default_resolution_units,
|
||||
_("pixels/%a"),
|
||||
FALSE, FALSE, FALSE, 75,
|
||||
FALSE, FALSE, FALSE, SB_WIDTH,
|
||||
GIMP_SIZE_ENTRY_UPDATE_RESOLUTION);
|
||||
gtk_table_set_col_spacing (GTK_TABLE (info->resolution_se), 1, 2);
|
||||
gtk_table_set_col_spacing (GTK_TABLE (info->resolution_se), 2, 2);
|
||||
gtk_table_set_row_spacing (GTK_TABLE (info->resolution_se), 0, 2);
|
||||
|
||||
gimp_size_entry_add_field (GIMP_SIZE_ENTRY (info->resolution_se),
|
||||
GTK_SPIN_BUTTON (spinbutton), NULL);
|
||||
gtk_table_attach_defaults (GTK_TABLE (info->resolution_se), spinbutton,
|
||||
1, 2, 0, 1);
|
||||
gtk_widget_show (spinbutton);
|
||||
|
||||
abox = gtk_alignment_new (0.0, 0.5, 0.0, 0.0);
|
||||
gtk_table_attach_defaults (GTK_TABLE (table), abox, 1, 2, 5, 7);
|
||||
gtk_widget_show (abox);
|
||||
|
||||
gtk_container_add (GTK_CONTAINER (abox), info->resolution_se);
|
||||
gtk_widget_show (info->resolution_se);
|
||||
|
||||
|
@ -355,8 +364,8 @@ file_new_dialog_create (Gimp *gimp,
|
|||
gtk_widget_show (info->couple_resolutions);
|
||||
|
||||
/* hbox containing the Image type and fill type frames */
|
||||
hbox = gtk_hbox_new (FALSE, 2);
|
||||
gtk_box_pack_start (GTK_BOX (top_vbox), hbox, FALSE, FALSE, 0);
|
||||
hbox = gtk_hbox_new (FALSE, 4);
|
||||
gtk_box_pack_start (GTK_BOX (main_vbox), hbox, FALSE, FALSE, 0);
|
||||
gtk_widget_show (hbox);
|
||||
|
||||
/* frame for Image Type */
|
||||
|
|
|
@ -30,135 +30,287 @@
|
|||
|
||||
#include "info-dialog.h"
|
||||
|
||||
#include "gimprc.h"
|
||||
|
||||
#include "libgimp/gimpintl.h"
|
||||
|
||||
|
||||
/* static functions */
|
||||
static void info_field_new (InfoDialog *idialog,
|
||||
InfoFieldType field_type,
|
||||
gchar *title,
|
||||
GtkWidget *widget,
|
||||
GtkObject *object,
|
||||
gpointer value_ptr,
|
||||
GCallback callback,
|
||||
gpointer callback_data);
|
||||
static void update_field (InfoField *info_field);
|
||||
static gint info_dialog_delete_callback (GtkWidget *widget,
|
||||
GdkEvent *event,
|
||||
gpointer data);
|
||||
#define SB_WIDTH 10
|
||||
|
||||
|
||||
static void
|
||||
info_field_new (InfoDialog *idialog,
|
||||
InfoFieldType field_type,
|
||||
gchar *title,
|
||||
GtkWidget *widget,
|
||||
GtkObject *obj,
|
||||
gpointer value_ptr,
|
||||
GCallback callback,
|
||||
gpointer callback_data)
|
||||
/* local function prototypes */
|
||||
|
||||
static InfoDialog * info_dialog_new_extended (GimpViewable *viewable,
|
||||
const gchar *title,
|
||||
const gchar *wmclass_name,
|
||||
const gchar *stock_id,
|
||||
const gchar *desc,
|
||||
GimpHelpFunc help_func,
|
||||
gpointer help_data,
|
||||
gboolean in_notebook);
|
||||
static gboolean info_dialog_delete_callback (GtkWidget *widget,
|
||||
GdkEvent *event,
|
||||
gpointer data);
|
||||
static void info_dialog_field_new (InfoDialog *idialog,
|
||||
InfoFieldType field_type,
|
||||
gchar *title,
|
||||
GtkWidget *widget,
|
||||
GtkObject *object,
|
||||
gpointer value_ptr,
|
||||
GCallback callback,
|
||||
gpointer callback_data);
|
||||
static void info_dialog_update_field (InfoField *info_field);
|
||||
|
||||
|
||||
/* public functions */
|
||||
|
||||
InfoDialog *
|
||||
info_dialog_new (GimpViewable *viewable,
|
||||
const gchar *title,
|
||||
const gchar *wmclass_name,
|
||||
const gchar *stock_id,
|
||||
const gchar *desc,
|
||||
GimpHelpFunc help_func,
|
||||
gpointer help_data)
|
||||
{
|
||||
return info_dialog_new_extended (viewable, title, wmclass_name,
|
||||
stock_id, desc,
|
||||
help_func, help_data, FALSE);
|
||||
}
|
||||
|
||||
InfoDialog *
|
||||
info_dialog_notebook_new (GimpViewable *viewable,
|
||||
const gchar *title,
|
||||
const gchar *wmclass_name,
|
||||
const gchar *stock_id,
|
||||
const gchar *desc,
|
||||
GimpHelpFunc help_func,
|
||||
gpointer help_data)
|
||||
{
|
||||
return info_dialog_new_extended (viewable, title, wmclass_name,
|
||||
stock_id, desc,
|
||||
help_func, help_data, TRUE);
|
||||
}
|
||||
|
||||
void
|
||||
info_dialog_free (InfoDialog *idialog)
|
||||
{
|
||||
g_return_if_fail (idialog != NULL);
|
||||
|
||||
g_slist_foreach (idialog->field_list, (GFunc) g_free, NULL);
|
||||
g_slist_free (idialog->field_list);
|
||||
|
||||
gtk_widget_destroy (idialog->shell);
|
||||
|
||||
g_free (idialog);
|
||||
}
|
||||
|
||||
void
|
||||
info_dialog_popup (InfoDialog *idialog)
|
||||
{
|
||||
g_return_if_fail (idialog != NULL);
|
||||
|
||||
if (! GTK_WIDGET_VISIBLE (idialog->shell))
|
||||
gtk_widget_show (idialog->shell);
|
||||
}
|
||||
|
||||
void
|
||||
info_dialog_popdown (InfoDialog *idialog)
|
||||
{
|
||||
g_return_if_fail (idialog != NULL);
|
||||
|
||||
if (GTK_WIDGET_VISIBLE (idialog->shell))
|
||||
gtk_widget_hide (idialog->shell);
|
||||
}
|
||||
|
||||
void
|
||||
info_dialog_update (InfoDialog *idialog)
|
||||
{
|
||||
GSList *list;
|
||||
|
||||
g_return_if_fail (idialog != NULL);
|
||||
|
||||
for (list = idialog->field_list; list; list = g_slist_next (list))
|
||||
info_dialog_update_field ((InfoField *) list->data);
|
||||
}
|
||||
|
||||
GtkWidget *
|
||||
info_dialog_add_label (InfoDialog *idialog,
|
||||
gchar *title,
|
||||
gchar *text_ptr)
|
||||
{
|
||||
GtkWidget *label;
|
||||
InfoField *field;
|
||||
gint row;
|
||||
|
||||
field = g_new (InfoField, 1);
|
||||
g_return_val_if_fail (idialog != NULL, NULL);
|
||||
|
||||
row = idialog->nfields + 1;
|
||||
gtk_table_resize (GTK_TABLE (idialog->info_table), 2, row);
|
||||
label = gtk_label_new (text_ptr);
|
||||
gtk_misc_set_alignment (GTK_MISC (label), 0.0, 0.5);
|
||||
|
||||
label = gtk_label_new (title);
|
||||
gtk_misc_set_alignment (GTK_MISC (label), 1.0, 0.5);
|
||||
gtk_table_attach (GTK_TABLE (idialog->info_table), label,
|
||||
0, 1, row - 1, row,
|
||||
GTK_SHRINK | GTK_FILL, GTK_SHRINK | GTK_FILL, 0, 0);
|
||||
gtk_widget_show (label);
|
||||
info_dialog_field_new (idialog, INFO_LABEL, title, label, NULL,
|
||||
text_ptr,
|
||||
NULL, NULL);
|
||||
|
||||
gtk_table_attach_defaults (GTK_TABLE (idialog->info_table), widget,
|
||||
1, 2, row - 1, row);
|
||||
gtk_widget_show (widget);
|
||||
return label;
|
||||
}
|
||||
|
||||
gtk_table_set_col_spacing (GTK_TABLE (idialog->info_table), 0, 6);
|
||||
gtk_table_set_row_spacings (GTK_TABLE (idialog->info_table), 2);
|
||||
GtkWidget *
|
||||
info_dialog_add_entry (InfoDialog *idialog,
|
||||
gchar *title,
|
||||
gchar *text_ptr,
|
||||
GCallback callback,
|
||||
gpointer callback_data)
|
||||
{
|
||||
GtkWidget *entry;
|
||||
|
||||
field->field_type = field_type;
|
||||
g_return_val_if_fail (idialog != NULL, NULL);
|
||||
|
||||
if (obj == NULL)
|
||||
field->obj = GTK_OBJECT (widget);
|
||||
entry = gtk_entry_new ();
|
||||
gtk_widget_set_size_request (entry, 50, -1);
|
||||
gtk_entry_set_text (GTK_ENTRY (entry), text_ptr ? text_ptr : "");
|
||||
|
||||
if (callback)
|
||||
g_signal_connect (G_OBJECT (entry), "changed",
|
||||
callback,
|
||||
callback_data);
|
||||
|
||||
info_dialog_field_new (idialog, INFO_ENTRY, title, entry, NULL,
|
||||
text_ptr,
|
||||
callback, callback_data);
|
||||
|
||||
return entry;
|
||||
}
|
||||
|
||||
GtkWidget *
|
||||
info_dialog_add_scale (InfoDialog *idialog,
|
||||
gchar *title,
|
||||
gdouble *value_ptr,
|
||||
gfloat lower,
|
||||
gfloat upper,
|
||||
gfloat step_increment,
|
||||
gfloat page_increment,
|
||||
gfloat page_size,
|
||||
gint digits,
|
||||
GCallback callback,
|
||||
gpointer callback_data)
|
||||
{
|
||||
GtkObject *adjustment;
|
||||
GtkWidget *scale;
|
||||
|
||||
g_return_val_if_fail (idialog != NULL, NULL);
|
||||
|
||||
adjustment = gtk_adjustment_new (value_ptr ? *value_ptr : 0, lower, upper,
|
||||
step_increment, page_increment, page_size);
|
||||
scale = gtk_hscale_new (GTK_ADJUSTMENT (adjustment));
|
||||
|
||||
if (digits >= 0)
|
||||
gtk_scale_set_digits (GTK_SCALE (scale), MAX (digits, 6));
|
||||
else
|
||||
field->obj = obj;
|
||||
gtk_scale_set_draw_value (GTK_SCALE (scale), FALSE);
|
||||
|
||||
field->value_ptr = value_ptr;
|
||||
field->callback = callback;
|
||||
field->callback_data = callback_data;
|
||||
if (callback)
|
||||
g_signal_connect (G_OBJECT (adjustment), "value_changed",
|
||||
callback,
|
||||
callback_data);
|
||||
|
||||
idialog->field_list = g_slist_prepend (idialog->field_list, field);
|
||||
idialog->nfields++;
|
||||
info_dialog_field_new (idialog, INFO_SCALE, title, scale, adjustment,
|
||||
value_ptr,
|
||||
callback, callback_data);
|
||||
|
||||
return scale;
|
||||
}
|
||||
|
||||
static void
|
||||
update_field (InfoField *field)
|
||||
GtkWidget *
|
||||
info_dialog_add_spinbutton (InfoDialog *idialog,
|
||||
gchar *title,
|
||||
gdouble *value_ptr,
|
||||
gfloat lower,
|
||||
gfloat upper,
|
||||
gfloat step_increment,
|
||||
gfloat page_increment,
|
||||
gfloat page_size,
|
||||
gfloat climb_rate,
|
||||
gint digits,
|
||||
GCallback callback,
|
||||
gpointer callback_data)
|
||||
{
|
||||
const gchar *old_text;
|
||||
gint num;
|
||||
gint i;
|
||||
GtkWidget *alignment;
|
||||
GtkObject *adjustment;
|
||||
GtkWidget *spinbutton;
|
||||
|
||||
if (field->value_ptr == NULL)
|
||||
return;
|
||||
g_return_val_if_fail (idialog != NULL, NULL);
|
||||
|
||||
if (field->field_type != INFO_LABEL)
|
||||
g_signal_handlers_block_by_func (G_OBJECT (field->obj),
|
||||
field->callback,
|
||||
field->callback_data);
|
||||
alignment = gtk_alignment_new (0.0, 0.5, 0.0, 1.0);
|
||||
|
||||
switch (field->field_type)
|
||||
{
|
||||
case INFO_LABEL:
|
||||
gtk_label_set_text (GTK_LABEL (field->obj), (gchar *) field->value_ptr);
|
||||
break;
|
||||
spinbutton = gimp_spin_button_new (&adjustment,
|
||||
value_ptr ? *value_ptr : 0,
|
||||
lower, upper,
|
||||
step_increment, page_increment, page_size,
|
||||
climb_rate, MAX (MIN (digits, 6), 0));
|
||||
gtk_entry_set_width_chars (GTK_ENTRY (spinbutton), SB_WIDTH);
|
||||
|
||||
case INFO_ENTRY:
|
||||
old_text = gtk_entry_get_text (GTK_ENTRY (field->obj));
|
||||
if (strcmp (old_text, (gchar *) field->value_ptr))
|
||||
gtk_entry_set_text (GTK_ENTRY (field->obj), (gchar *) field->value_ptr);
|
||||
break;
|
||||
if (callback)
|
||||
g_signal_connect (G_OBJECT (adjustment), "value_changed",
|
||||
callback,
|
||||
callback_data);
|
||||
|
||||
case INFO_SCALE:
|
||||
case INFO_SPINBUTTON:
|
||||
gtk_adjustment_set_value (GTK_ADJUSTMENT (field->obj),
|
||||
*((gdouble *) field->value_ptr));
|
||||
break;
|
||||
gtk_container_add (GTK_CONTAINER (alignment), spinbutton);
|
||||
gtk_widget_show (spinbutton);
|
||||
|
||||
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,
|
||||
((gdouble *) field->value_ptr)[i]);
|
||||
break;
|
||||
info_dialog_field_new (idialog, INFO_SPINBUTTON, title, alignment,
|
||||
adjustment,
|
||||
value_ptr,
|
||||
callback, callback_data);
|
||||
|
||||
default:
|
||||
g_warning ("%s: Unknown info_dialog field type.", G_STRLOC);
|
||||
break;
|
||||
}
|
||||
|
||||
if (field->field_type != INFO_LABEL)
|
||||
g_signal_handlers_unblock_by_func (G_OBJECT (field->obj),
|
||||
field->callback,
|
||||
field->callback_data);
|
||||
return spinbutton;
|
||||
}
|
||||
|
||||
static gboolean
|
||||
info_dialog_delete_callback (GtkWidget *widget,
|
||||
GdkEvent *event,
|
||||
gpointer data)
|
||||
GtkWidget *
|
||||
info_dialog_add_sizeentry (InfoDialog *idialog,
|
||||
gchar *title,
|
||||
gdouble *value_ptr,
|
||||
gint nfields,
|
||||
GimpUnit unit,
|
||||
gchar *unit_format,
|
||||
gboolean menu_show_pixels,
|
||||
gboolean menu_show_percent,
|
||||
gboolean show_refval,
|
||||
GimpSizeEntryUpdatePolicy update_policy,
|
||||
GCallback callback,
|
||||
gpointer callback_data)
|
||||
{
|
||||
info_dialog_popdown ((InfoDialog *) data);
|
||||
GtkWidget *alignment;
|
||||
GtkWidget *sizeentry;
|
||||
gint i;
|
||||
|
||||
return TRUE;
|
||||
g_return_val_if_fail (idialog != NULL, NULL);
|
||||
|
||||
alignment = gtk_alignment_new (0.0, 0.5, 0.0, 1.0);
|
||||
|
||||
sizeentry = gimp_size_entry_new (nfields, unit, unit_format,
|
||||
menu_show_pixels, menu_show_percent,
|
||||
show_refval, SB_WIDTH,
|
||||
update_policy);
|
||||
if (value_ptr)
|
||||
for (i = 0; i < nfields; i++)
|
||||
gimp_size_entry_set_refval (GIMP_SIZE_ENTRY (sizeentry), i, value_ptr[i]);
|
||||
|
||||
if (callback)
|
||||
g_signal_connect (G_OBJECT (sizeentry), "value_changed",
|
||||
callback,
|
||||
callback_data);
|
||||
|
||||
gtk_container_add (GTK_CONTAINER (alignment), sizeentry);
|
||||
gtk_widget_show (sizeentry);
|
||||
|
||||
info_dialog_field_new (idialog, INFO_SIZEENTRY, title, alignment,
|
||||
GTK_OBJECT (sizeentry),
|
||||
value_ptr,
|
||||
callback, callback_data);
|
||||
|
||||
return sizeentry;
|
||||
}
|
||||
|
||||
|
||||
/* private functions */
|
||||
|
||||
static InfoDialog *
|
||||
info_dialog_new_extended (GimpViewable *viewable,
|
||||
const gchar *title,
|
||||
|
@ -224,260 +376,111 @@ info_dialog_new_extended (GimpViewable *viewable,
|
|||
return idialog;
|
||||
}
|
||||
|
||||
/* public functions */
|
||||
|
||||
InfoDialog *
|
||||
info_dialog_notebook_new (GimpViewable *viewable,
|
||||
const gchar *title,
|
||||
const gchar *wmclass_name,
|
||||
const gchar *stock_id,
|
||||
const gchar *desc,
|
||||
GimpHelpFunc help_func,
|
||||
gpointer help_data)
|
||||
static gboolean
|
||||
info_dialog_delete_callback (GtkWidget *widget,
|
||||
GdkEvent *event,
|
||||
gpointer data)
|
||||
{
|
||||
return info_dialog_new_extended (viewable, title, wmclass_name,
|
||||
stock_id, desc,
|
||||
help_func, help_data, TRUE);
|
||||
info_dialog_popdown ((InfoDialog *) data);
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
InfoDialog *
|
||||
info_dialog_new (GimpViewable *viewable,
|
||||
const gchar *title,
|
||||
const gchar *wmclass_name,
|
||||
const gchar *stock_id,
|
||||
const gchar *desc,
|
||||
GimpHelpFunc help_func,
|
||||
gpointer help_data)
|
||||
{
|
||||
return info_dialog_new_extended (viewable, title, wmclass_name,
|
||||
stock_id, desc,
|
||||
help_func, help_data, FALSE);
|
||||
}
|
||||
|
||||
void
|
||||
info_dialog_free (InfoDialog *idialog)
|
||||
{
|
||||
GSList *list;
|
||||
|
||||
g_return_if_fail (idialog != NULL);
|
||||
|
||||
/* Free each item in the field list */
|
||||
for (list = idialog->field_list; list; list = g_slist_next (list))
|
||||
g_free (list->data);
|
||||
|
||||
/* Free the actual field linked list */
|
||||
g_slist_free (idialog->field_list);
|
||||
|
||||
/* Destroy the associated widgets */
|
||||
gtk_widget_destroy (idialog->shell);
|
||||
|
||||
/* Free the info dialog memory */
|
||||
g_free (idialog);
|
||||
}
|
||||
|
||||
void
|
||||
info_dialog_popup (InfoDialog *idialog)
|
||||
{
|
||||
g_return_if_fail (idialog != NULL);
|
||||
|
||||
if (! GTK_WIDGET_VISIBLE (idialog->shell))
|
||||
gtk_widget_show (idialog->shell);
|
||||
|
||||
}
|
||||
|
||||
void
|
||||
info_dialog_popdown (InfoDialog *idialog)
|
||||
{
|
||||
g_return_if_fail (idialog != NULL);
|
||||
|
||||
if (GTK_WIDGET_VISIBLE (idialog->shell))
|
||||
gtk_widget_hide (idialog->shell);
|
||||
}
|
||||
|
||||
void
|
||||
info_dialog_update (InfoDialog *idialog)
|
||||
{
|
||||
GSList *list;
|
||||
|
||||
if (! idialog)
|
||||
return;
|
||||
|
||||
for (list = idialog->field_list; list; list = g_slist_next (list))
|
||||
update_field ((InfoField *) list->data);
|
||||
}
|
||||
|
||||
GtkWidget *
|
||||
info_dialog_add_label (InfoDialog *idialog,
|
||||
char *title,
|
||||
char *text_ptr)
|
||||
static void
|
||||
info_dialog_field_new (InfoDialog *idialog,
|
||||
InfoFieldType field_type,
|
||||
gchar *title,
|
||||
GtkWidget *widget,
|
||||
GtkObject *obj,
|
||||
gpointer value_ptr,
|
||||
GCallback callback,
|
||||
gpointer callback_data)
|
||||
{
|
||||
GtkWidget *label;
|
||||
InfoField *field;
|
||||
gint row;
|
||||
|
||||
g_return_val_if_fail (idialog != NULL, NULL);
|
||||
field = g_new (InfoField, 1);
|
||||
|
||||
label = gtk_label_new (text_ptr);
|
||||
gtk_misc_set_alignment (GTK_MISC (label), 0.0, 0.5);
|
||||
row = idialog->nfields + 1;
|
||||
gtk_table_resize (GTK_TABLE (idialog->info_table), 2, row);
|
||||
|
||||
info_field_new (idialog, INFO_LABEL, title, label, NULL,
|
||||
text_ptr,
|
||||
NULL, NULL);
|
||||
label = gtk_label_new (title);
|
||||
gtk_misc_set_alignment (GTK_MISC (label), 1.0, 0.5);
|
||||
gtk_table_attach (GTK_TABLE (idialog->info_table), label,
|
||||
0, 1, row - 1, row,
|
||||
GTK_SHRINK | GTK_FILL, GTK_SHRINK | GTK_FILL, 0, 0);
|
||||
gtk_widget_show (label);
|
||||
|
||||
return label;
|
||||
}
|
||||
gtk_table_attach_defaults (GTK_TABLE (idialog->info_table), widget,
|
||||
1, 2, row - 1, row);
|
||||
gtk_widget_show (widget);
|
||||
|
||||
GtkWidget *
|
||||
info_dialog_add_entry (InfoDialog *idialog,
|
||||
gchar *title,
|
||||
gchar *text_ptr,
|
||||
GCallback callback,
|
||||
gpointer callback_data)
|
||||
{
|
||||
GtkWidget *entry;
|
||||
gtk_table_set_col_spacing (GTK_TABLE (idialog->info_table), 0, 6);
|
||||
gtk_table_set_row_spacings (GTK_TABLE (idialog->info_table), 2);
|
||||
|
||||
g_return_val_if_fail (idialog != NULL, NULL);
|
||||
field->field_type = field_type;
|
||||
|
||||
entry = gtk_entry_new ();
|
||||
gtk_widget_set_size_request (entry, 50, -1);
|
||||
gtk_entry_set_text (GTK_ENTRY (entry), text_ptr ? text_ptr : "");
|
||||
|
||||
if (callback)
|
||||
g_signal_connect (G_OBJECT (entry), "changed",
|
||||
callback,
|
||||
callback_data);
|
||||
|
||||
info_field_new (idialog, INFO_ENTRY, title, entry, NULL,
|
||||
text_ptr,
|
||||
callback, callback_data);
|
||||
|
||||
return entry;
|
||||
}
|
||||
|
||||
GtkWidget *
|
||||
info_dialog_add_scale (InfoDialog *idialog,
|
||||
gchar *title,
|
||||
gdouble *value_ptr,
|
||||
gfloat lower,
|
||||
gfloat upper,
|
||||
gfloat step_increment,
|
||||
gfloat page_increment,
|
||||
gfloat page_size,
|
||||
gint digits,
|
||||
GCallback callback,
|
||||
gpointer callback_data)
|
||||
{
|
||||
GtkObject *adjustment;
|
||||
GtkWidget *scale;
|
||||
|
||||
g_return_val_if_fail (idialog != NULL, NULL);
|
||||
|
||||
adjustment = gtk_adjustment_new (value_ptr ? *value_ptr : 0, lower, upper,
|
||||
step_increment, page_increment, page_size);
|
||||
scale = gtk_hscale_new (GTK_ADJUSTMENT (adjustment));
|
||||
|
||||
if (digits >= 0)
|
||||
gtk_scale_set_digits (GTK_SCALE (scale), MAX (digits, 6));
|
||||
if (obj == NULL)
|
||||
field->obj = GTK_OBJECT (widget);
|
||||
else
|
||||
gtk_scale_set_draw_value (GTK_SCALE (scale), FALSE);
|
||||
field->obj = obj;
|
||||
|
||||
if (callback)
|
||||
g_signal_connect (G_OBJECT (adjustment), "value_changed",
|
||||
callback,
|
||||
callback_data);
|
||||
field->value_ptr = value_ptr;
|
||||
field->callback = callback;
|
||||
field->callback_data = callback_data;
|
||||
|
||||
info_field_new (idialog, INFO_SCALE, title, scale, adjustment,
|
||||
value_ptr,
|
||||
callback, callback_data);
|
||||
|
||||
return scale;
|
||||
idialog->field_list = g_slist_prepend (idialog->field_list, field);
|
||||
idialog->nfields++;
|
||||
}
|
||||
|
||||
GtkWidget *
|
||||
info_dialog_add_spinbutton (InfoDialog *idialog,
|
||||
gchar *title,
|
||||
gdouble *value_ptr,
|
||||
gfloat lower,
|
||||
gfloat upper,
|
||||
gfloat step_increment,
|
||||
gfloat page_increment,
|
||||
gfloat page_size,
|
||||
gfloat climb_rate,
|
||||
gint digits,
|
||||
GCallback callback,
|
||||
gpointer callback_data)
|
||||
static void
|
||||
info_dialog_update_field (InfoField *field)
|
||||
{
|
||||
GtkWidget *alignment;
|
||||
GtkObject *adjustment;
|
||||
GtkWidget *spinbutton;
|
||||
const gchar *old_text;
|
||||
gint num;
|
||||
gint i;
|
||||
|
||||
g_return_val_if_fail (idialog != NULL, NULL);
|
||||
if (field->value_ptr == NULL)
|
||||
return;
|
||||
|
||||
alignment = gtk_alignment_new (0.0, 0.5, 0.0, 1.0);
|
||||
if (field->field_type != INFO_LABEL)
|
||||
g_signal_handlers_block_by_func (G_OBJECT (field->obj),
|
||||
field->callback,
|
||||
field->callback_data);
|
||||
|
||||
adjustment = gtk_adjustment_new (value_ptr ? *value_ptr : 0, lower, upper,
|
||||
step_increment, page_increment, page_size);
|
||||
spinbutton = gtk_spin_button_new (GTK_ADJUSTMENT (adjustment),
|
||||
climb_rate, MAX (MIN (digits, 6), 0));
|
||||
gtk_spin_button_set_numeric (GTK_SPIN_BUTTON (spinbutton), TRUE);
|
||||
gtk_widget_set_size_request (spinbutton, 75, -1);
|
||||
switch (field->field_type)
|
||||
{
|
||||
case INFO_LABEL:
|
||||
gtk_label_set_text (GTK_LABEL (field->obj), (gchar *) field->value_ptr);
|
||||
break;
|
||||
|
||||
if (callback)
|
||||
g_signal_connect (G_OBJECT (adjustment), "value_changed",
|
||||
callback,
|
||||
callback_data);
|
||||
case INFO_ENTRY:
|
||||
old_text = gtk_entry_get_text (GTK_ENTRY (field->obj));
|
||||
if (strcmp (old_text, (gchar *) field->value_ptr))
|
||||
gtk_entry_set_text (GTK_ENTRY (field->obj), (gchar *) field->value_ptr);
|
||||
break;
|
||||
|
||||
gtk_container_add (GTK_CONTAINER (alignment), spinbutton);
|
||||
gtk_widget_show (spinbutton);
|
||||
case INFO_SCALE:
|
||||
case INFO_SPINBUTTON:
|
||||
gtk_adjustment_set_value (GTK_ADJUSTMENT (field->obj),
|
||||
*((gdouble *) field->value_ptr));
|
||||
break;
|
||||
|
||||
info_field_new (idialog, INFO_SPINBUTTON, title, alignment,
|
||||
adjustment,
|
||||
value_ptr,
|
||||
callback, callback_data);
|
||||
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,
|
||||
((gdouble *) field->value_ptr)[i]);
|
||||
break;
|
||||
|
||||
return spinbutton;
|
||||
}
|
||||
|
||||
GtkWidget *
|
||||
info_dialog_add_sizeentry (InfoDialog *idialog,
|
||||
gchar *title,
|
||||
gdouble *value_ptr,
|
||||
gint nfields,
|
||||
GimpUnit unit,
|
||||
gchar *unit_format,
|
||||
gboolean menu_show_pixels,
|
||||
gboolean menu_show_percent,
|
||||
gboolean show_refval,
|
||||
GimpSizeEntryUpdatePolicy update_policy,
|
||||
GCallback callback,
|
||||
gpointer callback_data)
|
||||
{
|
||||
GtkWidget *alignment;
|
||||
GtkWidget *sizeentry;
|
||||
gint i;
|
||||
|
||||
g_return_val_if_fail (idialog != NULL, NULL);
|
||||
|
||||
alignment = gtk_alignment_new (0.0, 0.5, 0.0, 1.0);
|
||||
|
||||
sizeentry = gimp_size_entry_new (nfields, unit, unit_format,
|
||||
menu_show_pixels, menu_show_percent,
|
||||
show_refval, 75,
|
||||
update_policy);
|
||||
if (value_ptr)
|
||||
for (i = 0; i < nfields; i++)
|
||||
gimp_size_entry_set_refval (GIMP_SIZE_ENTRY (sizeentry), i, value_ptr[i]);
|
||||
|
||||
if (callback)
|
||||
g_signal_connect (G_OBJECT (sizeentry), "value_changed",
|
||||
callback,
|
||||
callback_data);
|
||||
|
||||
gtk_container_add (GTK_CONTAINER (alignment), sizeentry);
|
||||
gtk_widget_show (sizeentry);
|
||||
|
||||
info_field_new (idialog, INFO_SIZEENTRY, title, alignment,
|
||||
GTK_OBJECT (sizeentry),
|
||||
value_ptr,
|
||||
callback, callback_data);
|
||||
|
||||
return sizeentry;
|
||||
default:
|
||||
g_warning ("%s: Unknown info_dialog field type.", G_STRLOC);
|
||||
break;
|
||||
}
|
||||
|
||||
if (field->field_type != INFO_LABEL)
|
||||
g_signal_handlers_unblock_by_func (G_OBJECT (field->obj),
|
||||
field->callback,
|
||||
field->callback_data);
|
||||
}
|
||||
|
|
|
@ -52,7 +52,7 @@ struct _InfoDialog
|
|||
GSList *field_list;
|
||||
gint nfields;
|
||||
|
||||
void *user_data;
|
||||
gpointer user_data;
|
||||
};
|
||||
|
||||
/* Info Dialog functions */
|
||||
|
|
|
@ -56,25 +56,24 @@ struct _OffsetDialog
|
|||
};
|
||||
|
||||
|
||||
/* Forward declarations */
|
||||
/* local function prototypes */
|
||||
|
||||
static void offset_ok_callback (GtkWidget *widget,
|
||||
gpointer data);
|
||||
static void offset_cancel_callback (GtkWidget *widget,
|
||||
gpointer data);
|
||||
|
||||
static void offset_halfheight_callback (GtkWidget *widget,
|
||||
gpointer data);
|
||||
|
||||
|
||||
/* public functions */
|
||||
|
||||
void
|
||||
offset_dialog_create (GimpDrawable *drawable)
|
||||
{
|
||||
OffsetDialog *off_d;
|
||||
GtkWidget *label;
|
||||
GtkWidget *check;
|
||||
GtkWidget *push;
|
||||
GtkWidget *button;
|
||||
GtkWidget *vbox;
|
||||
GtkWidget *table;
|
||||
GtkWidget *abox;
|
||||
GtkObject *adjustment;
|
||||
GtkWidget *spinbutton;
|
||||
GtkWidget *frame;
|
||||
|
@ -106,53 +105,50 @@ offset_dialog_create (GimpDrawable *drawable)
|
|||
gimp_standard_help_func,
|
||||
"dialogs/offset.html",
|
||||
|
||||
GTK_STOCK_CANCEL, offset_cancel_callback,
|
||||
off_d, NULL, NULL, FALSE, TRUE,
|
||||
GTK_STOCK_CANCEL, gtk_widget_destroy,
|
||||
NULL, (gpointer) 1, NULL, FALSE, TRUE,
|
||||
|
||||
GTK_STOCK_OK, offset_ok_callback,
|
||||
off_d, NULL, NULL, TRUE, FALSE,
|
||||
|
||||
NULL);
|
||||
|
||||
|
||||
g_object_weak_ref (G_OBJECT (off_d->dlg), (GWeakNotify) g_free, off_d);
|
||||
|
||||
/* The vbox for first column of options */
|
||||
vbox = gtk_vbox_new (FALSE, 2);
|
||||
vbox = gtk_vbox_new (FALSE, 4);
|
||||
gtk_container_set_border_width (GTK_CONTAINER (vbox), 4);
|
||||
gtk_container_add (GTK_CONTAINER (GTK_DIALOG (off_d->dlg)->vbox), vbox);
|
||||
|
||||
/* The table for the offsets */
|
||||
table = gtk_table_new (3, 2, FALSE);
|
||||
gtk_table_set_col_spacing (GTK_TABLE (table), 0, 4);
|
||||
gtk_box_pack_start (GTK_BOX (vbox), table, FALSE, FALSE, 0);
|
||||
|
||||
/* The offset labels */
|
||||
label = gtk_label_new (_("Offset X:"));
|
||||
gtk_misc_set_alignment (GTK_MISC (label), 1.0, 0.5);
|
||||
gtk_table_attach (GTK_TABLE (table), label, 0, 1, 0, 1,
|
||||
GTK_SHRINK | GTK_FILL, GTK_SHRINK, 0, 0);
|
||||
gtk_widget_show (label);
|
||||
|
||||
label = gtk_label_new (_("Y:"));
|
||||
gtk_misc_set_alignment (GTK_MISC (label), 1.0, 0.5);
|
||||
gtk_table_attach (GTK_TABLE (table), label, 0, 1, 1, 2,
|
||||
GTK_SHRINK | GTK_FILL, GTK_SHRINK, 0, 0);
|
||||
gtk_widget_show (label);
|
||||
|
||||
/* The offset sizeentry */
|
||||
adjustment = gtk_adjustment_new (1, 1, 1, 1, 10, 1);
|
||||
spinbutton = gtk_spin_button_new (GTK_ADJUSTMENT (adjustment), 1, 2);
|
||||
gtk_spin_button_set_numeric (GTK_SPIN_BUTTON (spinbutton), TRUE);
|
||||
gtk_widget_set_size_request (spinbutton, 75, -1);
|
||||
abox = gtk_alignment_new (0.0, 0.5, 0.0, 0.0);
|
||||
gtk_box_pack_start (GTK_BOX (vbox), abox, FALSE, FALSE, 0);
|
||||
gtk_widget_show (abox);
|
||||
|
||||
spinbutton = gimp_spin_button_new (&adjustment,
|
||||
1, 1, 1, 1, 10, 1,
|
||||
1, 2);
|
||||
gtk_entry_set_width_chars (GTK_ENTRY (spinbutton), 10);
|
||||
|
||||
off_d->off_se = gimp_size_entry_new (1, off_d->gimage->unit, "%a",
|
||||
TRUE, TRUE, FALSE, 75,
|
||||
TRUE, TRUE, FALSE, 10,
|
||||
GIMP_SIZE_ENTRY_UPDATE_SIZE);
|
||||
gtk_table_set_col_spacing (GTK_TABLE (off_d->off_se), 0, 4);
|
||||
gtk_table_set_col_spacing (GTK_TABLE (off_d->off_se), 1, 4);
|
||||
gtk_table_set_row_spacing (GTK_TABLE (off_d->off_se), 0, 2);
|
||||
|
||||
gimp_size_entry_add_field (GIMP_SIZE_ENTRY (off_d->off_se),
|
||||
GTK_SPIN_BUTTON (spinbutton), NULL);
|
||||
gtk_table_attach_defaults (GTK_TABLE (off_d->off_se), spinbutton,
|
||||
1, 2, 0, 1);
|
||||
gtk_widget_show (spinbutton);
|
||||
gtk_table_attach (GTK_TABLE (table), off_d->off_se, 1, 2, 0, 2,
|
||||
GTK_SHRINK | GTK_FILL, GTK_SHRINK | GTK_FILL, 0, 0);
|
||||
|
||||
gimp_size_entry_attach_label (GIMP_SIZE_ENTRY (off_d->off_se),
|
||||
_("Offset X:"), 0, 0, 1.0);
|
||||
gimp_size_entry_attach_label (GIMP_SIZE_ENTRY (off_d->off_se),
|
||||
_("Y:"), 1, 0, 1.0);
|
||||
|
||||
gtk_container_add (GTK_CONTAINER (abox), off_d->off_se);
|
||||
gtk_widget_show (off_d->off_se);
|
||||
|
||||
gimp_size_entry_set_unit (GIMP_SIZE_ENTRY (off_d->off_se), GIMP_UNIT_PIXEL);
|
||||
|
@ -177,19 +173,26 @@ offset_dialog_create (GimpDrawable *drawable)
|
|||
gimp_size_entry_set_refval (GIMP_SIZE_ENTRY (off_d->off_se), 0, 0);
|
||||
gimp_size_entry_set_refval (GIMP_SIZE_ENTRY (off_d->off_se), 1, 0);
|
||||
|
||||
gtk_widget_show (table);
|
||||
|
||||
/* The by half height and half width option */
|
||||
push = gtk_button_new_with_label (_("Offset by (x/2),(y/2)"));
|
||||
gtk_container_set_border_width (GTK_CONTAINER (push), 2);
|
||||
gtk_box_pack_start (GTK_BOX (vbox), push, FALSE, FALSE, 0);
|
||||
gtk_widget_show (push);
|
||||
button = gtk_button_new_with_mnemonic (_("Offset by (x/_2),(y/2)"));
|
||||
gtk_container_set_border_width (GTK_CONTAINER (button), 2);
|
||||
gtk_box_pack_start (GTK_BOX (vbox), button, FALSE, FALSE, 0);
|
||||
gtk_widget_show (button);
|
||||
|
||||
g_signal_connect (G_OBJECT (button), "clicked",
|
||||
G_CALLBACK (offset_halfheight_callback),
|
||||
off_d);
|
||||
|
||||
/* The wrap around option */
|
||||
check = gtk_check_button_new_with_label (_("Wrap"));
|
||||
check = gtk_check_button_new_with_mnemonic (_("_Wrap"));
|
||||
gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (check), off_d->wrap_around);
|
||||
gtk_box_pack_start (GTK_BOX (vbox), check, FALSE, FALSE, 0);
|
||||
gtk_widget_show (check);
|
||||
|
||||
g_signal_connect (G_OBJECT (check), "toggled",
|
||||
G_CALLBACK (gimp_toggle_button_update),
|
||||
&off_d->wrap_around);
|
||||
|
||||
/* The fill options */
|
||||
frame =
|
||||
gimp_radio_group_new2 (TRUE, _("Fill Type"),
|
||||
|
@ -197,10 +200,10 @@ offset_dialog_create (GimpDrawable *drawable)
|
|||
&off_d->fill_type,
|
||||
GINT_TO_POINTER (off_d->fill_type),
|
||||
|
||||
_("Background"),
|
||||
_("_Background"),
|
||||
GINT_TO_POINTER (GIMP_OFFSET_BACKGROUND), NULL,
|
||||
|
||||
_("Transparent"),
|
||||
_("_Transparent"),
|
||||
GINT_TO_POINTER (GIMP_OFFSET_TRANSPARENT),
|
||||
&radio_button,
|
||||
|
||||
|
@ -212,24 +215,15 @@ offset_dialog_create (GimpDrawable *drawable)
|
|||
gtk_box_pack_start (GTK_BOX (vbox), frame, FALSE, FALSE, 0);
|
||||
gtk_widget_show (frame);
|
||||
|
||||
/* Hook up the wrap around */
|
||||
g_signal_connect (G_OBJECT (check), "toggled",
|
||||
G_CALLBACK (gimp_toggle_button_update),
|
||||
&off_d->wrap_around);
|
||||
g_object_set_data (G_OBJECT (check), "inverse_sensitive", frame);
|
||||
gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (check), off_d->wrap_around);
|
||||
|
||||
/* Hook up the by half */
|
||||
g_signal_connect (G_OBJECT (push), "clicked",
|
||||
G_CALLBACK (offset_halfheight_callback),
|
||||
off_d);
|
||||
gtk_widget_set_sensitive (frame, ! off_d->wrap_around);
|
||||
|
||||
gtk_widget_show (vbox);
|
||||
gtk_widget_show (off_d->dlg);
|
||||
}
|
||||
|
||||
|
||||
/* private function */
|
||||
/* private functions */
|
||||
|
||||
static void
|
||||
offset_ok_callback (GtkWidget *widget,
|
||||
|
@ -262,17 +256,6 @@ offset_ok_callback (GtkWidget *widget,
|
|||
g_free (off_d);
|
||||
}
|
||||
|
||||
static void
|
||||
offset_cancel_callback (GtkWidget *widget,
|
||||
gpointer data)
|
||||
{
|
||||
OffsetDialog *off_d;
|
||||
|
||||
off_d = (OffsetDialog *) data;
|
||||
gtk_widget_destroy (off_d->dlg);
|
||||
g_free (off_d);
|
||||
}
|
||||
|
||||
static void
|
||||
offset_halfheight_callback (GtkWidget *widget,
|
||||
gpointer data)
|
||||
|
|
|
@ -61,6 +61,8 @@
|
|||
#include "libgimp/gimpintl.h"
|
||||
|
||||
|
||||
#define SB_WIDTH 10
|
||||
|
||||
/* gimprc will be parsed with a buffer size of 1024,
|
||||
* so don't set this too large
|
||||
*/
|
||||
|
@ -1866,7 +1868,7 @@ preferences_dialog_create (Gimp *gimp)
|
|||
|
||||
sizeentry =
|
||||
gimp_size_entry_new (2, gimp->config->default_units, "%p",
|
||||
FALSE, FALSE, TRUE, 75,
|
||||
FALSE, FALSE, TRUE, SB_WIDTH,
|
||||
GIMP_SIZE_ENTRY_UPDATE_SIZE);
|
||||
|
||||
gimp_size_entry_attach_label (GIMP_SIZE_ENTRY (sizeentry),
|
||||
|
@ -1917,7 +1919,7 @@ preferences_dialog_create (Gimp *gimp)
|
|||
|
||||
sizeentry2 = gimp_size_entry_new (2, gimp->config->default_resolution_units,
|
||||
pixels_per_unit,
|
||||
FALSE, FALSE, TRUE, 75,
|
||||
FALSE, FALSE, TRUE, SB_WIDTH,
|
||||
GIMP_SIZE_ENTRY_UPDATE_RESOLUTION);
|
||||
|
||||
button = gimp_chain_button_new (GIMP_CHAIN_BOTTOM);
|
||||
|
@ -2499,7 +2501,7 @@ preferences_dialog_create (Gimp *gimp)
|
|||
|
||||
sizeentry =
|
||||
gimp_size_entry_new (2, GIMP_UNIT_INCH, pixels_per_unit,
|
||||
FALSE, FALSE, TRUE, 75,
|
||||
FALSE, FALSE, TRUE, SB_WIDTH,
|
||||
GIMP_SIZE_ENTRY_UPDATE_RESOLUTION);
|
||||
|
||||
g_free (pixels_per_unit);
|
||||
|
|
|
@ -39,6 +39,9 @@
|
|||
#include "libgimp/gimpintl.h"
|
||||
|
||||
|
||||
#define SB_WIDTH 10
|
||||
|
||||
|
||||
typedef struct _ResizePrivate ResizePrivate;
|
||||
|
||||
struct _ResizePrivate
|
||||
|
@ -120,7 +123,6 @@ resize_widget_new (GimpImage *gimage,
|
|||
GimpUnit unit,
|
||||
gboolean dot_for_dot,
|
||||
GCallback ok_cb,
|
||||
GCallback cancel_cb,
|
||||
gpointer user_data)
|
||||
{
|
||||
Resize *resize;
|
||||
|
@ -218,7 +220,7 @@ resize_widget_new (GimpImage *gimage,
|
|||
}
|
||||
frame = gtk_frame_new (_("Size"));
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
resize->resize_shell =
|
||||
gimp_viewable_dialog_new (GIMP_IS_VIEWABLE (object) ?
|
||||
|
@ -228,10 +230,8 @@ resize_widget_new (GimpImage *gimage,
|
|||
gimp_standard_help_func, help_page,
|
||||
|
||||
GTK_STOCK_CANCEL,
|
||||
cancel_cb ? cancel_cb : G_CALLBACK (gtk_widget_destroy),
|
||||
cancel_cb ? user_data : NULL,
|
||||
cancel_cb ? NULL : (gpointer) 1,
|
||||
NULL, FALSE, TRUE,
|
||||
G_CALLBACK (gtk_widget_destroy),
|
||||
NULL, (gpointer) 1, NULL, FALSE, TRUE,
|
||||
|
||||
GIMP_STOCK_RESET, reset_callback,
|
||||
resize, NULL, NULL, FALSE, FALSE,
|
||||
|
@ -248,17 +248,10 @@ resize_widget_new (GimpImage *gimage,
|
|||
|
||||
/* handle the image disappearing under our feet */
|
||||
if (object && signal)
|
||||
{
|
||||
if (cancel_cb)
|
||||
g_signal_connect (G_OBJECT (object), signal,
|
||||
cancel_cb,
|
||||
user_data);
|
||||
else
|
||||
g_signal_connect_object (G_OBJECT (object), signal,
|
||||
G_CALLBACK (gtk_widget_destroy),
|
||||
G_OBJECT (resize->resize_shell),
|
||||
G_CONNECT_SWAPPED);
|
||||
}
|
||||
g_signal_connect_object (G_OBJECT (object), signal,
|
||||
G_CALLBACK (gtk_widget_destroy),
|
||||
G_OBJECT (resize->resize_shell),
|
||||
G_CONNECT_SWAPPED);
|
||||
|
||||
/* the main vbox */
|
||||
main_vbox = gtk_vbox_new (FALSE, 4);
|
||||
|
@ -276,11 +269,12 @@ resize_widget_new (GimpImage *gimage,
|
|||
|
||||
table = gtk_table_new (6, 2, FALSE);
|
||||
gtk_container_set_border_width (GTK_CONTAINER (table), 2);
|
||||
gtk_table_set_col_spacings (GTK_TABLE (table), 2);
|
||||
gtk_table_set_col_spacing (GTK_TABLE (table), 0, 4);
|
||||
gtk_table_set_row_spacings (GTK_TABLE (table), 2);
|
||||
gtk_table_set_row_spacing (GTK_TABLE (table), 0, 4);
|
||||
gtk_table_set_row_spacing (GTK_TABLE (table), 1, 4);
|
||||
gtk_table_set_row_spacing (GTK_TABLE (table), 3, 4);
|
||||
gtk_table_set_row_spacing (GTK_TABLE (table), 4, 2);
|
||||
gtk_box_pack_start (GTK_BOX (vbox), table, FALSE, FALSE, 0);
|
||||
|
||||
/* the original width & height labels */
|
||||
|
@ -297,10 +291,10 @@ resize_widget_new (GimpImage *gimage,
|
|||
gtk_widget_show (label);
|
||||
|
||||
private->orig_width_label = gtk_label_new ("");
|
||||
gtk_misc_set_alignment (GTK_MISC ( private->orig_width_label), 0.0, 0.5);
|
||||
gtk_misc_set_alignment (GTK_MISC (private->orig_width_label), 0.0, 0.5);
|
||||
gtk_table_attach (GTK_TABLE (table), private->orig_width_label, 1, 2, 0, 1,
|
||||
GTK_SHRINK | GTK_FILL, GTK_SHRINK | GTK_FILL, 0, 0);
|
||||
gtk_widget_show ( private->orig_width_label);
|
||||
gtk_widget_show (private->orig_width_label);
|
||||
|
||||
private->orig_height_label = gtk_label_new ("");
|
||||
gtk_misc_set_alignment (GTK_MISC (private->orig_height_label), 0.0, 0.5);
|
||||
|
@ -322,19 +316,23 @@ resize_widget_new (GimpImage *gimage,
|
|||
gtk_widget_show (label);
|
||||
|
||||
/* the new size sizeentry */
|
||||
adjustment = gtk_adjustment_new (1, 1, 1, 1, 10, 1);
|
||||
spinbutton = gtk_spin_button_new (GTK_ADJUSTMENT (adjustment), 1, 2);
|
||||
gtk_spin_button_set_numeric (GTK_SPIN_BUTTON (spinbutton), TRUE);
|
||||
gtk_widget_set_size_request (spinbutton, 75, -1);
|
||||
spinbutton = gimp_spin_button_new (&adjustment,
|
||||
1, 1, 1, 1, 10, 1,
|
||||
1, 2);
|
||||
gtk_entry_set_width_chars (GTK_ENTRY (spinbutton), SB_WIDTH);
|
||||
|
||||
private->size_se = gimp_size_entry_new (1, unit, "%a",
|
||||
TRUE, TRUE, FALSE, SB_WIDTH,
|
||||
GIMP_SIZE_ENTRY_UPDATE_SIZE);
|
||||
gtk_table_set_col_spacing (GTK_TABLE (private->size_se), 1, 4);
|
||||
gtk_table_set_row_spacing (GTK_TABLE (private->size_se), 0, 2);
|
||||
|
||||
private->size_se =
|
||||
gimp_size_entry_new (1, unit, "%a", TRUE, TRUE, FALSE, 75,
|
||||
GIMP_SIZE_ENTRY_UPDATE_SIZE);
|
||||
gimp_size_entry_add_field (GIMP_SIZE_ENTRY (private->size_se),
|
||||
GTK_SPIN_BUTTON (spinbutton), NULL);
|
||||
gtk_table_attach_defaults (GTK_TABLE (private->size_se), spinbutton,
|
||||
1, 2, 0, 1);
|
||||
gtk_widget_show (spinbutton);
|
||||
|
||||
gtk_table_attach (GTK_TABLE (table), private->size_se, 1, 2, 2, 4,
|
||||
GTK_SHRINK | GTK_FILL, GTK_SHRINK | GTK_FILL, 0, 0);
|
||||
gtk_widget_show (private->size_se);
|
||||
|
@ -395,15 +393,14 @@ resize_widget_new (GimpImage *gimage,
|
|||
gtk_widget_show (abox);
|
||||
|
||||
/* the scale ratio spinbuttons */
|
||||
private->ratio_x_adj =
|
||||
gtk_adjustment_new (resize->ratio_x,
|
||||
(double) GIMP_MIN_IMAGE_SIZE / (double) resize->width,
|
||||
(double) GIMP_MAX_IMAGE_SIZE / (double) resize->width,
|
||||
0.01, 0.1, 1);
|
||||
spinbutton = gtk_spin_button_new (GTK_ADJUSTMENT (private->ratio_x_adj),
|
||||
0.01, 4);
|
||||
gtk_spin_button_set_numeric (GTK_SPIN_BUTTON (spinbutton), TRUE);
|
||||
gtk_widget_set_size_request (spinbutton, 75, -1);
|
||||
spinbutton =
|
||||
gimp_spin_button_new (&private->ratio_x_adj,
|
||||
resize->ratio_x,
|
||||
(double) GIMP_MIN_IMAGE_SIZE / (double) resize->width,
|
||||
(double) GIMP_MAX_IMAGE_SIZE / (double) resize->width,
|
||||
0.01, 0.1, 1,
|
||||
0.01, 4);
|
||||
gtk_entry_set_width_chars (GTK_ENTRY (spinbutton), SB_WIDTH);
|
||||
gtk_table_attach_defaults (GTK_TABLE (table2), spinbutton, 0, 1, 0, 1);
|
||||
gtk_widget_show (spinbutton);
|
||||
|
||||
|
@ -411,19 +408,18 @@ resize_widget_new (GimpImage *gimage,
|
|||
G_CALLBACK (ratio_callback),
|
||||
resize);
|
||||
|
||||
private->ratio_y_adj =
|
||||
gtk_adjustment_new (resize->ratio_y,
|
||||
(double) GIMP_MIN_IMAGE_SIZE / (double) resize->height,
|
||||
(double) GIMP_MAX_IMAGE_SIZE / (double) resize->height,
|
||||
0.01, 0.1, 1);
|
||||
spinbutton = gtk_spin_button_new (GTK_ADJUSTMENT (private->ratio_y_adj),
|
||||
0.01, 4);
|
||||
gtk_spin_button_set_numeric (GTK_SPIN_BUTTON (spinbutton), TRUE);
|
||||
gtk_widget_set_size_request (spinbutton, 75, -1);
|
||||
spinbutton =
|
||||
gimp_spin_button_new (&private->ratio_y_adj,
|
||||
resize->ratio_y,
|
||||
(double) GIMP_MIN_IMAGE_SIZE / (double) resize->height,
|
||||
(double) GIMP_MAX_IMAGE_SIZE / (double) resize->height,
|
||||
0.01, 0.1, 1,
|
||||
0.01, 4);
|
||||
gtk_entry_set_width_chars (GTK_ENTRY (spinbutton), SB_WIDTH);
|
||||
gtk_table_attach_defaults (GTK_TABLE (table2), spinbutton, 0, 1, 1, 2);
|
||||
gtk_widget_show (spinbutton);
|
||||
|
||||
g_signal_connect (G_OBJECT ( private->ratio_y_adj), "value_changed",
|
||||
g_signal_connect (G_OBJECT (private->ratio_y_adj), "value_changed",
|
||||
G_CALLBACK (ratio_callback),
|
||||
resize);
|
||||
|
||||
|
@ -457,24 +453,29 @@ resize_widget_new (GimpImage *gimage,
|
|||
gtk_box_pack_start (GTK_BOX (vbox), abox, FALSE, FALSE, 0);
|
||||
|
||||
/* the offset sizeentry */
|
||||
adjustment = gtk_adjustment_new (1, 1, 1, 1, 10, 1);
|
||||
spinbutton = gtk_spin_button_new (GTK_ADJUSTMENT (adjustment), 1, 2);
|
||||
gtk_spin_button_set_numeric (GTK_SPIN_BUTTON (spinbutton), TRUE);
|
||||
gtk_widget_set_size_request (spinbutton, 75, -1);
|
||||
spinbutton = gimp_spin_button_new (&adjustment,
|
||||
1, 1, 1, 1, 10, 1,
|
||||
1, 2);
|
||||
gtk_entry_set_width_chars (GTK_ENTRY (spinbutton), SB_WIDTH);
|
||||
|
||||
private->offset_se = gimp_size_entry_new (1, unit, "%a",
|
||||
TRUE, FALSE, FALSE, SB_WIDTH,
|
||||
GIMP_SIZE_ENTRY_UPDATE_SIZE);
|
||||
gtk_table_set_col_spacing (GTK_TABLE (private->offset_se), 0, 4);
|
||||
gtk_table_set_col_spacing (GTK_TABLE (private->offset_se), 1, 4);
|
||||
gtk_table_set_col_spacing (GTK_TABLE (private->offset_se), 3, 8);
|
||||
gtk_table_set_row_spacing (GTK_TABLE (private->offset_se), 0, 2);
|
||||
|
||||
private->offset_se =
|
||||
gimp_size_entry_new (1, unit, "%a", TRUE, FALSE, FALSE, 75,
|
||||
GIMP_SIZE_ENTRY_UPDATE_SIZE);
|
||||
gimp_size_entry_add_field (GIMP_SIZE_ENTRY (private->offset_se),
|
||||
GTK_SPIN_BUTTON (spinbutton), NULL);
|
||||
gtk_table_attach_defaults (GTK_TABLE (private->offset_se), spinbutton,
|
||||
1, 2, 0, 1);
|
||||
gtk_table_set_col_spacing (GTK_TABLE (private->offset_se), 0, 4);
|
||||
gtk_widget_show (spinbutton);
|
||||
|
||||
gimp_size_entry_attach_label (GIMP_SIZE_ENTRY (private->offset_se),
|
||||
_("X:"), 0, 0, 1.0);
|
||||
gimp_size_entry_attach_label (GIMP_SIZE_ENTRY (private->offset_se),
|
||||
_("Y:"), 1, 0, 1.0);
|
||||
gtk_widget_show (spinbutton);
|
||||
gtk_container_add (GTK_CONTAINER (abox), private->offset_se);
|
||||
gtk_widget_show (private->offset_se);
|
||||
|
||||
|
@ -503,7 +504,6 @@ resize_widget_new (GimpImage *gimage,
|
|||
gtk_misc_set_padding (GTK_MISC (GTK_BIN (button)->child), 4, 0);
|
||||
gtk_table_attach_defaults (GTK_TABLE (private->offset_se), button,
|
||||
4, 5, 1, 2);
|
||||
gtk_table_set_col_spacing (GTK_TABLE (private->offset_se), 3, 8);
|
||||
gtk_widget_show (button);
|
||||
|
||||
g_signal_connect (G_OBJECT (button), "clicked",
|
||||
|
@ -547,6 +547,7 @@ resize_widget_new (GimpImage *gimage,
|
|||
|
||||
table = gtk_table_new (4, 2, FALSE);
|
||||
gtk_table_set_col_spacing (GTK_TABLE (table), 0, 4);
|
||||
gtk_table_set_row_spacings (GTK_TABLE (table), 2);
|
||||
gtk_table_set_row_spacing (GTK_TABLE (table), 1, 4);
|
||||
gtk_box_pack_start (GTK_BOX (vbox), table, FALSE, FALSE, 0);
|
||||
|
||||
|
@ -565,28 +566,33 @@ resize_widget_new (GimpImage *gimage,
|
|||
|
||||
/* the print size sizeentry */
|
||||
abox = gtk_alignment_new (0.0, 0.5, 0.0, 1.0);
|
||||
adjustment = gtk_adjustment_new (1, 1, 1, 1, 10, 1);
|
||||
spinbutton = gtk_spin_button_new (GTK_ADJUSTMENT (adjustment), 1, 2);
|
||||
gtk_spin_button_set_numeric (GTK_SPIN_BUTTON (spinbutton), TRUE);
|
||||
gtk_widget_set_size_request (spinbutton, 75, -1);
|
||||
gtk_container_add (GTK_CONTAINER (abox), spinbutton);
|
||||
gtk_widget_show (spinbutton);
|
||||
gtk_table_attach (GTK_TABLE (table), abox, 1, 2, 0, 1,
|
||||
GTK_SHRINK | GTK_FILL, GTK_SHRINK | GTK_FILL, 0, 0);
|
||||
gtk_widget_show (abox);
|
||||
|
||||
spinbutton = gimp_spin_button_new (&adjustment,
|
||||
1, 1, 1, 1, 10, 1,
|
||||
1, 2);
|
||||
gtk_entry_set_width_chars (GTK_ENTRY (spinbutton), SB_WIDTH);
|
||||
gtk_container_add (GTK_CONTAINER (abox), spinbutton);
|
||||
gtk_widget_show (spinbutton);
|
||||
|
||||
abox = gtk_alignment_new (0.0, 0.5, 0.0, 1.0);
|
||||
private->printsize_se =
|
||||
gimp_size_entry_new (1, unit, "%a", FALSE, FALSE, FALSE, 75,
|
||||
GIMP_SIZE_ENTRY_UPDATE_SIZE);
|
||||
gimp_size_entry_add_field (GIMP_SIZE_ENTRY (private->printsize_se),
|
||||
GTK_SPIN_BUTTON (spinbutton), NULL);
|
||||
gtk_container_add (GTK_CONTAINER (abox), private->printsize_se);
|
||||
gtk_table_attach (GTK_TABLE (table), abox, 1, 2, 1, 2,
|
||||
GTK_SHRINK | GTK_FILL, GTK_SHRINK | GTK_FILL, 0, 0);
|
||||
gtk_widget_show (private->printsize_se);
|
||||
gtk_widget_show (abox);
|
||||
|
||||
private->printsize_se = gimp_size_entry_new (1, unit, "%a",
|
||||
FALSE, FALSE, FALSE, SB_WIDTH,
|
||||
GIMP_SIZE_ENTRY_UPDATE_SIZE);
|
||||
gtk_table_set_col_spacing (GTK_TABLE (private->printsize_se), 1, 4);
|
||||
|
||||
gimp_size_entry_add_field (GIMP_SIZE_ENTRY (private->printsize_se),
|
||||
GTK_SPIN_BUTTON (spinbutton), NULL);
|
||||
|
||||
gtk_container_add (GTK_CONTAINER (abox), private->printsize_se);
|
||||
gtk_widget_show (private->printsize_se);
|
||||
|
||||
gimp_size_entry_set_resolution (GIMP_SIZE_ENTRY (private->printsize_se),
|
||||
0, resolution_x, FALSE);
|
||||
gimp_size_entry_set_resolution (GIMP_SIZE_ENTRY (private->printsize_se),
|
||||
|
@ -610,7 +616,7 @@ resize_widget_new (GimpImage *gimage,
|
|||
g_signal_connect (G_OBJECT (private->printsize_se), "unit_changed",
|
||||
G_CALLBACK (unit_update),
|
||||
resize);
|
||||
|
||||
|
||||
/* the resolution labels */
|
||||
label = gtk_label_new (_("Resolution X:"));
|
||||
gtk_misc_set_alignment (GTK_MISC (label), 1.0, 0.5);
|
||||
|
@ -625,23 +631,26 @@ resize_widget_new (GimpImage *gimage,
|
|||
gtk_widget_show (label);
|
||||
|
||||
/* the resolution sizeentry */
|
||||
adjustment = gtk_adjustment_new (1, 1, 1, 1, 10, 1);
|
||||
spinbutton = gtk_spin_button_new (GTK_ADJUSTMENT (adjustment), 1, 2);
|
||||
gtk_spin_button_set_numeric (GTK_SPIN_BUTTON (spinbutton), TRUE);
|
||||
gtk_widget_set_size_request (spinbutton, 75, -1);
|
||||
spinbutton = gimp_spin_button_new (&adjustment,
|
||||
1, 1, 1, 1, 10, 1,
|
||||
1, 2);
|
||||
gtk_entry_set_width_chars (GTK_ENTRY (spinbutton), SB_WIDTH);
|
||||
|
||||
private->resolution_se =
|
||||
gimp_size_entry_new (1, gimage->gimp->config->default_resolution_units,
|
||||
_("pixels/%a"),
|
||||
FALSE, FALSE, FALSE, 75,
|
||||
FALSE, FALSE, FALSE, SB_WIDTH,
|
||||
GIMP_SIZE_ENTRY_UPDATE_RESOLUTION);
|
||||
gtk_table_set_col_spacing (GTK_TABLE (private->resolution_se), 1, 2);
|
||||
gtk_table_set_col_spacing (GTK_TABLE (private->resolution_se), 2, 2);
|
||||
gtk_table_set_row_spacing (GTK_TABLE (private->resolution_se), 0, 2);
|
||||
|
||||
gimp_size_entry_add_field (GIMP_SIZE_ENTRY (private->resolution_se),
|
||||
GTK_SPIN_BUTTON (spinbutton), NULL);
|
||||
gtk_table_attach_defaults (GTK_TABLE (private->resolution_se), spinbutton,
|
||||
1, 2, 0, 1);
|
||||
gtk_widget_show (spinbutton);
|
||||
|
||||
gtk_table_attach (GTK_TABLE (table), private->resolution_se, 1, 2, 2, 4,
|
||||
GTK_SHRINK | GTK_FILL, GTK_SHRINK | GTK_FILL, 0, 0);
|
||||
gtk_widget_show (private->resolution_se);
|
||||
|
|
|
@ -81,7 +81,6 @@ Resize * resize_widget_new (GimpImage *gimage,
|
|||
GimpUnit unit,
|
||||
gboolean dot_for_dot,
|
||||
GCallback ok_cb,
|
||||
GCallback cancel_cb,
|
||||
gpointer user_data);
|
||||
|
||||
|
||||
|
|
|
@ -251,7 +251,7 @@ resolution_calibrate_dialog (GtkWidget *resolution_entry,
|
|||
|
||||
calibrate_entry =
|
||||
gimp_coordinates_new (GIMP_UNIT_INCH, "%p",
|
||||
FALSE, FALSE, 75,
|
||||
FALSE, FALSE, 10,
|
||||
GIMP_SIZE_ENTRY_UPDATE_SIZE,
|
||||
FALSE,
|
||||
FALSE,
|
||||
|
|
|
@ -1237,7 +1237,7 @@ user_install_resolution (void)
|
|||
pixels_per_unit = g_strconcat (_("Pixels"), "/%s", NULL);
|
||||
resolution_entry =
|
||||
gimp_coordinates_new (GIMP_UNIT_INCH, pixels_per_unit,
|
||||
FALSE, FALSE, 75,
|
||||
FALSE, FALSE, 10,
|
||||
GIMP_SIZE_ENTRY_UPDATE_RESOLUTION,
|
||||
abs (gimprc.monitor_xres - gimprc.monitor_yres) < GIMP_MIN_RESOLUTION,
|
||||
FALSE,
|
||||
|
|
|
@ -41,6 +41,9 @@
|
|||
#include "libgimp/gimpintl.h"
|
||||
|
||||
|
||||
#define SB_WIDTH 10
|
||||
|
||||
|
||||
typedef struct
|
||||
{
|
||||
GtkWidget *dialog;
|
||||
|
@ -89,7 +92,7 @@ file_new_dialog_create (Gimp *gimp,
|
|||
GimpImage *gimage)
|
||||
{
|
||||
NewImageInfo *info;
|
||||
GtkWidget *top_vbox;
|
||||
GtkWidget *main_vbox;
|
||||
GtkWidget *hbox;
|
||||
GtkWidget *vbox;
|
||||
GtkWidget *abox;
|
||||
|
@ -131,15 +134,15 @@ file_new_dialog_create (Gimp *gimp,
|
|||
gtk_window_set_resizable (GTK_WINDOW (info->dialog), FALSE);
|
||||
|
||||
/* vbox holding the rest of the dialog */
|
||||
top_vbox = gtk_vbox_new (FALSE, 4);
|
||||
gtk_container_set_border_width (GTK_CONTAINER (top_vbox), 4);
|
||||
main_vbox = gtk_vbox_new (FALSE, 4);
|
||||
gtk_container_set_border_width (GTK_CONTAINER (main_vbox), 4);
|
||||
gtk_box_pack_start (GTK_BOX (GTK_DIALOG (info->dialog)->vbox),
|
||||
top_vbox, TRUE, TRUE, 0);
|
||||
gtk_widget_show (top_vbox);
|
||||
main_vbox, TRUE, TRUE, 0);
|
||||
gtk_widget_show (main_vbox);
|
||||
|
||||
/* Image size frame */
|
||||
frame = gtk_frame_new (_("Image Size"));
|
||||
gtk_box_pack_start (GTK_BOX (top_vbox), frame, FALSE, FALSE, 0);
|
||||
gtk_box_pack_start (GTK_BOX (main_vbox), frame, FALSE, FALSE, 0);
|
||||
gtk_widget_show (frame);
|
||||
|
||||
vbox = gtk_vbox_new (FALSE, 0);
|
||||
|
@ -149,7 +152,7 @@ file_new_dialog_create (Gimp *gimp,
|
|||
|
||||
table = gtk_table_new (7, 2, FALSE);
|
||||
gtk_table_set_col_spacing (GTK_TABLE (table), 0, 4);
|
||||
gtk_table_set_row_spacing (GTK_TABLE (table), 0, 2);
|
||||
gtk_table_set_row_spacings (GTK_TABLE (table), 2);
|
||||
gtk_table_set_row_spacing (GTK_TABLE (table), 1, 4);
|
||||
gtk_table_set_row_spacing (GTK_TABLE (table), 2, 4);
|
||||
gtk_table_set_row_spacing (GTK_TABLE (table), 4, 4);
|
||||
|
@ -190,30 +193,33 @@ file_new_dialog_create (Gimp *gimp,
|
|||
/* create the sizeentry which keeps it all together */
|
||||
abox = gtk_alignment_new (0.0, 0.5, 0.0, 0.0);
|
||||
gtk_table_attach_defaults (GTK_TABLE (table), abox, 1, 2, 3, 5);
|
||||
info->size_se =
|
||||
gimp_size_entry_new (0, info->values->unit, "%a", FALSE, FALSE, TRUE, 75,
|
||||
GIMP_SIZE_ENTRY_UPDATE_SIZE);
|
||||
gtk_table_set_col_spacing (GTK_TABLE (info->size_se), 1, 2);
|
||||
gtk_container_add (GTK_CONTAINER (abox), info->size_se);
|
||||
gtk_widget_show (info->size_se);
|
||||
gtk_widget_show (abox);
|
||||
|
||||
info->size_se = gimp_size_entry_new (0, info->values->unit, "%a",
|
||||
FALSE, FALSE, TRUE, SB_WIDTH,
|
||||
GIMP_SIZE_ENTRY_UPDATE_SIZE);
|
||||
gtk_table_set_col_spacing (GTK_TABLE (info->size_se), 1, 4);
|
||||
gtk_table_set_row_spacing (GTK_TABLE (info->size_se), 1, 2);
|
||||
gtk_container_add (GTK_CONTAINER (abox), info->size_se);
|
||||
gtk_widget_show (info->size_se);
|
||||
|
||||
/* height in units */
|
||||
adjustment = gtk_adjustment_new (1, 1, 1, 1, 10, 1);
|
||||
spinbutton = gtk_spin_button_new (GTK_ADJUSTMENT (adjustment), 1, 2);
|
||||
gtk_spin_button_set_numeric (GTK_SPIN_BUTTON (spinbutton), TRUE);
|
||||
gtk_widget_set_size_request (spinbutton, 75, -1);
|
||||
spinbutton = gimp_spin_button_new (&adjustment,
|
||||
1, 1, 1, 1, 10, 0,
|
||||
1, 2);
|
||||
gtk_entry_set_width_chars (GTK_ENTRY (spinbutton), SB_WIDTH);
|
||||
/* add the "height in units" spinbutton to the sizeentry */
|
||||
gtk_table_attach_defaults (GTK_TABLE (info->size_se), spinbutton,
|
||||
0, 1, 2, 3);
|
||||
gtk_widget_show (spinbutton);
|
||||
|
||||
/* height in pixels */
|
||||
hbox = gtk_hbox_new (FALSE, 2);
|
||||
adjustment = gtk_adjustment_new (1, 1, 1, 1, 10, 1);
|
||||
spinbutton2 = gtk_spin_button_new (GTK_ADJUSTMENT (adjustment), 1, 0);
|
||||
gtk_spin_button_set_numeric (GTK_SPIN_BUTTON (spinbutton2), TRUE);
|
||||
gtk_widget_set_size_request (spinbutton2, 75, -1);
|
||||
hbox = gtk_hbox_new (FALSE, 4);
|
||||
|
||||
spinbutton2 = gimp_spin_button_new (&adjustment,
|
||||
1, 1, 1, 1, 10, 0,
|
||||
1, 0);
|
||||
gtk_entry_set_width_chars (GTK_ENTRY (spinbutton2), SB_WIDTH);
|
||||
gtk_box_pack_start (GTK_BOX (hbox), spinbutton2, FALSE, FALSE, 0);
|
||||
gtk_widget_show (spinbutton2);
|
||||
|
||||
|
@ -235,10 +241,10 @@ file_new_dialog_create (Gimp *gimp,
|
|||
GTK_SPIN_BUTTON (spinbutton2));
|
||||
|
||||
/* width in units */
|
||||
adjustment = gtk_adjustment_new (1, 1, 1, 1, 10, 1);
|
||||
spinbutton = gtk_spin_button_new (GTK_ADJUSTMENT (adjustment), 1, 2);
|
||||
gtk_spin_button_set_numeric (GTK_SPIN_BUTTON (spinbutton), TRUE);
|
||||
gtk_widget_set_size_request (spinbutton, 75, -1);
|
||||
spinbutton = gimp_spin_button_new (&adjustment,
|
||||
1, 1, 1, 1, 10, 0,
|
||||
1, 2);
|
||||
gtk_entry_set_width_chars (GTK_ENTRY (spinbutton), SB_WIDTH);
|
||||
/* add the "width in units" spinbutton to the sizeentry */
|
||||
gtk_table_attach_defaults (GTK_TABLE (info->size_se), spinbutton,
|
||||
0, 1, 1, 2);
|
||||
|
@ -247,14 +253,15 @@ file_new_dialog_create (Gimp *gimp,
|
|||
/* width in pixels */
|
||||
abox = gtk_alignment_new (0.0, 0.5, 0.0, 0.0);
|
||||
gtk_table_attach_defaults (GTK_TABLE (table), abox, 1, 2, 0, 1);
|
||||
adjustment = gtk_adjustment_new (1, 1, 1, 1, 10, 1);
|
||||
spinbutton2 = gtk_spin_button_new (GTK_ADJUSTMENT (adjustment), 1, 0);
|
||||
gtk_spin_button_set_numeric (GTK_SPIN_BUTTON (spinbutton2), TRUE);
|
||||
gtk_widget_set_size_request (spinbutton2, 75, -1);
|
||||
gtk_widget_show (abox);
|
||||
|
||||
spinbutton2 = gimp_spin_button_new (&adjustment,
|
||||
1, 1, 1, 1, 10, 0,
|
||||
1, 0);
|
||||
gtk_entry_set_width_chars (GTK_ENTRY (spinbutton2), SB_WIDTH);
|
||||
/* add the "width in pixels" spinbutton to the main table */
|
||||
gtk_container_add (GTK_CONTAINER (abox), spinbutton2);
|
||||
gtk_widget_show (spinbutton2);
|
||||
gtk_widget_show (abox);
|
||||
|
||||
/* register the width spinbuttons with the sizeentry */
|
||||
gimp_size_entry_add_field (GIMP_SIZE_ENTRY (info->size_se),
|
||||
|
@ -303,28 +310,30 @@ file_new_dialog_create (Gimp *gimp,
|
|||
gtk_widget_show (label);
|
||||
|
||||
/* the resolution sizeentry */
|
||||
adjustment = gtk_adjustment_new (1, 1, 1, 1, 10, 1);
|
||||
spinbutton = gtk_spin_button_new (GTK_ADJUSTMENT (adjustment), 1, 2);
|
||||
gtk_spin_button_set_numeric (GTK_SPIN_BUTTON (spinbutton), TRUE);
|
||||
gtk_widget_set_size_request (spinbutton, 75, -1);
|
||||
abox = gtk_alignment_new (0.0, 0.5, 0.0, 0.0);
|
||||
gtk_table_attach_defaults (GTK_TABLE (table), abox, 1, 2, 5, 7);
|
||||
gtk_widget_show (abox);
|
||||
|
||||
spinbutton = gimp_spin_button_new (&adjustment,
|
||||
1, 1, 1, 1, 10, 0,
|
||||
1, 2);
|
||||
gtk_entry_set_width_chars (GTK_ENTRY (spinbutton), SB_WIDTH);
|
||||
|
||||
info->resolution_se =
|
||||
gimp_size_entry_new (1, gimp->config->default_resolution_units,
|
||||
_("pixels/%a"),
|
||||
FALSE, FALSE, FALSE, 75,
|
||||
FALSE, FALSE, FALSE, SB_WIDTH,
|
||||
GIMP_SIZE_ENTRY_UPDATE_RESOLUTION);
|
||||
gtk_table_set_col_spacing (GTK_TABLE (info->resolution_se), 1, 2);
|
||||
gtk_table_set_col_spacing (GTK_TABLE (info->resolution_se), 2, 2);
|
||||
gtk_table_set_row_spacing (GTK_TABLE (info->resolution_se), 0, 2);
|
||||
|
||||
gimp_size_entry_add_field (GIMP_SIZE_ENTRY (info->resolution_se),
|
||||
GTK_SPIN_BUTTON (spinbutton), NULL);
|
||||
gtk_table_attach_defaults (GTK_TABLE (info->resolution_se), spinbutton,
|
||||
1, 2, 0, 1);
|
||||
gtk_widget_show (spinbutton);
|
||||
|
||||
abox = gtk_alignment_new (0.0, 0.5, 0.0, 0.0);
|
||||
gtk_table_attach_defaults (GTK_TABLE (table), abox, 1, 2, 5, 7);
|
||||
gtk_widget_show (abox);
|
||||
|
||||
gtk_container_add (GTK_CONTAINER (abox), info->resolution_se);
|
||||
gtk_widget_show (info->resolution_se);
|
||||
|
||||
|
@ -355,8 +364,8 @@ file_new_dialog_create (Gimp *gimp,
|
|||
gtk_widget_show (info->couple_resolutions);
|
||||
|
||||
/* hbox containing the Image type and fill type frames */
|
||||
hbox = gtk_hbox_new (FALSE, 2);
|
||||
gtk_box_pack_start (GTK_BOX (top_vbox), hbox, FALSE, FALSE, 0);
|
||||
hbox = gtk_hbox_new (FALSE, 4);
|
||||
gtk_box_pack_start (GTK_BOX (main_vbox), hbox, FALSE, FALSE, 0);
|
||||
gtk_widget_show (hbox);
|
||||
|
||||
/* frame for Image Type */
|
||||
|
|
|
@ -127,20 +127,21 @@ image_resize_cmd_callback (GtkWidget *widget,
|
|||
|
||||
image_resize->gdisp = gdisp;
|
||||
image_resize->gimage = gimage;
|
||||
image_resize->resize = resize_widget_new (gimage,
|
||||
ResizeWidget,
|
||||
ResizeImage,
|
||||
G_OBJECT (gdisp),
|
||||
"disconnect",
|
||||
gimage->width,
|
||||
gimage->height,
|
||||
gimage->xresolution,
|
||||
gimage->yresolution,
|
||||
gimage->unit,
|
||||
GIMP_DISPLAY_SHELL (gdisp->shell)->dot_for_dot,
|
||||
G_CALLBACK (image_resize_callback),
|
||||
NULL,
|
||||
image_resize);
|
||||
|
||||
image_resize->resize =
|
||||
resize_widget_new (gimage,
|
||||
ResizeWidget,
|
||||
ResizeImage,
|
||||
G_OBJECT (gdisp),
|
||||
"disconnect",
|
||||
gimage->width,
|
||||
gimage->height,
|
||||
gimage->xresolution,
|
||||
gimage->yresolution,
|
||||
gimage->unit,
|
||||
GIMP_DISPLAY_SHELL (gdisp->shell)->dot_for_dot,
|
||||
G_CALLBACK (image_resize_callback),
|
||||
image_resize);
|
||||
|
||||
g_object_weak_ref (G_OBJECT (image_resize->resize->resize_shell),
|
||||
(GWeakNotify) g_free,
|
||||
|
@ -164,20 +165,21 @@ image_scale_cmd_callback (GtkWidget *widget,
|
|||
|
||||
image_scale->gdisp = gdisp;
|
||||
image_scale->gimage = gimage;
|
||||
image_scale->resize = resize_widget_new (gimage,
|
||||
ScaleWidget,
|
||||
ResizeImage,
|
||||
G_OBJECT (gdisp),
|
||||
"disconnect",
|
||||
gimage->width,
|
||||
gimage->height,
|
||||
gimage->xresolution,
|
||||
gimage->yresolution,
|
||||
gimage->unit,
|
||||
GIMP_DISPLAY_SHELL (gdisp->shell)->dot_for_dot,
|
||||
G_CALLBACK (image_scale_callback),
|
||||
NULL,
|
||||
image_scale);
|
||||
|
||||
image_scale->resize =
|
||||
resize_widget_new (gimage,
|
||||
ScaleWidget,
|
||||
ResizeImage,
|
||||
G_OBJECT (gdisp),
|
||||
"disconnect",
|
||||
gimage->width,
|
||||
gimage->height,
|
||||
gimage->xresolution,
|
||||
gimage->yresolution,
|
||||
gimage->unit,
|
||||
GIMP_DISPLAY_SHELL (gdisp->shell)->dot_for_dot,
|
||||
G_CALLBACK (image_scale_callback),
|
||||
image_scale);
|
||||
|
||||
g_object_weak_ref (G_OBJECT (image_scale->resize->resize_shell),
|
||||
(GWeakNotify) g_free,
|
||||
|
|
|
@ -30,135 +30,287 @@
|
|||
|
||||
#include "info-dialog.h"
|
||||
|
||||
#include "gimprc.h"
|
||||
|
||||
#include "libgimp/gimpintl.h"
|
||||
|
||||
|
||||
/* static functions */
|
||||
static void info_field_new (InfoDialog *idialog,
|
||||
InfoFieldType field_type,
|
||||
gchar *title,
|
||||
GtkWidget *widget,
|
||||
GtkObject *object,
|
||||
gpointer value_ptr,
|
||||
GCallback callback,
|
||||
gpointer callback_data);
|
||||
static void update_field (InfoField *info_field);
|
||||
static gint info_dialog_delete_callback (GtkWidget *widget,
|
||||
GdkEvent *event,
|
||||
gpointer data);
|
||||
#define SB_WIDTH 10
|
||||
|
||||
|
||||
static void
|
||||
info_field_new (InfoDialog *idialog,
|
||||
InfoFieldType field_type,
|
||||
gchar *title,
|
||||
GtkWidget *widget,
|
||||
GtkObject *obj,
|
||||
gpointer value_ptr,
|
||||
GCallback callback,
|
||||
gpointer callback_data)
|
||||
/* local function prototypes */
|
||||
|
||||
static InfoDialog * info_dialog_new_extended (GimpViewable *viewable,
|
||||
const gchar *title,
|
||||
const gchar *wmclass_name,
|
||||
const gchar *stock_id,
|
||||
const gchar *desc,
|
||||
GimpHelpFunc help_func,
|
||||
gpointer help_data,
|
||||
gboolean in_notebook);
|
||||
static gboolean info_dialog_delete_callback (GtkWidget *widget,
|
||||
GdkEvent *event,
|
||||
gpointer data);
|
||||
static void info_dialog_field_new (InfoDialog *idialog,
|
||||
InfoFieldType field_type,
|
||||
gchar *title,
|
||||
GtkWidget *widget,
|
||||
GtkObject *object,
|
||||
gpointer value_ptr,
|
||||
GCallback callback,
|
||||
gpointer callback_data);
|
||||
static void info_dialog_update_field (InfoField *info_field);
|
||||
|
||||
|
||||
/* public functions */
|
||||
|
||||
InfoDialog *
|
||||
info_dialog_new (GimpViewable *viewable,
|
||||
const gchar *title,
|
||||
const gchar *wmclass_name,
|
||||
const gchar *stock_id,
|
||||
const gchar *desc,
|
||||
GimpHelpFunc help_func,
|
||||
gpointer help_data)
|
||||
{
|
||||
return info_dialog_new_extended (viewable, title, wmclass_name,
|
||||
stock_id, desc,
|
||||
help_func, help_data, FALSE);
|
||||
}
|
||||
|
||||
InfoDialog *
|
||||
info_dialog_notebook_new (GimpViewable *viewable,
|
||||
const gchar *title,
|
||||
const gchar *wmclass_name,
|
||||
const gchar *stock_id,
|
||||
const gchar *desc,
|
||||
GimpHelpFunc help_func,
|
||||
gpointer help_data)
|
||||
{
|
||||
return info_dialog_new_extended (viewable, title, wmclass_name,
|
||||
stock_id, desc,
|
||||
help_func, help_data, TRUE);
|
||||
}
|
||||
|
||||
void
|
||||
info_dialog_free (InfoDialog *idialog)
|
||||
{
|
||||
g_return_if_fail (idialog != NULL);
|
||||
|
||||
g_slist_foreach (idialog->field_list, (GFunc) g_free, NULL);
|
||||
g_slist_free (idialog->field_list);
|
||||
|
||||
gtk_widget_destroy (idialog->shell);
|
||||
|
||||
g_free (idialog);
|
||||
}
|
||||
|
||||
void
|
||||
info_dialog_popup (InfoDialog *idialog)
|
||||
{
|
||||
g_return_if_fail (idialog != NULL);
|
||||
|
||||
if (! GTK_WIDGET_VISIBLE (idialog->shell))
|
||||
gtk_widget_show (idialog->shell);
|
||||
}
|
||||
|
||||
void
|
||||
info_dialog_popdown (InfoDialog *idialog)
|
||||
{
|
||||
g_return_if_fail (idialog != NULL);
|
||||
|
||||
if (GTK_WIDGET_VISIBLE (idialog->shell))
|
||||
gtk_widget_hide (idialog->shell);
|
||||
}
|
||||
|
||||
void
|
||||
info_dialog_update (InfoDialog *idialog)
|
||||
{
|
||||
GSList *list;
|
||||
|
||||
g_return_if_fail (idialog != NULL);
|
||||
|
||||
for (list = idialog->field_list; list; list = g_slist_next (list))
|
||||
info_dialog_update_field ((InfoField *) list->data);
|
||||
}
|
||||
|
||||
GtkWidget *
|
||||
info_dialog_add_label (InfoDialog *idialog,
|
||||
gchar *title,
|
||||
gchar *text_ptr)
|
||||
{
|
||||
GtkWidget *label;
|
||||
InfoField *field;
|
||||
gint row;
|
||||
|
||||
field = g_new (InfoField, 1);
|
||||
g_return_val_if_fail (idialog != NULL, NULL);
|
||||
|
||||
row = idialog->nfields + 1;
|
||||
gtk_table_resize (GTK_TABLE (idialog->info_table), 2, row);
|
||||
label = gtk_label_new (text_ptr);
|
||||
gtk_misc_set_alignment (GTK_MISC (label), 0.0, 0.5);
|
||||
|
||||
label = gtk_label_new (title);
|
||||
gtk_misc_set_alignment (GTK_MISC (label), 1.0, 0.5);
|
||||
gtk_table_attach (GTK_TABLE (idialog->info_table), label,
|
||||
0, 1, row - 1, row,
|
||||
GTK_SHRINK | GTK_FILL, GTK_SHRINK | GTK_FILL, 0, 0);
|
||||
gtk_widget_show (label);
|
||||
info_dialog_field_new (idialog, INFO_LABEL, title, label, NULL,
|
||||
text_ptr,
|
||||
NULL, NULL);
|
||||
|
||||
gtk_table_attach_defaults (GTK_TABLE (idialog->info_table), widget,
|
||||
1, 2, row - 1, row);
|
||||
gtk_widget_show (widget);
|
||||
return label;
|
||||
}
|
||||
|
||||
gtk_table_set_col_spacing (GTK_TABLE (idialog->info_table), 0, 6);
|
||||
gtk_table_set_row_spacings (GTK_TABLE (idialog->info_table), 2);
|
||||
GtkWidget *
|
||||
info_dialog_add_entry (InfoDialog *idialog,
|
||||
gchar *title,
|
||||
gchar *text_ptr,
|
||||
GCallback callback,
|
||||
gpointer callback_data)
|
||||
{
|
||||
GtkWidget *entry;
|
||||
|
||||
field->field_type = field_type;
|
||||
g_return_val_if_fail (idialog != NULL, NULL);
|
||||
|
||||
if (obj == NULL)
|
||||
field->obj = GTK_OBJECT (widget);
|
||||
entry = gtk_entry_new ();
|
||||
gtk_widget_set_size_request (entry, 50, -1);
|
||||
gtk_entry_set_text (GTK_ENTRY (entry), text_ptr ? text_ptr : "");
|
||||
|
||||
if (callback)
|
||||
g_signal_connect (G_OBJECT (entry), "changed",
|
||||
callback,
|
||||
callback_data);
|
||||
|
||||
info_dialog_field_new (idialog, INFO_ENTRY, title, entry, NULL,
|
||||
text_ptr,
|
||||
callback, callback_data);
|
||||
|
||||
return entry;
|
||||
}
|
||||
|
||||
GtkWidget *
|
||||
info_dialog_add_scale (InfoDialog *idialog,
|
||||
gchar *title,
|
||||
gdouble *value_ptr,
|
||||
gfloat lower,
|
||||
gfloat upper,
|
||||
gfloat step_increment,
|
||||
gfloat page_increment,
|
||||
gfloat page_size,
|
||||
gint digits,
|
||||
GCallback callback,
|
||||
gpointer callback_data)
|
||||
{
|
||||
GtkObject *adjustment;
|
||||
GtkWidget *scale;
|
||||
|
||||
g_return_val_if_fail (idialog != NULL, NULL);
|
||||
|
||||
adjustment = gtk_adjustment_new (value_ptr ? *value_ptr : 0, lower, upper,
|
||||
step_increment, page_increment, page_size);
|
||||
scale = gtk_hscale_new (GTK_ADJUSTMENT (adjustment));
|
||||
|
||||
if (digits >= 0)
|
||||
gtk_scale_set_digits (GTK_SCALE (scale), MAX (digits, 6));
|
||||
else
|
||||
field->obj = obj;
|
||||
gtk_scale_set_draw_value (GTK_SCALE (scale), FALSE);
|
||||
|
||||
field->value_ptr = value_ptr;
|
||||
field->callback = callback;
|
||||
field->callback_data = callback_data;
|
||||
if (callback)
|
||||
g_signal_connect (G_OBJECT (adjustment), "value_changed",
|
||||
callback,
|
||||
callback_data);
|
||||
|
||||
idialog->field_list = g_slist_prepend (idialog->field_list, field);
|
||||
idialog->nfields++;
|
||||
info_dialog_field_new (idialog, INFO_SCALE, title, scale, adjustment,
|
||||
value_ptr,
|
||||
callback, callback_data);
|
||||
|
||||
return scale;
|
||||
}
|
||||
|
||||
static void
|
||||
update_field (InfoField *field)
|
||||
GtkWidget *
|
||||
info_dialog_add_spinbutton (InfoDialog *idialog,
|
||||
gchar *title,
|
||||
gdouble *value_ptr,
|
||||
gfloat lower,
|
||||
gfloat upper,
|
||||
gfloat step_increment,
|
||||
gfloat page_increment,
|
||||
gfloat page_size,
|
||||
gfloat climb_rate,
|
||||
gint digits,
|
||||
GCallback callback,
|
||||
gpointer callback_data)
|
||||
{
|
||||
const gchar *old_text;
|
||||
gint num;
|
||||
gint i;
|
||||
GtkWidget *alignment;
|
||||
GtkObject *adjustment;
|
||||
GtkWidget *spinbutton;
|
||||
|
||||
if (field->value_ptr == NULL)
|
||||
return;
|
||||
g_return_val_if_fail (idialog != NULL, NULL);
|
||||
|
||||
if (field->field_type != INFO_LABEL)
|
||||
g_signal_handlers_block_by_func (G_OBJECT (field->obj),
|
||||
field->callback,
|
||||
field->callback_data);
|
||||
alignment = gtk_alignment_new (0.0, 0.5, 0.0, 1.0);
|
||||
|
||||
switch (field->field_type)
|
||||
{
|
||||
case INFO_LABEL:
|
||||
gtk_label_set_text (GTK_LABEL (field->obj), (gchar *) field->value_ptr);
|
||||
break;
|
||||
spinbutton = gimp_spin_button_new (&adjustment,
|
||||
value_ptr ? *value_ptr : 0,
|
||||
lower, upper,
|
||||
step_increment, page_increment, page_size,
|
||||
climb_rate, MAX (MIN (digits, 6), 0));
|
||||
gtk_entry_set_width_chars (GTK_ENTRY (spinbutton), SB_WIDTH);
|
||||
|
||||
case INFO_ENTRY:
|
||||
old_text = gtk_entry_get_text (GTK_ENTRY (field->obj));
|
||||
if (strcmp (old_text, (gchar *) field->value_ptr))
|
||||
gtk_entry_set_text (GTK_ENTRY (field->obj), (gchar *) field->value_ptr);
|
||||
break;
|
||||
if (callback)
|
||||
g_signal_connect (G_OBJECT (adjustment), "value_changed",
|
||||
callback,
|
||||
callback_data);
|
||||
|
||||
case INFO_SCALE:
|
||||
case INFO_SPINBUTTON:
|
||||
gtk_adjustment_set_value (GTK_ADJUSTMENT (field->obj),
|
||||
*((gdouble *) field->value_ptr));
|
||||
break;
|
||||
gtk_container_add (GTK_CONTAINER (alignment), spinbutton);
|
||||
gtk_widget_show (spinbutton);
|
||||
|
||||
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,
|
||||
((gdouble *) field->value_ptr)[i]);
|
||||
break;
|
||||
info_dialog_field_new (idialog, INFO_SPINBUTTON, title, alignment,
|
||||
adjustment,
|
||||
value_ptr,
|
||||
callback, callback_data);
|
||||
|
||||
default:
|
||||
g_warning ("%s: Unknown info_dialog field type.", G_STRLOC);
|
||||
break;
|
||||
}
|
||||
|
||||
if (field->field_type != INFO_LABEL)
|
||||
g_signal_handlers_unblock_by_func (G_OBJECT (field->obj),
|
||||
field->callback,
|
||||
field->callback_data);
|
||||
return spinbutton;
|
||||
}
|
||||
|
||||
static gboolean
|
||||
info_dialog_delete_callback (GtkWidget *widget,
|
||||
GdkEvent *event,
|
||||
gpointer data)
|
||||
GtkWidget *
|
||||
info_dialog_add_sizeentry (InfoDialog *idialog,
|
||||
gchar *title,
|
||||
gdouble *value_ptr,
|
||||
gint nfields,
|
||||
GimpUnit unit,
|
||||
gchar *unit_format,
|
||||
gboolean menu_show_pixels,
|
||||
gboolean menu_show_percent,
|
||||
gboolean show_refval,
|
||||
GimpSizeEntryUpdatePolicy update_policy,
|
||||
GCallback callback,
|
||||
gpointer callback_data)
|
||||
{
|
||||
info_dialog_popdown ((InfoDialog *) data);
|
||||
GtkWidget *alignment;
|
||||
GtkWidget *sizeentry;
|
||||
gint i;
|
||||
|
||||
return TRUE;
|
||||
g_return_val_if_fail (idialog != NULL, NULL);
|
||||
|
||||
alignment = gtk_alignment_new (0.0, 0.5, 0.0, 1.0);
|
||||
|
||||
sizeentry = gimp_size_entry_new (nfields, unit, unit_format,
|
||||
menu_show_pixels, menu_show_percent,
|
||||
show_refval, SB_WIDTH,
|
||||
update_policy);
|
||||
if (value_ptr)
|
||||
for (i = 0; i < nfields; i++)
|
||||
gimp_size_entry_set_refval (GIMP_SIZE_ENTRY (sizeentry), i, value_ptr[i]);
|
||||
|
||||
if (callback)
|
||||
g_signal_connect (G_OBJECT (sizeentry), "value_changed",
|
||||
callback,
|
||||
callback_data);
|
||||
|
||||
gtk_container_add (GTK_CONTAINER (alignment), sizeentry);
|
||||
gtk_widget_show (sizeentry);
|
||||
|
||||
info_dialog_field_new (idialog, INFO_SIZEENTRY, title, alignment,
|
||||
GTK_OBJECT (sizeentry),
|
||||
value_ptr,
|
||||
callback, callback_data);
|
||||
|
||||
return sizeentry;
|
||||
}
|
||||
|
||||
|
||||
/* private functions */
|
||||
|
||||
static InfoDialog *
|
||||
info_dialog_new_extended (GimpViewable *viewable,
|
||||
const gchar *title,
|
||||
|
@ -224,260 +376,111 @@ info_dialog_new_extended (GimpViewable *viewable,
|
|||
return idialog;
|
||||
}
|
||||
|
||||
/* public functions */
|
||||
|
||||
InfoDialog *
|
||||
info_dialog_notebook_new (GimpViewable *viewable,
|
||||
const gchar *title,
|
||||
const gchar *wmclass_name,
|
||||
const gchar *stock_id,
|
||||
const gchar *desc,
|
||||
GimpHelpFunc help_func,
|
||||
gpointer help_data)
|
||||
static gboolean
|
||||
info_dialog_delete_callback (GtkWidget *widget,
|
||||
GdkEvent *event,
|
||||
gpointer data)
|
||||
{
|
||||
return info_dialog_new_extended (viewable, title, wmclass_name,
|
||||
stock_id, desc,
|
||||
help_func, help_data, TRUE);
|
||||
info_dialog_popdown ((InfoDialog *) data);
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
InfoDialog *
|
||||
info_dialog_new (GimpViewable *viewable,
|
||||
const gchar *title,
|
||||
const gchar *wmclass_name,
|
||||
const gchar *stock_id,
|
||||
const gchar *desc,
|
||||
GimpHelpFunc help_func,
|
||||
gpointer help_data)
|
||||
{
|
||||
return info_dialog_new_extended (viewable, title, wmclass_name,
|
||||
stock_id, desc,
|
||||
help_func, help_data, FALSE);
|
||||
}
|
||||
|
||||
void
|
||||
info_dialog_free (InfoDialog *idialog)
|
||||
{
|
||||
GSList *list;
|
||||
|
||||
g_return_if_fail (idialog != NULL);
|
||||
|
||||
/* Free each item in the field list */
|
||||
for (list = idialog->field_list; list; list = g_slist_next (list))
|
||||
g_free (list->data);
|
||||
|
||||
/* Free the actual field linked list */
|
||||
g_slist_free (idialog->field_list);
|
||||
|
||||
/* Destroy the associated widgets */
|
||||
gtk_widget_destroy (idialog->shell);
|
||||
|
||||
/* Free the info dialog memory */
|
||||
g_free (idialog);
|
||||
}
|
||||
|
||||
void
|
||||
info_dialog_popup (InfoDialog *idialog)
|
||||
{
|
||||
g_return_if_fail (idialog != NULL);
|
||||
|
||||
if (! GTK_WIDGET_VISIBLE (idialog->shell))
|
||||
gtk_widget_show (idialog->shell);
|
||||
|
||||
}
|
||||
|
||||
void
|
||||
info_dialog_popdown (InfoDialog *idialog)
|
||||
{
|
||||
g_return_if_fail (idialog != NULL);
|
||||
|
||||
if (GTK_WIDGET_VISIBLE (idialog->shell))
|
||||
gtk_widget_hide (idialog->shell);
|
||||
}
|
||||
|
||||
void
|
||||
info_dialog_update (InfoDialog *idialog)
|
||||
{
|
||||
GSList *list;
|
||||
|
||||
if (! idialog)
|
||||
return;
|
||||
|
||||
for (list = idialog->field_list; list; list = g_slist_next (list))
|
||||
update_field ((InfoField *) list->data);
|
||||
}
|
||||
|
||||
GtkWidget *
|
||||
info_dialog_add_label (InfoDialog *idialog,
|
||||
char *title,
|
||||
char *text_ptr)
|
||||
static void
|
||||
info_dialog_field_new (InfoDialog *idialog,
|
||||
InfoFieldType field_type,
|
||||
gchar *title,
|
||||
GtkWidget *widget,
|
||||
GtkObject *obj,
|
||||
gpointer value_ptr,
|
||||
GCallback callback,
|
||||
gpointer callback_data)
|
||||
{
|
||||
GtkWidget *label;
|
||||
InfoField *field;
|
||||
gint row;
|
||||
|
||||
g_return_val_if_fail (idialog != NULL, NULL);
|
||||
field = g_new (InfoField, 1);
|
||||
|
||||
label = gtk_label_new (text_ptr);
|
||||
gtk_misc_set_alignment (GTK_MISC (label), 0.0, 0.5);
|
||||
row = idialog->nfields + 1;
|
||||
gtk_table_resize (GTK_TABLE (idialog->info_table), 2, row);
|
||||
|
||||
info_field_new (idialog, INFO_LABEL, title, label, NULL,
|
||||
text_ptr,
|
||||
NULL, NULL);
|
||||
label = gtk_label_new (title);
|
||||
gtk_misc_set_alignment (GTK_MISC (label), 1.0, 0.5);
|
||||
gtk_table_attach (GTK_TABLE (idialog->info_table), label,
|
||||
0, 1, row - 1, row,
|
||||
GTK_SHRINK | GTK_FILL, GTK_SHRINK | GTK_FILL, 0, 0);
|
||||
gtk_widget_show (label);
|
||||
|
||||
return label;
|
||||
}
|
||||
gtk_table_attach_defaults (GTK_TABLE (idialog->info_table), widget,
|
||||
1, 2, row - 1, row);
|
||||
gtk_widget_show (widget);
|
||||
|
||||
GtkWidget *
|
||||
info_dialog_add_entry (InfoDialog *idialog,
|
||||
gchar *title,
|
||||
gchar *text_ptr,
|
||||
GCallback callback,
|
||||
gpointer callback_data)
|
||||
{
|
||||
GtkWidget *entry;
|
||||
gtk_table_set_col_spacing (GTK_TABLE (idialog->info_table), 0, 6);
|
||||
gtk_table_set_row_spacings (GTK_TABLE (idialog->info_table), 2);
|
||||
|
||||
g_return_val_if_fail (idialog != NULL, NULL);
|
||||
field->field_type = field_type;
|
||||
|
||||
entry = gtk_entry_new ();
|
||||
gtk_widget_set_size_request (entry, 50, -1);
|
||||
gtk_entry_set_text (GTK_ENTRY (entry), text_ptr ? text_ptr : "");
|
||||
|
||||
if (callback)
|
||||
g_signal_connect (G_OBJECT (entry), "changed",
|
||||
callback,
|
||||
callback_data);
|
||||
|
||||
info_field_new (idialog, INFO_ENTRY, title, entry, NULL,
|
||||
text_ptr,
|
||||
callback, callback_data);
|
||||
|
||||
return entry;
|
||||
}
|
||||
|
||||
GtkWidget *
|
||||
info_dialog_add_scale (InfoDialog *idialog,
|
||||
gchar *title,
|
||||
gdouble *value_ptr,
|
||||
gfloat lower,
|
||||
gfloat upper,
|
||||
gfloat step_increment,
|
||||
gfloat page_increment,
|
||||
gfloat page_size,
|
||||
gint digits,
|
||||
GCallback callback,
|
||||
gpointer callback_data)
|
||||
{
|
||||
GtkObject *adjustment;
|
||||
GtkWidget *scale;
|
||||
|
||||
g_return_val_if_fail (idialog != NULL, NULL);
|
||||
|
||||
adjustment = gtk_adjustment_new (value_ptr ? *value_ptr : 0, lower, upper,
|
||||
step_increment, page_increment, page_size);
|
||||
scale = gtk_hscale_new (GTK_ADJUSTMENT (adjustment));
|
||||
|
||||
if (digits >= 0)
|
||||
gtk_scale_set_digits (GTK_SCALE (scale), MAX (digits, 6));
|
||||
if (obj == NULL)
|
||||
field->obj = GTK_OBJECT (widget);
|
||||
else
|
||||
gtk_scale_set_draw_value (GTK_SCALE (scale), FALSE);
|
||||
field->obj = obj;
|
||||
|
||||
if (callback)
|
||||
g_signal_connect (G_OBJECT (adjustment), "value_changed",
|
||||
callback,
|
||||
callback_data);
|
||||
field->value_ptr = value_ptr;
|
||||
field->callback = callback;
|
||||
field->callback_data = callback_data;
|
||||
|
||||
info_field_new (idialog, INFO_SCALE, title, scale, adjustment,
|
||||
value_ptr,
|
||||
callback, callback_data);
|
||||
|
||||
return scale;
|
||||
idialog->field_list = g_slist_prepend (idialog->field_list, field);
|
||||
idialog->nfields++;
|
||||
}
|
||||
|
||||
GtkWidget *
|
||||
info_dialog_add_spinbutton (InfoDialog *idialog,
|
||||
gchar *title,
|
||||
gdouble *value_ptr,
|
||||
gfloat lower,
|
||||
gfloat upper,
|
||||
gfloat step_increment,
|
||||
gfloat page_increment,
|
||||
gfloat page_size,
|
||||
gfloat climb_rate,
|
||||
gint digits,
|
||||
GCallback callback,
|
||||
gpointer callback_data)
|
||||
static void
|
||||
info_dialog_update_field (InfoField *field)
|
||||
{
|
||||
GtkWidget *alignment;
|
||||
GtkObject *adjustment;
|
||||
GtkWidget *spinbutton;
|
||||
const gchar *old_text;
|
||||
gint num;
|
||||
gint i;
|
||||
|
||||
g_return_val_if_fail (idialog != NULL, NULL);
|
||||
if (field->value_ptr == NULL)
|
||||
return;
|
||||
|
||||
alignment = gtk_alignment_new (0.0, 0.5, 0.0, 1.0);
|
||||
if (field->field_type != INFO_LABEL)
|
||||
g_signal_handlers_block_by_func (G_OBJECT (field->obj),
|
||||
field->callback,
|
||||
field->callback_data);
|
||||
|
||||
adjustment = gtk_adjustment_new (value_ptr ? *value_ptr : 0, lower, upper,
|
||||
step_increment, page_increment, page_size);
|
||||
spinbutton = gtk_spin_button_new (GTK_ADJUSTMENT (adjustment),
|
||||
climb_rate, MAX (MIN (digits, 6), 0));
|
||||
gtk_spin_button_set_numeric (GTK_SPIN_BUTTON (spinbutton), TRUE);
|
||||
gtk_widget_set_size_request (spinbutton, 75, -1);
|
||||
switch (field->field_type)
|
||||
{
|
||||
case INFO_LABEL:
|
||||
gtk_label_set_text (GTK_LABEL (field->obj), (gchar *) field->value_ptr);
|
||||
break;
|
||||
|
||||
if (callback)
|
||||
g_signal_connect (G_OBJECT (adjustment), "value_changed",
|
||||
callback,
|
||||
callback_data);
|
||||
case INFO_ENTRY:
|
||||
old_text = gtk_entry_get_text (GTK_ENTRY (field->obj));
|
||||
if (strcmp (old_text, (gchar *) field->value_ptr))
|
||||
gtk_entry_set_text (GTK_ENTRY (field->obj), (gchar *) field->value_ptr);
|
||||
break;
|
||||
|
||||
gtk_container_add (GTK_CONTAINER (alignment), spinbutton);
|
||||
gtk_widget_show (spinbutton);
|
||||
case INFO_SCALE:
|
||||
case INFO_SPINBUTTON:
|
||||
gtk_adjustment_set_value (GTK_ADJUSTMENT (field->obj),
|
||||
*((gdouble *) field->value_ptr));
|
||||
break;
|
||||
|
||||
info_field_new (idialog, INFO_SPINBUTTON, title, alignment,
|
||||
adjustment,
|
||||
value_ptr,
|
||||
callback, callback_data);
|
||||
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,
|
||||
((gdouble *) field->value_ptr)[i]);
|
||||
break;
|
||||
|
||||
return spinbutton;
|
||||
}
|
||||
|
||||
GtkWidget *
|
||||
info_dialog_add_sizeentry (InfoDialog *idialog,
|
||||
gchar *title,
|
||||
gdouble *value_ptr,
|
||||
gint nfields,
|
||||
GimpUnit unit,
|
||||
gchar *unit_format,
|
||||
gboolean menu_show_pixels,
|
||||
gboolean menu_show_percent,
|
||||
gboolean show_refval,
|
||||
GimpSizeEntryUpdatePolicy update_policy,
|
||||
GCallback callback,
|
||||
gpointer callback_data)
|
||||
{
|
||||
GtkWidget *alignment;
|
||||
GtkWidget *sizeentry;
|
||||
gint i;
|
||||
|
||||
g_return_val_if_fail (idialog != NULL, NULL);
|
||||
|
||||
alignment = gtk_alignment_new (0.0, 0.5, 0.0, 1.0);
|
||||
|
||||
sizeentry = gimp_size_entry_new (nfields, unit, unit_format,
|
||||
menu_show_pixels, menu_show_percent,
|
||||
show_refval, 75,
|
||||
update_policy);
|
||||
if (value_ptr)
|
||||
for (i = 0; i < nfields; i++)
|
||||
gimp_size_entry_set_refval (GIMP_SIZE_ENTRY (sizeentry), i, value_ptr[i]);
|
||||
|
||||
if (callback)
|
||||
g_signal_connect (G_OBJECT (sizeentry), "value_changed",
|
||||
callback,
|
||||
callback_data);
|
||||
|
||||
gtk_container_add (GTK_CONTAINER (alignment), sizeentry);
|
||||
gtk_widget_show (sizeentry);
|
||||
|
||||
info_field_new (idialog, INFO_SIZEENTRY, title, alignment,
|
||||
GTK_OBJECT (sizeentry),
|
||||
value_ptr,
|
||||
callback, callback_data);
|
||||
|
||||
return sizeentry;
|
||||
default:
|
||||
g_warning ("%s: Unknown info_dialog field type.", G_STRLOC);
|
||||
break;
|
||||
}
|
||||
|
||||
if (field->field_type != INFO_LABEL)
|
||||
g_signal_handlers_unblock_by_func (G_OBJECT (field->obj),
|
||||
field->callback,
|
||||
field->callback_data);
|
||||
}
|
||||
|
|
|
@ -52,7 +52,7 @@ struct _InfoDialog
|
|||
GSList *field_list;
|
||||
gint nfields;
|
||||
|
||||
void *user_data;
|
||||
gpointer user_data;
|
||||
};
|
||||
|
||||
/* Info Dialog functions */
|
||||
|
|
|
@ -617,7 +617,7 @@ layers_new_layer_query (GimpImage *gimage,
|
|||
options);
|
||||
|
||||
/* The main vbox */
|
||||
vbox = gtk_vbox_new (FALSE, 2);
|
||||
vbox = gtk_vbox_new (FALSE, 4);
|
||||
gtk_container_set_border_width (GTK_CONTAINER (vbox), 4);
|
||||
gtk_container_add (GTK_CONTAINER (GTK_DIALOG (options->query_box)->vbox),
|
||||
vbox);
|
||||
|
@ -628,19 +628,12 @@ layers_new_layer_query (GimpImage *gimage,
|
|||
gtk_box_pack_start (GTK_BOX (vbox), table, FALSE, FALSE, 0);
|
||||
|
||||
/* The name label and entry */
|
||||
label = gtk_label_new (_("Layer Name:"));
|
||||
gtk_misc_set_alignment (GTK_MISC (label), 1.0, 0.5);
|
||||
gtk_table_attach (GTK_TABLE (table), label, 0, 1, 0, 1,
|
||||
GTK_SHRINK | GTK_FILL, GTK_SHRINK, 0, 1);
|
||||
gtk_widget_show (label);
|
||||
|
||||
options->name_entry = gtk_entry_new ();
|
||||
gtk_widget_set_size_request (options->name_entry, 75, -1);
|
||||
gtk_table_attach_defaults (GTK_TABLE (table),
|
||||
options->name_entry, 1, 2, 0, 1);
|
||||
gtk_entry_set_text (GTK_ENTRY (options->name_entry),
|
||||
(layer_name ? layer_name : _("New Layer")));
|
||||
gtk_widget_show (options->name_entry);
|
||||
gimp_table_attach_aligned (GTK_TABLE (table), 0, 0,
|
||||
_("Layer _Name:"), 1.0, 0.5,
|
||||
options->name_entry, 1, FALSE);
|
||||
|
||||
/* The size labels */
|
||||
label = gtk_label_new (_("Layer Width:"));
|
||||
|
@ -656,19 +649,23 @@ layers_new_layer_query (GimpImage *gimage,
|
|||
gtk_widget_show (label);
|
||||
|
||||
/* The size sizeentry */
|
||||
adjustment = gtk_adjustment_new (1, 1, 1, 1, 10, 1);
|
||||
spinbutton = gtk_spin_button_new (GTK_ADJUSTMENT (adjustment), 1, 2);
|
||||
gtk_spin_button_set_numeric (GTK_SPIN_BUTTON (spinbutton), TRUE);
|
||||
gtk_widget_set_size_request (spinbutton, 75, -1);
|
||||
|
||||
spinbutton = gimp_spin_button_new (&adjustment,
|
||||
1, 1, 1, 1, 10, 1,
|
||||
1, 2);
|
||||
gtk_entry_set_width_chars (GTK_ENTRY (spinbutton), 10);
|
||||
|
||||
options->size_se = gimp_size_entry_new (1, gimage->unit, "%a",
|
||||
TRUE, TRUE, FALSE, 75,
|
||||
TRUE, TRUE, FALSE, 10,
|
||||
GIMP_SIZE_ENTRY_UPDATE_SIZE);
|
||||
gtk_table_set_col_spacing (GTK_TABLE (options->size_se), 1, 4);
|
||||
gtk_table_set_row_spacing (GTK_TABLE (options->size_se), 0, 2);
|
||||
|
||||
gimp_size_entry_add_field (GIMP_SIZE_ENTRY (options->size_se),
|
||||
GTK_SPIN_BUTTON (spinbutton), NULL);
|
||||
gtk_table_attach_defaults (GTK_TABLE (options->size_se), spinbutton,
|
||||
1, 2, 0, 1);
|
||||
gtk_widget_show (spinbutton);
|
||||
|
||||
gtk_table_attach (GTK_TABLE (table), options->size_se, 1, 2, 1, 3,
|
||||
GTK_SHRINK | GTK_FILL, GTK_SHRINK | GTK_FILL, 0, 0);
|
||||
gtk_widget_show (options->size_se);
|
||||
|
@ -777,8 +774,7 @@ layers_edit_layer_query (GimpLayer *layer)
|
|||
{
|
||||
EditLayerOptions *options;
|
||||
GtkWidget *vbox;
|
||||
GtkWidget *hbox;
|
||||
GtkWidget *label;
|
||||
GtkWidget *table;
|
||||
|
||||
options = g_new0 (EditLayerOptions, 1);
|
||||
|
||||
|
@ -813,33 +809,30 @@ layers_edit_layer_query (GimpLayer *layer)
|
|||
G_CONNECT_SWAPPED);
|
||||
|
||||
/* The main vbox */
|
||||
vbox = gtk_vbox_new (FALSE, 2);
|
||||
vbox = gtk_vbox_new (FALSE, 4);
|
||||
gtk_container_set_border_width (GTK_CONTAINER (vbox), 4);
|
||||
gtk_container_add (GTK_CONTAINER (GTK_DIALOG (options->query_box)->vbox),
|
||||
vbox);
|
||||
|
||||
/* The name hbox, label and entry */
|
||||
hbox = gtk_hbox_new (FALSE, 4);
|
||||
gtk_box_pack_start (GTK_BOX (vbox), hbox, FALSE, FALSE, 0);
|
||||
|
||||
label = gtk_label_new (_("Layer name:"));
|
||||
gtk_box_pack_start (GTK_BOX (hbox), label, FALSE, FALSE, 0);
|
||||
gtk_widget_show (label);
|
||||
/* The name label and entry */
|
||||
table = gtk_table_new (1, 2, FALSE);
|
||||
gtk_table_set_col_spacing (GTK_TABLE (table), 0, 4);
|
||||
gtk_box_pack_start (GTK_BOX (vbox), table, FALSE, FALSE, 0);
|
||||
gtk_widget_show (table);
|
||||
|
||||
options->name_entry = gtk_entry_new ();
|
||||
gtk_box_pack_start (GTK_BOX (hbox), options->name_entry, TRUE, TRUE, 0);
|
||||
gtk_entry_set_text (GTK_ENTRY (options->name_entry),
|
||||
((gimp_layer_is_floating_sel (layer) ?
|
||||
_("Floating Selection") :
|
||||
gimp_object_get_name (GIMP_OBJECT (layer)))));
|
||||
gtk_widget_show (options->name_entry);
|
||||
gimp_table_attach_aligned (GTK_TABLE (table), 0, 0,
|
||||
_("Layer _Name"), 1.0, 0.5,
|
||||
options->name_entry, 1, FALSE);
|
||||
|
||||
g_signal_connect (G_OBJECT (options->name_entry), "activate",
|
||||
G_CALLBACK (edit_layer_query_ok_callback),
|
||||
options);
|
||||
|
||||
gtk_widget_show (hbox);
|
||||
|
||||
gtk_widget_show (vbox);
|
||||
gtk_widget_show (options->query_box);
|
||||
}
|
||||
|
@ -1048,9 +1041,10 @@ layers_scale_layer_query (GimpImage *gimage,
|
|||
{
|
||||
ScaleLayerOptions *options;
|
||||
|
||||
/* the new options structure */
|
||||
options = g_new (ScaleLayerOptions, 1);
|
||||
options->layer = layer;
|
||||
options = g_new0 (ScaleLayerOptions, 1);
|
||||
|
||||
options->layer = layer;
|
||||
|
||||
options->resize =
|
||||
resize_widget_new (gimage,
|
||||
ScaleWidget,
|
||||
|
@ -1064,8 +1058,7 @@ layers_scale_layer_query (GimpImage *gimage,
|
|||
gimage->unit,
|
||||
TRUE,
|
||||
G_CALLBACK (scale_layer_query_ok_callback),
|
||||
NULL,
|
||||
options);
|
||||
options);
|
||||
|
||||
g_object_weak_ref (G_OBJECT (options->resize->resize_shell),
|
||||
(GWeakNotify) g_free,
|
||||
|
@ -1140,9 +1133,10 @@ layers_resize_layer_query (GimpImage *gimage,
|
|||
{
|
||||
ResizeLayerOptions *options;
|
||||
|
||||
/* the new options structure */
|
||||
options = g_new (ResizeLayerOptions, 1);
|
||||
options->layer = layer;
|
||||
options = g_new0 (ResizeLayerOptions, 1);
|
||||
|
||||
options->layer = layer;
|
||||
|
||||
options->resize =
|
||||
resize_widget_new (gimage,
|
||||
ResizeWidget,
|
||||
|
@ -1156,8 +1150,7 @@ layers_resize_layer_query (GimpImage *gimage,
|
|||
gimage->unit,
|
||||
TRUE,
|
||||
G_CALLBACK (resize_layer_query_ok_callback),
|
||||
NULL,
|
||||
options);
|
||||
options);
|
||||
|
||||
g_object_weak_ref (G_OBJECT (options->resize->resize_shell),
|
||||
(GWeakNotify) g_free,
|
||||
|
|
|
@ -56,25 +56,24 @@ struct _OffsetDialog
|
|||
};
|
||||
|
||||
|
||||
/* Forward declarations */
|
||||
/* local function prototypes */
|
||||
|
||||
static void offset_ok_callback (GtkWidget *widget,
|
||||
gpointer data);
|
||||
static void offset_cancel_callback (GtkWidget *widget,
|
||||
gpointer data);
|
||||
|
||||
static void offset_halfheight_callback (GtkWidget *widget,
|
||||
gpointer data);
|
||||
|
||||
|
||||
/* public functions */
|
||||
|
||||
void
|
||||
offset_dialog_create (GimpDrawable *drawable)
|
||||
{
|
||||
OffsetDialog *off_d;
|
||||
GtkWidget *label;
|
||||
GtkWidget *check;
|
||||
GtkWidget *push;
|
||||
GtkWidget *button;
|
||||
GtkWidget *vbox;
|
||||
GtkWidget *table;
|
||||
GtkWidget *abox;
|
||||
GtkObject *adjustment;
|
||||
GtkWidget *spinbutton;
|
||||
GtkWidget *frame;
|
||||
|
@ -106,53 +105,50 @@ offset_dialog_create (GimpDrawable *drawable)
|
|||
gimp_standard_help_func,
|
||||
"dialogs/offset.html",
|
||||
|
||||
GTK_STOCK_CANCEL, offset_cancel_callback,
|
||||
off_d, NULL, NULL, FALSE, TRUE,
|
||||
GTK_STOCK_CANCEL, gtk_widget_destroy,
|
||||
NULL, (gpointer) 1, NULL, FALSE, TRUE,
|
||||
|
||||
GTK_STOCK_OK, offset_ok_callback,
|
||||
off_d, NULL, NULL, TRUE, FALSE,
|
||||
|
||||
NULL);
|
||||
|
||||
|
||||
g_object_weak_ref (G_OBJECT (off_d->dlg), (GWeakNotify) g_free, off_d);
|
||||
|
||||
/* The vbox for first column of options */
|
||||
vbox = gtk_vbox_new (FALSE, 2);
|
||||
vbox = gtk_vbox_new (FALSE, 4);
|
||||
gtk_container_set_border_width (GTK_CONTAINER (vbox), 4);
|
||||
gtk_container_add (GTK_CONTAINER (GTK_DIALOG (off_d->dlg)->vbox), vbox);
|
||||
|
||||
/* The table for the offsets */
|
||||
table = gtk_table_new (3, 2, FALSE);
|
||||
gtk_table_set_col_spacing (GTK_TABLE (table), 0, 4);
|
||||
gtk_box_pack_start (GTK_BOX (vbox), table, FALSE, FALSE, 0);
|
||||
|
||||
/* The offset labels */
|
||||
label = gtk_label_new (_("Offset X:"));
|
||||
gtk_misc_set_alignment (GTK_MISC (label), 1.0, 0.5);
|
||||
gtk_table_attach (GTK_TABLE (table), label, 0, 1, 0, 1,
|
||||
GTK_SHRINK | GTK_FILL, GTK_SHRINK, 0, 0);
|
||||
gtk_widget_show (label);
|
||||
|
||||
label = gtk_label_new (_("Y:"));
|
||||
gtk_misc_set_alignment (GTK_MISC (label), 1.0, 0.5);
|
||||
gtk_table_attach (GTK_TABLE (table), label, 0, 1, 1, 2,
|
||||
GTK_SHRINK | GTK_FILL, GTK_SHRINK, 0, 0);
|
||||
gtk_widget_show (label);
|
||||
|
||||
/* The offset sizeentry */
|
||||
adjustment = gtk_adjustment_new (1, 1, 1, 1, 10, 1);
|
||||
spinbutton = gtk_spin_button_new (GTK_ADJUSTMENT (adjustment), 1, 2);
|
||||
gtk_spin_button_set_numeric (GTK_SPIN_BUTTON (spinbutton), TRUE);
|
||||
gtk_widget_set_size_request (spinbutton, 75, -1);
|
||||
abox = gtk_alignment_new (0.0, 0.5, 0.0, 0.0);
|
||||
gtk_box_pack_start (GTK_BOX (vbox), abox, FALSE, FALSE, 0);
|
||||
gtk_widget_show (abox);
|
||||
|
||||
spinbutton = gimp_spin_button_new (&adjustment,
|
||||
1, 1, 1, 1, 10, 1,
|
||||
1, 2);
|
||||
gtk_entry_set_width_chars (GTK_ENTRY (spinbutton), 10);
|
||||
|
||||
off_d->off_se = gimp_size_entry_new (1, off_d->gimage->unit, "%a",
|
||||
TRUE, TRUE, FALSE, 75,
|
||||
TRUE, TRUE, FALSE, 10,
|
||||
GIMP_SIZE_ENTRY_UPDATE_SIZE);
|
||||
gtk_table_set_col_spacing (GTK_TABLE (off_d->off_se), 0, 4);
|
||||
gtk_table_set_col_spacing (GTK_TABLE (off_d->off_se), 1, 4);
|
||||
gtk_table_set_row_spacing (GTK_TABLE (off_d->off_se), 0, 2);
|
||||
|
||||
gimp_size_entry_add_field (GIMP_SIZE_ENTRY (off_d->off_se),
|
||||
GTK_SPIN_BUTTON (spinbutton), NULL);
|
||||
gtk_table_attach_defaults (GTK_TABLE (off_d->off_se), spinbutton,
|
||||
1, 2, 0, 1);
|
||||
gtk_widget_show (spinbutton);
|
||||
gtk_table_attach (GTK_TABLE (table), off_d->off_se, 1, 2, 0, 2,
|
||||
GTK_SHRINK | GTK_FILL, GTK_SHRINK | GTK_FILL, 0, 0);
|
||||
|
||||
gimp_size_entry_attach_label (GIMP_SIZE_ENTRY (off_d->off_se),
|
||||
_("Offset X:"), 0, 0, 1.0);
|
||||
gimp_size_entry_attach_label (GIMP_SIZE_ENTRY (off_d->off_se),
|
||||
_("Y:"), 1, 0, 1.0);
|
||||
|
||||
gtk_container_add (GTK_CONTAINER (abox), off_d->off_se);
|
||||
gtk_widget_show (off_d->off_se);
|
||||
|
||||
gimp_size_entry_set_unit (GIMP_SIZE_ENTRY (off_d->off_se), GIMP_UNIT_PIXEL);
|
||||
|
@ -177,19 +173,26 @@ offset_dialog_create (GimpDrawable *drawable)
|
|||
gimp_size_entry_set_refval (GIMP_SIZE_ENTRY (off_d->off_se), 0, 0);
|
||||
gimp_size_entry_set_refval (GIMP_SIZE_ENTRY (off_d->off_se), 1, 0);
|
||||
|
||||
gtk_widget_show (table);
|
||||
|
||||
/* The by half height and half width option */
|
||||
push = gtk_button_new_with_label (_("Offset by (x/2),(y/2)"));
|
||||
gtk_container_set_border_width (GTK_CONTAINER (push), 2);
|
||||
gtk_box_pack_start (GTK_BOX (vbox), push, FALSE, FALSE, 0);
|
||||
gtk_widget_show (push);
|
||||
button = gtk_button_new_with_mnemonic (_("Offset by (x/_2),(y/2)"));
|
||||
gtk_container_set_border_width (GTK_CONTAINER (button), 2);
|
||||
gtk_box_pack_start (GTK_BOX (vbox), button, FALSE, FALSE, 0);
|
||||
gtk_widget_show (button);
|
||||
|
||||
g_signal_connect (G_OBJECT (button), "clicked",
|
||||
G_CALLBACK (offset_halfheight_callback),
|
||||
off_d);
|
||||
|
||||
/* The wrap around option */
|
||||
check = gtk_check_button_new_with_label (_("Wrap"));
|
||||
check = gtk_check_button_new_with_mnemonic (_("_Wrap"));
|
||||
gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (check), off_d->wrap_around);
|
||||
gtk_box_pack_start (GTK_BOX (vbox), check, FALSE, FALSE, 0);
|
||||
gtk_widget_show (check);
|
||||
|
||||
g_signal_connect (G_OBJECT (check), "toggled",
|
||||
G_CALLBACK (gimp_toggle_button_update),
|
||||
&off_d->wrap_around);
|
||||
|
||||
/* The fill options */
|
||||
frame =
|
||||
gimp_radio_group_new2 (TRUE, _("Fill Type"),
|
||||
|
@ -197,10 +200,10 @@ offset_dialog_create (GimpDrawable *drawable)
|
|||
&off_d->fill_type,
|
||||
GINT_TO_POINTER (off_d->fill_type),
|
||||
|
||||
_("Background"),
|
||||
_("_Background"),
|
||||
GINT_TO_POINTER (GIMP_OFFSET_BACKGROUND), NULL,
|
||||
|
||||
_("Transparent"),
|
||||
_("_Transparent"),
|
||||
GINT_TO_POINTER (GIMP_OFFSET_TRANSPARENT),
|
||||
&radio_button,
|
||||
|
||||
|
@ -212,24 +215,15 @@ offset_dialog_create (GimpDrawable *drawable)
|
|||
gtk_box_pack_start (GTK_BOX (vbox), frame, FALSE, FALSE, 0);
|
||||
gtk_widget_show (frame);
|
||||
|
||||
/* Hook up the wrap around */
|
||||
g_signal_connect (G_OBJECT (check), "toggled",
|
||||
G_CALLBACK (gimp_toggle_button_update),
|
||||
&off_d->wrap_around);
|
||||
g_object_set_data (G_OBJECT (check), "inverse_sensitive", frame);
|
||||
gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (check), off_d->wrap_around);
|
||||
|
||||
/* Hook up the by half */
|
||||
g_signal_connect (G_OBJECT (push), "clicked",
|
||||
G_CALLBACK (offset_halfheight_callback),
|
||||
off_d);
|
||||
gtk_widget_set_sensitive (frame, ! off_d->wrap_around);
|
||||
|
||||
gtk_widget_show (vbox);
|
||||
gtk_widget_show (off_d->dlg);
|
||||
}
|
||||
|
||||
|
||||
/* private function */
|
||||
/* private functions */
|
||||
|
||||
static void
|
||||
offset_ok_callback (GtkWidget *widget,
|
||||
|
@ -262,17 +256,6 @@ offset_ok_callback (GtkWidget *widget,
|
|||
g_free (off_d);
|
||||
}
|
||||
|
||||
static void
|
||||
offset_cancel_callback (GtkWidget *widget,
|
||||
gpointer data)
|
||||
{
|
||||
OffsetDialog *off_d;
|
||||
|
||||
off_d = (OffsetDialog *) data;
|
||||
gtk_widget_destroy (off_d->dlg);
|
||||
g_free (off_d);
|
||||
}
|
||||
|
||||
static void
|
||||
offset_halfheight_callback (GtkWidget *widget,
|
||||
gpointer data)
|
||||
|
|
|
@ -61,6 +61,8 @@
|
|||
#include "libgimp/gimpintl.h"
|
||||
|
||||
|
||||
#define SB_WIDTH 10
|
||||
|
||||
/* gimprc will be parsed with a buffer size of 1024,
|
||||
* so don't set this too large
|
||||
*/
|
||||
|
@ -1866,7 +1868,7 @@ preferences_dialog_create (Gimp *gimp)
|
|||
|
||||
sizeentry =
|
||||
gimp_size_entry_new (2, gimp->config->default_units, "%p",
|
||||
FALSE, FALSE, TRUE, 75,
|
||||
FALSE, FALSE, TRUE, SB_WIDTH,
|
||||
GIMP_SIZE_ENTRY_UPDATE_SIZE);
|
||||
|
||||
gimp_size_entry_attach_label (GIMP_SIZE_ENTRY (sizeentry),
|
||||
|
@ -1917,7 +1919,7 @@ preferences_dialog_create (Gimp *gimp)
|
|||
|
||||
sizeentry2 = gimp_size_entry_new (2, gimp->config->default_resolution_units,
|
||||
pixels_per_unit,
|
||||
FALSE, FALSE, TRUE, 75,
|
||||
FALSE, FALSE, TRUE, SB_WIDTH,
|
||||
GIMP_SIZE_ENTRY_UPDATE_RESOLUTION);
|
||||
|
||||
button = gimp_chain_button_new (GIMP_CHAIN_BOTTOM);
|
||||
|
@ -2499,7 +2501,7 @@ preferences_dialog_create (Gimp *gimp)
|
|||
|
||||
sizeentry =
|
||||
gimp_size_entry_new (2, GIMP_UNIT_INCH, pixels_per_unit,
|
||||
FALSE, FALSE, TRUE, 75,
|
||||
FALSE, FALSE, TRUE, SB_WIDTH,
|
||||
GIMP_SIZE_ENTRY_UPDATE_RESOLUTION);
|
||||
|
||||
g_free (pixels_per_unit);
|
||||
|
|
|
@ -39,6 +39,9 @@
|
|||
#include "libgimp/gimpintl.h"
|
||||
|
||||
|
||||
#define SB_WIDTH 10
|
||||
|
||||
|
||||
typedef struct _ResizePrivate ResizePrivate;
|
||||
|
||||
struct _ResizePrivate
|
||||
|
@ -120,7 +123,6 @@ resize_widget_new (GimpImage *gimage,
|
|||
GimpUnit unit,
|
||||
gboolean dot_for_dot,
|
||||
GCallback ok_cb,
|
||||
GCallback cancel_cb,
|
||||
gpointer user_data)
|
||||
{
|
||||
Resize *resize;
|
||||
|
@ -218,7 +220,7 @@ resize_widget_new (GimpImage *gimage,
|
|||
}
|
||||
frame = gtk_frame_new (_("Size"));
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
resize->resize_shell =
|
||||
gimp_viewable_dialog_new (GIMP_IS_VIEWABLE (object) ?
|
||||
|
@ -228,10 +230,8 @@ resize_widget_new (GimpImage *gimage,
|
|||
gimp_standard_help_func, help_page,
|
||||
|
||||
GTK_STOCK_CANCEL,
|
||||
cancel_cb ? cancel_cb : G_CALLBACK (gtk_widget_destroy),
|
||||
cancel_cb ? user_data : NULL,
|
||||
cancel_cb ? NULL : (gpointer) 1,
|
||||
NULL, FALSE, TRUE,
|
||||
G_CALLBACK (gtk_widget_destroy),
|
||||
NULL, (gpointer) 1, NULL, FALSE, TRUE,
|
||||
|
||||
GIMP_STOCK_RESET, reset_callback,
|
||||
resize, NULL, NULL, FALSE, FALSE,
|
||||
|
@ -248,17 +248,10 @@ resize_widget_new (GimpImage *gimage,
|
|||
|
||||
/* handle the image disappearing under our feet */
|
||||
if (object && signal)
|
||||
{
|
||||
if (cancel_cb)
|
||||
g_signal_connect (G_OBJECT (object), signal,
|
||||
cancel_cb,
|
||||
user_data);
|
||||
else
|
||||
g_signal_connect_object (G_OBJECT (object), signal,
|
||||
G_CALLBACK (gtk_widget_destroy),
|
||||
G_OBJECT (resize->resize_shell),
|
||||
G_CONNECT_SWAPPED);
|
||||
}
|
||||
g_signal_connect_object (G_OBJECT (object), signal,
|
||||
G_CALLBACK (gtk_widget_destroy),
|
||||
G_OBJECT (resize->resize_shell),
|
||||
G_CONNECT_SWAPPED);
|
||||
|
||||
/* the main vbox */
|
||||
main_vbox = gtk_vbox_new (FALSE, 4);
|
||||
|
@ -276,11 +269,12 @@ resize_widget_new (GimpImage *gimage,
|
|||
|
||||
table = gtk_table_new (6, 2, FALSE);
|
||||
gtk_container_set_border_width (GTK_CONTAINER (table), 2);
|
||||
gtk_table_set_col_spacings (GTK_TABLE (table), 2);
|
||||
gtk_table_set_col_spacing (GTK_TABLE (table), 0, 4);
|
||||
gtk_table_set_row_spacings (GTK_TABLE (table), 2);
|
||||
gtk_table_set_row_spacing (GTK_TABLE (table), 0, 4);
|
||||
gtk_table_set_row_spacing (GTK_TABLE (table), 1, 4);
|
||||
gtk_table_set_row_spacing (GTK_TABLE (table), 3, 4);
|
||||
gtk_table_set_row_spacing (GTK_TABLE (table), 4, 2);
|
||||
gtk_box_pack_start (GTK_BOX (vbox), table, FALSE, FALSE, 0);
|
||||
|
||||
/* the original width & height labels */
|
||||
|
@ -297,10 +291,10 @@ resize_widget_new (GimpImage *gimage,
|
|||
gtk_widget_show (label);
|
||||
|
||||
private->orig_width_label = gtk_label_new ("");
|
||||
gtk_misc_set_alignment (GTK_MISC ( private->orig_width_label), 0.0, 0.5);
|
||||
gtk_misc_set_alignment (GTK_MISC (private->orig_width_label), 0.0, 0.5);
|
||||
gtk_table_attach (GTK_TABLE (table), private->orig_width_label, 1, 2, 0, 1,
|
||||
GTK_SHRINK | GTK_FILL, GTK_SHRINK | GTK_FILL, 0, 0);
|
||||
gtk_widget_show ( private->orig_width_label);
|
||||
gtk_widget_show (private->orig_width_label);
|
||||
|
||||
private->orig_height_label = gtk_label_new ("");
|
||||
gtk_misc_set_alignment (GTK_MISC (private->orig_height_label), 0.0, 0.5);
|
||||
|
@ -322,19 +316,23 @@ resize_widget_new (GimpImage *gimage,
|
|||
gtk_widget_show (label);
|
||||
|
||||
/* the new size sizeentry */
|
||||
adjustment = gtk_adjustment_new (1, 1, 1, 1, 10, 1);
|
||||
spinbutton = gtk_spin_button_new (GTK_ADJUSTMENT (adjustment), 1, 2);
|
||||
gtk_spin_button_set_numeric (GTK_SPIN_BUTTON (spinbutton), TRUE);
|
||||
gtk_widget_set_size_request (spinbutton, 75, -1);
|
||||
spinbutton = gimp_spin_button_new (&adjustment,
|
||||
1, 1, 1, 1, 10, 1,
|
||||
1, 2);
|
||||
gtk_entry_set_width_chars (GTK_ENTRY (spinbutton), SB_WIDTH);
|
||||
|
||||
private->size_se = gimp_size_entry_new (1, unit, "%a",
|
||||
TRUE, TRUE, FALSE, SB_WIDTH,
|
||||
GIMP_SIZE_ENTRY_UPDATE_SIZE);
|
||||
gtk_table_set_col_spacing (GTK_TABLE (private->size_se), 1, 4);
|
||||
gtk_table_set_row_spacing (GTK_TABLE (private->size_se), 0, 2);
|
||||
|
||||
private->size_se =
|
||||
gimp_size_entry_new (1, unit, "%a", TRUE, TRUE, FALSE, 75,
|
||||
GIMP_SIZE_ENTRY_UPDATE_SIZE);
|
||||
gimp_size_entry_add_field (GIMP_SIZE_ENTRY (private->size_se),
|
||||
GTK_SPIN_BUTTON (spinbutton), NULL);
|
||||
gtk_table_attach_defaults (GTK_TABLE (private->size_se), spinbutton,
|
||||
1, 2, 0, 1);
|
||||
gtk_widget_show (spinbutton);
|
||||
|
||||
gtk_table_attach (GTK_TABLE (table), private->size_se, 1, 2, 2, 4,
|
||||
GTK_SHRINK | GTK_FILL, GTK_SHRINK | GTK_FILL, 0, 0);
|
||||
gtk_widget_show (private->size_se);
|
||||
|
@ -395,15 +393,14 @@ resize_widget_new (GimpImage *gimage,
|
|||
gtk_widget_show (abox);
|
||||
|
||||
/* the scale ratio spinbuttons */
|
||||
private->ratio_x_adj =
|
||||
gtk_adjustment_new (resize->ratio_x,
|
||||
(double) GIMP_MIN_IMAGE_SIZE / (double) resize->width,
|
||||
(double) GIMP_MAX_IMAGE_SIZE / (double) resize->width,
|
||||
0.01, 0.1, 1);
|
||||
spinbutton = gtk_spin_button_new (GTK_ADJUSTMENT (private->ratio_x_adj),
|
||||
0.01, 4);
|
||||
gtk_spin_button_set_numeric (GTK_SPIN_BUTTON (spinbutton), TRUE);
|
||||
gtk_widget_set_size_request (spinbutton, 75, -1);
|
||||
spinbutton =
|
||||
gimp_spin_button_new (&private->ratio_x_adj,
|
||||
resize->ratio_x,
|
||||
(double) GIMP_MIN_IMAGE_SIZE / (double) resize->width,
|
||||
(double) GIMP_MAX_IMAGE_SIZE / (double) resize->width,
|
||||
0.01, 0.1, 1,
|
||||
0.01, 4);
|
||||
gtk_entry_set_width_chars (GTK_ENTRY (spinbutton), SB_WIDTH);
|
||||
gtk_table_attach_defaults (GTK_TABLE (table2), spinbutton, 0, 1, 0, 1);
|
||||
gtk_widget_show (spinbutton);
|
||||
|
||||
|
@ -411,19 +408,18 @@ resize_widget_new (GimpImage *gimage,
|
|||
G_CALLBACK (ratio_callback),
|
||||
resize);
|
||||
|
||||
private->ratio_y_adj =
|
||||
gtk_adjustment_new (resize->ratio_y,
|
||||
(double) GIMP_MIN_IMAGE_SIZE / (double) resize->height,
|
||||
(double) GIMP_MAX_IMAGE_SIZE / (double) resize->height,
|
||||
0.01, 0.1, 1);
|
||||
spinbutton = gtk_spin_button_new (GTK_ADJUSTMENT (private->ratio_y_adj),
|
||||
0.01, 4);
|
||||
gtk_spin_button_set_numeric (GTK_SPIN_BUTTON (spinbutton), TRUE);
|
||||
gtk_widget_set_size_request (spinbutton, 75, -1);
|
||||
spinbutton =
|
||||
gimp_spin_button_new (&private->ratio_y_adj,
|
||||
resize->ratio_y,
|
||||
(double) GIMP_MIN_IMAGE_SIZE / (double) resize->height,
|
||||
(double) GIMP_MAX_IMAGE_SIZE / (double) resize->height,
|
||||
0.01, 0.1, 1,
|
||||
0.01, 4);
|
||||
gtk_entry_set_width_chars (GTK_ENTRY (spinbutton), SB_WIDTH);
|
||||
gtk_table_attach_defaults (GTK_TABLE (table2), spinbutton, 0, 1, 1, 2);
|
||||
gtk_widget_show (spinbutton);
|
||||
|
||||
g_signal_connect (G_OBJECT ( private->ratio_y_adj), "value_changed",
|
||||
g_signal_connect (G_OBJECT (private->ratio_y_adj), "value_changed",
|
||||
G_CALLBACK (ratio_callback),
|
||||
resize);
|
||||
|
||||
|
@ -457,24 +453,29 @@ resize_widget_new (GimpImage *gimage,
|
|||
gtk_box_pack_start (GTK_BOX (vbox), abox, FALSE, FALSE, 0);
|
||||
|
||||
/* the offset sizeentry */
|
||||
adjustment = gtk_adjustment_new (1, 1, 1, 1, 10, 1);
|
||||
spinbutton = gtk_spin_button_new (GTK_ADJUSTMENT (adjustment), 1, 2);
|
||||
gtk_spin_button_set_numeric (GTK_SPIN_BUTTON (spinbutton), TRUE);
|
||||
gtk_widget_set_size_request (spinbutton, 75, -1);
|
||||
spinbutton = gimp_spin_button_new (&adjustment,
|
||||
1, 1, 1, 1, 10, 1,
|
||||
1, 2);
|
||||
gtk_entry_set_width_chars (GTK_ENTRY (spinbutton), SB_WIDTH);
|
||||
|
||||
private->offset_se = gimp_size_entry_new (1, unit, "%a",
|
||||
TRUE, FALSE, FALSE, SB_WIDTH,
|
||||
GIMP_SIZE_ENTRY_UPDATE_SIZE);
|
||||
gtk_table_set_col_spacing (GTK_TABLE (private->offset_se), 0, 4);
|
||||
gtk_table_set_col_spacing (GTK_TABLE (private->offset_se), 1, 4);
|
||||
gtk_table_set_col_spacing (GTK_TABLE (private->offset_se), 3, 8);
|
||||
gtk_table_set_row_spacing (GTK_TABLE (private->offset_se), 0, 2);
|
||||
|
||||
private->offset_se =
|
||||
gimp_size_entry_new (1, unit, "%a", TRUE, FALSE, FALSE, 75,
|
||||
GIMP_SIZE_ENTRY_UPDATE_SIZE);
|
||||
gimp_size_entry_add_field (GIMP_SIZE_ENTRY (private->offset_se),
|
||||
GTK_SPIN_BUTTON (spinbutton), NULL);
|
||||
gtk_table_attach_defaults (GTK_TABLE (private->offset_se), spinbutton,
|
||||
1, 2, 0, 1);
|
||||
gtk_table_set_col_spacing (GTK_TABLE (private->offset_se), 0, 4);
|
||||
gtk_widget_show (spinbutton);
|
||||
|
||||
gimp_size_entry_attach_label (GIMP_SIZE_ENTRY (private->offset_se),
|
||||
_("X:"), 0, 0, 1.0);
|
||||
gimp_size_entry_attach_label (GIMP_SIZE_ENTRY (private->offset_se),
|
||||
_("Y:"), 1, 0, 1.0);
|
||||
gtk_widget_show (spinbutton);
|
||||
gtk_container_add (GTK_CONTAINER (abox), private->offset_se);
|
||||
gtk_widget_show (private->offset_se);
|
||||
|
||||
|
@ -503,7 +504,6 @@ resize_widget_new (GimpImage *gimage,
|
|||
gtk_misc_set_padding (GTK_MISC (GTK_BIN (button)->child), 4, 0);
|
||||
gtk_table_attach_defaults (GTK_TABLE (private->offset_se), button,
|
||||
4, 5, 1, 2);
|
||||
gtk_table_set_col_spacing (GTK_TABLE (private->offset_se), 3, 8);
|
||||
gtk_widget_show (button);
|
||||
|
||||
g_signal_connect (G_OBJECT (button), "clicked",
|
||||
|
@ -547,6 +547,7 @@ resize_widget_new (GimpImage *gimage,
|
|||
|
||||
table = gtk_table_new (4, 2, FALSE);
|
||||
gtk_table_set_col_spacing (GTK_TABLE (table), 0, 4);
|
||||
gtk_table_set_row_spacings (GTK_TABLE (table), 2);
|
||||
gtk_table_set_row_spacing (GTK_TABLE (table), 1, 4);
|
||||
gtk_box_pack_start (GTK_BOX (vbox), table, FALSE, FALSE, 0);
|
||||
|
||||
|
@ -565,28 +566,33 @@ resize_widget_new (GimpImage *gimage,
|
|||
|
||||
/* the print size sizeentry */
|
||||
abox = gtk_alignment_new (0.0, 0.5, 0.0, 1.0);
|
||||
adjustment = gtk_adjustment_new (1, 1, 1, 1, 10, 1);
|
||||
spinbutton = gtk_spin_button_new (GTK_ADJUSTMENT (adjustment), 1, 2);
|
||||
gtk_spin_button_set_numeric (GTK_SPIN_BUTTON (spinbutton), TRUE);
|
||||
gtk_widget_set_size_request (spinbutton, 75, -1);
|
||||
gtk_container_add (GTK_CONTAINER (abox), spinbutton);
|
||||
gtk_widget_show (spinbutton);
|
||||
gtk_table_attach (GTK_TABLE (table), abox, 1, 2, 0, 1,
|
||||
GTK_SHRINK | GTK_FILL, GTK_SHRINK | GTK_FILL, 0, 0);
|
||||
gtk_widget_show (abox);
|
||||
|
||||
spinbutton = gimp_spin_button_new (&adjustment,
|
||||
1, 1, 1, 1, 10, 1,
|
||||
1, 2);
|
||||
gtk_entry_set_width_chars (GTK_ENTRY (spinbutton), SB_WIDTH);
|
||||
gtk_container_add (GTK_CONTAINER (abox), spinbutton);
|
||||
gtk_widget_show (spinbutton);
|
||||
|
||||
abox = gtk_alignment_new (0.0, 0.5, 0.0, 1.0);
|
||||
private->printsize_se =
|
||||
gimp_size_entry_new (1, unit, "%a", FALSE, FALSE, FALSE, 75,
|
||||
GIMP_SIZE_ENTRY_UPDATE_SIZE);
|
||||
gimp_size_entry_add_field (GIMP_SIZE_ENTRY (private->printsize_se),
|
||||
GTK_SPIN_BUTTON (spinbutton), NULL);
|
||||
gtk_container_add (GTK_CONTAINER (abox), private->printsize_se);
|
||||
gtk_table_attach (GTK_TABLE (table), abox, 1, 2, 1, 2,
|
||||
GTK_SHRINK | GTK_FILL, GTK_SHRINK | GTK_FILL, 0, 0);
|
||||
gtk_widget_show (private->printsize_se);
|
||||
gtk_widget_show (abox);
|
||||
|
||||
private->printsize_se = gimp_size_entry_new (1, unit, "%a",
|
||||
FALSE, FALSE, FALSE, SB_WIDTH,
|
||||
GIMP_SIZE_ENTRY_UPDATE_SIZE);
|
||||
gtk_table_set_col_spacing (GTK_TABLE (private->printsize_se), 1, 4);
|
||||
|
||||
gimp_size_entry_add_field (GIMP_SIZE_ENTRY (private->printsize_se),
|
||||
GTK_SPIN_BUTTON (spinbutton), NULL);
|
||||
|
||||
gtk_container_add (GTK_CONTAINER (abox), private->printsize_se);
|
||||
gtk_widget_show (private->printsize_se);
|
||||
|
||||
gimp_size_entry_set_resolution (GIMP_SIZE_ENTRY (private->printsize_se),
|
||||
0, resolution_x, FALSE);
|
||||
gimp_size_entry_set_resolution (GIMP_SIZE_ENTRY (private->printsize_se),
|
||||
|
@ -610,7 +616,7 @@ resize_widget_new (GimpImage *gimage,
|
|||
g_signal_connect (G_OBJECT (private->printsize_se), "unit_changed",
|
||||
G_CALLBACK (unit_update),
|
||||
resize);
|
||||
|
||||
|
||||
/* the resolution labels */
|
||||
label = gtk_label_new (_("Resolution X:"));
|
||||
gtk_misc_set_alignment (GTK_MISC (label), 1.0, 0.5);
|
||||
|
@ -625,23 +631,26 @@ resize_widget_new (GimpImage *gimage,
|
|||
gtk_widget_show (label);
|
||||
|
||||
/* the resolution sizeentry */
|
||||
adjustment = gtk_adjustment_new (1, 1, 1, 1, 10, 1);
|
||||
spinbutton = gtk_spin_button_new (GTK_ADJUSTMENT (adjustment), 1, 2);
|
||||
gtk_spin_button_set_numeric (GTK_SPIN_BUTTON (spinbutton), TRUE);
|
||||
gtk_widget_set_size_request (spinbutton, 75, -1);
|
||||
spinbutton = gimp_spin_button_new (&adjustment,
|
||||
1, 1, 1, 1, 10, 1,
|
||||
1, 2);
|
||||
gtk_entry_set_width_chars (GTK_ENTRY (spinbutton), SB_WIDTH);
|
||||
|
||||
private->resolution_se =
|
||||
gimp_size_entry_new (1, gimage->gimp->config->default_resolution_units,
|
||||
_("pixels/%a"),
|
||||
FALSE, FALSE, FALSE, 75,
|
||||
FALSE, FALSE, FALSE, SB_WIDTH,
|
||||
GIMP_SIZE_ENTRY_UPDATE_RESOLUTION);
|
||||
gtk_table_set_col_spacing (GTK_TABLE (private->resolution_se), 1, 2);
|
||||
gtk_table_set_col_spacing (GTK_TABLE (private->resolution_se), 2, 2);
|
||||
gtk_table_set_row_spacing (GTK_TABLE (private->resolution_se), 0, 2);
|
||||
|
||||
gimp_size_entry_add_field (GIMP_SIZE_ENTRY (private->resolution_se),
|
||||
GTK_SPIN_BUTTON (spinbutton), NULL);
|
||||
gtk_table_attach_defaults (GTK_TABLE (private->resolution_se), spinbutton,
|
||||
1, 2, 0, 1);
|
||||
gtk_widget_show (spinbutton);
|
||||
|
||||
gtk_table_attach (GTK_TABLE (table), private->resolution_se, 1, 2, 2, 4,
|
||||
GTK_SHRINK | GTK_FILL, GTK_SHRINK | GTK_FILL, 0, 0);
|
||||
gtk_widget_show (private->resolution_se);
|
||||
|
|
|
@ -81,7 +81,6 @@ Resize * resize_widget_new (GimpImage *gimage,
|
|||
GimpUnit unit,
|
||||
gboolean dot_for_dot,
|
||||
GCallback ok_cb,
|
||||
GCallback cancel_cb,
|
||||
gpointer user_data);
|
||||
|
||||
|
||||
|
|
|
@ -251,7 +251,7 @@ resolution_calibrate_dialog (GtkWidget *resolution_entry,
|
|||
|
||||
calibrate_entry =
|
||||
gimp_coordinates_new (GIMP_UNIT_INCH, "%p",
|
||||
FALSE, FALSE, 75,
|
||||
FALSE, FALSE, 10,
|
||||
GIMP_SIZE_ENTRY_UPDATE_SIZE,
|
||||
FALSE,
|
||||
FALSE,
|
||||
|
|
|
@ -1237,7 +1237,7 @@ user_install_resolution (void)
|
|||
pixels_per_unit = g_strconcat (_("Pixels"), "/%s", NULL);
|
||||
resolution_entry =
|
||||
gimp_coordinates_new (GIMP_UNIT_INCH, pixels_per_unit,
|
||||
FALSE, FALSE, 75,
|
||||
FALSE, FALSE, 10,
|
||||
GIMP_SIZE_ENTRY_UPDATE_RESOLUTION,
|
||||
abs (gimprc.monitor_xres - gimprc.monitor_yres) < GIMP_MIN_RESOLUTION,
|
||||
FALSE,
|
||||
|
|
Loading…
Reference in New Issue