LUAEditorContextInterface.h 5.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127
  1. /*
  2. * Copyright (c) Contributors to the Open 3D Engine Project.
  3. * For complete copyright and license terms please see the LICENSE at the root of this distribution.
  4. *
  5. * SPDX-License-Identifier: Apache-2.0 OR MIT
  6. *
  7. */
  8. #ifndef LUAEDITORCONTEXTINTERFACE_H
  9. #define LUAEDITORCONTEXTINTERFACE_H
  10. #include <AzCore/base.h>
  11. #include <AzCore/std/string/string.h>
  12. #include <AzToolsFramework/UI/LegacyFramework/Core/EditorContextBus.h>
  13. #include <AzCore/IO/SystemFile.h>
  14. #include <AzToolsFramework/SourceControl/SourceControlAPI.h>
  15. #include <AzCore/PlatformIncl.h>
  16. #include <CryCommon/platform.h>
  17. namespace LUAEditor
  18. {
  19. struct DocumentInfo
  20. {
  21. AZStd::string m_assetId; // the assetId
  22. AZ::IO::SystemFile m_scriptFile;
  23. //AZ::Data::Asset<AZ::ScriptAsset> m_scriptAsset; //this is the documents data
  24. AZStd::string m_scriptAsset;
  25. AZStd::string m_assetName; // relative asset name
  26. AZStd::string m_displayName; // for friendly display only
  27. FILETIME m_lastKnownModTime;
  28. AzToolsFramework::SourceControlFileInfo m_sourceControlInfo;
  29. bool m_bSourceControl_Ready; // a result (or failure) came back from SCC. Until this is true, you cannot write to it.
  30. bool m_bSourceControl_BusyGettingStats; // a perforce stat operation is pending
  31. bool m_bSourceControl_BusyRequestingEdit; // a perforce edit request operation is pending
  32. bool m_bSourceControl_CanWrite; // you are allowed to edit and save this file
  33. bool m_bSourceControl_CanCheckOut; // you may be able to check this file out (Actually attempting to may still fail due to changes on the net)
  34. bool m_bDataIsLoaded;
  35. bool m_bDataIsWritten;
  36. bool m_bCloseAfterSave;
  37. bool m_bUntitledDocument;
  38. bool m_bIsModified;
  39. bool m_bIsBeingSaved;
  40. int m_PresetLineAtOpen; // auto-position to this offset when data is loaded
  41. DocumentInfo()
  42. : m_bSourceControl_Ready(false)
  43. , m_bSourceControl_BusyGettingStats(false)
  44. , m_bSourceControl_BusyRequestingEdit(false)
  45. , m_bSourceControl_CanWrite(false)
  46. , m_bSourceControl_CanCheckOut(false)
  47. //, m_assetId(AZ::Data::AssetId::CreateNull())
  48. , m_bDataIsLoaded(false)
  49. , m_bDataIsWritten(true)
  50. , m_bCloseAfterSave(false)
  51. , m_bUntitledDocument(false)
  52. , m_bIsModified(false)
  53. , m_bIsBeingSaved(false)
  54. , m_PresetLineAtOpen(1){}
  55. // Copy constructor does not copy over open file handle
  56. DocumentInfo(const DocumentInfo& other)
  57. : m_assetId(other.m_assetId)
  58. , m_scriptAsset(other.m_scriptAsset)
  59. , m_assetName(other.m_assetName)
  60. , m_displayName(other.m_displayName)
  61. , m_lastKnownModTime(other.m_lastKnownModTime)
  62. , m_sourceControlInfo(other.m_sourceControlInfo)
  63. , m_bSourceControl_Ready(other.m_bSourceControl_Ready)
  64. , m_bSourceControl_BusyGettingStats(other.m_bSourceControl_BusyGettingStats)
  65. , m_bSourceControl_BusyRequestingEdit(other.m_bSourceControl_BusyRequestingEdit)
  66. , m_bSourceControl_CanWrite(other.m_bSourceControl_CanWrite)
  67. , m_bSourceControl_CanCheckOut(other.m_bSourceControl_CanCheckOut)
  68. , m_bDataIsLoaded(other.m_bDataIsLoaded)
  69. , m_bDataIsWritten(other.m_bDataIsWritten)
  70. , m_bCloseAfterSave(other.m_bCloseAfterSave)
  71. , m_bUntitledDocument(other.m_bUntitledDocument)
  72. , m_bIsModified(other.m_bIsModified)
  73. , m_bIsBeingSaved(other.m_bIsBeingSaved)
  74. , m_PresetLineAtOpen(other.m_PresetLineAtOpen)
  75. {}
  76. DocumentInfo& operator=(const DocumentInfo& other)
  77. {
  78. m_assetId = other.m_assetId;
  79. m_scriptAsset = other.m_scriptAsset;
  80. m_assetName = other.m_assetName;
  81. m_displayName = other.m_displayName;
  82. m_lastKnownModTime = other.m_lastKnownModTime;
  83. m_sourceControlInfo = other.m_sourceControlInfo;
  84. m_bSourceControl_Ready = other.m_bSourceControl_Ready;
  85. m_bSourceControl_BusyGettingStats = other.m_bSourceControl_BusyGettingStats;
  86. m_bSourceControl_BusyRequestingEdit = other.m_bSourceControl_BusyRequestingEdit;
  87. m_bSourceControl_CanWrite = other.m_bSourceControl_CanWrite;
  88. m_bSourceControl_CanCheckOut = other.m_bSourceControl_CanCheckOut;
  89. m_bDataIsLoaded = other.m_bDataIsLoaded;
  90. m_bDataIsWritten = other.m_bDataIsWritten;
  91. m_bCloseAfterSave = other.m_bCloseAfterSave;
  92. m_bUntitledDocument = other.m_bUntitledDocument;
  93. m_bIsModified = other.m_bIsModified;
  94. m_bIsBeingSaved = other.m_bIsBeingSaved;
  95. m_PresetLineAtOpen = other.m_PresetLineAtOpen;
  96. return *this;
  97. }
  98. };
  99. class ContextInterface
  100. : public LegacyFramework::EditorContextMessages
  101. {
  102. public:
  103. typedef AZ::EBus<ContextInterface> Bus;
  104. typedef Bus::Handler Handler;
  105. virtual void ShowLUAEditorView() = 0;
  106. };
  107. }
  108. #endif