Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
GNOME
GIMP
Commits
dc436e82
Commit
dc436e82
authored
Dec 19, 1998
by
Sven Neumann
Browse files
Applied the second patch from Xach with a slight modification to get
centered fixed-size selections right. --Sven
parent
3231691d
Changes
4
Hide whitespace changes
Inline
Side-by-side
ChangeLog
View file @
dc436e82
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>
* app/rect_select.c: applied the patch from Xach. Corrects the
...
...
app/rect_select.c
View file @
dc436e82
...
...
@@ -344,13 +344,9 @@ rect_select_button_press (Tool *tool,
default:
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
->
h
=
0
;
}
rect_sel
->
w
=
0
;
rect_sel
->
h
=
0
;
rect_sel
->
center
=
FALSE
;
...
...
@@ -520,36 +516,31 @@ rect_select_motion (Tool *tool,
(
double
)
rect_sel
->
fixed_width
);
tw
=
x
-
ox
;
th
=
y
-
oy
;
/*
* This is probably a poorly-optimized way to do it, but it gives
* 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
)))
{
w
=
tw
;
h
=
(
int
)(
tw
*
ratio
);
/* h should have the sign of th */
if
((
th
<
0
&&
h
>
0
)
||
(
th
>
0
&&
h
<
0
))
h
=
-
h
;
}
else
{
h
=
th
;
w
=
(
int
)(
th
/
ratio
);
/* w should have the sign of tw */
if
((
tw
<
0
&&
w
>
0
)
||
(
tw
>
0
&&
w
<
0
))
w
=
-
w
;
}
}
else
{
w
=
rect_sel
->
fixed_width
;
h
=
rect_sel
->
fixed_height
;
ox
=
x
;
oy
=
y
;
}
/*
* This is probably an inefficient way to do it, but it gives
* nicer, more predictable results than the original agorithm
*/
if
((
abs
(
th
)
<
(
ratio
*
abs
(
tw
)))
&&
(
abs
(
tw
)
>
(
abs
(
th
)
/
ratio
)))
{
w
=
tw
;
h
=
(
int
)(
tw
*
ratio
);
/* h should have the sign of th */
if
((
th
<
0
&&
h
>
0
)
||
(
th
>
0
&&
h
<
0
))
h
=
-
h
;
}
else
{
h
=
th
;
w
=
(
int
)(
th
/
ratio
);
/* w should have the sign of tw */
if
((
tw
<
0
&&
w
>
0
)
||
(
tw
>
0
&&
w
<
0
))
w
=
-
w
;
}
}
else
{
w
=
rect_sel
->
fixed_width
;
h
=
rect_sel
->
fixed_height
;
}
}
else
{
w
=
(
x
-
ox
);
h
=
(
y
-
oy
);
...
...
@@ -576,8 +567,8 @@ rect_select_motion (Tool *tool,
{
if
(
rect_sel
->
fixed_size
)
{
rect_sel
->
x
=
ox
-
w
/
2
;
rect_sel
->
y
=
oy
-
h
/
2
;
rect_sel
->
x
=
ox
-
(
w
/
2
)
;
rect_sel
->
y
=
oy
-
(
h
/
2
)
;
rect_sel
->
w
=
w
;
rect_sel
->
h
=
h
;
}
...
...
app/tools/gimprectselecttool.c
View file @
dc436e82
...
...
@@ -344,13 +344,9 @@ rect_select_button_press (Tool *tool,
default:
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
->
h
=
0
;
}
rect_sel
->
w
=
0
;
rect_sel
->
h
=
0
;
rect_sel
->
center
=
FALSE
;
...
...
@@ -520,36 +516,31 @@ rect_select_motion (Tool *tool,
(
double
)
rect_sel
->
fixed_width
);
tw
=
x
-
ox
;
th
=
y
-
oy
;
/*
* This is probably a poorly-optimized way to do it, but it gives
* 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
)))
{
w
=
tw
;
h
=
(
int
)(
tw
*
ratio
);
/* h should have the sign of th */
if
((
th
<
0
&&
h
>
0
)
||
(
th
>
0
&&
h
<
0
))
h
=
-
h
;
}
else
{
h
=
th
;
w
=
(
int
)(
th
/
ratio
);
/* w should have the sign of tw */
if
((
tw
<
0
&&
w
>
0
)
||
(
tw
>
0
&&
w
<
0
))
w
=
-
w
;
}
}
else
{
w
=
rect_sel
->
fixed_width
;
h
=
rect_sel
->
fixed_height
;
ox
=
x
;
oy
=
y
;
}
/*
* This is probably an inefficient way to do it, but it gives
* nicer, more predictable results than the original agorithm
*/
if
((
abs
(
th
)
<
(
ratio
*
abs
(
tw
)))
&&
(
abs
(
tw
)
>
(
abs
(
th
)
/
ratio
)))
{
w
=
tw
;
h
=
(
int
)(
tw
*
ratio
);
/* h should have the sign of th */
if
((
th
<
0
&&
h
>
0
)
||
(
th
>
0
&&
h
<
0
))
h
=
-
h
;
}
else
{
h
=
th
;
w
=
(
int
)(
th
/
ratio
);
/* w should have the sign of tw */
if
((
tw
<
0
&&
w
>
0
)
||
(
tw
>
0
&&
w
<
0
))
w
=
-
w
;
}
}
else
{
w
=
rect_sel
->
fixed_width
;
h
=
rect_sel
->
fixed_height
;
}
}
else
{
w
=
(
x
-
ox
);
h
=
(
y
-
oy
);
...
...
@@ -576,8 +567,8 @@ rect_select_motion (Tool *tool,
{
if
(
rect_sel
->
fixed_size
)
{
rect_sel
->
x
=
ox
-
w
/
2
;
rect_sel
->
y
=
oy
-
h
/
2
;
rect_sel
->
x
=
ox
-
(
w
/
2
)
;
rect_sel
->
y
=
oy
-
(
h
/
2
)
;
rect_sel
->
w
=
w
;
rect_sel
->
h
=
h
;
}
...
...
app/tools/rect_select.c
View file @
dc436e82
...
...
@@ -344,13 +344,9 @@ rect_select_button_press (Tool *tool,
default:
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
->
h
=
0
;
}
rect_sel
->
w
=
0
;
rect_sel
->
h
=
0
;
rect_sel
->
center
=
FALSE
;
...
...
@@ -520,36 +516,31 @@ rect_select_motion (Tool *tool,
(
double
)
rect_sel
->
fixed_width
);
tw
=
x
-
ox
;
th
=
y
-
oy
;
/*
* This is probably a poorly-optimized way to do it, but it gives
* 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
)))
{
w
=
tw
;
h
=
(
int
)(
tw
*
ratio
);
/* h should have the sign of th */
if
((
th
<
0
&&
h
>
0
)
||
(
th
>
0
&&
h
<
0
))
h
=
-
h
;
}
else
{
h
=
th
;
w
=
(
int
)(
th
/
ratio
);
/* w should have the sign of tw */
if
((
tw
<
0
&&
w
>
0
)
||
(
tw
>
0
&&
w
<
0
))
w
=
-
w
;
}
}
else
{
w
=
rect_sel
->
fixed_width
;
h
=
rect_sel
->
fixed_height
;
ox
=
x
;
oy
=
y
;
}
/*
* This is probably an inefficient way to do it, but it gives
* nicer, more predictable results than the original agorithm
*/
if
((
abs
(
th
)
<
(
ratio
*
abs
(
tw
)))
&&
(
abs
(
tw
)
>
(
abs
(
th
)
/
ratio
)))
{
w
=
tw
;
h
=
(
int
)(
tw
*
ratio
);
/* h should have the sign of th */
if
((
th
<
0
&&
h
>
0
)
||
(
th
>
0
&&
h
<
0
))
h
=
-
h
;
}
else
{
h
=
th
;
w
=
(
int
)(
th
/
ratio
);
/* w should have the sign of tw */
if
((
tw
<
0
&&
w
>
0
)
||
(
tw
>
0
&&
w
<
0
))
w
=
-
w
;
}
}
else
{
w
=
rect_sel
->
fixed_width
;
h
=
rect_sel
->
fixed_height
;
}
}
else
{
w
=
(
x
-
ox
);
h
=
(
y
-
oy
);
...
...
@@ -576,8 +567,8 @@ rect_select_motion (Tool *tool,
{
if
(
rect_sel
->
fixed_size
)
{
rect_sel
->
x
=
ox
-
w
/
2
;
rect_sel
->
y
=
oy
-
h
/
2
;
rect_sel
->
x
=
ox
-
(
w
/
2
)
;
rect_sel
->
y
=
oy
-
(
h
/
2
)
;
rect_sel
->
w
=
w
;
rect_sel
->
h
=
h
;
}
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment