From aklikins@eos.ncsu.edu Fri Apr 18 16:28:06 1997 Date: Fri, 18 Apr 1997 16:26:43 -0400 (EDT) From: Adrian Likins To: xach@mint.net Subject: FW: Re: [gimp-devel] patch: offset stuff for .99.8 -----FW: <199704181922.PAA09635@eos03a.eos.ncsu.edu>----- Date: Fri, 18 Apr 1997 12:02:46 -0700 From: Peter Mattis To: gimp-developer@xcf.berkeley.edu Subject: Re: [gimp-devel] patch: offset stuff for .99.8 I applied Adrian's new patch and while it worked, I wasn't perfectly happy with the interface. So I changed the check button to a push button which, when clicked, causes the half width and half height to be placed in the text fields. The patch is against a fresh 0.99.8 channel_ops.c file. Also, this patch reverts the arguments to "gimp-channel-ops-offset" to their original values and allows the "swirl-tile" script to work smoothly. Peter --- channel_ops.c.orig Thu Apr 17 17:18:24 1997 +++ channel_ops.c Fri Apr 18 11:39:07 1997 @@ -40,7 +40,6 @@ GtkWidget *off_y_entry; int wrap_around; - int half_height; int transparent; int background; int gimage_id; @@ -53,7 +52,6 @@ int drawable, int wrap_around, int fill_type, - int half_height, int offset_x, int offset_y); @@ -91,6 +89,7 @@ GtkWidget *button; GtkWidget *label; GtkWidget *check; + GtkWidget *push; GtkWidget *toggle; GtkWidget *vbox; GtkWidget *toggle_vbox; @@ -104,7 +103,6 @@ off_d = g_new (OffsetDialog, 1); off_d->wrap_around = TRUE; - off_d->half_height = TRUE; off_d->transparent = drawable_has_alpha (drawable_id); off_d->background = !off_d->transparent; off_d->gimage_id = gimage->ID; @@ -164,11 +162,6 @@ check = gtk_check_button_new_with_label ("Wrap-Around"); gtk_box_pack_start (GTK_BOX (vbox), check, FALSE, FALSE, 0); gtk_widget_show (check); - - /* the by half height and half width offtion */ - check = gtk_check_button_new_with_label ("Offset by (x/2),(y/2)"); - gtk_box_pack_start (GTK_BOX (vbox), check, FALSE, FALSE,0); - gtk_widget_show (check); /* The fill options */ off_d->fill_options = gtk_frame_new ("Fill Options"); @@ -199,6 +192,11 @@ gtk_widget_show (toggle); } + /* the by half height and half width offtion */ + push = gtk_button_new_with_label ("Offset by (x/2),(y/2)"); + gtk_box_pack_start (GTK_BOX (vbox), push, FALSE, FALSE,0); + gtk_widget_show (push); + gtk_widget_show (toggle_vbox); gtk_widget_show (off_d->fill_options); gtk_widget_show (vbox); @@ -209,13 +207,11 @@ (GtkSignalFunc) offset_wraparound_update, off_d); gtk_toggle_button_set_state (GTK_TOGGLE_BUTTON (check), off_d->wrap_around); - - + /* Hook up the by half */ - gtk_signal_connect (GTK_OBJECT (check), "toggled", - (GtkSignalFunc) offset_halfheight_update, - off_d); - gtk_toggle_button_set_state (GTK_TOGGLE_BUTTON (check), off_d->half_height); + gtk_signal_connect (GTK_OBJECT (push), "clicked", + (GtkSignalFunc) offset_halfheight_update, + off_d); } static GImage * @@ -339,7 +335,6 @@ offset (GImage *gimage, int drawable, int wrap_around, - int half_height, int fill_type, int offset_x, int offset_y) @@ -367,12 +362,6 @@ offset_y = BOUNDS (offset_y, -height, height); } - if (half_height) - { - offset_x = width/2; - offset_y = height/2; - } - if (offset_x == 0 && offset_y == 0) return; @@ -600,7 +589,7 @@ else fill_type = OFFSET_BACKGROUND; - offset (gimage, drawable_id, off_d->wrap_around,off_d->half_height, fill_ type, offset_x, offset_y); + offset (gimage, drawable_id, off_d->wrap_around, fill_type, offset_x, off set_y); gdisplays_flush (); } @@ -651,17 +640,20 @@ static void offset_halfheight_update (GtkWidget *widget, - gpointer data) + gpointer data) { - OffsetDialog *off_d; - - off_d = (OffsetDialog *) data; - if (GTK_TOGGLE_BUTTON (widget)->active) - off_d->half_height = TRUE; - else - off_d->half_height = FALSE; - - gtk_widget_set_sensitive (off_d->fill_options, !off_d->half_height); + OffsetDialog *off_d; + GImage *gimage; + gchar buffer[16]; + + off_d = (OffsetDialog *) data; + gimage = gimage_get_ID (off_d->gimage_id); + + sprintf (buffer, "%d", gimage->width / 2); + gtk_entry_set_text (GTK_ENTRY (off_d->off_x_entry), buffer); + + sprintf (buffer, "%d", gimage->height / 2); + gtk_entry_set_text (GTK_ENTRY (off_d->off_y_entry), buffer); } @@ -802,7 +794,6 @@ GImage *gimage; int drawable_id; int wrap_around; - int half_height; int fill_type; int offset_x; int offset_y; @@ -837,7 +828,7 @@ } if (success) - offset (gimage, drawable_id, wrap_around, half_height, fill_type, offset_x, offset_y); + offset (gimage, drawable_id, wrap_around, fill_type, offset_x, offset_y); return procedural_db_return_args (&channel_ops_offset_proc, success); } -------------End of forwarding message------------------------- ******************************************************************************** This is my sig. There are many like it, but this one is mine. Adrian Likins aklikins@eos.ncsu.edu http://www4.ncsu.edu/eos/users/a/aklikins/pub/adrian.html