1
0
mirror of https://git.dev.opencascade.org/repos/occt.git synced 2025-08-09 13:22:24 +03:00

0031621: Draw Harness - handle navigation keys

AIS_ViewController::handleNavigationKeys() - added an interface for processing navigation keys.
ViewerTest_EventManager now maps WASD+Arrows navigation keys.
Axonometric view hotkey A has been replaced by Backspace.
Shaded/Wireframe are now mapped with hotkeys W+Ctrl/S+Ctrl.
Hotkey D (reset view to undefined default state) has been removed.
This commit is contained in:
kgv
2020-06-20 14:57:02 +03:00
committed by bugmaster
parent 2ff1d580f1
commit d22962e4e0
6 changed files with 304 additions and 18 deletions

View File

@@ -81,6 +81,11 @@ public:
Aspect_VKeyFlags theModifiers,
bool theIsEmulated) Standard_OVERRIDE;
//! Release key.
Standard_EXPORT virtual void KeyDown (Aspect_VKey theKey,
double theTime,
double thePressure = 1.0) Standard_OVERRIDE;
//! Release key.
Standard_EXPORT virtual void KeyUp (Aspect_VKey theKey,
double theTime) Standard_OVERRIDE;
@@ -98,10 +103,33 @@ public:
//! Handle KeyPress event.
Standard_EXPORT void ProcessKeyPress (Aspect_VKey theKey);
protected:
//! Register hot-keys for specified Action.
void addActionHotKeys (Aspect_VKey theAction,
unsigned int theHotKey1 = 0,
unsigned int theHotKey2 = 0,
unsigned int theHotKey3 = 0,
unsigned int theHotKey4 = 0,
unsigned int theHotKey5 = 0)
{
if (theHotKey1 != 0) { myNavKeyMap.Bind (theHotKey1, theAction); }
if (theHotKey2 != 0) { myNavKeyMap.Bind (theHotKey2, theAction); }
if (theHotKey3 != 0) { myNavKeyMap.Bind (theHotKey3, theAction); }
if (theHotKey4 != 0) { myNavKeyMap.Bind (theHotKey4, theAction); }
if (theHotKey5 != 0) { myNavKeyMap.Bind (theHotKey5, theAction); }
}
//! Handle modifier key changes.
Standard_EXPORT bool navigationKeyModifierSwitch (unsigned int theModifOld,
unsigned int theModifNew,
double theTimeStamp);
private:
Handle(AIS_InteractiveContext) myCtx;
Handle(V3d_View) myView;
NCollection_DataMap<unsigned int, Aspect_VKey> myNavKeyMap; //!< map of Hot-Key (key+modifiers) to Action
TCollection_AsciiString myPickPntArgVec[3];
Standard_Boolean myToPickPnt;