#===========================================================
# CoolReader3
# Key to Command map file
#
# all identifiers should be declared in keydefs.ini
#===========================================================

#main viewer window, commands possible to use in override

[main-override-commands]
#2 = DCMD_LINEUP
1001 = DCMD_PAGEUP
1002 = DCMD_PAGEDOWN
1003 = DCMD_PAGEUP, 10
1004 = DCMD_PAGEDOWN, 10
#5 = DCMD_LINEDOWN
1005 = DCMD_BEGIN
1006 = DCMD_END
6 = DCMD_LINK_FORWARD
7 = DCMD_LINK_BACK

#22 = DCMD_LINK_FIRST
#8 = DCMD_LINK_NEXT
#9 = DCMD_LINK_PREV
#10 = DCMD_LINK_GO
#12 = DCMD_GO_POS
#13 = DCMD_GO_PAGE
14 = DCMD_ZOOM_IN
15 = DCMD_ZOOM_OUT
191 = DCMD_MOVE_BY_CHAPTER, 1
192 = DCMD_MOVE_BY_CHAPTER, -1

#20 = DCMD_GO_SCROLL_POS
#21 = DCMD_TOGGLE_PAGE_SCROLL_VIEW
231 = DCMD_ROTATE_BY, 1
232 = DCMD_ROTATE_BY, -1
241 = DCMD_ROTATE_SET, 0
242 = DCMD_ROTATE_SET, 1

25 = DCMD_SAVE_HISTORY
26 = DCMD_SAVE_TO_CACHE
16 = DCMD_TOGGLE_TEXT_FORMAT
116 = DCMD_TOGGLE_BOLD

27 = MCMD_QUIT
28 = MCMD_MAIN_MENU
29 = MCMD_GO_PAGE
291 = MCMD_GO_PERCENT
33 = MCMD_GO_LINK
30 = MCMD_SETTINGS
31 = MCMD_SETTINGS_FONTSIZE
32 = MCMD_SETTINGS_ORIENTATION
#34 = MCMD_LONG_FORWARD
#35 = MCMD_LONG_BACK
36 = MCMD_DICT
43 = MCMD_DICT_VKEYBOARD
#44 = MCMD_DICT_FIND
37 = MCMD_BOOKMARK_LIST
38 = MCMD_RECENT_BOOK_LIST
#38 = MCMD_OPEN_RECENT_BOOK
138 = MCMD_SWITCH_TO_RECENT_BOOK
39 = MCMD_ABOUT
40 = MCMD_CITE
41 = MCMD_SEARCH
#42 = MCMD_SEARCH_FINDFIRST
#45 = MCMD_KBD_NEXTLAYOUT
#46 = MCMD_KBD_PREVLAYOUT
47 = MCMD_HELP
48 = MCMD_HELP_KEYS


171 = DCMD_BOOKMARK_SAVE_N, 0
172 = DCMD_BOOKMARK_SAVE_N, 1
173 = DCMD_BOOKMARK_SAVE_N, 2
174 = DCMD_BOOKMARK_SAVE_N, 3 
175 = DCMD_BOOKMARK_SAVE_N, 4
#176 = DCMD_BOOKMARK_SAVE_N, 5
181 = DCMD_BOOKMARK_GO_N, 1
182 = DCMD_BOOKMARK_GO_N, 2
183 = DCMD_BOOKMARK_GO_N, 3
184 = DCMD_BOOKMARK_GO_N, 4
#185 = DCMD_BOOKMARK_GO_N, 5

#main viewer window, keys possible to override
[main-override-keys]
'1' = 1000
'2' = 1
'3' = 2
'4' = 3
'5' = 4
'6' = 5
'7' = 6
'8' = 7
'1', LONG = 10
'2', LONG = 11
'3', LONG = 12
'4', LONG = 13
'5', LONG = 14
'6', LONG = 15
'7', LONG = 16
'8', LONG = 17
'9' = 8
'0' = 9
'9', LONG = 18
'0', LONG = 19

XK_KP_Subtract = 30
XK_KP_Subtract, LONG = 31
XK_KP_Add = 32
XK_KP_Add, LONG = 32
XK_Return = 20
XK_Return, LONG = 21

# key translation map for different screen orientations
[key-substitution-90]
XK_Left = XK_Right
XK_Right = XK_Left
[key-substitution-180]
XK_Left = XK_Right
XK_Right = XK_Left


# main viewer window
[main]
'1' = DCMD_LINK_BACK
#'1', LONG = DCMD_LINK_FORWARD
'1', LONG = MCMD_HELP_KEYS
'2' = MCMD_GO_PAGE
'3', LONG = MCMD_DICT
'3' = MCMD_DICT_VKEYBOARD
'6' = MCMD_GO_LINK
'6', LONG = MCMD_RECENT_BOOK_LIST
'7' = MCMD_BOOKMARK_LIST
'7', LONG = DCMD_BOOKMARK_SAVE_N, 0
'8' = MCMD_SETTINGS_FONTSIZE
'8', LONG = MCMD_SETTINGS_ORIENTATION
XK_Escape = MCMD_QUIT
#XK_Escape = MCMD_CANCEL
XK_Return = MCMD_MAIN_MENU
XK_Return, LONG = MCMD_SETTINGS

'0' = DCMD_PAGEDOWN
XK_Right = DCMD_PAGEDOWN
#XK_KP_Add = DCMD_PAGEDOWN
'0', LONG = DCMD_PAGEDOWN, 10
XK_Right, LONG = DCMD_PAGEDOWN, 10
XK_KP_Add, LONG = DCMD_PAGEDOWN, 10
'9' = DCMD_PAGEUP
XK_Left = DCMD_PAGEUP
#XK_KP_Subtract = DCMD_PAGEUP
'9', LONG = DCMD_PAGEUP, 10
XK_Left, LONG = DCMD_PAGEUP, 10
XK_KP_Subtract, LONG = DCMD_PAGEUP, 10
#'6', LONG = MCMD_DICT
XK_KP_Add = DCMD_ZOOM_IN, 2
#61 is '='
61 = DCMD_ZOOM_IN
XK_KP_Subtract = DCMD_ZOOM_OUT, 2
#'1' = DCMD_BOOKMARK_GO_N, 1
#'1', LONG = DCMD_BOOKMARK_SAVE_N, 1
#'2' = DCMD_BOOKMARK_GO_N, 2
#'2', LONG = DCMD_BOOKMARK_SAVE_N, 2
#'3' = DCMD_BOOKMARK_GO_N, 3
#'3', LONG = DCMD_BOOKMARK_SAVE_N, 3
#'4' = DCMD_BOOKMARK_GO_N, 4
#'4', LONG = DCMD_BOOKMARK_SAVE_N, 4
#'5' = DCMD_BOOKMARK_GO_N, 5
#'5', LONG = DCMD_BOOKMARK_SAVE_N, 5
'4' = DCMD_MOVE_BY_CHAPTER, -1
'5' = DCMD_MOVE_BY_CHAPTER, 1
'4', LONG = DCMD_BEGIN
'5', LONG = DCMD_END

#uncomment following lines to disable +/- keys handling in viewer
#XK_KP_Add = GCMD_PASS_TO_PARENT
#XK_KP_Add, LONG = GCMD_PASS_TO_PARENT
#XK_KP_Subtract = GCMD_PASS_TO_PARENT
#XK_KP_Subtract, LONG = GCMD_PASS_TO_PARENT


[menu]
XK_Escape, LONG = MCMD_CLEAR
XK_Escape = MCMD_CANCEL
XK_Return = MCMD_OK
XK_Return, LONG = MCMD_OK
'0' = MCMD_SCROLL_FORWARD
XK_Right = MCMD_SCROLL_FORWARD
XK_KP_Add = MCMD_SCROLL_FORWARD
'9' = MCMD_SCROLL_BACK
XK_Left = MCMD_SCROLL_BACK
XK_KP_Subtract = MCMD_SCROLL_BACK
'0', LONG = MCMD_SCROLL_FORWARD_LONG
XK_Right, LONG = MCMD_SCROLL_FORWARD_LONG
'9', LONG = MCMD_SCROLL_BACK_LONG
XK_Left, LONG = MCMD_SCROLL_BACK_LONG
'1' = MCMD_SELECT_1
'2' = MCMD_SELECT_2
'3' = MCMD_SELECT_3
'4' = MCMD_SELECT_4
'5' = MCMD_SELECT_5
'6' = MCMD_SELECT_6
'7' = MCMD_SELECT_7
'8' = MCMD_SELECT_8
'1', LONG = MCMD_SELECT_1_LONG
'2', LONG = MCMD_SELECT_2_LONG
'3', LONG = MCMD_SELECT_3_LONG
'4', LONG = MCMD_SELECT_4_LONG
'5', LONG = MCMD_SELECT_5_LONG
'6', LONG = MCMD_SELECT_6_LONG
'7', LONG = MCMD_SELECT_7_LONG
'8', LONG = MCMD_SELECT_8_LONG

[menu10]
XK_Escape, LONG = MCMD_CLEAR
XK_Escape = MCMD_CANCEL
XK_Return = MCMD_OK
XK_Return, LONG = MCMD_OK
'0' = MCMD_SELECT_0
'9' = MCMD_SELECT_9
'0', LONG = MCMD_SELECT_0_LONG
'9', LONG = MCMD_SELECT_9_LONG
'1' = MCMD_SELECT_1
'2' = MCMD_SELECT_2
'3' = MCMD_SELECT_3
'4' = MCMD_SELECT_4
'5' = MCMD_SELECT_5
'6' = MCMD_SELECT_6
'7' = MCMD_SELECT_7
'8' = MCMD_SELECT_8
'1', LONG = MCMD_SELECT_1_LONG
'2', LONG = MCMD_SELECT_2_LONG
'3', LONG = MCMD_SELECT_3_LONG
'4', LONG = MCMD_SELECT_4_LONG
'5', LONG = MCMD_SELECT_5_LONG
'6', LONG = MCMD_SELECT_6_LONG
'7', LONG = MCMD_SELECT_7_LONG
'8', LONG = MCMD_SELECT_8_LONG

[dialog]
XK_Escape, LONG = MCMD_CLEAR
XK_Escape = MCMD_CANCEL
XK_Return, LONG = MCMD_OK
XK_Return = MCMD_OK
XK_Right = MCMD_SCROLL_FORWARD
XK_KP_Add = MCMD_SCROLL_FORWARD
XK_Left = MCMD_SCROLL_BACK
XK_KP_Subtract = MCMD_SCROLL_BACK
'0' = MCMD_SELECT_0
'1' = MCMD_SELECT_1
'2' = MCMD_SELECT_2
'3' = MCMD_SELECT_3
'4' = MCMD_SELECT_4
'5' = MCMD_SELECT_5
'6' = MCMD_SELECT_6
'7' = MCMD_SELECT_7
'8' = MCMD_SELECT_8
'9' = MCMD_SELECT_9

[vkeyboard]
XK_Escape = MCMD_CANCEL
XK_Return, LONG = MCMD_OK
XK_Return = MCMD_OK
XK_Right = MCMD_SCROLL_FORWARD
XK_KP_Add = MCMD_SCROLL_FORWARD
XK_Left = MCMD_SCROLL_BACK
XK_KP_Subtract = MCMD_SCROLL_BACK
'0' = MCMD_SELECT_0
'1' = MCMD_SELECT_1
'2' = MCMD_SELECT_2
'3' = MCMD_SELECT_3
'4' = MCMD_SELECT_4
'5' = MCMD_SELECT_5
'6' = MCMD_SELECT_6
'7' = MCMD_SELECT_7
'8' = MCMD_SELECT_8
'9' = MCMD_SELECT_9
XK_Escape, LONG = MCMD_CLEAR

[txkeyboard]
XK_Escape = MCMD_CANCEL
XK_Return, LONG = MCMD_OK
XK_Return = MCMD_OK
XK_Right = MCMD_SCROLL_FORWARD
XK_KP_Add = MCMD_SCROLL_FORWARD
XK_Left = MCMD_SCROLL_BACK
XK_KP_Subtract = MCMD_SCROLL_BACK
'9' = MCMD_KBD_PREVLAYOUT
'0' = MCMD_KBD_NEXTLAYOUT
'1' = MCMD_SELECT_1
'2' = MCMD_SELECT_2
'3' = MCMD_SELECT_3
'4' = MCMD_SELECT_4
'5' = MCMD_SELECT_5
'6' = MCMD_SELECT_6
'7' = MCMD_SELECT_7
'8' = MCMD_SELECT_8
XK_Escape, LONG = MCMD_CLEAR

# custom document view dialog
[browse]
'1' = DCMD_LINK_BACK
'1', LONG = DCMD_LINK_FORWARD
'2' = MCMD_GO_PAGE
'3', LONG = MCMD_DICT
'3' = MCMD_DICT_VKEYBOARD
'6' = MCMD_GO_LINK
XK_Escape = MCMD_CANCEL
XK_Escape, LONG = MCMD_CANCEL
XK_Return = MCMD_OK
XK_Return, LONG = MCMD_OK
'0' = DCMD_PAGEDOWN
XK_Right = DCMD_PAGEDOWN
XK_KP_Add = DCMD_ZOOM_IN, 2
'0', LONG = DCMD_PAGEDOWN, 10
XK_Right, LONG = DCMD_PAGEDOWN, 10
XK_KP_Add, LONG = DCMD_PAGEDOWN, 10
'9' = DCMD_PAGEUP
XK_Left = DCMD_PAGEUP
XK_KP_Subtract = DCMD_ZOOM_OUT, 2
'9', LONG = DCMD_PAGEUP, 10
XK_Left, LONG = DCMD_PAGEUP, 10
XK_KP_Subtract, LONG = DCMD_PAGEUP, 10
'4' = DCMD_MOVE_BY_CHAPTER, -1
'5' = DCMD_MOVE_BY_CHAPTER, 1
'4', LONG = DCMD_BEGIN
'5', LONG = DCMD_END

# this is Main Menu definition
# place items for main menu here
# left side will be ignored
[mainMenuItems]
1 = MCMD_ABOUT
2 = MCMD_GO_PAGE
3 = MCMD_RECENT_BOOK_LIST
4 = MCMD_DICT
5 = MCMD_CITE
6 = MCMD_BOOKMARK_LIST
7 = MCMD_SEARCH
8 = MCMD_SETTINGS
9 = MCMD_HELP
10 = MCMD_HELP_KEYS
11 = MCMD_GO_PERCENT
