started to redo this dialog without using a GimpSizeBox. The widgets
2004-11-15 Sven Neumann <sven@gimp.org> * app/dialogs/print-size-dialog.c: started to redo this dialog without using a GimpSizeBox. The widgets aren't connected, so it isn't usable yet. * app/widgets/gimpprogressbox.c * app/widgets/gimpprogressdialog.c * app/widgets/gimpsizebox.c: trivial cleanups. * data/images/gimp-splash.png: splash for 2.2-pre2, done by Jimmac.
This commit is contained in:
committed by
Sven Neumann
parent
376b23f9d3
commit
869a1b680d
12
ChangeLog
12
ChangeLog
@ -1,3 +1,15 @@
|
||||
2004-11-15 Sven Neumann <sven@gimp.org>
|
||||
|
||||
* app/dialogs/print-size-dialog.c: started to redo this dialog
|
||||
without using a GimpSizeBox. The widgets aren't connected, so it
|
||||
isn't usable yet.
|
||||
|
||||
* app/widgets/gimpprogressbox.c
|
||||
* app/widgets/gimpprogressdialog.c
|
||||
* app/widgets/gimpsizebox.c: trivial cleanups.
|
||||
|
||||
* data/images/gimp-splash.png: splash for 2.2-pre2, done by Jimmac.
|
||||
|
||||
2004-11-14 Sven Neumann <sven@gimp.org>
|
||||
|
||||
* app/actions/image-commands.c: converted error messages that should
|
||||
|
||||
5
NEWS
5
NEWS
@ -28,6 +28,8 @@ Overview of Changes in GIMP 2.2-pre2
|
||||
- Allow file plug-ins to provide a way to access an image thumbnail if
|
||||
the file format provides one or can be rendered at small sizes.
|
||||
|
||||
- Allow to import Photoshop (.act) palette files.
|
||||
|
||||
- Lots of bug fixes and some optimizations.
|
||||
|
||||
|
||||
@ -35,7 +37,8 @@ Contributors:
|
||||
|
||||
Michael Natterer, Sven Neumann, David Odin, Manish Singh, Kevin Cozens,
|
||||
Joao S. O. Bueno, Geert Jordaens, David Gowers, Øyvind Kolås, Cai Qian,
|
||||
Simon Budig, Jakub Steiner, Philip Lafleur, Karine Proot
|
||||
Simon Budig, Jakub Steiner, Philip Lafleur, Nickolay V. Shmyrev,
|
||||
Karine Proot
|
||||
|
||||
|
||||
|
||||
|
||||
@ -20,15 +20,14 @@
|
||||
|
||||
#include <gtk/gtk.h>
|
||||
|
||||
#include "libgimpbase/gimpbase.h"
|
||||
#include "libgimpwidgets/gimpwidgets.h"
|
||||
|
||||
#include "dialogs-types.h"
|
||||
|
||||
#include "core/gimpimage.h"
|
||||
#include "core/gimpitem.h"
|
||||
|
||||
#include "widgets/gimphelp-ids.h"
|
||||
#include "widgets/gimpsizebox.h"
|
||||
#include "widgets/gimpviewabledialog.h"
|
||||
|
||||
#include "print-size-dialog.h"
|
||||
@ -37,6 +36,7 @@
|
||||
|
||||
|
||||
#define RESPONSE_RESET 1
|
||||
#define SB_WIDTH 8
|
||||
|
||||
|
||||
typedef struct _PrintSizeDialog PrintSizeDialog;
|
||||
@ -44,7 +44,8 @@ typedef struct _PrintSizeDialog PrintSizeDialog;
|
||||
struct _PrintSizeDialog
|
||||
{
|
||||
GimpImage *image;
|
||||
GtkWidget *box;
|
||||
GtkWidget *size_entry;
|
||||
GtkWidget *resolution_entry;
|
||||
GimpResolutionCallback callback;
|
||||
gpointer user_data;
|
||||
};
|
||||
@ -67,18 +68,21 @@ print_size_dialog_new (GimpImage *image,
|
||||
gpointer user_data)
|
||||
{
|
||||
GtkWidget *dialog;
|
||||
GtkWidget *vbox;
|
||||
GtkWidget *frame;
|
||||
GtkWidget *table;
|
||||
GtkWidget *entry;
|
||||
GtkWidget *label;
|
||||
GtkWidget *width;
|
||||
GtkWidget *height;
|
||||
GtkWidget *hbox;
|
||||
GtkWidget *chain;
|
||||
GtkObject *adj;
|
||||
PrintSizeDialog *private;
|
||||
gint width, height;
|
||||
gdouble xres, yres;
|
||||
|
||||
g_return_val_if_fail (GIMP_IS_IMAGE (image), NULL);
|
||||
g_return_val_if_fail (callback != NULL, NULL);
|
||||
|
||||
width = gimp_image_get_width (image);
|
||||
height = gimp_image_get_height (image);
|
||||
|
||||
dialog = gimp_viewable_dialog_new (GIMP_VIEWABLE (image),
|
||||
title, role,
|
||||
GIMP_STOCK_PRINT_RESOLUTION, title,
|
||||
@ -99,38 +103,143 @@ print_size_dialog_new (GimpImage *image,
|
||||
G_CALLBACK (g_free),
|
||||
private);
|
||||
|
||||
g_signal_connect (dialog, "response",
|
||||
G_CALLBACK (print_size_dialog_response),
|
||||
private);
|
||||
|
||||
private->image = image;
|
||||
private->callback = callback;
|
||||
private->user_data = user_data;
|
||||
|
||||
gimp_image_get_resolution (image, &xres, &yres);
|
||||
|
||||
private->box = g_object_new (GIMP_TYPE_SIZE_BOX,
|
||||
"width", width,
|
||||
"height", height,
|
||||
"unit", gimp_image_get_unit (image),
|
||||
"xresolution", xres,
|
||||
"yresolution", yres,
|
||||
"resolution-unit", gimp_image_get_unit (image),
|
||||
"keep-aspect", TRUE,
|
||||
"edit-resolution", TRUE,
|
||||
NULL);
|
||||
|
||||
g_signal_connect (dialog, "response",
|
||||
G_CALLBACK (print_size_dialog_response),
|
||||
private);
|
||||
|
||||
vbox = gtk_vbox_new (FALSE, 12);
|
||||
gtk_container_set_border_width (GTK_CONTAINER (vbox), 12);
|
||||
gtk_container_add (GTK_CONTAINER (GTK_DIALOG (dialog)->vbox), vbox);
|
||||
gtk_widget_show (vbox);
|
||||
|
||||
frame = gimp_frame_new (_("Print Size"));
|
||||
gtk_box_pack_start (GTK_BOX (vbox), frame, FALSE, FALSE, 0);
|
||||
gtk_container_set_border_width (GTK_CONTAINER (frame), 12);
|
||||
gtk_box_pack_start (GTK_BOX (GTK_DIALOG (dialog)->vbox),
|
||||
frame, FALSE, FALSE, 0);
|
||||
gtk_widget_show (frame);
|
||||
|
||||
gtk_container_add (GTK_CONTAINER (frame), private->box);
|
||||
gtk_widget_show (private->box);
|
||||
table = gtk_table_new (4, 3, FALSE);
|
||||
gtk_table_set_col_spacing (GTK_TABLE (table), 0, 6);
|
||||
gtk_table_set_row_spacings (GTK_TABLE (table), 12);
|
||||
gtk_table_set_row_spacing (GTK_TABLE (table), 0, 2);
|
||||
gtk_table_set_row_spacing (GTK_TABLE (table), 2, 2);
|
||||
gtk_container_add (GTK_CONTAINER (frame), table);
|
||||
gtk_widget_show (table);
|
||||
|
||||
/* the print size entry */
|
||||
|
||||
width = gimp_spin_button_new (&adj, 1, 1, 1, 1, 10, 0, 1, 2);
|
||||
gtk_entry_set_width_chars (GTK_ENTRY (width), SB_WIDTH);
|
||||
|
||||
height = gimp_spin_button_new (&adj, 1, 1, 1, 1, 10, 0, 1, 2);
|
||||
gtk_entry_set_width_chars (GTK_ENTRY (height), SB_WIDTH);
|
||||
|
||||
entry = gimp_size_entry_new (0, gimp_image_get_unit (image), "%p",
|
||||
FALSE, FALSE, FALSE, SB_WIDTH,
|
||||
GIMP_SIZE_ENTRY_UPDATE_SIZE);
|
||||
|
||||
label = gtk_label_new_with_mnemonic (_("_Width:"));
|
||||
gtk_misc_set_alignment (GTK_MISC (label), 0.0, 0.5);
|
||||
gtk_label_set_mnemonic_widget (GTK_LABEL (label), width);
|
||||
gtk_table_attach (GTK_TABLE (table), label, 0, 1, 0, 1,
|
||||
GTK_SHRINK | GTK_FILL, GTK_SHRINK | GTK_FILL, 0, 0);
|
||||
gtk_widget_show (label);
|
||||
|
||||
label = gtk_label_new_with_mnemonic (_("H_eight:"));
|
||||
gtk_misc_set_alignment (GTK_MISC (label), 0.0, 0.5);
|
||||
gtk_label_set_mnemonic_widget (GTK_LABEL (label), height);
|
||||
gtk_table_attach (GTK_TABLE (table), label, 0, 1, 1, 2,
|
||||
GTK_SHRINK | GTK_FILL, GTK_SHRINK | GTK_FILL, 0, 0);
|
||||
gtk_widget_show (label);
|
||||
|
||||
hbox = gtk_hbox_new (FALSE, 0);
|
||||
gtk_table_attach_defaults (GTK_TABLE (table), hbox, 1, 2, 0, 2);
|
||||
gtk_widget_show (hbox);
|
||||
|
||||
gtk_table_set_row_spacing (GTK_TABLE (entry), 0, 2);
|
||||
gtk_table_set_col_spacing (GTK_TABLE (entry), 1, 6);
|
||||
|
||||
gtk_box_pack_start (GTK_BOX (hbox), entry, FALSE, FALSE, 0);
|
||||
gtk_widget_show (entry);
|
||||
|
||||
gimp_size_entry_add_field (GIMP_SIZE_ENTRY (entry),
|
||||
GTK_SPIN_BUTTON (height), NULL);
|
||||
gtk_table_attach_defaults (GTK_TABLE (entry), height, 0, 1, 1, 2);
|
||||
gtk_widget_show (height);
|
||||
|
||||
gimp_size_entry_add_field (GIMP_SIZE_ENTRY (entry),
|
||||
GTK_SPIN_BUTTON (width), NULL);
|
||||
gtk_table_attach_defaults (GTK_TABLE (entry), width, 0, 1, 0, 1);
|
||||
gtk_widget_show (width);
|
||||
|
||||
gimp_size_entry_set_resolution (GIMP_SIZE_ENTRY (entry), 0, xres, FALSE);
|
||||
gimp_size_entry_set_resolution (GIMP_SIZE_ENTRY (entry), 1, yres, FALSE);
|
||||
|
||||
gimp_size_entry_set_refval (GIMP_SIZE_ENTRY (entry), 0, image->width);
|
||||
gimp_size_entry_set_refval (GIMP_SIZE_ENTRY (entry), 1, image->height);
|
||||
|
||||
/* the resolution entry */
|
||||
|
||||
width = gimp_spin_button_new (&adj, 1, 1, 1, 1, 10, 0, 1, 2);
|
||||
gtk_entry_set_width_chars (GTK_ENTRY (width), SB_WIDTH);
|
||||
|
||||
height = gimp_spin_button_new (&adj, 1, 1, 1, 1, 10, 0, 1, 2);
|
||||
gtk_entry_set_width_chars (GTK_ENTRY (height), SB_WIDTH);
|
||||
|
||||
label = gtk_label_new_with_mnemonic (_("_X resolution:"));
|
||||
gtk_misc_set_alignment (GTK_MISC (label), 0.0, 0.5);
|
||||
gtk_label_set_mnemonic_widget (GTK_LABEL (label), width);
|
||||
gtk_table_attach (GTK_TABLE (table), label, 0, 1, 2, 3,
|
||||
GTK_SHRINK | GTK_FILL, GTK_SHRINK | GTK_FILL, 0, 0);
|
||||
gtk_widget_show (label);
|
||||
|
||||
label = gtk_label_new_with_mnemonic (_("_Y resolution:"));
|
||||
gtk_misc_set_alignment (GTK_MISC (label), 0.0, 0.5);
|
||||
gtk_label_set_mnemonic_widget (GTK_LABEL (label), height);
|
||||
gtk_table_attach (GTK_TABLE (table), label, 0, 1, 3, 4,
|
||||
GTK_SHRINK | GTK_FILL, GTK_SHRINK | GTK_FILL, 0, 0);
|
||||
gtk_widget_show (label);
|
||||
|
||||
hbox = gtk_hbox_new (FALSE, 0);
|
||||
gtk_table_attach_defaults (GTK_TABLE (table), hbox, 1, 2, 2, 4);
|
||||
gtk_widget_show (hbox);
|
||||
|
||||
entry = gimp_size_entry_new (0, gimp_image_get_unit (image), _("pixels/%a"),
|
||||
FALSE, FALSE, FALSE, SB_WIDTH,
|
||||
GIMP_SIZE_ENTRY_UPDATE_RESOLUTION);
|
||||
|
||||
gtk_table_set_row_spacing (GTK_TABLE (entry), 0, 2);
|
||||
gtk_table_set_col_spacing (GTK_TABLE (entry), 1, 2);
|
||||
gtk_table_set_col_spacing (GTK_TABLE (entry), 2, 2);
|
||||
|
||||
gtk_box_pack_start (GTK_BOX (hbox), entry, FALSE, FALSE, 0);
|
||||
gtk_widget_show (entry);
|
||||
|
||||
gimp_size_entry_add_field (GIMP_SIZE_ENTRY (entry),
|
||||
GTK_SPIN_BUTTON (height), NULL);
|
||||
gtk_table_attach_defaults (GTK_TABLE (entry), height, 0, 1, 1, 2);
|
||||
gtk_widget_show (height);
|
||||
|
||||
gimp_size_entry_add_field (GIMP_SIZE_ENTRY (entry),
|
||||
GTK_SPIN_BUTTON (width), NULL);
|
||||
gtk_table_attach_defaults (GTK_TABLE (entry), width, 0, 1, 0, 1);
|
||||
gtk_widget_show (width);
|
||||
|
||||
gimp_size_entry_set_refval_boundaries (GIMP_SIZE_ENTRY (entry), 0,
|
||||
GIMP_MIN_RESOLUTION,
|
||||
GIMP_MAX_RESOLUTION);
|
||||
gimp_size_entry_set_refval_boundaries (GIMP_SIZE_ENTRY (entry), 1,
|
||||
GIMP_MIN_RESOLUTION,
|
||||
GIMP_MAX_RESOLUTION);
|
||||
|
||||
gimp_size_entry_set_refval (GIMP_SIZE_ENTRY (entry), 0, xres);
|
||||
gimp_size_entry_set_refval (GIMP_SIZE_ENTRY (entry), 1, yres);
|
||||
|
||||
chain = gimp_chain_button_new (GIMP_CHAIN_RIGHT);
|
||||
gimp_chain_button_set_active (GIMP_CHAIN_BUTTON (chain), TRUE);
|
||||
gtk_table_attach_defaults (GTK_TABLE (entry), chain, 1, 2, 0, 2);
|
||||
gtk_widget_show (chain);
|
||||
|
||||
return dialog;
|
||||
}
|
||||
@ -140,7 +249,7 @@ print_size_dialog_response (GtkWidget *dialog,
|
||||
gint response_id,
|
||||
PrintSizeDialog *private)
|
||||
{
|
||||
GimpUnit resolution_unit;
|
||||
GimpUnit unit;
|
||||
gdouble xres, yres;
|
||||
|
||||
switch (response_id)
|
||||
@ -150,15 +259,12 @@ print_size_dialog_response (GtkWidget *dialog,
|
||||
break;
|
||||
|
||||
case GTK_RESPONSE_OK:
|
||||
g_object_get (private->box,
|
||||
"xresolution", &xres,
|
||||
"yresolution", &yres,
|
||||
"resolution-unit", &resolution_unit,
|
||||
NULL);
|
||||
unit = gimp_image_get_unit (private->image);
|
||||
gimp_image_get_resolution (private->image, &xres, &yres);
|
||||
|
||||
private->callback (dialog,
|
||||
private->image,
|
||||
xres, yres, resolution_unit,
|
||||
xres, yres, unit,
|
||||
private->user_data);
|
||||
break;
|
||||
|
||||
@ -171,15 +277,9 @@ print_size_dialog_response (GtkWidget *dialog,
|
||||
static void
|
||||
print_size_dialog_reset (PrintSizeDialog *private)
|
||||
{
|
||||
GimpUnit unit;
|
||||
gdouble xres, yres;
|
||||
|
||||
gimp_image_get_resolution (private->image, &xres, &yres);
|
||||
|
||||
g_object_set (private->box,
|
||||
"keep-aspect", FALSE,
|
||||
"xresolution", xres,
|
||||
"yresolution", yres,
|
||||
"resolution-unit", gimp_image_get_unit (private->image),
|
||||
"keep-aspect", TRUE,
|
||||
NULL);
|
||||
unit = gimp_image_get_unit (private->image);
|
||||
}
|
||||
|
||||
@ -34,8 +34,6 @@
|
||||
#include "gimp-intl.h"
|
||||
|
||||
|
||||
static void gimp_progress_box_class_init (GimpProgressBoxClass *klass);
|
||||
static void gimp_progress_box_init (GimpProgressBox *box);
|
||||
static void gimp_progress_box_progress_iface_init (GimpProgressInterface *progress_iface);
|
||||
|
||||
static GimpProgress *
|
||||
@ -51,8 +49,6 @@ static void gimp_progress_box_progress_set_value (GimpProgress *progress,
|
||||
static gdouble gimp_progress_box_progress_get_value (GimpProgress *progress);
|
||||
|
||||
|
||||
static GtkVBoxClass *parent_class = NULL;
|
||||
|
||||
|
||||
GType
|
||||
gimp_progress_box_get_type (void)
|
||||
@ -66,12 +62,12 @@ gimp_progress_box_get_type (void)
|
||||
sizeof (GimpProgressBoxClass),
|
||||
(GBaseInitFunc) NULL,
|
||||
(GBaseFinalizeFunc) NULL,
|
||||
(GClassInitFunc) gimp_progress_box_class_init,
|
||||
NULL, /* class_init */
|
||||
NULL, /* class_finalize */
|
||||
NULL, /* class_data */
|
||||
sizeof (GimpProgressBox),
|
||||
0, /* n_preallocs */
|
||||
(GInstanceInitFunc) gimp_progress_box_init,
|
||||
NULL /* instance_init */
|
||||
};
|
||||
|
||||
static const GInterfaceInfo progress_iface_info =
|
||||
@ -92,17 +88,6 @@ gimp_progress_box_get_type (void)
|
||||
return box_type;
|
||||
}
|
||||
|
||||
static void
|
||||
gimp_progress_box_class_init (GimpProgressBoxClass *klass)
|
||||
{
|
||||
parent_class = g_type_class_peek_parent (klass);
|
||||
}
|
||||
|
||||
static void
|
||||
gimp_progress_box_init (GimpProgressBox *box)
|
||||
{
|
||||
}
|
||||
|
||||
static void
|
||||
gimp_progress_box_progress_iface_init (GimpProgressInterface *progress_iface)
|
||||
{
|
||||
|
||||
@ -111,8 +111,7 @@ gimp_progress_dialog_init (GimpProgressDialog *dialog)
|
||||
{
|
||||
dialog->box = gimp_progress_box_new ();
|
||||
gtk_container_set_border_width (GTK_CONTAINER (dialog->box), 12);
|
||||
gtk_container_add (GTK_CONTAINER (GTK_DIALOG (dialog)->vbox),
|
||||
dialog->box);
|
||||
gtk_container_add (GTK_CONTAINER (GTK_DIALOG (dialog)->vbox), dialog->box);
|
||||
gtk_widget_show (dialog->box);
|
||||
|
||||
g_signal_connect (dialog->box, "destroy",
|
||||
|
||||
@ -63,7 +63,6 @@ struct _GimpSizeBoxPrivate
|
||||
GimpChainButton *size_chain;
|
||||
GtkWidget *pixel_label;
|
||||
GtkWidget *res_label;
|
||||
GimpSizeEntry *res_entry;
|
||||
gdouble aspect;
|
||||
};
|
||||
|
||||
@ -367,11 +366,6 @@ gimp_size_box_constructor (GType type,
|
||||
gtk_table_attach_defaults (GTK_TABLE (entry), xres, 0, 1, 0, 1);
|
||||
gtk_widget_show (xres);
|
||||
|
||||
gimp_size_entry_set_resolution (GIMP_SIZE_ENTRY (entry), 0,
|
||||
box->xresolution, FALSE);
|
||||
gimp_size_entry_set_resolution (GIMP_SIZE_ENTRY (entry), 1,
|
||||
box->yresolution, FALSE);
|
||||
|
||||
/* the resolution chainbutton */
|
||||
chain = gimp_chain_button_new (GIMP_CHAIN_RIGHT);
|
||||
gtk_table_attach_defaults (GTK_TABLE (entry), chain, 1, 2, 0, 2);
|
||||
@ -382,8 +376,6 @@ gimp_size_box_constructor (GType type,
|
||||
"resolution-unit",
|
||||
entry, chain,
|
||||
1.0, 1.0);
|
||||
|
||||
priv->res_entry = GIMP_SIZE_ENTRY (entry);
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
Binary file not shown.
|
Before Width: | Height: | Size: 148 KiB After Width: | Height: | Size: 144 KiB |
Reference in New Issue
Block a user