From 75c07011b7c4d06acd7b45dabdcd60ab9d80f385 Mon Sep 17 00:00:00 2001 From: Daniel Wilhelm Date: Fri, 18 Apr 2014 17:29:28 +0200 Subject: 5.23 --- ui/IFileDialog_Vista/IFileDialog_Vista.vcxproj | 244 ------------------------- ui/IFileDialog_Vista/ifile_dialog.cpp | 108 ----------- ui/IFileDialog_Vista/ifile_dialog.h | 67 ------- 3 files changed, 419 deletions(-) delete mode 100644 ui/IFileDialog_Vista/IFileDialog_Vista.vcxproj delete mode 100644 ui/IFileDialog_Vista/ifile_dialog.cpp delete mode 100644 ui/IFileDialog_Vista/ifile_dialog.h (limited to 'ui/IFileDialog_Vista') diff --git a/ui/IFileDialog_Vista/IFileDialog_Vista.vcxproj b/ui/IFileDialog_Vista/IFileDialog_Vista.vcxproj deleted file mode 100644 index 7f84b4fb..00000000 --- a/ui/IFileDialog_Vista/IFileDialog_Vista.vcxproj +++ /dev/null @@ -1,244 +0,0 @@ - - - - - Debug - Win32 - - - Debug - x64 - - - Release - Win32 - - - Release - x64 - - - - - - - - - - - {70394AEF-5897-4911-AFA1-82EAF0581EFA} - ShadowDll - Win32Proj - - - - DynamicLibrary - Unicode - true - v120_xp - - - DynamicLibrary - Unicode - v120_xp - - - DynamicLibrary - Unicode - true - v120_xp - - - DynamicLibrary - Unicode - v120_xp - - - - - - - - - - - - - - - - - - - <_ProjectFileVersion>10.0.30319.1 - OBJ\$(ProjectName)_$(Configuration)_$(Platform)\ - OBJ\$(ProjectName)_$(Configuration)_$(Platform)\ - OBJ\$(ProjectName)_$(Configuration)_$(Platform)\ - OBJ\$(ProjectName)_$(Configuration)_$(Platform)\ - .\ - OBJ\$(ProjectName)_$(Configuration)_$(Platform)\ - false - .\ - OBJ\$(ProjectName)_$(Configuration)_$(Platform)\ - false - IFileDialog_Vista_$(Platform) - IFileDialog_Vista_$(Platform) - IFileDialog_Vista_$(Platform) - IFileDialog_Vista_$(Platform) - - - - $(IntDir)Build.html - - - Disabled - ZEN_WIN;WXINTL_NO_GETTEXT_MACRO;_DEBUG;_WINDOWS;_USRDLL;IFILE_DIALOG_VISTA_DLL_EXPORTS;%(PreprocessorDefinitions) - false - EnableFastChecks - MultiThreadedDebugDLL - - - Level4 - true - EditAndContinue - 4100 - ../.. - true - true - NoExtensions - - - $(OutDir)$(TargetName)$(TargetExt) - true - true - $(IntDir)$(TargetName).pdb - Windows - - - $(IntDir)$(TargetName).lib - MachineX86 - %(AdditionalLibraryDirectories) - %(AdditionalDependencies) - - - - - $(IntDir)Build.html - - - X64 - - - Disabled - ZEN_WIN;WXINTL_NO_GETTEXT_MACRO;_DEBUG;_WINDOWS;_USRDLL;IFILE_DIALOG_VISTA_DLL_EXPORTS;%(PreprocessorDefinitions) - false - EnableFastChecks - MultiThreadedDebugDLL - - - Level4 - true - ProgramDatabase - 4100 - ../.. - true - true - - - $(OutDir)$(TargetName)$(TargetExt) - true - true - $(IntDir)$(TargetName).pdb - Windows - - - $(IntDir)$(TargetName).lib - MachineX64 - - - %(AdditionalDependencies) - - - - - $(IntDir)Build.html - - - MaxSpeed - true - ZEN_WIN;WXINTL_NO_GETTEXT_MACRO;NDEBUG;_WINDOWS;_USRDLL;IFILE_DIALOG_VISTA_DLL_EXPORTS;%(PreprocessorDefinitions) - MultiThreaded - true - - - Level4 - true - ProgramDatabase - 4100 - Speed - ../.. - false - true - NoExtensions - - - $(OutDir)$(TargetName)$(TargetExt) - true - true - Windows - true - true - UseLinkTimeCodeGeneration - - - $(IntDir)$(TargetName).lib - MachineX86 - %(AdditionalLibraryDirectories) - %(AdditionalDependencies) - - - - - $(IntDir)Build.html - - - X64 - - - MaxSpeed - true - ZEN_WIN;WXINTL_NO_GETTEXT_MACRO;NDEBUG;_WINDOWS;_USRDLL;IFILE_DIALOG_VISTA_DLL_EXPORTS;%(PreprocessorDefinitions) - MultiThreaded - true - - - Level4 - true - ProgramDatabase - 4100 - Speed - ../.. - false - true - - - $(OutDir)$(TargetName)$(TargetExt) - true - true - Windows - true - true - UseLinkTimeCodeGeneration - - - $(IntDir)$(TargetName).lib - MachineX64 - - - %(AdditionalDependencies) - - - - - - \ No newline at end of file diff --git a/ui/IFileDialog_Vista/ifile_dialog.cpp b/ui/IFileDialog_Vista/ifile_dialog.cpp deleted file mode 100644 index f56df9e7..00000000 --- a/ui/IFileDialog_Vista/ifile_dialog.cpp +++ /dev/null @@ -1,108 +0,0 @@ -// ************************************************************************** -// * This file is part of the FreeFileSync project. It is distributed under * -// * GNU General Public License: http://www.gnu.org/licenses/gpl.html * -// * Copyright (C) Zenju (zenju AT gmx DOT de) - All Rights Reserved * -// ************************************************************************** - -#include "ifile_dialog.h" -#define WIN32_LEAN_AND_MEAN -#include -#include -#include -#include -#include - -using namespace zen; - - -namespace -{ -bool showFolderPickerImpl(HWND ownerWindow, //throw SysError; return "false" if cancelled by user - const wchar_t* defaultFolder, //optional! - const GUID* persistenceGuid, // - std::wstring& selectedFolder) -{ - ComPtr fileDlg; - ZEN_COM_CHECK(::CoCreateInstance(CLSID_FileOpenDialog, //throw SysError - nullptr, - CLSCTX_ALL, - IID_PPV_ARGS(fileDlg.init()))); - - if (persistenceGuid) - ZEN_COM_CHECK(fileDlg->SetClientGuid(*persistenceGuid)); - - FILEOPENDIALOGOPTIONS dlgOptions = 0; - ZEN_COM_CHECK(fileDlg->GetOptions(&dlgOptions)); //throw SysError - ZEN_COM_CHECK(fileDlg->SetOptions(dlgOptions | FOS_PICKFOLDERS | FOS_NOVALIDATE | FOS_FORCEFILESYSTEM)); - - if (defaultFolder) //show last selection instead of top level if no default available - { - ComPtr folderItem; - ZEN_COM_CHECK(::SHCreateItemFromParsingName(defaultFolder, - nullptr, - IID_PPV_ARGS(folderItem.init()))); - ZEN_COM_CHECK(fileDlg->SetFolder(folderItem.get())); - } - - try - { - ZEN_COM_CHECK(fileDlg->Show(ownerWindow)); //may fail with: HRESULT_FROM_WIN32(ERROR_CANCELLED) - } - catch (const SysError&) { return false; } - - ComPtr folderItem; - ZEN_COM_CHECK(fileDlg->GetResult(folderItem.init())); - - LPWSTR folderPath = nullptr; - ZEN_COM_CHECK(folderItem->GetDisplayName(SIGDN_FILESYSPATH, &folderPath)); - ZEN_ON_SCOPE_EXIT(::CoTaskMemFree(folderPath)); - - selectedFolder = folderPath; - return true; -} - -wchar_t* allocString(const std::wstring& msg) //ownership passed -{ - auto tmp = new wchar_t [msg.size() + 1]; //std::bad_alloc ? - ::wmemcpy(tmp, msg.c_str(), msg.size() + 1); //include 0-termination - return tmp; -} -} - -//################################################################################################## - -void ifile::showFolderPicker(void* ownerWindow, - const wchar_t* defaultFolder, - const GuidProxy* guid, - wchar_t*& selectedFolder, - bool& cancelled, - wchar_t*& errorMsg) -{ - selectedFolder = nullptr; - cancelled = false; - errorMsg = nullptr; - - try - { - static_assert(sizeof(GuidProxy) == sizeof(GUID), ""); - GUID winGuid = {}; - if (guid) - ::memcpy(&winGuid, guid, sizeof(GUID)); - - std::wstring folderPath; - if (showFolderPickerImpl(static_cast(ownerWindow), defaultFolder, guid ? &winGuid : nullptr, folderPath)) //throw SysError - selectedFolder = allocString(folderPath); - else - cancelled = true; - } - catch (const SysError& e) - { - errorMsg = allocString(e.toString()); //std::bad_alloc ? - } -} - - -void ifile::freeString(const wchar_t* str) -{ - delete [] str; -} diff --git a/ui/IFileDialog_Vista/ifile_dialog.h b/ui/IFileDialog_Vista/ifile_dialog.h deleted file mode 100644 index 5b4dc532..00000000 --- a/ui/IFileDialog_Vista/ifile_dialog.h +++ /dev/null @@ -1,67 +0,0 @@ -// ************************************************************************** -// * This file is part of the FreeFileSync project. It is distributed under * -// * GNU General Public License: http://www.gnu.org/licenses/gpl.html * -// * Copyright (C) Zenju (zenju AT gmx DOT de) - All Rights Reserved * -// ************************************************************************** - -#ifndef IFILE_DIALOG_HEADER_916743921746324 -#define IFILE_DIALOG_HEADER_916743921746324 - -#ifdef IFILE_DIALOG_VISTA_DLL_EXPORTS -#define DLL_FUNCTION_DECLARATION extern "C" __declspec(dllexport) -#else -#define DLL_FUNCTION_DECLARATION extern "C" __declspec(dllimport) -#endif - -#include - - -namespace ifile -{ -/*-------------- - |declarations| - --------------*/ - -//COM needs to be initialized before calling any of these functions! CoInitializeEx/CoUninitialize -//Requires Windows Vista and later - -typedef char GuidProxy[16]; //= Windows 128-bit GUID; we don't want to include "Guiddef.h" here! - -DLL_FUNCTION_DECLARATION -void showFolderPicker(void* ownerWindow, //in; ==HWND - const wchar_t* defaultFolder, //in, optional! - const GuidProxy* guid, //set nullptr by default: Windows stores dialog state (position, x, y coordinates, ect.) associated with the process executable name => use other GUID when needed - wchar_t*& selectedFolder, //out: call freeString() after use! - bool& cancelled, //out - wchar_t*& errorMsg); //out, optional: call freeString() after use! - -DLL_FUNCTION_DECLARATION -void freeString(const wchar_t* str); - -/*---------- - |typedefs| - ----------*/ -typedef bool (*FunType_showFolderPicker)(void* ownerWindow, - const wchar_t* defaultFolder, - const GuidProxy* guid, - wchar_t*& selectedFolder, - bool& cancelled, - wchar_t*& errorMsg); -typedef void (*FunType_freeString)(const wchar_t* str); - -/*-------------- - |symbol names| - --------------*/ -//(use const pointers to ensure internal linkage) -const char funName_showFolderPicker[] = "showFolderPicker"; -const char funName_freeString [] = "freeString"; - -/*--------------- - |library names| - ---------------*/ -inline const wchar_t* getDllName() { return zen::is64BitBuild ? L"IFileDialog_Vista_x64.dll" : L"IFileDialog_Vista_Win32.dll"; } -} - -#undef DLL_FUNCTION_DECLARATION - -#endif //IFILE_DIALOG_HEADER_916743921746324 -- cgit