Просмотр исходного кода

Project export window in IDE and Mac export, fixed StandalonePlayer not quitting properly

Ivan Safrin 13 лет назад
Родитель
Сommit
2b15068944

+ 16 - 1
IDE/Build/Mac OS X/English.lproj/MainMenu.xib

@@ -1124,6 +1124,14 @@
 					</object>
 					<int key="connectionID">590</int>
 				</object>
+				<object class="IBConnectionRecord">
+					<object class="IBActionConnection" key="connection">
+						<string key="label">exportProject:</string>
+						<reference key="source" ref="976324537"/>
+						<reference key="destination" ref="656074920"/>
+					</object>
+					<int key="connectionID">591</int>
+				</object>
 			</object>
 			<object class="IBMutableOrderedSet" key="objectRecords">
 				<object class="NSArray" key="orderedObjects">
@@ -1889,7 +1897,7 @@
 				<reference key="dict.values" ref="0"/>
 			</object>
 			<nil key="sourceID"/>
-			<int key="maxID">590</int>
+			<int key="maxID">591</int>
 		</object>
 		<object class="IBClassDescriber" key="IBDocument.Classes">
 			<object class="NSMutableArray" key="referencedPartialClassDescriptions">
@@ -1903,6 +1911,7 @@
 							<bool key="EncodedWithXMLCoder">YES</bool>
 							<string>browseExamples:</string>
 							<string>closeProject:</string>
+							<string>exportProject:</string>
 							<string>findText:</string>
 							<string>newFile:</string>
 							<string>newGroup:</string>
@@ -1928,6 +1937,7 @@
 							<string>id</string>
 							<string>id</string>
 							<string>id</string>
+							<string>id</string>
 						</object>
 					</object>
 					<object class="NSMutableDictionary" key="actionInfosByName">
@@ -1936,6 +1946,7 @@
 							<bool key="EncodedWithXMLCoder">YES</bool>
 							<string>browseExamples:</string>
 							<string>closeProject:</string>
+							<string>exportProject:</string>
 							<string>findText:</string>
 							<string>newFile:</string>
 							<string>newGroup:</string>
@@ -1957,6 +1968,10 @@
 								<string key="name">closeProject:</string>
 								<string key="candidateClassName">id</string>
 							</object>
+							<object class="IBActionInfo">
+								<string key="name">exportProject:</string>
+								<string key="candidateClassName">id</string>
+							</object>
 							<object class="IBActionInfo">
 								<string key="name">findText:</string>
 								<string key="candidateClassName">id</string>

+ 6 - 0
IDE/Build/Mac OS X/Polycode.xcodeproj/project.pbxproj

@@ -28,6 +28,7 @@
 		6D8A55B914B3EABB005F6411 /* main_icon.icns in Resources */ = {isa = PBXBuildFile; fileRef = 6D8A55B814B3EABB005F6411 /* main_icon.icns */; };
 		6D8A55BC14B3EACB005F6411 /* PolycodeView.mm in Sources */ = {isa = PBXBuildFile; fileRef = 6D8A55BB14B3EACB005F6411 /* PolycodeView.mm */; };
 		6D91B3B512AF2B1D00261ED4 /* PolycodeTextEditor.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 6D91B3B412AF2B1D00261ED4 /* PolycodeTextEditor.cpp */; };
+		6DC825791648571E006AFC03 /* ExportProjectWindow.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 6DC825781648571E006AFC03 /* ExportProjectWindow.cpp */; };
 		6DCAFD4314B519C900039F34 /* ExampleBrowserWindow.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 6DCAFD4214B519C900039F34 /* ExampleBrowserWindow.cpp */; };
 		6DCE857A12AE018800566FAE /* PolycodeEditor.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 6DCE857812AE018800566FAE /* PolycodeEditor.cpp */; };
 		6DCE857B12AE018800566FAE /* PolycodeEditorManager.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 6DCE857912AE018800566FAE /* PolycodeEditorManager.cpp */; };
@@ -108,6 +109,8 @@
 		6D8A55BB14B3EACB005F6411 /* PolycodeView.mm */ = {isa = PBXFileReference; explicitFileType = sourcecode.cpp.objcpp; fileEncoding = 4; name = PolycodeView.mm; path = ../../../Release/Darwin/Framework/Core/PolycodeView/PolycodeView.mm; sourceTree = "<group>"; };
 		6D91B3B312AF2B1600261ED4 /* PolycodeTextEditor.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = PolycodeTextEditor.h; sourceTree = "<group>"; };
 		6D91B3B412AF2B1D00261ED4 /* PolycodeTextEditor.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = PolycodeTextEditor.cpp; sourceTree = "<group>"; };
+		6DC825781648571E006AFC03 /* ExportProjectWindow.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = ExportProjectWindow.cpp; sourceTree = "<group>"; };
+		6DC8257B16485726006AFC03 /* ExportProjectWindow.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ExportProjectWindow.h; sourceTree = "<group>"; };
 		6DCAFD4214B519C900039F34 /* ExampleBrowserWindow.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = ExampleBrowserWindow.cpp; sourceTree = "<group>"; };
 		6DCAFD4614B51A2D00039F34 /* ExampleBrowserWindow.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ExampleBrowserWindow.h; sourceTree = "<group>"; };
 		6DCE857612AE018000566FAE /* PolycodeEditor.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = PolycodeEditor.h; sourceTree = "<group>"; };
@@ -256,6 +259,7 @@
 		6D80E91212AB53FB0037A708 /* Include */ = {
 			isa = PBXGroup;
 			children = (
+				6DC8257B16485726006AFC03 /* ExportProjectWindow.h */,
 				6D80B0D0163B14D100EF3C04 /* PolycodeMaterialEditor.h */,
 				6DD1835F1628A4D2005A5682 /* PolycodeRemoteDebugger.h */,
 				6D3DC79F16220440003ED2C9 /* PolycodeConsole.h */,
@@ -285,6 +289,7 @@
 		6D80E91812AB53FB0037A708 /* Source */ = {
 			isa = PBXGroup;
 			children = (
+				6DC825781648571E006AFC03 /* ExportProjectWindow.cpp */,
 				6D80B0CD163B14CB00EF3C04 /* PolycodeMaterialEditor.cpp */,
 				6DD1835C1628A4CC005A5682 /* PolycodeRemoteDebugger.cpp */,
 				6D3DC79C1622043A003ED2C9 /* PolycodeConsole.cpp */,
@@ -416,6 +421,7 @@
 				6D3DC79D1622043A003ED2C9 /* PolycodeConsole.cpp in Sources */,
 				6DD1835D1628A4CC005A5682 /* PolycodeRemoteDebugger.cpp in Sources */,
 				6D80B0CE163B14CB00EF3C04 /* PolycodeMaterialEditor.cpp in Sources */,
+				6DC825791648571E006AFC03 /* ExportProjectWindow.cpp in Sources */,
 			);
 			runOnlyForDeploymentPostprocessing = 0;
 		};

+ 1 - 0
IDE/Build/Mac OS X/PolycodeAppDelegate.h

@@ -58,6 +58,7 @@ public:
 -(IBAction) newGroup: (id) sender;
 -(IBAction) browseExamples: (id) sender;
 -(IBAction) runProject: (id) sender;
+-(IBAction) exportProject: (id) sender;
 -(IBAction) newProject: (id) sender;
 -(IBAction) closeProject: (id) sender;
 -(IBAction) newFile: (id) sender;

+ 5 - 0
IDE/Build/Mac OS X/PolycodeAppDelegate.m

@@ -95,6 +95,11 @@
 	app->runProject();
 }
 
+-(IBAction) exportProject: (id) sender {
+	app->exportProject();
+}
+
+
 -(IBAction) newProject: (id) sender {
 	app->newProject();
 }

+ 51 - 0
IDE/Contents/Include/ExportProjectWindow.h

@@ -0,0 +1,51 @@
+/*
+ Copyright (C) 2012 by Ivan Safrin
+ 
+ Permission is hereby granted, free of charge, to any person obtaining a copy
+ of this software and associated documentation files (the "Software"), to deal
+ in the Software without restriction, including without limitation the rights
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ copies of the Software, and to permit persons to whom the Software is
+ furnished to do so, subject to the following conditions:
+ 
+ The above copyright notice and this permission notice shall be included in
+ all copies or substantial portions of the Software.
+ 
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+ THE SOFTWARE.
+ */
+
+#pragma once
+
+#include "PolycodeGlobals.h"
+#include "PolycodeUI.h"
+#include "Polycode.h"
+#include "OSBasics.h"
+
+using namespace Polycode;
+
+
+class ExportProjectWindow : public UIWindow {
+	public:
+		ExportProjectWindow();
+		~ExportProjectWindow();
+	
+		void resetForm();
+	
+		void handleEvent(Event *event);
+	
+		UITextInput *projectLocationInput;
+		UIButton *locationSelectButton;
+		
+		UIButton *okButton;
+		UIButton *cancelButton;
+		
+		UICheckBox *macCheckBox;
+		UICheckBox *winCheckBox;
+		UICheckBox *linCheckBox;		
+};

+ 2 - 0
IDE/Contents/Include/PolycodeFrame.h

@@ -26,6 +26,7 @@
 #include "PolycodeEditor.h"
 #include "PolycodeConsole.h"
 #include "NewProjectWindow.h"
+#include "ExportProjectWindow.h"
 #include "ExampleBrowserWindow.h"
 #include "NewFileWindow.h"
 #include "ToolWindows.h"
@@ -64,6 +65,7 @@ public:
 	NewProjectWindow *newProjectWindow;	
 	ExampleBrowserWindow *exampleBrowserWindow;
 	NewFileWindow *newFileWindow;
+	ExportProjectWindow *exportProjectWindow;
 	
 	TextInputPopup *textInputPopup;
 	

+ 3 - 3
IDE/Contents/Include/PolycodeIDEApp.h

@@ -71,10 +71,10 @@ public:
 	void closeProject();	
 	void saveFile();
 	void findText();
-	
-	void refreshProject();
-	
 	void runProject();
+	void exportProject();
+	
+	void refreshProject();	
 	
 	const static int EVENT_SHOW_MENU = 1;
 	

+ 2 - 0
IDE/Contents/Include/PolycodeProjectManager.h

@@ -48,6 +48,8 @@ class PolycodeProjectManager {
 	
 	PolycodeProject *getProjectByProjectFile(String projectFile);
 	
+	void exportProject(PolycodeProject *project, String exportPath, bool macOS, bool windows, bool linux);
+	
 	int removeProject(PolycodeProject *project);
 	
 	String activeFolder;

+ 114 - 0
IDE/Contents/Source/ExportProjectWindow.cpp

@@ -0,0 +1,114 @@
+/*
+ Copyright (C) 2012 by Ivan Safrin
+ 
+ Permission is hereby granted, free of charge, to any person obtaining a copy
+ of this software and associated documentation files (the "Software"), to deal
+ in the Software without restriction, including without limitation the rights
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ copies of the Software, and to permit persons to whom the Software is
+ furnished to do so, subject to the following conditions:
+ 
+ The above copyright notice and this permission notice shall be included in
+ all copies or substantial portions of the Software.
+ 
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+ THE SOFTWARE.
+ */
+ 
+#include "ExportProjectWindow.h"
+
+ExportProjectWindow::ExportProjectWindow() : UIWindow(L"Publish Project", 400, 300) {
+
+	closeOnEscape = true;
+
+	ScreenLabel *label = new ScreenLabel("LOCATION", 22, "section", Label::ANTIALIAS_FULL);
+	addChild(label);
+	label->color.a = 0.4;	
+	label->setPosition(padding, 50);
+
+	projectLocationInput = new UITextInput(false, 430-(padding*2.0), 12);	
+	addChild(projectLocationInput);
+	projectLocationInput->setPosition(padding, 80);
+
+	
+	locationSelectButton = new UIButton(L"Choose...", 100);
+	locationSelectButton->addEventListener(this, UIEvent::CLICK_EVENT);	
+	addChild(locationSelectButton);
+	locationSelectButton->setPosition(padding, projectLocationInput->getPosition().y+projectLocationInput->getHeight()+5);
+
+
+	label = new ScreenLabel("PLATFORMS", 22, "section", Label::ANTIALIAS_FULL);
+	addChild(label);
+	label->color.a = 0.4;	
+	label->setPosition(padding, 150);
+
+	macCheckBox = new UICheckBox("MacOS X (Intel 64-bit)", false);
+	addChild(macCheckBox);
+	macCheckBox->setPosition(padding, 185);
+
+	winCheckBox = new UICheckBox("Microsoft Windows (32-bit)", false);
+	addChild(winCheckBox);
+	winCheckBox->setPosition(padding, 205);
+
+	linCheckBox = new UICheckBox("Linux (Intel 64-bit)", false);
+	addChild(linCheckBox);
+	linCheckBox->setPosition(padding, 225);
+
+
+	cancelButton = new UIButton(L"Cancel", 100);
+	cancelButton->addEventListener(this, UIEvent::CLICK_EVENT);
+	addChild(cancelButton);
+	cancelButton->setPosition(400-75-padding-100-10, 300-15);
+		
+	
+	okButton = new UIButton(L"Publish", 100);
+	okButton->addEventListener(this, UIEvent::CLICK_EVENT);
+	addChild(okButton);
+	okButton->setPosition(400-75-padding, 300-15);
+	
+	projectLocationInput->setText(CoreServices::getInstance()->getCore()->getUserHomeDirectory()+"/Documents/Polycode");
+	
+}
+
+ExportProjectWindow::~ExportProjectWindow() {
+	
+}
+
+void ExportProjectWindow::resetForm() {
+/*
+	projectLocationInput->setText(CoreServices::getInstance()->getCore()->getUserHomeDirectory()+"/Documents/Polycode");
+	macCheckBox->setChecked(false);
+	winCheckBox->setChecked(false);
+	linCheckBox->setChecked(false);	
+*/
+}
+
+void ExportProjectWindow::handleEvent(Event *event) {
+
+	if(event->getEventType() == "UIEvent") {
+		if(event->getEventCode() == UIEvent::CLICK_EVENT) {
+			if(event->getDispatcher() == okButton) {
+				dispatchEvent(new UIEvent(), UIEvent::OK_EVENT);						
+			}
+			
+			if(event->getDispatcher() == cancelButton) {
+				dispatchEvent(new UIEvent(), UIEvent::CLOSE_EVENT);				
+			}			
+			
+			if(event->getDispatcher() == locationSelectButton) {
+				String pathName = CoreServices::getInstance()->getCore()->openFolderPicker();
+				if(pathName != "")
+					projectLocationInput->setText(pathName);
+			}			
+			
+		}
+	}
+	
+	
+	UIWindow::handleEvent(event);	
+}

+ 3 - 0
IDE/Contents/Source/PolycodeFrame.cpp

@@ -119,6 +119,9 @@ PolycodeFrame::PolycodeFrame() : ScreenEntity() {
 	newFileWindow = new NewFileWindow();
 	newFileWindow->visible = false;
 	
+	exportProjectWindow = new ExportProjectWindow();
+	exportProjectWindow->visible = false;
+	
 	textInputPopup = new TextInputPopup();
 	textInputPopup->visible = false;
 	

+ 16 - 7
IDE/Contents/Source/PolycodeIDEApp.cpp

@@ -65,6 +65,7 @@ PolycodeIDEApp::PolycodeIDEApp(PolycodeView *view) : EventDispatcher() {
 
 	frame->textInputPopup->addEventListener(this, UIEvent::OK_EVENT);	
 	frame->newProjectWindow->addEventListener(this, UIEvent::OK_EVENT);
+	frame->exportProjectWindow->addEventListener(this, UIEvent::OK_EVENT);
 	frame->newFileWindow->addEventListener(this, UIEvent::OK_EVENT);	
 	frame->exampleBrowserWindow->addEventListener(this, UIEvent::OK_EVENT);
 	
@@ -92,13 +93,6 @@ PolycodeIDEApp::PolycodeIDEApp(PolycodeView *view) : EventDispatcher() {
 	editorManager->registerEditorFactory(new PolycodeTextEditorFactory());
 	editorManager->registerEditorFactory(new PolycodeProjectEditorFactory(projectManager));
 		
-	
-	
-//	CoreServices::getInstance()->getResourceManager()->addArchive(RESOURCE_PATH"tomato.polyapp");
-	
-//	ScreenImage *img = new ScreenImage("tomato.png");
-//	screen->addChild(img);
-	
 	loadConfigFile();
 }
 
@@ -182,6 +176,13 @@ void PolycodeIDEApp::stopProject() {
 	}
 }
 
+void PolycodeIDEApp::exportProject() {
+	if(projectManager->getActiveProject()) {
+		frame->exportProjectWindow->resetForm();
+		frame->showModal(frame->exportProjectWindow);		
+	}	
+}
+
 void PolycodeIDEApp::runProject() {
 	printf("Running project...\n");
 	stopProject();
@@ -353,6 +354,14 @@ void PolycodeIDEApp::handleEvent(Event *event) {
 			frame->hideModal();			
 		}
 	}	
+
+	if(event->getDispatcher() == frame->exportProjectWindow) {
+		if(event->getEventType() == "UIEvent" && event->getEventCode() == UIEvent::OK_EVENT) {
+			projectManager->exportProject(projectManager->getActiveProject(), frame->exportProjectWindow->projectLocationInput->getText(), frame->exportProjectWindow->macCheckBox->isChecked(), frame->exportProjectWindow->winCheckBox->isChecked(), frame->exportProjectWindow->linCheckBox->isChecked());
+			frame->hideModal();			
+		}
+	}
+
 	
 	if(event->getDispatcher() == frame->newProjectWindow) {
 		if(event->getEventType() == "UIEvent" && event->getEventCode() == UIEvent::OK_EVENT) {

+ 30 - 0
IDE/Contents/Source/PolycodeProjectManager.cpp

@@ -21,6 +21,7 @@
 */
 
 #include "PolycodeProjectManager.h"
+#include "PolycodeToolLauncher.h"
 
 PolycodeProjectManager::PolycodeProjectManager() {
 	activeProject = NULL;
@@ -125,3 +126,32 @@ void PolycodeProjectManager::createNewProject(String templateFolder, String proj
 	CoreServices::getInstance()->getCore()->moveDiskItem(projectLocation+"/"+projectName+"/template.polyproject",  projectLocation+"/"+projectName+"/"+projectName+".polyproject");
 	openProject(projectLocation+"/"+projectName+"/"+projectName+".polyproject");	
 }
+
+void PolycodeProjectManager::exportProject(PolycodeProject *project, String exportPath, bool macOS, bool windows, bool linux) {
+
+	String polycodeBasePath = CoreServices::getInstance()->getCore()->getDefaultWorkingDirectory();
+
+	String publishPath = polycodeBasePath+"/Standalone/Publish";
+	
+	String polyappPath = PolycodeToolLauncher::generateTempPath(project) + ".polyapp";
+	PolycodeToolLauncher::buildProject(project, polyappPath);	
+	
+	if(macOS) {
+		PolycodeConsole::print("Exporting Mac version to "+exportPath+"/Mac \n");
+		
+		CoreServices::getInstance()->getCore()->createFolder(exportPath+"/Mac");
+		
+		String appPath = exportPath+"/Mac/"+project->getProjectName()+".app";
+		
+		CoreServices::getInstance()->getCore()->createFolder(appPath);
+		CoreServices::getInstance()->getCore()->createFolder(appPath+"/Contents");
+		CoreServices::getInstance()->getCore()->createFolder(appPath+"/Contents/MacOS");
+		CoreServices::getInstance()->getCore()->copyDiskItem(publishPath+"/Mac/StandalonePlayer.app/Contents/MacOS/StandalonePlayer", appPath+"/Contents/MacOS/"+project->getProjectName());
+		CoreServices::getInstance()->getCore()->copyDiskItem(publishPath+"/Mac/StandalonePlayer.app/Contents/Resources", appPath+"/Contents/Resources");
+		CoreServices::getInstance()->getCore()->copyDiskItem(publishPath+"/Mac/StandalonePlayer.app/Contents/Info.plist", appPath+"/Contents/Info.plist");
+		CoreServices::getInstance()->getCore()->removeDiskItem(appPath+"/Contents/Resources/main.polyapp");
+		CoreServices::getInstance()->getCore()->copyDiskItem(polyappPath, appPath+"/Contents/Resources/main.polyapp");
+		
+	}
+}
+

+ 0 - 1
Player/Contents/Platform/Darwin/MyDocument.mm

@@ -150,7 +150,6 @@ NSMutableAttributedString *str = [[NSMutableAttributedString alloc ]initWithStri
 {
 	[self destroyPlayer];
 	[super close];
-
 }
 
 

+ 7 - 2
Player/Contents/Platform/Darwin/Standalone/StandalonePlayerAppDelegate.mm

@@ -17,7 +17,7 @@
 {
 	chdir([[[[NSBundle mainBundle] bundlePath] stringByAppendingString:@"/Contents/Resources"] UTF8String]);
 
-	player =  new CocoaPolycodePlayer(mainView, "main.polyapp", false);
+	player =  new CocoaPolycodePlayer(mainView, "main.polyapp", false, false);
 	player->windowData = self;	
 	player->runPlayer();
 
@@ -27,11 +27,16 @@
 
 }
 
+- (BOOL)applicationShouldTerminateAfterLastWindowClosed:(NSApplication *)theApplication
+{
+	return YES;
+}
+
 - (void)animationTimer:(NSTimer *)timer
 {
 
 	if(!player->Update()) {
-		[self close];
+		[window close];
 	}
 }
 

+ 5 - 0
Player/Contents/Source/PolycodePlayer.cpp

@@ -652,6 +652,8 @@ void PolycodePlayer::loadFile(const char *fileName) {
 		Logger::log(fullPath.c_str());
 	}
 	
+	remoteDebuggerClient = NULL;
+	
 	if(useDebugger) {
 	
 			
@@ -693,6 +695,8 @@ void PolycodePlayer::handleEvent(Event *event) {
 		debuggerTimer->Pause(true);
 	}
 	
+	if(remoteDebuggerClient) {	
+	
 	if(event->getDispatcher() == remoteDebuggerClient) {
 		if(event->getEventCode() == Event::COMPLETE_EVENT) {
 			dispatchEvent(new PolycodeDebugEvent(), PolycodeDebugEvent::EVENT_CLOSE);
@@ -723,6 +727,7 @@ void PolycodePlayer::handleEvent(Event *event) {
 			break;			
 		}
 	}
+	}
 	
 	if(event->getDispatcher() == core) {
 		switch(event->getEventCode()) {