Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Open sidebar
OpenWalnut
OpenWalnut Core
Commits
a30d79db
Commit
a30d79db
authored
Mar 04, 2021
by
Robin Eschbach
Browse files
[ADD
#41
] keyboard logging
parent
4321ff00
Changes
5
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
132 additions
and
8 deletions
+132
-8
src/modules/pointConnector/WClickHandler.cpp
src/modules/pointConnector/WClickHandler.cpp
+1
-1
src/modules/pointConnector/WKeyboardHandler.cpp
src/modules/pointConnector/WKeyboardHandler.cpp
+49
-0
src/modules/pointConnector/WKeyboardHandler.h
src/modules/pointConnector/WKeyboardHandler.h
+72
-0
src/modules/pointConnector/WMPointConnector.cpp
src/modules/pointConnector/WMPointConnector.cpp
+8
-5
src/modules/pointConnector/WMPointConnector.h
src/modules/pointConnector/WMPointConnector.h
+2
-2
No files found.
src/modules/pointConnector/WClickHandler.cpp
View file @
a30d79db
...
...
@@ -31,7 +31,7 @@ WClickHandler::WClickHandler( WMPointConnector* connector ):
bool
WClickHandler
::
handle
(
const
osgGA
::
GUIEventAdapter
&
ea
,
osgGA
::
GUIActionAdapter
&
aa
)
{
osgViewer
::
Viewer
*
viewer
=
dynamic_cast
<
osgViewer
::
Viewer
*>
(
&
aa
);
osgViewer
::
Viewer
*
viewer
=
dynamic_cast
<
osgViewer
::
Viewer
*
>
(
&
aa
);
if
(
ea
.
getEventType
()
==
osgGA
::
GUIEventAdapter
::
RELEASE
&&
ea
.
getButton
()
!=
osgGA
::
GUIEventAdapter
::
MIDDLE_MOUSE_BUTTON
)
{
...
...
src/modules/pointConnector/WKeyboardHandler.cpp
0 → 100644
View file @
a30d79db
//---------------------------------------------------------------------------
//
// Project: OpenWalnut ( http://www.openwalnut.org )
//
// Copyright 2009 OpenWalnut Community, BSV@Uni-Leipzig and CNCF@MPI-CBS
// For more information see http://www.openwalnut.org/copying
//
// This file is part of OpenWalnut.
//
// OpenWalnut is free software: you can redistribute it and/or modify
// it under the terms of the GNU Lesser General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// OpenWalnut is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU Lesser General Public License for more details.
//
// You should have received a copy of the GNU Lesser General Public License
// along with OpenWalnut. If not, see <http://www.gnu.org/licenses/>.
//
//---------------------------------------------------------------------------
#include "WKeyboardHandler.h"
WKeyboardHandler
::
WKeyboardHandler
(
WMPointConnector
*
connector
)
:
m_connector
(
connector
)
{
}
bool
WKeyboardHandler
::
handle
(
const
osgGA
::
GUIEventAdapter
&
ea
,
osgGA
::
GUIActionAdapter
&
aa
)
{
if
(
ea
.
getEventType
()
==
osgGA
::
GUIEventAdapter
::
KEYDOWN
)
{
std
::
cout
<<
"DOWN KEY:
\t\t\t
"
<<
ea
.
getKey
()
<<
std
::
endl
;
std
::
cout
<<
"
\t
Unmodified Key:
\t\t
"
<<
ea
.
getUnmodifiedKey
()
<<
std
::
endl
;
std
::
cout
<<
"
\t
ModKeyMask:
\t\t
"
<<
ea
.
getModKeyMask
()
<<
std
::
endl
;
}
if
(
ea
.
getEventType
()
==
osgGA
::
GUIEventAdapter
::
KEYUP
)
{
std
::
cout
<<
"UP KEY:
\t\t\t\t
"
<<
ea
.
getKey
()
<<
std
::
endl
;
std
::
cout
<<
"
\t
Unmodified Key:
\t\t
"
<<
ea
.
getUnmodifiedKey
()
<<
std
::
endl
;
std
::
cout
<<
"
\t
ModKeyMask:
\t\t
"
<<
ea
.
getModKeyMask
()
<<
std
::
endl
;
}
return
false
;
}
src/modules/pointConnector/WKeyboardHandler.h
0 → 100644
View file @
a30d79db
//---------------------------------------------------------------------------
//
// Project: OpenWalnut ( http://www.openwalnut.org )
//
// Copyright 2009 OpenWalnut Community, BSV@Uni-Leipzig and CNCF@MPI-CBS
// For more information see http://www.openwalnut.org/copying
//
// This file is part of OpenWalnut.
//
// OpenWalnut is free software: you can redistribute it and/or modify
// it under the terms of the GNU Lesser General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// OpenWalnut is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU Lesser General Public License for more details.
//
// You should have received a copy of the GNU Lesser General Public License
// along with OpenWalnut. If not, see <http://www.gnu.org/licenses/>.
//
//---------------------------------------------------------------------------
#ifndef WKEYBOARDHANDLER_H
#define WKEYBOARDHANDLER_H
#include <iostream>
#include <string>
#include <osg/Geode>
#include <osg/Viewport>
#include <osgGA/GUIEventHandler>
#include <osgViewer/Viewer>
#include "WMPointConnector.h"
/**
* Forward declartion for the WMPointConnector
*/
class
WMPointConnector
;
/**
* The click handler for the mouse keyboard events of WMPointConnector
*/
class
WKeyboardHandler
:
public
osgGA
::
GUIEventHandler
{
public:
/**
* Constructs one WKeyboardHandler.
* \param connector The WMPointConnector this handler belongs to.
*/
explicit
WKeyboardHandler
(
WMPointConnector
*
connector
);
/**
* The callback for the event listener.
* \param ea The Adapter of the event.
* \param aa The Adapter of the action.
* \return Whether the event should be passed on.
*/
bool
handle
(
const
osgGA
::
GUIEventAdapter
&
ea
,
osgGA
::
GUIActionAdapter
&
aa
);
private:
/**
* The WMPointConnector this handler belongs to.
*/
WMPointConnector
*
m_connector
;
bool
m_isCtrl
=
false
;
};
#endif // WKEYBOARDHANDLER_H
src/modules/pointConnector/WMPointConnector.cpp
View file @
a30d79db
...
...
@@ -27,6 +27,7 @@
#include "WConnectorData.h"
#include "WClickHandler.h"
#include "WKeyboardHandler.h"
#include "WFiberHandler.h"
#include "WMPointConnector.h"
...
...
@@ -87,7 +88,7 @@ void WMPointConnector::moduleMain()
m_moduleState
.
add
(
m_pointInput
->
getDataChangedCondition
()
);
createPointRenderer
();
create
Click
Handler
();
createHandler
();
ready
();
...
...
@@ -115,11 +116,13 @@ void WMPointConnector::createPointRenderer()
m_properties
->
addProperty
(
m_pointRenderer
->
getProperties
()
->
getProperty
(
"Point Size"
)
);
}
void
WMPointConnector
::
create
Click
Handler
()
void
WMPointConnector
::
createHandler
()
{
osg
::
ref_ptr
<
osgViewer
::
View
>
viewer
=
WKernel
::
getRunningKernel
()
->
getGraphicsEngine
()
->
getViewer
()
->
getView
();
osg
::
ref_ptr
<
WClickHandler
>
handler
=
new
WClickHandler
(
this
);
viewer
->
addEventHandler
(
handler
.
get
()
);
osg
::
ref_ptr
<
WClickHandler
>
clickHandler
=
new
WClickHandler
(
this
);
viewer
->
addEventHandler
(
clickHandler
.
get
()
);
osg
::
ref_ptr
<
WKeyboardHandler
>
keyboardHandler
=
new
WKeyboardHandler
(
this
);
viewer
->
addEventHandler
(
keyboardHandler
.
get
()
);
}
void
WMPointConnector
::
handleInput
()
...
...
src/modules/pointConnector/WMPointConnector.h
View file @
a30d79db
...
...
@@ -155,9 +155,9 @@ private:
void
createPointRenderer
();
/**
* Creates the WClickHandler and registers
i
t.
* Creates the WClickHandler and
the WKeyboardHandler and
registers t
hem
.
*/
void
create
Click
Handler
();
void
createHandler
();
/**
* Handles the input of this module.
...
...
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