EditorStrings.ts 3.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104
  1. //
  2. // Copyright (c) 2014-2016 THUNDERBEAST GAMES LLC
  3. //
  4. // Permission is hereby granted, free of charge, to any person obtaining a copy
  5. // of this software and associated documentation files (the "Software"), to deal
  6. // in the Software without restriction, including without limitation the rights
  7. // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
  8. // copies of the Software, and to permit persons to whom the Software is
  9. // furnished to do so, subject to the following conditions:
  10. //
  11. // The above copyright notice and this permission notice shall be included in
  12. // all copies or substantial portions of the Software.
  13. //
  14. // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
  15. // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
  16. // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
  17. // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
  18. // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
  19. // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
  20. // THE SOFTWARE.
  21. //
  22. export enum StringID {
  23. RevealInFinder,
  24. ShortcutUndo,
  25. ShortcutRedo,
  26. ShortcutCut,
  27. ShortcutCopy,
  28. ShortcutPaste,
  29. ShortcutSelectAll,
  30. ShortcutFind,
  31. ShortcutFindNext,
  32. ShortcutFindPrev,
  33. ShortcutBeautify,
  34. ShortcutCloseFile,
  35. ShortcutSaveFile,
  36. ShortcutPlay,
  37. ShortcutPause,
  38. ShortcutStep,
  39. ShortcutPlayDebug,
  40. ShortcutBuild,
  41. ShortcutBuildSettings,
  42. ShortcutFrameSelected,
  43. ShortcutScreenshot
  44. }
  45. export class EditorString {
  46. public static GetString(id: StringID): string {
  47. return EditorString.lookup[id];
  48. }
  49. private static lookup: { [id: number]: string; } = {};
  50. private static Ctor = (() => {
  51. var lookup = EditorString.lookup;
  52. var shortcutKey;
  53. if (Atomic.platform == "MacOSX") {
  54. shortcutKey = "⌘";
  55. } else { // Windows and Linux
  56. shortcutKey = "CTRL + ";
  57. }
  58. lookup[StringID.RevealInFinder] = "Reveal in Finder";
  59. // Mac, Windows and Linux
  60. lookup[StringID.ShortcutRedo] = "⇧" + shortcutKey + "Z";
  61. lookup[StringID.ShortcutFindNext] = shortcutKey + "G";
  62. lookup[StringID.ShortcutFindPrev] = "⇧" + shortcutKey + "G";
  63. lookup[StringID.ShortcutBuildSettings] = "⇧" + shortcutKey + "B";
  64. // General
  65. lookup[StringID.ShortcutUndo] = shortcutKey + "Z";
  66. lookup[StringID.ShortcutCut] = shortcutKey + "X";
  67. lookup[StringID.ShortcutCopy] = shortcutKey + "C";
  68. lookup[StringID.ShortcutPaste] = shortcutKey + "V";
  69. lookup[StringID.ShortcutSelectAll] = shortcutKey + "A";
  70. lookup[StringID.ShortcutFind] = shortcutKey + "F";
  71. lookup[StringID.ShortcutFrameSelected] = "F";
  72. lookup[StringID.ShortcutBeautify] = shortcutKey + "I";
  73. lookup[StringID.ShortcutSaveFile] = shortcutKey + "S";
  74. lookup[StringID.ShortcutCloseFile] = shortcutKey + "W";
  75. lookup[StringID.ShortcutPlay] = shortcutKey + "P";
  76. lookup[StringID.ShortcutPause] = shortcutKey + "U";
  77. lookup[StringID.ShortcutStep] = "⇧" + shortcutKey + "U";
  78. lookup[StringID.ShortcutPlayDebug] = "⇧" + shortcutKey + "P";
  79. lookup[StringID.ShortcutBuild] = shortcutKey + "B";
  80. lookup[StringID.ShortcutScreenshot] = shortcutKey + "9";
  81. })();
  82. }