2#include "MRViewerFwd.h"
3#include "MRMesh/MRphmap.h"
59 bool repeatable =
true;
62 inline static const std::string categoryNames[6] = {
"Info",
"Edit",
"View",
"Scene",
"Objects",
"Selection " };
69 using ShortcutList = std::vector<std::tuple<ShortcutKey, Category, std::string>>;
83 void enable(
bool on ) { enabled_ = on; }
88 MRVIEWER_API
bool onKeyDown_(
int key,
int modifier )
override;
113 bool enabled_{
true };
Definition MRShortcutManager.h:47
static ShortcutKey kayAndModFromMapKey(int mapKey)
returns key with modifier (alt, ctrl, shift, etc.) from simple map key
Definition MRShortcutManager.h:108
MRVIEWER_API const ShortcutList & getShortcutList() const
HashMap< std::string, int > ShourtcutsBackMap
Definition MRShortcutManager.h:111
Reason
Definition MRShortcutManager.h:76
static MRVIEWER_API const char * getModifierString(int mod)
make string from strictly one modifier
static MRVIEWER_API std::string getKeyString(int key)
make string from a key without modifiers, for arrow characters it uses icons font
MRVIEWER_API bool onKeyDown_(int key, int modifier) override
int key
Definition MRShortcutManager.h:17
virtual MRVIEWER_API bool processShortcut(const ShortcutKey &key, Reason=Reason::KeyDown) const
if given key has action in shortcut map - process it and returns true, otherwise returns false;
void enable(bool on)
Definition MRShortcutManager.h:83
MRVIEWER_API void clear()
clear all saved shortcuts
virtual MRVIEWER_API void setShortcut(const ShortcutKey &key, const ShortcutCommand &command)
std::function< void()> action
name of action
Definition MRShortcutManager.h:58
std::string name
Definition MRShortcutManager.h:57
std::vector< std::tuple< ShortcutKey, Category, std::string > > ShortcutList
Definition MRShortcutManager.h:69
HashMap< int, ShortcutCommand > ShourtcutsMap
Definition MRShortcutManager.h:110
ShourtcutsBackMap backMap_
Definition MRShortcutManager.h:116
ShourtcutsMap map_
Definition MRShortcutManager.h:115
bool isEnabled() const
processShortcut does nothing if not enabled
Definition MRShortcutManager.h:82
ShortcutCategory
Definition MRShortcutManager.h:31
bool operator<(const ShortcutKey &other) const
Definition MRShortcutManager.h:20
virtual ~ShortcutManager()=default
Category category
Definition MRShortcutManager.h:56
static MRVIEWER_API int mapKeyFromKeyAndMod(const ShortcutKey &key, bool respectKeyboard)
static MRVIEWER_API std::string getKeyFullString(const ShortcutKey &key, bool respectKey=true)
make string from all modifiers and with/without key and returns it
MRVIEWER_API std::optional< ShortcutKey > findShortcutByName(const std::string &name) const
if action with given name is present in shortcut list - returns it
std::optional< ShortcutList > listCache_
Definition MRShortcutManager.h:118
int mod
Definition MRShortcutManager.h:18
MRVIEWER_API bool onKeyRepeat_(int key, int modifier) override
@ other
Angle, normally float. Measure in radians.
only for bindings generation
Definition MRCameraOrientationPlugin.h:8
Definition MRViewerEventsListener.h:32
Definition MRShortcutManager.h:16
Definition MRShortcutManager.h:55