Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
K
kicad-source-mirror
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Commits
Open sidebar
Elphel
kicad-source-mirror
Commits
a525c890
Commit
a525c890
authored
Jul 15, 2014
by
Maciej Suminski
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Alternative way to handle mouse buttons (GAL).
parent
0adb6fa9
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
38 additions
and
2 deletions
+38
-2
tool_dispatcher.cpp
common/tool/tool_dispatcher.cpp
+38
-2
No files found.
common/tool/tool_dispatcher.cpp
View file @
a525c890
...
...
@@ -85,6 +85,30 @@ struct TOOL_DISPATCHER::BUTTON_STATE
dragging
=
false
;
pressed
=
false
;
}
///> Checks the current state of the button.
bool
GetState
()
const
{
wxMouseState
mouseState
=
wxGetMouseState
();
switch
(
button
)
{
case
BUT_LEFT
:
return
mouseState
.
LeftIsDown
();
case
BUT_MIDDLE
:
return
mouseState
.
MiddleIsDown
();
case
BUT_RIGHT
:
return
mouseState
.
RightIsDown
();
default
:
assert
(
false
);
break
;
}
return
false
;
}
};
...
...
@@ -129,9 +153,21 @@ bool TOOL_DISPATCHER::handleMouseButton( wxEvent& aEvent, int aIndex, bool aMoti
boost
::
optional
<
TOOL_EVENT
>
evt
;
bool
isClick
=
false
;
bool
up
=
type
==
st
->
upEvent
;
bool
down
=
type
==
st
->
downEvent
;
// bool up = type == st->upEvent;
// bool down = type == st->downEvent;
bool
up
=
false
,
down
=
false
;
bool
dblClick
=
type
==
st
->
dblClickEvent
;
bool
state
=
st
->
GetState
();
if
(
!
dblClick
)
{
// Sometimes the dispatcher does not receive mouse button up event, so it stays
// in the dragging mode even if the mouse button is not held anymore
if
(
st
->
pressed
&&
!
state
)
up
=
true
;
else
if
(
!
st
->
pressed
&&
state
)
down
=
true
;
}
int
mods
=
decodeModifiers
<
wxMouseEvent
>
(
static_cast
<
wxMouseEvent
*>
(
&
aEvent
)
);
int
args
=
st
->
button
|
mods
;
...
...
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