Remove file/dialog.cpp,h

This commit is contained in:
Henrik Rydgård committed 2015-09-19 10:29:16 +02:00
1 parent df47f41db6
commit 58ffa5f38c
6 files changed
-110

No files matched your search

-2
View File
@@ -904,8 +904,6 @@ add_library(native STATIC
ext/native/ext/vjson/block_allocator.h
ext/native/file/chunk_file.cpp
ext/native/file/chunk_file.h
ext/native/file/dialog.cpp
ext/native/file/dialog.h
ext/native/file/easy_file.cpp
ext/native/file/easy_file.h
ext/native/file/fd_util.cpp
-1
View File
@@ -41,7 +41,6 @@ LOCAL_SRC_FILES :=\
ext/stb_vorbis/stb_vorbis.c.arm \
ext/vjson/json.cpp \
ext/vjson/block_allocator.cpp \
file/dialog.cpp \
file/fd_util.cpp \
file/easy_file.cpp \
file/chunk_file.cpp \
-89
View File
@@ -1,89 +0,0 @@
#ifdef _WIN32
#define WIN32_LEAN_AND_MEAN
#include <windows.h>
#include <commdlg.h>
#include <string>
#include "util/text/utf8.h"
// For desktop operating systems only. Stubbed out on Android.
// Simplified as this will only be used in utilities / temp code.
// An false returned means cancel;
bool OpenFileDialog(const char *title, const char *extension, std::string *filename)
{
std::wstring wtitle = ConvertUTF8ToWString(std::string(title));
std::wstring wext = ConvertUTF8ToWString(std::string(extension));
OPENFILENAME of;
memset(&of, 0, sizeof(of));
wchar_t buffer[512] = {0};
of.lStructSize = sizeof(OPENFILENAME);
of.hInstance = 0;
of.hwndOwner = GetActiveWindow();
// These weird strings with zeroes in them can't be dealt with using normal string
// functions, so here we go - evil hackery.
wchar_t filter[256] = L"XXX files\0*.XXX\0\0";
memcpy(filter, wext.c_str(), 3 * sizeof(wchar_t));
memcpy(filter + 12, wext.c_str(), 3 * sizeof(wchar_t));
of.lpstrFilter = filter;
of.lpstrDefExt = wext.c_str();
of.lpstrFile = buffer;
of.nMaxFile = 511;
of.Flags = OFN_FILEMUSTEXIST;
if (!GetOpenFileName(&of)) return false;
*filename = ConvertWStringToUTF8(of.lpstrFile);
return true;
}
bool SaveFileDialog(const char *title, const char *extension, std::string *filename) {
std::wstring wtitle = ConvertUTF8ToWString(std::string(title));
std::wstring wext = ConvertUTF8ToWString(std::string(extension));
OPENFILENAME of;
memset(&of, 0, sizeof(of));
wchar_t buffer[512] = {0};
of.lStructSize = sizeof(OPENFILENAME);
of.hInstance = 0;
of.hwndOwner = GetActiveWindow();
// These weird strings with zeroes in them can't be dealt with using normal string
// functions, so here we go - evil hackery.
wchar_t filter[256] = L"XXX files\0*.XXX\0\0";
memcpy(filter, wext.c_str(), 3 * sizeof(wchar_t));
memcpy(filter + 12, wext.c_str(), 3 * sizeof(wchar_t));
of.lpstrFilter = filter;
of.lpstrDefExt = wext.c_str();
of.lpstrFile = buffer;
of.nMaxFile = 511;
of.Flags = OFN_OVERWRITEPROMPT | OFN_HIDEREADONLY;
if (!GetSaveFileName(&of))
return false;
*filename = ConvertWStringToUTF8(of.lpstrFile);
return true;
}
#else
#include <string>
#include "base/basictypes.h"
#include "base/logging.h"
bool OpenFileDialog(const char *title, const char *extension, std::string *filename)
{
ELOG("Asked for OpenFileDialog, not present on this platform.");
return false;
}
bool SaveFileDialog(const char *title, const char *extension, std::string *filename)
{
ELOG("Asked for SaveFileDialog, not present on this platform.");
return false;
}
#endif
-10
View File
@@ -1,10 +0,0 @@
#pragma once
#pragma once
#include <string>
#include "file/dialog.h"
bool OpenFileDialog(const char *title, const char *extension, std::string *filename);
bool SaveFileDialog(const char *title, const char *extension, std::string *filename);
-2
View File
@@ -224,7 +224,6 @@
<ClInclude Include="ext\vjson\block_allocator.h" />
<ClInclude Include="ext\vjson\json.h" />
<ClInclude Include="file\chunk_file.h" />
<ClInclude Include="file\dialog.h" />
<ClInclude Include="file\easy_file.h" />
<ClInclude Include="file\fd_util.h" />
<ClInclude Include="file\file_util.h" />
@@ -690,7 +689,6 @@
<ClCompile Include="ext\vjson\block_allocator.cpp" />
<ClCompile Include="ext\vjson\json.cpp" />
<ClCompile Include="file\chunk_file.cpp" />
<ClCompile Include="file\dialog.cpp" />
<ClCompile Include="file\easy_file.cpp" />
<ClCompile Include="file\fd_util.cpp" />
<ClCompile Include="file\file_util.cpp" />
-6
View File
@@ -135,9 +135,6 @@
<ClInclude Include="ui\ui.h">
<Filter>ui</Filter>
</ClInclude>
<ClInclude Include="file\dialog.h">
<Filter>file</Filter>
</ClInclude>
<ClInclude Include="base\mutex.h">
<Filter>base</Filter>
</ClInclude>
@@ -428,9 +425,6 @@
<ClCompile Include="ui\ui.cpp">
<Filter>ui</Filter>
</ClCompile>
<ClCompile Include="file\dialog.cpp">
<Filter>file</Filter>
</ClCompile>
<ClCompile Include="util\bits\bits.cpp">
<Filter>util</Filter>
</ClCompile>