Overworked the line preview. Sorry for the inconvenience, but it has always

worked here due to a bug in icewm. Should work much better now, also it still
isn't perfect (yet).

Had to change the standard toggle key for all toggleable tools to
<Ctrl> since <Shift> collides with line drawing in the Convolver tool.


--Sven
This commit is contained in:
Sven Neumann
1999-06-07 22:38:20 +00:00
parent 8be87c245b
commit cff5ff7187
16 changed files with 104 additions and 86 deletions

View File

@ -1,3 +1,15 @@
Tue Jun 8 00:30:57 MEST 1999 Sven Neumann <sven@gimp.org>
* app/bucket_fill.c
* app/convolve.c
* app/crop.c
* app/flip_tool.c
* app/paint_core.c: Overworked the line preview. Sorry for the
inconvenience, but it has always worked here due to a bug in icewm. Should
work much better now, also it still isn't perfect (yet).
Had to change the standard toggle key for all toggleable tools to <Ctrl>
since <Shift> collides with line drawing in the Convolver tool.
1999-06-07 Tomas Ogren <stric@ing.umu.se> 1999-06-07 Tomas Ogren <stric@ing.umu.se>
* app/bucket_fill.c app/color_picker.c app/commands.c app/convolve.c * app/bucket_fill.c app/color_picker.c app/commands.c app/convolve.c

View File

@ -299,6 +299,8 @@ bucket_fill_modifier_key_func (Tool *tool,
case GDK_Alt_L: case GDK_Alt_R: case GDK_Alt_L: case GDK_Alt_R:
break; break;
case GDK_Shift_L: case GDK_Shift_R: case GDK_Shift_L: case GDK_Shift_R:
break;
case GDK_Control_L: case GDK_Control_R:
switch (bucket_options->fill_mode) switch (bucket_options->fill_mode)
{ {
case FG_BUCKET_FILL: case FG_BUCKET_FILL:
@ -311,8 +313,6 @@ bucket_fill_modifier_key_func (Tool *tool,
break; break;
} }
break; break;
case GDK_Control_L: case GDK_Control_R:
break;
} }
} }

View File

@ -199,6 +199,8 @@ convolve_modifier_key_func (Tool *tool,
case GDK_Alt_L: case GDK_Alt_R: case GDK_Alt_L: case GDK_Alt_R:
break; break;
case GDK_Shift_L: case GDK_Shift_R: case GDK_Shift_L: case GDK_Shift_R:
break;
case GDK_Control_L: case GDK_Control_R:
switch (convolve_options->type) switch (convolve_options->type)
{ {
case BLUR_CONVOLVE: case BLUR_CONVOLVE:
@ -211,8 +213,6 @@ convolve_modifier_key_func (Tool *tool,
break; break;
} }
break; break;
case GDK_Control_L: case GDK_Control_R:
break;
} }
} }

View File

@ -650,13 +650,13 @@ crop_modifier_key_func (Tool *tool,
gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (crop_options->allow_enlarge_w), !crop_options->allow_enlarge); gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (crop_options->allow_enlarge_w), !crop_options->allow_enlarge);
break; break;
case GDK_Shift_L: case GDK_Shift_R: case GDK_Shift_L: case GDK_Shift_R:
break;
case GDK_Control_L: case GDK_Control_R:
if (crop_options->type == CROP_CROP) if (crop_options->type == CROP_CROP)
gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (crop_options->type_w[RESIZE_CROP]), TRUE); gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (crop_options->type_w[RESIZE_CROP]), TRUE);
else else
gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (crop_options->type_w[CROP_CROP]), TRUE); gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (crop_options->type_w[CROP_CROP]), TRUE);
break; break;
case GDK_Control_L: case GDK_Control_R:
break;
} }
} }

View File

@ -104,13 +104,13 @@ flip_modifier_key_func (Tool *tool,
case GDK_Alt_L: case GDK_Alt_R: case GDK_Alt_L: case GDK_Alt_R:
break; break;
case GDK_Shift_L: case GDK_Shift_R: case GDK_Shift_L: case GDK_Shift_R:
break;
case GDK_Control_L: case GDK_Control_R:
if (flip_options->type == FLIP_HORZ) if (flip_options->type == FLIP_HORZ)
gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (flip_options->type_w[FLIP_VERT]), TRUE); gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (flip_options->type_w[FLIP_VERT]), TRUE);
else else
gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (flip_options->type_w[FLIP_HORZ]), TRUE); gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (flip_options->type_w[FLIP_HORZ]), TRUE);
break; break;
case GDK_Control_L: case GDK_Control_R:
break;
} }
} }

View File

@ -199,6 +199,8 @@ convolve_modifier_key_func (Tool *tool,
case GDK_Alt_L: case GDK_Alt_R: case GDK_Alt_L: case GDK_Alt_R:
break; break;
case GDK_Shift_L: case GDK_Shift_R: case GDK_Shift_L: case GDK_Shift_R:
break;
case GDK_Control_L: case GDK_Control_R:
switch (convolve_options->type) switch (convolve_options->type)
{ {
case BLUR_CONVOLVE: case BLUR_CONVOLVE:
@ -211,8 +213,6 @@ convolve_modifier_key_func (Tool *tool,
break; break;
} }
break; break;
case GDK_Control_L: case GDK_Control_R:
break;
} }
} }

View File

@ -226,6 +226,7 @@ paint_core_button_press (Tool *tool,
(* paint_core->paint_func) (paint_core, drawable, INIT_PAINT); (* paint_core->paint_func) (paint_core, drawable, INIT_PAINT);
if (paint_core->pick_colors if (paint_core->pick_colors
&& !(bevent->state & GDK_SHIFT_MASK)
&& (bevent->state & (GDK_CONTROL_MASK | GDK_MOD1_MASK))) && (bevent->state & (GDK_CONTROL_MASK | GDK_MOD1_MASK)))
{ {
paint_core_sample_color (drawable, x, y, bevent->state); paint_core_sample_color (drawable, x, y, bevent->state);
@ -337,26 +338,19 @@ paint_core_cursor_update (Tool *tool,
/* undraw the current tool */ /* undraw the current tool */
draw_core_pause (paint_core->core, tool); draw_core_pause (paint_core->core, tool);
gdisplay_untransform_coords (gdisp, (double) mevent->x, (double) mevent->y,
&x, &y, TRUE, FALSE);
if ((layer = gimage_get_active_layer (gdisp->gimage))) if ((layer = gimage_get_active_layer (gdisp->gimage)))
{ {
/* If Ctrl or Mod1 is pressed, pick colors */
if (paint_core->pick_colors
&& (mevent->state & (GDK_CONTROL_MASK | GDK_MOD1_MASK)))
{
ctype = GIMP_COLOR_PICKER_CURSOR;
}
/* If shift is down and this is not the first paint stroke, draw a line */ /* If shift is down and this is not the first paint stroke, draw a line */
else if (gdisp_ptr == tool->gdisp_ptr && if (gdisp_ptr == tool->gdisp_ptr &&
(mevent->state & COMMON_MODIFIERS_MASK) == GDK_SHIFT_MASK) (mevent->state & COMMON_MODIFIERS_MASK) == GDK_SHIFT_MASK)
{ {
ctype = GDK_PENCIL; ctype = GDK_PENCIL;
/* Get the current coordinates */ /* Get the current coordinates */
gdisplay_untransform_coords_f (gdisp, (double) mevent->x, (double) mevent->y, gdisplay_untransform_coords_f (gdisp,
&paint_core->curx, &paint_core->cury, TRUE); (double) mevent->x,
(double) mevent->y,
&paint_core->curx,
&paint_core->cury, TRUE);
if (paint_core->core->gc == NULL) if (paint_core->core->gc == NULL)
draw_core_start (paint_core->core, gdisp->canvas->window, tool); draw_core_start (paint_core->core, gdisp->canvas->window, tool);
@ -367,11 +361,21 @@ paint_core_cursor_update (Tool *tool,
draw_core_resume (paint_core->core, tool); draw_core_resume (paint_core->core, tool);
} }
} }
/* If Ctrl or Mod1 is pressed, pick colors */
else if (paint_core->pick_colors
&& !(mevent->state & GDK_SHIFT_MASK)
&& (mevent->state & (GDK_CONTROL_MASK | GDK_MOD1_MASK)))
{
ctype = GIMP_COLOR_PICKER_CURSOR;
}
/* Normal operation -- no modifier pressed or first stroke */ /* Normal operation -- no modifier pressed or first stroke */
else else
{ {
int off_x, off_y; int off_x, off_y;
drawable_offsets (GIMP_DRAWABLE(layer), &off_x, &off_y); drawable_offsets (GIMP_DRAWABLE(layer), &off_x, &off_y);
gdisplay_untransform_coords (gdisp, (double) mevent->x, (double) mevent->y,
&x, &y, TRUE, FALSE);
if (x >= off_x && y >= off_y && if (x >= off_x && y >= off_y &&
x < (off_x + drawable_width (GIMP_DRAWABLE(layer))) && x < (off_x + drawable_width (GIMP_DRAWABLE(layer))) &&
@ -386,9 +390,9 @@ paint_core_cursor_update (Tool *tool,
ctype = GDK_PENCIL; ctype = GDK_PENCIL;
} }
} }
}
gdisplay_install_tool_cursor (gdisp, ctype); gdisplay_install_tool_cursor (gdisp, ctype);
} }
}
void void
paint_core_control (Tool *tool, paint_core_control (Tool *tool,
@ -406,10 +410,8 @@ paint_core_control (Tool *tool,
switch (action) switch (action)
{ {
case PAUSE : case PAUSE :
draw_core_pause (paint_core->core, tool);
break; break;
case RESUME : case RESUME :
draw_core_resume (paint_core->core, tool);
break; break;
case HALT : case HALT :
(* paint_core->paint_func) (paint_core, drawable, FINISH_PAINT); (* paint_core->paint_func) (paint_core, drawable, FINISH_PAINT);
@ -429,7 +431,8 @@ paint_core_draw (Tool *tool)
paint_core = (PaintCore *) tool->private; paint_core = (PaintCore *) tool->private;
/* if shift was never used, we don't care about a redraw */ /* if shift was never used, paint_core->core->gc is NULL
and we don't care about a redraw */
if (paint_core->core->gc != NULL) if (paint_core->core->gc != NULL)
{ {
gdisp = (GDisplay *) tool->gdisp_ptr; gdisp = (GDisplay *) tool->gdisp_ptr;
@ -600,7 +603,7 @@ paint_core_get_color_from_gradient (PaintCore *paint_core,
/* if were past the first chunk... */ /* if were past the first chunk... */
if ((y/gradient_length) > 1.0) if ((y/gradient_length) > 1.0)
{ {
/* if this is an "odd" chunk..." */ /* if this is an "odd" chunk... */
if ((int)(y/gradient_length) & 1) if ((int)(y/gradient_length) & 1)
{ {
/* draw it "normally" */ /* draw it "normally" */

View File

@ -299,6 +299,8 @@ bucket_fill_modifier_key_func (Tool *tool,
case GDK_Alt_L: case GDK_Alt_R: case GDK_Alt_L: case GDK_Alt_R:
break; break;
case GDK_Shift_L: case GDK_Shift_R: case GDK_Shift_L: case GDK_Shift_R:
break;
case GDK_Control_L: case GDK_Control_R:
switch (bucket_options->fill_mode) switch (bucket_options->fill_mode)
{ {
case FG_BUCKET_FILL: case FG_BUCKET_FILL:
@ -311,8 +313,6 @@ bucket_fill_modifier_key_func (Tool *tool,
break; break;
} }
break; break;
case GDK_Control_L: case GDK_Control_R:
break;
} }
} }

View File

@ -199,6 +199,8 @@ convolve_modifier_key_func (Tool *tool,
case GDK_Alt_L: case GDK_Alt_R: case GDK_Alt_L: case GDK_Alt_R:
break; break;
case GDK_Shift_L: case GDK_Shift_R: case GDK_Shift_L: case GDK_Shift_R:
break;
case GDK_Control_L: case GDK_Control_R:
switch (convolve_options->type) switch (convolve_options->type)
{ {
case BLUR_CONVOLVE: case BLUR_CONVOLVE:
@ -211,8 +213,6 @@ convolve_modifier_key_func (Tool *tool,
break; break;
} }
break; break;
case GDK_Control_L: case GDK_Control_R:
break;
} }
} }

View File

@ -650,13 +650,13 @@ crop_modifier_key_func (Tool *tool,
gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (crop_options->allow_enlarge_w), !crop_options->allow_enlarge); gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (crop_options->allow_enlarge_w), !crop_options->allow_enlarge);
break; break;
case GDK_Shift_L: case GDK_Shift_R: case GDK_Shift_L: case GDK_Shift_R:
break;
case GDK_Control_L: case GDK_Control_R:
if (crop_options->type == CROP_CROP) if (crop_options->type == CROP_CROP)
gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (crop_options->type_w[RESIZE_CROP]), TRUE); gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (crop_options->type_w[RESIZE_CROP]), TRUE);
else else
gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (crop_options->type_w[CROP_CROP]), TRUE); gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (crop_options->type_w[CROP_CROP]), TRUE);
break; break;
case GDK_Control_L: case GDK_Control_R:
break;
} }
} }

View File

@ -104,13 +104,13 @@ flip_modifier_key_func (Tool *tool,
case GDK_Alt_L: case GDK_Alt_R: case GDK_Alt_L: case GDK_Alt_R:
break; break;
case GDK_Shift_L: case GDK_Shift_R: case GDK_Shift_L: case GDK_Shift_R:
break;
case GDK_Control_L: case GDK_Control_R:
if (flip_options->type == FLIP_HORZ) if (flip_options->type == FLIP_HORZ)
gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (flip_options->type_w[FLIP_VERT]), TRUE); gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (flip_options->type_w[FLIP_VERT]), TRUE);
else else
gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (flip_options->type_w[FLIP_HORZ]), TRUE); gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (flip_options->type_w[FLIP_HORZ]), TRUE);
break; break;
case GDK_Control_L: case GDK_Control_R:
break;
} }
} }

View File

@ -299,6 +299,8 @@ bucket_fill_modifier_key_func (Tool *tool,
case GDK_Alt_L: case GDK_Alt_R: case GDK_Alt_L: case GDK_Alt_R:
break; break;
case GDK_Shift_L: case GDK_Shift_R: case GDK_Shift_L: case GDK_Shift_R:
break;
case GDK_Control_L: case GDK_Control_R:
switch (bucket_options->fill_mode) switch (bucket_options->fill_mode)
{ {
case FG_BUCKET_FILL: case FG_BUCKET_FILL:
@ -311,8 +313,6 @@ bucket_fill_modifier_key_func (Tool *tool,
break; break;
} }
break; break;
case GDK_Control_L: case GDK_Control_R:
break;
} }
} }

View File

@ -199,6 +199,8 @@ convolve_modifier_key_func (Tool *tool,
case GDK_Alt_L: case GDK_Alt_R: case GDK_Alt_L: case GDK_Alt_R:
break; break;
case GDK_Shift_L: case GDK_Shift_R: case GDK_Shift_L: case GDK_Shift_R:
break;
case GDK_Control_L: case GDK_Control_R:
switch (convolve_options->type) switch (convolve_options->type)
{ {
case BLUR_CONVOLVE: case BLUR_CONVOLVE:
@ -211,8 +213,6 @@ convolve_modifier_key_func (Tool *tool,
break; break;
} }
break; break;
case GDK_Control_L: case GDK_Control_R:
break;
} }
} }

View File

@ -650,13 +650,13 @@ crop_modifier_key_func (Tool *tool,
gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (crop_options->allow_enlarge_w), !crop_options->allow_enlarge); gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (crop_options->allow_enlarge_w), !crop_options->allow_enlarge);
break; break;
case GDK_Shift_L: case GDK_Shift_R: case GDK_Shift_L: case GDK_Shift_R:
break;
case GDK_Control_L: case GDK_Control_R:
if (crop_options->type == CROP_CROP) if (crop_options->type == CROP_CROP)
gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (crop_options->type_w[RESIZE_CROP]), TRUE); gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (crop_options->type_w[RESIZE_CROP]), TRUE);
else else
gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (crop_options->type_w[CROP_CROP]), TRUE); gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (crop_options->type_w[CROP_CROP]), TRUE);
break; break;
case GDK_Control_L: case GDK_Control_R:
break;
} }
} }

View File

@ -104,13 +104,13 @@ flip_modifier_key_func (Tool *tool,
case GDK_Alt_L: case GDK_Alt_R: case GDK_Alt_L: case GDK_Alt_R:
break; break;
case GDK_Shift_L: case GDK_Shift_R: case GDK_Shift_L: case GDK_Shift_R:
break;
case GDK_Control_L: case GDK_Control_R:
if (flip_options->type == FLIP_HORZ) if (flip_options->type == FLIP_HORZ)
gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (flip_options->type_w[FLIP_VERT]), TRUE); gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (flip_options->type_w[FLIP_VERT]), TRUE);
else else
gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (flip_options->type_w[FLIP_HORZ]), TRUE); gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (flip_options->type_w[FLIP_HORZ]), TRUE);
break; break;
case GDK_Control_L: case GDK_Control_R:
break;
} }
} }

View File

@ -226,6 +226,7 @@ paint_core_button_press (Tool *tool,
(* paint_core->paint_func) (paint_core, drawable, INIT_PAINT); (* paint_core->paint_func) (paint_core, drawable, INIT_PAINT);
if (paint_core->pick_colors if (paint_core->pick_colors
&& !(bevent->state & GDK_SHIFT_MASK)
&& (bevent->state & (GDK_CONTROL_MASK | GDK_MOD1_MASK))) && (bevent->state & (GDK_CONTROL_MASK | GDK_MOD1_MASK)))
{ {
paint_core_sample_color (drawable, x, y, bevent->state); paint_core_sample_color (drawable, x, y, bevent->state);
@ -337,26 +338,19 @@ paint_core_cursor_update (Tool *tool,
/* undraw the current tool */ /* undraw the current tool */
draw_core_pause (paint_core->core, tool); draw_core_pause (paint_core->core, tool);
gdisplay_untransform_coords (gdisp, (double) mevent->x, (double) mevent->y,
&x, &y, TRUE, FALSE);
if ((layer = gimage_get_active_layer (gdisp->gimage))) if ((layer = gimage_get_active_layer (gdisp->gimage)))
{ {
/* If Ctrl or Mod1 is pressed, pick colors */
if (paint_core->pick_colors
&& (mevent->state & (GDK_CONTROL_MASK | GDK_MOD1_MASK)))
{
ctype = GIMP_COLOR_PICKER_CURSOR;
}
/* If shift is down and this is not the first paint stroke, draw a line */ /* If shift is down and this is not the first paint stroke, draw a line */
else if (gdisp_ptr == tool->gdisp_ptr && if (gdisp_ptr == tool->gdisp_ptr &&
(mevent->state & COMMON_MODIFIERS_MASK) == GDK_SHIFT_MASK) (mevent->state & COMMON_MODIFIERS_MASK) == GDK_SHIFT_MASK)
{ {
ctype = GDK_PENCIL; ctype = GDK_PENCIL;
/* Get the current coordinates */ /* Get the current coordinates */
gdisplay_untransform_coords_f (gdisp, (double) mevent->x, (double) mevent->y, gdisplay_untransform_coords_f (gdisp,
&paint_core->curx, &paint_core->cury, TRUE); (double) mevent->x,
(double) mevent->y,
&paint_core->curx,
&paint_core->cury, TRUE);
if (paint_core->core->gc == NULL) if (paint_core->core->gc == NULL)
draw_core_start (paint_core->core, gdisp->canvas->window, tool); draw_core_start (paint_core->core, gdisp->canvas->window, tool);
@ -367,11 +361,21 @@ paint_core_cursor_update (Tool *tool,
draw_core_resume (paint_core->core, tool); draw_core_resume (paint_core->core, tool);
} }
} }
/* If Ctrl or Mod1 is pressed, pick colors */
else if (paint_core->pick_colors
&& !(mevent->state & GDK_SHIFT_MASK)
&& (mevent->state & (GDK_CONTROL_MASK | GDK_MOD1_MASK)))
{
ctype = GIMP_COLOR_PICKER_CURSOR;
}
/* Normal operation -- no modifier pressed or first stroke */ /* Normal operation -- no modifier pressed or first stroke */
else else
{ {
int off_x, off_y; int off_x, off_y;
drawable_offsets (GIMP_DRAWABLE(layer), &off_x, &off_y); drawable_offsets (GIMP_DRAWABLE(layer), &off_x, &off_y);
gdisplay_untransform_coords (gdisp, (double) mevent->x, (double) mevent->y,
&x, &y, TRUE, FALSE);
if (x >= off_x && y >= off_y && if (x >= off_x && y >= off_y &&
x < (off_x + drawable_width (GIMP_DRAWABLE(layer))) && x < (off_x + drawable_width (GIMP_DRAWABLE(layer))) &&
@ -386,9 +390,9 @@ paint_core_cursor_update (Tool *tool,
ctype = GDK_PENCIL; ctype = GDK_PENCIL;
} }
} }
}
gdisplay_install_tool_cursor (gdisp, ctype); gdisplay_install_tool_cursor (gdisp, ctype);
} }
}
void void
paint_core_control (Tool *tool, paint_core_control (Tool *tool,
@ -406,10 +410,8 @@ paint_core_control (Tool *tool,
switch (action) switch (action)
{ {
case PAUSE : case PAUSE :
draw_core_pause (paint_core->core, tool);
break; break;
case RESUME : case RESUME :
draw_core_resume (paint_core->core, tool);
break; break;
case HALT : case HALT :
(* paint_core->paint_func) (paint_core, drawable, FINISH_PAINT); (* paint_core->paint_func) (paint_core, drawable, FINISH_PAINT);
@ -429,7 +431,8 @@ paint_core_draw (Tool *tool)
paint_core = (PaintCore *) tool->private; paint_core = (PaintCore *) tool->private;
/* if shift was never used, we don't care about a redraw */ /* if shift was never used, paint_core->core->gc is NULL
and we don't care about a redraw */
if (paint_core->core->gc != NULL) if (paint_core->core->gc != NULL)
{ {
gdisp = (GDisplay *) tool->gdisp_ptr; gdisp = (GDisplay *) tool->gdisp_ptr;
@ -600,7 +603,7 @@ paint_core_get_color_from_gradient (PaintCore *paint_core,
/* if were past the first chunk... */ /* if were past the first chunk... */
if ((y/gradient_length) > 1.0) if ((y/gradient_length) > 1.0)
{ {
/* if this is an "odd" chunk..." */ /* if this is an "odd" chunk... */
if ((int)(y/gradient_length) & 1) if ((int)(y/gradient_length) & 1)
{ {
/* draw it "normally" */ /* draw it "normally" */