Explorar el Código

Merge branch 'master' of github.com:ivansafrin/Polycode

Ivan Safrin hace 14 años
padre
commit
e089bf39d5

+ 159 - 13
IDE/Build/Mac OS X/English.lproj/MainMenu.xib

@@ -210,6 +210,15 @@
 									<reference key="NSOnImage" ref="35465992"/>
 									<reference key="NSMixedImage" ref="502551668"/>
 								</object>
+								<object class="NSMenuItem" id="93992569">
+									<reference key="NSMenu" ref="720053764"/>
+									<string key="NSTitle">New Folder</string>
+									<string key="NSKeyEquiv">F</string>
+									<int key="NSKeyEquivModMask">1048576</int>
+									<int key="NSMnemonicLoc">2147483647</int>
+									<reference key="NSOnImage" ref="35465992"/>
+									<reference key="NSMixedImage" ref="502551668"/>
+								</object>
 								<object class="NSMenuItem" id="425164168">
 									<reference key="NSMenu" ref="720053764"/>
 									<bool key="NSIsDisabled">YES</bool>
@@ -268,6 +277,15 @@
 									<reference key="NSOnImage" ref="35465992"/>
 									<reference key="NSMixedImage" ref="502551668"/>
 								</object>
+								<object class="NSMenuItem" id="355684970">
+									<reference key="NSMenu" ref="720053764"/>
+									<string key="NSTitle">Remove File</string>
+									<string type="base64-UTF8" key="NSKeyEquiv">CA</string>
+									<int key="NSKeyEquivModMask">1048576</int>
+									<int key="NSMnemonicLoc">2147483647</int>
+									<reference key="NSOnImage" ref="35465992"/>
+									<reference key="NSMixedImage" ref="502551668"/>
+								</object>
 								<object class="NSMenuItem" id="268409637">
 									<reference key="NSMenu" ref="720053764"/>
 									<bool key="NSIsDisabled">YES</bool>
@@ -679,6 +697,14 @@
 						<reference key="NSOnImage" ref="35465992"/>
 						<reference key="NSMixedImage" ref="502551668"/>
 					</object>
+					<object class="NSMenuItem" id="46500047">
+						<reference key="NSMenu" ref="1048220208"/>
+						<string key="NSTitle">Add New Folder</string>
+						<string key="NSKeyEquiv"/>
+						<int key="NSMnemonicLoc">2147483647</int>
+						<reference key="NSOnImage" ref="35465992"/>
+						<reference key="NSMixedImage" ref="502551668"/>
+					</object>
 					<object class="NSMenuItem" id="26940596">
 						<reference key="NSMenu" ref="1048220208"/>
 						<bool key="NSIsDisabled">YES</bool>
@@ -689,6 +715,24 @@
 						<reference key="NSOnImage" ref="35465992"/>
 						<reference key="NSMixedImage" ref="502551668"/>
 					</object>
+					<object class="NSMenuItem" id="49210983">
+						<reference key="NSMenu" ref="1048220208"/>
+						<string key="NSTitle">Rename</string>
+						<string key="NSKeyEquiv"/>
+						<int key="NSMnemonicLoc">2147483647</int>
+						<reference key="NSOnImage" ref="35465992"/>
+						<reference key="NSMixedImage" ref="502551668"/>
+					</object>
+					<object class="NSMenuItem" id="954168611">
+						<reference key="NSMenu" ref="1048220208"/>
+						<bool key="NSIsDisabled">YES</bool>
+						<bool key="NSIsSeparator">YES</bool>
+						<string key="NSTitle"/>
+						<string key="NSKeyEquiv"/>
+						<int key="NSMnemonicLoc">2147483647</int>
+						<reference key="NSOnImage" ref="35465992"/>
+						<reference key="NSMixedImage" ref="502551668"/>
+					</object>
 					<object class="NSMenuItem" id="901265223">
 						<reference key="NSMenu" ref="1048220208"/>
 						<string key="NSTitle">Remove</string>
@@ -943,14 +987,6 @@
 					</object>
 					<int key="connectionID">564</int>
 				</object>
-				<object class="IBConnectionRecord">
-					<object class="IBActionConnection" key="connection">
-						<string key="label">newProject:</string>
-						<reference key="source" ref="976324537"/>
-						<reference key="destination" ref="548023385"/>
-					</object>
-					<int key="connectionID">565</int>
-				</object>
 				<object class="IBConnectionRecord">
 					<object class="IBActionConnection" key="connection">
 						<string key="label">closeProject:</string>
@@ -983,6 +1019,62 @@
 					</object>
 					<int key="connectionID">572</int>
 				</object>
+				<object class="IBConnectionRecord">
+					<object class="IBActionConnection" key="connection">
+						<string key="label">newGroup:</string>
+						<reference key="source" ref="976324537"/>
+						<reference key="destination" ref="93992569"/>
+					</object>
+					<int key="connectionID">574</int>
+				</object>
+				<object class="IBConnectionRecord">
+					<object class="IBActionConnection" key="connection">
+						<string key="label">removeFile:</string>
+						<reference key="source" ref="976324537"/>
+						<reference key="destination" ref="355684970"/>
+					</object>
+					<int key="connectionID">576</int>
+				</object>
+				<object class="IBConnectionRecord">
+					<object class="IBActionConnection" key="connection">
+						<string key="label">removeFile:</string>
+						<reference key="source" ref="976324537"/>
+						<reference key="destination" ref="901265223"/>
+					</object>
+					<int key="connectionID">577</int>
+				</object>
+				<object class="IBConnectionRecord">
+					<object class="IBActionConnection" key="connection">
+						<string key="label">newProject:</string>
+						<reference key="source" ref="976324537"/>
+						<reference key="destination" ref="548023385"/>
+					</object>
+					<int key="connectionID">578</int>
+				</object>
+				<object class="IBConnectionRecord">
+					<object class="IBActionConnection" key="connection">
+						<string key="label">newFile:</string>
+						<reference key="source" ref="976324537"/>
+						<reference key="destination" ref="921894302"/>
+					</object>
+					<int key="connectionID">579</int>
+				</object>
+				<object class="IBConnectionRecord">
+					<object class="IBActionConnection" key="connection">
+						<string key="label">newGroup:</string>
+						<reference key="source" ref="976324537"/>
+						<reference key="destination" ref="46500047"/>
+					</object>
+					<int key="connectionID">581</int>
+				</object>
+				<object class="IBConnectionRecord">
+					<object class="IBActionConnection" key="connection">
+						<string key="label">renameFile:</string>
+						<reference key="source" ref="976324537"/>
+						<reference key="destination" ref="49210983"/>
+					</object>
+					<int key="connectionID">584</int>
+				</object>
 			</object>
 			<object class="IBMutableOrderedSet" key="objectRecords">
 				<object class="NSArray" key="orderedObjects">
@@ -1081,6 +1173,8 @@
 							<reference ref="164447311"/>
 							<reference ref="810242391"/>
 							<reference ref="1071799412"/>
+							<reference ref="93992569"/>
+							<reference ref="355684970"/>
 						</object>
 						<reference key="parent" ref="379814623"/>
 					</object>
@@ -1470,6 +1564,9 @@
 							<reference ref="548023385"/>
 							<reference ref="901265223"/>
 							<reference ref="26940596"/>
+							<reference ref="46500047"/>
+							<reference ref="49210983"/>
+							<reference ref="954168611"/>
 						</object>
 						<reference key="parent" ref="0"/>
 					</object>
@@ -1503,6 +1600,31 @@
 						<reference key="object" ref="1071799412"/>
 						<reference key="parent" ref="720053764"/>
 					</object>
+					<object class="IBObjectRecord">
+						<int key="objectID">573</int>
+						<reference key="object" ref="93992569"/>
+						<reference key="parent" ref="720053764"/>
+					</object>
+					<object class="IBObjectRecord">
+						<int key="objectID">575</int>
+						<reference key="object" ref="355684970"/>
+						<reference key="parent" ref="720053764"/>
+					</object>
+					<object class="IBObjectRecord">
+						<int key="objectID">580</int>
+						<reference key="object" ref="46500047"/>
+						<reference key="parent" ref="1048220208"/>
+					</object>
+					<object class="IBObjectRecord">
+						<int key="objectID">582</int>
+						<reference key="object" ref="49210983"/>
+						<reference key="parent" ref="1048220208"/>
+					</object>
+					<object class="IBObjectRecord">
+						<int key="objectID">583</int>
+						<reference key="object" ref="954168611"/>
+						<reference key="parent" ref="1048220208"/>
+					</object>
 				</object>
 			</object>
 			<object class="NSMutableDictionary" key="flattenedProperties">
@@ -1579,7 +1701,12 @@
 					<string>57.IBPluginDependency</string>
 					<string>570.IBPluginDependency</string>
 					<string>571.IBPluginDependency</string>
+					<string>573.IBPluginDependency</string>
+					<string>575.IBPluginDependency</string>
 					<string>58.IBPluginDependency</string>
+					<string>580.IBPluginDependency</string>
+					<string>582.IBPluginDependency</string>
+					<string>583.IBPluginDependency</string>
 					<string>72.IBPluginDependency</string>
 					<string>73.IBPluginDependency</string>
 					<string>75.IBPluginDependency</string>
@@ -1670,6 +1797,11 @@
 					<string>com.apple.InterfaceBuilder.CocoaPlugin</string>
 					<string>com.apple.InterfaceBuilder.CocoaPlugin</string>
 					<string>com.apple.InterfaceBuilder.CocoaPlugin</string>
+					<string>com.apple.InterfaceBuilder.CocoaPlugin</string>
+					<string>com.apple.InterfaceBuilder.CocoaPlugin</string>
+					<string>com.apple.InterfaceBuilder.CocoaPlugin</string>
+					<string>com.apple.InterfaceBuilder.CocoaPlugin</string>
+					<string>com.apple.InterfaceBuilder.CocoaPlugin</string>
 				</object>
 			</object>
 			<object class="NSMutableDictionary" key="unlocalizedProperties">
@@ -1684,7 +1816,7 @@
 				<reference key="dict.values" ref="0"/>
 			</object>
 			<nil key="sourceID"/>
-			<int key="maxID">572</int>
+			<int key="maxID">584</int>
 		</object>
 		<object class="IBClassDescriber" key="IBDocument.Classes">
 			<object class="NSMutableArray" key="referencedPartialClassDescriptions">
@@ -1766,9 +1898,11 @@
 							<string>browseExamples:</string>
 							<string>closeProject:</string>
 							<string>newFile:</string>
+							<string>newGroup:</string>
 							<string>newProject:</string>
-							<string>open:</string>
 							<string>openProject:</string>
+							<string>removeFile:</string>
+							<string>renameFile:</string>
 							<string>runProject:</string>
 							<string>saveFile:</string>
 						</object>
@@ -1782,6 +1916,8 @@
 							<string>id</string>
 							<string>id</string>
 							<string>id</string>
+							<string>id</string>
+							<string>id</string>
 						</object>
 					</object>
 					<object class="NSMutableDictionary" key="actionInfosByName">
@@ -1791,9 +1927,11 @@
 							<string>browseExamples:</string>
 							<string>closeProject:</string>
 							<string>newFile:</string>
+							<string>newGroup:</string>
 							<string>newProject:</string>
-							<string>open:</string>
 							<string>openProject:</string>
+							<string>removeFile:</string>
+							<string>renameFile:</string>
 							<string>runProject:</string>
 							<string>saveFile:</string>
 						</object>
@@ -1812,17 +1950,25 @@
 								<string key="candidateClassName">id</string>
 							</object>
 							<object class="IBActionInfo">
-								<string key="name">newProject:</string>
+								<string key="name">newGroup:</string>
 								<string key="candidateClassName">id</string>
 							</object>
 							<object class="IBActionInfo">
-								<string key="name">open:</string>
+								<string key="name">newProject:</string>
 								<string key="candidateClassName">id</string>
 							</object>
 							<object class="IBActionInfo">
 								<string key="name">openProject:</string>
 								<string key="candidateClassName">id</string>
 							</object>
+							<object class="IBActionInfo">
+								<string key="name">removeFile:</string>
+								<string key="candidateClassName">id</string>
+							</object>
+							<object class="IBActionInfo">
+								<string key="name">renameFile:</string>
+								<string key="candidateClassName">id</string>
+							</object>
 							<object class="IBActionInfo">
 								<string key="name">runProject:</string>
 								<string key="candidateClassName">id</string>

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

@@ -10,6 +10,7 @@
 		1DDD58160DA1D0A300B32029 /* MainMenu.xib in Resources */ = {isa = PBXBuildFile; fileRef = 1DDD58140DA1D0A300B32029 /* MainMenu.xib */; };
 		256AC3DA0F4B6AC300CF3369 /* PolycodeAppDelegate.m in Sources */ = {isa = PBXBuildFile; fileRef = 256AC3D90F4B6AC300CF3369 /* PolycodeAppDelegate.m */; };
 		6D34143412B816BC0034FA9B /* IOKit.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 6D34143312B816BC0034FA9B /* IOKit.framework */; };
+		6D3B6C5B14B820A900727F17 /* ToolWindows.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 6D3B6C5A14B820A900727F17 /* ToolWindows.cpp */; };
 		6D6D3FA614B446A600219173 /* PolycodeToolLauncher.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 6D6D3FA514B446A600219173 /* PolycodeToolLauncher.cpp */; };
 		6D70AB2A12B29BF200EB6D94 /* NewFileWindow.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 6D70AB2912B29BF200EB6D94 /* NewFileWindow.cpp */; };
 		6D80E91E12AB53FB0037A708 /* PolycodeFrame.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 6D80E91912AB53FB0037A708 /* PolycodeFrame.cpp */; };
@@ -67,6 +68,8 @@
 		29B97324FDCFA39411CA2CEA /* AppKit.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = AppKit.framework; path = /System/Library/Frameworks/AppKit.framework; sourceTree = "<absolute>"; };
 		29B97325FDCFA39411CA2CEA /* Foundation.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Foundation.framework; path = /System/Library/Frameworks/Foundation.framework; sourceTree = "<absolute>"; };
 		6D34143312B816BC0034FA9B /* IOKit.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = IOKit.framework; path = System/Library/Frameworks/IOKit.framework; sourceTree = SDKROOT; };
+		6D3B6C5A14B820A900727F17 /* ToolWindows.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = ToolWindows.cpp; sourceTree = "<group>"; };
+		6D3B6C5C14B820B000727F17 /* ToolWindows.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ToolWindows.h; sourceTree = "<group>"; };
 		6D6D3FA514B446A600219173 /* PolycodeToolLauncher.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = PolycodeToolLauncher.cpp; sourceTree = "<group>"; };
 		6D6D3FA814B446AF00219173 /* PolycodeToolLauncher.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = PolycodeToolLauncher.h; sourceTree = "<group>"; };
 		6D70AB2812B29BEC00EB6D94 /* NewFileWindow.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = NewFileWindow.h; sourceTree = "<group>"; };
@@ -235,6 +238,7 @@
 		6D80E91212AB53FB0037A708 /* Include */ = {
 			isa = PBXGroup;
 			children = (
+				6D3B6C5C14B820B000727F17 /* ToolWindows.h */,
 				6DCAFD4614B51A2D00039F34 /* ExampleBrowserWindow.h */,
 				6D6D3FA814B446AF00219173 /* PolycodeToolLauncher.h */,
 				6D70AB2812B29BEC00EB6D94 /* NewFileWindow.h */,
@@ -258,6 +262,7 @@
 		6D80E91812AB53FB0037A708 /* Source */ = {
 			isa = PBXGroup;
 			children = (
+				6D3B6C5A14B820A900727F17 /* ToolWindows.cpp */,
 				6DCAFD4214B519C900039F34 /* ExampleBrowserWindow.cpp */,
 				6D6D3FA514B446A600219173 /* PolycodeToolLauncher.cpp */,
 				6D70AB2912B29BF200EB6D94 /* NewFileWindow.cpp */,
@@ -376,6 +381,7 @@
 				6D8A55BC14B3EACB005F6411 /* PolycodeView.mm in Sources */,
 				6D6D3FA614B446A600219173 /* PolycodeToolLauncher.cpp in Sources */,
 				6DCAFD4314B519C900039F34 /* ExampleBrowserWindow.cpp in Sources */,
+				6D3B6C5B14B820A900727F17 /* ToolWindows.cpp in Sources */,
 			);
 			runOnlyForDeploymentPostprocessing = 0;
 		};

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

@@ -52,6 +52,9 @@ public:
 
 // Menu accessors
 
+-(IBAction) renameFile: (id) sender;
+-(IBAction) removeFile: (id) sender;
+-(IBAction) newGroup: (id) sender;
 -(IBAction) browseExamples: (id) sender;
 -(IBAction) runProject: (id) sender;
 -(IBAction) newProject: (id) sender;

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

@@ -71,6 +71,18 @@
 	return YES;
 }
 
+-(IBAction) renameFile: (id) sender {
+	app->renameFile();
+}
+
+-(IBAction) removeFile: (id) sender {
+	app->removeFile();
+}
+
+-(IBAction) newGroup: (id) sender {
+	app->newGroup();
+}
+
 -(IBAction) browseExamples: (id) sender {
 	app->browseExamples();
 }

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

@@ -36,6 +36,7 @@ public:
 	
 	virtual void saveFile(){};
 	
+	void setFilePath(String newPath);
 	String getFilePath() { return filePath; }
 	
 	bool isReadOnly() { return _isReadOnly; }

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

@@ -27,6 +27,7 @@
 #include "NewProjectWindow.h"
 #include "ExampleBrowserWindow.h"
 #include "NewFileWindow.h"
+#include "ToolWindows.h"
 
 using namespace Polycode;
 
@@ -52,6 +53,8 @@ public:
 	ExampleBrowserWindow *exampleBrowserWindow;
 	NewFileWindow *newFileWindow;
 	
+	TextInputPopup *textInputPopup;
+	
 	ScreenEntity *welcomeEntity;	
 	PolycodeProjectBrowser *projectBrowser;
 		

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

@@ -50,9 +50,12 @@ public:
 	void loadConfigFile();
 	
 	// menu commands
+	void renameFile();
+	void removeFile();
 	void browseExamples();
 	void newProject();
 	void newFile();	
+	void newGroup();
 	void openProject();
 	void closeProject();	
 	void saveFile();

+ 5 - 0
IDE/Contents/Include/PolycodeProjectBrowser.h

@@ -57,6 +57,11 @@ public:
 	void addProject(PolycodeProject *project);
 	void removeProject(PolycodeProject *project);
 	
+	UITree *nodeHasName(UITree *node, String name);
+	bool listHasFileEntry(vector<OSFileEntry> files, OSFileEntry fileEntry);
+	
+	void refreshProject(PolycodeProject *project);
+	
 	void handleEvent(Event *event);
 	
 	void parseFolderIntoNode(UITree *node, String spath, PolycodeProject *parentProject);

+ 9 - 1
IDE/Contents/Include/PolycodeProjectManager.h

@@ -39,15 +39,23 @@ class PolycodeProjectManager {
 	void setProjectBrowser(PolycodeProjectBrowser *projectBrowser) { this->projectBrowser = projectBrowser; }
 	
 	PolycodeProject* getActiveProject() { return activeProject; }
-	void setActiveProject(PolycodeProject* project) { if(project) printf("setting active project: %s\n", project->getProjectName().c_str()); activeProject = project; }
+	void setActiveProject(PolycodeProject* project) {
+//		if(project) printf("setting active project: %s\n", project->getProjectName().c_str());
+		activeProject = project;
+	}
 	
 	int getProjectCount() { return projects.size(); }
 	PolycodeProject *getProjectByIndex(int index) { return projects[index]; }
 	
 	int removeProject(PolycodeProject *project);
 	
+	String activeFolder;
+	String selectedFile;
+	OSFileEntry selectedFileEntry;
+	
 protected:
 	
+	
 	PolycodeProject* activeProject;
 	
 	PolycodeProjectBrowser *projectBrowser;

+ 48 - 0
IDE/Contents/Include/ToolWindows.h

@@ -0,0 +1,48 @@
+/*
+ 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 TextInputPopup : public UIWindow {
+	public:
+		TextInputPopup();
+		~TextInputPopup();
+		
+		void setValue(String value);
+		String getValue();
+		void handleEvent(Event *event);
+		
+	protected:
+	
+		UITextInput *textInput;
+	
+		UIButton *cancelButton;
+		UIButton *okButton;
+	
+};

+ 4 - 0
IDE/Contents/Source/PolycodeEditor.cpp

@@ -38,6 +38,10 @@ bool PolycodeEditorFactory::canHandleExtension(String extension) {
 	return false;
 }
 
+void PolycodeEditor::setFilePath(String newPath) {
+	filePath = newPath;
+}
+
 PolycodeEditor::PolycodeEditor(bool _isReadOnly) : ScreenEntity() {
 	this->_isReadOnly = _isReadOnly;
 }

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

@@ -83,6 +83,9 @@ PolycodeFrame::PolycodeFrame() : ScreenEntity() {
 	newFileWindow = new NewFileWindow();
 	newFileWindow->visible = false;
 	
+	textInputPopup = new TextInputPopup();
+	textInputPopup->visible = false;
+	
 	currentEditor = NULL;
 	
 }

+ 64 - 1
IDE/Contents/Source/PolycodeIDEApp.cpp

@@ -53,7 +53,8 @@ PolycodeIDEApp::PolycodeIDEApp(PolycodeView *view) : EventDispatcher() {
 	
 	frame = new PolycodeFrame();
 	frame->setPositionMode(ScreenEntity::POSITION_TOPLEFT);
-	
+
+	frame->textInputPopup->addEventListener(this, UIEvent::OK_EVENT);	
 	frame->newProjectWindow->addEventListener(this, UIEvent::OK_EVENT);
 	frame->exampleBrowserWindow->addEventListener(this, UIEvent::OK_EVENT);
 	
@@ -79,6 +80,22 @@ PolycodeIDEApp::PolycodeIDEApp(PolycodeView *view) : EventDispatcher() {
 	loadConfigFile();
 }
 
+void PolycodeIDEApp::renameFile() {
+	if(projectManager->selectedFile != "") {
+		frame->textInputPopup->setValue(projectManager->selectedFileEntry.name);
+		frame->showModal(frame->textInputPopup);
+	}
+}
+
+void PolycodeIDEApp::removeFile() {
+	if(projectManager->selectedFile != "") {
+		core->removeDiskItem(projectManager->selectedFile);
+		if(projectManager->getActiveProject()) {
+			frame->projectBrowser->refreshProject(projectManager->getActiveProject());
+		}
+	}
+}
+
 void PolycodeIDEApp::newProject() {
 	frame->newProjectWindow->ResetForm();
 	frame->showModal(frame->newProjectWindow);
@@ -99,6 +116,15 @@ void PolycodeIDEApp::closeProject() {
 	}
 }
 
+void PolycodeIDEApp::newGroup() {
+	if(projectManager->activeFolder != "") {
+		core->createFolder(projectManager->activeFolder+"/New Folder");
+		if(projectManager->getActiveProject()) {
+			frame->getProjectBrowser()->refreshProject(projectManager->getActiveProject());
+		}
+	}
+}
+
 void PolycodeIDEApp::openProject() {
 	
 	vector<CoreFileExtension> extensions;
@@ -155,8 +181,25 @@ void PolycodeIDEApp::handleEvent(Event *event) {
 		
 		if(event->getEventCode() == Event::CHANGE_EVENT) {
 			BrowserUserData *selectedData = frame->getProjectBrowser()->getSelectedData();
+						
+			if(selectedData->type == 3) {
+				projectManager->activeFolder = selectedData->parentProject->getRootFolder();
+				projectManager->selectedFile = "";				
+			} else if(selectedData->type == 0) {
+				projectManager->activeFolder = "";
+				projectManager->selectedFile = "";
+			} else {
+				projectManager->selectedFileEntry = selectedData->fileEntry;
+				projectManager->selectedFile = selectedData->fileEntry.fullPath;
+				if(selectedData->fileEntry.type == OSFileEntry::TYPE_FILE) {
+					projectManager->activeFolder = selectedData->fileEntry.basePath;
+				} else {
+					projectManager->activeFolder = selectedData->fileEntry.fullPath;
+				}			
+			}
 			
 			projectManager->setActiveProject(selectedData->parentProject);
+			
 			if(selectedData->type == 0)
 				return;			
 			
@@ -192,6 +235,26 @@ void PolycodeIDEApp::handleEvent(Event *event) {
 		}
 	}
 	
+	if(event->getDispatcher() == frame->textInputPopup) {
+		if(event->getEventType() == "UIEvent" && event->getEventCode() == UIEvent::OK_EVENT) {
+			core->moveDiskItem(projectManager->selectedFileEntry.fullPath, projectManager->selectedFileEntry.basePath + "/" + frame->textInputPopup->getValue());			
+			if(projectManager->getActiveProject()) {
+				frame->getProjectBrowser()->refreshProject(projectManager->getActiveProject());
+			}
+			
+			PolycodeEditor *editor = editorManager->getEditorForPath(projectManager->selectedFileEntry.fullPath);
+			if(editor) {
+				editor->setFilePath(projectManager->selectedFileEntry.basePath + "/" + frame->textInputPopup->getValue());
+			}
+			
+			projectManager->selectedFileEntry.fullPath = projectManager->selectedFileEntry.basePath + "/" + frame->textInputPopup->getValue();
+			projectManager->selectedFileEntry.name = frame->textInputPopup->getValue();
+			
+			
+			frame->hideModal();			
+		}
+	}	
+	
 	if(event->getDispatcher() == frame->newProjectWindow) {
 		if(event->getEventType() == "UIEvent" && event->getEventCode() == UIEvent::OK_EVENT) {
 			projectManager->createNewProject(frame->newProjectWindow->getTemplateFolder(), frame->newProjectWindow->getProjectName(), frame->newProjectWindow->getProjectLocation());

+ 64 - 13
IDE/Contents/Source/PolycodeProjectBrowser.cpp

@@ -43,6 +43,21 @@ PolycodeProjectBrowser::~PolycodeProjectBrowser() {
 	
 }
 
+void PolycodeProjectBrowser::refreshProject(PolycodeProject *project) {
+	
+	UITree *projectTree = treeContainer->getRootNode();
+	
+	for(int i=0; i < projectTree->getNumTreeChildren(); i++) {
+		UITree *projectChild = projectTree->getTreeChild(i);
+		BrowserUserData *userData = (BrowserUserData*)projectChild->getUserData();
+		if(userData->parentProject == project) {
+			parseFolderIntoNode(projectChild, project->getRootFolder(), project);		
+			return;
+		}
+	}	
+	
+}
+
 void PolycodeProjectBrowser::removeProject(PolycodeProject *project) {
 	
 	UITree *projectTree = treeContainer->getRootNode();
@@ -62,7 +77,7 @@ void PolycodeProjectBrowser::addProject(PolycodeProject *project) {
 	projectTree->toggleCollapsed();
 	
 	BrowserUserData *data = new BrowserUserData();
-	data->type = 0;
+	data->type = 3;
 	data->parentProject = project;
 	projectTree->setUserData((void*) data)	;
 	
@@ -92,26 +107,62 @@ void PolycodeProjectBrowser::handleEvent(Event *event) {
 	ScreenEntity::handleEvent(event);
 }
 
+UITree *PolycodeProjectBrowser::nodeHasName(UITree *node, String name) {
+	for(int i=0; i < node->getNumTreeChildren(); i++) {
+		UITree *projectChild = node->getTreeChild(i);
+		if(projectChild->getLabelText() == name) {
+			return projectChild;
+		}
+	}
+	return NULL;
+}
+
+bool PolycodeProjectBrowser::listHasFileEntry(vector<OSFileEntry> files, OSFileEntry fileEntry) {
+	for(int i=0; i < files.size(); i++) {
+		if(files[i].fullPath == fileEntry.fullPath && files[i].type == fileEntry.type) {
+			return true;
+		}
+	}
+	return false;
+}
+
 void PolycodeProjectBrowser::parseFolderIntoNode(UITree *node, String spath, PolycodeProject *parentProject) {
 	printf("Parsing %s\n", spath.c_str());
 	vector<OSFileEntry> files = OSBasics::parseFolder(spath, false);
+	
+	// check if files got deleted
+	for(int i=0; i < node->getNumTreeChildren(); i++) {
+		UITree *projectChild = node->getTreeChild(i);
+		if(!listHasFileEntry(files, ((BrowserUserData*)projectChild->getUserData())->fileEntry)) {
+			node->removeTreeChild(projectChild);
+		}
+	}	
+	
 	for(int i=0; i < files.size(); i++) {
 		OSFileEntry entry = files[i];
 		if(entry.type == OSFileEntry::TYPE_FOLDER) {
-			BrowserUserData *data = new BrowserUserData();
-			data->fileEntry = entry;
-			UITree *newChild = node->addTreeChild("folder.png", entry.name, (void*) data);
-			data->type = 2;	
-			data->parentProject = parentProject;
-			parseFolderIntoNode(newChild, entry.fullPath, parentProject);
+			UITree *existing = nodeHasName(node, entry.name);
+			if(!existing) {		
+				BrowserUserData *data = new BrowserUserData();
+				data->fileEntry = entry;
+				UITree *newChild = node->addTreeChild("folder.png", entry.name, (void*) data);
+				data->type = 2;	
+				data->parentProject = parentProject;
+				parseFolderIntoNode(newChild, entry.fullPath, parentProject);				
+			} else {
+				parseFolderIntoNode(existing, entry.fullPath, parentProject);							
+			}
 		} else {
-			BrowserUserData *data = new BrowserUserData();
-			data->fileEntry = entry;
-			data->type = 1;
-			data->parentProject = parentProject;			
-			UITree *newChild = node->addTreeChild("file.png", entry.name, (void*) data);			
+			if(!nodeHasName(node, entry.name)) {
+				BrowserUserData *data = new BrowserUserData();
+				data->fileEntry = entry;
+				data->type = 1;
+				data->parentProject = parentProject;			
+				UITree *newChild = node->addTreeChild("file.png", entry.name, (void*) data);
+			}
 		}
-	}	
+	}		
+	
 }
 
 void PolycodeProjectBrowser::Resize(int newWidth, int newHeight) {

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

@@ -24,6 +24,8 @@
 
 PolycodeProjectManager::PolycodeProjectManager() {
 	activeProject = NULL;
+	activeFolder = "";
+	selectedFile = "";
 }
 
 PolycodeProjectManager::~PolycodeProjectManager() {

+ 72 - 0
IDE/Contents/Source/ToolWindows.cpp

@@ -0,0 +1,72 @@
+/*
+ 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 "ToolWindows.h"
+
+TextInputPopup::TextInputPopup() : UIWindow(L"", 300, 95) {
+	
+	textInput = new UITextInput(false, 300-(padding*3.0), 12);	
+	addChild(textInput);
+	textInput->setPosition(padding, 35);
+		
+	cancelButton = new UIButton(L"Cancel", 100);
+	cancelButton->addEventListener(this, UIEvent::CLICK_EVENT);
+	addChild(cancelButton);
+	cancelButton->setPosition(300-100-padding-100-10, 60);		
+	
+	okButton = new UIButton(L"OK", 100);
+	okButton->addEventListener(this, UIEvent::CLICK_EVENT);
+	addChild(okButton);
+	okButton->setPosition(300-100-padding, 60);
+	
+	closeOnEscape = true;
+
+}
+
+String TextInputPopup::getValue() {
+	return textInput->getText();
+}
+
+void TextInputPopup::setValue(String value) {
+	textInput->setText(value);
+	focusChild(textInput);	
+}
+
+void TextInputPopup::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);				
+			}									
+		}
+	}
+	UIWindow::handleEvent(event);	
+}
+
+
+TextInputPopup::~TextInputPopup() {
+	
+}

+ 3 - 0
Modules/Contents/UI/Include/PolyUITree.h

@@ -59,10 +59,13 @@ namespace Polycode {
 			UITree *getTreeChild(int index) { return treeChildren[index]; }
 			void removeTreeChild(UITree *child);
 		
+			String getLabelText();
+			
 			Number handleRotation;
 		
 		private:
 		
+			String labelText;
 			void *userData;
 			Number treeWidth;
 			Number treeOffset;

+ 6 - 2
Modules/Contents/UI/Source/PolyUITree.cpp

@@ -31,7 +31,7 @@ using namespace Polycode;
 
 UITree::UITree(String icon, String text, Number treeWidth, Number treeOffset) : ScreenEntity() {
 		
-	
+	labelText = text;
 	Config *conf = CoreServices::getInstance()->getConfig();
 	
 	handleRotation = 0;
@@ -109,6 +109,10 @@ UITree::UITree(String icon, String text, Number treeWidth, Number treeOffset) :
 	refreshTree();
 }
 
+String UITree::getLabelText() {
+	return labelText;
+}
+
 void UITree::removeTreeChild(UITree *child) {
 	for(int i=0; i < treeChildren.size(); i++) {
 		if(treeChildren[i] == child) {			
@@ -172,7 +176,6 @@ void UITree::handleEvent(Event *event) {
 			break;
 			case UITreeEvent::NEED_REFRESH_EVENT:
 				refreshTree();
-				dispatchEvent(new UITreeEvent(), UITreeEvent::NEED_REFRESH_EVENT);
 			break;
 		}
 		}
@@ -231,6 +234,7 @@ void UITree::refreshTree() {
 	hitheight = height;
 	
 	selection->visible = selected;
+	dispatchEvent(new UITreeEvent(), UITreeEvent::NEED_REFRESH_EVENT);	
 }
 
 Number UITree::getTreeHeight() {