Applied the second patch from Xach with a slight modification to get

centered fixed-size selections right.


--Sven
This commit is contained in:
Sven Neumann
1998-12-19 23:59:04 +00:00
parent 3231691d2f
commit dc436e826e
4 changed files with 96 additions and 117 deletions

View File

@ -1,3 +1,9 @@
Sun Dec 20 00:55:21 MET 1998 Sven Neumann <sven@gimp.org>
* app/rect_select.c: applied the second patch from Xach with
a slight modification to get centered fixed-size selections
right.
Sat Dec 19 19:19:22 MET 1998 Sven Neumann <sven@gimp.org> Sat Dec 19 19:19:22 MET 1998 Sven Neumann <sven@gimp.org>
* app/rect_select.c: applied the patch from Xach. Corrects the * app/rect_select.c: applied the patch from Xach. Corrects the

View File

@ -344,13 +344,9 @@ rect_select_button_press (Tool *tool,
default: default:
break; break;
} }
if (rect_sel->fixed_size) {
rect_sel->w = rect_sel->fixed_width;
rect_sel->h = rect_sel->fixed_height;
} else {
rect_sel->w = 0; rect_sel->w = 0;
rect_sel->h = 0; rect_sel->h = 0;
}
rect_sel->center = FALSE; rect_sel->center = FALSE;
@ -520,12 +516,9 @@ rect_select_motion (Tool *tool,
(double)rect_sel->fixed_width); (double)rect_sel->fixed_width);
tw = x - ox; tw = x - ox;
th = y - oy; th = y - oy;
/* /*
* This is probably a poorly-optimized way to do it, but it gives * This is probably an inefficient way to do it, but it gives
* nicer, more predictable results than the original agorithm * nicer, more predictable results than the original agorithm
* FIXME: center-originating selections (Ctrl-drag) are broken now.
* -xach
*/ */
if ((abs(th) < (ratio * abs(tw))) && (abs(tw) > (abs(th) / ratio))) if ((abs(th) < (ratio * abs(tw))) && (abs(tw) > (abs(th) / ratio)))
@ -547,8 +540,6 @@ rect_select_motion (Tool *tool,
} else { } else {
w = rect_sel->fixed_width; w = rect_sel->fixed_width;
h = rect_sel->fixed_height; h = rect_sel->fixed_height;
ox = x;
oy = y;
} }
} else { } else {
w = (x - ox); w = (x - ox);
@ -576,8 +567,8 @@ rect_select_motion (Tool *tool,
{ {
if (rect_sel->fixed_size) if (rect_sel->fixed_size)
{ {
rect_sel->x = ox - w / 2; rect_sel->x = ox - (w/2);
rect_sel->y = oy - h / 2; rect_sel->y = oy - (h/2);
rect_sel->w = w; rect_sel->w = w;
rect_sel->h = h; rect_sel->h = h;
} }

View File

@ -344,13 +344,9 @@ rect_select_button_press (Tool *tool,
default: default:
break; break;
} }
if (rect_sel->fixed_size) {
rect_sel->w = rect_sel->fixed_width;
rect_sel->h = rect_sel->fixed_height;
} else {
rect_sel->w = 0; rect_sel->w = 0;
rect_sel->h = 0; rect_sel->h = 0;
}
rect_sel->center = FALSE; rect_sel->center = FALSE;
@ -520,12 +516,9 @@ rect_select_motion (Tool *tool,
(double)rect_sel->fixed_width); (double)rect_sel->fixed_width);
tw = x - ox; tw = x - ox;
th = y - oy; th = y - oy;
/* /*
* This is probably a poorly-optimized way to do it, but it gives * This is probably an inefficient way to do it, but it gives
* nicer, more predictable results than the original agorithm * nicer, more predictable results than the original agorithm
* FIXME: center-originating selections (Ctrl-drag) are broken now.
* -xach
*/ */
if ((abs(th) < (ratio * abs(tw))) && (abs(tw) > (abs(th) / ratio))) if ((abs(th) < (ratio * abs(tw))) && (abs(tw) > (abs(th) / ratio)))
@ -547,8 +540,6 @@ rect_select_motion (Tool *tool,
} else { } else {
w = rect_sel->fixed_width; w = rect_sel->fixed_width;
h = rect_sel->fixed_height; h = rect_sel->fixed_height;
ox = x;
oy = y;
} }
} else { } else {
w = (x - ox); w = (x - ox);
@ -576,8 +567,8 @@ rect_select_motion (Tool *tool,
{ {
if (rect_sel->fixed_size) if (rect_sel->fixed_size)
{ {
rect_sel->x = ox - w / 2; rect_sel->x = ox - (w/2);
rect_sel->y = oy - h / 2; rect_sel->y = oy - (h/2);
rect_sel->w = w; rect_sel->w = w;
rect_sel->h = h; rect_sel->h = h;
} }

View File

@ -344,13 +344,9 @@ rect_select_button_press (Tool *tool,
default: default:
break; break;
} }
if (rect_sel->fixed_size) {
rect_sel->w = rect_sel->fixed_width;
rect_sel->h = rect_sel->fixed_height;
} else {
rect_sel->w = 0; rect_sel->w = 0;
rect_sel->h = 0; rect_sel->h = 0;
}
rect_sel->center = FALSE; rect_sel->center = FALSE;
@ -520,12 +516,9 @@ rect_select_motion (Tool *tool,
(double)rect_sel->fixed_width); (double)rect_sel->fixed_width);
tw = x - ox; tw = x - ox;
th = y - oy; th = y - oy;
/* /*
* This is probably a poorly-optimized way to do it, but it gives * This is probably an inefficient way to do it, but it gives
* nicer, more predictable results than the original agorithm * nicer, more predictable results than the original agorithm
* FIXME: center-originating selections (Ctrl-drag) are broken now.
* -xach
*/ */
if ((abs(th) < (ratio * abs(tw))) && (abs(tw) > (abs(th) / ratio))) if ((abs(th) < (ratio * abs(tw))) && (abs(tw) > (abs(th) / ratio)))
@ -547,8 +540,6 @@ rect_select_motion (Tool *tool,
} else { } else {
w = rect_sel->fixed_width; w = rect_sel->fixed_width;
h = rect_sel->fixed_height; h = rect_sel->fixed_height;
ox = x;
oy = y;
} }
} else { } else {
w = (x - ox); w = (x - ox);
@ -576,8 +567,8 @@ rect_select_motion (Tool *tool,
{ {
if (rect_sel->fixed_size) if (rect_sel->fixed_size)
{ {
rect_sel->x = ox - w / 2; rect_sel->x = ox - (w/2);
rect_sel->y = oy - h / 2; rect_sel->y = oy - (h/2);
rect_sel->w = w; rect_sel->w = w;
rect_sel->h = h; rect_sel->h = h;
} }