about summary refs log tree commit diff
path: root/src/game/editor/ed_editor.cpp
diff options
context:
space:
mode:
authoroy <Tom_Adams@web.de>2011-03-20 22:53:50 +0100
committeroy <Tom_Adams@web.de>2011-03-20 22:53:50 +0100
commit588a411666de052fd237f9aaa857278ade420b51 (patch)
tree5c934bf0eb635e87db3c2344a3145e9fe17fee47 /src/game/editor/ed_editor.cpp
parent8d159ce65a867889db62c4827f25951de33fe106 (diff)
downloadzcatch-588a411666de052fd237f9aaa857278ade420b51.tar.gz
zcatch-588a411666de052fd237f9aaa857278ade420b51.zip
added a popup to create a new folder in the editor's file dialog and show an error if it fails
Diffstat (limited to 'src/game/editor/ed_editor.cpp')
-rw-r--r--src/game/editor/ed_editor.cpp21
1 files changed, 7 insertions, 14 deletions
diff --git a/src/game/editor/ed_editor.cpp b/src/game/editor/ed_editor.cpp
index 5420b9a2..283ded42 100644
--- a/src/game/editor/ed_editor.cpp
+++ b/src/game/editor/ed_editor.cpp
@@ -2212,8 +2212,9 @@ void CEditor::RenderFileDialog()
 {
 	// GUI coordsys
 	Graphics()->MapScreen(UI()->Screen()->x, UI()->Screen()->y, UI()->Screen()->w, UI()->Screen()->h);
-
 	CUIRect View = *UI()->Screen();
+	float Width = View.w, Height = View.h;
+
 	RenderTools()->DrawUIRect(&View, vec4(0,0,0,0.25f), 0, 0);
 	View.VMargin(150.0f, &View);
 	View.HMargin(50.0f, &View);
@@ -2386,19 +2387,11 @@ void CEditor::RenderFileDialog()
 		ButtonBar.VSplitLeft(70.0f, &Button, &ButtonBar);
 		if(DoButton_Editor(&s_NewFolderButton, "New folder", 0, &Button, 0, 0))
 		{
-			if(*m_aFileDialogFileName)
-			{
-				char aBuf[512];
-				str_format(aBuf, sizeof(aBuf), "%s/%s", m_pFileDialogPath, m_aFileDialogFileName);
-				if(Storage()->CreateFolder(aBuf, IStorage::TYPE_SAVE))
-				{
-					FilelistPopulate(IStorage::TYPE_SAVE);
-					if(m_FilesSelectedIndex >= 0 && !m_FileList[m_FilesSelectedIndex].m_IsDir)
-						str_copy(m_aFileDialogFileName, m_FileList[m_FilesSelectedIndex].m_aFilename, sizeof(m_aFileDialogFileName));
-					else
-						m_aFileDialogFileName[0] = 0;
-				}
-			}
+			m_FileDialogNewFolderName[0] = 0;
+			m_FileDialogErrString[0] = 0;
+			static int s_NewFolderPopupID = 0;
+			UiInvokePopupMenu(&s_NewFolderPopupID, 0, Width/2.0f-200.0f, Height/2.0f-100.0f, 400.0f, 200.0f, PopupNewFolder);
+			UI()->SetActiveItem(0);
 		}
 	}
 }