diff --git a/app/cmake/GenerateManual.cmake b/app/cmake/GenerateManual.cmake index ccd6e611d1..3915d35e4f 100644 --- a/app/cmake/GenerateManual.cmake +++ b/app/cmake/GenerateManual.cmake @@ -47,6 +47,14 @@ add_custom_command(OUTPUT "${INDEX_OUTPUT_PATH}" COMMENT "Creating manual file ${INDEX_OUTPUT_PATH}" ) +# Dump the keyboard shortcuts +set(DOC_MANUAL_SHORTCUTS_JS_TARGET_ABSOLUTE "${DOC_MANUAL_TARGET_DIR}/shortcuts.js") +add_custom_command( + OUTPUT "${DOC_MANUAL_SHORTCUTS_JS_TARGET_ABSOLUTE}" + COMMAND dump-shortcuts ARGS "${DOC_MANUAL_SHORTCUTS_JS_TARGET_ABSOLUTE}" + DEPENDS "${DOC_MANUAL_TARGET_DIR}" + VERBATIM) + # Collect resources and copy them to the correct locations # DOC_MANUAL_SOURCE_FILES_ABSOLUTE contains the absolute paths to all source resource files # DOC_MANUAL_SOURCE_IMAGE_FILES_RELATIVE contains the relative paths to all source resource files, relative to DOC_MANUAL_IMAGES_SOURCE_DIR @@ -70,8 +78,7 @@ foreach(MANUAL_SOURCE_FILE_ABSOLUTE ${DOC_MANUAL_SOURCE_FILES_ABSOLUTE}) set(DOC_MANUAL_TARGET_FILES_ABSOLUTE ${DOC_MANUAL_TARGET_FILES_ABSOLUTE} - "${MANUAL_TARGET_FILE_ABSOLUTE}" - ) + "${MANUAL_TARGET_FILE_ABSOLUTE}") endforeach(MANUAL_SOURCE_FILE_ABSOLUTE) # Copy the images using the relative paths (absolute paths would yield very long command lines which are then truncated by MSVC) @@ -117,4 +124,4 @@ add_custom_command(OUTPUT ${DOC_MANUAL_TARGET_IMAGE_FILES_ABSOLUTE} COMMENT "Copying image files to ${DOC_MANUAL_IMAGES_TARGET_DIR}" ) -add_custom_target(GenerateManual DEPENDS ${INDEX_OUTPUT_PATH} ${DOC_MANUAL_TARGET_FILES_ABSOLUTE} ${DOC_MANUAL_TARGET_IMAGE_FILES_ABSOLUTE}) +add_custom_target(GenerateManual DEPENDS ${INDEX_OUTPUT_PATH} ${DOC_MANUAL_TARGET_FILES_ABSOLUTE} ${DOC_MANUAL_SHORTCUTS_JS_TARGET_ABSOLUTE} ${DOC_MANUAL_TARGET_IMAGE_FILES_ABSOLUTE}) diff --git a/app/resources/documentation/manual/shortcuts.js b/app/resources/documentation/manual/shortcuts.js deleted file mode 100644 index d1ad61b753..0000000000 --- a/app/resources/documentation/manual/shortcuts.js +++ /dev/null @@ -1,754 +0,0 @@ -var keys = { mac: {}, windows: {}, linux: {} }; -keys["windows"][8] = "Backspace"; -keys["windows"][9] = "Tab"; -keys["windows"][13] = "Return"; -keys["windows"][27] = "Escape"; -keys["windows"][32] = "Space"; -keys["windows"][33] = "!"; -keys["windows"][34] = """; -keys["windows"][35] = "#"; -keys["windows"][36] = "$"; -keys["windows"][37] = "%"; -keys["windows"][38] = "&"; -keys["windows"][39] = "'"; -keys["windows"][40] = "("; -keys["windows"][41] = ")"; -keys["windows"][42] = "*"; -keys["windows"][43] = "+"; -keys["windows"][44] = ","; -keys["windows"][45] = "-"; -keys["windows"][46] = "."; -keys["windows"][47] = "/"; -keys["windows"][48] = "0"; -keys["windows"][49] = "1"; -keys["windows"][50] = "2"; -keys["windows"][51] = "3"; -keys["windows"][52] = "4"; -keys["windows"][53] = "5"; -keys["windows"][54] = "6"; -keys["windows"][55] = "7"; -keys["windows"][56] = "8"; -keys["windows"][57] = "9"; -keys["windows"][58] = ":"; -keys["windows"][59] = ";"; -keys["windows"][60] = ">"; -keys["windows"][61] = "="; -keys["windows"][62] = "<"; -keys["windows"][63] = "?"; -keys["windows"][64] = "@"; -keys["windows"][65] = "A"; -keys["windows"][66] = "B"; -keys["windows"][67] = "C"; -keys["windows"][68] = "D"; -keys["windows"][69] = "E"; -keys["windows"][70] = "F"; -keys["windows"][71] = "G"; -keys["windows"][72] = "H"; -keys["windows"][73] = "I"; -keys["windows"][74] = "J"; -keys["windows"][75] = "K"; -keys["windows"][76] = "L"; -keys["windows"][77] = "M"; -keys["windows"][78] = "N"; -keys["windows"][79] = "O"; -keys["windows"][80] = "P"; -keys["windows"][81] = "Q"; -keys["windows"][82] = "R"; -keys["windows"][83] = "S"; -keys["windows"][84] = "T"; -keys["windows"][85] = "U"; -keys["windows"][86] = "V"; -keys["windows"][87] = "W"; -keys["windows"][88] = "X"; -keys["windows"][89] = "Y"; -keys["windows"][90] = "Z"; -keys["windows"][91] = "["; -keys["windows"][92] = "\\"; -keys["windows"][93] = "]"; -keys["windows"][94] = "^"; -keys["windows"][95] = "_"; -keys["windows"][96] = "`"; -keys["windows"][97] = "a"; -keys["windows"][98] = "b"; -keys["windows"][99] = "c"; -keys["windows"][100] = "d"; -keys["windows"][101] = "e"; -keys["windows"][102] = "f"; -keys["windows"][103] = "g"; -keys["windows"][104] = "h"; -keys["windows"][105] = "i"; -keys["windows"][106] = "j"; -keys["windows"][107] = "k"; -keys["windows"][108] = "l"; -keys["windows"][109] = "m"; -keys["windows"][110] = "n"; -keys["windows"][111] = "o"; -keys["windows"][112] = "p"; -keys["windows"][113] = "q"; -keys["windows"][114] = "r"; -keys["windows"][115] = "s"; -keys["windows"][116] = "t"; -keys["windows"][117] = "u"; -keys["windows"][118] = "v"; -keys["windows"][119] = "w"; -keys["windows"][120] = "x"; -keys["windows"][121] = "y"; -keys["windows"][122] = "z"; -keys["windows"][123] = "{"; -keys["windows"][124] = "|"; -keys["windows"][125] = "}"; -keys["windows"][126] = "~"; -keys["windows"][127] = "Delete"; -keys["windows"][303] = "Cancel"; -keys["windows"][305] = "Clear"; -keys["windows"][306] = "Shift"; -keys["windows"][307] = "Alt"; -keys["windows"][308] = "Ctrl"; -keys["windows"][309] = "Menu"; -keys["windows"][310] = "Pause"; -keys["windows"][311] = "Capital"; -keys["windows"][312] = "End"; -keys["windows"][313] = "Home"; -keys["windows"][314] = "←"; -keys["windows"][315] = "↑"; -keys["windows"][316] = "→"; -keys["windows"][317] = "↓"; -keys["windows"][318] = "Select"; -keys["windows"][319] = "Print"; -keys["windows"][320] = "Execute"; -keys["windows"][321] = "Snapshot"; -keys["windows"][322] = "Insert"; -keys["windows"][323] = "Help"; -keys["windows"][324] = "Numpad 0"; -keys["windows"][325] = "Numpad 1"; -keys["windows"][326] = "Numpad 2"; -keys["windows"][327] = "Numpad 3"; -keys["windows"][328] = "Numpad 4"; -keys["windows"][329] = "Numpad 5"; -keys["windows"][330] = "Numpad 6"; -keys["windows"][331] = "Numpad 7"; -keys["windows"][332] = "Numpad 8"; -keys["windows"][333] = "Numpad 9"; -keys["windows"][334] = "*"; -keys["windows"][335] = "+"; -keys["windows"][337] = "-"; -keys["windows"][338] = "."; -keys["windows"][339] = "/"; -keys["windows"][340] = "F1"; -keys["windows"][341] = "F2"; -keys["windows"][342] = "F3"; -keys["windows"][343] = "F4"; -keys["windows"][344] = "F5"; -keys["windows"][345] = "F6"; -keys["windows"][346] = "F7"; -keys["windows"][347] = "F8"; -keys["windows"][348] = "F9"; -keys["windows"][349] = "F10"; -keys["windows"][350] = "F11"; -keys["windows"][351] = "F12"; -keys["windows"][352] = "F13"; -keys["windows"][353] = "F14"; -keys["windows"][354] = "F15"; -keys["windows"][355] = "F16"; -keys["windows"][356] = "F17"; -keys["windows"][357] = "F18"; -keys["windows"][358] = "F19"; -keys["windows"][359] = "F20"; -keys["windows"][360] = "F21"; -keys["windows"][361] = "F22"; -keys["windows"][362] = "F23"; -keys["windows"][363] = "F24"; -keys["windows"][364] = "Numlock"; -keys["windows"][365] = "Scroll"; -keys["windows"][366] = "Page Up"; -keys["windows"][367] = "Page Down"; -keys["windows"][368] = "Numpad Space"; -keys["windows"][369] = "Numpad Tab"; -keys["windows"][370] = "Numpad Enter"; -keys["windows"][371] = "Numpad F1"; -keys["windows"][372] = "Numpad F2"; -keys["windows"][373] = "Numpad F3"; -keys["windows"][374] = "Numpad F4"; -keys["windows"][375] = "Numpad Home"; -keys["windows"][376] = "Numpad ←"; -keys["windows"][377] = "Numpad ↑"; -keys["windows"][378] = "Numpad →"; -keys["windows"][379] = "Numpad ↓"; -keys["windows"][380] = "Numpad Page Up"; -keys["windows"][381] = "Numpad Page Down"; -keys["windows"][382] = "Numpad End"; -keys["windows"][383] = "Numpad Home"; -keys["windows"][384] = "Numpad Insert"; -keys["windows"][385] = "Numpad Delete"; -keys["windows"][386] = "Numpad ="; -keys["windows"][387] = "Numpad *"; -keys["windows"][388] = "Numpad +"; -keys["windows"][389] = "Numpad Separator"; -keys["windows"][390] = "Numpad -"; -keys["windows"][391] = "Numpad ."; -keys["windows"][392] = "Numpad /"; -keys["windows"][393] = "Left Windows Key"; -keys["windows"][394] = "Right Windows Key"; -keys["windows"][395] = "Windows Menu Key"; -keys["windows"]["+"] = "+"; -keys["mac"][8] = "⌫"; -keys["mac"][9] = "⇥"; -keys["mac"][13] = "↩"; -keys["mac"][27] = "⎋"; -keys["mac"][32] = "Space"; -keys["mac"][33] = "!"; -keys["mac"][34] = """; -keys["mac"][35] = "#"; -keys["mac"][36] = "$"; -keys["mac"][37] = "%"; -keys["mac"][38] = "&"; -keys["mac"][39] = "'"; -keys["mac"][40] = "("; -keys["mac"][41] = ")"; -keys["mac"][42] = "*"; -keys["mac"][43] = "+"; -keys["mac"][44] = ","; -keys["mac"][45] = "-"; -keys["mac"][46] = "."; -keys["mac"][47] = "/"; -keys["mac"][48] = "0"; -keys["mac"][49] = "1"; -keys["mac"][50] = "2"; -keys["mac"][51] = "3"; -keys["mac"][52] = "4"; -keys["mac"][53] = "5"; -keys["mac"][54] = "6"; -keys["mac"][55] = "7"; -keys["mac"][56] = "8"; -keys["mac"][57] = "9"; -keys["mac"][58] = ":"; -keys["mac"][59] = ";"; -keys["mac"][60] = ">"; -keys["mac"][61] = "="; -keys["mac"][62] = "<"; -keys["mac"][63] = "?"; -keys["mac"][64] = "@"; -keys["mac"][65] = "A"; -keys["mac"][66] = "B"; -keys["mac"][67] = "C"; -keys["mac"][68] = "D"; -keys["mac"][69] = "E"; -keys["mac"][70] = "F"; -keys["mac"][71] = "G"; -keys["mac"][72] = "H"; -keys["mac"][73] = "I"; -keys["mac"][74] = "J"; -keys["mac"][75] = "K"; -keys["mac"][76] = "L"; -keys["mac"][77] = "M"; -keys["mac"][78] = "N"; -keys["mac"][79] = "O"; -keys["mac"][80] = "P"; -keys["mac"][81] = "Q"; -keys["mac"][82] = "R"; -keys["mac"][83] = "S"; -keys["mac"][84] = "T"; -keys["mac"][85] = "U"; -keys["mac"][86] = "V"; -keys["mac"][87] = "W"; -keys["mac"][88] = "X"; -keys["mac"][89] = "Y"; -keys["mac"][90] = "Z"; -keys["mac"][91] = "["; -keys["mac"][92] = "\\"; -keys["mac"][93] = "]"; -keys["mac"][94] = "^"; -keys["mac"][95] = "_"; -keys["mac"][96] = "`"; -keys["mac"][97] = "a"; -keys["mac"][98] = "b"; -keys["mac"][99] = "c"; -keys["mac"][100] = "d"; -keys["mac"][101] = "e"; -keys["mac"][102] = "f"; -keys["mac"][103] = "g"; -keys["mac"][104] = "h"; -keys["mac"][105] = "i"; -keys["mac"][106] = "j"; -keys["mac"][107] = "k"; -keys["mac"][108] = "l"; -keys["mac"][109] = "m"; -keys["mac"][110] = "n"; -keys["mac"][111] = "o"; -keys["mac"][112] = "p"; -keys["mac"][113] = "q"; -keys["mac"][114] = "r"; -keys["mac"][115] = "s"; -keys["mac"][116] = "t"; -keys["mac"][117] = "u"; -keys["mac"][118] = "v"; -keys["mac"][119] = "w"; -keys["mac"][120] = "x"; -keys["mac"][121] = "y"; -keys["mac"][122] = "z"; -keys["mac"][123] = "{"; -keys["mac"][124] = "|"; -keys["mac"][125] = "}"; -keys["mac"][126] = "~"; -keys["mac"][127] = "⌫"; -keys["mac"][303] = "Cancel"; -keys["mac"][305] = "Clear"; -keys["mac"][306] = "⇧"; -keys["mac"][307] = "⌥"; -keys["mac"][308] = "⌘"; -keys["mac"][309] = "Menu"; -keys["mac"][310] = "Pause"; -keys["mac"][311] = "Capital"; -keys["mac"][312] = "⇲"; -keys["mac"][313] = "⇱"; -keys["mac"][314] = "←"; -keys["mac"][315] = "↑"; -keys["mac"][316] = "→"; -keys["mac"][317] = "↓"; -keys["mac"][318] = "Select"; -keys["mac"][319] = "Print"; -keys["mac"][320] = "Execute"; -keys["mac"][321] = "Snapshot"; -keys["mac"][322] = "Insert"; -keys["mac"][323] = "Help"; -keys["mac"][324] = "Numpad 0"; -keys["mac"][325] = "Numpad 1"; -keys["mac"][326] = "Numpad 2"; -keys["mac"][327] = "Numpad 3"; -keys["mac"][328] = "Numpad 4"; -keys["mac"][329] = "Numpad 5"; -keys["mac"][330] = "Numpad 6"; -keys["mac"][331] = "Numpad 7"; -keys["mac"][332] = "Numpad 8"; -keys["mac"][333] = "Numpad 9"; -keys["mac"][334] = "*"; -keys["mac"][335] = "+"; -keys["mac"][337] = "-"; -keys["mac"][338] = "."; -keys["mac"][339] = "/"; -keys["mac"][340] = "F1"; -keys["mac"][341] = "F2"; -keys["mac"][342] = "F3"; -keys["mac"][343] = "F4"; -keys["mac"][344] = "F5"; -keys["mac"][345] = "F6"; -keys["mac"][346] = "F7"; -keys["mac"][347] = "F8"; -keys["mac"][348] = "F9"; -keys["mac"][349] = "F10"; -keys["mac"][350] = "F11"; -keys["mac"][351] = "F12"; -keys["mac"][352] = "F13"; -keys["mac"][353] = "F14"; -keys["mac"][354] = "F15"; -keys["mac"][355] = "F16"; -keys["mac"][356] = "F17"; -keys["mac"][357] = "F18"; -keys["mac"][358] = "F19"; -keys["mac"][359] = "F20"; -keys["mac"][360] = "F21"; -keys["mac"][361] = "F22"; -keys["mac"][362] = "F23"; -keys["mac"][363] = "F24"; -keys["mac"][364] = "Numlock"; -keys["mac"][365] = "Scroll"; -keys["mac"][366] = "⇞"; -keys["mac"][367] = "⇟"; -keys["mac"][368] = "Numpad ␣"; -keys["mac"][369] = "Numpad ⇥"; -keys["mac"][370] = "Numpad ↩"; -keys["mac"][371] = "Numpad F1"; -keys["mac"][372] = "Numpad F2"; -keys["mac"][373] = "Numpad F3"; -keys["mac"][374] = "Numpad F4"; -keys["mac"][375] = "Numpad ⇱"; -keys["mac"][376] = "Numpad ←"; -keys["mac"][377] = "Numpad ↑"; -keys["mac"][378] = "Numpad →"; -keys["mac"][379] = "Numpad ↓"; -keys["mac"][380] = "Numpad ⇞"; -keys["mac"][381] = "Numpad ⇟"; -keys["mac"][382] = "Numpad ⇲"; -keys["mac"][383] = "Numpad ⇱"; -keys["mac"][384] = "Numpad Insert"; -keys["mac"][385] = "Numpad ⌫"; -keys["mac"][386] = "Numpad ="; -keys["mac"][387] = "Numpad *"; -keys["mac"][388] = "Numpad +"; -keys["mac"][389] = "Numpad Separator"; -keys["mac"][390] = "Numpad -"; -keys["mac"][391] = "Numpad ."; -keys["mac"][392] = "Numpad /"; -keys["mac"][393] = "Left Windows Key"; -keys["mac"][394] = "Right Windows Key"; -keys["mac"][395] = "Windows Menu Key"; -keys["mac"]["+"] = ""; -keys["linux"][8] = "Backspace"; -keys["linux"][9] = "Tab"; -keys["linux"][13] = "Return"; -keys["linux"][27] = "Escape"; -keys["linux"][32] = "Space"; -keys["linux"][33] = "!"; -keys["linux"][34] = """; -keys["linux"][35] = "#"; -keys["linux"][36] = "$"; -keys["linux"][37] = "%"; -keys["linux"][38] = "&"; -keys["linux"][39] = "'"; -keys["linux"][40] = "("; -keys["linux"][41] = ")"; -keys["linux"][42] = "*"; -keys["linux"][43] = "+"; -keys["linux"][44] = ","; -keys["linux"][45] = "-"; -keys["linux"][46] = "."; -keys["linux"][47] = "/"; -keys["linux"][48] = "0"; -keys["linux"][49] = "1"; -keys["linux"][50] = "2"; -keys["linux"][51] = "3"; -keys["linux"][52] = "4"; -keys["linux"][53] = "5"; -keys["linux"][54] = "6"; -keys["linux"][55] = "7"; -keys["linux"][56] = "8"; -keys["linux"][57] = "9"; -keys["linux"][58] = ":"; -keys["linux"][59] = ";"; -keys["linux"][60] = ">"; -keys["linux"][61] = "="; -keys["linux"][62] = "<"; -keys["linux"][63] = "?"; -keys["linux"][64] = "@"; -keys["linux"][65] = "A"; -keys["linux"][66] = "B"; -keys["linux"][67] = "C"; -keys["linux"][68] = "D"; -keys["linux"][69] = "E"; -keys["linux"][70] = "F"; -keys["linux"][71] = "G"; -keys["linux"][72] = "H"; -keys["linux"][73] = "I"; -keys["linux"][74] = "J"; -keys["linux"][75] = "K"; -keys["linux"][76] = "L"; -keys["linux"][77] = "M"; -keys["linux"][78] = "N"; -keys["linux"][79] = "O"; -keys["linux"][80] = "P"; -keys["linux"][81] = "Q"; -keys["linux"][82] = "R"; -keys["linux"][83] = "S"; -keys["linux"][84] = "T"; -keys["linux"][85] = "U"; -keys["linux"][86] = "V"; -keys["linux"][87] = "W"; -keys["linux"][88] = "X"; -keys["linux"][89] = "Y"; -keys["linux"][90] = "Z"; -keys["linux"][91] = "["; -keys["linux"][92] = "\\"; -keys["linux"][93] = "]"; -keys["linux"][94] = "^"; -keys["linux"][95] = "_"; -keys["linux"][96] = "`"; -keys["linux"][97] = "a"; -keys["linux"][98] = "b"; -keys["linux"][99] = "c"; -keys["linux"][100] = "d"; -keys["linux"][101] = "e"; -keys["linux"][102] = "f"; -keys["linux"][103] = "g"; -keys["linux"][104] = "h"; -keys["linux"][105] = "i"; -keys["linux"][106] = "j"; -keys["linux"][107] = "k"; -keys["linux"][108] = "l"; -keys["linux"][109] = "m"; -keys["linux"][110] = "n"; -keys["linux"][111] = "o"; -keys["linux"][112] = "p"; -keys["linux"][113] = "q"; -keys["linux"][114] = "r"; -keys["linux"][115] = "s"; -keys["linux"][116] = "t"; -keys["linux"][117] = "u"; -keys["linux"][118] = "v"; -keys["linux"][119] = "w"; -keys["linux"][120] = "x"; -keys["linux"][121] = "y"; -keys["linux"][122] = "z"; -keys["linux"][123] = "{"; -keys["linux"][124] = "|"; -keys["linux"][125] = "}"; -keys["linux"][126] = "~"; -keys["linux"][127] = "Delete"; -keys["linux"][303] = "Cancel"; -keys["linux"][305] = "Clear"; -keys["linux"][306] = "Shift"; -keys["linux"][307] = "Alt"; -keys["linux"][308] = "Ctrl"; -keys["linux"][309] = "Menu"; -keys["linux"][310] = "Pause"; -keys["linux"][311] = "Capital"; -keys["linux"][312] = "End"; -keys["linux"][313] = "Home"; -keys["linux"][314] = "←"; -keys["linux"][315] = "↑"; -keys["linux"][316] = "→"; -keys["linux"][317] = "↓"; -keys["linux"][318] = "Select"; -keys["linux"][319] = "Print"; -keys["linux"][320] = "Execute"; -keys["linux"][321] = "Snapshot"; -keys["linux"][322] = "Insert"; -keys["linux"][323] = "Help"; -keys["linux"][324] = "Numpad 0"; -keys["linux"][325] = "Numpad 1"; -keys["linux"][326] = "Numpad 2"; -keys["linux"][327] = "Numpad 3"; -keys["linux"][328] = "Numpad 4"; -keys["linux"][329] = "Numpad 5"; -keys["linux"][330] = "Numpad 6"; -keys["linux"][331] = "Numpad 7"; -keys["linux"][332] = "Numpad 8"; -keys["linux"][333] = "Numpad 9"; -keys["linux"][334] = "*"; -keys["linux"][335] = "+"; -keys["linux"][337] = "-"; -keys["linux"][338] = "."; -keys["linux"][339] = "/"; -keys["linux"][340] = "F1"; -keys["linux"][341] = "F2"; -keys["linux"][342] = "F3"; -keys["linux"][343] = "F4"; -keys["linux"][344] = "F5"; -keys["linux"][345] = "F6"; -keys["linux"][346] = "F7"; -keys["linux"][347] = "F8"; -keys["linux"][348] = "F9"; -keys["linux"][349] = "F10"; -keys["linux"][350] = "F11"; -keys["linux"][351] = "F12"; -keys["linux"][352] = "F13"; -keys["linux"][353] = "F14"; -keys["linux"][354] = "F15"; -keys["linux"][355] = "F16"; -keys["linux"][356] = "F17"; -keys["linux"][357] = "F18"; -keys["linux"][358] = "F19"; -keys["linux"][359] = "F20"; -keys["linux"][360] = "F21"; -keys["linux"][361] = "F22"; -keys["linux"][362] = "F23"; -keys["linux"][363] = "F24"; -keys["linux"][364] = "Numlock"; -keys["linux"][365] = "Scroll"; -keys["linux"][366] = "Page Up"; -keys["linux"][367] = "Page Down"; -keys["linux"][368] = "Numpad Space"; -keys["linux"][369] = "Numpad Tab"; -keys["linux"][370] = "Numpad Enter"; -keys["linux"][371] = "Numpad F1"; -keys["linux"][372] = "Numpad F2"; -keys["linux"][373] = "Numpad F3"; -keys["linux"][374] = "Numpad F4"; -keys["linux"][375] = "Numpad Home"; -keys["linux"][376] = "Numpad ←"; -keys["linux"][377] = "Numpad ↑"; -keys["linux"][378] = "Numpad →"; -keys["linux"][379] = "Numpad ↓"; -keys["linux"][380] = "Numpad Page Up"; -keys["linux"][381] = "Numpad Page Down"; -keys["linux"][382] = "Numpad End"; -keys["linux"][383] = "Numpad Home"; -keys["linux"][384] = "Numpad Insert"; -keys["linux"][385] = "Numpad Delete"; -keys["linux"][386] = "Numpad ="; -keys["linux"][387] = "Numpad *"; -keys["linux"][388] = "Numpad +"; -keys["linux"][389] = "Numpad Separator"; -keys["linux"][390] = "Numpad -"; -keys["linux"][391] = "Numpad ."; -keys["linux"][392] = "Numpad /"; -keys["linux"][393] = "Left Windows Key"; -keys["linux"][394] = "Right Windows Key"; -keys["linux"][395] = "Windows Menu Key"; -keys["linux"]["+"] = "+"; - -var menu = {}; -menu["Menu/File/New"] = { path: ["File", "New"], shortcut: { key:78, modifiers: [308] } }; -menu["Menu/File/Open"] = { path: ["File", "Open..."], shortcut: { key:79, modifiers: [308] } }; -menu["Menu/File/Save"] = { path: ["File", "Save"], shortcut: { key:83, modifiers: [308] } }; -menu["Menu/File/Save as"] = { path: ["File", "Save as..."], shortcut: { key:83, modifiers: [306, 308] } }; -menu["Menu/File/Export/Wavefront OBJ"] = { path: ["File", "Export", "Wavefront OBJ..."], shortcut: { key:0, modifiers: [] } }; -menu["Menu/File/Load Point File"] = { path: ["File", "Load Point File..."], shortcut: { key:0, modifiers: [] } }; -menu["Menu/File/Reload Point File"] = { path: ["File", "Reload Point File"], shortcut: { key:0, modifiers: [] } }; -menu["Menu/File/Unload Point File"] = { path: ["File", "Unload Point File"], shortcut: { key:0, modifiers: [] } }; -menu["Menu/File/Load Portal File"] = { path: ["File", "Load Portal File..."], shortcut: { key:0, modifiers: [] } }; -menu["Menu/File/Reload Portal File"] = { path: ["File", "Reload Portal File"], shortcut: { key:0, modifiers: [] } }; -menu["Menu/File/Unload Portal File"] = { path: ["File", "Unload Portal File"], shortcut: { key:0, modifiers: [] } }; -menu["Menu/File/Reload Texture Collections"] = { path: ["File", "Reload Texture Collections"], shortcut: { key:344, modifiers: [] } }; -menu["Menu/File/Reload Entity Definitions"] = { path: ["File", "Reload Entity Definitions"], shortcut: { key:345, modifiers: [] } }; -menu["Menu/File/Close"] = { path: ["File", "Close"], shortcut: { key:87, modifiers: [308] } }; -menu["Menu/Edit/Undo"] = { path: ["Edit", "Undo"], shortcut: { key:90, modifiers: [308] } }; -menu["Menu/Edit/Redo"] = { path: ["Edit", "Redo"], shortcut: { key:90, modifiers: [306, 308] } }; -menu["Menu/Edit/Repeat"] = { path: ["Edit", "Repeat"], shortcut: { key:82, modifiers: [308] } }; -menu["Menu/Edit/Clear Repeatable Commands"] = { path: ["Edit", "Clear Repeatable Commands"], shortcut: { key:82, modifiers: [306, 308] } }; -menu["Menu/Edit/Cut"] = { path: ["Edit", "Cut"], shortcut: { key:88, modifiers: [308] } }; -menu["Menu/Edit/Copy"] = { path: ["Edit", "Copy"], shortcut: { key:67, modifiers: [308] } }; -menu["Menu/Edit/Paste"] = { path: ["Edit", "Paste"], shortcut: { key:86, modifiers: [308] } }; -menu["Menu/Edit/Paste at Original Position"] = { path: ["Edit", "Paste at Original Position"], shortcut: { key:86, modifiers: [307, 308] } }; -menu["Menu/Edit/Duplicate"] = { path: ["Edit", "Duplicate"], shortcut: { key:68, modifiers: [308] } }; -menu["Menu/Edit/Delete"] = { path: ["Edit", "Delete"], shortcut: { key:127, modifiers: [] } }; -menu["Menu/Edit/Select All"] = { path: ["Edit", "Select All"], shortcut: { key:65, modifiers: [308] } }; -menu["Menu/Edit/Select Siblings"] = { path: ["Edit", "Select Siblings"], shortcut: { key:66, modifiers: [308] } }; -menu["Menu/Edit/Select Touching"] = { path: ["Edit", "Select Touching"], shortcut: { key:84, modifiers: [308] } }; -menu["Menu/Edit/Select Inside"] = { path: ["Edit", "Select Inside"], shortcut: { key:69, modifiers: [308] } }; -menu["Menu/Edit/Select Tall"] = { path: ["Edit", "Select Tall"], shortcut: { key:69, modifiers: [306, 308] } }; -menu["Menu/Edit/Select by Line Number"] = { path: ["Edit", "Select by Line Number"], shortcut: { key:0, modifiers: [] } }; -menu["Menu/Edit/Select None"] = { path: ["Edit", "Select None"], shortcut: { key:65, modifiers: [306, 308] } }; -menu["Menu/Edit/Group"] = { path: ["Edit", "Group"], shortcut: { key:71, modifiers: [308] } }; -menu["Menu/Edit/Ungroup"] = { path: ["Edit", "Ungroup"], shortcut: { key:71, modifiers: [306, 308] } }; -menu["Menu/Edit/Tools/Brush Tool"] = { path: ["Edit", "Tools", "Brush Tool"], shortcut: { key:66, modifiers: [] } }; -menu["Menu/Edit/Tools/Clip Tool"] = { path: ["Edit", "Tools", "Clip Tool"], shortcut: { key:67, modifiers: [] } }; -menu["Menu/Edit/Tools/Rotate Tool"] = { path: ["Edit", "Tools", "Rotate Tool"], shortcut: { key:82, modifiers: [] } }; -menu["Menu/Edit/Tools/Scale Tool"] = { path: ["Edit", "Tools", "Scale Tool"], shortcut: { key:84, modifiers: [] } }; -menu["Menu/Edit/Tools/Shear Tool"] = { path: ["Edit", "Tools", "Shear Tool"], shortcut: { key:71, modifiers: [] } }; -menu["Menu/Edit/Tools/Vertex Tool"] = { path: ["Edit", "Tools", "Vertex Tool"], shortcut: { key:86, modifiers: [] } }; -menu["Menu/Edit/Tools/Edge Tool"] = { path: ["Edit", "Tools", "Edge Tool"], shortcut: { key:69, modifiers: [] } }; -menu["Menu/Edit/Tools/Face Tool"] = { path: ["Edit", "Tools", "Face Tool"], shortcut: { key:70, modifiers: [] } }; -menu["Menu/Edit/CSG/Convex Merge"] = { path: ["Edit", "CSG", "Convex Merge"], shortcut: { key:74, modifiers: [308] } }; -menu["Menu/Edit/CSG/Subtract"] = { path: ["Edit", "CSG", "Subtract"], shortcut: { key:75, modifiers: [308] } }; -menu["Menu/Edit/CSG/Hollow"] = { path: ["Edit", "CSG", "Hollow"], shortcut: { key:75, modifiers: [307, 308] } }; -menu["Menu/Edit/CSG/Intersect"] = { path: ["Edit", "CSG", "Intersect"], shortcut: { key:76, modifiers: [308] } }; -menu["Menu/Edit/Snap Vertices to Integer"] = { path: ["Edit", "Snap Vertices to Integer"], shortcut: { key:86, modifiers: [306, 308] } }; -menu["Menu/Edit/Snap Vertices to Grid"] = { path: ["Edit", "Snap Vertices to Grid"], shortcut: { key:86, modifiers: [306, 307, 308] } }; -menu["Menu/Edit/Texture Lock"] = { path: ["Edit", "Texture Lock"], shortcut: { key:0, modifiers: [] } }; -menu["Menu/Edit/UV Lock"] = { path: ["Edit", "UV Lock"], shortcut: { key:85, modifiers: [] } }; -menu["Menu/Edit/Replace Texture"] = { path: ["Edit", "Replace Texture..."], shortcut: { key:0, modifiers: [] } }; -menu["Menu/View/Grid/Show Grid"] = { path: ["View", "Grid", "Show Grid"], shortcut: { key:48, modifiers: [] } }; -menu["Menu/View/Grid/Snap to Grid"] = { path: ["View", "Grid", "Snap to Grid"], shortcut: { key:48, modifiers: [307] } }; -menu["Menu/View/Grid/Increase Grid Size"] = { path: ["View", "Grid", "Increase Grid Size"], shortcut: { key:43, modifiers: [] } }; -menu["Menu/View/Grid/Decrease Grid Size"] = { path: ["View", "Grid", "Decrease Grid Size"], shortcut: { key:45, modifiers: [] } }; -menu["Menu/View/Grid/Set Grid Size 0.125"] = { path: ["View", "Grid", "Set Grid Size 0.125"], shortcut: { key:0, modifiers: [] } }; -menu["Menu/View/Grid/Set Grid Size 0.25"] = { path: ["View", "Grid", "Set Grid Size 0.25"], shortcut: { key:0, modifiers: [] } }; -menu["Menu/View/Grid/Set Grid Size 0.5"] = { path: ["View", "Grid", "Set Grid Size 0.5"], shortcut: { key:0, modifiers: [] } }; -menu["Menu/View/Grid/Set Grid Size 1"] = { path: ["View", "Grid", "Set Grid Size 1"], shortcut: { key:49, modifiers: [] } }; -menu["Menu/View/Grid/Set Grid Size 2"] = { path: ["View", "Grid", "Set Grid Size 2"], shortcut: { key:50, modifiers: [] } }; -menu["Menu/View/Grid/Set Grid Size 4"] = { path: ["View", "Grid", "Set Grid Size 4"], shortcut: { key:51, modifiers: [] } }; -menu["Menu/View/Grid/Set Grid Size 8"] = { path: ["View", "Grid", "Set Grid Size 8"], shortcut: { key:52, modifiers: [] } }; -menu["Menu/View/Grid/Set Grid Size 16"] = { path: ["View", "Grid", "Set Grid Size 16"], shortcut: { key:53, modifiers: [] } }; -menu["Menu/View/Grid/Set Grid Size 32"] = { path: ["View", "Grid", "Set Grid Size 32"], shortcut: { key:54, modifiers: [] } }; -menu["Menu/View/Grid/Set Grid Size 64"] = { path: ["View", "Grid", "Set Grid Size 64"], shortcut: { key:55, modifiers: [] } }; -menu["Menu/View/Grid/Set Grid Size 128"] = { path: ["View", "Grid", "Set Grid Size 128"], shortcut: { key:56, modifiers: [] } }; -menu["Menu/View/Grid/Set Grid Size 256"] = { path: ["View", "Grid", "Set Grid Size 256"], shortcut: { key:57, modifiers: [] } }; -menu["Menu/View/Camera/Move to Next Point"] = { path: ["View", "Camera", "Move to Next Point"], shortcut: { key:46, modifiers: [] } }; -menu["Menu/View/Camera/Move to Previous Point"] = { path: ["View", "Camera", "Move to Previous Point"], shortcut: { key:44, modifiers: [] } }; -menu["Menu/View/Camera/Focus on Selection"] = { path: ["View", "Camera", "Focus on Selection"], shortcut: { key:85, modifiers: [308] } }; -menu["Menu/View/Camera/Move Camera to"] = { path: ["View", "Camera", "Move Camera to..."], shortcut: { key:0, modifiers: [] } }; -menu["Menu/View/Isolate"] = { path: ["View", "Isolate"], shortcut: { key:73, modifiers: [308] } }; -menu["Menu/View/Hide"] = { path: ["View", "Hide"], shortcut: { key:73, modifiers: [307, 308] } }; -menu["Menu/View/Show All"] = { path: ["View", "Show All"], shortcut: { key:73, modifiers: [306, 308] } }; -menu["Menu/View/Switch to Map Inspector"] = { path: ["View", "Switch to Map Inspector"], shortcut: { key:49, modifiers: [308] } }; -menu["Menu/View/Switch to Entity Inspector"] = { path: ["View", "Switch to Entity Inspector"], shortcut: { key:50, modifiers: [308] } }; -menu["Menu/View/Switch to Face Inspector"] = { path: ["View", "Switch to Face Inspector"], shortcut: { key:51, modifiers: [308] } }; -menu["Menu/View/Toggle Info Panel"] = { path: ["View", "Toggle Info Panel"], shortcut: { key:52, modifiers: [308] } }; -menu["Menu/View/Toggle Inspector"] = { path: ["View", "Toggle Inspector"], shortcut: { key:53, modifiers: [308] } }; -menu["Menu/View/Maximize Current View"] = { path: ["View", "Maximize Current View"], shortcut: { key:32, modifiers: [308] } }; -menu["Menu/View/Preferences"] = { path: ["View", "Preferences..."], shortcut: { key:0, modifiers: [] } }; -menu["Menu/Run/Compile"] = { path: ["Run", "Compile..."], shortcut: { key:0, modifiers: [] } }; -menu["Menu/Run/Launch"] = { path: ["Run", "Launch..."], shortcut: { key:0, modifiers: [] } }; -menu["Menu/Debug/Print Vertices"] = { path: ["Debug", "Print Vertices"], shortcut: { key:0, modifiers: [] } }; -menu["Menu/Debug/Create Brush"] = { path: ["Debug", "Create Brush..."], shortcut: { key:0, modifiers: [] } }; -menu["Menu/Debug/Create Cube"] = { path: ["Debug", "Create Cube..."], shortcut: { key:0, modifiers: [] } }; -menu["Menu/Debug/Clip Brush"] = { path: ["Debug", "Clip Brush..."], shortcut: { key:0, modifiers: [] } }; -menu["Menu/Debug/Copy Javascript Shortcut Map"] = { path: ["Debug", "Copy Javascript Shortcut Map"], shortcut: { key:0, modifiers: [] } }; -menu["Menu/Debug/Crash"] = { path: ["Debug", "Crash..."], shortcut: { key:0, modifiers: [] } }; -menu["Menu/Debug/Throw Exception During Command"] = { path: ["Debug", "Throw Exception During Command"], shortcut: { key:0, modifiers: [] } }; -menu["Menu/Debug/Show Crash Report Dialog"] = { path: ["Debug", "Show Crash Report Dialog"], shortcut: { key:0, modifiers: [] } }; -menu["Menu/Debug/Set Window Size"] = { path: ["Debug", "Set Window Size..."], shortcut: { key:0, modifiers: [] } }; -menu["Menu/Help/TrenchBroom Manual"] = { path: ["Help", "TrenchBroom Manual"], shortcut: { key:340, modifiers: [] } }; -menu["Menu/Help/About TrenchBroom"] = { path: ["Help", "About TrenchBroom"], shortcut: { key:0, modifiers: [] } }; -var actions = {}; -actions["Controls/Map view/Create brush"] = { key:13, modifiers: [] }; -actions["Controls/Map view/Toggle clip side"] = { key:13, modifiers: [308] }; -actions["Controls/Map view/Perform clip"] = { key:13, modifiers: [] }; -actions["Controls/Map view/Move vertices up; Move vertices forward"] = { key:315, modifiers: [] }; -actions["Controls/Map view/Move vertices down; Move vertices backward"] = { key:317, modifiers: [] }; -actions["Controls/Map view/Move vertices left"] = { key:314, modifiers: [] }; -actions["Controls/Map view/Move vertices right"] = { key:316, modifiers: [] }; -actions["Controls/Map view/Move vertices backward; Move vertices up"] = { key:366, modifiers: [] }; -actions["Controls/Map view/Move vertices forward; Move vertices down"] = { key:367, modifiers: [] }; -actions["Controls/Map view/Move rotation center up; Move rotation center forward"] = { key:315, modifiers: [] }; -actions["Controls/Map view/Move rotation center down; Move rotation center backward"] = { key:317, modifiers: [] }; -actions["Controls/Map view/Move rotation center left"] = { key:314, modifiers: [] }; -actions["Controls/Map view/Move rotation center right"] = { key:316, modifiers: [] }; -actions["Controls/Map view/Move rotation center backward; Move rotation center up"] = { key:366, modifiers: [] }; -actions["Controls/Map view/Move rotation center forward; Move rotation center down"] = { key:367, modifiers: [] }; -actions["Controls/Map view/Move objects up; Move objects forward"] = { key:315, modifiers: [] }; -actions["Controls/Map view/Move objects down; Move objects backward"] = { key:317, modifiers: [] }; -actions["Controls/Map view/Move objects left"] = { key:314, modifiers: [] }; -actions["Controls/Map view/Move objects right"] = { key:316, modifiers: [] }; -actions["Controls/Map view/Move objects backward; Move objects up"] = { key:366, modifiers: [] }; -actions["Controls/Map view/Move objects forward; Move objects down"] = { key:367, modifiers: [] }; -actions["Controls/Map view/Roll objects clockwise"] = { key:315, modifiers: [307] }; -actions["Controls/Map view/Roll objects counter-clockwise"] = { key:317, modifiers: [307] }; -actions["Controls/Map view/Yaw objects clockwise"] = { key:314, modifiers: [307] }; -actions["Controls/Map view/Yaw objects counter-clockwise"] = { key:316, modifiers: [307] }; -actions["Controls/Map view/Pitch objects clockwise"] = { key:366, modifiers: [307] }; -actions["Controls/Map view/Pitch objects counter-clockwise"] = { key:367, modifiers: [307] }; -actions["Controls/Map view/Flip objects horizontally"] = { key:70, modifiers: [308] }; -actions["Controls/Map view/Flip objects vertically"] = { key:70, modifiers: [307, 308] }; -actions["Controls/Map view/Duplicate and move objects up; Duplicate and move objects forward"] = { key:315, modifiers: [308] }; -actions["Controls/Map view/Duplicate and move objects down; Duplicate and move objects backward"] = { key:317, modifiers: [308] }; -actions["Controls/Map view/Duplicate and move objects left"] = { key:314, modifiers: [308] }; -actions["Controls/Map view/Duplicate and move objects right"] = { key:316, modifiers: [308] }; -actions["Controls/Map view/Duplicate and move objects backward; Duplicate and move objects up"] = { key:366, modifiers: [308] }; -actions["Controls/Map view/Duplicate and move objects forward; Duplicate and move objects down"] = { key:367, modifiers: [308] }; -actions["Controls/Map view/Move textures up"] = { key:315, modifiers: [] }; -actions["Controls/Map view/Move textures up (fine)"] = { key:315, modifiers: [308] }; -actions["Controls/Map view/Move textures up (coarse)"] = { key:315, modifiers: [306] }; -actions["Controls/Map view/Move textures down"] = { key:317, modifiers: [] }; -actions["Controls/Map view/Move textures down (fine)"] = { key:317, modifiers: [308] }; -actions["Controls/Map view/Move textures down (coarse)"] = { key:317, modifiers: [306] }; -actions["Controls/Map view/Move textures left"] = { key:314, modifiers: [] }; -actions["Controls/Map view/Move textures left (fine)"] = { key:314, modifiers: [308] }; -actions["Controls/Map view/Move textures left (coarse)"] = { key:314, modifiers: [306] }; -actions["Controls/Map view/Move textures right"] = { key:316, modifiers: [] }; -actions["Controls/Map view/Move textures right (fine)"] = { key:316, modifiers: [308] }; -actions["Controls/Map view/Move textures right (coarse)"] = { key:316, modifiers: [306] }; -actions["Controls/Map view/Rotate textures clockwise"] = { key:366, modifiers: [] }; -actions["Controls/Map view/Rotate textures clockwise (fine)"] = { key:366, modifiers: [308] }; -actions["Controls/Map view/Rotate textures clockwise (coarse)"] = { key:366, modifiers: [306] }; -actions["Controls/Map view/Rotate textures counter-clockwise"] = { key:367, modifiers: [] }; -actions["Controls/Map view/Rotate textures counter-clockwise (fine)"] = { key:367, modifiers: [308] }; -actions["Controls/Map view/Rotate textures counter-clockwise (coarse)"] = { key:367, modifiers: [306] }; -actions["Controls/Map view/Cycle map view"] = { key:32, modifiers: [] }; -actions["Controls/Map view/Reset camera zoom"] = { key:27, modifiers: [306] }; -actions["Controls/Map view/Cancel"] = { key:27, modifiers: [] }; -actions["Controls/Map view/Deactivate current tool"] = { key:27, modifiers: [308] }; -actions["Controls/Map view/Make structural"] = { key:83, modifiers: [307] }; -actions["Controls/Map view/View Filter > Toggle show entity classnames"] = { key:0, modifiers: [] }; -actions["Controls/Map view/View Filter > Toggle show group bounds"] = { key:0, modifiers: [] }; -actions["Controls/Map view/View Filter > Toggle show brush entity bounds"] = { key:0, modifiers: [] }; -actions["Controls/Map view/View Filter > Toggle show point entity bounds"] = { key:0, modifiers: [] }; -actions["Controls/Map view/View Filter > Toggle show point entities"] = { key:0, modifiers: [] }; -actions["Controls/Map view/View Filter > Toggle show point entity models"] = { key:0, modifiers: [] }; -actions["Controls/Map view/View Filter > Toggle show brushes"] = { key:0, modifiers: [] }; -actions["Controls/Map view/View Filter > Show textures"] = { key:0, modifiers: [] }; -actions["Controls/Map view/View Filter > Hide textures"] = { key:0, modifiers: [] }; -actions["Controls/Map view/View Filter > Hide faces"] = { key:0, modifiers: [] }; -actions["Controls/Map view/View Filter > Shade faces"] = { key:0, modifiers: [] }; -actions["Controls/Map view/View Filter > Use fog"] = { key:0, modifiers: [] }; -actions["Controls/Map view/View Filter > Show edges"] = { key:0, modifiers: [] }; -actions["Controls/Map view/View Filter > Show all entity links"] = { key:0, modifiers: [] }; -actions["Controls/Map view/View Filter > Show transitively selected entity links"] = { key:0, modifiers: [] }; -actions["Controls/Map view/View Filter > Show directly selected entity links"] = { key:0, modifiers: [] }; -actions["Controls/Map view/View Filter > Hide entity links"] = { key:0, modifiers: [] }; -actions["Controls/Camera/Move forward"] = { key:87, modifiers: [] }; -actions["Controls/Camera/Move backward"] = { key:83, modifiers: [] }; -actions["Controls/Camera/Move left"] = { key:65, modifiers: [] }; -actions["Controls/Camera/Move right"] = { key:68, modifiers: [] }; -actions["Controls/Camera/Move up"] = { key:81, modifiers: [] }; -actions["Controls/Camera/Move down"] = { key:88, modifiers: [] }; diff --git a/app/resources/documentation/manual/shortcuts_helper.js b/app/resources/documentation/manual/shortcuts_helper.js index 24b5c42eb5..911e784153 100644 --- a/app/resources/documentation/manual/shortcuts_helper.js +++ b/app/resources/documentation/manual/shortcuts_helper.js @@ -1,80 +1,69 @@ -var platform = "windows"; -if (navigator.platform.indexOf("Win")!=-1) platform = "windows"; -if (navigator.platform.indexOf("Mac")!=-1) platform = "mac"; -if (navigator.platform.indexOf("X11")!=-1) platform = "linux"; -if (navigator.platform.indexOf("Linux")!=-1) platform = "linux"; -//platform = "mac"; //debug - -console.log(`Platform detected as ${platform} with navigator.platform=${navigator.platform}`); - function key_str(key) { - if (keys[platform][key]) - return "" + keys[platform][key] + ""; - return null; + if (keys[key]) { + return "" + keys[key] + ""; + } else { + return undefined; + } } function shortcut_str(shortcut) { - var result = ""; - if (shortcut) { - if (shortcut.key == 0) { - result = null; - } else { - for (i = 0; i < shortcut.modifiers.length; ++i) - result += key_str(shortcut.modifiers[i]); - result += key_str(shortcut.key); - } - } else { - result += "«unknown shortcut»"; - } + let result = ""; + if (shortcut) { + if (shortcut.key == 0) { + result = undefined; + } else { + for (i = 0; i < shortcut.modifiers.length; ++i) { + result += key_str(shortcut.modifiers[i]); + } + result += key_str(shortcut.key); + } + } else { + result += "«unknown shortcut»"; + } - return result; + return result; } function menu_path_str(path) { - var result = ""; - for (i = 0; i < path.length; ++i) { - result += path[i]; - if (i < path.length - 1) - result += " » "; - } - return result; + return path.join(" » "); } function menu_item_str(key) { - var result = ""; - var item = menu[key]; - if (item) { - result += menu_path_str(item.path); - var shortcut = shortcut_str(item.shortcut); - if (shortcut) - result += " (" + shortcut + ")"; - } else { - result += "unknown menu item \"" + key + "\""; - } - result += ""; - return result; + let result = ""; + const item = menu[key]; + if (item) { + result += menu_path_str(item.path); + const shortcut = shortcut_str(item.shortcut); + if (shortcut) { + result += " (" + shortcut + ")"; + } + } else { + result += "unknown menu item \"" + key + "\""; + } + result += ""; + return result; } function action_str(key) { - var result = ""; - var item = actions[key]; - if (item) { - result += shortcut_str(item); - } else { - result += "unknown action \"" + key + "\""; - } - result += ""; - return result; + let result = ""; + const item = actions[key]; + if (item) { + result += shortcut_str(item); + } else { + result += "unknown action \"" + key + "\""; + } + result += ""; + return result; } function print_key(key) { - document.write(key_str(key)); + document.write(key_str(key)); } function print_menu_item(key) { - document.write(menu_item_str(key)); + document.write(menu_item_str(key)); } function print_action(key) { - document.write(action_str(key)); -} \ No newline at end of file + document.write(action_str(key)); +} diff --git a/dump-shortcuts/src/Main.cpp b/dump-shortcuts/src/Main.cpp index 6083e9035d..77665731e2 100644 --- a/dump-shortcuts/src/Main.cpp +++ b/dump-shortcuts/src/Main.cpp @@ -106,9 +106,8 @@ namespace TrenchBroom { void visit(const MenuActionItem& item) override { m_out << " '" << QString::fromStdString(item.action().preferencePath().asString('/')) << "': "; - m_out << "{ path: " << toString(m_path, item.label()) << ", shortcut: " << toString(item.action().keySequence()) << ",\n"; + m_out << "{ path: " << toString(m_path, item.label()) << ", shortcut: " << toString(item.action().keySequence()) << " },\n"; } - }; void printMenuShortcuts(QTextStream& out) { @@ -156,7 +155,7 @@ int main(int argc, char *argv[]) { const auto fileInfo = QFileInfo(file.fileName()); const auto absPath = fileInfo.absoluteFilePath().toStdString(); - if (!file.open(QIODevice::WriteOnly | QIODevice::Text)) { // implies truncate, which we want + if (!file.open(QIODevice::WriteOnly | QIODevice::Text)) { // QIODevice::WriteOnly implies truncate, which we want std::cout << "Could not open output file for writing: " << absPath << "\n"; return 1; }