about summary refs log tree commit diff
path: root/src/game
diff options
context:
space:
mode:
authoroy <Tom_Adams@web.de>2010-10-16 18:33:54 +0200
committeroy <Tom_Adams@web.de>2010-10-16 18:33:54 +0200
commit85fd27284621d335dd76ee66da7349b19004adc1 (patch)
tree82d377b016cb5dae093b76bb16a9eacf82f1fd05 /src/game
parent662f43919cfb1cd449a75516a87ad2e9623636b1 (diff)
downloadzcatch-85fd27284621d335dd76ee66da7349b19004adc1.tar.gz
zcatch-85fd27284621d335dd76ee66da7349b19004adc1.zip
added the possibility to create a new folder within the editor's save file dialog
Diffstat (limited to 'src/game')
-rw-r--r--src/game/editor/ed_editor.cpp21
1 files changed, 21 insertions, 0 deletions
diff --git a/src/game/editor/ed_editor.cpp b/src/game/editor/ed_editor.cpp
index 1c6ad225..1cf367d4 100644
--- a/src/game/editor/ed_editor.cpp
+++ b/src/game/editor/ed_editor.cpp
@@ -2293,6 +2293,7 @@ void CEditor::RenderFileDialog()
 	// the buttons
 	static int s_OkButton = 0;
 	static int s_CancelButton = 0;
+	static int s_NewFolderButton = 0;
 
 	CUIRect Button;
 	ButtonBar.VSplitRight(50.0f, &ButtonBar, &Button);
@@ -2341,6 +2342,26 @@ void CEditor::RenderFileDialog()
 	ButtonBar.VSplitRight(50.0f, &ButtonBar, &Button);
 	if(DoButton_Editor(&s_CancelButton, Localize("Cancel"), 0, &Button, 0, 0) || Input()->KeyPressed(KEY_ESCAPE))
 		m_Dialog = DIALOG_NONE;
+
+	if(m_FileDialogStorageType == IStorage::TYPE_SAVE)
+	{
+		ButtonBar.VSplitLeft(40.0f, 0, &ButtonBar);
+		ButtonBar.VSplitLeft(70.0f, &Button, &ButtonBar);
+		if(DoButton_Editor(&s_NewFolderButton, Localize("New folder"), 0, &Button, 0, 0))
+		{
+			if(*m_aFileDialogFileName)
+			{
+				char aBuf[512];
+				str_format(aBuf, sizeof(aBuf), "%s/%s", m_pFileDialogPath, m_aFileDialogFileName);
+				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;
+			}
+		}
+	}
 }
 
 void CEditor::FilelistPopulate(int StorageType)