AEEditorStrings.cpp 2.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081
  1. // Copyright (c) 2014-2015, THUNDERBEAST GAMES LLC All rights reserved
  2. // Please see LICENSE.md in repository root for license information
  3. // https://github.com/AtomicGameEngine/AtomicGameEngine
  4. #include "AtomicEditor.h"
  5. #include <Atomic/Core/Context.h>
  6. #include "AEEvents.h"
  7. #include "AEEditorStrings.h"
  8. namespace AtomicEditor
  9. {
  10. EditorStrings::EditorStrings(Context* context) :
  11. Object(context)
  12. {
  13. InitializeStrings();
  14. SubscribeToEvent(E_EDITORSHUTDOWN, HANDLER(EditorStrings, HandleEditorShutdown));
  15. }
  16. EditorStrings::~EditorStrings()
  17. {
  18. }
  19. const String& EditorStrings::Str(EditorString estring)
  20. {
  21. if (stringLookup_.Contains(estring))
  22. return stringLookup_[estring];
  23. return String::EMPTY;
  24. }
  25. void EditorStrings::InitializeStrings()
  26. {
  27. stringLookup_[RevealInFinder] = "Reveal in Finder";
  28. #ifdef ATOMIC_PLATFORM_WINDOWS
  29. String shortcutKey = "Ctrl-";
  30. stringLookup_[ShortcutRedo] ="Ctrl-Y";
  31. stringLookup_[ShortcutFindNext] = "F3";
  32. stringLookup_[ShortcutFindPrev] = "Shift-F3";
  33. stringLookup_[ShortcutBuildSettings] = "Ctrl-Shift-B";
  34. #else
  35. String shortcutKey = "⌘";
  36. stringLookup_[ShortcutRedo] ="⇧⌘Z";
  37. stringLookup_[ShortcutFindNext] = "⌘G";
  38. stringLookup_[ShortcutFindPrev] = "⇧⌘G";
  39. stringLookup_[ShortcutBuildSettings] = "⇧⌘B";
  40. #endif
  41. // Shortcuts
  42. stringLookup_[ShortcutUndo] = shortcutKey + "Z";
  43. stringLookup_[ShortcutCut] = shortcutKey + "X";
  44. stringLookup_[ShortcutCopy] = shortcutKey + "C";
  45. stringLookup_[ShortcutPaste] = shortcutKey + "V";
  46. stringLookup_[ShortcutSelectAll] = shortcutKey + "A";
  47. stringLookup_[ShortcutFind] = shortcutKey + "F";
  48. stringLookup_[ShortcutBeautify] = shortcutKey + "I";
  49. stringLookup_[ShortcutSaveFile] = shortcutKey + "S";
  50. stringLookup_[ShortcutCloseFile] = shortcutKey + "W";
  51. stringLookup_[ShortcutPlay] = shortcutKey + "P";
  52. stringLookup_[ShortcutBuild] = shortcutKey +"B";
  53. }
  54. void EditorStrings::HandleEditorShutdown(StringHash eventType, VariantMap& eventData)
  55. {
  56. context_->RemoveSubsystem(GetType());
  57. }
  58. }