Browse Source

Project handling improvements, fix for issue with Graphics::RaiseWindow on Windows (fixed in SDL)

Josh Engebretson 9 years ago
parent
commit
83884d62e8

+ 33 - 4
Script/AtomicEditor/ui/modal/build/BuildSettingsWindow.ts

@@ -142,6 +142,11 @@ export class BuildSettingsWindow extends ModalWindow {
 
                 var index = this.platformSelect.value;
 
+                var showMessage = function(target, title, message) {
+                    var window = new Atomic.UIMessageWindow(target, "modal_error");
+                    window.show(title, message, Atomic.UI_MESSAGEWINDOW_SETTINGS_OK, true, 640, 260);
+                }
+
                 for (var name in this.platformInfo) {
 
                     var info: { widget: Atomic.UIWidget, index: number, logo: string } = this.platformInfo[name];
@@ -150,18 +155,42 @@ export class BuildSettingsWindow extends ModalWindow {
 
                         var platform = toolSystem.getPlatformByName(name);
 
-                        if (platform.platformID == ToolCore.PLATFORMID_IOS) {
+                        // Do we have a C# project?
+                        if (ToolCore.netProjectSystem.solutionAvailable) {
 
-                            if (Atomic.platform == "Windows") {
+                            if (platform.platformID == ToolCore.PLATFORMID_WEB) {
 
-                                var message = "\niOS Deployment requires running the Atomic Editor on MacOSX\n\n";
-                                new Atomic.UIMessageWindow(this, "modal_error").show("MacOSX Required", message, Atomic.UI_MESSAGEWINDOW_SETTINGS_OK, true, 640, 260);
+                                showMessage(this, "Platform Info", "\nThe web platform is not available when using C# at this time\n\n");
                                 return true;
 
                             }
 
+                            if (platform.platformID == ToolCore.PLATFORMID_IOS || platform.platformID == ToolCore.PLATFORMID_ANDROID) {
+
+                                var ide = Atomic.platform == "Windows" ? "Visual Studio" : "Xamarin Studio";
+                                var message = `Please open the following solution in ${ide}:\n\n ${ToolCore.netProjectSystem.solutionPath}\n\n`;
+                                message += "HINT: You can open the solution by clicking on any C# script in the project or from the Developer->Plugins->AtomicNET menu\n";
+                                showMessage(this, "IDE Deployment Required", message);
+                                return true;
+                            }
+
+
+                        } else {
+
+                            if (platform.platformID == ToolCore.PLATFORMID_IOS) {
+
+                                if (Atomic.platform == "Windows") {
+
+                                    showMessage(this, "MacOSX Required", "\niOS Deployment requires running the Atomic Editor on MacOSX\n\n");
+                                    return true;
+
+                                }
+
+                            }
+
                         }
 
+
                         toolSystem.setCurrentPlatform(platform.platformID);
 
                         return true;

+ 2 - 1
Source/AtomicApp/Player/IPCPlayerApp.cpp

@@ -194,7 +194,8 @@ namespace Atomic
             SubscribeToEvent(E_PLAYERQUIT, ATOMIC_HANDLER(IPCPlayerApp, HandleQuit));
         }
 
-        
+        GetSubsystem<Graphics>()->RaiseWindow();
+
 
     }
 

+ 3 - 0
Source/AtomicEditor/EditorMode/AEEditorMode.cpp

@@ -128,6 +128,9 @@ void EditorMode::HandleIPCJSError(StringHash eventType, VariantMap& eventData)
 
 bool EditorMode::PlayProject(String addArgs, bool debug)
 {
+    if (playerBroker_.NotNull())
+        return false;
+
     FileSystem* fileSystem = GetSubsystem<FileSystem>();
     ToolSystem* tsystem = GetSubsystem<ToolSystem>();
     ToolEnvironment* tenv = GetSubsystem<ToolEnvironment>();

+ 6 - 1
Source/ThirdParty/SDL/src/video/windows/SDL_windowswindow.c

@@ -488,7 +488,12 @@ WIN_HideWindow(_THIS, SDL_Window * window)
 void
 WIN_RaiseWindow(_THIS, SDL_Window * window)
 {
-    WIN_SetWindowPositionInternal(_this, window, SWP_NOCOPYBITS | SWP_NOMOVE | SWP_NOSIZE);
+    // ATOMIC BEGIN
+    // See: http://hg.libsdl.org/SDL/rev/76e7fa1a446d
+    // WIN_SetWindowPositionInternal(_this, window, SWP_NOCOPYBITS | SWP_NOMOVE | SWP_NOSIZE);
+    HWND hwnd = ((SDL_WindowData *)window->driverdata)->hwnd;
+    SetForegroundWindow(hwnd);
+    // ATOMIC END
 }
 
 void

+ 5 - 1
Source/ToolCore/NETTools/NETProjectSystem.cpp

@@ -327,7 +327,11 @@ namespace ToolCore
         {
             fileSystem->ScanDir(results, AddTrailingSlash(projectPath) + "Resources", "*.dll", SCAN_FILES, true);
             if (!results.Size())
-                return;
+            {
+                solutionPath_.Clear();
+                return;                
+            }
+                
         }            
 
         // if the solution or project assemblies don't exist mark as dirty

+ 3 - 0
Source/ToolCore/NETTools/NETProjectSystem.h

@@ -52,6 +52,9 @@ namespace ToolCore
 
         bool GetIDEAvailable() const { return idePath_.Length() != 0; }
 
+        /// Returns true if there is a solution available for the loaded project (true = managed app)
+        bool GetSolutionAvailable() const { return solutionPath_.Length() != 0; }
+
         const String& GetSolutionPath() const { return solutionPath_; }
 
         void BuildAtomicProject();