1
////////////////////////////////////////////////////////////////////////////
2
// NoteCase notes manager project <http://notecase.sf.net>
4
// This code is licensed under BSD license.See "license.txt" for more details.
6
// File: Implements list of keyboard shortcuts for program actions
7
////////////////////////////////////////////////////////////////////////////
9
#ifndef SHORTCUTSLIST_H__
10
#define SHORTCUTSLIST_H__
14
#endif // _MSC_VER > 1000
19
#include "lib/debug.h"
21
//define for each action (that can have a shortcut)
23
NC_ACTION_DOC_NEW = 1,
26
NC_ACTION_DOC_SAVE_AS,
32
NC_ACTION_TREE_NODE_NEW,
33
NC_ACTION_TREE_NODE_NEW_CHILD,
34
NC_ACTION_TREE_NODE_DELETE,
35
NC_ACTION_TREE_NODE_RENAME,
36
NC_ACTION_TREE_NODE_MOVE_UP,
37
NC_ACTION_TREE_NODE_MOVE_DOWN,
38
NC_ACTION_TREE_NODE_MOVE_LEFT,
39
NC_ACTION_TREE_NODE_MOVE_RIGHT,
40
NC_ACTION_TREE_NODE_PROPERTIES,
41
NC_ACTION_TREE_NODE_DELETE_FINISHED,
42
NC_ACTION_TREE_NODE_TOGGLE_FINISHED,
43
NC_ACTION_TREE_SORT_CHILDREN_ASC,
44
NC_ACTION_TREE_SORT_CHILDREN_DESC,
45
NC_ACTION_TREE_SORT_ROOT_ASC,
46
NC_ACTION_TREE_SORT_ROOT_DESC,
47
NC_ACTION_TREE_EXPAND_ALL,
48
NC_ACTION_TREE_COLAPSE_ALL,
54
NC_ACTION_EDIT_DELETE,
55
NC_ACTION_EDIT_COPY_BR_STRUCT, //copy branch structure
56
NC_ACTION_EDIT_PASTE_BR_ROOT, //paste branch to root
57
NC_ACTION_EDIT_INSERT_DATETIME,
59
NC_ACTION_EDIT_FIND_NEXT,
60
NC_ACTION_EDIT_REPLACE,
61
NC_ACTION_EDIT_LINK_WIZARD,
62
NC_ACTION_EDIT_INSERT_PICTURE,
63
NC_ACTION_EDIT_ATTACHMENTS,
64
NC_ACTION_EDIT_SHORTCUTS,
65
NC_ACTION_EDIT_OPTIONS,
66
NC_ACTION_FORMAT_BOLD,
67
NC_ACTION_FORMAT_ITALIC,
68
NC_ACTION_FORMAT_UNDERLINE,
69
NC_ACTION_FORMAT_STRIKETHROUGH,
70
NC_ACTION_FORMAT_COLOR,
71
NC_ACTION_FORMAT_REMOVE,
72
NC_ACTION_VIEW_TOOLBAR,
73
NC_ACTION_VIEW_STATUS_BAR,
74
NC_ACTION_VIEW_NODE_TITLEBAR,
76
NC_ACTION_VIEW_CHANGE_MODE,
77
NC_ACTION_VIEW_WORD_COUNT,
81
NC_ACTION_PASSWORD_CHANGE,
82
DUMMY_ITEM2, // keeps IDs sychronized with Pro version
83
NC_ACTION_FORMAT_BKG_COLOR,
85
NC_ACTION_VIEW_FULLSCREEN,
86
DUMMY_ITEM3, // keeps IDs sychronized with Pro version
87
DUMMY_ITEM4, // keeps IDs sychronized with Pro version
88
NC_ACTION_LOCK_DOCUMENT,
89
DUMMY_ITEM5, // keeps IDs sychronized with Pro version
90
DUMMY_ITEM6, // keeps IDs sychronized with Pro version
91
DUMMY_ITEM7, // keeps IDs sychronized with Pro version
92
DUMMY_ITEM8, // keeps IDs sychronized with Pro version
93
DUMMY_ITEM9, // keeps IDs sychronized with Pro version
94
DUMMY_ITEM10, // keeps IDs sychronized with Pro version
95
DUMMY_ITEM11, // keeps IDs sychronized with Pro version
96
DUMMY_ITEM12, // keeps IDs sychronized with Pro version
97
DUMMY_ITEM13, // keeps IDs sychronized with Pro version
98
DUMMY_ITEM14, // keeps IDs sychronized with Pro version
99
DUMMY_ITEM15, // keeps IDs sychronized with Pro version
100
DUMMY_ITEM16, // keeps IDs sychronized with Pro version
101
DUMMY_ITEM17, // keeps IDs sychronized with Pro version
102
DUMMY_ITEM18, // keeps IDs sychronized with Pro version
103
DUMMY_ITEM19, // keeps IDs sychronized with Pro version
104
NC_ACTION_VISIT_WEBSITE
108
#define SH_CTX_GLOBAL 0
109
#define SH_CTX_TREE_WIDGET 1
115
ShortcutDef(const ShortcutDef &other){ operator = (other); };
116
ShortcutDef(int nCtx, int nID, const char *szName, int nKey, bool bShift, bool bCtrl, bool bAlt){
117
m_strActionName = szName;
118
m_nCtx = nCtx; //global, tree, text
121
m_bModShift = bShift;
125
//ASSERT(IsValid(m_nCtx));
128
void operator =(const ShortcutDef &other){
129
m_strActionName = other.m_strActionName;
130
m_nCtx = other.m_nCtx;
131
m_nActionID = other.m_nActionID;
132
m_nKey = other.m_nKey;
133
m_bModShift = other.m_bModShift;
134
m_bModCtrl = other.m_bModCtrl;
135
m_bModAlt = other.m_bModAlt;
137
//ASSERT(IsValid(m_nCtx));
140
bool IsValid(int nContext = SH_CTX_GLOBAL);
141
bool IsEmpty(){ return (0 == m_nKey); };
143
std::string GetDisplayString();
144
int GetModifierFlags();
146
bool Match(GdkEventKey *evnt);
149
bool operator ==(const ShortcutDef &other);
152
std::string m_strActionName;
153
int m_nCtx; //global, tree, text
161
class ShortcutsList : public std::vector<ShortcutDef>
165
virtual ~ShortcutsList();
170
int FindByKey(ShortcutDef &key, int nSkipLine=-1, int nActionID=-1);
171
int FindByAction(int nActionID, int nCtx = SH_CTX_GLOBAL);
172
int FindByContext(int nCtx, int nIdx);
174
void UpdateAction(ShortcutDef &key);
175
void ClearAction(int nActionID, int nCtx);
178
#endif // SHORTCUTSLIST_H__
1
////////////////////////////////////////////////////////////////////////////
2
// NoteCase notes manager project <http://notecase.sf.net>
4
// This code is licensed under BSD license.See "license.txt" for more details.
6
// File: Implements list of keyboard shortcuts for program actions
7
////////////////////////////////////////////////////////////////////////////
9
#ifndef SHORTCUTSLIST_H__
10
#define SHORTCUTSLIST_H__
14
#endif // _MSC_VER > 1000
19
#include "lib/debug.h"
21
//define for each action (that can have a shortcut)
23
NC_ACTION_DOC_NEW = 1,
26
NC_ACTION_DOC_SAVE_AS,
32
NC_ACTION_TREE_NODE_NEW,
33
NC_ACTION_TREE_NODE_NEW_CHILD,
34
NC_ACTION_TREE_NODE_DELETE,
35
NC_ACTION_TREE_NODE_RENAME,
36
NC_ACTION_TREE_NODE_MOVE_UP,
37
NC_ACTION_TREE_NODE_MOVE_DOWN,
38
NC_ACTION_TREE_NODE_MOVE_LEFT,
39
NC_ACTION_TREE_NODE_MOVE_RIGHT,
40
NC_ACTION_TREE_NODE_PROPERTIES,
41
NC_ACTION_TREE_NODE_DELETE_FINISHED,
42
NC_ACTION_TREE_NODE_TOGGLE_FINISHED,
43
NC_ACTION_TREE_SORT_CHILDREN_ASC,
44
NC_ACTION_TREE_SORT_CHILDREN_DESC,
45
NC_ACTION_TREE_SORT_ROOT_ASC,
46
NC_ACTION_TREE_SORT_ROOT_DESC,
47
NC_ACTION_TREE_EXPAND_ALL,
48
NC_ACTION_TREE_COLAPSE_ALL,
54
NC_ACTION_EDIT_DELETE,
55
NC_ACTION_EDIT_COPY_BR_STRUCT, //copy branch structure
56
NC_ACTION_EDIT_PASTE_BR_ROOT, //paste branch to root
57
NC_ACTION_EDIT_INSERT_DATETIME,
59
NC_ACTION_EDIT_FIND_NEXT,
60
NC_ACTION_EDIT_REPLACE,
61
NC_ACTION_EDIT_LINK_WIZARD,
62
NC_ACTION_EDIT_INSERT_PICTURE,
63
NC_ACTION_EDIT_ATTACHMENTS,
64
NC_ACTION_EDIT_SHORTCUTS,
65
NC_ACTION_EDIT_OPTIONS,
66
NC_ACTION_FORMAT_BOLD,
67
NC_ACTION_FORMAT_ITALIC,
68
NC_ACTION_FORMAT_UNDERLINE,
69
NC_ACTION_FORMAT_STRIKETHROUGH,
70
NC_ACTION_FORMAT_COLOR,
71
NC_ACTION_FORMAT_REMOVE,
72
NC_ACTION_VIEW_TOOLBAR,
73
NC_ACTION_VIEW_STATUS_BAR,
74
NC_ACTION_VIEW_NODE_TITLEBAR,
76
NC_ACTION_VIEW_CHANGE_MODE,
77
NC_ACTION_VIEW_WORD_COUNT,
81
NC_ACTION_PASSWORD_CHANGE,
82
DUMMY_ITEM2, // keeps IDs sychronized with Pro version
83
NC_ACTION_FORMAT_BKG_COLOR,
85
NC_ACTION_VIEW_FULLSCREEN,
86
DUMMY_ITEM3, // keeps IDs sychronized with Pro version
87
DUMMY_ITEM4, // keeps IDs sychronized with Pro version
88
NC_ACTION_LOCK_DOCUMENT,
89
DUMMY_ITEM5, // keeps IDs sychronized with Pro version
90
DUMMY_ITEM6, // keeps IDs sychronized with Pro version
91
DUMMY_ITEM7, // keeps IDs sychronized with Pro version
92
DUMMY_ITEM8, // keeps IDs sychronized with Pro version
93
DUMMY_ITEM9, // keeps IDs sychronized with Pro version
94
DUMMY_ITEM10, // keeps IDs sychronized with Pro version
95
DUMMY_ITEM11, // keeps IDs sychronized with Pro version
96
DUMMY_ITEM12, // keeps IDs sychronized with Pro version
97
DUMMY_ITEM13, // keeps IDs sychronized with Pro version
98
DUMMY_ITEM14, // keeps IDs sychronized with Pro version
99
DUMMY_ITEM15, // keeps IDs sychronized with Pro version
100
DUMMY_ITEM16, // keeps IDs sychronized with Pro version
101
DUMMY_ITEM17, // keeps IDs sychronized with Pro version
102
DUMMY_ITEM18, // keeps IDs sychronized with Pro version
103
DUMMY_ITEM19, // keeps IDs sychronized with Pro version
104
NC_ACTION_VISIT_WEBSITE
108
#define SH_CTX_GLOBAL 0
109
#define SH_CTX_TREE_WIDGET 1
115
ShortcutDef(const ShortcutDef &other){ operator = (other); };
116
ShortcutDef(int nCtx, int nID, const char *szName, int nKey, bool bShift, bool bCtrl, bool bAlt){
117
m_strActionName = szName;
118
m_nCtx = nCtx; //global, tree, text
121
m_bModShift = bShift;
125
//ASSERT(IsValid(m_nCtx));
128
void operator =(const ShortcutDef &other){
129
m_strActionName = other.m_strActionName;
130
m_nCtx = other.m_nCtx;
131
m_nActionID = other.m_nActionID;
132
m_nKey = other.m_nKey;
133
m_bModShift = other.m_bModShift;
134
m_bModCtrl = other.m_bModCtrl;
135
m_bModAlt = other.m_bModAlt;
137
//ASSERT(IsValid(m_nCtx));
140
bool IsValid(int nContext = SH_CTX_GLOBAL);
141
bool IsEmpty(){ return (0 == m_nKey); };
143
std::string GetDisplayString();
144
int GetModifierFlags();
146
bool Match(GdkEventKey *evnt);
149
bool operator ==(const ShortcutDef &other);
152
std::string m_strActionName;
153
int m_nCtx; //global, tree, text
161
class ShortcutsList : public std::vector<ShortcutDef>
165
virtual ~ShortcutsList();
170
int FindByKey(ShortcutDef &key, int nSkipLine=-1, int nActionID=-1);
171
int FindByAction(int nActionID, int nCtx = SH_CTX_GLOBAL);
172
int FindByContext(int nCtx, int nIdx);
174
void UpdateAction(ShortcutDef &key);
175
void ClearAction(int nActionID, int nCtx);
178
#endif // SHORTCUTSLIST_H__