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
3231691d
Commit
3231691d
authored
Dec 19, 1998
by
Sven Neumann
Browse files
Applied the patch Xach sent to the list.
--Sven
parent
1179ae33
Changes
4
Hide whitespace changes
Inline
Side-by-side
ChangeLog
View file @
3231691d
Sat Dec 19 19:19:22 MET 1998 Sven Neumann <sven@gimp.org>
* app/rect_select.c: applied the patch from Xach. Corrects the
behaviour of ratio-constrained selections.
Sat Dec 19 15:13:47 MET 1998 Sven Neumann <sven@gimp.org>
* app/session.c: use new gtk_window_set_default_size() to
...
...
app/rect_select.c
View file @
3231691d
...
...
@@ -518,29 +518,38 @@ rect_select_motion (Tool *tool,
if
(
mevent
->
state
&
GDK_SHIFT_MASK
)
{
ratio
=
(
double
)(
rect_sel
->
fixed_height
/
(
double
)
rect_sel
->
fixed_width
);
th
=
(
int
)((
x
-
ox
)
*
ratio
);
tw
=
(
int
)((
y
-
oy
)
/
ratio
);
/*******************************************************
I'm currently not satisfied with the way that this algorithm
decides which measurement (mouse position) to snap the selection
box to. If you have a better idea either tell me
(email: chap@cc.gatech.edu) or patch this sucker and send it.
*******************************************************/
if
(
abs
(
tw
-
(
x
-
oy
))
<
abs
(
th
-
(
y
-
oy
)))
{
w
=
tw
;
h
=
(
int
)(
w
*
ratio
);
}
else
{
h
=
th
;
w
=
(
int
)(
h
/
ratio
);
}
}
else
{
w
=
rect_sel
->
fixed_width
;
h
=
rect_sel
->
fixed_height
;
ox
=
x
;
oy
=
y
;
}
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
;
}
}
else
{
w
=
(
x
-
ox
);
h
=
(
y
-
oy
);
...
...
app/tools/gimprectselecttool.c
View file @
3231691d
...
...
@@ -518,29 +518,38 @@ rect_select_motion (Tool *tool,
if
(
mevent
->
state
&
GDK_SHIFT_MASK
)
{
ratio
=
(
double
)(
rect_sel
->
fixed_height
/
(
double
)
rect_sel
->
fixed_width
);
th
=
(
int
)((
x
-
ox
)
*
ratio
);
tw
=
(
int
)((
y
-
oy
)
/
ratio
);
/*******************************************************
I'm currently not satisfied with the way that this algorithm
decides which measurement (mouse position) to snap the selection
box to. If you have a better idea either tell me
(email: chap@cc.gatech.edu) or patch this sucker and send it.
*******************************************************/
if
(
abs
(
tw
-
(
x
-
oy
))
<
abs
(
th
-
(
y
-
oy
)))
{
w
=
tw
;
h
=
(
int
)(
w
*
ratio
);
}
else
{
h
=
th
;
w
=
(
int
)(
h
/
ratio
);
}
}
else
{
w
=
rect_sel
->
fixed_width
;
h
=
rect_sel
->
fixed_height
;
ox
=
x
;
oy
=
y
;
}
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
;
}
}
else
{
w
=
(
x
-
ox
);
h
=
(
y
-
oy
);
...
...
app/tools/rect_select.c
View file @
3231691d
...
...
@@ -518,29 +518,38 @@ rect_select_motion (Tool *tool,
if
(
mevent
->
state
&
GDK_SHIFT_MASK
)
{
ratio
=
(
double
)(
rect_sel
->
fixed_height
/
(
double
)
rect_sel
->
fixed_width
);
th
=
(
int
)((
x
-
ox
)
*
ratio
);
tw
=
(
int
)((
y
-
oy
)
/
ratio
);
/*******************************************************
I'm currently not satisfied with the way that this algorithm
decides which measurement (mouse position) to snap the selection
box to. If you have a better idea either tell me
(email: chap@cc.gatech.edu) or patch this sucker and send it.
*******************************************************/
if
(
abs
(
tw
-
(
x
-
oy
))
<
abs
(
th
-
(
y
-
oy
)))
{
w
=
tw
;
h
=
(
int
)(
w
*
ratio
);
}
else
{
h
=
th
;
w
=
(
int
)(
h
/
ratio
);
}
}
else
{
w
=
rect_sel
->
fixed_width
;
h
=
rect_sel
->
fixed_height
;
ox
=
x
;
oy
=
y
;
}
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
;
}
}
else
{
w
=
(
x
-
ox
);
h
=
(
y
-
oy
);
...
...
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