Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
P
proview
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Esteban Blanc
proview
Commits
3acba18d
Commit
3acba18d
authored
Jun 12, 2019
by
Christoffer Ackelman
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Slight cleanup of Glow.
parent
85f94d7b
Changes
18
Hide whitespace changes
Inline
Side-by-side
Showing
18 changed files
with
71 additions
and
284 deletions
+71
-284
xtt/lib/glow/src/glow_growarc.cpp
xtt/lib/glow/src/glow_growarc.cpp
+6
-22
xtt/lib/glow/src/glow_growarc.h
xtt/lib/glow/src/glow_growarc.h
+0
-14
xtt/lib/glow/src/glow_growimage.cpp
xtt/lib/glow/src/glow_growimage.cpp
+6
-22
xtt/lib/glow/src/glow_growimage.h
xtt/lib/glow/src/glow_growimage.h
+0
-14
xtt/lib/glow/src/glow_growline.cpp
xtt/lib/glow/src/glow_growline.cpp
+15
-21
xtt/lib/glow/src/glow_growline.h
xtt/lib/glow/src/glow_growline.h
+0
-14
xtt/lib/glow/src/glow_growmenu.cpp
xtt/lib/glow/src/glow_growmenu.cpp
+8
-24
xtt/lib/glow/src/glow_growmenu.h
xtt/lib/glow/src/glow_growmenu.h
+0
-1
xtt/lib/glow/src/glow_growpolyline.cpp
xtt/lib/glow/src/glow_growpolyline.cpp
+15
-22
xtt/lib/glow/src/glow_growpolyline.h
xtt/lib/glow/src/glow_growpolyline.h
+0
-14
xtt/lib/glow/src/glow_growrect.cpp
xtt/lib/glow/src/glow_growrect.cpp
+6
-23
xtt/lib/glow/src/glow_growrect.h
xtt/lib/glow/src/glow_growrect.h
+0
-14
xtt/lib/glow/src/glow_growrectrounded.cpp
xtt/lib/glow/src/glow_growrectrounded.cpp
+6
-23
xtt/lib/glow/src/glow_growrectrounded.h
xtt/lib/glow/src/glow_growrectrounded.h
+0
-14
xtt/lib/glow/src/glow_growtable.cpp
xtt/lib/glow/src/glow_growtable.cpp
+2
-6
xtt/lib/glow/src/glow_growtext.cpp
xtt/lib/glow/src/glow_growtext.cpp
+4
-9
xtt/lib/glow/src/glow_growtext.h
xtt/lib/glow/src/glow_growtext.h
+0
-14
xtt/lib/glow/src/glow_growwindow.cpp
xtt/lib/glow/src/glow_growwindow.cpp
+3
-13
No files found.
xtt/lib/glow/src/glow_growarc.cpp
View file @
3acba18d
...
...
@@ -114,35 +114,19 @@ void GrowArc::move(double delta_x, double delta_y, int grid)
}
}
int
GrowArc
::
local_event_handler
(
glow_eEvent
event
,
double
x
,
double
y
)
{
double
ll_x
,
ur_x
,
ll_y
,
ur_y
;
ll_x
=
MIN
(
ll
.
x
,
ur
.
x
);
ur_x
=
MAX
(
ll
.
x
,
ur
.
x
);
ll_y
=
MIN
(
ll
.
y
,
ur
.
y
);
ur_y
=
MAX
(
ll
.
y
,
ur
.
y
);
if
(
ll_x
<=
x
&&
x
<=
ur_x
&&
ll_y
<=
y
&&
y
<=
ur_y
)
return
1
;
else
return
0
;
}
int
GrowArc
::
event_handler
(
glow_eEvent
event
,
double
fx
,
double
fy
)
{
// Convert from global to local coordinates
glow_sPoint
p
=
trf
.
reverse
(
fx
,
fy
);
return
local_event_handler
(
event
,
p
.
x
,
p
.
y
);
return
(
MIN
(
ll
.
x
,
ur
.
x
)
<=
p
.
x
&&
p
.
x
<=
MAX
(
ll
.
x
,
ur
.
x
)
&&
MIN
(
ll
.
y
,
ur
.
y
)
<=
p
.
y
&&
p
.
y
<=
MAX
(
ll
.
y
,
ur
.
y
));
}
int
GrowArc
::
event_handler
(
glow_eEvent
event
,
int
x
,
int
y
,
double
fx
,
double
fy
)
{
// Convert koordinates to local koordinates
glow_sPoint
r
=
trf
.
reverse
(
fx
,
fy
);
int
sts
=
0
;
if
(
event
==
ctx
->
event_move_node
)
{
sts
=
local_event_handler
(
event
,
r
.
x
,
r
.
y
);
sts
=
event_handler
(
event
,
fx
,
f
y
);
if
(
sts
)
{
/* Register node for potential movement */
ctx
->
move_insert
(
this
);
...
...
@@ -156,7 +140,7 @@ int GrowArc::event_handler(glow_eEvent event, int x, int y, double fx, double fy
else
if
(
ctx
->
hot_found
)
sts
=
0
;
else
{
sts
=
local_event_handler
(
event
,
r
.
x
,
r
.
y
);
sts
=
event_handler
(
event
,
fx
,
f
y
);
if
(
sts
)
ctx
->
hot_found
=
1
;
}
...
...
@@ -173,7 +157,7 @@ int GrowArc::event_handler(glow_eEvent event, int x, int y, double fx, double fy
break
;
}
default:
sts
=
local_event_handler
(
event
,
r
.
x
,
r
.
y
);
sts
=
event_handler
(
event
,
fx
,
f
y
);
}
if
(
sts
)
ctx
->
register_callback_object
(
glow_eObjectType_Node
,
this
);
...
...
xtt/lib/glow/src/glow_growarc.h
View file @
3acba18d
...
...
@@ -118,20 +118,6 @@ public:
*/
int
event_handler
(
glow_eEvent
event
,
double
fx
,
double
fy
);
//! Detects if the object is hit by an event in local coordinates
/*!
\param event Current event.
\param x x of event coordinate in the objects local coordinate
system.
\param y y of event coordinate in the objects local coordinate
system.
\return Returns 1 if the object is hit, else 0.
Compares the coordinates of the event with the borders of the object.
If the event is inside the borders, 1 is returned, otherwise 0 is returned.
*/
int
local_event_handler
(
glow_eEvent
event
,
double
x
,
double
y
);
//! Calculate the border for a set of objects or for a parent node.
/*!
\param t Transform.
...
...
xtt/lib/glow/src/glow_growimage.cpp
View file @
3acba18d
...
...
@@ -271,35 +271,19 @@ void GrowImage::move(double delta_x, double delta_y, int grid)
}
}
int
GrowImage
::
local_event_handler
(
glow_eEvent
event
,
double
x
,
double
y
)
{
double
ll_x
,
ur_x
,
ll_y
,
ur_y
;
ll_x
=
MIN
(
ll
.
x
,
ur
.
x
);
ur_x
=
MAX
(
ll
.
x
,
ur
.
x
);
ll_y
=
MIN
(
ll
.
y
,
ur
.
y
);
ur_y
=
MAX
(
ll
.
y
,
ur
.
y
);
if
(
ll_x
<=
x
&&
x
<=
ur_x
&&
ll_y
<=
y
&&
y
<=
ur_y
)
{
return
1
;
}
else
return
0
;
}
int
GrowImage
::
event_handler
(
glow_eEvent
event
,
double
fx
,
double
fy
)
{
// Convert from global to local coordinates
glow_sPoint
p
=
trf
.
reverse
(
fx
,
fy
);
return
local_event_handler
(
event
,
p
.
x
,
p
.
y
);
return
(
MIN
(
ll
.
x
,
ur
.
x
)
<=
p
.
x
&&
p
.
x
<=
MAX
(
ll
.
x
,
ur
.
x
)
&&
MIN
(
ll
.
y
,
ur
.
y
)
<=
p
.
y
&&
p
.
y
<=
MAX
(
ll
.
y
,
ur
.
y
));
}
int
GrowImage
::
event_handler
(
glow_eEvent
event
,
int
x
,
int
y
,
double
fx
,
double
fy
)
{
// Convert koordinates to local koordinates
glow_sPoint
r
=
trf
.
reverse
(
fx
,
fy
);
int
sts
=
0
;
if
(
event
==
ctx
->
event_move_node
)
{
sts
=
local_event_handler
(
event
,
r
.
x
,
r
.
y
);
sts
=
event_handler
(
event
,
fx
,
f
y
);
if
(
sts
)
{
/* Register node for potential movement */
ctx
->
move_insert
(
this
);
...
...
@@ -313,7 +297,7 @@ int GrowImage::event_handler(glow_eEvent event, int x, int y, double fx, double
else
if
(
ctx
->
hot_found
)
sts
=
0
;
else
{
sts
=
local_event_handler
(
event
,
r
.
x
,
r
.
y
);
sts
=
event_handler
(
event
,
fx
,
f
y
);
if
(
sts
)
ctx
->
hot_found
=
1
;
}
...
...
@@ -330,7 +314,7 @@ int GrowImage::event_handler(glow_eEvent event, int x, int y, double fx, double
break
;
}
default:
sts
=
local_event_handler
(
event
,
r
.
x
,
r
.
y
);
sts
=
event_handler
(
event
,
fx
,
f
y
);
}
if
(
sts
)
ctx
->
register_callback_object
(
glow_eObjectType_Node
,
this
);
...
...
xtt/lib/glow/src/glow_growimage.h
View file @
3acba18d
...
...
@@ -108,20 +108,6 @@ public:
*/
int
event_handler
(
glow_eEvent
event
,
double
fx
,
double
fy
);
//! Detects if the object is hit by an event in local coordinates
/*!
\param event Current event.
\param x x of event coordinate in the objects local coordinate
system.
\param y y of event coordinate in the objects local coordinate
system.
\return Returns 1 if the object is hit, else 0.
Compares the coordinates of the event with the borders of the object.
If the event is inside the borders, 1 is returned, otherwise 0 is returned.
*/
int
local_event_handler
(
glow_eEvent
event
,
double
x
,
double
y
);
//! Calculate the border for a set of objects or for a parent node.
/*!
\param t Transform.
...
...
xtt/lib/glow/src/glow_growline.cpp
View file @
3acba18d
...
...
@@ -104,48 +104,42 @@ void GrowLine::move(double delta_x, double delta_y, int grid)
}
}
int
GrowLine
::
local_event_handler
(
glow_eEvent
event
,
double
x
,
double
y
)
{
int
GrowLine
::
event_handler
(
glow_eEvent
event
,
double
fx
,
double
fy
)
{
// Convert from global to local coordinates
glow_sPoint
p
=
trf
.
reverse
(
fx
,
fy
);
glow_sPoint
tmp2
=
trf
.
reverse
(
0.05
*
line_width
,
0.05
*
line_width
);
glow_sPoint
tmp1
=
trf
.
reverse
(
0
,
0
);
double
dx
=
fabs
(
tmp2
.
x
-
tmp1
.
x
);
double
dy
=
fabs
(
tmp2
.
y
-
tmp1
.
y
);
if
((
feq
(
p1
.
x
,
p2
.
x
)
&&
p1
.
y
<
p2
.
y
&&
// Vertical
fabs
(
p1
.
x
-
x
)
<
dx
&&
p1
.
y
<
y
&&
y
<
p2
.
y
)
fabs
(
p1
.
x
-
p
.
x
)
<
dx
&&
p1
.
y
<
p
.
y
&&
p
.
y
<
p2
.
y
)
||
(
feq
(
p1
.
x
,
p2
.
x
)
&&
p1
.
y
>
p2
.
y
&&
// Vertical
fabs
(
p1
.
x
-
x
)
<
dx
&&
p2
.
y
<
y
&&
y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.
x
)
*
x
-
p1
.
y
+
(
!
(
feq
(
p1
.
x
,
p2
.
x
)
||
feq
(
p1
.
y
,
p2
.
y
))
&&
p1
.
x
>
p2
.
x
&&
p2
.
x
<=
p
.
x
&&
p
.
x
<=
p1
.
x
&&
fabs
(
p
.
y
-
(
p2
.
y
-
p1
.
y
)
/
(
p2
.
x
-
p1
.
x
)
*
p
.
x
-
p1
.
y
+
(
p2
.
y
-
p1
.
y
)
/
(
p2
.
x
-
p1
.
x
)
*
p1
.
x
)
<
dx
))
{
return
1
;
}
return
0
;
}
int
GrowLine
::
event_handler
(
glow_eEvent
event
,
double
fx
,
double
fy
)
{
glow_sPoint
p
=
trf
.
reverse
(
fx
,
fy
);
return
local_event_handler
(
event
,
p
.
x
,
p
.
y
);
}
int
GrowLine
::
event_handler
(
glow_eEvent
event
,
int
x
,
int
y
,
double
fx
,
double
fy
)
{
// Convert koordinates to local koordinates
glow_sPoint
r
=
trf
.
reverse
(
fx
,
fy
);
int
sts
=
0
;
if
(
event
==
ctx
->
event_move_node
)
{
sts
=
local_event_handler
(
event
,
r
.
x
,
r
.
y
);
sts
=
event_handler
(
event
,
fx
,
f
y
);
if
(
sts
)
{
/* Register node for potential movement */
ctx
->
move_insert
(
this
);
...
...
@@ -159,7 +153,7 @@ int GrowLine::event_handler(glow_eEvent event, int x, int y, double fx,
else
if
(
ctx
->
hot_found
)
sts
=
0
;
else
{
sts
=
local_event_handler
(
event
,
r
.
x
,
r
.
y
);
sts
=
event_handler
(
event
,
fx
,
f
y
);
if
(
sts
)
ctx
->
hot_found
=
1
;
}
...
...
@@ -176,7 +170,7 @@ int GrowLine::event_handler(glow_eEvent event, int x, int y, double fx,
break
;
}
default:
sts
=
local_event_handler
(
event
,
r
.
x
,
r
.
y
);
sts
=
event_handler
(
event
,
fx
,
f
y
);
}
if
(
sts
)
ctx
->
register_callback_object
(
glow_eObjectType_Node
,
this
);
...
...
xtt/lib/glow/src/glow_growline.h
View file @
3acba18d
...
...
@@ -107,20 +107,6 @@ public:
*/
int
event_handler
(
glow_eEvent
event
,
double
fx
,
double
fy
);
//! Detects if the object is hit by an event in local coordinates
/*!
\param event Current event.
\param x x of event coordinate in the objects local coordinate
system.
\param y y of event coordinate in the objects local coordinate
system.
\return Returns 1 if the object is hit, else 0.
Compares the coordinates of the event with the borders of the object.
If the event is inside the borders, 1 is returned, otherwise 0 is returned.
*/
int
local_event_handler
(
glow_eEvent
event
,
double
x
,
double
y
);
//! Calculate the border for a set of objects or for a parent node.
/*!
\param t Transform.
...
...
xtt/lib/glow/src/glow_growmenu.cpp
View file @
3acba18d
...
...
@@ -301,21 +301,14 @@ void GrowMenu::erase(GlowWind* w, GlowTransform* t, int hot, void* node)
ll_x
,
ll_y
,
ur_x
-
ll_x
,
ur_y
-
ll_y
,
glow_eDrawType_LineErase
,
1
,
0
);
}
int
GrowMenu
::
local_event_handler
(
glow_eEvent
event
,
double
x
,
double
y
)
int
GrowMenu
::
event_handler
(
glow_eEvent
event
,
double
fx
,
double
f
y
)
{
double
ll_x
,
ur_x
,
ll_y
,
ur_y
;
ll_x
=
MIN
(
ll
.
x
,
ur
.
x
);
ur_x
=
MAX
(
ll
.
x
,
ur
.
x
);
ll_y
=
MIN
(
ll
.
y
,
ur
.
y
);
ur_y
=
MAX
(
ll
.
y
,
ur
.
y
);
if
(
ll_x
<=
x
&&
x
<=
ur_x
&&
ll_y
<=
y
&&
y
<=
ur_y
)
{
if
(
MIN
(
ll
.
x
,
ur
.
x
)
<=
fx
&&
fx
<=
MAX
(
ll
.
x
,
ur
.
x
)
&&
MIN
(
ll
.
y
,
ur
.
y
)
<=
fy
&&
fy
<=
MAX
(
ll
.
y
,
ur
.
y
))
{
int
item
;
double
vscale
=
1
;
// trf.vertical_scale();
// std::cout << "Event handler: Hit in menu " << this << '\n';
item
=
int
((
y
-
ll
.
y
)
/
(
item_height
/
vscale
/
ctx
->
mw
.
zoom_factor_y
));
item
=
int
((
f
y
-
ll
.
y
)
/
(
item_height
/
vscale
/
ctx
->
mw
.
zoom_factor_y
));
if
(
item
>
item_cnt
-
1
)
item
=
item_cnt
-
1
;
if
(
item
<
0
)
...
...
@@ -344,17 +337,8 @@ int GrowMenu::local_event_handler(glow_eEvent event, double x, double y)
}
}
int
GrowMenu
::
event_handler
(
glow_eEvent
event
,
double
fx
,
double
fy
)
{
return
local_event_handler
(
event
,
fx
,
fy
);
}
int
GrowMenu
::
event_handler
(
glow_eEvent
event
,
int
x
,
int
y
,
double
fx
,
double
fy
)
{
// Convert koordinates to local koordinates
double
rx
=
fx
;
double
ry
=
fy
;
int
sts
=
0
;
if
(
event
==
ctx
->
event_move_node
)
{
return
0
;
...
...
@@ -364,7 +348,7 @@ int GrowMenu::event_handler(glow_eEvent event, int x, int y, double fx, double f
if
(
ctx
->
hot_mode
!=
glow_eHotMode_TraceAction
&&
ctx
->
hot_found
)
sts
=
0
;
else
{
sts
=
local_event_handler
(
event
,
rx
,
r
y
);
sts
=
event_handler
(
event
,
fx
,
f
y
);
if
(
sts
)
{
ctx
->
hot_found
=
1
;
}
...
...
@@ -393,14 +377,14 @@ int GrowMenu::event_handler(glow_eEvent event, int x, int y, double fx, double f
break
;
}
case
glow_eEvent_MB1Down
:
sts
=
local_event_handler
(
event
,
rx
,
r
y
);
sts
=
event_handler
(
event
,
fx
,
f
y
);
if
(
sts
)
// Remove any previous hit
ctx
->
register_callback_object
(
glow_eObjectType_NoObject
,
0
);
ctx
->
gdraw
->
set_click_sensitivity
(
glow_mSensitivity_MB1Click
);
break
;
case
glow_eEvent_MB1Click
:
{
sts
=
local_event_handler
(
event
,
rx
,
r
y
);
sts
=
event_handler
(
event
,
fx
,
f
y
);
if
(
sts
&&
current_item
!=
-
1
)
{
if
(
info
.
item
[
current_item
].
type
==
glow_eMenuItem_Button
)
{
int
csts
=
ctx
->
send_menu_callback
(
...
...
@@ -418,7 +402,7 @@ int GrowMenu::event_handler(glow_eEvent event, int x, int y, double fx, double f
}
}
default:
sts
=
local_event_handler
(
event
,
rx
,
r
y
);
sts
=
event_handler
(
event
,
fx
,
f
y
);
}
if
(
sts
)
ctx
->
register_callback_object
(
glow_eObjectType_Node
,
this
);
...
...
xtt/lib/glow/src/glow_growmenu.h
View file @
3acba18d
...
...
@@ -180,7 +180,6 @@ public:
int
event_handler
(
glow_eEvent
event
,
int
x
,
int
y
,
double
fx
,
double
fy
);
int
event_handler
(
glow_eEvent
event
,
double
fx
,
double
fy
);
int
local_event_handler
(
glow_eEvent
event
,
double
x
,
double
y
);
//! Check this menu object is a child to the specified menu object, and delete
//! it if it is.
...
...
xtt/lib/glow/src/glow_growpolyline.cpp
View file @
3acba18d
...
...
@@ -579,13 +579,15 @@ GrowPolyLine::~GrowPolyLine()
ctx
->
gdraw
->
set_cursor
(
ctx
->
mw
.
window
,
glow_eDrawCursor_Normal
);
}
int
GrowPolyLine
::
local_event_handler
(
glow_eEvent
event
,
double
x
,
double
y
)
int
GrowPolyLine
::
event_handler
(
glow_eEvent
event
,
double
fx
,
double
f
y
)
{
// Convert from global to local coordinates
glow_sPoint
p
=
trf
.
reverse
(
fx
,
fy
);
if
(
ctx
->
edit_mode
==
grow_eMode_EditPolyLine
&&
ctx
->
a_sel
[
0
]
==
this
)
{
int
dx
=
4
;
int
dy
=
4
;
glow_sPoint
c
=
trf
*
glow_sPoint
({
x
,
y
})
;
glow_sPoint
c
=
trf
*
p
;
c
.
x
=
c
.
x
*
ctx
->
mw
.
zoom_factor_x
+
ctx
->
mw
.
offset_x
;
c
.
y
=
c
.
y
*
ctx
->
mw
.
zoom_factor_y
+
ctx
->
mw
.
offset_y
;
...
...
@@ -611,20 +613,20 @@ int GrowPolyLine::local_event_handler(glow_eEvent event, double x, double y)
p2
=
*
((
GlowPoint
*
)
a_points
[
i
+
1
]);
if
((
feq
(
p1
.
x
,
p2
.
x
)
&&
p1
.
y
<
p2
.
y
&&
// Vertical
fabs
(
p1
.
x
-
x
)
<
dx
&&
p1
.
y
<
y
&&
y
<
p2
.
y
)
fabs
(
p1
.
x
-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
(
feq
(
p1
.
x
,
p2
.
x
)
||
feq
(
p1
.
y
,
p2
.
y
))
&&
p1
.
x
>
p2
.
x
&&
p2
.
x
<=
x
&&
x
<=
p1
.
x
&&
fabs
(
y
-
(
p2
.
y
-
p1
.
y
)
/
(
p2
.
x
-
p1
.
x
)
*
x
-
p1
.
y
+
(
!
(
feq
(
p1
.
x
,
p2
.
x
)
||
feq
(
p1
.
y
,
p2
.
y
))
&&
p1
.
x
>
p2
.
x
&&
p2
.
x
<=
p
.
x
&&
p
.
x
<=
p1
.
x
&&
fabs
(
p
.
y
-
(
p2
.
y
-
p1
.
y
)
/
(
p2
.
x
-
p1
.
x
)
*
p
.
x
-
p1
.
y
+
(
p2
.
y
-
p1
.
y
)
/
(
p2
.
x
-
p1
.
x
)
*
p1
.
x
)
<
dx
))
{
return
1
;
}
...
...
@@ -633,20 +635,11 @@ int GrowPolyLine::local_event_handler(glow_eEvent event, double x, double y)
return
0
;
}
int
GrowPolyLine
::
event_handler
(
glow_eEvent
event
,
double
fx
,
double
fy
)
{
glow_sPoint
p
=
trf
.
reverse
(
fx
,
fy
);
return
local_event_handler
(
event
,
p
.
x
,
p
.
y
);
}
int
GrowPolyLine
::
event_handler
(
glow_eEvent
event
,
int
x
,
int
y
,
double
fx
,
double
fy
)
{
// Convert koordinates to local koordinates
glow_sPoint
r
=
trf
.
reverse
(
fx
,
fy
);
int
sts
=
0
;
if
(
event
==
ctx
->
event_move_node
)
{
sts
=
local_event_handler
(
event
,
r
.
x
,
r
.
y
);
sts
=
event_handler
(
event
,
fx
,
f
y
);
if
(
sts
)
{
/* Register node for potential movement */
ctx
->
move_insert
(
this
);
...
...
@@ -660,7 +653,7 @@ int GrowPolyLine::event_handler(glow_eEvent event, int x, int y, double fx, doub
else
if
(
ctx
->
hot_found
)
sts
=
0
;
else
{
sts
=
local_event_handler
(
event
,
r
.
x
,
r
.
y
);
sts
=
event_handler
(
event
,
fx
,
f
y
);
if
(
sts
)
ctx
->
hot_found
=
1
;
}
...
...
@@ -677,7 +670,7 @@ int GrowPolyLine::event_handler(glow_eEvent event, int x, int y, double fx, doub
break
;
}
default:
sts
=
local_event_handler
(
event
,
r
.
x
,
r
.
y
);
sts
=
event_handler
(
event
,
fx
,
f
y
);
}
if
(
sts
)
ctx
->
register_callback_object
(
glow_eObjectType_Node
,
this
);
...
...
xtt/lib/glow/src/glow_growpolyline.h
View file @
3acba18d
...
...
@@ -110,20 +110,6 @@ public:
*/
int
event_handler
(
glow_eEvent
event
,
double
fx
,
double
fy
);
//! Detects if the object is hit by an event in local coordinates
/*!
\param event Current event.
\param x x of event coordinate in the objects local coordinate
system.
\param y y of event coordinate in the objects local coordinate
system.
\return Returns 1 if the object is hit, else 0.
Compares the coordinates of the event with the borders of the object.
If the event is inside the borders, 1 is returned, otherwise 0 is returned.
*/
int
local_event_handler
(
glow_eEvent
event
,
double
x
,
double
y
);
//! Calculate the border for a set of objects or for a parent node.
/*!
\param t Transform.
...
...
xtt/lib/glow/src/glow_growrect.cpp
View file @
3acba18d
...
...
@@ -115,36 +115,19 @@ void GrowRect::move(double delta_x, double delta_y, int grid)
}
}
int
GrowRect
::
local_event_handler
(
glow_eEvent
event
,
double
x
,
double
y
)
{
double
ll_x
,
ur_x
,
ll_y
,
ur_y
;
ll_x
=
MIN
(
ll
.
x
,
ur
.
x
);
ur_x
=
MAX
(
ll
.
x
,
ur
.
x
);
ll_y
=
MIN
(
ll
.
y
,
ur
.
y
);
ur_y
=
MAX
(
ll
.
y
,
ur
.
y
);
if
(
ll_x
<=
x
&&
x
<=
ur_x
&&
ll_y
<=
y
&&
y
<=
ur_y
)
{
// std::cout << "Event handler: Hit in rect\n";
return
1
;
}
else
return
0
;
}
int
GrowRect
::
event_handler
(
glow_eEvent
event
,
double
fx
,
double
fy
)
{
// Convert from global to local coordinates
glow_sPoint
p
=
trf
.
reverse
(
fx
,
fy
);
return
local_event_handler
(
event
,
p
.
x
,
p
.
y
);
return
(
MIN
(
ll
.
x
,
ur
.
x
)
<=
p
.
x
&&
p
.
x
<=
MAX
(
ll
.
x
,
ur
.
x
)
&&
MIN
(
ll
.
y
,
ur
.
y
)
<=
p
.
y
&&
p
.
y
<=
MAX
(
ll
.
y
,
ur
.
y
));
}
int
GrowRect
::
event_handler
(
glow_eEvent
event
,
int
x
,
int
y
,
double
fx
,
double
fy
)
{
// Convert koordinates to local koordinates
glow_sPoint
r
=
trf
.
reverse
(
fx
,
fy
);
int
sts
=
0
;
if
(
event
==
ctx
->
event_move_node
)
{
sts
=
local_event_handler
(
event
,
r
.
x
,
r
.
y
);
sts
=
event_handler
(
event
,
fx
,
f
y
);
if
(
sts
)
{
/* Register node for potential movement */
ctx
->
move_insert
(
this
);
...
...
@@ -158,7 +141,7 @@ int GrowRect::event_handler(glow_eEvent event, int x, int y, double fx, double f
else
if
(
ctx
->
hot_found
)
sts
=
0
;
else
{
sts
=
local_event_handler
(
event
,
r
.
x
,
r
.
y
);
sts
=
event_handler
(
event
,
fx
,
f
y
);
if
(
sts
)
ctx
->
hot_found
=
1
;
}
...
...
@@ -176,7 +159,7 @@ int GrowRect::event_handler(glow_eEvent event, int x, int y, double fx, double f
break
;
}
default:
sts
=
local_event_handler
(
event
,
r
.
x
,
r
.
y
);
sts
=
event_handler
(
event
,
fx
,
f
y
);
}
if
(
sts
)
ctx
->
register_callback_object
(
glow_eObjectType_Node
,
this
);
...
...
xtt/lib/glow/src/glow_growrect.h
View file @
3acba18d
...
...
@@ -111,20 +111,6 @@ public:
*/
int
event_handler
(
glow_eEvent
event
,
double
fx
,
double
fy
);
//! Detects if the object is hit by an event in local coordinates
/*!
\param event Current event.
\param x x of event coordinate in the objects local coordinate
system.
\param y y of event coordinate in the objects local coordinate
system.
\return Returns 1 if the object is hit, else 0.
Compares the coordinates of the event with the borders of the object.
If the event is inside the borders, 1 is returned, otherwise 0 is returned.
*/
virtual
int
local_event_handler
(
glow_eEvent
event
,
double
x
,
double
y
);
//! Calculate the border for a set of objects or for a parent node.
/*!
\param t Transform.
...
...
xtt/lib/glow/src/glow_growrectrounded.cpp
View file @
3acba18d
...
...
@@ -112,36 +112,19 @@ void GrowRectRounded::move(double delta_x, double delta_y, int grid)
}
}
int
GrowRectRounded
::
local_event_handler
(
glow_eEvent
event
,
double
x
,
double
y
)
{
double
ll_x
,
ur_x
,
ll_y
,
ur_y
;
ll_x
=
MIN
(
ll
.
x
,
ur
.
x
);
ur_x
=
MAX
(
ll
.
x
,
ur
.
x
);
ll_y
=
MIN
(
ll
.
y
,
ur
.
y
);
ur_y
=
MAX
(
ll
.
y
,
ur
.
y
);
if
(
ll_x
<=
x
&&
x
<=
ur_x
&&
ll_y
<=
y
&&
y
<=
ur_y
)
{
// std::cout << "Event handler: Hit in rect\n";
return
1
;
}
else
return
0
;
}
int
GrowRectRounded
::
event_handler
(
glow_eEvent
event
,
double
fx
,
double
fy
)
{
// Convert from global to local coordinates
glow_sPoint
p
=
trf
.
reverse
(
fx
,
fy
);
return
local_event_handler
(
event
,
p
.
x
,
p
.
y
);
return
(
MIN
(
ll
.
x
,
ur
.
x
)
<=
p
.
x
&&
p
.
x
<=
MAX
(
ll
.
x
,
ur
.
x
)
&&
MIN
(
ll
.
y
,
ur
.
y
)
<=
p
.
y
&&
p
.
y
<=
MAX
(
ll
.
y
,
ur
.
y
));
}
int
GrowRectRounded
::
event_handler
(
glow_eEvent
event
,
int
x
,
int
y
,
double
fx
,
double
fy
)
{
// Convert koordinates to local koordinates
glow_sPoint
r
=
trf
.
reverse
(
fx
,
fy
);
int
sts
=
0
;
if
(
event
==
ctx
->
event_move_node
)
{
sts
=
local_event_handler
(
event
,
r
.
x
,
r
.
y
);
sts
=
event_handler
(
event
,
fx
,
f
y
);
if
(
sts
)
{
/* Register node for potential movement */
ctx
->
move_insert
(
this
);
...
...
@@ -155,7 +138,7 @@ int GrowRectRounded::event_handler(glow_eEvent event, int x, int y, double fx, d
else
if
(
ctx
->
hot_found
)
sts
=
0
;
else
{
sts
=
local_event_handler
(
event
,
r
.
x
,
r
.
y
);
sts
=
event_handler
(
event
,
fx
,
f
y
);
if
(
sts
)
ctx
->
hot_found
=
1
;
}
...
...
@@ -172,7 +155,7 @@ int GrowRectRounded::event_handler(glow_eEvent event, int x, int y, double fx, d
break
;
}
default:
sts
=
local_event_handler
(
event
,
r
.
x
,
r
.
y
);
sts
=
event_handler
(
event
,
fx
,
f
y
);
}
if
(
sts
)
ctx
->
register_callback_object
(
glow_eObjectType_Node
,
this
);
...
...
xtt/lib/glow/src/glow_growrectrounded.h
View file @
3acba18d
...
...
@@ -109,20 +109,6 @@ public:
*/
int
event_handler
(
glow_eEvent
event
,
double
fx
,
double
fy
);
//! Detects if the object is hit by an event in local coordinates
/*!
\param event Current event.
\param x x of event coordinate in the objects local coordinate
system.
\param y y of event coordinate in the objects local coordinate
system.
\return Returns 1 if the object is hit, else 0.
Compares the coordinates of the event with the borders of the object.
If the event is inside the borders, 1 is returned, otherwise 0 is returned.
*/
int
local_event_handler
(
glow_eEvent
event
,
double
x
,
double
y
);
//! Calculate the border for a set of objects or for a parent node.
/*!
\param t Transform.
...
...
xtt/lib/glow/src/glow_growtable.cpp
View file @
3acba18d
...
...
@@ -1106,9 +1106,7 @@ int GrowTable::event_handler(glow_eEvent event, int x, int y, double fx, double
if
(
!
ctx
->
trace_started
)
return
0
;
if
(
v_scrollbar
)
{
// Convert koordinates to local koordinates
glow_sPoint
r
=
trf
.
reverse
(
fx
,
fy
);
sts
=
local_event_handler
(
event
,
r
.
x
,
r
.
y
);
sts
=
GrowRect
::
event_handler
(
event
,
fx
,
fy
);
if
(
sts
)
{
v_value
-=
(
table_y1
-
table_y0
)
*
window_scale
/
50
;
if
(
v_value
<
table_y0
*
window_scale
)
...
...
@@ -1124,9 +1122,7 @@ int GrowTable::event_handler(glow_eEvent event, int x, int y, double fx, double
if
(
!
ctx
->
trace_started
)
return
0
;
if
(
v_scrollbar
)
{
// Convert koordinates to local koordinates
glow_sPoint
r
=
trf
.
reverse
(
fx
,
fy
);
sts
=
local_event_handler
(
event
,
r
.
x
,
r
.
y
);
sts
=
GrowRect
::
event_handler
(
event
,
fx
,
fy
);
if
(
sts
)
{
v_value
+=
(
table_y1
-
table_y0
)
*
window_scale
/
50
;
if
(
v_value
>
(
table_y1
-
(
y_high
-
y_low
...
...
xtt/lib/glow/src/glow_growtext.cpp
View file @
3acba18d
...
...
@@ -111,21 +111,16 @@ void GrowText::move(double delta_x, double delta_y, int grid)
}
}
int
GrowText
::
local_event_handler
(
glow_eEvent
event
,
double
x
,
double
y
)
{
return
(
x_left
<=
x
&&
x
<=
x_right
&&
y_low
<=
y
&&
y
<=
y_high
);
}
int
GrowText
::
event_handler
(
glow_eEvent
event
,
double
fx
,
double
fy
)
{
return
local_event_handler
(
event
,
fx
,
fy
);
return
(
x_left
<=
fx
&&
fx
<=
x_right
&&
y_low
<=
fy
&&
fy
<=
y_high
);
}
int
GrowText
::
event_handler
(
glow_eEvent
event
,
int
x
,
int
y
,
double
fx
,
double
fy
)
{
int
sts
=
0
;
if
(
event
==
ctx
->
event_move_node
)
{
sts
=
local_
event_handler
(
event
,
fx
,
fy
);
sts
=
event_handler
(
event
,
fx
,
fy
);
if
(
sts
)
{
/* Register node for potential movement */
ctx
->
move_insert
(
this
);
...
...
@@ -139,7 +134,7 @@ int GrowText::event_handler(glow_eEvent event, int x, int y, double fx, double f
else
if
(
ctx
->
hot_found
)
sts
=
0
;
else
{
sts
=
local_
event_handler
(
event
,
fx
,
fy
);
sts
=
event_handler
(
event
,
fx
,
fy
);
if
(
sts
)
ctx
->
hot_found
=
1
;
}
...
...
@@ -156,7 +151,7 @@ int GrowText::event_handler(glow_eEvent event, int x, int y, double fx, double f
break
;
}
default:
sts
=
local_
event_handler
(
event
,
fx
,
fy
);
sts
=
event_handler
(
event
,
fx
,
fy
);
}
if
(
sts
)
ctx
->
register_callback_object
(
glow_eObjectType_Node
,
this
);
...
...
xtt/lib/glow/src/glow_growtext.h
View file @
3acba18d
...
...
@@ -112,20 +112,6 @@ public:
*/
int
event_handler
(
glow_eEvent
event
,
double
fx
,
double
fy
);
//! Detects if the object is hit by an event in local coordinates
/*!
\param event Current event.
\param x x of event coordinate in the objects local coordinate
system.
\param y y of event coordinate in the objects local coordinate
system.
\return Returns 1 if the object is hit, else 0.
Compares the coordinates of the event with the borders of the object.
If the event is inside the borders, 1 is returned, otherwise 0 is returned.
*/
int
local_event_handler
(
glow_eEvent
event
,
double
x
,
double
y
);
//! Calculate the border for a set of objects or for a parent node.
/*!
\param t Transform.
...
...
xtt/lib/glow/src/glow_growwindow.cpp
View file @
3acba18d
...
...
@@ -571,9 +571,7 @@ int GrowWindow::event_handler(glow_eEvent event, int x, int y, double fx, double
if
(
!
ctx
->
trace_started
)
return
0
;
if
(
v_scrollbar
)
{
// Convert koordinates to local koordinates
glow_sPoint
r
=
trf
.
reverse
(
fx
,
fy
);
sts
=
local_event_handler
(
event
,
r
.
x
,
r
.
y
);
sts
=
GrowRect
::
event_handler
(
event
,
fx
,
fy
);
if
(
sts
)
{
v_value
-=
(
wctx_y1
-
wctx_y0
)
*
window_scale
/
50
;
if
(
v_value
<
wctx_y0
*
window_scale
)
...
...
@@ -589,9 +587,7 @@ int GrowWindow::event_handler(glow_eEvent event, int x, int y, double fx, double
if
(
!
ctx
->
trace_started
)
return
0
;
if
(
v_scrollbar
)
{
// Convert koordinates to local koordinates
glow_sPoint
r
=
trf
.
reverse
(
fx
,
fy
);
sts
=
local_event_handler
(
event
,
r
.
x
,
r
.
y
);
sts
=
GrowRect
::
event_handler
(
event
,
fx
,
fy
);
if
(
sts
)
{
v_value
+=
(
wctx_y1
-
wctx_y0
)
*
window_scale
/
50
;
if
(
v_value
>
wctx_y1
*
window_scale
...
...
@@ -633,9 +629,7 @@ int GrowWindow::event_handler(glow_eEvent event, int x, int y, double fx, double
}
if
(
ctx
->
hot_mode
==
glow_eHotMode_TraceAction
)
{
// Convert koordinates to local koordinates
glow_sPoint
r
=
trf
.
reverse
(
fx
,
fy
);
sts
=
local_event_handler
(
event
,
r
.
x
,
r
.
y
);
sts
=
GrowRect
::
event_handler
(
event
,
fx
,
fy
);
}
if
(
window_ctx
&&
sts
)
{
...
...
@@ -680,10 +674,6 @@ int GrowWindow::event_handler(glow_eEvent event, int x, int y, double fx, double
ctx
->
register_inputfocus
(
this
,
0
);
input_focus
=
0
;
}
// if ( window_ctx->callback_object)
// ctx->register_callback_object( window_ctx->callback_object_type,
// window_ctx->callback_object);
}
return
sts
;
}
...
...
Write
Preview
Markdown
is supported
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