We have entries in the info dialog now that allow to enter exact values

for the transformations and crop.

Changed "Clip perspective" to "Clip result" in the ransform tool options
and made it available for all transformations.

Minor cosmetic changes to rect_select and ink option dialogs.


--Sven
This commit is contained in:
Sven Neumann 1998-08-15 13:34:54 +00:00
parent e6568759d8
commit 14394b2e6b
38 changed files with 1477 additions and 254 deletions

View File

@ -1,3 +1,21 @@
Sat Aug 15 15:27:39 MEST 1998 Sven Neumann <sven@gimp.org>
* app/color_picker.c
* app/crop.c
* app/info_dialog.[ch]
* app/info_window.c
* app/rotate_tool.c
* app/scale_tool.c
* app/shear_tool.c: We have entries in the info dialog now that
allow to enter exact values for the transformations and crop.
* app/transform_core.c
* app/transform_tool.c: Changed "Clip perspective" to "Clip result"
and made it available for all transformations.
* app/rect_select.c
* app/ink.c: minor cosmetic changes
Fri Aug 14 19:58:13 EDT 1998 Adrian Likins <adrian@gimp.org> Fri Aug 14 19:58:13 EDT 1998 Adrian Likins <adrian@gimp.org>
* plugins/script-fu/scripts/select_to_brush.scm, * plugins/script-fu/scripts/select_to_brush.scm,

View File

@ -153,26 +153,26 @@ color_picker_button_press (Tool *tool,
switch (drawable_type (active_drawable)) switch (drawable_type (active_drawable))
{ {
case RGB_GIMAGE: case RGBA_GIMAGE: case RGB_GIMAGE: case RGBA_GIMAGE:
info_dialog_add_field (color_picker_info, "Red", red_buf); info_dialog_add_field (color_picker_info, "Red", red_buf, NULL, NULL);
info_dialog_add_field (color_picker_info, "Green", green_buf); info_dialog_add_field (color_picker_info, "Green", green_buf, NULL, NULL);
info_dialog_add_field (color_picker_info, "Blue", blue_buf); info_dialog_add_field (color_picker_info, "Blue", blue_buf, NULL, NULL);
info_dialog_add_field (color_picker_info, "Alpha", alpha_buf); info_dialog_add_field (color_picker_info, "Alpha", alpha_buf, NULL, NULL);
info_dialog_add_field (color_picker_info, "Hex Triplet", hex_buf); info_dialog_add_field (color_picker_info, "Hex Triplet", hex_buf, NULL, NULL);
break; break;
case INDEXED_GIMAGE: case INDEXEDA_GIMAGE: case INDEXED_GIMAGE: case INDEXEDA_GIMAGE:
info_dialog_add_field (color_picker_info, "Index", index_buf); info_dialog_add_field (color_picker_info, "Index", index_buf, NULL, NULL);
info_dialog_add_field (color_picker_info, "Alpha", alpha_buf); info_dialog_add_field (color_picker_info, "Alpha", alpha_buf, NULL, NULL);
info_dialog_add_field (color_picker_info, "Red", red_buf); info_dialog_add_field (color_picker_info, "Red", red_buf, NULL, NULL);
info_dialog_add_field (color_picker_info, "Green", green_buf); info_dialog_add_field (color_picker_info, "Green", green_buf, NULL, NULL);
info_dialog_add_field (color_picker_info, "Blue", blue_buf); info_dialog_add_field (color_picker_info, "Blue", blue_buf, NULL, NULL);
info_dialog_add_field (color_picker_info, "Hex Triplet", hex_buf); info_dialog_add_field (color_picker_info, "Hex Triplet", hex_buf, NULL, NULL);
break; break;
case GRAY_GIMAGE: case GRAYA_GIMAGE: case GRAY_GIMAGE: case GRAYA_GIMAGE:
info_dialog_add_field (color_picker_info, "Intensity", gray_buf); info_dialog_add_field (color_picker_info, "Intensity", gray_buf, NULL, NULL);
info_dialog_add_field (color_picker_info, "Alpha", alpha_buf); info_dialog_add_field (color_picker_info, "Alpha", alpha_buf, NULL, NULL);
info_dialog_add_field (color_picker_info, "Hex Triplet", hex_buf); info_dialog_add_field (color_picker_info, "Hex Triplet", hex_buf, NULL, NULL);
break; break;
default : default :

View File

@ -97,6 +97,12 @@ static void crop_ok_callback (GtkWidget *, gpointer);
static void crop_selection_callback (GtkWidget *, gpointer); static void crop_selection_callback (GtkWidget *, gpointer);
static void crop_close_callback (GtkWidget *, gpointer); static void crop_close_callback (GtkWidget *, gpointer);
/* Crop dialog callback funtions */
static void crop_orig_x_changed (GtkWidget *, gpointer);
static void crop_orig_y_changed (GtkWidget *, gpointer);
static void crop_width_changed (GtkWidget *, gpointer);
static void crop_height_changed (GtkWidget *, gpointer);
static void *crop_options = NULL; static void *crop_options = NULL;
static Argument *crop_invoker (Argument *); static Argument *crop_invoker (Argument *);
@ -719,10 +725,10 @@ crop_info_create (Tool *tool)
crop_info = info_dialog_new ("Crop Information"); crop_info = info_dialog_new ("Crop Information");
/* add the information fields */ /* add the information fields */
info_dialog_add_field (crop_info, "X Origin: ", orig_x_buf); info_dialog_add_field (crop_info, "X Origin: ", orig_x_buf, crop_orig_x_changed, tool);
info_dialog_add_field (crop_info, "Y Origin: ", orig_y_buf); info_dialog_add_field (crop_info, "Y Origin: ", orig_y_buf, crop_orig_y_changed, tool);
info_dialog_add_field (crop_info, "Width: ", width_buf); info_dialog_add_field (crop_info, "Width: ", width_buf, crop_width_changed, tool);
info_dialog_add_field (crop_info, "Height: ", height_buf); info_dialog_add_field (crop_info, "Height: ", height_buf, crop_height_changed, tool);
/* Create the action area */ /* Create the action area */
build_action_area (GTK_DIALOG (crop_info->shell), action_items, 3, 0); build_action_area (GTK_DIALOG (crop_info->shell), action_items, 3, 0);
@ -800,6 +806,135 @@ crop_close_callback (GtkWidget *w,
tool->state = INACTIVE; tool->state = INACTIVE;
} }
static void
crop_orig_x_changed (GtkWidget *w,
gpointer data)
{
Tool * tool;
Crop * crop;
GDisplay * gdisp;
gchar *str;
int value;
tool = (Tool *)data;
if (tool)
{
gdisp = (GDisplay *) tool->gdisp_ptr;
crop = (Crop *) tool->private;
str = g_strdup (gtk_entry_get_text (GTK_ENTRY (w)));
value = (int) atof(str);
if (value != crop->tx1)
{
draw_core_pause (crop->core, tool);
crop->tx2 = crop->tx2 + (value - crop->tx1);
crop->tx1 = value;
crop_recalc (tool, crop);
draw_core_resume (crop->core, tool);
}
g_free (str);
}
}
static void
crop_orig_y_changed (GtkWidget *w,
gpointer data)
{
Tool * tool;
Crop * crop;
GDisplay * gdisp;
gchar *str;
int value;
tool = (Tool *)data;
if (tool)
{
gdisp = (GDisplay *) tool->gdisp_ptr;
crop = (Crop *) tool->private;
str = g_strdup (gtk_entry_get_text (GTK_ENTRY (w)));
value = (int) atof(str);
if (value != crop->ty1)
{
draw_core_pause (crop->core, tool);
crop->ty2 = crop->ty2 + (value - crop->ty1);
crop->ty1 = value;
crop_recalc (tool, crop);
draw_core_resume (crop->core, tool);
}
g_free (str);
}
}
static void
crop_width_changed (GtkWidget *w,
gpointer data)
{
Tool * tool;
Crop * crop;
GDisplay * gdisp;
gchar *str;
int value;
tool = (Tool *)data;
if (tool)
{
gdisp = (GDisplay *) tool->gdisp_ptr;
crop = (Crop *) tool->private;
str = g_strdup (gtk_entry_get_text (GTK_ENTRY (w)));
value = (int) atof(str);
if (value != (crop->tx2 - crop->tx1));
{
draw_core_pause (crop->core, tool);
crop->tx2 = value + crop->tx1;
crop_recalc (tool, crop);
draw_core_resume (crop->core, tool);
}
g_free (str);
}
}
static void
crop_height_changed (GtkWidget *w,
gpointer data)
{
Tool * tool;
Crop * crop;
GDisplay * gdisp;
gchar *str;
int value;
tool = (Tool *)data;
if (tool)
{
gdisp = (GDisplay *) tool->gdisp_ptr;
crop = (Crop *) tool->private;
str = g_strdup (gtk_entry_get_text (GTK_ENTRY (w)));
value = (int) atof(str);
if (value != (crop->ty2 - crop->ty1));
{
draw_core_pause (crop->core, tool);
crop->ty2 = value + crop->ty1;
crop_recalc (tool, crop);
draw_core_resume (crop->core, tool);
}
g_free (str);
}
}
/* The procedure definition */ /* The procedure definition */
ProcArg crop_args[] = ProcArg crop_args[] =

View File

@ -24,33 +24,55 @@
#include "session.h" #include "session.h"
/* static functions */ /* static functions */
static InfoField * info_field_new (InfoDialog *, char *, char *); static InfoField * info_field_new (InfoDialog *, char *, char *, GtkSignalFunc, gpointer);
static void update_field (InfoField *); static void update_field (InfoField *);
static gint info_dialog_delete_callback (GtkWidget *, GdkEvent *, gpointer); static gint info_dialog_delete_callback (GtkWidget *, GdkEvent *, gpointer);
static InfoField * static InfoField *
info_field_new (InfoDialog *idialog, info_field_new (InfoDialog *idialog,
char *title, char *title,
char *text_ptr) char *text_ptr,
GtkSignalFunc callback,
gpointer client_data)
{ {
GtkWidget *label; GtkWidget *label;
InfoField *field; InfoField *field;
int row;
field = (InfoField *) g_malloc (sizeof (InfoField)); field = (InfoField *) g_malloc (sizeof (InfoField));
row = idialog->nfields + 1;
gtk_table_resize (GTK_TABLE (idialog->info_table), 2, row);
label = gtk_label_new (title); label = gtk_label_new (title);
gtk_misc_set_alignment (GTK_MISC (label), 0.0, 0.5); gtk_misc_set_alignment (GTK_MISC (label), 0.0, 0.5);
gtk_box_pack_start (GTK_BOX (idialog->labels), label, FALSE, FALSE, 0); gtk_table_attach_defaults (GTK_TABLE (idialog->info_table), label,
0, 1, row - 1, row);
field->w = gtk_label_new (text_ptr); if (callback == NULL)
gtk_misc_set_alignment (GTK_MISC (field->w), 0.0, 0.5); {
gtk_box_pack_start (GTK_BOX (idialog->values), field->w, FALSE, FALSE, 0); field->w = gtk_label_new (text_ptr);
gtk_misc_set_alignment (GTK_MISC (field->w), 0.0, 0.5);
}
else
{
field->w = gtk_entry_new ();
gtk_widget_set_usize (field->w, 50, 0);
gtk_entry_set_text (GTK_ENTRY (field->w), text_ptr);
gtk_signal_connect (GTK_OBJECT (field->w), "changed",
GTK_SIGNAL_FUNC (callback), client_data);
}
field->text_ptr = text_ptr; gtk_table_attach_defaults (GTK_TABLE (idialog->info_table), field->w,
1, 2, row - 1, row);
gtk_widget_show (field->w); gtk_widget_show (field->w);
gtk_widget_show (label); gtk_widget_show (label);
field->text_ptr = text_ptr;
field->callback = callback;
field->client_data = client_data;
return field; return field;
} }
@ -60,12 +82,18 @@ update_field (InfoField *field)
gchar *old_text; gchar *old_text;
/* only update the field if its new value differs from the old */ /* only update the field if its new value differs from the old */
gtk_label_get (GTK_LABEL (field->w), &old_text); if (field->callback == NULL)
gtk_label_get (GTK_LABEL (field->w), &old_text);
else
old_text = gtk_entry_get_text (GTK_ENTRY (field->w));
if (strcmp (old_text, field->text_ptr)) if (strcmp (old_text, field->text_ptr))
{ {
/* set the new value and update somehow */ /* set the new value and update somehow */
gtk_label_set (GTK_LABEL (field->w), field->text_ptr); if (field->callback == NULL)
gtk_label_set (GTK_LABEL (field->w), field->text_ptr);
else
gtk_entry_set_text (GTK_ENTRY (field->w), field->text_ptr);
} }
} }
@ -77,11 +105,11 @@ info_dialog_new (char *title)
InfoDialog * idialog; InfoDialog * idialog;
GtkWidget *shell; GtkWidget *shell;
GtkWidget *vbox; GtkWidget *vbox;
GtkWidget *labels, *values; GtkWidget *info_table;
GtkWidget *info_area;
idialog = (InfoDialog *) g_malloc (sizeof (InfoDialog)); idialog = (InfoDialog *) g_malloc (sizeof (InfoDialog));
idialog->field_list = NULL; idialog->field_list = NULL;
idialog->nfields = 0;
shell = gtk_dialog_new (); shell = gtk_dialog_new ();
gtk_window_set_wmclass (GTK_WINDOW (shell), "info_dialog", "Gimp"); gtk_window_set_wmclass (GTK_WINDOW (shell), "info_dialog", "Gimp");
@ -96,25 +124,15 @@ info_dialog_new (char *title)
gtk_container_border_width (GTK_CONTAINER (vbox), 1); gtk_container_border_width (GTK_CONTAINER (vbox), 1);
gtk_box_pack_start (GTK_BOX (GTK_DIALOG (shell)->vbox), vbox, TRUE, TRUE, 0); gtk_box_pack_start (GTK_BOX (GTK_DIALOG (shell)->vbox), vbox, TRUE, TRUE, 0);
info_area = gtk_hbox_new (FALSE, 1); info_table = gtk_table_new (0, 0, FALSE);
gtk_container_border_width (GTK_CONTAINER (info_area), 5); gtk_container_border_width (GTK_CONTAINER (info_table), 5);
gtk_box_pack_start (GTK_BOX (vbox), info_area, TRUE, TRUE, 0); gtk_box_pack_start (GTK_BOX (vbox), info_table, TRUE, TRUE, 0);
labels = gtk_vbox_new (FALSE, 1);
gtk_box_pack_start (GTK_BOX (info_area), labels, TRUE, TRUE, 0);
values = gtk_vbox_new (FALSE, 1);
gtk_box_pack_start (GTK_BOX (info_area), values, TRUE, TRUE, 0);
idialog->shell = shell; idialog->shell = shell;
idialog->vbox = vbox; idialog->vbox = vbox;
idialog->info_area = info_area; idialog->info_table = info_table;
idialog->labels = labels;
idialog->values = values;
gtk_widget_show (idialog->labels); gtk_widget_show (idialog->info_table);
gtk_widget_show (idialog->values);
gtk_widget_show (idialog->info_area);
gtk_widget_show (idialog->vbox); gtk_widget_show (idialog->vbox);
return idialog; return idialog;
@ -150,17 +168,20 @@ info_dialog_free (InfoDialog *idialog)
} }
void void
info_dialog_add_field (InfoDialog *idialog, info_dialog_add_field (InfoDialog *idialog,
char *title, char *title,
char *text_ptr) char *text_ptr,
GtkSignalFunc callback,
gpointer data)
{ {
InfoField * new_field; InfoField * new_field;
if (!idialog) if (!idialog)
return; return;
new_field = info_field_new (idialog, title, text_ptr); new_field = info_field_new (idialog, title, text_ptr, callback, data);
idialog->field_list = g_slist_prepend (idialog->field_list, (void *) new_field); idialog->field_list = g_slist_prepend (idialog->field_list, (void *) new_field);
idialog->nfields++;
} }
void void

View File

@ -24,8 +24,10 @@ typedef struct _info_field InfoField;
struct _info_field struct _info_field
{ {
GtkWidget *w; GtkWidget *w;
char * text_ptr; char *text_ptr;
GtkSignalFunc callback;
gpointer client_data;
}; };
@ -35,11 +37,10 @@ struct _info_dialog
{ {
GtkWidget *shell; GtkWidget *shell;
GtkWidget *vbox; GtkWidget *vbox;
GtkWidget *info_area; GtkWidget *info_table;
GtkWidget *labels;
GtkWidget *values;
GSList *field_list; GSList *field_list;
int nfields;
void *user_data; void *user_data;
}; };
@ -49,7 +50,11 @@ struct _info_dialog
InfoDialog * info_dialog_new (char *); InfoDialog * info_dialog_new (char *);
void info_dialog_free (InfoDialog *); void info_dialog_free (InfoDialog *);
void info_dialog_add_field (InfoDialog *, char *, char *); void info_dialog_add_field (InfoDialog *,
char *,
char *,
GtkSignalFunc,
gpointer);
void info_dialog_popup (InfoDialog *); void info_dialog_popup (InfoDialog *);
void info_dialog_popdown (InfoDialog *); void info_dialog_popdown (InfoDialog *);
void info_dialog_update (InfoDialog *); void info_dialog_update (InfoDialog *);

View File

@ -148,17 +148,17 @@ info_window_create (void *gdisp_ptr)
iwd->shades_str[0] = '\0'; iwd->shades_str[0] = '\0';
/* add the information fields */ /* add the information fields */
info_dialog_add_field (info_win, "Dimensions (w x h): ", iwd->dimensions_str); info_dialog_add_field (info_win, "Dimensions (w x h): ", iwd->dimensions_str, NULL, NULL);
info_dialog_add_field (info_win, "Scale Ratio: ", iwd->scale_str); info_dialog_add_field (info_win, "Scale Ratio: ", iwd->scale_str, NULL, NULL);
info_dialog_add_field (info_win, "Display Type: ", iwd->color_type_str); info_dialog_add_field (info_win, "Display Type: ", iwd->color_type_str, NULL, NULL);
info_dialog_add_field (info_win, "Visual Class: ", iwd->visual_class_str); info_dialog_add_field (info_win, "Visual Class: ", iwd->visual_class_str, NULL, NULL);
info_dialog_add_field (info_win, "Visual Depth: ", iwd->visual_depth_str); info_dialog_add_field (info_win, "Visual Depth: ", iwd->visual_depth_str, NULL, NULL);
if (type == RGB) if (type == RGB)
info_dialog_add_field (info_win, "Shades of Color: ", iwd->shades_str); info_dialog_add_field (info_win, "Shades of Color: ", iwd->shades_str, NULL, NULL);
else if (type == INDEXED) else if (type == INDEXED)
info_dialog_add_field (info_win, "Shades: ", iwd->shades_str); info_dialog_add_field (info_win, "Shades: ", iwd->shades_str, NULL, NULL);
else if (type == GRAY) else if (type == GRAY)
info_dialog_add_field (info_win, "Shades of Gray: ", iwd->shades_str); info_dialog_add_field (info_win, "Shades of Gray: ", iwd->shades_str, NULL, NULL);
/* update the fields */ /* update the fields */
info_window_update (info_win, gdisp_ptr); info_window_update (info_win, gdisp_ptr);

View File

@ -24,33 +24,55 @@
#include "session.h" #include "session.h"
/* static functions */ /* static functions */
static InfoField * info_field_new (InfoDialog *, char *, char *); static InfoField * info_field_new (InfoDialog *, char *, char *, GtkSignalFunc, gpointer);
static void update_field (InfoField *); static void update_field (InfoField *);
static gint info_dialog_delete_callback (GtkWidget *, GdkEvent *, gpointer); static gint info_dialog_delete_callback (GtkWidget *, GdkEvent *, gpointer);
static InfoField * static InfoField *
info_field_new (InfoDialog *idialog, info_field_new (InfoDialog *idialog,
char *title, char *title,
char *text_ptr) char *text_ptr,
GtkSignalFunc callback,
gpointer client_data)
{ {
GtkWidget *label; GtkWidget *label;
InfoField *field; InfoField *field;
int row;
field = (InfoField *) g_malloc (sizeof (InfoField)); field = (InfoField *) g_malloc (sizeof (InfoField));
row = idialog->nfields + 1;
gtk_table_resize (GTK_TABLE (idialog->info_table), 2, row);
label = gtk_label_new (title); label = gtk_label_new (title);
gtk_misc_set_alignment (GTK_MISC (label), 0.0, 0.5); gtk_misc_set_alignment (GTK_MISC (label), 0.0, 0.5);
gtk_box_pack_start (GTK_BOX (idialog->labels), label, FALSE, FALSE, 0); gtk_table_attach_defaults (GTK_TABLE (idialog->info_table), label,
0, 1, row - 1, row);
field->w = gtk_label_new (text_ptr); if (callback == NULL)
gtk_misc_set_alignment (GTK_MISC (field->w), 0.0, 0.5); {
gtk_box_pack_start (GTK_BOX (idialog->values), field->w, FALSE, FALSE, 0); field->w = gtk_label_new (text_ptr);
gtk_misc_set_alignment (GTK_MISC (field->w), 0.0, 0.5);
}
else
{
field->w = gtk_entry_new ();
gtk_widget_set_usize (field->w, 50, 0);
gtk_entry_set_text (GTK_ENTRY (field->w), text_ptr);
gtk_signal_connect (GTK_OBJECT (field->w), "changed",
GTK_SIGNAL_FUNC (callback), client_data);
}
field->text_ptr = text_ptr; gtk_table_attach_defaults (GTK_TABLE (idialog->info_table), field->w,
1, 2, row - 1, row);
gtk_widget_show (field->w); gtk_widget_show (field->w);
gtk_widget_show (label); gtk_widget_show (label);
field->text_ptr = text_ptr;
field->callback = callback;
field->client_data = client_data;
return field; return field;
} }
@ -60,12 +82,18 @@ update_field (InfoField *field)
gchar *old_text; gchar *old_text;
/* only update the field if its new value differs from the old */ /* only update the field if its new value differs from the old */
gtk_label_get (GTK_LABEL (field->w), &old_text); if (field->callback == NULL)
gtk_label_get (GTK_LABEL (field->w), &old_text);
else
old_text = gtk_entry_get_text (GTK_ENTRY (field->w));
if (strcmp (old_text, field->text_ptr)) if (strcmp (old_text, field->text_ptr))
{ {
/* set the new value and update somehow */ /* set the new value and update somehow */
gtk_label_set (GTK_LABEL (field->w), field->text_ptr); if (field->callback == NULL)
gtk_label_set (GTK_LABEL (field->w), field->text_ptr);
else
gtk_entry_set_text (GTK_ENTRY (field->w), field->text_ptr);
} }
} }
@ -77,11 +105,11 @@ info_dialog_new (char *title)
InfoDialog * idialog; InfoDialog * idialog;
GtkWidget *shell; GtkWidget *shell;
GtkWidget *vbox; GtkWidget *vbox;
GtkWidget *labels, *values; GtkWidget *info_table;
GtkWidget *info_area;
idialog = (InfoDialog *) g_malloc (sizeof (InfoDialog)); idialog = (InfoDialog *) g_malloc (sizeof (InfoDialog));
idialog->field_list = NULL; idialog->field_list = NULL;
idialog->nfields = 0;
shell = gtk_dialog_new (); shell = gtk_dialog_new ();
gtk_window_set_wmclass (GTK_WINDOW (shell), "info_dialog", "Gimp"); gtk_window_set_wmclass (GTK_WINDOW (shell), "info_dialog", "Gimp");
@ -96,25 +124,15 @@ info_dialog_new (char *title)
gtk_container_border_width (GTK_CONTAINER (vbox), 1); gtk_container_border_width (GTK_CONTAINER (vbox), 1);
gtk_box_pack_start (GTK_BOX (GTK_DIALOG (shell)->vbox), vbox, TRUE, TRUE, 0); gtk_box_pack_start (GTK_BOX (GTK_DIALOG (shell)->vbox), vbox, TRUE, TRUE, 0);
info_area = gtk_hbox_new (FALSE, 1); info_table = gtk_table_new (0, 0, FALSE);
gtk_container_border_width (GTK_CONTAINER (info_area), 5); gtk_container_border_width (GTK_CONTAINER (info_table), 5);
gtk_box_pack_start (GTK_BOX (vbox), info_area, TRUE, TRUE, 0); gtk_box_pack_start (GTK_BOX (vbox), info_table, TRUE, TRUE, 0);
labels = gtk_vbox_new (FALSE, 1);
gtk_box_pack_start (GTK_BOX (info_area), labels, TRUE, TRUE, 0);
values = gtk_vbox_new (FALSE, 1);
gtk_box_pack_start (GTK_BOX (info_area), values, TRUE, TRUE, 0);
idialog->shell = shell; idialog->shell = shell;
idialog->vbox = vbox; idialog->vbox = vbox;
idialog->info_area = info_area; idialog->info_table = info_table;
idialog->labels = labels;
idialog->values = values;
gtk_widget_show (idialog->labels); gtk_widget_show (idialog->info_table);
gtk_widget_show (idialog->values);
gtk_widget_show (idialog->info_area);
gtk_widget_show (idialog->vbox); gtk_widget_show (idialog->vbox);
return idialog; return idialog;
@ -150,17 +168,20 @@ info_dialog_free (InfoDialog *idialog)
} }
void void
info_dialog_add_field (InfoDialog *idialog, info_dialog_add_field (InfoDialog *idialog,
char *title, char *title,
char *text_ptr) char *text_ptr,
GtkSignalFunc callback,
gpointer data)
{ {
InfoField * new_field; InfoField * new_field;
if (!idialog) if (!idialog)
return; return;
new_field = info_field_new (idialog, title, text_ptr); new_field = info_field_new (idialog, title, text_ptr, callback, data);
idialog->field_list = g_slist_prepend (idialog->field_list, (void *) new_field); idialog->field_list = g_slist_prepend (idialog->field_list, (void *) new_field);
idialog->nfields++;
} }
void void

View File

@ -24,8 +24,10 @@ typedef struct _info_field InfoField;
struct _info_field struct _info_field
{ {
GtkWidget *w; GtkWidget *w;
char * text_ptr; char *text_ptr;
GtkSignalFunc callback;
gpointer client_data;
}; };
@ -35,11 +37,10 @@ struct _info_dialog
{ {
GtkWidget *shell; GtkWidget *shell;
GtkWidget *vbox; GtkWidget *vbox;
GtkWidget *info_area; GtkWidget *info_table;
GtkWidget *labels;
GtkWidget *values;
GSList *field_list; GSList *field_list;
int nfields;
void *user_data; void *user_data;
}; };
@ -49,7 +50,11 @@ struct _info_dialog
InfoDialog * info_dialog_new (char *); InfoDialog * info_dialog_new (char *);
void info_dialog_free (InfoDialog *); void info_dialog_free (InfoDialog *);
void info_dialog_add_field (InfoDialog *, char *, char *); void info_dialog_add_field (InfoDialog *,
char *,
char *,
GtkSignalFunc,
gpointer);
void info_dialog_popup (InfoDialog *); void info_dialog_popup (InfoDialog *);
void info_dialog_popdown (InfoDialog *); void info_dialog_popdown (InfoDialog *);
void info_dialog_update (InfoDialog *); void info_dialog_update (InfoDialog *);

View File

@ -148,17 +148,17 @@ info_window_create (void *gdisp_ptr)
iwd->shades_str[0] = '\0'; iwd->shades_str[0] = '\0';
/* add the information fields */ /* add the information fields */
info_dialog_add_field (info_win, "Dimensions (w x h): ", iwd->dimensions_str); info_dialog_add_field (info_win, "Dimensions (w x h): ", iwd->dimensions_str, NULL, NULL);
info_dialog_add_field (info_win, "Scale Ratio: ", iwd->scale_str); info_dialog_add_field (info_win, "Scale Ratio: ", iwd->scale_str, NULL, NULL);
info_dialog_add_field (info_win, "Display Type: ", iwd->color_type_str); info_dialog_add_field (info_win, "Display Type: ", iwd->color_type_str, NULL, NULL);
info_dialog_add_field (info_win, "Visual Class: ", iwd->visual_class_str); info_dialog_add_field (info_win, "Visual Class: ", iwd->visual_class_str, NULL, NULL);
info_dialog_add_field (info_win, "Visual Depth: ", iwd->visual_depth_str); info_dialog_add_field (info_win, "Visual Depth: ", iwd->visual_depth_str, NULL, NULL);
if (type == RGB) if (type == RGB)
info_dialog_add_field (info_win, "Shades of Color: ", iwd->shades_str); info_dialog_add_field (info_win, "Shades of Color: ", iwd->shades_str, NULL, NULL);
else if (type == INDEXED) else if (type == INDEXED)
info_dialog_add_field (info_win, "Shades: ", iwd->shades_str); info_dialog_add_field (info_win, "Shades: ", iwd->shades_str, NULL, NULL);
else if (type == GRAY) else if (type == GRAY)
info_dialog_add_field (info_win, "Shades of Gray: ", iwd->shades_str); info_dialog_add_field (info_win, "Shades of Gray: ", iwd->shades_str, NULL, NULL);
/* update the fields */ /* update the fields */
info_window_update (info_win, gdisp_ptr); info_window_update (info_win, gdisp_ptr);

View File

@ -24,33 +24,55 @@
#include "session.h" #include "session.h"
/* static functions */ /* static functions */
static InfoField * info_field_new (InfoDialog *, char *, char *); static InfoField * info_field_new (InfoDialog *, char *, char *, GtkSignalFunc, gpointer);
static void update_field (InfoField *); static void update_field (InfoField *);
static gint info_dialog_delete_callback (GtkWidget *, GdkEvent *, gpointer); static gint info_dialog_delete_callback (GtkWidget *, GdkEvent *, gpointer);
static InfoField * static InfoField *
info_field_new (InfoDialog *idialog, info_field_new (InfoDialog *idialog,
char *title, char *title,
char *text_ptr) char *text_ptr,
GtkSignalFunc callback,
gpointer client_data)
{ {
GtkWidget *label; GtkWidget *label;
InfoField *field; InfoField *field;
int row;
field = (InfoField *) g_malloc (sizeof (InfoField)); field = (InfoField *) g_malloc (sizeof (InfoField));
row = idialog->nfields + 1;
gtk_table_resize (GTK_TABLE (idialog->info_table), 2, row);
label = gtk_label_new (title); label = gtk_label_new (title);
gtk_misc_set_alignment (GTK_MISC (label), 0.0, 0.5); gtk_misc_set_alignment (GTK_MISC (label), 0.0, 0.5);
gtk_box_pack_start (GTK_BOX (idialog->labels), label, FALSE, FALSE, 0); gtk_table_attach_defaults (GTK_TABLE (idialog->info_table), label,
0, 1, row - 1, row);
field->w = gtk_label_new (text_ptr); if (callback == NULL)
gtk_misc_set_alignment (GTK_MISC (field->w), 0.0, 0.5); {
gtk_box_pack_start (GTK_BOX (idialog->values), field->w, FALSE, FALSE, 0); field->w = gtk_label_new (text_ptr);
gtk_misc_set_alignment (GTK_MISC (field->w), 0.0, 0.5);
}
else
{
field->w = gtk_entry_new ();
gtk_widget_set_usize (field->w, 50, 0);
gtk_entry_set_text (GTK_ENTRY (field->w), text_ptr);
gtk_signal_connect (GTK_OBJECT (field->w), "changed",
GTK_SIGNAL_FUNC (callback), client_data);
}
field->text_ptr = text_ptr; gtk_table_attach_defaults (GTK_TABLE (idialog->info_table), field->w,
1, 2, row - 1, row);
gtk_widget_show (field->w); gtk_widget_show (field->w);
gtk_widget_show (label); gtk_widget_show (label);
field->text_ptr = text_ptr;
field->callback = callback;
field->client_data = client_data;
return field; return field;
} }
@ -60,12 +82,18 @@ update_field (InfoField *field)
gchar *old_text; gchar *old_text;
/* only update the field if its new value differs from the old */ /* only update the field if its new value differs from the old */
gtk_label_get (GTK_LABEL (field->w), &old_text); if (field->callback == NULL)
gtk_label_get (GTK_LABEL (field->w), &old_text);
else
old_text = gtk_entry_get_text (GTK_ENTRY (field->w));
if (strcmp (old_text, field->text_ptr)) if (strcmp (old_text, field->text_ptr))
{ {
/* set the new value and update somehow */ /* set the new value and update somehow */
gtk_label_set (GTK_LABEL (field->w), field->text_ptr); if (field->callback == NULL)
gtk_label_set (GTK_LABEL (field->w), field->text_ptr);
else
gtk_entry_set_text (GTK_ENTRY (field->w), field->text_ptr);
} }
} }
@ -77,11 +105,11 @@ info_dialog_new (char *title)
InfoDialog * idialog; InfoDialog * idialog;
GtkWidget *shell; GtkWidget *shell;
GtkWidget *vbox; GtkWidget *vbox;
GtkWidget *labels, *values; GtkWidget *info_table;
GtkWidget *info_area;
idialog = (InfoDialog *) g_malloc (sizeof (InfoDialog)); idialog = (InfoDialog *) g_malloc (sizeof (InfoDialog));
idialog->field_list = NULL; idialog->field_list = NULL;
idialog->nfields = 0;
shell = gtk_dialog_new (); shell = gtk_dialog_new ();
gtk_window_set_wmclass (GTK_WINDOW (shell), "info_dialog", "Gimp"); gtk_window_set_wmclass (GTK_WINDOW (shell), "info_dialog", "Gimp");
@ -96,25 +124,15 @@ info_dialog_new (char *title)
gtk_container_border_width (GTK_CONTAINER (vbox), 1); gtk_container_border_width (GTK_CONTAINER (vbox), 1);
gtk_box_pack_start (GTK_BOX (GTK_DIALOG (shell)->vbox), vbox, TRUE, TRUE, 0); gtk_box_pack_start (GTK_BOX (GTK_DIALOG (shell)->vbox), vbox, TRUE, TRUE, 0);
info_area = gtk_hbox_new (FALSE, 1); info_table = gtk_table_new (0, 0, FALSE);
gtk_container_border_width (GTK_CONTAINER (info_area), 5); gtk_container_border_width (GTK_CONTAINER (info_table), 5);
gtk_box_pack_start (GTK_BOX (vbox), info_area, TRUE, TRUE, 0); gtk_box_pack_start (GTK_BOX (vbox), info_table, TRUE, TRUE, 0);
labels = gtk_vbox_new (FALSE, 1);
gtk_box_pack_start (GTK_BOX (info_area), labels, TRUE, TRUE, 0);
values = gtk_vbox_new (FALSE, 1);
gtk_box_pack_start (GTK_BOX (info_area), values, TRUE, TRUE, 0);
idialog->shell = shell; idialog->shell = shell;
idialog->vbox = vbox; idialog->vbox = vbox;
idialog->info_area = info_area; idialog->info_table = info_table;
idialog->labels = labels;
idialog->values = values;
gtk_widget_show (idialog->labels); gtk_widget_show (idialog->info_table);
gtk_widget_show (idialog->values);
gtk_widget_show (idialog->info_area);
gtk_widget_show (idialog->vbox); gtk_widget_show (idialog->vbox);
return idialog; return idialog;
@ -150,17 +168,20 @@ info_dialog_free (InfoDialog *idialog)
} }
void void
info_dialog_add_field (InfoDialog *idialog, info_dialog_add_field (InfoDialog *idialog,
char *title, char *title,
char *text_ptr) char *text_ptr,
GtkSignalFunc callback,
gpointer data)
{ {
InfoField * new_field; InfoField * new_field;
if (!idialog) if (!idialog)
return; return;
new_field = info_field_new (idialog, title, text_ptr); new_field = info_field_new (idialog, title, text_ptr, callback, data);
idialog->field_list = g_slist_prepend (idialog->field_list, (void *) new_field); idialog->field_list = g_slist_prepend (idialog->field_list, (void *) new_field);
idialog->nfields++;
} }
void void

View File

@ -24,8 +24,10 @@ typedef struct _info_field InfoField;
struct _info_field struct _info_field
{ {
GtkWidget *w; GtkWidget *w;
char * text_ptr; char *text_ptr;
GtkSignalFunc callback;
gpointer client_data;
}; };
@ -35,11 +37,10 @@ struct _info_dialog
{ {
GtkWidget *shell; GtkWidget *shell;
GtkWidget *vbox; GtkWidget *vbox;
GtkWidget *info_area; GtkWidget *info_table;
GtkWidget *labels;
GtkWidget *values;
GSList *field_list; GSList *field_list;
int nfields;
void *user_data; void *user_data;
}; };
@ -49,7 +50,11 @@ struct _info_dialog
InfoDialog * info_dialog_new (char *); InfoDialog * info_dialog_new (char *);
void info_dialog_free (InfoDialog *); void info_dialog_free (InfoDialog *);
void info_dialog_add_field (InfoDialog *, char *, char *); void info_dialog_add_field (InfoDialog *,
char *,
char *,
GtkSignalFunc,
gpointer);
void info_dialog_popup (InfoDialog *); void info_dialog_popup (InfoDialog *);
void info_dialog_popdown (InfoDialog *); void info_dialog_popdown (InfoDialog *);
void info_dialog_update (InfoDialog *); void info_dialog_update (InfoDialog *);

View File

@ -148,17 +148,17 @@ info_window_create (void *gdisp_ptr)
iwd->shades_str[0] = '\0'; iwd->shades_str[0] = '\0';
/* add the information fields */ /* add the information fields */
info_dialog_add_field (info_win, "Dimensions (w x h): ", iwd->dimensions_str); info_dialog_add_field (info_win, "Dimensions (w x h): ", iwd->dimensions_str, NULL, NULL);
info_dialog_add_field (info_win, "Scale Ratio: ", iwd->scale_str); info_dialog_add_field (info_win, "Scale Ratio: ", iwd->scale_str, NULL, NULL);
info_dialog_add_field (info_win, "Display Type: ", iwd->color_type_str); info_dialog_add_field (info_win, "Display Type: ", iwd->color_type_str, NULL, NULL);
info_dialog_add_field (info_win, "Visual Class: ", iwd->visual_class_str); info_dialog_add_field (info_win, "Visual Class: ", iwd->visual_class_str, NULL, NULL);
info_dialog_add_field (info_win, "Visual Depth: ", iwd->visual_depth_str); info_dialog_add_field (info_win, "Visual Depth: ", iwd->visual_depth_str, NULL, NULL);
if (type == RGB) if (type == RGB)
info_dialog_add_field (info_win, "Shades of Color: ", iwd->shades_str); info_dialog_add_field (info_win, "Shades of Color: ", iwd->shades_str, NULL, NULL);
else if (type == INDEXED) else if (type == INDEXED)
info_dialog_add_field (info_win, "Shades: ", iwd->shades_str); info_dialog_add_field (info_win, "Shades: ", iwd->shades_str, NULL, NULL);
else if (type == GRAY) else if (type == GRAY)
info_dialog_add_field (info_win, "Shades of Gray: ", iwd->shades_str); info_dialog_add_field (info_win, "Shades of Gray: ", iwd->shades_str, NULL, NULL);
/* update the fields */ /* update the fields */
info_window_update (info_win, gdisp_ptr); info_window_update (info_win, gdisp_ptr);

View File

@ -160,6 +160,11 @@ create_ink_options ()
/* the main vbox */ /* the main vbox */
vbox = gtk_vbox_new (FALSE, 1); vbox = gtk_vbox_new (FALSE, 1);
/* the main label */
label = gtk_label_new ("Ink Options");
gtk_box_pack_start (GTK_BOX (vbox), label, FALSE, FALSE, 0);
gtk_widget_show (label);
/* size slider */ /* size slider */
hbox = gtk_hbox_new (FALSE, 2); hbox = gtk_hbox_new (FALSE, 2);
gtk_box_pack_start (GTK_BOX(vbox), hbox, FALSE, FALSE, 0); gtk_box_pack_start (GTK_BOX(vbox), hbox, FALSE, FALSE, 0);

View File

@ -160,6 +160,11 @@ create_ink_options ()
/* the main vbox */ /* the main vbox */
vbox = gtk_vbox_new (FALSE, 1); vbox = gtk_vbox_new (FALSE, 1);
/* the main label */
label = gtk_label_new ("Ink Options");
gtk_box_pack_start (GTK_BOX (vbox), label, FALSE, FALSE, 0);
gtk_widget_show (label);
/* size slider */ /* size slider */
hbox = gtk_hbox_new (FALSE, 2); hbox = gtk_hbox_new (FALSE, 2);
gtk_box_pack_start (GTK_BOX(vbox), hbox, FALSE, FALSE, 0); gtk_box_pack_start (GTK_BOX(vbox), hbox, FALSE, FALSE, 0);

View File

@ -70,11 +70,11 @@ perspective_tool_transform (tool, gdisp_ptr, state)
{ {
transform_info = info_dialog_new ("Perspective Transform Information"); transform_info = info_dialog_new ("Perspective Transform Information");
info_dialog_add_field (transform_info, "Matrix: ", info_dialog_add_field (transform_info, "Matrix: ",
matrix_row_buf[0]); matrix_row_buf[0], NULL, NULL);
info_dialog_add_field (transform_info, " ", info_dialog_add_field (transform_info, " ",
matrix_row_buf[1]); matrix_row_buf[1], NULL, NULL);
info_dialog_add_field (transform_info, " ", info_dialog_add_field (transform_info, " ",
matrix_row_buf[2]); matrix_row_buf[2], NULL, NULL);
} }
transform_core->trans_info [X0] = (double) transform_core->x1; transform_core->trans_info [X0] = (double) transform_core->x1;
@ -212,7 +212,6 @@ perspective_tool_motion (tool, gdisp_ptr)
} }
} }
static void * static void *
perspective_tool_recalc (tool, gdisp_ptr) perspective_tool_recalc (tool, gdisp_ptr)
Tool * tool; Tool * tool;

View File

@ -185,7 +185,7 @@ create_selection_options (ToolType tool_type)
/* Widgets for fixed size select */ /* Widgets for fixed size select */
if (tool_type == RECT_SELECT || tool_type == ELLIPSE_SELECT) if (tool_type == RECT_SELECT || tool_type == ELLIPSE_SELECT)
{ {
fixed_size_toggle = gtk_check_button_new_with_label ("Fixed size"); fixed_size_toggle = gtk_check_button_new_with_label ("Fixed size / aspect ratio");
gtk_box_pack_start (GTK_BOX(vbox), fixed_size_toggle, FALSE, FALSE, 0); gtk_box_pack_start (GTK_BOX(vbox), fixed_size_toggle, FALSE, FALSE, 0);
gtk_signal_connect (GTK_OBJECT(fixed_size_toggle), "toggled", gtk_signal_connect (GTK_OBJECT(fixed_size_toggle), "toggled",
(GtkSignalFunc)selection_toggle_update, (GtkSignalFunc)selection_toggle_update,

View File

@ -58,6 +58,12 @@ static void rotate_tool_motion (Tool *, void *);
static void rotate_info_update (Tool *); static void rotate_info_update (Tool *);
static Argument * rotate_invoker (Argument *); static Argument * rotate_invoker (Argument *);
/* callback functions for the info dialog entries */
static void rotate_angle_changed (GtkWidget *entry, gpointer data);
static void rotate_center_x_changed (GtkWidget *entry, gpointer data);
static void rotate_center_y_changed (GtkWidget *entry, gpointer data);
void * void *
rotate_tool_transform (tool, gdisp_ptr, state) rotate_tool_transform (tool, gdisp_ptr, state)
Tool * tool; Tool * tool;
@ -76,9 +82,9 @@ rotate_tool_transform (tool, gdisp_ptr, state)
if (!transform_info) if (!transform_info)
{ {
transform_info = info_dialog_new ("Rotation Information"); transform_info = info_dialog_new ("Rotation Information");
info_dialog_add_field (transform_info, "Angle: ", angle_buf); info_dialog_add_field (transform_info, "Angle: ", angle_buf, (GtkSignalFunc) rotate_angle_changed, tool);
info_dialog_add_field (transform_info, "Center X: ", center_x_buf); info_dialog_add_field (transform_info, "Center X: ", center_x_buf, (GtkSignalFunc) rotate_center_x_changed, tool);
info_dialog_add_field (transform_info, "Center Y: ", center_y_buf); info_dialog_add_field (transform_info, "Center Y: ", center_y_buf, (GtkSignalFunc) rotate_center_y_changed, tool);
} }
transform_core->trans_info[ANGLE] = 0.0; transform_core->trans_info[ANGLE] = 0.0;
@ -145,12 +151,10 @@ static void
rotate_info_update (tool) rotate_info_update (tool)
Tool * tool; Tool * tool;
{ {
GDisplay * gdisp;
TransformCore * transform_core; TransformCore * transform_core;
double angle; double angle;
int cx, cy; int cx, cy;
gdisp = (GDisplay *) tool->gdisp_ptr;
transform_core = (TransformCore *) tool->private; transform_core = (TransformCore *) tool->private;
angle = (transform_core->trans_info[ANGLE] * 180.0) / M_PI; angle = (transform_core->trans_info[ANGLE] * 180.0) / M_PI;
@ -165,6 +169,102 @@ rotate_info_update (tool)
info_dialog_popup (transform_info); info_dialog_popup (transform_info);
} }
static void
rotate_angle_changed (GtkWidget *w,
gpointer data)
{
Tool * tool;
GDisplay * gdisp;
TransformCore * transform_core;
gchar *str;
double value;
tool = (Tool *)data;
if (tool)
{
gdisp = (GDisplay *) tool->gdisp_ptr;
transform_core = (TransformCore *) tool->private;
str = g_strdup (gtk_entry_get_text (GTK_ENTRY (w)));
value = (atof(str) * M_PI) / 180.0;
if (value != transform_core->trans_info[ANGLE])
{
draw_core_pause (transform_core->core, tool);
transform_core->trans_info[ANGLE] = value;
rotate_tool_recalc (tool, gdisp);
draw_core_resume (transform_core->core, tool);
}
g_free (str);
}
}
static void
rotate_center_x_changed (GtkWidget *w,
gpointer data)
{
Tool * tool;
GDisplay * gdisp;
TransformCore * transform_core;
gchar *str;
int value;
tool = (Tool *)data;
if (tool)
{
gdisp = (GDisplay *) tool->gdisp_ptr;
transform_core = (TransformCore *) tool->private;
str = g_strdup (gtk_entry_get_text (GTK_ENTRY (w)));
value = (int) atof(str);
if (value != transform_core->cx)
{
draw_core_pause (transform_core->core, tool);
transform_core->cx = value;
rotate_tool_recalc (tool, gdisp);
draw_core_resume (transform_core->core, tool);
}
g_free (str);
}
}
static void
rotate_center_y_changed (GtkWidget *w,
gpointer data)
{
Tool * tool;
GDisplay * gdisp;
TransformCore * transform_core;
gchar *str;
int value;
tool = (Tool *)data;
if (tool)
{
gdisp = (GDisplay *) tool->gdisp_ptr;
transform_core = (TransformCore *) tool->private;
str = g_strdup (gtk_entry_get_text (GTK_ENTRY (w)));
value = (int) atof(str);
if (value != transform_core->cy)
{
draw_core_pause (transform_core->core, tool);
transform_core->cy = value;
rotate_tool_recalc (tool, gdisp);
draw_core_resume (transform_core->core, tool);
}
g_free (str);
}
}
static void static void
rotate_tool_motion (tool, gdisp_ptr) rotate_tool_motion (tool, gdisp_ptr)
Tool * tool; Tool * tool;

View File

@ -51,6 +51,10 @@ static void scale_tool_motion (Tool *, void *);
static void scale_info_update (Tool *); static void scale_info_update (Tool *);
static Argument * scale_invoker (Argument *); static Argument * scale_invoker (Argument *);
/* callback functions for the info dialog entries */
static void scale_width_changed (GtkWidget *entry, gpointer data);
static void scale_height_changed (GtkWidget *entry, gpointer data);
void * void *
scale_tool_transform (tool, gdisp_ptr, state) scale_tool_transform (tool, gdisp_ptr, state)
Tool * tool; Tool * tool;
@ -69,12 +73,12 @@ scale_tool_transform (tool, gdisp_ptr, state)
if (!transform_info) if (!transform_info)
{ {
transform_info = info_dialog_new ("Scaling Information"); transform_info = info_dialog_new ("Scaling Information");
info_dialog_add_field (transform_info, "Original Width: ", orig_width_buf); info_dialog_add_field (transform_info, "Original Width: ", orig_width_buf, NULL, NULL);
info_dialog_add_field (transform_info, "Original Height: ", orig_height_buf); info_dialog_add_field (transform_info, "Original Height: ", orig_height_buf, NULL, NULL);
info_dialog_add_field (transform_info, "Current Width: ", width_buf); info_dialog_add_field (transform_info, "Current Width: ", width_buf, scale_width_changed, tool);
info_dialog_add_field (transform_info, "Current Height: ", height_buf); info_dialog_add_field (transform_info, "Current Height: ", height_buf, scale_height_changed, tool);
info_dialog_add_field (transform_info, "X Scale Ratio: ", x_ratio_buf); info_dialog_add_field (transform_info, "X Scale Ratio: ", x_ratio_buf, NULL, NULL);
info_dialog_add_field (transform_info, "Y Scale Ratio: ", y_ratio_buf); info_dialog_add_field (transform_info, "Y Scale Ratio: ", y_ratio_buf, NULL, NULL);
} }
transform_core->trans_info [X1] = (double) transform_core->x1; transform_core->trans_info [X1] = (double) transform_core->x1;
@ -181,6 +185,70 @@ scale_info_update (tool)
info_dialog_popup (transform_info); info_dialog_popup (transform_info);
} }
static void
scale_width_changed (GtkWidget *w,
gpointer data)
{
Tool * tool;
TransformCore * transform_core;
GDisplay * gdisp;
gchar *str;
int value;
tool = (Tool *)data;
if (tool)
{
gdisp = (GDisplay *) tool->gdisp_ptr;
transform_core = (TransformCore *) tool->private;
str = g_strdup (gtk_entry_get_text (GTK_ENTRY (w)));
value = (int) atof(str);
if (value != (transform_core->trans_info[X2] - transform_core->trans_info[X1]))
{
draw_core_pause (transform_core->core, tool);
transform_core->trans_info[X2] = transform_core->trans_info[X1] + value;
scale_tool_recalc (tool, gdisp);
draw_core_resume (transform_core->core, tool);
}
g_free (str);
}
}
static void
scale_height_changed (GtkWidget *w,
gpointer data)
{
Tool * tool;
TransformCore * transform_core;
GDisplay * gdisp;
gchar *str;
int value;
tool = (Tool *)data;
if (tool)
{
gdisp = (GDisplay *) tool->gdisp_ptr;
transform_core = (TransformCore *) tool->private;
str = g_strdup (gtk_entry_get_text (GTK_ENTRY (w)));
value = (int) atof(str);
if (value != (transform_core->trans_info[Y2] - transform_core->trans_info[Y1]))
{
draw_core_pause (transform_core->core, tool);
transform_core->trans_info[Y2] = transform_core->trans_info[Y1] + value;
scale_tool_recalc (tool, gdisp);
draw_core_resume (transform_core->core, tool);
}
g_free (str);
}
}
static void static void
scale_tool_motion (tool, gdisp_ptr) scale_tool_motion (tool, gdisp_ptr)
Tool * tool; Tool * tool;

View File

@ -57,6 +57,10 @@ static void shear_tool_motion (Tool *, void *);
static void shear_info_update (Tool *); static void shear_info_update (Tool *);
static Argument * shear_invoker (Argument *); static Argument * shear_invoker (Argument *);
/* Info dialog callback funtions */
static void shear_x_mag_changed (GtkWidget *, gpointer);
static void shear_y_mag_changed (GtkWidget *, gpointer);
void * void *
shear_tool_transform (tool, gdisp_ptr, state) shear_tool_transform (tool, gdisp_ptr, state)
Tool * tool; Tool * tool;
@ -75,8 +79,8 @@ shear_tool_transform (tool, gdisp_ptr, state)
if (!transform_info) if (!transform_info)
{ {
transform_info = info_dialog_new ("Shear Information"); transform_info = info_dialog_new ("Shear Information");
info_dialog_add_field (transform_info, "X Shear Magnitude: ", xshear_buf); info_dialog_add_field (transform_info, "X Shear Magnitude: ", xshear_buf, shear_x_mag_changed, tool);
info_dialog_add_field (transform_info, "Y Shear Magnitude: ", yshear_buf); info_dialog_add_field (transform_info, "Y Shear Magnitude: ", yshear_buf, shear_y_mag_changed, tool);
} }
direction_unknown = 1; direction_unknown = 1;
transform_core->trans_info[HORZ_OR_VERT] = HORZ; transform_core->trans_info[HORZ_OR_VERT] = HORZ;
@ -150,6 +154,69 @@ shear_info_update (tool)
info_dialog_popup (transform_info); info_dialog_popup (transform_info);
} }
static void
shear_x_mag_changed (GtkWidget *w,
gpointer data)
{
Tool * tool;
TransformCore * transform_core;
GDisplay * gdisp;
gchar *str;
int value;
tool = (Tool *)data;
if (tool)
{
gdisp = (GDisplay *) tool->gdisp_ptr;
transform_core = (TransformCore *) tool->private;
str = g_strdup (gtk_entry_get_text (GTK_ENTRY (w)));
value = (int) atof(str);
if (value != transform_core->trans_info[XSHEAR])
{
draw_core_pause (transform_core->core, tool);
transform_core->trans_info[XSHEAR] = value;
shear_tool_recalc (tool, gdisp);
draw_core_resume (transform_core->core, tool);
}
g_free (str);
}
}
static void
shear_y_mag_changed (GtkWidget *w,
gpointer data)
{
Tool * tool;
TransformCore * transform_core;
GDisplay * gdisp;
gchar *str;
int value;
tool = (Tool *)data;
if (tool)
{
gdisp = (GDisplay *) tool->gdisp_ptr;
transform_core = (TransformCore *) tool->private;
str = g_strdup (gtk_entry_get_text (GTK_ENTRY (w)));
value = (int) atof(str);
if (value != transform_core->trans_info[YSHEAR])
{
draw_core_pause (transform_core->core, tool);
transform_core->trans_info[YSHEAR] = value;
shear_tool_recalc (tool, gdisp);
draw_core_resume (transform_core->core, tool);
}
g_free (str);
}
}
static void static void
shear_tool_motion (tool, gdisp_ptr) shear_tool_motion (tool, gdisp_ptr)

View File

@ -153,26 +153,26 @@ color_picker_button_press (Tool *tool,
switch (drawable_type (active_drawable)) switch (drawable_type (active_drawable))
{ {
case RGB_GIMAGE: case RGBA_GIMAGE: case RGB_GIMAGE: case RGBA_GIMAGE:
info_dialog_add_field (color_picker_info, "Red", red_buf); info_dialog_add_field (color_picker_info, "Red", red_buf, NULL, NULL);
info_dialog_add_field (color_picker_info, "Green", green_buf); info_dialog_add_field (color_picker_info, "Green", green_buf, NULL, NULL);
info_dialog_add_field (color_picker_info, "Blue", blue_buf); info_dialog_add_field (color_picker_info, "Blue", blue_buf, NULL, NULL);
info_dialog_add_field (color_picker_info, "Alpha", alpha_buf); info_dialog_add_field (color_picker_info, "Alpha", alpha_buf, NULL, NULL);
info_dialog_add_field (color_picker_info, "Hex Triplet", hex_buf); info_dialog_add_field (color_picker_info, "Hex Triplet", hex_buf, NULL, NULL);
break; break;
case INDEXED_GIMAGE: case INDEXEDA_GIMAGE: case INDEXED_GIMAGE: case INDEXEDA_GIMAGE:
info_dialog_add_field (color_picker_info, "Index", index_buf); info_dialog_add_field (color_picker_info, "Index", index_buf, NULL, NULL);
info_dialog_add_field (color_picker_info, "Alpha", alpha_buf); info_dialog_add_field (color_picker_info, "Alpha", alpha_buf, NULL, NULL);
info_dialog_add_field (color_picker_info, "Red", red_buf); info_dialog_add_field (color_picker_info, "Red", red_buf, NULL, NULL);
info_dialog_add_field (color_picker_info, "Green", green_buf); info_dialog_add_field (color_picker_info, "Green", green_buf, NULL, NULL);
info_dialog_add_field (color_picker_info, "Blue", blue_buf); info_dialog_add_field (color_picker_info, "Blue", blue_buf, NULL, NULL);
info_dialog_add_field (color_picker_info, "Hex Triplet", hex_buf); info_dialog_add_field (color_picker_info, "Hex Triplet", hex_buf, NULL, NULL);
break; break;
case GRAY_GIMAGE: case GRAYA_GIMAGE: case GRAY_GIMAGE: case GRAYA_GIMAGE:
info_dialog_add_field (color_picker_info, "Intensity", gray_buf); info_dialog_add_field (color_picker_info, "Intensity", gray_buf, NULL, NULL);
info_dialog_add_field (color_picker_info, "Alpha", alpha_buf); info_dialog_add_field (color_picker_info, "Alpha", alpha_buf, NULL, NULL);
info_dialog_add_field (color_picker_info, "Hex Triplet", hex_buf); info_dialog_add_field (color_picker_info, "Hex Triplet", hex_buf, NULL, NULL);
break; break;
default : default :

View File

@ -97,6 +97,12 @@ static void crop_ok_callback (GtkWidget *, gpointer);
static void crop_selection_callback (GtkWidget *, gpointer); static void crop_selection_callback (GtkWidget *, gpointer);
static void crop_close_callback (GtkWidget *, gpointer); static void crop_close_callback (GtkWidget *, gpointer);
/* Crop dialog callback funtions */
static void crop_orig_x_changed (GtkWidget *, gpointer);
static void crop_orig_y_changed (GtkWidget *, gpointer);
static void crop_width_changed (GtkWidget *, gpointer);
static void crop_height_changed (GtkWidget *, gpointer);
static void *crop_options = NULL; static void *crop_options = NULL;
static Argument *crop_invoker (Argument *); static Argument *crop_invoker (Argument *);
@ -719,10 +725,10 @@ crop_info_create (Tool *tool)
crop_info = info_dialog_new ("Crop Information"); crop_info = info_dialog_new ("Crop Information");
/* add the information fields */ /* add the information fields */
info_dialog_add_field (crop_info, "X Origin: ", orig_x_buf); info_dialog_add_field (crop_info, "X Origin: ", orig_x_buf, crop_orig_x_changed, tool);
info_dialog_add_field (crop_info, "Y Origin: ", orig_y_buf); info_dialog_add_field (crop_info, "Y Origin: ", orig_y_buf, crop_orig_y_changed, tool);
info_dialog_add_field (crop_info, "Width: ", width_buf); info_dialog_add_field (crop_info, "Width: ", width_buf, crop_width_changed, tool);
info_dialog_add_field (crop_info, "Height: ", height_buf); info_dialog_add_field (crop_info, "Height: ", height_buf, crop_height_changed, tool);
/* Create the action area */ /* Create the action area */
build_action_area (GTK_DIALOG (crop_info->shell), action_items, 3, 0); build_action_area (GTK_DIALOG (crop_info->shell), action_items, 3, 0);
@ -800,6 +806,135 @@ crop_close_callback (GtkWidget *w,
tool->state = INACTIVE; tool->state = INACTIVE;
} }
static void
crop_orig_x_changed (GtkWidget *w,
gpointer data)
{
Tool * tool;
Crop * crop;
GDisplay * gdisp;
gchar *str;
int value;
tool = (Tool *)data;
if (tool)
{
gdisp = (GDisplay *) tool->gdisp_ptr;
crop = (Crop *) tool->private;
str = g_strdup (gtk_entry_get_text (GTK_ENTRY (w)));
value = (int) atof(str);
if (value != crop->tx1)
{
draw_core_pause (crop->core, tool);
crop->tx2 = crop->tx2 + (value - crop->tx1);
crop->tx1 = value;
crop_recalc (tool, crop);
draw_core_resume (crop->core, tool);
}
g_free (str);
}
}
static void
crop_orig_y_changed (GtkWidget *w,
gpointer data)
{
Tool * tool;
Crop * crop;
GDisplay * gdisp;
gchar *str;
int value;
tool = (Tool *)data;
if (tool)
{
gdisp = (GDisplay *) tool->gdisp_ptr;
crop = (Crop *) tool->private;
str = g_strdup (gtk_entry_get_text (GTK_ENTRY (w)));
value = (int) atof(str);
if (value != crop->ty1)
{
draw_core_pause (crop->core, tool);
crop->ty2 = crop->ty2 + (value - crop->ty1);
crop->ty1 = value;
crop_recalc (tool, crop);
draw_core_resume (crop->core, tool);
}
g_free (str);
}
}
static void
crop_width_changed (GtkWidget *w,
gpointer data)
{
Tool * tool;
Crop * crop;
GDisplay * gdisp;
gchar *str;
int value;
tool = (Tool *)data;
if (tool)
{
gdisp = (GDisplay *) tool->gdisp_ptr;
crop = (Crop *) tool->private;
str = g_strdup (gtk_entry_get_text (GTK_ENTRY (w)));
value = (int) atof(str);
if (value != (crop->tx2 - crop->tx1));
{
draw_core_pause (crop->core, tool);
crop->tx2 = value + crop->tx1;
crop_recalc (tool, crop);
draw_core_resume (crop->core, tool);
}
g_free (str);
}
}
static void
crop_height_changed (GtkWidget *w,
gpointer data)
{
Tool * tool;
Crop * crop;
GDisplay * gdisp;
gchar *str;
int value;
tool = (Tool *)data;
if (tool)
{
gdisp = (GDisplay *) tool->gdisp_ptr;
crop = (Crop *) tool->private;
str = g_strdup (gtk_entry_get_text (GTK_ENTRY (w)));
value = (int) atof(str);
if (value != (crop->ty2 - crop->ty1));
{
draw_core_pause (crop->core, tool);
crop->ty2 = value + crop->ty1;
crop_recalc (tool, crop);
draw_core_resume (crop->core, tool);
}
g_free (str);
}
}
/* The procedure definition */ /* The procedure definition */
ProcArg crop_args[] = ProcArg crop_args[] =

View File

@ -97,6 +97,12 @@ static void crop_ok_callback (GtkWidget *, gpointer);
static void crop_selection_callback (GtkWidget *, gpointer); static void crop_selection_callback (GtkWidget *, gpointer);
static void crop_close_callback (GtkWidget *, gpointer); static void crop_close_callback (GtkWidget *, gpointer);
/* Crop dialog callback funtions */
static void crop_orig_x_changed (GtkWidget *, gpointer);
static void crop_orig_y_changed (GtkWidget *, gpointer);
static void crop_width_changed (GtkWidget *, gpointer);
static void crop_height_changed (GtkWidget *, gpointer);
static void *crop_options = NULL; static void *crop_options = NULL;
static Argument *crop_invoker (Argument *); static Argument *crop_invoker (Argument *);
@ -719,10 +725,10 @@ crop_info_create (Tool *tool)
crop_info = info_dialog_new ("Crop Information"); crop_info = info_dialog_new ("Crop Information");
/* add the information fields */ /* add the information fields */
info_dialog_add_field (crop_info, "X Origin: ", orig_x_buf); info_dialog_add_field (crop_info, "X Origin: ", orig_x_buf, crop_orig_x_changed, tool);
info_dialog_add_field (crop_info, "Y Origin: ", orig_y_buf); info_dialog_add_field (crop_info, "Y Origin: ", orig_y_buf, crop_orig_y_changed, tool);
info_dialog_add_field (crop_info, "Width: ", width_buf); info_dialog_add_field (crop_info, "Width: ", width_buf, crop_width_changed, tool);
info_dialog_add_field (crop_info, "Height: ", height_buf); info_dialog_add_field (crop_info, "Height: ", height_buf, crop_height_changed, tool);
/* Create the action area */ /* Create the action area */
build_action_area (GTK_DIALOG (crop_info->shell), action_items, 3, 0); build_action_area (GTK_DIALOG (crop_info->shell), action_items, 3, 0);
@ -800,6 +806,135 @@ crop_close_callback (GtkWidget *w,
tool->state = INACTIVE; tool->state = INACTIVE;
} }
static void
crop_orig_x_changed (GtkWidget *w,
gpointer data)
{
Tool * tool;
Crop * crop;
GDisplay * gdisp;
gchar *str;
int value;
tool = (Tool *)data;
if (tool)
{
gdisp = (GDisplay *) tool->gdisp_ptr;
crop = (Crop *) tool->private;
str = g_strdup (gtk_entry_get_text (GTK_ENTRY (w)));
value = (int) atof(str);
if (value != crop->tx1)
{
draw_core_pause (crop->core, tool);
crop->tx2 = crop->tx2 + (value - crop->tx1);
crop->tx1 = value;
crop_recalc (tool, crop);
draw_core_resume (crop->core, tool);
}
g_free (str);
}
}
static void
crop_orig_y_changed (GtkWidget *w,
gpointer data)
{
Tool * tool;
Crop * crop;
GDisplay * gdisp;
gchar *str;
int value;
tool = (Tool *)data;
if (tool)
{
gdisp = (GDisplay *) tool->gdisp_ptr;
crop = (Crop *) tool->private;
str = g_strdup (gtk_entry_get_text (GTK_ENTRY (w)));
value = (int) atof(str);
if (value != crop->ty1)
{
draw_core_pause (crop->core, tool);
crop->ty2 = crop->ty2 + (value - crop->ty1);
crop->ty1 = value;
crop_recalc (tool, crop);
draw_core_resume (crop->core, tool);
}
g_free (str);
}
}
static void
crop_width_changed (GtkWidget *w,
gpointer data)
{
Tool * tool;
Crop * crop;
GDisplay * gdisp;
gchar *str;
int value;
tool = (Tool *)data;
if (tool)
{
gdisp = (GDisplay *) tool->gdisp_ptr;
crop = (Crop *) tool->private;
str = g_strdup (gtk_entry_get_text (GTK_ENTRY (w)));
value = (int) atof(str);
if (value != (crop->tx2 - crop->tx1));
{
draw_core_pause (crop->core, tool);
crop->tx2 = value + crop->tx1;
crop_recalc (tool, crop);
draw_core_resume (crop->core, tool);
}
g_free (str);
}
}
static void
crop_height_changed (GtkWidget *w,
gpointer data)
{
Tool * tool;
Crop * crop;
GDisplay * gdisp;
gchar *str;
int value;
tool = (Tool *)data;
if (tool)
{
gdisp = (GDisplay *) tool->gdisp_ptr;
crop = (Crop *) tool->private;
str = g_strdup (gtk_entry_get_text (GTK_ENTRY (w)));
value = (int) atof(str);
if (value != (crop->ty2 - crop->ty1));
{
draw_core_pause (crop->core, tool);
crop->ty2 = value + crop->ty1;
crop_recalc (tool, crop);
draw_core_resume (crop->core, tool);
}
g_free (str);
}
}
/* The procedure definition */ /* The procedure definition */
ProcArg crop_args[] = ProcArg crop_args[] =

View File

@ -160,6 +160,11 @@ create_ink_options ()
/* the main vbox */ /* the main vbox */
vbox = gtk_vbox_new (FALSE, 1); vbox = gtk_vbox_new (FALSE, 1);
/* the main label */
label = gtk_label_new ("Ink Options");
gtk_box_pack_start (GTK_BOX (vbox), label, FALSE, FALSE, 0);
gtk_widget_show (label);
/* size slider */ /* size slider */
hbox = gtk_hbox_new (FALSE, 2); hbox = gtk_hbox_new (FALSE, 2);
gtk_box_pack_start (GTK_BOX(vbox), hbox, FALSE, FALSE, 0); gtk_box_pack_start (GTK_BOX(vbox), hbox, FALSE, FALSE, 0);

View File

@ -70,11 +70,11 @@ perspective_tool_transform (tool, gdisp_ptr, state)
{ {
transform_info = info_dialog_new ("Perspective Transform Information"); transform_info = info_dialog_new ("Perspective Transform Information");
info_dialog_add_field (transform_info, "Matrix: ", info_dialog_add_field (transform_info, "Matrix: ",
matrix_row_buf[0]); matrix_row_buf[0], NULL, NULL);
info_dialog_add_field (transform_info, " ", info_dialog_add_field (transform_info, " ",
matrix_row_buf[1]); matrix_row_buf[1], NULL, NULL);
info_dialog_add_field (transform_info, " ", info_dialog_add_field (transform_info, " ",
matrix_row_buf[2]); matrix_row_buf[2], NULL, NULL);
} }
transform_core->trans_info [X0] = (double) transform_core->x1; transform_core->trans_info [X0] = (double) transform_core->x1;
@ -212,7 +212,6 @@ perspective_tool_motion (tool, gdisp_ptr)
} }
} }
static void * static void *
perspective_tool_recalc (tool, gdisp_ptr) perspective_tool_recalc (tool, gdisp_ptr)
Tool * tool; Tool * tool;

View File

@ -185,7 +185,7 @@ create_selection_options (ToolType tool_type)
/* Widgets for fixed size select */ /* Widgets for fixed size select */
if (tool_type == RECT_SELECT || tool_type == ELLIPSE_SELECT) if (tool_type == RECT_SELECT || tool_type == ELLIPSE_SELECT)
{ {
fixed_size_toggle = gtk_check_button_new_with_label ("Fixed size"); fixed_size_toggle = gtk_check_button_new_with_label ("Fixed size / aspect ratio");
gtk_box_pack_start (GTK_BOX(vbox), fixed_size_toggle, FALSE, FALSE, 0); gtk_box_pack_start (GTK_BOX(vbox), fixed_size_toggle, FALSE, FALSE, 0);
gtk_signal_connect (GTK_OBJECT(fixed_size_toggle), "toggled", gtk_signal_connect (GTK_OBJECT(fixed_size_toggle), "toggled",
(GtkSignalFunc)selection_toggle_update, (GtkSignalFunc)selection_toggle_update,

View File

@ -58,6 +58,12 @@ static void rotate_tool_motion (Tool *, void *);
static void rotate_info_update (Tool *); static void rotate_info_update (Tool *);
static Argument * rotate_invoker (Argument *); static Argument * rotate_invoker (Argument *);
/* callback functions for the info dialog entries */
static void rotate_angle_changed (GtkWidget *entry, gpointer data);
static void rotate_center_x_changed (GtkWidget *entry, gpointer data);
static void rotate_center_y_changed (GtkWidget *entry, gpointer data);
void * void *
rotate_tool_transform (tool, gdisp_ptr, state) rotate_tool_transform (tool, gdisp_ptr, state)
Tool * tool; Tool * tool;
@ -76,9 +82,9 @@ rotate_tool_transform (tool, gdisp_ptr, state)
if (!transform_info) if (!transform_info)
{ {
transform_info = info_dialog_new ("Rotation Information"); transform_info = info_dialog_new ("Rotation Information");
info_dialog_add_field (transform_info, "Angle: ", angle_buf); info_dialog_add_field (transform_info, "Angle: ", angle_buf, (GtkSignalFunc) rotate_angle_changed, tool);
info_dialog_add_field (transform_info, "Center X: ", center_x_buf); info_dialog_add_field (transform_info, "Center X: ", center_x_buf, (GtkSignalFunc) rotate_center_x_changed, tool);
info_dialog_add_field (transform_info, "Center Y: ", center_y_buf); info_dialog_add_field (transform_info, "Center Y: ", center_y_buf, (GtkSignalFunc) rotate_center_y_changed, tool);
} }
transform_core->trans_info[ANGLE] = 0.0; transform_core->trans_info[ANGLE] = 0.0;
@ -145,12 +151,10 @@ static void
rotate_info_update (tool) rotate_info_update (tool)
Tool * tool; Tool * tool;
{ {
GDisplay * gdisp;
TransformCore * transform_core; TransformCore * transform_core;
double angle; double angle;
int cx, cy; int cx, cy;
gdisp = (GDisplay *) tool->gdisp_ptr;
transform_core = (TransformCore *) tool->private; transform_core = (TransformCore *) tool->private;
angle = (transform_core->trans_info[ANGLE] * 180.0) / M_PI; angle = (transform_core->trans_info[ANGLE] * 180.0) / M_PI;
@ -165,6 +169,102 @@ rotate_info_update (tool)
info_dialog_popup (transform_info); info_dialog_popup (transform_info);
} }
static void
rotate_angle_changed (GtkWidget *w,
gpointer data)
{
Tool * tool;
GDisplay * gdisp;
TransformCore * transform_core;
gchar *str;
double value;
tool = (Tool *)data;
if (tool)
{
gdisp = (GDisplay *) tool->gdisp_ptr;
transform_core = (TransformCore *) tool->private;
str = g_strdup (gtk_entry_get_text (GTK_ENTRY (w)));
value = (atof(str) * M_PI) / 180.0;
if (value != transform_core->trans_info[ANGLE])
{
draw_core_pause (transform_core->core, tool);
transform_core->trans_info[ANGLE] = value;
rotate_tool_recalc (tool, gdisp);
draw_core_resume (transform_core->core, tool);
}
g_free (str);
}
}
static void
rotate_center_x_changed (GtkWidget *w,
gpointer data)
{
Tool * tool;
GDisplay * gdisp;
TransformCore * transform_core;
gchar *str;
int value;
tool = (Tool *)data;
if (tool)
{
gdisp = (GDisplay *) tool->gdisp_ptr;
transform_core = (TransformCore *) tool->private;
str = g_strdup (gtk_entry_get_text (GTK_ENTRY (w)));
value = (int) atof(str);
if (value != transform_core->cx)
{
draw_core_pause (transform_core->core, tool);
transform_core->cx = value;
rotate_tool_recalc (tool, gdisp);
draw_core_resume (transform_core->core, tool);
}
g_free (str);
}
}
static void
rotate_center_y_changed (GtkWidget *w,
gpointer data)
{
Tool * tool;
GDisplay * gdisp;
TransformCore * transform_core;
gchar *str;
int value;
tool = (Tool *)data;
if (tool)
{
gdisp = (GDisplay *) tool->gdisp_ptr;
transform_core = (TransformCore *) tool->private;
str = g_strdup (gtk_entry_get_text (GTK_ENTRY (w)));
value = (int) atof(str);
if (value != transform_core->cy)
{
draw_core_pause (transform_core->core, tool);
transform_core->cy = value;
rotate_tool_recalc (tool, gdisp);
draw_core_resume (transform_core->core, tool);
}
g_free (str);
}
}
static void static void
rotate_tool_motion (tool, gdisp_ptr) rotate_tool_motion (tool, gdisp_ptr)
Tool * tool; Tool * tool;

View File

@ -51,6 +51,10 @@ static void scale_tool_motion (Tool *, void *);
static void scale_info_update (Tool *); static void scale_info_update (Tool *);
static Argument * scale_invoker (Argument *); static Argument * scale_invoker (Argument *);
/* callback functions for the info dialog entries */
static void scale_width_changed (GtkWidget *entry, gpointer data);
static void scale_height_changed (GtkWidget *entry, gpointer data);
void * void *
scale_tool_transform (tool, gdisp_ptr, state) scale_tool_transform (tool, gdisp_ptr, state)
Tool * tool; Tool * tool;
@ -69,12 +73,12 @@ scale_tool_transform (tool, gdisp_ptr, state)
if (!transform_info) if (!transform_info)
{ {
transform_info = info_dialog_new ("Scaling Information"); transform_info = info_dialog_new ("Scaling Information");
info_dialog_add_field (transform_info, "Original Width: ", orig_width_buf); info_dialog_add_field (transform_info, "Original Width: ", orig_width_buf, NULL, NULL);
info_dialog_add_field (transform_info, "Original Height: ", orig_height_buf); info_dialog_add_field (transform_info, "Original Height: ", orig_height_buf, NULL, NULL);
info_dialog_add_field (transform_info, "Current Width: ", width_buf); info_dialog_add_field (transform_info, "Current Width: ", width_buf, scale_width_changed, tool);
info_dialog_add_field (transform_info, "Current Height: ", height_buf); info_dialog_add_field (transform_info, "Current Height: ", height_buf, scale_height_changed, tool);
info_dialog_add_field (transform_info, "X Scale Ratio: ", x_ratio_buf); info_dialog_add_field (transform_info, "X Scale Ratio: ", x_ratio_buf, NULL, NULL);
info_dialog_add_field (transform_info, "Y Scale Ratio: ", y_ratio_buf); info_dialog_add_field (transform_info, "Y Scale Ratio: ", y_ratio_buf, NULL, NULL);
} }
transform_core->trans_info [X1] = (double) transform_core->x1; transform_core->trans_info [X1] = (double) transform_core->x1;
@ -181,6 +185,70 @@ scale_info_update (tool)
info_dialog_popup (transform_info); info_dialog_popup (transform_info);
} }
static void
scale_width_changed (GtkWidget *w,
gpointer data)
{
Tool * tool;
TransformCore * transform_core;
GDisplay * gdisp;
gchar *str;
int value;
tool = (Tool *)data;
if (tool)
{
gdisp = (GDisplay *) tool->gdisp_ptr;
transform_core = (TransformCore *) tool->private;
str = g_strdup (gtk_entry_get_text (GTK_ENTRY (w)));
value = (int) atof(str);
if (value != (transform_core->trans_info[X2] - transform_core->trans_info[X1]))
{
draw_core_pause (transform_core->core, tool);
transform_core->trans_info[X2] = transform_core->trans_info[X1] + value;
scale_tool_recalc (tool, gdisp);
draw_core_resume (transform_core->core, tool);
}
g_free (str);
}
}
static void
scale_height_changed (GtkWidget *w,
gpointer data)
{
Tool * tool;
TransformCore * transform_core;
GDisplay * gdisp;
gchar *str;
int value;
tool = (Tool *)data;
if (tool)
{
gdisp = (GDisplay *) tool->gdisp_ptr;
transform_core = (TransformCore *) tool->private;
str = g_strdup (gtk_entry_get_text (GTK_ENTRY (w)));
value = (int) atof(str);
if (value != (transform_core->trans_info[Y2] - transform_core->trans_info[Y1]))
{
draw_core_pause (transform_core->core, tool);
transform_core->trans_info[Y2] = transform_core->trans_info[Y1] + value;
scale_tool_recalc (tool, gdisp);
draw_core_resume (transform_core->core, tool);
}
g_free (str);
}
}
static void static void
scale_tool_motion (tool, gdisp_ptr) scale_tool_motion (tool, gdisp_ptr)
Tool * tool; Tool * tool;

View File

@ -57,6 +57,10 @@ static void shear_tool_motion (Tool *, void *);
static void shear_info_update (Tool *); static void shear_info_update (Tool *);
static Argument * shear_invoker (Argument *); static Argument * shear_invoker (Argument *);
/* Info dialog callback funtions */
static void shear_x_mag_changed (GtkWidget *, gpointer);
static void shear_y_mag_changed (GtkWidget *, gpointer);
void * void *
shear_tool_transform (tool, gdisp_ptr, state) shear_tool_transform (tool, gdisp_ptr, state)
Tool * tool; Tool * tool;
@ -75,8 +79,8 @@ shear_tool_transform (tool, gdisp_ptr, state)
if (!transform_info) if (!transform_info)
{ {
transform_info = info_dialog_new ("Shear Information"); transform_info = info_dialog_new ("Shear Information");
info_dialog_add_field (transform_info, "X Shear Magnitude: ", xshear_buf); info_dialog_add_field (transform_info, "X Shear Magnitude: ", xshear_buf, shear_x_mag_changed, tool);
info_dialog_add_field (transform_info, "Y Shear Magnitude: ", yshear_buf); info_dialog_add_field (transform_info, "Y Shear Magnitude: ", yshear_buf, shear_y_mag_changed, tool);
} }
direction_unknown = 1; direction_unknown = 1;
transform_core->trans_info[HORZ_OR_VERT] = HORZ; transform_core->trans_info[HORZ_OR_VERT] = HORZ;
@ -150,6 +154,69 @@ shear_info_update (tool)
info_dialog_popup (transform_info); info_dialog_popup (transform_info);
} }
static void
shear_x_mag_changed (GtkWidget *w,
gpointer data)
{
Tool * tool;
TransformCore * transform_core;
GDisplay * gdisp;
gchar *str;
int value;
tool = (Tool *)data;
if (tool)
{
gdisp = (GDisplay *) tool->gdisp_ptr;
transform_core = (TransformCore *) tool->private;
str = g_strdup (gtk_entry_get_text (GTK_ENTRY (w)));
value = (int) atof(str);
if (value != transform_core->trans_info[XSHEAR])
{
draw_core_pause (transform_core->core, tool);
transform_core->trans_info[XSHEAR] = value;
shear_tool_recalc (tool, gdisp);
draw_core_resume (transform_core->core, tool);
}
g_free (str);
}
}
static void
shear_y_mag_changed (GtkWidget *w,
gpointer data)
{
Tool * tool;
TransformCore * transform_core;
GDisplay * gdisp;
gchar *str;
int value;
tool = (Tool *)data;
if (tool)
{
gdisp = (GDisplay *) tool->gdisp_ptr;
transform_core = (TransformCore *) tool->private;
str = g_strdup (gtk_entry_get_text (GTK_ENTRY (w)));
value = (int) atof(str);
if (value != transform_core->trans_info[YSHEAR])
{
draw_core_pause (transform_core->core, tool);
transform_core->trans_info[YSHEAR] = value;
shear_tool_recalc (tool, gdisp);
draw_core_resume (transform_core->core, tool);
}
g_free (str);
}
}
static void static void
shear_tool_motion (tool, gdisp_ptr) shear_tool_motion (tool, gdisp_ptr)

View File

@ -160,6 +160,11 @@ create_ink_options ()
/* the main vbox */ /* the main vbox */
vbox = gtk_vbox_new (FALSE, 1); vbox = gtk_vbox_new (FALSE, 1);
/* the main label */
label = gtk_label_new ("Ink Options");
gtk_box_pack_start (GTK_BOX (vbox), label, FALSE, FALSE, 0);
gtk_widget_show (label);
/* size slider */ /* size slider */
hbox = gtk_hbox_new (FALSE, 2); hbox = gtk_hbox_new (FALSE, 2);
gtk_box_pack_start (GTK_BOX(vbox), hbox, FALSE, FALSE, 0); gtk_box_pack_start (GTK_BOX(vbox), hbox, FALSE, FALSE, 0);

View File

@ -70,11 +70,11 @@ perspective_tool_transform (tool, gdisp_ptr, state)
{ {
transform_info = info_dialog_new ("Perspective Transform Information"); transform_info = info_dialog_new ("Perspective Transform Information");
info_dialog_add_field (transform_info, "Matrix: ", info_dialog_add_field (transform_info, "Matrix: ",
matrix_row_buf[0]); matrix_row_buf[0], NULL, NULL);
info_dialog_add_field (transform_info, " ", info_dialog_add_field (transform_info, " ",
matrix_row_buf[1]); matrix_row_buf[1], NULL, NULL);
info_dialog_add_field (transform_info, " ", info_dialog_add_field (transform_info, " ",
matrix_row_buf[2]); matrix_row_buf[2], NULL, NULL);
} }
transform_core->trans_info [X0] = (double) transform_core->x1; transform_core->trans_info [X0] = (double) transform_core->x1;
@ -212,7 +212,6 @@ perspective_tool_motion (tool, gdisp_ptr)
} }
} }
static void * static void *
perspective_tool_recalc (tool, gdisp_ptr) perspective_tool_recalc (tool, gdisp_ptr)
Tool * tool; Tool * tool;

View File

@ -185,7 +185,7 @@ create_selection_options (ToolType tool_type)
/* Widgets for fixed size select */ /* Widgets for fixed size select */
if (tool_type == RECT_SELECT || tool_type == ELLIPSE_SELECT) if (tool_type == RECT_SELECT || tool_type == ELLIPSE_SELECT)
{ {
fixed_size_toggle = gtk_check_button_new_with_label ("Fixed size"); fixed_size_toggle = gtk_check_button_new_with_label ("Fixed size / aspect ratio");
gtk_box_pack_start (GTK_BOX(vbox), fixed_size_toggle, FALSE, FALSE, 0); gtk_box_pack_start (GTK_BOX(vbox), fixed_size_toggle, FALSE, FALSE, 0);
gtk_signal_connect (GTK_OBJECT(fixed_size_toggle), "toggled", gtk_signal_connect (GTK_OBJECT(fixed_size_toggle), "toggled",
(GtkSignalFunc)selection_toggle_update, (GtkSignalFunc)selection_toggle_update,

View File

@ -58,6 +58,12 @@ static void rotate_tool_motion (Tool *, void *);
static void rotate_info_update (Tool *); static void rotate_info_update (Tool *);
static Argument * rotate_invoker (Argument *); static Argument * rotate_invoker (Argument *);
/* callback functions for the info dialog entries */
static void rotate_angle_changed (GtkWidget *entry, gpointer data);
static void rotate_center_x_changed (GtkWidget *entry, gpointer data);
static void rotate_center_y_changed (GtkWidget *entry, gpointer data);
void * void *
rotate_tool_transform (tool, gdisp_ptr, state) rotate_tool_transform (tool, gdisp_ptr, state)
Tool * tool; Tool * tool;
@ -76,9 +82,9 @@ rotate_tool_transform (tool, gdisp_ptr, state)
if (!transform_info) if (!transform_info)
{ {
transform_info = info_dialog_new ("Rotation Information"); transform_info = info_dialog_new ("Rotation Information");
info_dialog_add_field (transform_info, "Angle: ", angle_buf); info_dialog_add_field (transform_info, "Angle: ", angle_buf, (GtkSignalFunc) rotate_angle_changed, tool);
info_dialog_add_field (transform_info, "Center X: ", center_x_buf); info_dialog_add_field (transform_info, "Center X: ", center_x_buf, (GtkSignalFunc) rotate_center_x_changed, tool);
info_dialog_add_field (transform_info, "Center Y: ", center_y_buf); info_dialog_add_field (transform_info, "Center Y: ", center_y_buf, (GtkSignalFunc) rotate_center_y_changed, tool);
} }
transform_core->trans_info[ANGLE] = 0.0; transform_core->trans_info[ANGLE] = 0.0;
@ -145,12 +151,10 @@ static void
rotate_info_update (tool) rotate_info_update (tool)
Tool * tool; Tool * tool;
{ {
GDisplay * gdisp;
TransformCore * transform_core; TransformCore * transform_core;
double angle; double angle;
int cx, cy; int cx, cy;
gdisp = (GDisplay *) tool->gdisp_ptr;
transform_core = (TransformCore *) tool->private; transform_core = (TransformCore *) tool->private;
angle = (transform_core->trans_info[ANGLE] * 180.0) / M_PI; angle = (transform_core->trans_info[ANGLE] * 180.0) / M_PI;
@ -165,6 +169,102 @@ rotate_info_update (tool)
info_dialog_popup (transform_info); info_dialog_popup (transform_info);
} }
static void
rotate_angle_changed (GtkWidget *w,
gpointer data)
{
Tool * tool;
GDisplay * gdisp;
TransformCore * transform_core;
gchar *str;
double value;
tool = (Tool *)data;
if (tool)
{
gdisp = (GDisplay *) tool->gdisp_ptr;
transform_core = (TransformCore *) tool->private;
str = g_strdup (gtk_entry_get_text (GTK_ENTRY (w)));
value = (atof(str) * M_PI) / 180.0;
if (value != transform_core->trans_info[ANGLE])
{
draw_core_pause (transform_core->core, tool);
transform_core->trans_info[ANGLE] = value;
rotate_tool_recalc (tool, gdisp);
draw_core_resume (transform_core->core, tool);
}
g_free (str);
}
}
static void
rotate_center_x_changed (GtkWidget *w,
gpointer data)
{
Tool * tool;
GDisplay * gdisp;
TransformCore * transform_core;
gchar *str;
int value;
tool = (Tool *)data;
if (tool)
{
gdisp = (GDisplay *) tool->gdisp_ptr;
transform_core = (TransformCore *) tool->private;
str = g_strdup (gtk_entry_get_text (GTK_ENTRY (w)));
value = (int) atof(str);
if (value != transform_core->cx)
{
draw_core_pause (transform_core->core, tool);
transform_core->cx = value;
rotate_tool_recalc (tool, gdisp);
draw_core_resume (transform_core->core, tool);
}
g_free (str);
}
}
static void
rotate_center_y_changed (GtkWidget *w,
gpointer data)
{
Tool * tool;
GDisplay * gdisp;
TransformCore * transform_core;
gchar *str;
int value;
tool = (Tool *)data;
if (tool)
{
gdisp = (GDisplay *) tool->gdisp_ptr;
transform_core = (TransformCore *) tool->private;
str = g_strdup (gtk_entry_get_text (GTK_ENTRY (w)));
value = (int) atof(str);
if (value != transform_core->cy)
{
draw_core_pause (transform_core->core, tool);
transform_core->cy = value;
rotate_tool_recalc (tool, gdisp);
draw_core_resume (transform_core->core, tool);
}
g_free (str);
}
}
static void static void
rotate_tool_motion (tool, gdisp_ptr) rotate_tool_motion (tool, gdisp_ptr)
Tool * tool; Tool * tool;

View File

@ -51,6 +51,10 @@ static void scale_tool_motion (Tool *, void *);
static void scale_info_update (Tool *); static void scale_info_update (Tool *);
static Argument * scale_invoker (Argument *); static Argument * scale_invoker (Argument *);
/* callback functions for the info dialog entries */
static void scale_width_changed (GtkWidget *entry, gpointer data);
static void scale_height_changed (GtkWidget *entry, gpointer data);
void * void *
scale_tool_transform (tool, gdisp_ptr, state) scale_tool_transform (tool, gdisp_ptr, state)
Tool * tool; Tool * tool;
@ -69,12 +73,12 @@ scale_tool_transform (tool, gdisp_ptr, state)
if (!transform_info) if (!transform_info)
{ {
transform_info = info_dialog_new ("Scaling Information"); transform_info = info_dialog_new ("Scaling Information");
info_dialog_add_field (transform_info, "Original Width: ", orig_width_buf); info_dialog_add_field (transform_info, "Original Width: ", orig_width_buf, NULL, NULL);
info_dialog_add_field (transform_info, "Original Height: ", orig_height_buf); info_dialog_add_field (transform_info, "Original Height: ", orig_height_buf, NULL, NULL);
info_dialog_add_field (transform_info, "Current Width: ", width_buf); info_dialog_add_field (transform_info, "Current Width: ", width_buf, scale_width_changed, tool);
info_dialog_add_field (transform_info, "Current Height: ", height_buf); info_dialog_add_field (transform_info, "Current Height: ", height_buf, scale_height_changed, tool);
info_dialog_add_field (transform_info, "X Scale Ratio: ", x_ratio_buf); info_dialog_add_field (transform_info, "X Scale Ratio: ", x_ratio_buf, NULL, NULL);
info_dialog_add_field (transform_info, "Y Scale Ratio: ", y_ratio_buf); info_dialog_add_field (transform_info, "Y Scale Ratio: ", y_ratio_buf, NULL, NULL);
} }
transform_core->trans_info [X1] = (double) transform_core->x1; transform_core->trans_info [X1] = (double) transform_core->x1;
@ -181,6 +185,70 @@ scale_info_update (tool)
info_dialog_popup (transform_info); info_dialog_popup (transform_info);
} }
static void
scale_width_changed (GtkWidget *w,
gpointer data)
{
Tool * tool;
TransformCore * transform_core;
GDisplay * gdisp;
gchar *str;
int value;
tool = (Tool *)data;
if (tool)
{
gdisp = (GDisplay *) tool->gdisp_ptr;
transform_core = (TransformCore *) tool->private;
str = g_strdup (gtk_entry_get_text (GTK_ENTRY (w)));
value = (int) atof(str);
if (value != (transform_core->trans_info[X2] - transform_core->trans_info[X1]))
{
draw_core_pause (transform_core->core, tool);
transform_core->trans_info[X2] = transform_core->trans_info[X1] + value;
scale_tool_recalc (tool, gdisp);
draw_core_resume (transform_core->core, tool);
}
g_free (str);
}
}
static void
scale_height_changed (GtkWidget *w,
gpointer data)
{
Tool * tool;
TransformCore * transform_core;
GDisplay * gdisp;
gchar *str;
int value;
tool = (Tool *)data;
if (tool)
{
gdisp = (GDisplay *) tool->gdisp_ptr;
transform_core = (TransformCore *) tool->private;
str = g_strdup (gtk_entry_get_text (GTK_ENTRY (w)));
value = (int) atof(str);
if (value != (transform_core->trans_info[Y2] - transform_core->trans_info[Y1]))
{
draw_core_pause (transform_core->core, tool);
transform_core->trans_info[Y2] = transform_core->trans_info[Y1] + value;
scale_tool_recalc (tool, gdisp);
draw_core_resume (transform_core->core, tool);
}
g_free (str);
}
}
static void static void
scale_tool_motion (tool, gdisp_ptr) scale_tool_motion (tool, gdisp_ptr)
Tool * tool; Tool * tool;

View File

@ -57,6 +57,10 @@ static void shear_tool_motion (Tool *, void *);
static void shear_info_update (Tool *); static void shear_info_update (Tool *);
static Argument * shear_invoker (Argument *); static Argument * shear_invoker (Argument *);
/* Info dialog callback funtions */
static void shear_x_mag_changed (GtkWidget *, gpointer);
static void shear_y_mag_changed (GtkWidget *, gpointer);
void * void *
shear_tool_transform (tool, gdisp_ptr, state) shear_tool_transform (tool, gdisp_ptr, state)
Tool * tool; Tool * tool;
@ -75,8 +79,8 @@ shear_tool_transform (tool, gdisp_ptr, state)
if (!transform_info) if (!transform_info)
{ {
transform_info = info_dialog_new ("Shear Information"); transform_info = info_dialog_new ("Shear Information");
info_dialog_add_field (transform_info, "X Shear Magnitude: ", xshear_buf); info_dialog_add_field (transform_info, "X Shear Magnitude: ", xshear_buf, shear_x_mag_changed, tool);
info_dialog_add_field (transform_info, "Y Shear Magnitude: ", yshear_buf); info_dialog_add_field (transform_info, "Y Shear Magnitude: ", yshear_buf, shear_y_mag_changed, tool);
} }
direction_unknown = 1; direction_unknown = 1;
transform_core->trans_info[HORZ_OR_VERT] = HORZ; transform_core->trans_info[HORZ_OR_VERT] = HORZ;
@ -150,6 +154,69 @@ shear_info_update (tool)
info_dialog_popup (transform_info); info_dialog_popup (transform_info);
} }
static void
shear_x_mag_changed (GtkWidget *w,
gpointer data)
{
Tool * tool;
TransformCore * transform_core;
GDisplay * gdisp;
gchar *str;
int value;
tool = (Tool *)data;
if (tool)
{
gdisp = (GDisplay *) tool->gdisp_ptr;
transform_core = (TransformCore *) tool->private;
str = g_strdup (gtk_entry_get_text (GTK_ENTRY (w)));
value = (int) atof(str);
if (value != transform_core->trans_info[XSHEAR])
{
draw_core_pause (transform_core->core, tool);
transform_core->trans_info[XSHEAR] = value;
shear_tool_recalc (tool, gdisp);
draw_core_resume (transform_core->core, tool);
}
g_free (str);
}
}
static void
shear_y_mag_changed (GtkWidget *w,
gpointer data)
{
Tool * tool;
TransformCore * transform_core;
GDisplay * gdisp;
gchar *str;
int value;
tool = (Tool *)data;
if (tool)
{
gdisp = (GDisplay *) tool->gdisp_ptr;
transform_core = (TransformCore *) tool->private;
str = g_strdup (gtk_entry_get_text (GTK_ENTRY (w)));
value = (int) atof(str);
if (value != transform_core->trans_info[YSHEAR])
{
draw_core_pause (transform_core->core, tool);
transform_core->trans_info[YSHEAR] = value;
shear_tool_recalc (tool, gdisp);
draw_core_resume (transform_core->core, tool);
}
g_free (str);
}
}
static void static void
shear_tool_motion (tool, gdisp_ptr) shear_tool_motion (tool, gdisp_ptr)

View File

@ -79,8 +79,8 @@ transform_ok_callback (GtkWidget *w,
} }
static void static void
transform_cancel_callback (GtkWidget *w, transform_reset_callback (GtkWidget *w,
gpointer client_data) gpointer client_data)
{ {
Tool *tool; Tool *tool;
TransformCore *transform_core; TransformCore *transform_core;
@ -106,7 +106,7 @@ transform_cancel_callback (GtkWidget *w,
static ActionAreaItem action_items[2] = static ActionAreaItem action_items[2] =
{ {
{ NULL, transform_ok_callback, NULL, NULL }, { NULL, transform_ok_callback, NULL, NULL },
{ "Cancel", transform_cancel_callback, NULL, NULL }, { "Reset", transform_reset_callback, NULL, NULL },
}; };
static char *action_labels[4] = static char *action_labels[4] =
@ -607,8 +607,8 @@ transform_core_draw (tool)
if ((transform_core->grid_coords != NULL) && if ((transform_core->grid_coords != NULL) &&
(transform_core->tgrid_coords != NULL) && (transform_core->tgrid_coords != NULL) &&
((tool->type != PERSPECTIVE) || ((tool->type != PERSPECTIVE) ||
(transform_core->transform[0][0] >=0.0) && ((transform_core->transform[0][0] >=0.0) &&
(transform_core->transform[1][1] >=0.0))) (transform_core->transform[1][1] >=0.0))))
{ {
gci = 0; gci = 0;
@ -1196,7 +1196,7 @@ transform_core_do (gimage, drawable, float_tiles, interpolation, matrix)
y2 = y1 + float_tiles->levels[0].height; y2 = y1 + float_tiles->levels[0].height;
/* Find the bounding coordinates */ /* Find the bounding coordinates */
if (active_tool && active_tool->type == PERSPECTIVE && transform_tool_clip ()) if (active_tool && transform_tool_clip ())
{ {
tx1 = x1; tx1 = x1;
ty1 = y1; ty1 = y1;

View File

@ -125,8 +125,8 @@ create_transform_options (void)
/* the new options structure */ /* the new options structure */
options = (TransformOptions *) g_malloc (sizeof (TransformOptions)); options = (TransformOptions *) g_malloc (sizeof (TransformOptions));
options->type = ROTATE; options->type = ROTATE;
options->smoothing = 1; options->smoothing = TRUE;
options->clip = 1; options->clip = FALSE;
options->direction = TRANSFORM_TRADITIONAL; options->direction = TRANSFORM_TRADITIONAL;
options->grid_size = 32; options->grid_size = 32;
options->show_grid = TRUE; options->show_grid = TRUE;
@ -238,7 +238,7 @@ create_transform_options (void)
gtk_widget_show (grid_density); gtk_widget_show (grid_density);
/* the clip resulting image toggle button */ /* the clip resulting image toggle button */
toggle = gtk_check_button_new_with_label ("Clip perspective"); toggle = gtk_check_button_new_with_label ("Clip result");
gtk_box_pack_start (GTK_BOX (vbox), toggle, FALSE, FALSE, 0); gtk_box_pack_start (GTK_BOX (vbox), toggle, FALSE, FALSE, 0);
gtk_signal_connect (GTK_OBJECT (toggle), "toggled", gtk_signal_connect (GTK_OBJECT (toggle), "toggled",
(GtkSignalFunc) transform_toggle_update, (GtkSignalFunc) transform_toggle_update,
@ -324,7 +324,7 @@ int
transform_tool_smoothing () transform_tool_smoothing ()
{ {
if (!transform_options) if (!transform_options)
return 1; return TRUE;
else else
return transform_options->smoothing; return transform_options->smoothing;
} }
@ -333,7 +333,7 @@ int
transform_tool_clip () transform_tool_clip ()
{ {
if (!transform_options) if (!transform_options)
return 1; return FALSE;
else else
return transform_options->clip; return transform_options->clip;
} }

View File

@ -79,8 +79,8 @@ transform_ok_callback (GtkWidget *w,
} }
static void static void
transform_cancel_callback (GtkWidget *w, transform_reset_callback (GtkWidget *w,
gpointer client_data) gpointer client_data)
{ {
Tool *tool; Tool *tool;
TransformCore *transform_core; TransformCore *transform_core;
@ -106,7 +106,7 @@ transform_cancel_callback (GtkWidget *w,
static ActionAreaItem action_items[2] = static ActionAreaItem action_items[2] =
{ {
{ NULL, transform_ok_callback, NULL, NULL }, { NULL, transform_ok_callback, NULL, NULL },
{ "Cancel", transform_cancel_callback, NULL, NULL }, { "Reset", transform_reset_callback, NULL, NULL },
}; };
static char *action_labels[4] = static char *action_labels[4] =
@ -607,8 +607,8 @@ transform_core_draw (tool)
if ((transform_core->grid_coords != NULL) && if ((transform_core->grid_coords != NULL) &&
(transform_core->tgrid_coords != NULL) && (transform_core->tgrid_coords != NULL) &&
((tool->type != PERSPECTIVE) || ((tool->type != PERSPECTIVE) ||
(transform_core->transform[0][0] >=0.0) && ((transform_core->transform[0][0] >=0.0) &&
(transform_core->transform[1][1] >=0.0))) (transform_core->transform[1][1] >=0.0))))
{ {
gci = 0; gci = 0;
@ -1196,7 +1196,7 @@ transform_core_do (gimage, drawable, float_tiles, interpolation, matrix)
y2 = y1 + float_tiles->levels[0].height; y2 = y1 + float_tiles->levels[0].height;
/* Find the bounding coordinates */ /* Find the bounding coordinates */
if (active_tool && active_tool->type == PERSPECTIVE && transform_tool_clip ()) if (active_tool && transform_tool_clip ())
{ {
tx1 = x1; tx1 = x1;
ty1 = y1; ty1 = y1;

View File

@ -125,8 +125,8 @@ create_transform_options (void)
/* the new options structure */ /* the new options structure */
options = (TransformOptions *) g_malloc (sizeof (TransformOptions)); options = (TransformOptions *) g_malloc (sizeof (TransformOptions));
options->type = ROTATE; options->type = ROTATE;
options->smoothing = 1; options->smoothing = TRUE;
options->clip = 1; options->clip = FALSE;
options->direction = TRANSFORM_TRADITIONAL; options->direction = TRANSFORM_TRADITIONAL;
options->grid_size = 32; options->grid_size = 32;
options->show_grid = TRUE; options->show_grid = TRUE;
@ -238,7 +238,7 @@ create_transform_options (void)
gtk_widget_show (grid_density); gtk_widget_show (grid_density);
/* the clip resulting image toggle button */ /* the clip resulting image toggle button */
toggle = gtk_check_button_new_with_label ("Clip perspective"); toggle = gtk_check_button_new_with_label ("Clip result");
gtk_box_pack_start (GTK_BOX (vbox), toggle, FALSE, FALSE, 0); gtk_box_pack_start (GTK_BOX (vbox), toggle, FALSE, FALSE, 0);
gtk_signal_connect (GTK_OBJECT (toggle), "toggled", gtk_signal_connect (GTK_OBJECT (toggle), "toggled",
(GtkSignalFunc) transform_toggle_update, (GtkSignalFunc) transform_toggle_update,
@ -324,7 +324,7 @@ int
transform_tool_smoothing () transform_tool_smoothing ()
{ {
if (!transform_options) if (!transform_options)
return 1; return TRUE;
else else
return transform_options->smoothing; return transform_options->smoothing;
} }
@ -333,7 +333,7 @@ int
transform_tool_clip () transform_tool_clip ()
{ {
if (!transform_options) if (!transform_options)
return 1; return FALSE;
else else
return transform_options->clip; return transform_options->clip;
} }