From d59f40ff5dd1bc84ebc18360545b19fc269100c2 Mon Sep 17 00:00:00 2001 From: Florian Rival Date: Sun, 21 Apr 2019 19:40:05 +0100 Subject: [PATCH] [WIP] Clean old methods used only in GD4 in objects and behaviors (2) --- Core/GDCore/Events/Builtin/CommentEvent.cpp | 3 - Core/GDCore/Events/Builtin/ForEachEvent.cpp | 3 - Core/GDCore/Events/Builtin/GroupEvent.cpp | 3 - Core/GDCore/Events/Builtin/LinkEvent.cpp | 1 - Core/GDCore/Events/Builtin/RepeatEvent.cpp | 3 - Core/GDCore/Events/Builtin/StandardEvent.cpp | 4 - Core/GDCore/Events/Builtin/WhileEvent.cpp | 4 - Core/GDCore/Events/Event.h | 2 - .../Extensions/Metadata/BehaviorMetadata.cpp | 23 - .../Extensions/Metadata/BehaviorMetadata.h | 11 - .../Extensions/Metadata/EventMetadata.h | 10 - .../Metadata/ExpressionMetadata.cpp | 11 - .../Extensions/Metadata/ExpressionMetadata.h | 10 - .../Metadata/InstructionMetadata.cpp | 16 - .../Extensions/Metadata/InstructionMetadata.h | 13 - .../Extensions/Metadata/ObjectMetadata.cpp | 40 -- .../Extensions/Metadata/ObjectMetadata.h | 16 - .../EventsEditor/EventsEditorItemsAreas.cpp | 281 -------- .../EventsEditor/EventsEditorItemsAreas.h | 318 --------- .../EventsEditor/EventsEditorSelection.cpp | 369 ----------- .../EventsEditor/EventsEditorSelection.h | 249 ------- .../EventsEditor/EventsRenderingHelper.cpp | 626 ------------------ .../EventsEditor/EventsRenderingHelper.h | 275 -------- .../IDE/Project/ProjectResourcesCopier.cpp | 27 - Core/GDCore/Project/Project.cpp | 58 -- Core/GDCore/Tools/FileStream.h | 6 +- Core/GDCore/Tools/Localization.h | 17 +- Core/GDCore/Tools/Log.cpp | 40 +- Core/GDCore/Tools/Log.h | 14 +- .../ParticleSystem/ParticleEmitterObject.cpp | 11 + .../PrimitiveDrawing/ShapePainterObject.cpp | 8 - Extensions/SkeletonObject/SkeletonObject.h | 2 +- GDCpp/GDCpp/Events/Builtin/CppCodeEvent.cpp | 80 --- GDCpp/GDCpp/Events/Builtin/CppCodeEvent.h | 3 - GDCpp/GDCpp/Extensions/CppPlatform.h | 2 + GDCpp/GDCpp/IDE/BaseDebugger.cpp | 18 + GDCpp/GDCpp/IDE/BaseDebugger.h | 44 ++ GDCpp/GDCpp/IDE/BaseProfiler.cpp | 47 ++ GDCpp/GDCpp/IDE/BaseProfiler.h | 71 ++ GDCpp/GDCpp/Runtime/RuntimeScene.cpp | 3 - GDCpp/GDCpp/Runtime/RuntimeScene.h | 8 +- GDJS/GDJS/Events/Builtin/JsCodeEvent.cpp | 7 - Readme.md | 7 +- 43 files changed, 206 insertions(+), 2558 deletions(-) delete mode 100644 Core/GDCore/IDE/Dialogs/EventsEditor/EventsEditorItemsAreas.cpp delete mode 100644 Core/GDCore/IDE/Dialogs/EventsEditor/EventsEditorItemsAreas.h delete mode 100644 Core/GDCore/IDE/Dialogs/EventsEditor/EventsEditorSelection.cpp delete mode 100644 Core/GDCore/IDE/Dialogs/EventsEditor/EventsEditorSelection.h delete mode 100644 Core/GDCore/IDE/Dialogs/EventsEditor/EventsRenderingHelper.cpp delete mode 100644 Core/GDCore/IDE/Dialogs/EventsEditor/EventsRenderingHelper.h create mode 100644 GDCpp/GDCpp/IDE/BaseDebugger.cpp create mode 100644 GDCpp/GDCpp/IDE/BaseDebugger.h create mode 100644 GDCpp/GDCpp/IDE/BaseProfiler.cpp create mode 100644 GDCpp/GDCpp/IDE/BaseProfiler.h diff --git a/Core/GDCore/Events/Builtin/CommentEvent.cpp b/Core/GDCore/Events/Builtin/CommentEvent.cpp index 7fc9f3896d..a0663b47e1 100644 --- a/Core/GDCore/Events/Builtin/CommentEvent.cpp +++ b/Core/GDCore/Events/Builtin/CommentEvent.cpp @@ -6,9 +6,6 @@ #include "CommentEvent.h" #include "GDCore/CommonTools.h" -#include "GDCore/IDE/Dialogs/EventsEditor/EventsEditorItemsAreas.h" -#include "GDCore/IDE/Dialogs/EventsEditor/EventsEditorSelection.h" -#include "GDCore/IDE/Dialogs/EventsEditor/EventsRenderingHelper.h" #include "GDCore/Serialization/SerializerElement.h" using namespace std; diff --git a/Core/GDCore/Events/Builtin/ForEachEvent.cpp b/Core/GDCore/Events/Builtin/ForEachEvent.cpp index b4afb3d04c..61f0a4cd2b 100644 --- a/Core/GDCore/Events/Builtin/ForEachEvent.cpp +++ b/Core/GDCore/Events/Builtin/ForEachEvent.cpp @@ -11,9 +11,6 @@ #include "GDCore/Events/CodeGeneration/ExpressionsCodeGeneration.h" #include "GDCore/Events/Serialization.h" #include "GDCore/Events/Tools/EventsCodeNameMangler.h" -#include "GDCore/IDE/Dialogs/EventsEditor/EventsEditorItemsAreas.h" -#include "GDCore/IDE/Dialogs/EventsEditor/EventsEditorSelection.h" -#include "GDCore/IDE/Dialogs/EventsEditor/EventsRenderingHelper.h" #include "GDCore/Serialization/SerializerElement.h" #include "GDCore/TinyXml/tinyxml.h" diff --git a/Core/GDCore/Events/Builtin/GroupEvent.cpp b/Core/GDCore/Events/Builtin/GroupEvent.cpp index 93691e2f6a..18aea7d823 100644 --- a/Core/GDCore/Events/Builtin/GroupEvent.cpp +++ b/Core/GDCore/Events/Builtin/GroupEvent.cpp @@ -13,9 +13,6 @@ #include "GDCore/Events/CodeGeneration/EventsCodeGenerationContext.h" #include "GDCore/Events/CodeGeneration/EventsCodeGenerator.h" #include "GDCore/Events/Serialization.h" -#include "GDCore/IDE/Dialogs/EventsEditor/EventsEditorItemsAreas.h" -#include "GDCore/IDE/Dialogs/EventsEditor/EventsEditorSelection.h" -#include "GDCore/IDE/Dialogs/EventsEditor/EventsRenderingHelper.h" #include "GDCore/Serialization/SerializerElement.h" #include "GDCore/TinyXml/tinyxml.h" diff --git a/Core/GDCore/Events/Builtin/LinkEvent.cpp b/Core/GDCore/Events/Builtin/LinkEvent.cpp index 9deb790007..a3c99c2c88 100644 --- a/Core/GDCore/Events/Builtin/LinkEvent.cpp +++ b/Core/GDCore/Events/Builtin/LinkEvent.cpp @@ -11,7 +11,6 @@ #include "GDCore/Events/CodeGeneration/EventsCodeGenerationContext.h" #include "GDCore/Events/CodeGeneration/EventsCodeGenerator.h" #include "GDCore/Events/Tools/EventsCodeNameMangler.h" -#include "GDCore/IDE/Dialogs/EventsEditor/EventsRenderingHelper.h" #include "GDCore/Project/ExternalEvents.h" #include "GDCore/Project/Layout.h" #include "GDCore/Project/Object.h" diff --git a/Core/GDCore/Events/Builtin/RepeatEvent.cpp b/Core/GDCore/Events/Builtin/RepeatEvent.cpp index 4aac0620ff..332237be9c 100644 --- a/Core/GDCore/Events/Builtin/RepeatEvent.cpp +++ b/Core/GDCore/Events/Builtin/RepeatEvent.cpp @@ -9,9 +9,6 @@ #include "GDCore/Events/CodeGeneration/EventsCodeGenerator.h" #include "GDCore/Events/CodeGeneration/ExpressionsCodeGeneration.h" #include "GDCore/Events/Serialization.h" -#include "GDCore/IDE/Dialogs/EventsEditor/EventsEditorItemsAreas.h" -#include "GDCore/IDE/Dialogs/EventsEditor/EventsEditorSelection.h" -#include "GDCore/IDE/Dialogs/EventsEditor/EventsRenderingHelper.h" #include "GDCore/Serialization/SerializerElement.h" using namespace std; diff --git a/Core/GDCore/Events/Builtin/StandardEvent.cpp b/Core/GDCore/Events/Builtin/StandardEvent.cpp index 790c4c0d2e..0428ec7e9e 100644 --- a/Core/GDCore/Events/Builtin/StandardEvent.cpp +++ b/Core/GDCore/Events/Builtin/StandardEvent.cpp @@ -9,11 +9,7 @@ #include "GDCore/Events/CodeGeneration/EventsCodeGenerationContext.h" #include "GDCore/Events/CodeGeneration/EventsCodeGenerator.h" #include "GDCore/Events/Serialization.h" -#include "GDCore/IDE/Dialogs/EventsEditor/EventsEditorItemsAreas.h" -#include "GDCore/IDE/Dialogs/EventsEditor/EventsEditorSelection.h" -#include "GDCore/IDE/Dialogs/EventsEditor/EventsRenderingHelper.h" #include "GDCore/Serialization/SerializerElement.h" -#include "GDCore/TinyXml/tinyxml.h" using namespace std; diff --git a/Core/GDCore/Events/Builtin/WhileEvent.cpp b/Core/GDCore/Events/Builtin/WhileEvent.cpp index 1958d351b5..bb2cbc1895 100644 --- a/Core/GDCore/Events/Builtin/WhileEvent.cpp +++ b/Core/GDCore/Events/Builtin/WhileEvent.cpp @@ -10,11 +10,7 @@ #include "GDCore/Events/CodeGeneration/EventsCodeGenerator.h" #include "GDCore/Events/CodeGeneration/ExpressionsCodeGeneration.h" #include "GDCore/Events/Serialization.h" -#include "GDCore/IDE/Dialogs/EventsEditor/EventsEditorItemsAreas.h" -#include "GDCore/IDE/Dialogs/EventsEditor/EventsEditorSelection.h" -#include "GDCore/IDE/Dialogs/EventsEditor/EventsRenderingHelper.h" #include "GDCore/Serialization/SerializerElement.h" -#include "GDCore/TinyXml/tinyxml.h" using namespace std; diff --git a/Core/GDCore/Events/Event.h b/Core/GDCore/Events/Event.h index 5b1ddee3e6..2912982a07 100644 --- a/Core/GDCore/Events/Event.h +++ b/Core/GDCore/Events/Event.h @@ -21,8 +21,6 @@ class Layout; class EventsCodeGenerator; class EventsCodeGenerationContext; class Platform; -class EventsEditorItemsAreas; -class EventsEditorSelection; class SerializerElement; class Instruction; } diff --git a/Core/GDCore/Extensions/Metadata/BehaviorMetadata.cpp b/Core/GDCore/Extensions/Metadata/BehaviorMetadata.cpp index 04c331986b..ce19f10d15 100644 --- a/Core/GDCore/Extensions/Metadata/BehaviorMetadata.cpp +++ b/Core/GDCore/Extensions/Metadata/BehaviorMetadata.cpp @@ -10,11 +10,6 @@ #include "GDCore/Extensions/Metadata/InstructionMetadata.h" #include "GDCore/Project/Behavior.h" #include "GDCore/Project/BehaviorsSharedData.h" -#if defined(GD_IDE_ONLY) && !defined(GD_NO_WX_GUI) -#include -#include -#include "GDCore/IDE/wxTools/SkinHelper.h" -#endif namespace gd { @@ -39,18 +34,6 @@ BehaviorMetadata::BehaviorMetadata( SetGroup(group_); className = className_; iconFilename = icon24x24; -#if !defined(GD_NO_WX_GUI) - if (gd::SkinHelper::IconExists(iconFilename, 24)) - SetBitmapIcon(gd::SkinHelper::GetIcon(iconFilename, 24)); - else if (wxFile::Exists(iconFilename)) - SetBitmapIcon(wxBitmap(iconFilename, wxBITMAP_TYPE_ANY)); - else { - std::cout << "Warning: The icon file for behavior \"" << name_ - << " was not found in the current skin icons" - << " and the specified name is not an existing filename."; - SetBitmapIcon(wxBitmap(24, 24)); - } -#endif #endif if (instance) instance->SetTypeName(name_); @@ -161,12 +144,6 @@ BehaviorMetadata& BehaviorMetadata::SetGroup(const gd::String& group_) { #endif return *this; } -BehaviorMetadata& BehaviorMetadata::SetBitmapIcon(const wxBitmap& bitmap_) { -#if defined(GD_IDE_ONLY) && !defined(GD_NO_WX_GUI) - icon = bitmap_; -#endif - return *this; -} BehaviorMetadata& BehaviorMetadata::SetIncludeFile( const gd::String& includeFile) { #if defined(GD_IDE_ONLY) diff --git a/Core/GDCore/Extensions/Metadata/BehaviorMetadata.h b/Core/GDCore/Extensions/Metadata/BehaviorMetadata.h index 2f27478573..e7beaf00bf 100644 --- a/Core/GDCore/Extensions/Metadata/BehaviorMetadata.h +++ b/Core/GDCore/Extensions/Metadata/BehaviorMetadata.h @@ -9,16 +9,12 @@ #include "GDCore/Extensions/Metadata/ExpressionMetadata.h" #include "GDCore/Extensions/Metadata/InstructionMetadata.h" #include "GDCore/String.h" -#if defined(GD_IDE_ONLY) && !defined(GD_NO_WX_GUI) -#include -#endif namespace gd { class Behavior; class BehaviorsSharedData; class InstructionMetadata; class ExpressionMetadata; } // namespace gd -class wxBitmap; namespace gd { @@ -90,7 +86,6 @@ class GD_CORE_API BehaviorMetadata { BehaviorMetadata& SetDefaultName(const gd::String& defaultName_); BehaviorMetadata& SetDescription(const gd::String& description_); BehaviorMetadata& SetGroup(const gd::String& group_); - BehaviorMetadata& SetBitmapIcon(const wxBitmap& bitmap_); /** * \brief Erase any existing include file and add the specified include. @@ -126,9 +121,6 @@ class GD_CORE_API BehaviorMetadata { const gd::String& GetDescription() const { return description; } const gd::String& GetGroup() const { return group; } const gd::String& GetIconFilename() const { return iconFilename; } -#if !defined(GD_NO_WX_GUI) - const wxBitmap& GetBitmapIcon() const { return icon; } -#endif #endif std::shared_ptr Get() const { return instance; } std::shared_ptr GetSharedDataInstance() const { @@ -153,9 +145,6 @@ class GD_CORE_API BehaviorMetadata { gd::String description; gd::String group; gd::String iconFilename; -#if !defined(GD_NO_WX_GUI) - wxBitmap icon; -#endif #endif std::shared_ptr instance; diff --git a/Core/GDCore/Extensions/Metadata/EventMetadata.h b/Core/GDCore/Extensions/Metadata/EventMetadata.h index 955e29bf1e..2aee848b9b 100644 --- a/Core/GDCore/Extensions/Metadata/EventMetadata.h +++ b/Core/GDCore/Extensions/Metadata/EventMetadata.h @@ -11,10 +11,6 @@ #include #include #include "GDCore/String.h" -#if !defined(GD_NO_WX_GUI) -#include -#endif -class wxBitmap; namespace gd { class EventsList; class BaseEvent; @@ -81,16 +77,10 @@ class GD_CORE_API EventMetadata { const gd::String& GetFullName() const { return fullname; } const gd::String& GetDescription() const { return description; } const gd::String& GetGroup() const { return group; } -#if !defined(GD_NO_WX_GUI) - const wxBitmap& GetBitmapIcon() const { return smallicon; } -#endif gd::String fullname; gd::String description; gd::String group; -#if !defined(GD_NO_WX_GUI) - wxBitmap smallicon; -#endif std::shared_ptr instance; bool hasCustomCodeGenerator; diff --git a/Core/GDCore/Extensions/Metadata/ExpressionMetadata.cpp b/Core/GDCore/Extensions/Metadata/ExpressionMetadata.cpp index 9f5d747a1c..d90d182202 100644 --- a/Core/GDCore/Extensions/Metadata/ExpressionMetadata.cpp +++ b/Core/GDCore/Extensions/Metadata/ExpressionMetadata.cpp @@ -6,10 +6,6 @@ #include "ExpressionMetadata.h" #include "GDCore/CommonTools.h" #include "GDCore/String.h" -#if !defined(GD_NO_WX_GUI) -#include -#include -#endif namespace gd { @@ -25,13 +21,6 @@ ExpressionMetadata::ExpressionMetadata(const gd::String& extensionNamespace_, shown(true), smallIconFilename(smallicon_), extensionNamespace(extensionNamespace_) { -#if !defined(GD_NO_WX_GUI) - if (wxFile::Exists(smallicon_)) { - smallicon = wxBitmap(smallicon_, wxBITMAP_TYPE_ANY); - } else { - smallicon = wxBitmap(16, 16); - } -#endif } ExpressionMetadata& ExpressionMetadata::SetHidden() { diff --git a/Core/GDCore/Extensions/Metadata/ExpressionMetadata.h b/Core/GDCore/Extensions/Metadata/ExpressionMetadata.h index 494378f6dc..f7a4da7aac 100644 --- a/Core/GDCore/Extensions/Metadata/ExpressionMetadata.h +++ b/Core/GDCore/Extensions/Metadata/ExpressionMetadata.h @@ -11,10 +11,6 @@ #include "GDCore/Events/Instruction.h" #include "GDCore/Extensions/Metadata/InstructionMetadata.h" #include "GDCore/String.h" -#if !defined(GD_NO_WX_GUI) -#include -#endif -class wxBitmap; namespace gd { class Layout; } @@ -200,9 +196,6 @@ class GD_CORE_API ExpressionMetadata { const gd::String& GetDescription() const { return description; } const gd::String& GetGroup() const { return group; } const gd::String& GetSmallIconFilename() const { return smallIconFilename; } -#if !defined(GD_NO_WX_GUI) - const wxBitmap& GetBitmapIcon() const { return smallicon; } -#endif const gd::ParameterMetadata& GetParameter(std::size_t id) const { return parameters[id]; }; @@ -220,9 +213,6 @@ class GD_CORE_API ExpressionMetadata { gd::String group; bool shown; -#if !defined(GD_NO_WX_GUI) - wxBitmap smallicon; -#endif gd::String smallIconFilename; gd::String extensionNamespace; }; diff --git a/Core/GDCore/Extensions/Metadata/InstructionMetadata.cpp b/Core/GDCore/Extensions/Metadata/InstructionMetadata.cpp index 7127d30ee1..faf6481708 100644 --- a/Core/GDCore/Extensions/Metadata/InstructionMetadata.cpp +++ b/Core/GDCore/Extensions/Metadata/InstructionMetadata.cpp @@ -3,10 +3,6 @@ * Copyright 2008-2016 Florian Rival (Florian.Rival@gmail.com). All rights * reserved. This project is released under the MIT License. */ -#if !defined(GD_NO_WX_GUI) -#include -#include -#endif #include #include "GDCore/CommonTools.h" #include "GDCore/Serialization/SerializerElement.h" @@ -42,18 +38,6 @@ InstructionMetadata::InstructionMetadata(const gd::String& extensionNamespace_, extensionNamespace(extensionNamespace_), hidden(false), usageComplexity(5) { -#if !defined(GD_NO_WX_GUI) - if (wxFile::Exists(icon_)) { - icon = wxBitmap(icon_, wxBITMAP_TYPE_ANY); - } else { - icon = wxBitmap(24, 24); - } - if (wxFile::Exists(smallIcon_)) { - smallicon = wxBitmap(smallIcon_, wxBITMAP_TYPE_ANY); - } else { - smallicon = wxBitmap(16, 16); - } -#endif } ParameterMetadata::ParameterMetadata() : optional(false), codeOnly(false) {} diff --git a/Core/GDCore/Extensions/Metadata/InstructionMetadata.h b/Core/GDCore/Extensions/Metadata/InstructionMetadata.h index 73bebf2b2d..63a166d4b4 100644 --- a/Core/GDCore/Extensions/Metadata/InstructionMetadata.h +++ b/Core/GDCore/Extensions/Metadata/InstructionMetadata.h @@ -12,11 +12,6 @@ #include #include "GDCore/Events/Instruction.h" #include "GDCore/String.h" -#if !defined(GD_NO_WX_GUI) -#include -#endif -#include "GDCore/String.h" -class wxBitmap; namespace gd { class Project; class Layout; @@ -246,10 +241,6 @@ class GD_CORE_API InstructionMetadata { const std::vector &GetParameters() const { return parameters; } -#if !defined(GD_NO_WX_GUI) - const wxBitmap &GetBitmapIcon() const { return icon; } - const wxBitmap &GetSmallBitmapIcon() const { return smallicon; } -#endif const gd::String &GetIconFilename() const { return iconFilename; } const gd::String &GetSmallIconFilename() const { return smallIconFilename; } bool CanHaveSubInstructions() const { return canHaveSubInstructions; } @@ -536,10 +527,6 @@ class GD_CORE_API InstructionMetadata { gd::String helpPath; gd::String sentence; gd::String group; -#if !defined(GD_NO_WX_GUI) - wxBitmap icon; - wxBitmap smallicon; -#endif gd::String iconFilename; gd::String smallIconFilename; bool canHaveSubInstructions; diff --git a/Core/GDCore/Extensions/Metadata/ObjectMetadata.cpp b/Core/GDCore/Extensions/Metadata/ObjectMetadata.cpp index 0336a68713..70651aed7b 100644 --- a/Core/GDCore/Extensions/Metadata/ObjectMetadata.cpp +++ b/Core/GDCore/Extensions/Metadata/ObjectMetadata.cpp @@ -9,11 +9,6 @@ #include "GDCore/Extensions/Metadata/ExpressionMetadata.h" #include "GDCore/Extensions/Metadata/InstructionMetadata.h" #include "GDCore/Project/Object.h" -#if defined(GD_IDE_ONLY) && !defined(GD_NO_WX_GUI) -#include -#include -#include "GDCore/IDE/wxTools/SkinHelper.h" -#endif namespace gd { @@ -30,20 +25,6 @@ ObjectMetadata::ObjectMetadata(const gd::String& extensionNamespace_, SetFullName(gd::String(fullname_)); SetDescription(gd::String(description_)); iconFilename = icon24x24; -#if !defined(GD_NO_WX_GUI) - if (!iconFilename.empty()) { - if (gd::SkinHelper::IconExists(icon24x24, 24)) - SetBitmapIcon(gd::SkinHelper::GetIcon(icon24x24, 24)); - else if (wxFile::Exists(icon24x24)) - SetBitmapIcon(wxBitmap(icon24x24, wxBITMAP_TYPE_ANY)); - else { - std::cout << "Warning: The icon file for object \"" << name_ - << " was not found in the current skin icons" - << " and the specified name is not an existing filename."; - SetBitmapIcon(wxBitmap(24, 24)); - } - } -#endif #endif createFunPtr = [blueprintObject_](gd::String name) -> std::unique_ptr { @@ -73,20 +54,6 @@ ObjectMetadata::ObjectMetadata(const gd::String& extensionNamespace_, SetFullName(gd::String(fullname_)); SetDescription(gd::String(description_)); iconFilename = icon24x24; -#if !defined(GD_NO_WX_GUI) - if (!iconFilename.empty()) { - if (gd::SkinHelper::IconExists(icon24x24, 24)) - SetBitmapIcon(gd::SkinHelper::GetIcon(icon24x24, 24)); - else if (wxFile::Exists(icon24x24)) - SetBitmapIcon(wxBitmap(icon24x24, wxBITMAP_TYPE_ANY)); - else { - std::cout << "Warning: The icon file for object \"" << name_ - << " was not found in the current skin icons" - << " and the specified name is not an existing filename."; - SetBitmapIcon(wxBitmap(24, 24)); - } - } -#endif #endif createFunPtr = createFunPtrP; } @@ -190,13 +157,6 @@ ObjectMetadata& ObjectMetadata::SetDescription(const gd::String& description_) { return *this; } -ObjectMetadata& ObjectMetadata::SetBitmapIcon(const wxBitmap& bitmap_) { -#if defined(GD_IDE_ONLY) && !defined(GD_NO_WX_GUI) - icon = bitmap_; -#endif - return *this; -} - ObjectMetadata& ObjectMetadata::SetIncludeFile(const gd::String& includeFile) { #if defined(GD_IDE_ONLY) includeFiles.clear(); diff --git a/Core/GDCore/Extensions/Metadata/ObjectMetadata.h b/Core/GDCore/Extensions/Metadata/ObjectMetadata.h index 7ab6280f9d..8fd20ae981 100644 --- a/Core/GDCore/Extensions/Metadata/ObjectMetadata.h +++ b/Core/GDCore/Extensions/Metadata/ObjectMetadata.h @@ -12,14 +12,10 @@ #include "GDCore/Extensions/Metadata/InstructionMetadata.h" #include "GDCore/Project/Object.h" #include "GDCore/String.h" -#if defined(GD_IDE_ONLY) && !defined(GD_NO_WX_GUI) -#include -#endif namespace gd { class InstructionMetadata; class ExpressionMetadata; } // namespace gd -class wxBitmap; typedef std::function(gd::String name)> CreateFunPtr; @@ -111,12 +107,6 @@ class GD_CORE_API ObjectMetadata { */ ObjectMetadata& SetDescription(const gd::String& description_); - /** - * Set the bitmap icon shown to the user. - * \note This method does nothing when used for GD C++ runtime. - */ - ObjectMetadata& SetBitmapIcon(const wxBitmap& bitmap_); - /** * Get the help path of the object, relative to the documentation root. */ @@ -139,9 +129,6 @@ class GD_CORE_API ObjectMetadata { const gd::String& GetHelpUrl() const { return helpUrl; } const gd::String& GetDescription() const { return description; } const gd::String& GetIconFilename() const { return iconFilename; } -#if !defined(GD_NO_WX_GUI) - const wxBitmap& GetBitmapIcon() const { return icon; } -#endif #endif /** @@ -183,9 +170,6 @@ class GD_CORE_API ObjectMetadata { gd::String fullname; gd::String description; gd::String iconFilename; -#if !defined(GD_NO_WX_GUI) - wxBitmap icon; -#endif #endif std::shared_ptr blueprintObject; ///< The "blueprint" object to be copied when a new diff --git a/Core/GDCore/IDE/Dialogs/EventsEditor/EventsEditorItemsAreas.cpp b/Core/GDCore/IDE/Dialogs/EventsEditor/EventsEditorItemsAreas.cpp deleted file mode 100644 index 015e7b7c14..0000000000 --- a/Core/GDCore/IDE/Dialogs/EventsEditor/EventsEditorItemsAreas.cpp +++ /dev/null @@ -1,281 +0,0 @@ -/* - * GDevelop Core - * Copyright 2008-2016 Florian Rival (Florian.Rival@gmail.com). All rights - * reserved. This project is released under the MIT License. - */ -#if defined(GD_IDE_ONLY) && !defined(GD_NO_WX_GUI) - -#include "EventsEditorItemsAreas.h" -#include -#include -#include -#include "GDCore/Events/Event.h" - -namespace gd { - -bool EventsEditorItemsAreas::IsOnEvent(int x, int y) { - for (std::size_t i = 0; i < eventsAreas.size(); ++i) { - if (eventsAreas[i].first.Contains(x, y)) return true; - } - - return false; -} - -EventItem EventsEditorItemsAreas::GetEventAt(int x, int y) { - for (std::size_t i = 0; i < eventsAreas.size(); ++i) { - if (eventsAreas[i].first.Contains(x, y)) return eventsAreas[i].second; - } - - std::cout << "WARNING, RETURNING DUMMY EVENT"; - - EventItem dummy; - return dummy; -} -wxRect EventsEditorItemsAreas::GetAreaOfEventAt(int x, int y) { - for (std::size_t i = 0; i < eventsAreas.size(); ++i) { - if (eventsAreas[i].first.Contains(x, y)) return eventsAreas[i].first; - } - - std::cout << "WARNING, RETURNING DUMMY EVENT rect"; - - wxRect dummy; - return dummy; -} - -bool EventsEditorItemsAreas::IsOnInstruction(int x, int y) { - for (std::size_t i = 0; i < instructionsAreas.size(); ++i) { - if (instructionsAreas[i].first.Contains(x, y)) return true; - } - - return false; -} - -InstructionItem EventsEditorItemsAreas::GetInstructionAt(int x, int y) { - for (std::size_t i = 0; i < instructionsAreas.size(); ++i) { - if (instructionsAreas[i].first.Contains(x, y)) - return instructionsAreas[i].second; - } - - std::cout << "WARNING, RETURNING DUMMY Instruction"; - - gd::InstructionItem dummy; - return dummy; -} - -wxRect EventsEditorItemsAreas::GetAreaOfInstructionAt(int x, int y) { - for (std::size_t i = 0; i < instructionsAreas.size(); ++i) { - if (instructionsAreas[i].first.Contains(x, y)) - return instructionsAreas[i].first; - } - - std::cout << "WARNING, RETURNING DUMMY Instruction area"; - - wxRect dummy; - return dummy; -} - -bool EventsEditorItemsAreas::IsOnInstructionList(int x, int y) { - for (std::size_t i = 0; i < instructionListsAreas.size(); ++i) { - if (instructionListsAreas[i].first.Contains(x, y)) return true; - } - - return false; -} - -InstructionListItem EventsEditorItemsAreas::GetInstructionListAt(int x, int y) { - wxRect rect; - InstructionListItem instructionList; - for (std::size_t i = 0; i < instructionListsAreas.size(); ++i) { - if (instructionListsAreas[i].first.Contains(x, y)) { - if ((instructionListsAreas[i].first.width * - instructionListsAreas[i].first.height < - rect.width * rect.height) || - rect.width == 0) { - rect = instructionListsAreas[i].first; - instructionList = instructionListsAreas[i].second; - } - } - } - - if (rect.width == 0) - std::cout << "WARNING, RETURNING DUMMY InstructionListItem"; - - return instructionList; -} - -wxRect EventsEditorItemsAreas::GetAreaOfInstructionListAt(int x, int y) { - wxRect rect; - for (std::size_t i = 0; i < instructionListsAreas.size(); ++i) { - if (instructionListsAreas[i].first.Contains(x, y)) { - if ((instructionListsAreas[i].first.width * - instructionListsAreas[i].first.height < - rect.width * rect.height) || - rect.width == 0) - rect = instructionListsAreas[i].first; - } - } - - if (rect.width == 0) - std::cout << "WARNING, RETURNING DUMMY InstructionListItem Rect"; - - return rect; -} - -bool EventsEditorItemsAreas::IsOnParameter(int x, int y) { - for (std::size_t i = 0; i < parametersAreas.size(); ++i) { - if (parametersAreas[i].first.Contains(x, y)) return true; - } - - return false; -} - -ParameterItem EventsEditorItemsAreas::GetParameterAt(int x, int y) { - for (std::size_t i = 0; i < parametersAreas.size(); ++i) { - if (parametersAreas[i].first.Contains(x, y)) - return parametersAreas[i].second; - } - - std::cout << "WARNING, RETURNING DUMMY Parameter"; - - ParameterItem dummy; - return dummy; -} - -wxRect EventsEditorItemsAreas::GetAreaOfParameterAt(int x, int y) { - for (std::size_t i = 0; i < parametersAreas.size(); ++i) { - if (parametersAreas[i].first.Contains(x, y)) - return parametersAreas[i].first; - } - - std::cout << "WARNING, RETURNING DUMMY Parameter Rect"; - - wxRect dummy; - return dummy; -} - -bool EventsEditorItemsAreas::IsOnFoldingItem(int x, int y) { - for (std::size_t i = 0; i < foldingAreas.size(); ++i) { - if (foldingAreas[i].first.Contains(x, y)) return true; - } - - return false; -} - -FoldingItem EventsEditorItemsAreas::GetFoldingItemAt(int x, int y) { - for (std::size_t i = 0; i < foldingAreas.size(); ++i) { - if (foldingAreas[i].first.Contains(x, y)) return foldingAreas[i].second; - } - - std::cout << "WARNING, RETURNING DUMMY FoldingItem"; - - FoldingItem dummy; - return dummy; -} - -void EventsEditorItemsAreas::Clear() { - eventsAreas.clear(); - instructionsAreas.clear(); - instructionListsAreas.clear(); - parametersAreas.clear(); - foldingAreas.clear(); -} - -void EventsEditorItemsAreas::AddInstructionArea( - wxRect area, gd::InstructionItem& instruction) { - instructionsAreas.push_back(std::make_pair(area, instruction)); -} - -void EventsEditorItemsAreas::AddParameterArea(wxRect area, - ParameterItem& parameter) { - parametersAreas.push_back(std::make_pair(area, parameter)); -} - -void EventsEditorItemsAreas::AddEventArea(wxRect area, gd::EventItem& event) { - eventsAreas.push_back(std::make_pair(area, event)); -} - -void EventsEditorItemsAreas::AddFoldingItem(wxRect area, FoldingItem& item) { - foldingAreas.push_back(std::make_pair(area, item)); -} - -void EventsEditorItemsAreas::AddInstructionListArea(wxRect area, - InstructionListItem& item) { - instructionListsAreas.push_back(std::make_pair(area, item)); -} - -// EventItem stuff : -bool EventItem::operator==(const gd::EventItem& other) const { - return (event == other.event && eventsList == other.eventsList && - positionInList == other.positionInList); -} - -EventItem::EventItem(std::shared_ptr event_, - gd::EventsList* eventsList_, - std::size_t positionInList_) - : event(event_), eventsList(eventsList_), positionInList(positionInList_) {} - -EventItem::EventItem() : eventsList(NULL), positionInList(0) {} - -// InstructionItem stuff : -bool gd::InstructionItem::operator==(const gd::InstructionItem& other) const { - return (instruction == other.instruction && - isCondition == other.isCondition && - instructionList == other.instructionList && - positionInList == other.positionInList && event == other.event); -} - -InstructionItem::InstructionItem(gd::Instruction* instruction_, - bool isCondition_, - gd::InstructionsList* instructionList_, - std::size_t positionInList_, - gd::BaseEvent* event_) - : instruction(instruction_), - isCondition(isCondition_), - instructionList(instructionList_), - positionInList(positionInList_), - event(event_) {} - -InstructionItem::InstructionItem() - : instruction(NULL), - isCondition(true), - instructionList(NULL), - positionInList(0), - event(NULL) {} - -// InstructionListItem stuff : -bool InstructionListItem::operator==(const InstructionListItem& other) const { - return (isConditionList == other.isConditionList && - instructionList == other.instructionList && event == other.event); -} - -InstructionListItem::InstructionListItem(bool isCondition_, - gd::InstructionsList* instructionList_, - gd::BaseEvent* event_) - : isConditionList(isCondition_), - instructionList(instructionList_), - event(event_) {} - -InstructionListItem::InstructionListItem() - : isConditionList(true), instructionList(NULL), event(NULL) {} -// ParameterItem stuff : -bool ParameterItem::operator==(const ParameterItem& other) const { - return (parameter == other.parameter && event == other.event); -} - -ParameterItem::ParameterItem(gd::Expression* parameter_, gd::BaseEvent* event_) - : parameter(parameter_), event(event_) {} - -ParameterItem::ParameterItem() : parameter(NULL), event(NULL) {} - -// FoldingItem stuff : -bool FoldingItem::operator==(const FoldingItem& other) const { - return (event == other.event); -} - -FoldingItem::FoldingItem(gd::BaseEvent* event_) : event(event_) {} - -FoldingItem::FoldingItem() : event(NULL) {} - -} // namespace gd - -#endif diff --git a/Core/GDCore/IDE/Dialogs/EventsEditor/EventsEditorItemsAreas.h b/Core/GDCore/IDE/Dialogs/EventsEditor/EventsEditorItemsAreas.h deleted file mode 100644 index b77c80da8a..0000000000 --- a/Core/GDCore/IDE/Dialogs/EventsEditor/EventsEditorItemsAreas.h +++ /dev/null @@ -1,318 +0,0 @@ -/* - * GDevelop Core - * Copyright 2008-2016 Florian Rival (Florian.Rival@gmail.com). All rights - * reserved. This project is released under the MIT License. - */ - -#if defined(GD_IDE_ONLY) && !defined(GD_NO_WX_GUI) -#ifndef EVENTSEDITORITEMSAREAS_H -#define EVENTSEDITORITEMSAREAS_H -#include -#include -#include -#include -#include -#include -#include "GDCore/Events/InstructionsList.h" -namespace gd { -class EventsList; -} -namespace gd { -class BaseEvent; -} -namespace gd { -class Instruction; -} -namespace gd { -class Expression; -} - -namespace gd { - -/** - * \brief Tool class to store information about an event. - * - * Used by events editor to indicate to EventsEditorItemsAreas that an event is - * displayed somewhere. \ingroup IDEDialogsEventsEditor - */ -class GD_CORE_API EventItem { - public: - EventItem(std::shared_ptr event_, - gd::EventsList* eventsList_, - std::size_t positionInList_); - EventItem(); - ~EventItem(){}; - - bool operator==(const gd::EventItem& other) const; - - std::shared_ptr event; - gd::EventsList* eventsList; - std::size_t positionInList; -}; - -/** - * \brief Used to indicate to EventsEditorItemsAreas that an instruction is - * displayed somewhere \ingroup IDEDialogsEventsEditor - */ -class GD_CORE_API InstructionItem { - public: - /** - * Use this constructor to declare the instruction, the list it belongs to and - * its position in this list. - */ - InstructionItem(gd::Instruction* instruction_, - bool isCondition, - gd::InstructionsList* instructionList_, - std::size_t positionInList_, - gd::BaseEvent* event); - InstructionItem(); - ~InstructionItem(){}; - - bool operator==(const gd::InstructionItem& other) const; - - gd::Instruction* instruction; - bool isCondition; - gd::InstructionsList* instructionList; - std::size_t positionInList; - gd::BaseEvent* event; -}; - -/** - * \brief Used to indicate to EventsEditorItemsAreas that an instruction list is - * displayed somewhere \ingroup IDEDialogsEventsEditor - */ -class GD_CORE_API InstructionListItem { - public: - /** - * Use this constructor to declare the instruction, the list it belongs to and - * its position in this list. - */ - InstructionListItem(bool isConditionList, - gd::InstructionsList* instructionList_, - gd::BaseEvent* event); - InstructionListItem(); - ~InstructionListItem(){}; - - bool operator==(const InstructionListItem& other) const; - - bool isConditionList; - gd::InstructionsList* instructionList; - gd::BaseEvent* event; -}; - -/** - * \brief Used to indicate to EventsEditorItemsAreas that a parameter is - * displayed somewhere \ingroup IDEDialogsEventsEditor - */ -class GD_CORE_API ParameterItem { - public: - ParameterItem(gd::Expression* parameter_, gd::BaseEvent* event); - ParameterItem(); - ~ParameterItem(){}; - - bool operator==(const ParameterItem& other) const; - - gd::Expression* parameter; - gd::BaseEvent* event; -}; - -/** - * \brief Used to indicate to EventsEditorItemsAreas that a fold/unfold button - * is displayed somewhere \ingroup IDEDialogsEventsEditor - */ -class GD_CORE_API FoldingItem { - public: - FoldingItem(gd::BaseEvent* event); - FoldingItem(); - ~FoldingItem(){}; - - bool operator==(const FoldingItem& other) const; - - gd::BaseEvent* event; -}; - -/** - * \brief Allow events to indicate where is displayed an instruction or - * parameter. - * - * Events editor also uses this internally to indicate where events are - * displayed. \ingroup IDEDialogsEventsEditor - */ -class GD_CORE_API EventsEditorItemsAreas { - public: - /** - * \brief Notify the editor there is an instruction in this area - */ - void AddInstructionArea(wxRect area, gd::InstructionItem& instruction); - - /** - * \brief Notify the editor there is a parameter in this area - */ - void AddParameterArea(wxRect area, ParameterItem& parameter); - - /** - * \brief Notify the editor there is an event in this area - */ - void AddEventArea(wxRect area, gd::EventItem& event); - - /** - * \brief Notify the editor there is a folding button in this area - */ - void AddFoldingItem(wxRect area, FoldingItem& event); - - /** - * \brief Notify the editor there is a list in this area - */ - void AddInstructionListArea(wxRect area, InstructionListItem& item); - - /** - * \brief True if a point is on an event. - */ - bool IsOnEvent(int x, int y); - - /** - * \brief Return event at point (x,y). Be sure there is an event here using - * IsOnEvent(x,y); - */ - EventItem GetEventAt(int x, int y); - - /** - * \brief Return the rectangle used by the event at point(x,y). - */ - wxRect GetAreaOfEventAt(int x, int y); - - /** - * \brief True if a point is on an instruction. - */ - bool IsOnInstruction(int x, int y); - - /** - * \brief Return event at point (x,y). Be sure there is an event here using - * IsOnInstruction(x,y); - */ - gd::InstructionItem GetInstructionAt(int x, int y); - - /** - * \brief True if a point is on an instruction list. - */ - bool IsOnInstructionList(int x, int y); - - /** - * \brief Return event at point (x,y). Be sure there is an event here using - * IsOnEvent(x,y); - */ - InstructionListItem GetInstructionListAt(int x, int y); - - /** - * \brief Return the rectangle used by the instruction at point(x,y). - */ - wxRect GetAreaOfInstructionAt(int x, int y); - - /** - * \brief Return the rectangle used by the list at point(x,y). - */ - wxRect GetAreaOfInstructionListAt(int x, int y); - - /** - * \brief True if a point is on an event. - */ - bool IsOnParameter(int x, int y); - - /** - * \brief Return event at point (x,y). Be sure there is an event here using - * IsOnEvent(x,y); - */ - ParameterItem GetParameterAt(int x, int y); - - /** - * \brief Return the rectangle used by the parameter at point(x,y). - */ - wxRect GetAreaOfParameterAt(int x, int y); - - /** - * \brief True if a point is on an event. - */ - bool IsOnFoldingItem(int x, int y); - - /** - * \brief Return event at point (x,y). Be sure there is an event here using - * IsOnEvent(x,y); - */ - FoldingItem GetFoldingItemAt(int x, int y); - - /** - * \brief Clear all areas ( typically before redraw ) - */ - void Clear(); - - /** - * \brief Default constructor doing nothing. - */ - EventsEditorItemsAreas(){}; - - /** - * \brief Default destructor doing nothing. - */ - virtual ~EventsEditorItemsAreas(){}; - - std::vector > eventsAreas; - std::vector > instructionsAreas; - std::vector > parametersAreas; - std::vector > foldingAreas; - std::vector > instructionListsAreas; - - private: -}; - -} // namespace gd - -// Hash for EventItem, ParameterItem, InstructionItem, InstructionListItem and -// FoldingItem -namespace std { -template <> -struct hash { - std::size_t operator()(gd::EventItem const& item) const { - return (std::hash()(item.event.get())) ^ - (std::hash()(item.eventsList) << 1) ^ - (std::hash()(item.positionInList) << 2); - } -}; - -template <> -struct hash { - std::size_t operator()(gd::InstructionItem const& item) const { - return (std::hash()(item.instruction)) ^ - (std::hash()(item.instructionList) << 1) ^ - (std::hash()(item.positionInList) << 2) ^ - (std::hash()(item.event) << 3) ^ - (std::hash()(item.isCondition) << 4); - } -}; - -template <> -struct hash { - std::size_t operator()(gd::InstructionListItem const& item) const { - return (std::hash()(item.instructionList)) ^ - (std::hash()(item.event) << 1) ^ - (std::hash()(item.isConditionList) << 2); - } -}; - -template <> -struct hash { - std::size_t operator()(gd::ParameterItem const& item) const { - return (std::hash()(item.parameter)) ^ - (std::hash()(item.event) << 1); - } -}; - -template <> -struct hash { - std::size_t operator()(gd::FoldingItem const& item) const { - return std::hash()(item.event); - } -}; -} // namespace std - -#endif // EVENTSEDITORITEMSAREAS_H -#endif diff --git a/Core/GDCore/IDE/Dialogs/EventsEditor/EventsEditorSelection.cpp b/Core/GDCore/IDE/Dialogs/EventsEditor/EventsEditorSelection.cpp deleted file mode 100644 index 9c0e6700a4..0000000000 --- a/Core/GDCore/IDE/Dialogs/EventsEditor/EventsEditorSelection.cpp +++ /dev/null @@ -1,369 +0,0 @@ -/* - * GDevelop Core - * Copyright 2008-2016 Florian Rival (Florian.Rival@gmail.com). All rights - * reserved. This project is released under the MIT License. - */ - -#if defined(GD_IDE_ONLY) && !defined(GD_NO_WX_GUI) - -#include "GDCore/IDE/Dialogs/EventsEditor/EventsEditorSelection.h" -#include -#include -#include -#include "GDCore/Events/Event.h" -#include "GDCore/Events/EventsList.h" -#include "GDCore/IDE/Dialogs/EventsEditor/EventsEditorItemsAreas.h" - -namespace gd { - -void EventsEditorSelection::ClearSelection(bool refresh) { - eventsSelected.clear(); - instructionsSelected.clear(); - - if (refresh) eventsEditorCallback.Refresh(); -} - -void EventsEditorSelection::AddEvent(const gd::EventItem& eventSelection) { - if (eventSelection.event == std::shared_ptr() || - eventSelection.eventsList == NULL) { - std::cout << "WARNING, attempted to add a bad event to selection"; - return; - } - - if (!EventSelected(eventSelection)) { - eventsSelected.insert(eventSelection); - eventsEditorCallback.Refresh(); - } -} - -/** - * True if an event is selected - */ -bool EventsEditorSelection::EventSelected(const gd::EventItem& event) { - return eventsSelected.find(event) != eventsSelected.end(); -} - -void EventsEditorSelection::AddInstruction(const gd::InstructionItem& instr) { - if (instr.instruction == NULL || instr.instructionList == NULL) { - std::cout << "WARNING, attempted to add a bad instruction to selection"; - return; - } - - if (!InstructionSelected(instr)) { - instructionsSelected.insert(instr); - eventsEditorCallback.Refresh(); - } -} -/** - * Return a vector with all selected events - */ -std::vector EventsEditorSelection::GetAllSelectedEvents() { - std::vector results; - for (std::unordered_set::iterator it = eventsSelected.begin(); - it != eventsSelected.end(); - ++it) - results.push_back(*it); - - return results; -} - -std::vector -EventsEditorSelection::GetAllSelectedEventsWithoutSubEvents() { - std::vector results; - for (std::unordered_set::iterator it = eventsSelected.begin(); - it != eventsSelected.end(); - ++it) { - bool isAlreadyIncludedAsSubEvent = false; - for (std::unordered_set::iterator it2 = eventsSelected.begin(); - it2 != eventsSelected.end(); - ++it2) { - if ((*it).event != (*it2).event && - (*it2).event != std::shared_ptr() && - (*it2).event->CanHaveSubEvents()) { - if ((*it2).event->GetSubEvents().Contains(*(*it).event)) - isAlreadyIncludedAsSubEvent = true; - } - } - - if (!isAlreadyIncludedAsSubEvent) results.push_back(*it); - } - - return results; -} - -/** - * Return a vector with all selected instructions - */ -std::vector -EventsEditorSelection::GetAllSelectedInstructions() { - std::vector results; - for (std::unordered_set::iterator it = - instructionsSelected.begin(); - it != instructionsSelected.end(); - ++it) - results.push_back(*it); - - return results; -} - -bool EventsEditorSelection::HasSelectedActions() { - for (std::unordered_set::iterator it = - instructionsSelected.begin(); - it != instructionsSelected.end(); - ++it) - if (!it->isCondition) return true; - - return false; -} - -bool EventsEditorSelection::HasSelectedConditions() { - for (std::unordered_set::iterator it = - instructionsSelected.begin(); - it != instructionsSelected.end(); - ++it) - if (it->isCondition) return true; - - return false; -} - -bool EventsEditorSelection::InstructionSelected( - const gd::InstructionItem& instr) { - return instructionsSelected.find(instr) != instructionsSelected.end(); -} - -void EventsEditorSelection::SetHighlighted( - const gd::EventItem& eventSelection) { - eventHighlighted = eventSelection; -} -void EventsEditorSelection::SetHighlighted( - const gd::InstructionItem& instructionSelection) { - instructionHighlighted = instructionSelection; -} -void EventsEditorSelection::SetHighlighted(const InstructionListItem& item) { - instructionListHighlighted = item; -} -void EventsEditorSelection::SetHighlighted(const ParameterItem& parameterItem) { - parameterHighlighted = parameterItem; -} - -void EventsEditorSelection::BeginDragEvent() { dragging = true; } - -bool EventsEditorSelection::IsDraggingEvent() { return dragging; } - -bool EventsEditorSelection::EndDragEvent(bool deleteDraggedEvent, - bool dropAfterHighlightedElement) { - if (!dragging) return false; - dragging = false; - - if (eventHighlighted.eventsList == NULL) return false; - - // Be sure we do not try to drag inside an event selected - for (std::unordered_set::iterator it = eventsSelected.begin(); - it != eventsSelected.end(); - ++it) { - if ((*it).event == std::shared_ptr()) { - std::cout << "WARNING: Bad event in selection"; - continue; - } - - if ((*it).event == eventHighlighted.event || - ((*it).event->CanHaveSubEvents() && - (*it).event->GetSubEvents().Contains(*eventHighlighted.event))) { - return false; - } - } - - // Insert copy of dragged events - size_t positionInList = !dropAfterHighlightedElement - ? eventHighlighted.positionInList - : eventHighlighted.positionInList + 1; - for (std::unordered_set::iterator it = eventsSelected.begin(); - it != eventsSelected.end(); - ++it) { - if ((*it).event != std::shared_ptr()) - eventHighlighted.eventsList->InsertEvent(*(*it).event, positionInList); - } - - // Remove them from their initial position - if (deleteDraggedEvent) { - for (std::unordered_set::iterator it = eventsSelected.begin(); - it != eventsSelected.end(); - ++it) { - if ((*it).event != std::shared_ptr() && - (*it).eventsList != NULL) - (*it).eventsList->RemoveEvent(*(*it).event); - } - } - - ClearSelection(); - - return true; -} - -void EventsEditorSelection::BeginDragInstruction() { - draggingInstruction = true; -} - -bool EventsEditorSelection::IsDraggingInstruction() { - return draggingInstruction; -} - -gd::InstructionsList* EventsEditorSelection::EndDragInstruction( - bool deleteDraggedInstruction, bool dropAfterHighlightedElement) { - if (!draggingInstruction) return NULL; - draggingInstruction = false; - - // Find where to drag - gd::InstructionsList* list = NULL; - size_t positionInList = gd::String::npos; - if (instructionHighlighted.instructionList != NULL) { - list = instructionHighlighted.instructionList; - positionInList = instructionHighlighted.positionInList; - if (instructionHighlighted.event != NULL) - instructionHighlighted.event->eventHeightNeedUpdate = true; - else - std::cout << "WARNING : Instruction hightlighted event is not valid! " - << std::endl; - - if (dropAfterHighlightedElement) positionInList++; - } else if (instructionListHighlighted.instructionList != NULL) { - list = instructionListHighlighted.instructionList; - if (instructionListHighlighted.event != NULL) - instructionListHighlighted.event->eventHeightNeedUpdate = true; - else - std::cout - << "WARNING : Instruction list hightlighted event is not valid! " - << std::endl; - } else - return NULL; - - // Be sure we do not try to drag inside an instruction selected - if (instructionHighlighted.instruction != NULL) { - for (std::unordered_set::iterator it = - instructionsSelected.begin(); - it != instructionsSelected.end(); - ++it) { - if ((*it).instruction == NULL) { - std::cout << "WARNING: Bad instr in selection"; - continue; - } - - if ((*it).instruction == instructionHighlighted.instruction || - (FindInInstructionsAndSubInstructions( - (*it).instruction->GetSubInstructions(), - instructionHighlighted.instruction))) { - return NULL; - } - if (FindInInstructionsAndSubInstructions( - instructionHighlighted.instruction->GetSubInstructions(), - (*it).instruction)) { - return NULL; - } - } - } - - // Copy dragged instructions - gd::InstructionsList draggedInstructions; - for (std::unordered_set::iterator it = - instructionsSelected.begin(); - it != instructionsSelected.end(); - ++it) { - if ((*it).instruction != NULL) - draggedInstructions.Insert(*(*it).instruction); - } - - // Insert dragged instructions into their new list. - for (std::size_t i = 0; i < draggedInstructions.size(); ++i) { - if (positionInList < list->size()) - list->Insert(draggedInstructions[i], positionInList); - else - list->Insert(draggedInstructions[i]); - } - - if (deleteDraggedInstruction) { - // Update selection as some selected instruction can have become invalid - std::unordered_set newInstructionsSelected; - for (std::unordered_set::iterator it = - instructionsSelected.begin(); - it != instructionsSelected.end(); - ++it) { - if ((*it).instructionList == instructionHighlighted.instructionList && - (*it).positionInList > instructionHighlighted.positionInList) { - gd::InstructionItem newItem = (*it); - newItem.instruction = NULL; - newItem.positionInList += draggedInstructions.size(); - newInstructionsSelected.insert(newItem); - } else - newInstructionsSelected.insert(*it); - } - instructionsSelected = newInstructionsSelected; - - // Remove dragged instructions - DeleteAllInstructionSelected(); - } - - ClearSelection(); - - return list; -} - -void EventsEditorSelection::InstructionHighlightedOnBottomPart( - bool isOnbottomHandSide) { - isOnbottomHandSideOfInstruction = isOnbottomHandSide; -} - -void EventsEditorSelection::EventHighlightedOnBottomPart( - bool isOnbottomHandSide) { - isOnbottomHandSideOfEvent = isOnbottomHandSide; -} - -void EventsEditorSelection::DeleteAllInstructionSelected() { - // 1) Construct a map with their list and their index in the list - std::map > - mapOfDeletionsRequest; - for (std::unordered_set::iterator it = - instructionsSelected.begin(); - it != instructionsSelected.end(); - ++it) { - if ((*it).event != NULL) (*it).event->eventHeightNeedUpdate = true; - if ((*it).instructionList != NULL) - mapOfDeletionsRequest[(*it).instructionList].push_back( - (*it).positionInList); - } - // 2) For each list, erase each index - for (auto it = mapOfDeletionsRequest.begin(); - it != mapOfDeletionsRequest.end(); - ++it) { - std::list& listOfIndexesToDelete = it->second; - listOfIndexesToDelete.sort(); - listOfIndexesToDelete.reverse(); // We have erase from end to start to - // prevent index changing - - for (std::list::iterator index = listOfIndexesToDelete.begin(); - index != listOfIndexesToDelete.end(); - ++index) - it->first->Remove(*index); - } -} - -EventsEditorSelection::EventsEditorSelection( - gd::EventsEditorRefreshCallbacks& eventsEditorCallback_) - : dragging(false), - draggingInstruction(false), - eventsEditorCallback(eventsEditorCallback_) {} - -bool EventsEditorSelection::FindInInstructionsAndSubInstructions( - gd::InstructionsList& list, const gd::Instruction* instrToSearch) { - for (std::size_t i = 0; i < list.size(); ++i) { - if (&list[i] == instrToSearch) return true; - if (FindInInstructionsAndSubInstructions(list[i].GetSubInstructions(), - instrToSearch)) - return true; - } - - return false; -} - -} // namespace gd - -#endif diff --git a/Core/GDCore/IDE/Dialogs/EventsEditor/EventsEditorSelection.h b/Core/GDCore/IDE/Dialogs/EventsEditor/EventsEditorSelection.h deleted file mode 100644 index dae76d7c0f..0000000000 --- a/Core/GDCore/IDE/Dialogs/EventsEditor/EventsEditorSelection.h +++ /dev/null @@ -1,249 +0,0 @@ -/* - * GDevelop Core - * Copyright 2008-2016 Florian Rival (Florian.Rival@gmail.com). All rights - * reserved. This project is released under the MIT License. - */ - -#if defined(GD_IDE_ONLY) && !defined(GD_NO_WX_GUI) - -#ifndef EVENTSEDITORSELECTION_H -#define EVENTSEDITORSELECTION_H -#include -#include -#include -#include "GDCore/IDE/Dialogs/EventsEditor/EventsEditorItemsAreas.h" -namespace gd { -class EventsList; -} -namespace gd { -class BaseEvent; -} -namespace gd { -class EventsEditorRefreshCallbacks; -} - -namespace gd { - -/** - * \brief Represents the selection in an event editor - * - * \ingroup IDEDialogsEventsEditor - */ -class GD_CORE_API EventsEditorSelection { - public: - EventsEditorSelection( - gd::EventsEditorRefreshCallbacks& eventsEditorCallback_); - virtual ~EventsEditorSelection(){}; - - /** - * Clear selection - */ - void ClearSelection(bool refresh = true); - - /** - * Add an event to selection - */ - void AddEvent(const gd::EventItem& event); - - /** - * Add an instruction to selection - */ - void AddInstruction(const gd::InstructionItem& event); - - /** - * Return true if an event is selected - */ - bool EventSelected(const gd::EventItem& event); - - /** - * Return true if an instruction is selected - */ - bool InstructionSelected(const gd::InstructionItem& event); - - /** - * Highlight an event - */ - void SetHighlighted(const gd::EventItem& event); - - /** - * Highlight an instruction - */ - void SetHighlighted(const gd::InstructionItem& item); - - /** - * Highlight an instruction list - */ - void SetHighlighted(const InstructionListItem& item); - - /** - * Highlight a parameter - */ - void SetHighlighted(const ParameterItem& parameter); - - /** - * Set if the mouse is on the bottom hand side of the instruction, or on the - * top hand side. - */ - void InstructionHighlightedOnBottomPart(bool isOnbottomHandSide); - - /** - * Set if the mouse is on the bottom hand side of the event, or on the top - * hand side. - */ - void EventHighlightedOnBottomPart(bool isOnbottomHandSide); - - /** - * Return true if an event is highlighted - */ - bool EventHighlighted(const gd::EventItem& event) { - return eventHighlighted == event; - }; - - /** - * Return true if the mouse is on the bottom hand side of the event - * highlighted. ( Used to known if we have to drop the dragged event(s) afer - * or before the highlighted one ) - */ - bool IsEventHighlightedOnBottomPart() { return isOnbottomHandSideOfEvent; }; - - /** - * Return true if an instruction item is highlighted - */ - bool InstructionHighlighted(const gd::InstructionItem& instr) { - return instructionHighlighted == instr; - }; - - /** - * Return true if the mouse is on the bottom hand side of the instruction - * highlighted - */ - bool IsInstructionHighlightedOnBottomPart() { - return isOnbottomHandSideOfInstruction; - }; - - /** - * Return true if an instruction list item is highlighted - */ - bool InstructionListHighlighted(const InstructionListItem& list) { - return instructionListHighlighted == list; - }; - - /** - * Return true if a parameter is highlighted - */ - bool ParameterHighLighted(const ParameterItem& parameter) { - return parameterHighlighted == parameter; - }; - - /** - * Return highlighted event item - */ - gd::EventItem& GetHighlightedEvent() { return eventHighlighted; }; - - /** - * Return highlighted instruction list item - */ - InstructionListItem& GetHighlightedInstructionList() { - return instructionListHighlighted; - }; - - /** - * Return true if some events are selected - */ - bool HasSelectedEvents() { return !eventsSelected.empty(); }; - - /** - * Return true if some instructions are selected - */ - bool HasSelectedInstructions() { return !instructionsSelected.empty(); }; - - /** - * Return true if some actions are selected - */ - bool HasSelectedActions(); - - /** - * Return true if some conditions are selected - */ - bool HasSelectedConditions(); - - /** - * Return a vector with all selected events - */ - std::vector GetAllSelectedEvents(); - - /** - * Return a vector with all selected events but without sub events - */ - std::vector GetAllSelectedEventsWithoutSubEvents(); - - /** - * Return a vector with all selected instructions - */ - std::vector GetAllSelectedInstructions(); - - /** - * As it is more difficult than for event, this function is dedicaced to - * deleting all instructions selected - */ - void DeleteAllInstructionSelected(); - - void BeginDragEvent(); - bool IsDraggingEvent(); - bool EndDragEvent(bool deleteDraggedEvent = true, - bool dropAfterHighlightedElement = false); - - void BeginDragInstruction(); - bool IsDraggingInstruction(); - gd::InstructionsList* EndDragInstruction( - bool deleteDraggedInstruction = true, - bool dropAfterHighlightedElement = false); - - private: - std::unordered_set eventsSelected; ///< Events selection - std::unordered_set - instructionsSelected; ///< Events selection - - EventItem eventHighlighted; - bool isOnbottomHandSideOfEvent; - gd::InstructionItem instructionHighlighted; - bool isOnbottomHandSideOfInstruction; - InstructionListItem instructionListHighlighted; - ParameterItem parameterHighlighted; - - bool dragging; ///< True if dragging event - bool draggingInstruction; ///< True if dragging instruction - - /** - * Return true if an event is found in the list ( sub events are also taken in - * account ) - */ - bool FindInEventsAndSubEvents(const gd::EventsList& list, - const gd::BaseEvent& eventToSearch); - /** - * Return true if an instruction is found in the list ( sub instructions are - * also taken in account ) - */ - bool FindInInstructionsAndSubInstructions( - gd::InstructionsList& list, const gd::Instruction* instrToSearch); - - gd::EventsEditorRefreshCallbacks& eventsEditorCallback; -}; - -/** - * \brief Internal GD class used to notice events editor they must be refreshed. - * - * \ingroup IDEDialogs - */ -class GD_CORE_API EventsEditorRefreshCallbacks { - public: - EventsEditorRefreshCallbacks(){}; - virtual ~EventsEditorRefreshCallbacks(){}; - - virtual void Refresh() = 0; -}; - -} // namespace gd - -#endif // EVENTSEDITORSELECTION_H -#endif diff --git a/Core/GDCore/IDE/Dialogs/EventsEditor/EventsRenderingHelper.cpp b/Core/GDCore/IDE/Dialogs/EventsEditor/EventsRenderingHelper.cpp deleted file mode 100644 index fec00f7a25..0000000000 --- a/Core/GDCore/IDE/Dialogs/EventsEditor/EventsRenderingHelper.cpp +++ /dev/null @@ -1,626 +0,0 @@ -/* - * GDevelop Core - * Copyright 2008-2016 Florian Rival (Florian.Rival@gmail.com). All rights - * reserved. This project is released under the MIT License. - */ -#if !defined(GD_NO_WX_GUI) -#include "EventsRenderingHelper.h" -#include -#include -#include -#include -#include -#include "GDCore/Events/Event.h" -#include "GDCore/Events/Instruction.h" -#include "GDCore/Events/InstructionsList.h" -#include "GDCore/Extensions/Metadata/MetadataProvider.h" -#include "GDCore/Extensions/Platform.h" -#include "GDCore/IDE/Dialogs/EventsEditor/EventsEditorItemsAreas.h" -#include "GDCore/IDE/Dialogs/EventsEditor/EventsEditorSelection.h" -#include "GDCore/IDE/Events/InstructionSentenceFormatter.h" -#include "GDCore/IDE/wxTools/CommonBitmapProvider.h" -#include "GDCore/IDE/wxTools/GUIContentScaleFactor.h" -#include "GDCore/String.h" - -using namespace std; - -namespace gd { - -EventsRenderingHelper* EventsRenderingHelper::singleton = NULL; - -wxPoint EventsRenderingHelper::DrawTextInArea(gd::String text, - wxDC& dc, - wxRect rect, - wxPoint point) { - if (text.empty() || rect.width == 0) return point; - - // Insert artificial space to simulate starting from point indicated - int spacesToInsert = static_cast(point.x - rect.x) / - static_cast(fontCharacterWidth); - if (spacesToInsert < 0) spacesToInsert = 0; - for (unsigned int i = 0; i < spacesToInsert; ++i) { - text = " " + text; - } - point.x = - rect.x; // We can now start from rect.x as spaces have been inserted. - - int charactersInALine = floor(static_cast(rect.width) / - static_cast(fontCharacterWidth)); - if (charactersInALine <= 0) charactersInALine = 1; - - int textLength = text.size(); - - int cutCount = ceil(static_cast(textLength) / - static_cast(charactersInALine)); - if (cutCount <= 0) cutCount = 1; - - size_t lastCutPosition = 0; - wxString displayedText; - for (unsigned int i = 0; i < cutCount; ++i) { - if (i != 0) point.y += fontCharacterHeight; - -#if defined(LINUX) - try { -#endif - displayedText = text.substr(lastCutPosition, charactersInALine); -#if defined(LINUX) - } catch (...) { - std::cout << "Error rendering:" << text << ";" << std::endl; - } -#endif - - dc.DrawText(displayedText, point); - - lastCutPosition += charactersInALine; - } - - // Return position to latest drawn character - return wxPoint(point.x + displayedText.length() * fontCharacterWidth, - point.y); -} - -unsigned int EventsRenderingHelper::GetTextHeightInArea( - const gd::String& text, unsigned int widthAvailable) { - if (text.empty() || widthAvailable == 0) return 0; - - int charactersInALine = floor(static_cast(widthAvailable) / - static_cast(fontCharacterWidth)); - if (charactersInALine <= 0) charactersInALine = 1; - - int cutCount = ceil(static_cast(text.length()) / - static_cast(charactersInALine)); - if (cutCount <= 0) cutCount = 1; - - return cutCount * fontCharacterHeight; -} - -EventsRenderingHelper::EventsRenderingHelper() - : eventGradient1(wxColour(209, 217, 255)), - eventGradient2(wxColour(196, 207, 255)), - eventGradient3(wxColour(233, 233, 255)), - eventGradient4(wxColour(205, 205, 255)), - eventBorderColor(wxColour(185, 185, 247)), - eventConditionsGradient1(wxColour(234, 242, 255)), - eventConditionsGradient2(wxColour(221, 232, 255)), - eventConditionsGradient3(wxColour(237, 237, 255)), - eventConditionsGradient4(wxColour(210, 210, 255)), - eventConditionsBorderColor(wxColour(185, 185, 247)), - selectionColor(wxColour(255, 230, 156)), - disabledColor(wxColour(245, 245, 254)), - disabledColor2(wxColour(245, 245, 245)), - instructionsListBorder(5), - separationBetweenInstructions(2), - conditionsColumnWidth(400), - selectionRectangleOutline(wxPen(wxColour(244, 217, 141), 1)), - selectionRectangleFill(wxBrush(wxColour(251, 235, 189))), - highlightRectangleOutline(wxPen(wxColour(206, 206, 206), 1)), - highlightRectangleFill(wxBrush(wxColour(226, 226, 226))), - niceRectangleFill1(wxColour(225, 225, 246)), - niceRectangleFill2(wxColour(198, 198, 246)), - niceRectangleOutline(wxPen(wxColour(205, 205, 246), 1)), - actionsRectangleOutline(wxPen(wxColour(205, 205, 246))), - conditionsRectangleOutline(wxPen(wxColour(185, 185, 247), 1)), - actionsRectangleFill(*wxWHITE_BRUSH), - conditionsRectangleFill(wxBrush(wxColour(252, 252, 255))) { - fakeBmp.Create(10, 10, -1); - - niceFont = - wxFont(8, wxFONTFAMILY_DEFAULT, wxFONTSTYLE_NORMAL, wxFONTWEIGHT_NORMAL); - niceFont.SetPointSize(10); - -#if defined(WINDOWS) - wxFont font(8, - wxFONTFAMILY_TELETYPE, - wxFONTSTYLE_NORMAL, - wxFONTWEIGHT_NORMAL, - false, - "Consolas"); -#else - wxFont font( - 8, wxFONTFAMILY_TELETYPE, wxFONTSTYLE_NORMAL, wxFONTWEIGHT_NORMAL, false); -#endif - font.SetPointSize(10); - SetFont(font); -} - -void EventsRenderingHelper::SetFont(const wxFont& font_) { - font = font_; - - // Update the character width - wxMemoryDC dc; - dc.SelectObject(fakeBmp); - dc.SetFont(font); - - fontCharacterWidth = - static_cast(dc.GetTextExtent("abcdef").GetWidth()) / 6.0f; - // Update height and ensure it's not too small - fontCharacterHeight = std::max(dc.GetTextExtent("abcdef").GetHeight(), 16); -} - -int EventsRenderingHelper::DrawConditionsList( - gd::InstructionsList& conditions, - wxDC& dc, - int x, - int y, - int width, - gd::BaseEvent* event, - gd::EventsEditorItemsAreas& areas, - gd::EventsEditorSelection& selection, - const gd::Platform& platform) { - int initialYPosition = y; - - dc.SetFont(font); - const int iconWidth = 18; - - // Draw Conditions rectangle - const int conditionsHeight = - GetRenderedConditionsListHeight(conditions, width, platform); - wxRect rect(x - 1, y - 1, width + 2, conditionsHeight + 2); - dc.SetPen(conditionsRectangleOutline); - dc.SetBrush(conditionsRectangleFill); - dc.DrawRectangle(rect); - - InstructionListItem item(/**isCondition=*/true, &conditions, event); - areas.AddInstructionListArea(rect, item); - - if (conditions.empty()) { - if (selection.IsDraggingInstruction() && - selection.InstructionListHighlighted(item)) { - dc.SetPen(wxPen(wxColour(0, 0, 0))); - dc.SetBrush(wxBrush(wxColour(0, 0, 0))); - dc.DrawRectangle(x + 2, y, width - 2, 2); - } - - dc.SetTextForeground(!event->IsDisabled() ? wxColour(0, 0, 0) - : wxColour(160, 160, 160)); - dc.SetFont(niceFont.Italic()); - dc.DrawText(_("No conditions"), x + 2, y + 1); - - return fontCharacterHeight; - } - - // Draw each conditions - for (std::size_t j = 0; j < conditions.size(); j++) { - if (j != 0) y += separationBetweenInstructions; - - const gd::InstructionMetadata& instructionMetadata = - MetadataProvider::GetConditionMetadata(platform, - conditions[j].GetType()); - gd::InstructionItem accessor( - &conditions[j], /*isCondition=*/true, &conditions, j, event); - - // Get the width available - int leftIconsWidth = conditions[j].IsInverted() ? iconWidth * 2 : iconWidth; - int freeWidth = width - leftIconsWidth; - freeWidth = freeWidth <= 0 ? 1 : freeWidth; - - // Draw - int height = 0; - if (selection.InstructionSelected(accessor)) { - gd::String text = InstructionSentenceFormatter::Get()->Translate( - conditions[j], instructionMetadata); - height = GetTextHeightInArea(text, freeWidth); - - dc.SetPen(selectionRectangleOutline); - dc.SetBrush(selectionRectangleFill); - dc.DrawRectangle(x, y, width, height); - DrawInstruction(conditions[j], - instructionMetadata, - /*isCondition=*/true, - dc, - wxPoint(x + leftIconsWidth, y), - freeWidth, - event, - areas, - selection); - } else if (selection.InstructionHighlighted(accessor)) { - gd::String text = InstructionSentenceFormatter::Get()->Translate( - conditions[j], instructionMetadata); - height = GetTextHeightInArea(text, freeWidth); - - dc.SetPen(highlightRectangleOutline); - dc.SetBrush(highlightRectangleFill); - dc.DrawRectangle(x, y, width, height); - DrawInstruction(conditions[j], - instructionMetadata, - /*isCondition=*/true, - dc, - wxPoint(x + leftIconsWidth, y), - freeWidth, - event, - areas, - selection); - - if (selection.IsDraggingInstruction()) { - dc.SetPen(wxPen(wxColour(0, 0, 0))); - dc.SetBrush(wxBrush(wxColour(0, 0, 0))); - dc.DrawRectangle( - x + leftIconsWidth + 2, - selection.IsInstructionHighlightedOnBottomPart() ? y + height : y, - width - 2 - iconWidth - 2, - 2); - } - } else - height = DrawInstruction(conditions[j], - instructionMetadata, - /*isCondition=*/true, - dc, - wxPoint(x + leftIconsWidth, y), - freeWidth, - event, - areas, - selection); - - // Draw needed icons - const wxBitmap* bmp = &instructionMetadata.GetSmallBitmapIcon(); - if (!bmp->IsOk()) bmp = &gd::CommonBitmapProvider::Get()->unknownBt; - - if (conditions[j].IsInverted()) { - dc.DrawBitmap( - gd::CommonBitmapProvider::Get()->invertedCondition, x + 1, y, true); - if (bmp->IsOk()) dc.DrawBitmap(*bmp, x + iconWidth + 1, y, true); - } else if (bmp->IsOk()) - dc.DrawBitmap(*bmp, x + 1, y, true); - - areas.AddInstructionArea(wxRect(x, y, width, height), accessor); - y += height; - - // Draw sub conditions - if (instructionMetadata.CanHaveSubInstructions()) - y += DrawConditionsList(conditions[j].GetSubInstructions(), - dc, - x + 18, - y, - width - 18, - event, - areas, - selection, - platform); - } - - return y - initialYPosition; -} - -int EventsRenderingHelper::DrawActionsList(gd::InstructionsList& actions, - wxDC& dc, - int x, - int y, - int width, - gd::BaseEvent* event, - gd::EventsEditorItemsAreas& areas, - gd::EventsEditorSelection& selection, - const gd::Platform& platform) { - int initialYPosition = y; - - dc.SetFont(font); - const int iconWidth = 18; - - // Draw Actions rectangle - const int actionsHeight = - GetRenderedActionsListHeight(actions, width, platform); - wxRect rect(x - 1, y - 1, width + 2, actionsHeight + 2); - dc.SetPen(actionsRectangleOutline); - dc.SetBrush(actionsRectangleFill); - dc.DrawRectangle(rect); - - InstructionListItem item(/**isCondition=*/false, &actions, event); - areas.AddInstructionListArea(rect, item); - - if (actions.empty()) { - if (selection.IsDraggingInstruction() && - selection.InstructionListHighlighted(item)) { - dc.SetPen(wxPen(wxColour(0, 0, 0))); - dc.SetBrush(wxBrush(wxColour(0, 0, 0))); - dc.DrawRectangle(x + 2, y, width - 2, 2); - } - - dc.SetTextForeground(!event->IsDisabled() ? wxColour(0, 0, 0) - : wxColour(160, 160, 160)); - dc.SetFont(niceFont.Italic()); - dc.DrawText(_("No actions"), x + 2, y + 1); - - return fontCharacterHeight; - } - - // Draw each actions - for (std::size_t j = 0; j < actions.size(); j++) { - if (j != 0) y += separationBetweenInstructions; - - const gd::InstructionMetadata& instructionMetadata = - MetadataProvider::GetActionMetadata(platform, actions[j].GetType()); - gd::InstructionItem accessor( - &actions[j], /*isCondition=*/false, &actions, j, event); - - // Get the width available - int freeWidth = width - iconWidth; - freeWidth = freeWidth <= 0 ? 1 : freeWidth; - - int height = 0; - if (selection.InstructionSelected(accessor)) { - gd::String text = InstructionSentenceFormatter::Get()->Translate( - actions[j], instructionMetadata); - height = GetTextHeightInArea(text, freeWidth); - - dc.SetPen(selectionRectangleOutline); - dc.SetBrush(selectionRectangleFill); - dc.DrawRectangle(x, y, width, height); - DrawInstruction(actions[j], - instructionMetadata, - /*isCondition=*/false, - dc, - wxPoint(x + iconWidth, y), - freeWidth, - event, - areas, - selection); - } else if (selection.InstructionHighlighted(accessor)) { - gd::String text = InstructionSentenceFormatter::Get()->Translate( - actions[j], instructionMetadata); - height = GetTextHeightInArea(text, freeWidth); - - dc.SetPen(highlightRectangleOutline); - dc.SetBrush(highlightRectangleFill); - dc.DrawRectangle(x, y, width, height); - DrawInstruction(actions[j], - instructionMetadata, - /*isCondition=*/false, - dc, - wxPoint(x + iconWidth, y), - freeWidth, - event, - areas, - selection); - - if (selection.IsDraggingInstruction()) { - dc.SetPen(wxPen(wxColour(0, 0, 0))); - dc.SetBrush(wxBrush(wxColour(0, 0, 0))); - dc.DrawRectangle( - x + iconWidth + 2, - selection.IsInstructionHighlightedOnBottomPart() ? y + height : y, - width - 2 - iconWidth - 2, - 2); - } - } else - height = DrawInstruction(actions[j], - instructionMetadata, - /*isCondition=*/false, - dc, - wxPoint(x + iconWidth, y), - freeWidth, - event, - areas, - selection); - - // Draw needed icons - const wxBitmap* bmp = &instructionMetadata.GetSmallBitmapIcon(); - if (!bmp->IsOk()) bmp = &gd::CommonBitmapProvider::Get()->unknownBt; - if (bmp->IsOk()) dc.DrawBitmap(*bmp, x + 1, y, true); - - areas.AddInstructionArea(wxRect(x, y, width, height), accessor); - y += height; - - // Draw sub actions - if (instructionMetadata.CanHaveSubInstructions()) - y += DrawActionsList(actions[j].GetSubInstructions(), - dc, - x + 18, - y, - width - 18, - event, - areas, - selection, - platform); - } - - return y - initialYPosition; -} - -unsigned int EventsRenderingHelper::GetRenderedConditionsListHeight( - const gd::InstructionsList& conditions, - int width, - const gd::Platform& platform) { - int y = 0; - - const int iconWidth = 18; - - if (conditions.empty()) return fontCharacterHeight; - - for (std::size_t j = 0; j < conditions.size(); j++) { - if (j != 0) y += separationBetweenInstructions; - - const gd::InstructionMetadata& instructionMetadata = - MetadataProvider::GetConditionMetadata(platform, - conditions[j].GetType()); - - // Get the width available - int leftIconsWidth = conditions[j].IsInverted() ? iconWidth * 2 : iconWidth; - int freeWidth = width - leftIconsWidth; - freeWidth = freeWidth <= 0 ? 1 : freeWidth; - - int height = - GetTextHeightInArea(InstructionSentenceFormatter::Get()->Translate( - conditions[j], instructionMetadata), - freeWidth); - y += height; - - // Sub conditions - if (instructionMetadata.CanHaveSubInstructions()) - y += GetRenderedConditionsListHeight( - conditions[j].GetSubInstructions(), width - 18, platform); - } - - return y; -} - -unsigned int EventsRenderingHelper::GetRenderedActionsListHeight( - const gd::InstructionsList& actions, - int width, - const gd::Platform& platform) { - int y = 0; - - const int iconWidth = 18; - - // Draw Actions rectangle - if (actions.empty()) return fontCharacterHeight; - - // Draw each actions - for (std::size_t j = 0; j < actions.size(); j++) { - if (j != 0) y += separationBetweenInstructions; - - const gd::InstructionMetadata& instructionMetadata = - MetadataProvider::GetActionMetadata(platform, actions[j].GetType()); - - // Get the width available - int freeWidth = width - iconWidth; - freeWidth = freeWidth <= 0 ? 1 : freeWidth; - - int height = - GetTextHeightInArea(InstructionSentenceFormatter::Get()->Translate( - actions[j], instructionMetadata), - freeWidth); - y += height; - - // Draw sub actions - if (instructionMetadata.CanHaveSubInstructions()) - y += GetRenderedActionsListHeight( - actions[j].GetSubInstructions(), width - 18, platform); - } - - return y; -} - -int EventsRenderingHelper::DrawInstruction( - gd::Instruction& instruction, - const gd::InstructionMetadata& instructionMetadata, - bool isCondition, - wxDC& dc, - wxPoint point, - int freeWidth, - gd::BaseEvent* event, - gd::EventsEditorItemsAreas& areas, - gd::EventsEditorSelection& selection) { - std::vector > formattedStr = - InstructionSentenceFormatter::Get()->GetAsFormattedText( - instruction, instructionMetadata); - - wxPoint lastPos = point; - // size_t alreadyWrittenCharCount = 0; - for (std::size_t i = 0; i < formattedStr.size(); ++i) { - // Update font and properties - dc.SetTextForeground(!event->IsDisabled() - ? formattedStr[i].second.GetWxColor() - : wxColour(160, 160, 160)); - font.SetWeight(formattedStr[i].second.bold ? wxFONTWEIGHT_BOLD - : wxFONTWEIGHT_NORMAL); - font.SetStyle(formattedStr[i].second.italic ? wxFONTSTYLE_ITALIC - : wxFONTSTYLE_NORMAL); - gd::String text = formattedStr[i].first; - - // Verify if we are drawing a parameter - if (formattedStr[i].second.userData != gd::String::npos) { - ParameterItem item( - formattedStr[i].second.userData < instruction.GetParameters().size() - ? &instruction.GetParameter(formattedStr[i].second.userData) - : NULL, - event); - - std::size_t textLength = text.size(); - int parameterWidth = - (textLength * fontCharacterWidth <= freeWidth - lastPos.x + point.x - ? textLength * fontCharacterWidth - : freeWidth - lastPos.x + point.x); - if (selection.ParameterHighLighted(item)) { - dc.SetBrush(wxBrush(wxColour(255, 163, 163))); - dc.SetPen(wxPen(wxColour(209, 0, 0))); - dc.DrawRectangle( - lastPos.x, lastPos.y, parameterWidth, fontCharacterHeight); - } - - areas.AddParameterArea( - wxRect(lastPos.x, lastPos.y, parameterWidth, fontCharacterHeight), - item); - } - - dc.SetFont(font); - lastPos = DrawTextInArea( - text, dc, wxRect(point.x, point.y, freeWidth, 0 /*Useless*/), lastPos); - } - - font.SetWeight(wxFONTWEIGHT_NORMAL); - font.SetStyle(wxFONTSTYLE_NORMAL); - dc.SetFont(font); - - return lastPos.y - point.y + fontCharacterHeight; -} - -void EventsRenderingHelper::DrawNiceRectangle(wxDC& dc, - const wxRect& rect) const { - { - wxRect background(rect); - - background.x += 2; - background.y += 2; - background.width -= 4; - background.height -= 4; - dc.GradientFillLinear( - background, niceRectangleFill1, niceRectangleFill2, wxSOUTH); - } - - wxPoint border_points[9]; - border_points[0] = wxPoint(1, rect.height - 4); - border_points[1] = wxPoint(1, 3); - border_points[2] = wxPoint(3, 1); - border_points[3] = wxPoint(rect.width - 4, 1); - border_points[4] = wxPoint(rect.width - 2, 3); - border_points[5] = wxPoint(rect.width - 2, rect.height - 4); - border_points[6] = wxPoint(rect.width - 4, rect.height - 2); - border_points[7] = wxPoint(3, rect.height - 2); - border_points[8] = wxPoint(1, rect.height - 4); - - dc.SetPen(niceRectangleOutline); - dc.DrawLines( - sizeof(border_points) / sizeof(wxPoint), border_points, rect.x, rect.y); -} - -gd::String EventsRenderingHelper::GetHTMLText(gd::String str) { - return str.FindAndReplace("&", "&") - .FindAndReplace("<", "<") - .FindAndReplace(">", ">") - .FindAndReplace("\n", "
"); -} - -EventsRenderingHelper* EventsRenderingHelper::Get() { - if (NULL == singleton) singleton = new EventsRenderingHelper; - - return singleton; -} - -void EventsRenderingHelper::DestroySingleton() { - if (NULL != singleton) { - delete singleton; - singleton = NULL; - } -} - -} // namespace gd -#endif diff --git a/Core/GDCore/IDE/Dialogs/EventsEditor/EventsRenderingHelper.h b/Core/GDCore/IDE/Dialogs/EventsEditor/EventsRenderingHelper.h deleted file mode 100644 index 5feeadf99e..0000000000 --- a/Core/GDCore/IDE/Dialogs/EventsEditor/EventsRenderingHelper.h +++ /dev/null @@ -1,275 +0,0 @@ -/* - * GDevelop Core - * Copyright 2008-2016 Florian Rival (Florian.Rival@gmail.com). All rights - * reserved. This project is released under the MIT License. - */ -#if !defined(GD_NO_WX_GUI) -#ifndef EventsRenderingHelper_H -#define EventsRenderingHelper_H -#include -#include -#include -#include "GDCore/Events/InstructionsList.h" -namespace gd { -class String; -} -namespace gd { -class BaseEvent; -} -namespace gd { -class Instruction; -} -namespace gd { -class Platform; -} -namespace gd { -class EventsEditorItemsAreas; -} -namespace gd { -class EventsEditorSelection; -} -namespace gd { -class InstructionMetadata; -} -namespace gd { -class InstructionsMetadataHolder; -} - -namespace gd { - -/** - - * \brief Provides tools to draw events using wxWidgets toolkit. - * - * Class providing default colors, fonts and drawing functions so as to - * render events using wxWidgets toolkit. - * - * \ingroup IDEDialogsEventsEditor - */ -class GD_CORE_API EventsRenderingHelper { - public: - static EventsRenderingHelper *Get(); - static void DestroySingleton(); - - /** - * Draw a nice rectangle, often used as conditions background, on a wxDC. - */ - void DrawNiceRectangle(wxDC &dc, const wxRect &rect) const; - - /** - * \brief Draw the specified condition list - * \param conditions Conditions to be rendered - * \param dc wxWidgets DC to be used - * \param x x position of the drawing - * \param y y position of the drawing - * \param width Width available for the drawing - * \param event Event owning the condition list - * \param areas EventsEditorItemsAreas object when drawn areas will be - * registered \param selection EventsEditorSelection object providing - * information about selection \param platform The platform currently used - * \return Height used for the drawing - */ - int DrawConditionsList(gd::InstructionsList &conditions, - wxDC &dc, - int x, - int y, - int width, - gd::BaseEvent *event, - gd::EventsEditorItemsAreas &areas, - gd::EventsEditorSelection &selection, - const gd::Platform &platform); - - /** - * \brief Draw the specified action list - * \see gd::EventsRenderingHelper::DrawConditionsList - */ - int DrawActionsList(gd::InstructionsList &actions, - wxDC &dc, - int x, - int y, - int width, - gd::BaseEvent *event, - gd::EventsEditorItemsAreas &areas, - gd::EventsEditorSelection &selection, - const gd::Platform &platform); - - /** - * \brief Get the height taken by drawing a condition list - * \param conditions Conditions to be rendered - * \param width Width available for the drawing - * \param platform The platform currently used - * \return Height used for the drawing - */ - unsigned int GetRenderedConditionsListHeight( - const gd::InstructionsList &conditions, - int width, - const gd::Platform &platform); - /** - * \brief Get the height taken by drawing a condition list - * \see gd::EventsRenderingHelper::GetRenderedConditionsListHeight - */ - unsigned int GetRenderedActionsListHeight(const gd::InstructionsList &actions, - int width, - const gd::Platform &platform); - - inline unsigned int GetConditionsColumnWidth() const { - return conditionsColumnWidth; - }; - inline void SetConditionsColumnWidth(unsigned int conditionsColumnWidth_) { - conditionsColumnWidth = conditionsColumnWidth_; - }; - - /** - * Draw a text in dc at point, without taking more than widthAvailable. - * \return X position of the last character and total height taken by the text - */ - wxPoint DrawTextInArea(gd::String text, wxDC &dc, wxRect rect, wxPoint point); - - /** - * \return Height taken by the text - */ - unsigned int GetTextHeightInArea(const gd::String &text, - unsigned int widthAvailable); - - /** - * Draw a specific instruction - * \param instruction Instruction to be rendered - * \param instructionMetadata Instruction metadata - * \param isCondition true if the instruction is a condition - * \param dc The wxWidgets DC to be used for rendering - * \param point The drawing position - * \param freeWidth Width available - * \param event Event owning the condition list - * \param areas EventsEditorItemsAreas object when drawn areas will be - * registered \param selection EventsEditorSelection object providing - * information about selection \return Height used for the drawing - */ - int DrawInstruction(gd::Instruction &instruction, - const gd::InstructionMetadata &instructionMetadata, - bool isCondition, - wxDC &dc, - wxPoint point, - int freeWidth, - gd::BaseEvent *event, - gd::EventsEditorItemsAreas &areas, - gd::EventsEditorSelection &selection); - - /** - * Change font. Only use a fixed width font. - */ - void SetFont(const wxFont &font); - - inline const wxFont &GetFont() const { return font; }; - inline wxFont &GetFont() { return font; }; - - inline const wxFont &GetNiceFont() const { return niceFont; }; - inline wxFont &GetNiceFont() { return niceFont; }; - - inline const wxHtmlDCRenderer &GetHTMLRenderer() const { - return htmlRenderer; - }; - inline wxHtmlDCRenderer &GetHTMLRenderer() { return htmlRenderer; }; - - const wxBrush &GetSelectedRectangleFillBrush() const { - return selectionRectangleFill; - } - wxBrush &GetSelectedRectangleFillBrush() { return selectionRectangleFill; } - - const wxPen &GetSelectedRectangleOutlinePen() const { - return selectionRectangleOutline; - } - wxPen &GetSelectedRectangleOutlinePen() { return selectionRectangleOutline; } - - const wxBrush &GetHighlightedRectangleFillBrush() const { - return highlightRectangleFill; - } - wxBrush &GetHighlightedRectangleFillBrush() { return highlightRectangleFill; } - - const wxPen &GetHighlightedRectangleOutlinePen() const { - return highlightRectangleOutline; - } - wxPen &GetHighlightedRectangleOutlinePen() { - return highlightRectangleOutline; - } - - const wxPen &GetConditionsRectangleOutlinePen() const { - return conditionsRectangleOutline; - } - wxPen &GetConditionsRectangleOutlinePen() { - return conditionsRectangleOutline; - } - - const wxPen &GetActionsRectangleOutlinePen() const { - return actionsRectangleOutline; - } - wxPen &GetActionsRectangleOutlinePen() { return actionsRectangleOutline; } - - const wxBrush &GetConditionsRectangleFillBrush() const { - return conditionsRectangleFill; - } - wxBrush &GetConditionsRectangleFillBrush() { return conditionsRectangleFill; } - - const wxBrush &GetActionsRectangleFillBrush() const { - return actionsRectangleFill; - } - wxBrush &GetActionsRectangleFillBrush() { return actionsRectangleFill; } - - /** - * Make sure a text will be correctly display by replacing specials characters - * and inserting tags like
. - */ - gd::String GetHTMLText(gd::String text); - - wxColor eventGradient1; - wxColor eventGradient2; - wxColor eventGradient3; - wxColor eventGradient4; - wxColor eventBorderColor; - wxColor eventConditionsGradient1; - wxColor eventConditionsGradient2; - wxColor eventConditionsGradient3; - wxColor eventConditionsGradient4; - wxColor eventConditionsBorderColor; - wxColor selectionColor; - wxColor disabledColor; - wxColor disabledColor2; - - int instructionsListBorder; - int separationBetweenInstructions; - - private: - EventsRenderingHelper(); - virtual ~EventsRenderingHelper(){}; - - unsigned int conditionsColumnWidth; - - wxPen selectionRectangleOutline; - wxBrush selectionRectangleFill; - wxPen highlightRectangleOutline; - wxBrush highlightRectangleFill; - - wxPen niceRectangleOutline; - wxColour niceRectangleFill1; - wxColour niceRectangleFill2; - - wxPen actionsRectangleOutline; - wxPen conditionsRectangleOutline; - wxBrush actionsRectangleFill; - wxBrush conditionsRectangleFill; - - wxFont font; ///< Fixed width font - float fontCharacterWidth; - float fontCharacterHeight; - - wxFont niceFont; - - wxHtmlDCRenderer htmlRenderer; - - static EventsRenderingHelper *singleton; - wxBitmap fakeBmp; -}; - -} // namespace gd - -#endif // EventsRenderingHelper_H -#endif diff --git a/Core/GDCore/IDE/Project/ProjectResourcesCopier.cpp b/Core/GDCore/IDE/Project/ProjectResourcesCopier.cpp index dff2acf5de..4dd982b9c6 100644 --- a/Core/GDCore/IDE/Project/ProjectResourcesCopier.cpp +++ b/Core/GDCore/IDE/Project/ProjectResourcesCopier.cpp @@ -5,12 +5,6 @@ */ #include "ProjectResourcesCopier.h" #include -#if defined(GD_IDE_ONLY) && !defined(GD_NO_WX_GUI) -#include -#include -#include -#include -#endif #include "GDCore/CommonTools.h" #include "GDCore/IDE/AbstractFileSystem.h" #include "GDCore/IDE/Project/ResourcesAbsolutePathChecker.h" @@ -36,18 +30,6 @@ bool ProjectResourcesCopier::CopyAllResourcesTo( originalProject.ExposeResources(absolutePathChecker); bool copyAlsoResourcesWithAbsolutePath = !askAboutAbsoluteFilenames; -#if !defined(GD_NO_WX_GUI) - if (!copyAlsoResourcesWithAbsolutePath) { - copyAlsoResourcesWithAbsolutePath = - absolutePathChecker.HasResourceWithAbsoluteFilenames() && - wxMessageBox(_("Some resources are using absolute filenames.\nDo you " - "want them to be copied in the new folder of the " - "project? If you choose No, they won't be modified."), - _("Some resources are using absolute filenames."), - wxYES_NO | wxICON_QUESTION) == wxYES; - } -#endif - auto projectDirectory = fs.DirNameFrom(originalProject.GetProjectFile()); std::cout << "Copying all ressources from " << projectDirectory << " to " << destinationDirectory << "..." << std::endl; @@ -76,15 +58,6 @@ bool ProjectResourcesCopier::CopyAllResourcesTo( it != resourcesNewFilename.end(); ++it) { if (!it->first.empty()) { -#if !defined(GD_NO_WX_GUI) - if (optionalProgressDialog) { - if (!optionalProgressDialog->Update( - i / static_cast(resourcesNewFilename.size()) * 100.0f, - _("Exporting ") + it->second)) - return false; // User choose to abort. - } -#endif - // Create the destination filename gd::String destinationFile = it->second; fs.MakeAbsolute(destinationFile, destinationDirectory); diff --git a/Core/GDCore/Project/Project.cpp b/Core/GDCore/Project/Project.cpp index add977e4b5..d069e6686d 100644 --- a/Core/GDCore/Project/Project.cpp +++ b/Core/GDCore/Project/Project.cpp @@ -38,15 +38,6 @@ #include "GDCore/Tools/PolymorphicClone.h" #include "GDCore/Tools/VersionWrapper.h" #include "GDCore/Utf8/utf8.h" -#if defined(GD_IDE_ONLY) && !defined(GD_NO_WX_GUI) -#include -// clang-format off -#include -#include -// clang-format on -#include -#include -#endif using namespace std; @@ -532,45 +523,6 @@ void Project::RemoveEventsFunctionsExtension(const gd::String& name) { } #endif -#if defined(GD_IDE_ONLY) && !defined(GD_NO_WX_GUI) -// Compatibility with GD2.x -class SpriteObjectsPositionUpdater : public gd::InitialInstanceFunctor { - public: - SpriteObjectsPositionUpdater(gd::Project& project_, gd::Layout& layout_) - : project(project_), layout(layout_){}; - virtual ~SpriteObjectsPositionUpdater(){}; - - virtual void operator()(gd::InitialInstance& instance) { - gd::Object* object = NULL; - if (layout.HasObjectNamed(instance.GetObjectName())) - object = &layout.GetObject(instance.GetObjectName()); - else if (project.HasObjectNamed(instance.GetObjectName())) - object = &project.GetObject(instance.GetObjectName()); - else - return; - - if (object->GetType() != "Sprite") return; - if (!instance.HasCustomSize()) return; - - wxSetWorkingDirectory( - wxFileName::FileName(project.GetProjectFile()).GetPath()); - object->LoadResources(project, layout); - - sf::Vector2f size = - object->GetInitialInstanceDefaultSize(instance, project, layout); - - instance.SetX(instance.GetX() + size.x / 2 - instance.GetCustomWidth() / 2); - instance.SetY(instance.GetY() + size.y / 2 - - instance.GetCustomHeight() / 2); - } - - private: - gd::Project& project; - gd::Layout& layout; -}; -// End of compatibility code -#endif - void Project::UnserializeFrom(const SerializerElement& element) { // Checking version #if defined(GD_IDE_ONLY) @@ -824,16 +776,6 @@ void Project::UnserializeFrom(const SerializerElement& element) { gd::Layout& layout = InsertNewLayout( layoutElement.GetStringAttribute("name", "", "nom"), -1); layout.UnserializeFrom(*this, layoutElement); - -// Compatibility code with GD 2.x -#if defined(GD_IDE_ONLY) && !defined(GD_NO_WX_GUI) - if (gdMajorVersion <= 2) { - SpriteObjectsPositionUpdater updater(*this, layout); - gd::InitialInstancesContainer& instances = layout.GetInitialInstances(); - instances.IterateOverInstances(updater); - } -#endif - // End of compatibility code } #if defined(GD_IDE_ONLY) diff --git a/Core/GDCore/Tools/FileStream.h b/Core/GDCore/Tools/FileStream.h index 1642010de0..d951a6e25a 100644 --- a/Core/GDCore/Tools/FileStream.h +++ b/Core/GDCore/Tools/FileStream.h @@ -8,9 +8,7 @@ #include "GDCore/String.h" -#define FSTREAM_WINDOWS_MINGW defined(WINDOWS) && __GLIBCXX__ - -#if FSTREAM_WINDOWS_MINGW +#if defined(WINDOWS) && __GLIBCXX__ #include #else #include //for std::filebuf @@ -25,7 +23,7 @@ namespace gd { */ class GD_CORE_API FileStream : public std::iostream { public: -#if FSTREAM_WINDOWS_MINGW +#if defined(WINDOWS) && __GLIBCXX__ using InternalBufferType = __gnu_cxx::stdio_filebuf; #else using InternalBufferType = std::filebuf; diff --git a/Core/GDCore/Tools/Localization.h b/Core/GDCore/Tools/Localization.h index 8ea2172aaa..500672570d 100644 --- a/Core/GDCore/Tools/Localization.h +++ b/Core/GDCore/Tools/Localization.h @@ -13,24 +13,11 @@ * are marked with the underscore macro, for example: _("Hello World"). * * The macro is then defined to be using the translation function - * of the underlying platform (Emscripten for GD5, wxWidgets for GD4, + * of the underlying platform (Emscripten for GDevelop 5, * no translation for GDCpp Runtime). */ -#if defined(GD_IDE_ONLY) && !defined(GD_NO_WX_GUI) -// When compiling with wxWidgets, use the translation method -// provided by wxWidgets, but return a gd::String. - -#include -#include "GDCore/String.h" - -// Create a new macro to return UTF8 gd::String from a translation -#if defined(_) -#undef _ -#endif -#define _(s) gd::String(wxGetTranslation(wxString::FromUTF8(u8##s))) - -#elif defined(EMSCRIPTEN) +#if defined(EMSCRIPTEN) // When compiling with Emscripten, use a translation function that is calling a // JS method on the module, so that an external translation library can be used. diff --git a/Core/GDCore/Tools/Log.cpp b/Core/GDCore/Tools/Log.cpp index 5681cf90bc..5a45b0b5ec 100644 --- a/Core/GDCore/Tools/Log.cpp +++ b/Core/GDCore/Tools/Log.cpp @@ -3,63 +3,25 @@ * Copyright 2008-2016 Florian Rival (Florian.Rival@gmail.com). All rights * reserved. This project is released under the MIT License. */ -#if defined(GD_IDE_ONLY) && !defined(GD_NO_WX_GUI) -#include -#else #include -#endif #include "GDCore/String.h" namespace gd { -/** - * \brief Standard function that should be used when emitting a warning to be - * displayed to the user. When used in the IDE, this result in a message box - * with a exclamation icon. - */ void GD_CORE_API LogWarning(const gd::String& msg) { -#if defined(GD_IDE_ONLY) && !defined(GD_NO_WX_GUI) - wxLogWarning(msg.ToWxString()); -#else std::cout << "WARNING: " << msg; -#endif } -/** - * \brief Standard function that should be used when emitting an error to be - * displayed to the user. When used in the IDE, this result in a message box - * with a error icon. - */ void GD_CORE_API LogError(const gd::String& msg) { -#if defined(GD_IDE_ONLY) && !defined(GD_NO_WX_GUI) - wxLogError(msg.ToWxString()); -#else std::cout << "ERROR: " << msg; -#endif } -/** - * \brief Standard function that should be used when emitting a message to be - * displayed to the user. When used in the IDE, this result in a message box. - */ void GD_CORE_API LogMessage(const gd::String& msg) { -#if defined(GD_IDE_ONLY) && !defined(GD_NO_WX_GUI) - wxLogMessage(msg.ToWxString()); -#else std::cout << "MESSAGE: " << msg; -#endif } -/** - * \brief Standard function that should be used when emitting a status message - * to be displayed to the user. When used in the IDE, this result in a message - * displayed in the status bar. - */ + void GD_CORE_API LogStatus(const gd::String& msg) { -#if defined(GD_IDE_ONLY) && !defined(GD_NO_WX_GUI) - wxLogStatus(msg.ToWxString()); -#else std::cout << "STATUS: " << msg; -#endif } } // namespace gd diff --git a/Core/GDCore/Tools/Log.h b/Core/GDCore/Tools/Log.h index 6b705440e6..ba0e4f23dd 100644 --- a/Core/GDCore/Tools/Log.h +++ b/Core/GDCore/Tools/Log.h @@ -7,35 +7,29 @@ #define GDCORE_LOG_H #include #include "GDCore/String.h" -#if defined(GD_IDE_ONLY) && !defined(GD_NO_WX_GUI) -#include -#endif namespace gd { /** * \brief Standard function that should be used when emitting a warning to be - * displayed to the user. When used in the IDE, this result in a message box - * with a exclamation icon. + * displayed to the user. */ void GD_CORE_API LogWarning(const gd::String& msg); /** * \brief Standard function that should be used when emitting an error to be - * displayed to the user. When used in the IDE, this result in a message box - * with a error icon. + * displayed to the user. */ void GD_CORE_API LogError(const gd::String& msg); /** * \brief Standard function that should be used when emitting a message to be - * displayed to the user. When used in the IDE, this result in a message box. + * displayed to the user. */ void GD_CORE_API LogMessage(const gd::String& msg); /** * \brief Standard function that should be used when emitting a status message - * to be displayed to the user. When used in the IDE, this result in a message - * displayed in the status bar. + * to be displayed to the user. */ void GD_CORE_API LogStatus(const gd::String& msg); diff --git a/Extensions/ParticleSystem/ParticleEmitterObject.cpp b/Extensions/ParticleSystem/ParticleEmitterObject.cpp index 1aca94724e..35cf2d5078 100644 --- a/Extensions/ParticleSystem/ParticleEmitterObject.cpp +++ b/Extensions/ParticleSystem/ParticleEmitterObject.cpp @@ -623,6 +623,17 @@ void ParticleEmitterObject::ExposeResources( SetParticleTexture(texture); } +void RuntimeParticleEmitterObject::GetPropertyForDebugger( + std::size_t propertyNb, gd::String& name, gd::String& value) const { + if (!GetParticleSystem() || !GetParticleSystem()->particleSystem) return; + + if (propertyNb == 0) { + name = _("Particles number"); + value = + gd::String::From(GetParticleSystem()->particleSystem->getNbParticles()); + } +} + bool RuntimeParticleEmitterObject::ChangeProperty(std::size_t propertyNb, gd::String newValue) { if (propertyNb == 0) { diff --git a/Extensions/PrimitiveDrawing/ShapePainterObject.cpp b/Extensions/PrimitiveDrawing/ShapePainterObject.cpp index ba516f1aae..7368dab2a4 100644 --- a/Extensions/PrimitiveDrawing/ShapePainterObject.cpp +++ b/Extensions/PrimitiveDrawing/ShapePainterObject.cpp @@ -5,9 +5,6 @@ Copyright (c) 2008-2016 Florian Rival (Florian.Rival@gmail.com) This project is released under the MIT License. */ -#if defined(GD_IDE_ONLY) && !defined(GD_NO_WX_GUI) -#include //Must be placed first, otherwise we get errors relative to "cannot convert 'const TCHAR*'..." in wx/msw/winundef.h -#endif #include #include "GDCore/Tools/Localization.h" #include "GDCpp/Runtime/CommonTools.h" @@ -25,11 +22,6 @@ This project is released under the MIT License. #include "GDCpp/Runtime/CommonTools.h" #endif -#if defined(GD_IDE_ONLY) && !defined(GD_NO_WX_GUI) -sf::Texture ShapePainterObject::edittimeIconImage; -sf::Sprite ShapePainterObject::edittimeIcon; -#endif - using namespace std; ShapePainterObjectBase::ShapePainterObjectBase() diff --git a/Extensions/SkeletonObject/SkeletonObject.h b/Extensions/SkeletonObject/SkeletonObject.h index 71f1d9a687..d2eb8af474 100644 --- a/Extensions/SkeletonObject/SkeletonObject.h +++ b/Extensions/SkeletonObject/SkeletonObject.h @@ -23,7 +23,7 @@ class GD_EXTENSION_API SkeletonObject : public gd::Object { public: SkeletonObject(gd::String name_); virtual ~SkeletonObject(){}; - virtual std::unique_ptr Clone() const { + virtual std::unique_ptr Clone() const override { return gd::make_unique(*this); } diff --git a/GDCpp/GDCpp/Events/Builtin/CppCodeEvent.cpp b/GDCpp/GDCpp/Events/Builtin/CppCodeEvent.cpp index 35e43f9645..03df08486d 100644 --- a/GDCpp/GDCpp/Events/Builtin/CppCodeEvent.cpp +++ b/GDCpp/GDCpp/Events/Builtin/CppCodeEvent.cpp @@ -5,7 +5,6 @@ */ #if defined(GD_IDE_ONLY) - #include "CppCodeEvent.h" #include #include @@ -14,9 +13,6 @@ #include "GDCore/Events/CodeGeneration/ExpressionsCodeGeneration.h" #include "GDCore/Events/Serialization.h" #include "GDCore/Events/Tools/EventsCodeNameMangler.h" -#include "GDCore/IDE/Dialogs/EventsEditor/EventsEditorItemsAreas.h" -#include "GDCore/IDE/Dialogs/EventsEditor/EventsEditorSelection.h" -#include "GDCore/IDE/Dialogs/EventsEditor/EventsRenderingHelper.h" #include "GDCore/Project/Layout.h" #include "GDCore/Project/Project.h" #include "GDCore/Project/SourceFile.h" @@ -24,87 +20,11 @@ #include "GDCore/Tools/FileStream.h" #include "GDCore/Tools/Localization.h" #include "GDCore/Tools/Log.h" -#include "GDCpp/IDE/CodeCompiler.h" -#include "GDCpp/IDE/Dialogs/EditCppCodeEvent.h" #include "GDCpp/Runtime/CommonTools.h" #include "GDCpp/Runtime/RuntimeScene.h" -#include "GDCpp/Runtime/TinyXml/tinyxml.h" using namespace std; -void CppCodeEvent::EnsureAssociatedSourceFileIsUpToDate( - gd::Project& project) const { -#if !defined(GD_NO_WX_GUI) - gd::String outputFile(CodeCompiler::Get()->GetOutputDirectory() + "GD" + - gd::String::From(this) + "SourceFile.cpp"); - - gd::SourceFile* sourceFile; - // First check if the associated source file exists in the GD project. - if (project.HasSourceFile(associatedGDManagedSourceFile, "C++")) - sourceFile = &project.GetSourceFile(associatedGDManagedSourceFile); - else { - // If there is no associated source file existing, then create a new one - sourceFile = &project.InsertNewSourceFile(outputFile, "C++"); - sourceFile->SetGDManaged(true); - } - - // Then check if the associated source file is up to date - associatedGDManagedSourceFile = outputFile; - if (sourceFile->GetFileName() != outputFile) { - sourceFile->SetFileName(outputFile); - } else if (wxFileExists(outputFile)) { - wxFileName sourceFileInfo(outputFile); - if (sourceFileInfo.GetModificationTime().GetTicks() >= lastChangeTimeStamp) - return; - } - - // The associated source file is non existing or not up to date: Regenerate - // it. It will be compiled ( see CodeCompilationHelpers ) as it will be - // detected ( by DependenciesAnalyzer ) as a SourceFile dependency which is - // not up to date. - gd::FileStream file; - file.open(outputFile, std::ios_base::out); - file << GenerateAssociatedFileCode(); - file.close(); -#else - gd::LogError( - "BAD USE: C++ Code event not supported when wxWidgets support is " - "disabled"); -#endif -} - -gd::String CppCodeEvent::GenerateAssociatedFileCode() const { -#if !defined(GD_NO_WX_GUI) - gd::String functionPrototype = - "void " + GetFunctionToCall() + "(" + - (passSceneAsParameter ? "RuntimeScene & scene" : "") + - ((passSceneAsParameter && passObjectListAsParameter) ? ", " : "") + - (passObjectListAsParameter ? "std::vector objectsList" - : "") + - ")"; - gd::String output; - if (passSceneAsParameter) - output += "#include \"GDCpp/Runtime/RuntimeScene.h\"\n"; - if (passObjectListAsParameter) - output += "#include \"GDCpp/Runtime/Project/Object.h\"\n"; - for (const auto& includeFile : includeFiles) { - if (!includeFile.empty()) output += "#include " + includeFile + "\n"; - } - - output += functionPrototype + "\n"; - output += "{\n"; - output += inlineCode; - output += "}\n"; - - return output; -#else - gd::LogError( - "BAD USE: C++ Code event not supported when wxWidgets support is " - "disabled"); - return ""; -#endif -} - void CppCodeEvent::SerializeTo(gd::SerializerElement& element) const { element.SetAttribute("functionToCall", functionToCall); element.SetAttribute("functionNameAutogenerated", functionNameAutogenerated); diff --git a/GDCpp/GDCpp/Events/Builtin/CppCodeEvent.h b/GDCpp/GDCpp/Events/Builtin/CppCodeEvent.h index 700a58db90..7380f744b9 100644 --- a/GDCpp/GDCpp/Events/Builtin/CppCodeEvent.h +++ b/GDCpp/GDCpp/Events/Builtin/CppCodeEvent.h @@ -58,7 +58,6 @@ class CppCodeEvent : public gd::BaseEvent { const gd::String& GetAssociatedGDManagedSourceFile( gd::Project& parentGame) const { - EnsureAssociatedSourceFileIsUpToDate(parentGame); return associatedGDManagedSourceFile; }; @@ -95,7 +94,6 @@ class CppCodeEvent : public gd::BaseEvent { bool IsCodeDisplayedInEditor() const { return codeDisplayedInEditor; }; void EnableCodeDisplayedInEditor(bool enable) { codeDisplayedInEditor = enable; - eventHeightNeedUpdate = true; }; const gd::String& GetDisplayedName() const { return displayedName; }; @@ -109,7 +107,6 @@ class CppCodeEvent : public gd::BaseEvent { private: void Init(const CppCodeEvent& event); - gd::String GenerateAssociatedFileCode() const; void AutogenerateFunctionName() const; std::vector includeFiles; diff --git a/GDCpp/GDCpp/Extensions/CppPlatform.h b/GDCpp/GDCpp/Extensions/CppPlatform.h index 70b6c60433..eefb938933 100644 --- a/GDCpp/GDCpp/Extensions/CppPlatform.h +++ b/GDCpp/GDCpp/Extensions/CppPlatform.h @@ -100,6 +100,8 @@ class GD_API CppPlatform : public gd::Platform { runtimeObjCreationFunctionTable; ///< The C++ Platform also need to store ///< functions to create runtime ///< objects. + + static CppPlatform* singleton; }; #endif // PLATFORM_H diff --git a/GDCpp/GDCpp/IDE/BaseDebugger.cpp b/GDCpp/GDCpp/IDE/BaseDebugger.cpp new file mode 100644 index 0000000000..7957ac63d3 --- /dev/null +++ b/GDCpp/GDCpp/IDE/BaseDebugger.cpp @@ -0,0 +1,18 @@ +/* + * GDevelop C++ Platform + * Copyright 2008-2016 Florian Rival (Florian.Rival@gmail.com). All rights + * reserved. This project is released under the MIT License. + */ + +#if defined(GD_IDE_ONLY) +#include "GDCpp/IDE/BaseDebugger.h" + +void BaseDebugger::Update() { + if (timeInterval.getElapsedTime().asMilliseconds() > + 200) // Update each 200 ms + { + UpdateGUI(); + timeInterval.restart(); + } +} +#endif diff --git a/GDCpp/GDCpp/IDE/BaseDebugger.h b/GDCpp/GDCpp/IDE/BaseDebugger.h new file mode 100644 index 0000000000..5cf8394fcf --- /dev/null +++ b/GDCpp/GDCpp/IDE/BaseDebugger.h @@ -0,0 +1,44 @@ +/* + * GDevelop C++ Platform + * Copyright 2008-2016 Florian Rival (Florian.Rival@gmail.com). All rights reserved. + * This project is released under the MIT License. + */ + +#if defined(GD_IDE_ONLY) +#ifndef BASEDEBUGGER_H +#define BASEDEBUGGER_H +#include + +class RuntimeObject; + +/** + * \brief Internal base class to implement a debugger. + * Derive from this class and implement + * UpdateGUI function which be called + * automatically by the scene + */ +class GD_API BaseDebugger +{ + public: + BaseDebugger() {}; + virtual ~BaseDebugger() {}; + + /** + * Called at each frame by RuntimeScene + */ + void Update(); + + virtual void OnRuntimeObjectAdded(RuntimeObject * object) {}; + virtual void OnRuntimeObjectAboutToBeRemoved(RuntimeObject * object) {}; + + virtual void OnRuntimeObjectListFullRefresh() {}; + + protected: + private: + virtual void UpdateGUI() = 0; + + sf::Clock timeInterval; +}; + +#endif // BASEDEBUGGER_H +#endif diff --git a/GDCpp/GDCpp/IDE/BaseProfiler.cpp b/GDCpp/GDCpp/IDE/BaseProfiler.cpp new file mode 100644 index 0000000000..8142db8d5c --- /dev/null +++ b/GDCpp/GDCpp/IDE/BaseProfiler.cpp @@ -0,0 +1,47 @@ +/* + * GDevelop C++ Platform + * Copyright 2008-2016 Florian Rival (Florian.Rival@gmail.com). All rights + * reserved. This project is released under the MIT License. + */ +#if defined(GD_IDE_ONLY) + +#include "BaseProfiler.h" + +/** + * Reset() only reset the profile clock, not the time registered. + */ +void ProfileLink::Reset() { profileClock.reset(); } + +/** + * Add the time of the profile clock to the total time. + */ +void ProfileLink::Stop() { time += profileClock.getTimeMicroseconds(); } + +BaseProfiler::BaseProfiler() + : profilingActivated(false), + lastEventsTime(0), + lastRenderingTime(0), + totalSceneTime(0), + totalEventsTime(0), + stepTime(50) { + // ctor +} + +void BaseProfiler::Update() { + if (stepClock.getElapsedTime().asMilliseconds() > stepTime) { + UpdateGUI(); + stepClock.restart(); + } +} + +void BaseProfiler::Reset() { + lastEventsTime = 0; + lastRenderingTime = 0; + totalSceneTime = 0; + totalEventsTime = 0; + + for (std::size_t i = 0; i < profileEventsInformation.size(); ++i) { + profileEventsInformation[i].time = 0; + } +} +#endif diff --git a/GDCpp/GDCpp/IDE/BaseProfiler.h b/GDCpp/GDCpp/IDE/BaseProfiler.h new file mode 100644 index 0000000000..60192076d1 --- /dev/null +++ b/GDCpp/GDCpp/IDE/BaseProfiler.h @@ -0,0 +1,71 @@ +/* + * GDevelop C++ Platform + * Copyright 2008-2016 Florian Rival (Florian.Rival@gmail.com). All rights reserved. + * This project is released under the MIT License. + */ + +#if defined(GD_IDE_ONLY) + +#ifndef BASEPROFILER_H +#define BASEPROFILER_H +#include +#include +#include +#include "GDCpp/Runtime/profile.h" +namespace gd { class BaseEvent; } + +/** + * \brief Internal class used as a link between compiled events code and events. + */ +class ProfileLink +{ +public: + ProfileLink() : time(0) {}; + + void Reset(); + void Stop(); + unsigned long int GetTime() const { return time; } + + btClock profileClock; + unsigned long int time; + std::weak_ptr originalEvent; +}; + +/** + * \brief Base class to create a profiler. + */ +class GD_API BaseProfiler +{ +public: + BaseProfiler(); + virtual ~BaseProfiler() {}; + + bool profilingActivated; ///< Set this to true so as to activate profiling. + + unsigned long int lastEventsTime; ///< Time used by events during the last frame + unsigned long int lastRenderingTime; ///< Time used by rendering during the last frame + unsigned long int totalSceneTime; ///< Total time used by events and rendering since the beginning. + unsigned long int totalEventsTime; ///< Total time used by events since the beginning. + + btClock eventsClock; ///< Used to compute time used by events during the frame + btClock renderingClock; ///< Used to compute time used by rendering during the frame + + std::vector profileEventsInformation; ///< Used by events generated code + + void Update(); + void Reset(); + +protected: + sf::Uint32 stepTime; ///< Time between each UpdateGUI, in milliseconds. + + /** + * Redefine this function so as to update GUI. + */ + virtual void UpdateGUI() = 0; +private: + sf::Clock stepClock; +}; + +#endif // BASEPROFILER_H +#endif + diff --git a/GDCpp/GDCpp/Runtime/RuntimeScene.cpp b/GDCpp/GDCpp/Runtime/RuntimeScene.cpp index 7b77a85989..6f2f3de020 100644 --- a/GDCpp/GDCpp/Runtime/RuntimeScene.cpp +++ b/GDCpp/GDCpp/Runtime/RuntimeScene.cpp @@ -3,9 +3,6 @@ * Copyright 2008-2016 Florian Rival (Florian.Rival@gmail.com). All rights * reserved. This project is released under the MIT License. */ -#if defined(GD_IDE_ONLY) && !defined(GD_NO_WX_GUI) -#include //Must be include first otherwise we get nice errors relative to "cannot convert 'const TCHAR*'..." in wx/msw/winundef.h -#endif #include #include #include diff --git a/GDCpp/GDCpp/Runtime/RuntimeScene.h b/GDCpp/GDCpp/Runtime/RuntimeScene.h index 27a044aab3..8172ef0810 100644 --- a/GDCpp/GDCpp/Runtime/RuntimeScene.h +++ b/GDCpp/GDCpp/Runtime/RuntimeScene.h @@ -14,23 +14,17 @@ #include "GDCpp/Runtime/BehaviorsRuntimeSharedDataHolder.h" #include "GDCpp/Runtime/InputManager.h" #include "GDCpp/Runtime/ObjInstancesHolder.h" -#include "GDCpp/Runtime/Project/Layout.h" //This include must be placed first +#include "GDCpp/Runtime/Project/Layout.h" #include "GDCpp/Runtime/RuntimeLayer.h" #include "GDCpp/Runtime/RuntimeVariablesContainer.h" #include "GDCpp/Runtime/TimeManager.h" namespace sf { class RenderWindow; -} -namespace sf { class Event; } namespace gd { class Project; -} -namespace gd { class Object; -} -namespace gd { class ImageManager; } class RuntimeLayer; diff --git a/GDJS/GDJS/Events/Builtin/JsCodeEvent.cpp b/GDJS/GDJS/Events/Builtin/JsCodeEvent.cpp index 66616acac7..fbd348bc8c 100644 --- a/GDJS/GDJS/Events/Builtin/JsCodeEvent.cpp +++ b/GDJS/GDJS/Events/Builtin/JsCodeEvent.cpp @@ -6,19 +6,12 @@ #include "JsCodeEvent.h" #include #include -#if !defined(GD_NO_WX_GUI) -#include -#include -#endif #include "GDCore/CommonTools.h" #include "GDCore/Events/CodeGeneration/EventsCodeGenerationContext.h" #include "GDCore/Events/CodeGeneration/EventsCodeGenerator.h" #include "GDCore/Events/CodeGeneration/ExpressionsCodeGeneration.h" #include "GDCore/Events/Serialization.h" #include "GDCore/Events/Tools/EventsCodeNameMangler.h" -#include "GDCore/IDE/Dialogs/EventsEditor/EventsEditorItemsAreas.h" -#include "GDCore/IDE/Dialogs/EventsEditor/EventsEditorSelection.h" -#include "GDCore/IDE/Dialogs/EventsEditor/EventsRenderingHelper.h" #include "GDCore/Project/Layout.h" #include "GDCore/Project/Project.h" #include "GDCore/Project/SourceFile.h" diff --git a/Readme.md b/Readme.md index 40e7fd0c20..03e86381fa 100644 --- a/Readme.md +++ b/Readme.md @@ -10,9 +10,8 @@ Getting started [![Build Status](https://semaphoreci.com/api/v1/4ian/gd/branches | ❔ I want to... | 🚀 What to do | | --- | --- | | Download GDevelop to make games | Go on [GDevelop website](https://gdevelop-app.com) to download GD! | -| Contribute to the new editor | Download [Node.js] and follow this [README](newIDE/README.md). | +| Contribute to the editor | Download [Node.js] and follow this [README](newIDE/README.md). | | Create/improve an extension | Download [Node.js] and follow this [README](newIDE/README-extensions.md). | -| Contribute to the old C++ editor | Download and launch [CMake], choose this directory as the source, generate the Makefile and launch it. Be sure to have [required development libraries](http://4ian.github.io/GD-Documentation/GDCore%20Documentation/setup_dev_env.html) installed.

Fully detailed instructions are [available here](http://4ian.github.io/GD-Documentation). | | Help to translate GDevelop | Go on the [GDevelop project on Crowdin](https://crowdin.com/project/gdevelop). | Overview of the architecture @@ -23,7 +22,6 @@ Overview of the architecture | `Core` | GDevelop core library, containing common tools to implement the IDE and work with GDevelop games. | | `GDCpp` | GDevelop C++ game engine, used to **build native games**. | | `GDJS` | GDevelop JS game engine, used to build **HTML5 games**. | -| `IDE` | The editor (written in C++). Binaries are created in `Binaries/Output` folder. | | `newIDE` | The new editor, written in Javascript with React, Electron and Pixi.js. | | `Extensions` | Extensions for C++ or JS game engines, providing objects, events and new features. | @@ -61,8 +59,7 @@ Links License ------- -* The Core library, the native and HTML5 game engines, the new IDE, and all extensions (respectively `Core`, `GDCpp`, `GDJS`, `new IDE` and `Extensions` folders) are under the **MIT license**. -* The IDE (in the `IDE` folder) is licensed with **GPL v3**. +* The Core library, the native and HTML5 game engines, the IDE, and all extensions (respectively `Core`, `GDCpp`, `GDJS`, `new IDE` and `Extensions` folders) are under the **MIT license**. * The name, GDevelop, and its logo are the exclusive property of Florian Rival. Games exported with GDevelop are based on the native and/or HTML5 game engines (see `Core`, `GDCpp` and `GDJS` folders): these engines are distributed under the MIT license, so that you can **distribute, sell or do anything** with the games you created with GDevelop. In particular, you are not forced to make your game open source.