2
0
Эх сурвалжийг харах

Merge branch 'default-text-editor' of https://github.com/BitPuffin/Polycode into pullreq_testing

Ivan Safrin 12 жил өмнө
parent
commit
838d24257b

+ 1 - 1
IDE/Build/Linux/Makefile

@@ -2,7 +2,7 @@ CC=g++
 CFLAGS=-I../../Contents/Include -I../../../Release/Linux/Framework/Core/Dependencies/include -I../../../Release/Linux/Framework/Core/Dependencies/include/AL -I../../../Release/Linux/Framework/Core/include -I../../../Release/Linux/Framework/Modules/include -I../../../Release/Linux/Framework/Modules/Dependencies/include -I../../../Release/Linux/Framework/Modules/Dependencies/include/bullet -DUSE_POLYCODEUI_FILE_DIALOGS -DUSE_POLYCODEUI_MENUBAR
 LDFLAGS=-lrt -ldl -lpthread ../../../Release/Linux/Framework/Core/lib/libPolycore.a ../../../Release/Linux/Framework/Core/Dependencies/lib/libfreetype.a ../../../Release/Linux/Framework/Core/Dependencies/lib/liblibvorbisfile.a ../../../Release/Linux/Framework/Core/Dependencies/lib/liblibvorbis.a ../../../Release/Linux/Framework/Core/Dependencies/lib/liblibogg.a ../../../Release/Linux/Framework/Core/Dependencies/lib/libopenal.so ../../../Release/Linux/Framework/Core/Dependencies/lib/libphysfs.a ../../../Release/Linux/Framework/Core/Dependencies/lib/libpng15.a ../../../Release/Linux/Framework/Core/Dependencies/lib/libz.a -lGL -lGLU -lSDL ../../../Release/Linux/Framework/Modules/lib/libPolycode2DPhysics.a ../../../Release/Linux/Framework/Modules/Dependencies/lib/libBox2D.a ../../../Release/Linux/Framework/Modules/lib/libPolycode3DPhysics.a ../../../Release/Linux/Framework/Modules/Dependencies/lib/libBulletDynamics.a ../../../Release/Linux/Framework/Modules/Dependencies/lib/libBulletCollision.a ../../../Release/Linux/Framework/Modules/Dependencies/lib/libLinearMath.a ../../../Release/Linux/Framework/Modules/lib/libPolycodeUI.a
 LDFLAGS_DEBUG=-lrt -ldl -lpthread ../../../Release/Linux/Framework/Core/lib/libPolycore_d.a ../../../Release/Linux/Framework/Core/Dependencies/lib/libfreetype_d.a ../../../Release/Linux/Framework/Core/Dependencies/lib/liblibvorbisfiled.a ../../../Release/Linux/Framework/Core/Dependencies/lib/liblibvorbisd.a ../../../Release/Linux/Framework/Core/Dependencies/lib/libliboggd.a ../../../Release/Linux/Framework/Core/Dependencies/lib/libopenal.so ../../../Release/Linux/Framework/Core/Dependencies/lib/libphysfsd.a ../../../Release/Linux/Framework/Core/Dependencies/lib/libpng15d.a ../../../Release/Linux/Framework/Core/Dependencies/lib/libz.a -lGL -lGLU -lSDL ../../../Release/Linux/Framework/Modules/lib/libPolycode2DPhysics_d.a ../../../Release/Linux/Framework/Modules/Dependencies/lib/libBox2D_d.a ../../../Release/Linux/Framework/Modules/lib/libPolycode3DPhysics_d.a ../../../Release/Linux/Framework/Modules/Dependencies/lib/libBulletDynamics_d.a ../../../Release/Linux/Framework/Modules/Dependencies/lib/libBulletCollision_d.a ../../../Release/Linux/Framework/Modules/Dependencies/lib/libLinearMath_d.a ../../../Release/Linux/Framework/Modules/lib/libPolycodeUI_d.a
-SRCS=../../Contents/Source/ExampleBrowserWindow.cpp ../../Contents/Source/PolycodeEditorManager.cpp  ../../Contents/Source/PolycodeProject.cpp        ../../Contents/Source/PolycodeScreenEditor.cpp ../../Contents/Source/ExportProjectWindow.cpp  ../../Contents/Source/PolycodeFontEditor.cpp     ../../Contents/Source/PolycodeProjectBrowser.cpp ../../Contents/Source/PolycodeSpriteEditor.cpp ../../Contents/Source/NewFileWindow.cpp        ../../Contents/Source/PolycodeFrame.cpp          ../../Contents/Source/PolycodeProjectEditor.cpp  ../../Contents/Source/PolycodeTextEditor.cpp ../../Contents/Source/NewProjectWindow.cpp     ../../Contents/Source/PolycodeIDEApp.cpp         ../../Contents/Source/PolycodeProjectManager.cpp ../../Contents/Source/PolycodeToolLauncher.cpp ../../Contents/Source/PolycodeConsole.cpp      ../../Contents/Source/PolycodeImageEditor.cpp    ../../Contents/Source/PolycodeProps.cpp          ../../Contents/Source/TextureBrowser.cpp ../../Contents/Source/PolycodeEditor.cpp       ../../Contents/Source/PolycodeMaterialEditor.cpp ../../Contents/Source/PolycodeRemoteDebugger.cpp ../../Contents/Source/ToolWindows.cpp ../../Contents/Source/PolycodeClipboard.cpp
+SRCS=../../Contents/Source/ExampleBrowserWindow.cpp ../../Contents/Source/PolycodeEditorManager.cpp  ../../Contents/Source/PolycodeProject.cpp        ../../Contents/Source/PolycodeScreenEditor.cpp ../../Contents/Source/ExportProjectWindow.cpp  ../../Contents/Source/PolycodeFontEditor.cpp     ../../Contents/Source/PolycodeProjectBrowser.cpp ../../Contents/Source/PolycodeSpriteEditor.cpp ../../Contents/Source/NewFileWindow.cpp        ../../Contents/Source/PolycodeFrame.cpp          ../../Contents/Source/PolycodeProjectEditor.cpp  ../../Contents/Source/PolycodeTextEditor.cpp ../../Contents/Source/NewProjectWindow.cpp     ../../Contents/Source/PolycodeIDEApp.cpp         ../../Contents/Source/PolycodeProjectManager.cpp ../../Contents/Source/PolycodeToolLauncher.cpp ../../Contents/Source/PolycodeConsole.cpp      ../../Contents/Source/PolycodeImageEditor.cpp    ../../Contents/Source/PolycodeProps.cpp          ../../Contents/Source/TextureBrowser.cpp ../../Contents/Source/PolycodeEditor.cpp       ../../Contents/Source/PolycodeMaterialEditor.cpp ../../Contents/Source/PolycodeRemoteDebugger.cpp ../../Contents/Source/ToolWindows.cpp ../../Contents/Source/PolycodeClipboard.cpp ../../Contents/Source/SettingsWindow.cpp
 
 default:
 	mkdir -p ./Build

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

@@ -33,6 +33,7 @@
 #include "ToolWindows.h"
 #include "PolycodeProjectManager.h"
 #include "PolycodeEditorManager.h"
+#include "SettingsWindow.h"
 
 using namespace Polycode;
 
@@ -186,6 +187,7 @@ public:
 	ExampleBrowserWindow *exampleBrowserWindow;
 	NewFileWindow *newFileWindow;
 	ExportProjectWindow *exportProjectWindow;
+	SettingsWindow *settingsWindow;
 	
 	AssetBrowser *assetBrowser;
 	

+ 1 - 0
IDE/Contents/Include/PolycodeIDEApp.h

@@ -89,6 +89,7 @@ public:
 	void doRunProject();
 	void exportProject();
 	void toggleConsole();
+	void showSettings();
 	
 	void removeEditor(PolycodeEditor *editor);
 	

+ 50 - 0
IDE/Contents/Include/SettingsWindow.h

@@ -0,0 +1,50 @@
+/*
+ Copyright (C) 2013 by Isak Andersson
+ 
+ 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"
+
+#define SETTINGS_WINDOW_WIDTH 400
+#define SETTINGS_WINDOW_HEIGHT 500
+
+using namespace Polycode;
+
+
+class SettingsWindow : public UIWindow {
+	public:
+		SettingsWindow();
+		~SettingsWindow();
+
+		void handleEvent(Event *event);
+		void updateUI();
+
+		UICheckBox *useExternalTextEditorBox;
+		UITextInput *externalTextEditorCommand;
+		UIButton *browseButton;
+
+		UIButton *cancelButton;
+		UIButton *okButton;
+};

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

@@ -591,6 +591,9 @@ PolycodeFrame::PolycodeFrame() : ScreenEntity() {
 	
 	exampleBrowserWindow = new ExampleBrowserWindow();
 	exampleBrowserWindow->visible = false;
+
+	settingsWindow = new SettingsWindow();
+	settingsWindow->visible = false;
 	
 	newFileWindow = new NewFileWindow();
 	newFileWindow->visible = false;

+ 77 - 12
IDE/Contents/Source/PolycodeIDEApp.cpp

@@ -101,6 +101,8 @@ PolycodeIDEApp::PolycodeIDEApp(PolycodeView *view) : EventDispatcher() {
 	frame->exportProjectWindow->addEventListener(this, UIEvent::OK_EVENT);
 	frame->newFileWindow->addEventListener(this, UIEvent::OK_EVENT);	
 	frame->exampleBrowserWindow->addEventListener(this, UIEvent::OK_EVENT);
+	frame->settingsWindow->addEventListener(this, UIEvent::OK_EVENT);
+	frame->settingsWindow->addEventListener(this, UIEvent::CLOSE_EVENT);
 	
 	frame->playButton->addEventListener(this, UIEvent::CLICK_EVENT);
 	frame->stopButton->addEventListener(this, UIEvent::CLICK_EVENT);
@@ -159,6 +161,7 @@ PolycodeIDEApp::PolycodeIDEApp(PolycodeView *view) : EventDispatcher() {
 	editEntry->addItem("Redo", "redo");
 	editEntry->addItem("Cut", "cut");
 	editEntry->addItem("Copy", "copy");
+	editEntry->addItem("Settings", "settings");
 
 	UIMenuBarEntry *viewEntry = menuBar->addMenuBarEntry("View");
 	viewEntry->addItem("Toggle Console", "toggle_console", KEY_LSHIFT, KEY_c);
@@ -204,6 +207,10 @@ void PolycodeIDEApp::showAbout() {
 	frame->showModal(frame->aboutWindow);
 }
 
+void PolycodeIDEApp::showSettings() {
+	frame->showModal(frame->settingsWindow);
+}
+
 void PolycodeIDEApp::toggleConsole() {
 	frame->toggleConsole();
 }
@@ -347,7 +354,7 @@ void PolycodeIDEApp::openProject() {
 #ifdef USE_POLYCODEUI_FILE_DIALOGS
 	std::vector<String> exts;
 	exts.push_back("polyproject");
-	frame->showFileBrowser(CoreServices::getInstance()->getCore()->getUserHomeDirectory(),  false, exts, false);
+	frame->showFileBrowser(CoreServices::getInstance()->getCore()->getUserHomeDirectory(),	false, exts, false);
 	frame->fileDialog->addEventListener(this, UIEvent::OK_EVENT);
 #else
 	vector<CoreFileExtension> extensions;
@@ -364,7 +371,7 @@ void PolycodeIDEApp::openProject() {
 		PolycodeProject *project = projectManager->openProject(paths[0]);
 		if(project) {
 			projectManager->setActiveProject(project);
-			OSFileEntry projectEntry =  OSFileEntry(project->getProjectFile(), OSFileEntry::TYPE_FILE);
+			OSFileEntry projectEntry =	OSFileEntry(project->getProjectFile(), OSFileEntry::TYPE_FILE);
 			openFile(projectEntry);			
 		}
 	}
@@ -529,7 +536,16 @@ void PolycodeIDEApp::openFileInProject(PolycodeProject *project, String filePath
 void PolycodeIDEApp::openFile(OSFileEntry file) {
 	PolycodeEditor *editor;
 	editor = editorManager->getEditorForPath(file.fullPath);
+
 	if(editor) {
+		CoreServices *core = CoreServices::getInstance();
+		Config *config = core->getConfig();
+		bool useExternalTextEditor = (config->getStringValue("Polycode", "useExternalTextEditor") == "true") && (config->getStringValue("Polycode", "externalTextEditorCommand") != "");
+		if(editor->getEditorType() == "PolycodeTextEditor" && useExternalTextEditor) {
+			core->getCore()->executeExternalCommand(config->getStringValue("Polycode", "externalTextEditorCommand"), file.fullPath, projectManager->getActiveProject()->getRootFolder());
+			return;
+		}
+
 		frame->showEditor(editor);
 	} else {
 		editor = editorManager->createEditorForExtension(file.extension);
@@ -560,7 +576,7 @@ void PolycodeIDEApp::handleEvent(Event *event) {
 				PolycodeProject *project = projectManager->openProject(path);
 				if(project) {
 					projectManager->setActiveProject(project);
-					OSFileEntry projectEntry =  OSFileEntry(project->getProjectFile(), OSFileEntry::TYPE_FILE);
+					OSFileEntry projectEntry =	OSFileEntry(project->getProjectFile(), OSFileEntry::TYPE_FILE);
 					openFile(projectEntry);			
 				}
 				
@@ -603,6 +619,8 @@ void PolycodeIDEApp::handleEvent(Event *event) {
 			showAbout();
 		} else if(action == "toggle_console") {
 			toggleConsole();
+		} else if(action == "settings") {
+			showSettings();
 		}
 	}
 
@@ -858,6 +876,23 @@ void PolycodeIDEApp::handleEvent(Event *event) {
 		}
 	}	
 
+	if(event->getDispatcher() == frame->settingsWindow) {
+		if(event->getEventType() == "UIEvent") {
+			Config *config = CoreServices::getInstance()->getConfig();
+			SettingsWindow *settingsWindow = frame->settingsWindow;
+
+			if(event->getEventCode() == UIEvent::OK_EVENT) {
+				config->setStringValue("Polycode", "useExternalTextEditor", settingsWindow->useExternalTextEditorBox->isChecked() ? "true" : "false");
+				config->setStringValue("Polycode", "externalTextEditorCommand", settingsWindow->externalTextEditorCommand->getText());
+			
+				frame->hideModal();
+			}
+			if(event->getEventCode() == UIEvent::CLOSE_EVENT) {
+				settingsWindow->updateUI();
+			}
+		}
+	}
+
 	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());
@@ -888,7 +923,7 @@ void PolycodeIDEApp::handleEvent(Event *event) {
 		if(event->getEventType() == "UIEvent" && event->getEventCode() == UIEvent::OK_EVENT) {
 			String fullPath = String(core->getDefaultWorkingDirectory()+"/"+frame->exampleBrowserWindow->getExamplePath());
 			PolycodeProject* project = projectManager->openProject(fullPath);
-			OSFileEntry projectEntry =  OSFileEntry(project->getProjectFile(), OSFileEntry::TYPE_FILE);
+			OSFileEntry projectEntry =	OSFileEntry(project->getProjectFile(), OSFileEntry::TYPE_FILE);
 			projectManager->setActiveProject(project);
 			openFile(projectEntry);			
 			
@@ -920,6 +955,7 @@ void PolycodeIDEApp::handleEvent(Event *event) {
 }
 
 void PolycodeIDEApp::saveConfigFile() {
+	Config *config = CoreServices::getInstance()->getConfig();
 	Object configFile;
 	configFile.root.name = "config";
 	configFile.root.addChild("open_projects");
@@ -931,6 +967,11 @@ void PolycodeIDEApp::saveConfigFile() {
 		projectEntry->addChild("path", project->getProjectFile());
 	}
 
+	configFile.root.addChild("settings");
+	ObjectEntry *textEditorEntry = configFile.root["settings"]->addChild("text_editor");
+	textEditorEntry->addChild("use_external", config->getStringValue("Polycode", "useExternalTextEditor"));
+	textEditorEntry->addChild("command", config->getStringValue("Polycode", "externalTextEditorCommand"));
+
 #if defined(__APPLE__) && defined(__MACH__)
 	core->createFolder(core->getUserHomeDirectory()+"/Library/Application Support/Polycode");
 	configFile.saveToXML(core->getUserHomeDirectory()+"/Library/Application Support/Polycode/config.xml");	
@@ -961,19 +1002,43 @@ void PolycodeIDEApp::loadConfigFile() {
 	if(configFile.root["open_projects"]) {
 		ObjectEntry *projects = configFile.root["open_projects"];
 		if(projects) {
-		for(int i=0; i < projects->length; i++) {
-			ObjectEntry *entry = (*(*projects)[i])["path"];
-			if(entry) {
-				PolycodeProject* project = projectManager->openProject(entry->stringVal);
-				if(project) {
-					OSFileEntry projectEntry =  OSFileEntry(project->getProjectFile(), OSFileEntry::TYPE_FILE);
-					projectManager->setActiveProject(project);
-					openFile(projectEntry);
+			for(int i=0; i < projects->length; i++) {
+				ObjectEntry *entry = (*(*projects)[i])["path"];
+				if(entry) {
+					PolycodeProject* project = projectManager->openProject(entry->stringVal);
+					if(project) {
+						OSFileEntry projectEntry =	OSFileEntry(project->getProjectFile(), OSFileEntry::TYPE_FILE);
+						projectManager->setActiveProject(project);
+						openFile(projectEntry);
+					}
 				}
 			}
 		}
+	}
+	
+	Config *config = CoreServices::getInstance()->getConfig();
+
+	if(configFile.root["settings"]) {
+		ObjectEntry *settings = configFile.root["settings"];
+		ObjectEntry *textEditor = (*settings)["text_editor"];
+		if(textEditor) {
+			if((*textEditor)["use_external"]) {
+				config->setStringValue("Polycode", "useExternalTextEditor", (*textEditor)["use_external"]->stringVal);
+			} else {
+				config->setStringValue("Polycode", "useExternalTextEditor", "false");
+			}
+
+			if((*textEditor)["command"]) {
+				config->setStringValue("Polycode", "externalTextEditorCommand", (*textEditor)["command"]->stringVal);
+			} else {
+				config->setStringValue("Polycode", "externalTextEditorCommand", "");
+			}
 		}
+	} else {
+		config->setStringValue("Polycode","useExternalTextEditor", "false");
+		config->setStringValue("Polycode", "externalTextEditorCommand", "");
 	}
+	frame->settingsWindow->updateUI();
 }
 
 

+ 124 - 0
IDE/Contents/Source/SettingsWindow.cpp

@@ -0,0 +1,124 @@
+/*
+ Copyright (C) 2013 by Isak Andersson
+ 
+ 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 "SettingsWindow.h"
+
+#include "PolycodeFrame.h"
+extern PolycodeFrame *globalFrame;
+
+SettingsWindow::SettingsWindow() : UIWindow(L"Settings", SETTINGS_WINDOW_WIDTH, SETTINGS_WINDOW_HEIGHT) {
+
+	closeOnEscape = true;
+
+
+	ScreenLabel *label = new ScreenLabel("MISC", 22, "section", Label::ANTIALIAS_FULL);
+	addChild(label);
+	label->color.a = 0.4;
+	label->setPosition(padding, 50);
+
+
+	useExternalTextEditorBox = new UICheckBox("Use external text editor?", false);
+	addChild(useExternalTextEditorBox); 
+	useExternalTextEditorBox->setPosition(padding, 85);
+
+	#define BUTTON_WIDTH 80
+	#define BUTTON_PADDING 10
+	#define EDITOR_BROWSE_POS 110
+	#define TEXTBOX_HEIGHT 12
+
+	externalTextEditorCommand = new UITextInput(false, SETTINGS_WINDOW_WIDTH - (padding*2 + BUTTON_WIDTH + BUTTON_PADDING/2), TEXTBOX_HEIGHT);
+	addChild(externalTextEditorCommand);
+	externalTextEditorCommand->setPosition(padding, EDITOR_BROWSE_POS);
+
+	browseButton = new UIButton("Browse...", BUTTON_WIDTH);
+	browseButton->addEventListener(this, UIEvent::CLICK_EVENT);
+	addChild(browseButton);
+	browseButton->setPosition(SETTINGS_WINDOW_WIDTH - (2*padding + BUTTON_WIDTH/2), EDITOR_BROWSE_POS);
+	
+
+	cancelButton = new UIButton("Cancel", BUTTON_WIDTH);
+	cancelButton->addEventListener(this, UIEvent::CLICK_EVENT);
+	addChild(cancelButton);
+	cancelButton->setPosition(SETTINGS_WINDOW_WIDTH - (2*padding + BUTTON_WIDTH*1.5 + BUTTON_PADDING), SETTINGS_WINDOW_HEIGHT - padding);
+
+	okButton = new UIButton("OK", BUTTON_WIDTH);
+	okButton->addEventListener(this, UIEvent::CLICK_EVENT);
+	addChild(okButton);
+	okButton->setPosition(SETTINGS_WINDOW_WIDTH - (2*padding + BUTTON_WIDTH/2), SETTINGS_WINDOW_HEIGHT - padding);
+}
+
+void SettingsWindow::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() == browseButton) {
+#ifdef USE_POLYCODEUI_FILE_DIALOGS
+				std::vector<String> extensions;
+				extensions.push_back("");
+				globalFrame->showFileBrowser(CoreServices::getInstance()->getCore()->getUserHomeDirectory(), false, extensions, false);
+				globalFrame->fileDialog->addEventListener(this, UIEvent::OK_EVENT);
+#else
+				vector<CoreFileExtension> extensions;
+				CoreFileExtension ext;
+#ifdef _WINDOWS
+				ext.extension = "exe"
+#else
+				ext.extension = "";
+#endif
+				ext.description = "executable";
+				extensions.push_back(ext);
+				std::vector<String> path = CoreServices::getInstance()->getCore()->openFilePicker(extensions, false);
+
+				if(path.size == 0) {
+					return;
+				}
+
+				if(path[0] != "") {
+					externalTextEditorCommand->setText(path[0]);
+				}
+#endif	
+			}
+		}
+
+		if(event->getDispatcher() == globalFrame->fileDialog && event->getEventCode() == UIEvent::OK_EVENT) {
+			String path = globalFrame->fileDialog->getSelection();
+			if (path != "") {
+				externalTextEditorCommand->setText(path);
+			}
+		}
+	}
+
+	UIWindow::handleEvent(event); 
+} 
+
+void SettingsWindow::updateUI() {
+	Config *config = CoreServices::getInstance()->getConfig();
+	
+	useExternalTextEditorBox->setChecked(config->getStringValue("Polycode", "useExternalTextEditor") == "true");
+	externalTextEditorCommand->setText(config->getStringValue("Polycode", "externalTextEditorCommand"));
+}
+	
+SettingsWindow::~SettingsWindow() {
+}