diff options
author | Daniel Wilhelm <daniel@wili.li> | 2014-04-18 17:21:16 +0200 |
---|---|---|
committer | Daniel Wilhelm <daniel@wili.li> | 2014-04-18 17:21:16 +0200 |
commit | 6d15812d7d93370d47e63f6bf9f70be40f5a9c5d (patch) | |
tree | 8e7bde205084ca23e1766d42305824c927c2ee5f /ui | |
parent | 5.6 (diff) | |
download | FreeFileSync-6d15812d7d93370d47e63f6bf9f70be40f5a9c5d.tar.gz FreeFileSync-6d15812d7d93370d47e63f6bf9f70be40f5a9c5d.tar.bz2 FreeFileSync-6d15812d7d93370d47e63f6bf9f70be40f5a9c5d.zip |
5.7
Diffstat (limited to 'ui')
52 files changed, 1616 insertions, 1162 deletions
diff --git a/ui/IFileDialog_Vista/IFileDialog_Vista.vcxproj b/ui/IFileDialog_Vista/IFileDialog_Vista.vcxproj new file mode 100644 index 00000000..f3dfcd23 --- /dev/null +++ b/ui/IFileDialog_Vista/IFileDialog_Vista.vcxproj @@ -0,0 +1,230 @@ +<?xml version="1.0" encoding="utf-8"?> +<Project DefaultTargets="Build" ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> + <ItemGroup Label="ProjectConfigurations"> + <ProjectConfiguration Include="Debug|Win32"> + <Configuration>Debug</Configuration> + <Platform>Win32</Platform> + </ProjectConfiguration> + <ProjectConfiguration Include="Debug|x64"> + <Configuration>Debug</Configuration> + <Platform>x64</Platform> + </ProjectConfiguration> + <ProjectConfiguration Include="Release|Win32"> + <Configuration>Release</Configuration> + <Platform>Win32</Platform> + </ProjectConfiguration> + <ProjectConfiguration Include="Release|x64"> + <Configuration>Release</Configuration> + <Platform>x64</Platform> + </ProjectConfiguration> + </ItemGroup> + <ItemGroup> + <ClCompile Include="dll_main.cpp" /> + <ClCompile Include="ifile_dialog.cpp" /> + </ItemGroup> + <ItemGroup> + <ClInclude Include="ifile_dialog.h" /> + </ItemGroup> + <PropertyGroup Label="Globals"> + <ProjectGuid>{70394AEF-5897-4911-AFA1-82EAF0581EFA}</ProjectGuid> + <RootNamespace>ShadowDll</RootNamespace> + <Keyword>Win32Proj</Keyword> + </PropertyGroup> + <Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" /> + <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration"> + <ConfigurationType>DynamicLibrary</ConfigurationType> + <CharacterSet>Unicode</CharacterSet> + <WholeProgramOptimization>true</WholeProgramOptimization> + <PlatformToolset>Windows7.1SDK</PlatformToolset> + </PropertyGroup> + <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration"> + <ConfigurationType>DynamicLibrary</ConfigurationType> + <CharacterSet>Unicode</CharacterSet> + <PlatformToolset>Windows7.1SDK</PlatformToolset> + </PropertyGroup> + <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="Configuration"> + <ConfigurationType>DynamicLibrary</ConfigurationType> + <CharacterSet>Unicode</CharacterSet> + <WholeProgramOptimization>true</WholeProgramOptimization> + <PlatformToolset>Windows7.1SDK</PlatformToolset> + </PropertyGroup> + <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="Configuration"> + <ConfigurationType>DynamicLibrary</ConfigurationType> + <CharacterSet>Unicode</CharacterSet> + <PlatformToolset>Windows7.1SDK</PlatformToolset> + </PropertyGroup> + <Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" /> + <ImportGroup Label="ExtensionSettings"> + </ImportGroup> + <ImportGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="PropertySheets"> + <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" /> + </ImportGroup> + <ImportGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="PropertySheets"> + <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" /> + </ImportGroup> + <ImportGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="PropertySheets"> + <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" /> + </ImportGroup> + <ImportGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="PropertySheets"> + <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" /> + </ImportGroup> + <PropertyGroup Label="UserMacros" /> + <PropertyGroup> + <_ProjectFileVersion>10.0.30319.1</_ProjectFileVersion> + <OutDir Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">OBJ\$(ProjectName)_$(Configuration)_$(Platform)\</OutDir> + <IntDir Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">OBJ\$(ProjectName)_$(Configuration)_$(Platform)\</IntDir> + <LinkIncremental Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">false</LinkIncremental> + <OutDir Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">OBJ\$(ProjectName)_$(Configuration)_$(Platform)\</OutDir> + <IntDir Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">OBJ\$(ProjectName)_$(Configuration)_$(Platform)\</IntDir> + <LinkIncremental Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">false</LinkIncremental> + <OutDir Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">.\</OutDir> + <IntDir Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">OBJ\$(ProjectName)_$(Configuration)_$(Platform)\</IntDir> + <LinkIncremental Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">false</LinkIncremental> + <OutDir Condition="'$(Configuration)|$(Platform)'=='Release|x64'">.\</OutDir> + <IntDir Condition="'$(Configuration)|$(Platform)'=='Release|x64'">OBJ\$(ProjectName)_$(Configuration)_$(Platform)\</IntDir> + <LinkIncremental Condition="'$(Configuration)|$(Platform)'=='Release|x64'">false</LinkIncremental> + <TargetName Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">IFileDialog_Vista_$(Platform)</TargetName> + <TargetName Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">IFileDialog_Vista_$(Platform)</TargetName> + <TargetName Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">IFileDialog_Vista_$(Platform)</TargetName> + <TargetName Condition="'$(Configuration)|$(Platform)'=='Release|x64'">IFileDialog_Vista_$(Platform)</TargetName> + </PropertyGroup> + <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'"> + <BuildLog> + <Path>$(IntDir)Build.html</Path> + </BuildLog> + <ClCompile> + <Optimization>Disabled</Optimization> + <PreprocessorDefinitions>_DEBUG;_WINDOWS;_USRDLL;IFILE_DIALOG_VISTA_DLL_EXPORTS;%(PreprocessorDefinitions)</PreprocessorDefinitions> + <MinimalRebuild>true</MinimalRebuild> + <BasicRuntimeChecks>EnableFastChecks</BasicRuntimeChecks> + <RuntimeLibrary>MultiThreadedDebugDLL</RuntimeLibrary> + <PrecompiledHeader> + </PrecompiledHeader> + <WarningLevel>Level4</WarningLevel> + <SuppressStartupBanner>true</SuppressStartupBanner> + <DebugInformationFormat>EditAndContinue</DebugInformationFormat> + <DisableSpecificWarnings>4100</DisableSpecificWarnings> + <AdditionalIncludeDirectories>../..</AdditionalIncludeDirectories> + </ClCompile> + <Link> + <OutputFile>$(OutDir)$(TargetName)$(TargetExt)</OutputFile> + <SuppressStartupBanner>true</SuppressStartupBanner> + <GenerateDebugInformation>true</GenerateDebugInformation> + <ProgramDatabaseFile>$(IntDir)$(TargetName).pdb</ProgramDatabaseFile> + <SubSystem>Windows</SubSystem> + <ProfileGuidedDatabase> + </ProfileGuidedDatabase> + <ImportLibrary>$(IntDir)$(TargetName).lib</ImportLibrary> + <TargetMachine>MachineX86</TargetMachine> + <AdditionalLibraryDirectories>%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories> + </Link> + </ItemDefinitionGroup> + <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'"> + <BuildLog> + <Path>$(IntDir)Build.html</Path> + </BuildLog> + <Midl> + <TargetEnvironment>X64</TargetEnvironment> + </Midl> + <ClCompile> + <Optimization>Disabled</Optimization> + <PreprocessorDefinitions>_DEBUG;_WINDOWS;_USRDLL;IFILE_DIALOG_VISTA_DLL_EXPORTS;%(PreprocessorDefinitions)</PreprocessorDefinitions> + <MinimalRebuild>true</MinimalRebuild> + <BasicRuntimeChecks>EnableFastChecks</BasicRuntimeChecks> + <RuntimeLibrary>MultiThreadedDebugDLL</RuntimeLibrary> + <PrecompiledHeader> + </PrecompiledHeader> + <WarningLevel>Level4</WarningLevel> + <SuppressStartupBanner>true</SuppressStartupBanner> + <DebugInformationFormat>ProgramDatabase</DebugInformationFormat> + <DisableSpecificWarnings>4100</DisableSpecificWarnings> + <AdditionalIncludeDirectories>../..</AdditionalIncludeDirectories> + </ClCompile> + <Link> + <OutputFile>$(OutDir)$(TargetName)$(TargetExt)</OutputFile> + <SuppressStartupBanner>true</SuppressStartupBanner> + <GenerateDebugInformation>true</GenerateDebugInformation> + <ProgramDatabaseFile>$(IntDir)$(TargetName).pdb</ProgramDatabaseFile> + <SubSystem>Windows</SubSystem> + <ProfileGuidedDatabase> + </ProfileGuidedDatabase> + <ImportLibrary>$(IntDir)$(TargetName).lib</ImportLibrary> + <TargetMachine>MachineX64</TargetMachine> + <AdditionalLibraryDirectories></AdditionalLibraryDirectories> + </Link> + </ItemDefinitionGroup> + <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'"> + <BuildLog> + <Path>$(IntDir)Build.html</Path> + </BuildLog> + <ClCompile> + <Optimization>MaxSpeed</Optimization> + <IntrinsicFunctions>true</IntrinsicFunctions> + <PreprocessorDefinitions>NDEBUG;_WINDOWS;_USRDLL;IFILE_DIALOG_VISTA_DLL_EXPORTS;%(PreprocessorDefinitions)</PreprocessorDefinitions> + <RuntimeLibrary>MultiThreaded</RuntimeLibrary> + <FunctionLevelLinking>true</FunctionLevelLinking> + <PrecompiledHeader> + </PrecompiledHeader> + <WarningLevel>Level4</WarningLevel> + <SuppressStartupBanner>true</SuppressStartupBanner> + <DebugInformationFormat>ProgramDatabase</DebugInformationFormat> + <DisableSpecificWarnings>4100</DisableSpecificWarnings> + <FavorSizeOrSpeed>Speed</FavorSizeOrSpeed> + <AdditionalIncludeDirectories>../..</AdditionalIncludeDirectories> + </ClCompile> + <Link> + <OutputFile>$(OutDir)$(TargetName)$(TargetExt)</OutputFile> + <SuppressStartupBanner>true</SuppressStartupBanner> + <GenerateDebugInformation>false</GenerateDebugInformation> + <SubSystem>Windows</SubSystem> + <OptimizeReferences>true</OptimizeReferences> + <EnableCOMDATFolding>true</EnableCOMDATFolding> + <LinkTimeCodeGeneration>UseLinkTimeCodeGeneration</LinkTimeCodeGeneration> + <ProfileGuidedDatabase> + </ProfileGuidedDatabase> + <ImportLibrary>$(IntDir)$(TargetName).lib</ImportLibrary> + <TargetMachine>MachineX86</TargetMachine> + <AdditionalLibraryDirectories>%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories> + </Link> + </ItemDefinitionGroup> + <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'"> + <BuildLog> + <Path>$(IntDir)Build.html</Path> + </BuildLog> + <Midl> + <TargetEnvironment>X64</TargetEnvironment> + </Midl> + <ClCompile> + <Optimization>MaxSpeed</Optimization> + <IntrinsicFunctions>true</IntrinsicFunctions> + <PreprocessorDefinitions>NDEBUG;_WINDOWS;_USRDLL;IFILE_DIALOG_VISTA_DLL_EXPORTS;%(PreprocessorDefinitions)</PreprocessorDefinitions> + <RuntimeLibrary>MultiThreaded</RuntimeLibrary> + <FunctionLevelLinking>true</FunctionLevelLinking> + <PrecompiledHeader> + </PrecompiledHeader> + <WarningLevel>Level4</WarningLevel> + <SuppressStartupBanner>true</SuppressStartupBanner> + <DebugInformationFormat>ProgramDatabase</DebugInformationFormat> + <DisableSpecificWarnings>4100</DisableSpecificWarnings> + <FavorSizeOrSpeed>Speed</FavorSizeOrSpeed> + <AdditionalIncludeDirectories>../..</AdditionalIncludeDirectories> + </ClCompile> + <Link> + <OutputFile>$(OutDir)$(TargetName)$(TargetExt)</OutputFile> + <SuppressStartupBanner>true</SuppressStartupBanner> + <GenerateDebugInformation>false</GenerateDebugInformation> + <SubSystem>Windows</SubSystem> + <OptimizeReferences>true</OptimizeReferences> + <EnableCOMDATFolding>true</EnableCOMDATFolding> + <LinkTimeCodeGeneration>UseLinkTimeCodeGeneration</LinkTimeCodeGeneration> + <ProfileGuidedDatabase> + </ProfileGuidedDatabase> + <ImportLibrary>$(IntDir)$(TargetName).lib</ImportLibrary> + <TargetMachine>MachineX64</TargetMachine> + <AdditionalLibraryDirectories></AdditionalLibraryDirectories> + </Link> + </ItemDefinitionGroup> + <Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" /> + <ImportGroup Label="ExtensionTargets"> + </ImportGroup> +</Project>
\ No newline at end of file diff --git a/ui/IFileDialog_Vista/dll_main.cpp b/ui/IFileDialog_Vista/dll_main.cpp new file mode 100644 index 00000000..95d14910 --- /dev/null +++ b/ui/IFileDialog_Vista/dll_main.cpp @@ -0,0 +1,25 @@ +// ************************************************************************** +// * 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 * +// ************************************************************************** + + +#define WIN32_LEAN_AND_MEAN +#include <windows.h> + +//optional: add init/teardown logic here +BOOL APIENTRY DllMain(HINSTANCE hinstDLL, + DWORD fdwReason, + LPVOID lpvReserved) +{ + switch (fdwReason) + { + case DLL_PROCESS_ATTACH: + case DLL_PROCESS_DETACH: + case DLL_THREAD_ATTACH: + case DLL_THREAD_DETACH: + break; + } + return TRUE; +} diff --git a/ui/IFileDialog_Vista/ifile_dialog.cpp b/ui/IFileDialog_Vista/ifile_dialog.cpp new file mode 100644 index 00000000..dd2bc7c8 --- /dev/null +++ b/ui/IFileDialog_Vista/ifile_dialog.cpp @@ -0,0 +1,98 @@ +// ************************************************************************** +// * 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 <zen/com_error.h> +#include <zen/com_ptr.h> +#include <Shobjidl.h> +#include <zen/scope_guard.h> +#include <string> + +using namespace zen; + + +namespace +{ +bool showFolderPickerImpl(HWND ownerWindow, //throw ComError; return "false" if cancelled by user + const wchar_t* defaultFolder, //optional! + std::wstring& selectedFolder) +{ + ComPtr<IFileDialog> fileDlg; + ZEN_CHECK_COM(::CoCreateInstance(CLSID_FileOpenDialog, //throw ComError + nullptr, + CLSCTX_ALL, + IID_PPV_ARGS(fileDlg.init()))); + + FILEOPENDIALOGOPTIONS dlgOptions = 0; + ZEN_CHECK_COM(fileDlg->GetOptions(&dlgOptions)); //throw ComError + ZEN_CHECK_COM(fileDlg->SetOptions(dlgOptions | FOS_PICKFOLDERS | FOS_NOVALIDATE | FOS_FORCEFILESYSTEM)); + + if (defaultFolder) //show last selection instead of top level if no default available + { + ComPtr<IShellItem> folderItem; + ZEN_CHECK_COM(::SHCreateItemFromParsingName(defaultFolder, + nullptr, + IID_PPV_ARGS(folderItem.init()))); + ZEN_CHECK_COM(fileDlg->SetFolder(folderItem.get())); + } + + try + { + ZEN_CHECK_COM(fileDlg->Show(ownerWindow)); //may fail with: HRESULT_FROM_WIN32(ERROR_CANCELLED) + } + catch (const ComError&) { return false; } + + ComPtr<IShellItem> folderItem; + ZEN_CHECK_COM(fileDlg->GetResult(folderItem.init())); + + LPWSTR folderPath = nullptr; + ZEN_CHECK_COM(folderItem->GetDisplayName(SIGDN_FILESYSPATH, &folderPath)); + ZEN_ON_SCOPE_EXIT(::CoTaskMemFree(folderPath)); + + selectedFolder = folderPath; + return true; +} + +const wchar_t* allocString(const std::wstring& msg) //ownership passed +{ + auto tmp = new wchar_t [msg.size() + 1]; //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 wchar_t*& selectedFolder, + bool& cancelled, + const wchar_t*& errorMsg) +{ + selectedFolder = nullptr; + cancelled = false; + errorMsg = nullptr; + + try + { + std::wstring folderPath; + if (showFolderPickerImpl(static_cast<HWND>(ownerWindow), defaultFolder, folderPath)) //throw ComError + selectedFolder = allocString(folderPath); + else + cancelled = true; + } + catch (const ComError& e) + { + errorMsg = allocString(e.toString()); + } +} + + +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 new file mode 100644 index 00000000..87a67625 --- /dev/null +++ b/ui/IFileDialog_Vista/ifile_dialog.h @@ -0,0 +1,61 @@ +// ************************************************************************** +// * 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 <zen/build_info.h> + + +namespace ifile +{ +/*-------------- + |declarations| + --------------*/ + +//COM needs to be initialized before calling any of these functions! CoInitializeEx/CoUninitialize +//Requires Windows Vista and later + +DLL_FUNCTION_DECLARATION +void showFolderPicker(void* ownerWindow, //in; ==HWND + const wchar_t* defaultFolder, //in, optional! + const wchar_t*& selectedFolder, //out: call freeString() after use! + bool& cancelled, //out + const 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 wchar_t*& selectedFolder, + bool& cancelled, + const 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"; } +} + +#endif //IFILE_DIALOG_HEADER_916743921746324 diff --git a/ui/Taskbar_Seven/dll_main.cpp b/ui/Taskbar_Seven/dll_main.cpp index 46c65311..95d14910 100644 --- a/ui/Taskbar_Seven/dll_main.cpp +++ b/ui/Taskbar_Seven/dll_main.cpp @@ -1,7 +1,7 @@ // ************************************************************************** // * 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 (zhnmju123 AT gmx DOT de) - All Rights Reserved * +// * Copyright (C) ZenJu (zenju AT gmx DOT de) - All Rights Reserved * // ************************************************************************** diff --git a/ui/Taskbar_Seven/taskbar.cpp b/ui/Taskbar_Seven/taskbar.cpp index 6c1365a4..32a858b1 100644 --- a/ui/Taskbar_Seven/taskbar.cpp +++ b/ui/Taskbar_Seven/taskbar.cpp @@ -1,7 +1,7 @@ // ************************************************************************** // * 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 (zhnmju123 AT gmx DOT de) - All Rights Reserved * +// * Copyright (C) ZenJu (zenju AT gmx DOT de) - All Rights Reserved * // ************************************************************************** #include "taskbar.h" diff --git a/ui/Taskbar_Seven/taskbar.h b/ui/Taskbar_Seven/taskbar.h index 6a46aad3..1f9f7bb3 100644 --- a/ui/Taskbar_Seven/taskbar.h +++ b/ui/Taskbar_Seven/taskbar.h @@ -1,7 +1,7 @@ // ************************************************************************** // * 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 (zhnmju123 AT gmx DOT de) - All Rights Reserved * +// * Copyright (C) ZenJu (zenju AT gmx DOT de) - All Rights Reserved * // ************************************************************************** #ifndef TASKBAR_SEVEN_DLL_H @@ -51,17 +51,17 @@ void getLastError(wchar_t* buffer, size_t bufferSize); /*---------- |typedefs| ----------*/ -typedef bool (*SetStatusFct )(void* hwnd, TaskBarStatus status); -typedef bool (*SetProgressFct )(void* hwnd, size_t current, size_t total); -typedef void (*GetLastErrorFct)(wchar_t* buffer, size_t bufferSize); +typedef bool (*FunType_setStatus )(void* hwnd, TaskBarStatus status); +typedef bool (*FunType_setProgress )(void* hwnd, size_t current, size_t total); +typedef void (*FunType_getLastError)(wchar_t* buffer, size_t bufferSize); /*-------------- |symbol names| --------------*/ //(use const pointers to ensure internal linkage) -const char setStatusFctName [] = "setStatus"; -const char setProgressFctName [] = "setProgress"; -const char getLastErrorFctName[] = "getLastError"; +const char funName_setStatus [] = "setStatus"; +const char funName_setProgress [] = "setProgress"; +const char funName_getLastError[] = "getLastError"; /*--------------- |library names| diff --git a/ui/batch_config.cpp b/ui/batch_config.cpp index 059996e8..c6d50bd2 100644 --- a/ui/batch_config.cpp +++ b/ui/batch_config.cpp @@ -1,25 +1,26 @@ // ************************************************************************** // * 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 (zhnmju123 AT gmx DOT de) - All Rights Reserved * +// * Copyright (C) ZenJu (zenju AT gmx DOT de) - All Rights Reserved * // ************************************************************************** #include "batch_config.h" -#include <wx+/dir_picker.h> -#include "folder_pair.h" #include <iterator> +#include <wx/filedlg.h> +#include <wx/msgdlg.h> #include <wx/wupdlock.h> +#include <wx+/button.h> +#include <wx+/choice_enum.h> +#include <wx+/mouse_move_dlg.h> #include <wx+/context_menu.h> -#include "../lib/help_provider.h" #include <zen/file_handling.h> +#include "../lib/help_provider.h" +#include "folder_pair.h" #include "msg_popup.h" #include "gui_generated.h" -#include <wx/msgdlg.h> -#include <wx+/button.h> -#include <wx+/choice_enum.h> -#include <wx+/mouse_move_dlg.h> using namespace zen; +using namespace xmlAccess; class DirectoryPairBatchFirst; class DirectoryPairBatch; @@ -27,14 +28,14 @@ class DirectoryPairBatch; class BatchDialog: public BatchDlgGenerated { - // friend class BatchFileDropEvent; template <class GuiPanel> friend class FolderPairCallback; + friend class DirectoryPairBatchFirst; public: BatchDialog(wxWindow* parent, const wxString& referenceFile, - const xmlAccess::XmlBatchConfig& batchCfg, + const XmlBatchConfig& batchCfg, const std::shared_ptr<FolderHistory>& folderHistLeft, const std::shared_ptr<FolderHistory>& folderHistRight, std::vector<std::wstring>& onCompletionHistory, @@ -46,11 +47,10 @@ private: virtual void OnConfigureFilter(wxCommandEvent& event); virtual void OnHelp (wxCommandEvent& event) { displayHelpEntry(L"html/Schedule a Batch Job.html"); } - void OnCompSettingsContext(wxCommandEvent& event); - void OnSyncSettingsContext(wxCommandEvent& event); - void OnGlobalFilterContext(wxCommandEvent& event); + virtual void OnCompSettingsContext(wxCommandEvent& event); + virtual void OnSyncSettingsContext(wxCommandEvent& event); + virtual void OnGlobalFilterContext(wxCommandEvent& event); virtual void OnCheckSaveLog (wxCommandEvent& event); - virtual void OnChangeMaxLogCountTxt(wxCommandEvent& event); virtual void OnClose (wxCloseEvent& event) { EndModal(0); } virtual void OnCancel (wxCommandEvent& event) { EndModal(0); } virtual void OnSaveBatchJob (wxCommandEvent& event); @@ -60,6 +60,13 @@ private: virtual void OnRemoveTopFolderPair (wxCommandEvent& event); void OnFilesDropped(FileDropEvent& event); + virtual void OnErrorPopup (wxCommandEvent& event) { localBatchCfg.handleError = ON_ERROR_POPUP; updateGui(); } + virtual void OnErrorIgnore(wxCommandEvent& event) { localBatchCfg.handleError = ON_ERROR_IGNORE; updateGui(); } + virtual void OnErrorExit (wxCommandEvent& event) { localBatchCfg.handleError = ON_ERROR_EXIT; updateGui(); } + + virtual void OnToggleGenerateLogfile(wxCommandEvent& event) { updateGui(); } + virtual void OnToggleLogfilesLimit (wxCommandEvent& event) { updateGui(); } + void addFolderPair(const std::vector<zen::FolderPairEnh>& newPairs, bool addFront = false); void removeAddFolderPair(int pos); void clearAddFolderPairs(); @@ -68,17 +75,12 @@ private: void updateGui(); //re-evaluate gui after config changes - //error handling - //xmlAccess::OnError getSelectionHandleError() const; -> obsolete, use getEnumVal() - void setSelectionHandleError(xmlAccess::OnError value); - void OnChangeErrorHandling(wxCommandEvent& event); - bool saveBatchFile(const wxString& filename); void loadBatchFile(const wxString& filename); void loadBatchFile(const std::vector<wxString>& filenames); - void setConfig(const xmlAccess::XmlBatchConfig& batchCfg); - xmlAccess::XmlBatchConfig getConfig() const; + void setConfig(const XmlBatchConfig& batchCfg); + XmlBatchConfig getConfig() const; std::unique_ptr<DirectoryPairBatchFirst> firstFolderPair; //always bound!!! std::vector<DirectoryPairBatch*> additionalFolderPairs; @@ -86,16 +88,12 @@ private: //used when saving batch file wxString proposedBatchFileName; - xmlAccess::XmlBatchConfig localBatchCfg; - - std::unique_ptr<DirectoryName<FolderHistoryBox>> logfileDir; + XmlBatchConfig localBatchCfg; //a mixture of settings some of which have OWNERSHIP WITHIN GUI CONTROLS! use getConfig() to resolve - zen::EnumDescrList<xmlAccess::OnError> enumDescrMap; + std::unique_ptr<DirectoryName<FolderHistoryBox>> logfileDir; //always bound, solve circular compile-time dependency const std::shared_ptr<FolderHistory> folderHistLeft_; const std::shared_ptr<FolderHistory> folderHistRight_; - std::vector<std::wstring>& onCompletionHistory_; - size_t onCompletionHistoryMax_; }; //################################################################################################################################### @@ -124,25 +122,13 @@ public: batchDlg(batchDialog) {} private: - virtual wxWindow* getParentWindow() - { - return &batchDlg; - } + virtual wxWindow* getParentWindow() { return &batchDlg; } - virtual MainConfiguration getMainConfig() const - { - return batchDlg.getConfig().mainCfg; - } + virtual MainConfiguration getMainConfig() const { return batchDlg.getConfig().mainCfg; } - virtual void OnAltCompCfgChange() - { - batchDlg.updateGui(); - } + virtual void OnAltCompCfgChange() { batchDlg.updateGui(); } - virtual void OnAltSyncCfgChange() - { - batchDlg.updateGui(); - } + virtual void OnAltSyncCfgChange() { batchDlg.updateGui(); } virtual void removeAltCompCfg() { @@ -170,8 +156,8 @@ public: DirectoryPairBatch(wxWindow* parent, BatchDialog& batchDialog) : BatchFolderPairGenerated(parent), FolderPairCallback<BatchFolderPairGenerated>(static_cast<BatchFolderPairGenerated&>(*this), batchDialog), //pass BatchFolderPairGenerated part... - dirNameLeft (*m_panelLeft, *m_dirPickerLeft, *m_directoryLeft), - dirNameRight(*m_panelRight, *m_dirPickerRight, *m_directoryRight) {} + dirNameLeft (*m_panelLeft, *m_buttonSelectDirLeft, *m_directoryLeft), + dirNameRight(*m_panelRight, *m_buttonSelectDirRight, *m_directoryRight) {} void setValues(const wxString& leftDir, const wxString& rightDir, @@ -201,10 +187,10 @@ public: //prepare drag & drop dirNameLeft(*batchDialog.m_panelLeft, - *batchDialog.m_dirPickerLeft, + *batchDialog.m_buttonSelectDirLeft, *batchDialog.m_directoryLeft), dirNameRight(*batchDialog.m_panelRight, - *batchDialog.m_dirPickerRight, + *batchDialog.m_buttonSelectDirRight, *batchDialog.m_directoryRight) {} void setValues(const wxString& leftDir, @@ -230,36 +216,27 @@ private: BatchDialog::BatchDialog(wxWindow* parent, const wxString& referenceFile, - const xmlAccess::XmlBatchConfig& batchCfg, + const XmlBatchConfig& batchCfg, const std::shared_ptr<FolderHistory>& folderHistLeft, const std::shared_ptr<FolderHistory>& folderHistRight, std::vector<std::wstring>& onCompletionHistory, size_t onCompletionHistoryMax) : BatchDlgGenerated(parent), folderHistLeft_(folderHistLeft), - folderHistRight_(folderHistRight), - onCompletionHistory_(onCompletionHistory), - onCompletionHistoryMax_(onCompletionHistoryMax) + folderHistRight_(folderHistRight) { m_directoryLeft ->init(folderHistLeft_); m_directoryRight->init(folderHistRight_); + m_comboBoxExecFinished->initHistory(onCompletionHistory, onCompletionHistoryMax); #ifdef FFS_WIN new zen::MouseMoveWindow(*this); //allow moving main dialog by clicking (nearly) anywhere...; ownership passed to "this" #endif - wxWindowUpdateLocker dummy(this); //avoid display distortion - enumDescrMap. - add(xmlAccess::ON_ERROR_POPUP , _("Show pop-up") , _("Show pop-up on errors or warnings")). - add(xmlAccess::ON_ERROR_IGNORE, _("Ignore errors") , _("Hide all error and warning messages")). - add(xmlAccess::ON_ERROR_EXIT , _("Exit instantly"), _("Abort synchronization immediately")); - - - m_bpButtonCmpConfig->SetBitmapLabel(GlobalResources::getImage(wxT("cmpConfig"))); - m_bpButtonSyncConfig->SetBitmapLabel(GlobalResources::getImage(wxT("syncConfig"))); - - m_bpButtonHelp->SetBitmapLabel(GlobalResources::getImage(wxT("help"))); + m_bpButtonCmpConfig ->SetBitmapLabel(GlobalResources::getImage(L"cmpConfig")); + m_bpButtonSyncConfig->SetBitmapLabel(GlobalResources::getImage(L"syncConfig")); + m_bpButtonHelp ->SetBitmapLabel(GlobalResources::getImage(L"help")); //init handling of first folder pair firstFolderPair.reset(new DirectoryPairBatchFirst(*this)); @@ -272,11 +249,11 @@ BatchDialog::BatchDialog(wxWindow* parent, setupFileDrop(*this); Connect(EVENT_DROP_FILE, FileDropEventHandler(BatchDialog::OnFilesDropped), nullptr, this); - logfileDir.reset(new DirectoryName<FolderHistoryBox>(*m_panelBatchSettings, *m_dirPickerLogfileDir, *m_comboBoxLogfileDir)); + logfileDir.reset(new DirectoryName<FolderHistoryBox>(*m_panelBatchSettings, *m_buttonSelectLogfileDir, *m_comboBoxLogfileDir)); //set icons for this dialog - m_bpButtonAddPair->SetBitmapLabel(GlobalResources::getImage(wxT("addFolderPair"))); - m_bitmap27->SetBitmap(GlobalResources::getImage(wxT("batch"))); + m_bpButtonAddPair->SetBitmapLabel(GlobalResources::getImage(L"addFolderPair")); + m_bitmap27->SetBitmap(GlobalResources::getImage(L"batch")); m_buttonSave->SetFocus(); @@ -291,53 +268,30 @@ BatchDialog::BatchDialog(wxWindow* parent, //------------------- error handling -------------------------- -void BatchDialog::setSelectionHandleError(xmlAccess::OnError value) -{ - // if (m_checkBoxSilent->GetValue()) - setEnumVal(enumDescrMap, *m_choiceHandleError, value); - /* else - { - EnumDescrList<xmlAccess::OnError> tmp(enumDescrMap); - tmp.descrList.pop_back(); //remove "Exit instantly" -> this option shall be available for silent mode only! - setEnumVal(tmp, *m_choiceHandleError, value); - } - */ -} - -void BatchDialog::OnChangeErrorHandling(wxCommandEvent& event) -{ - updateTooltipEnumVal(enumDescrMap, *m_choiceHandleError); -} - - void BatchDialog::OnCmpSettings(wxCommandEvent& event) { //show window right next to the compare-config button //wxPoint windowPos = m_bpButtonCmpConfig->GetScreenPosition(); //windowPos.x += m_bpButtonCmpConfig->GetSize().GetWidth() + 5; - if (zen::showCompareCfgDialog(this,localBatchCfg.mainCfg.cmpConfig) == ReturnSmallDlg::BUTTON_OKAY) - { + if (zen::showCompareCfgDialog(this, localBatchCfg.mainCfg.cmpConfig) == ReturnSmallDlg::BUTTON_OKAY) updateGui(); - } } void BatchDialog::OnSyncSettings(wxCommandEvent& event) { - ExecWhenFinishedCfg ewfCfg = { &localBatchCfg.mainCfg.onCompletion, - &onCompletionHistory_, - onCompletionHistoryMax_ - }; + //ExecWhenFinishedCfg ewfCfg = { &localBatchCfg.mainCfg.onCompletion, + // &onCompletionHistory_, + // onCompletionHistoryMax_ + // }; if (showSyncConfigDlg(this, localBatchCfg.mainCfg.cmpConfig.compareVar, localBatchCfg.mainCfg.syncCfg, nullptr, - &ewfCfg) == ReturnSyncConfig::BUTTON_OKAY) //optional input parameter - { + nullptr) == ReturnSyncConfig::BUTTON_OKAY) //optional input parameter updateGui(); - } } @@ -346,19 +300,16 @@ void BatchDialog::OnConfigureFilter(wxCommandEvent& event) if (showFilterDialog(this, true, //is main filter dialog localBatchCfg.mainCfg.globalFilter) == ReturnSmallDlg::BUTTON_OKAY) - { updateGui(); - } } void BatchDialog::updateGui() //re-evaluate gui after config changes { - xmlAccess::XmlBatchConfig cfg = getConfig(); - - //showNotebookpage(m_panelLogging, _("Logging"), cfg.silent); + XmlBatchConfig cfg = getConfig(); - m_panelLogfile->Enable(cfg.logFileCountMax > 0); + m_panelLogfile ->Enable(m_checkBoxGenerateLogfile->GetValue()); + m_spinCtrlLogfileLimit->Enable(m_checkBoxGenerateLogfile->GetValue() && m_checkBoxLogfilesLimit->GetValue()); //update compare variant name m_staticTextCmpVariant->SetLabel(cfg.mainCfg.getCompVariantName()); @@ -378,6 +329,22 @@ void BatchDialog::updateGui() //re-evaluate gui after config changes m_bpButtonFilter->SetToolTip(_("No filter selected")); } + m_toggleBtnErrorIgnore->SetValue(false); + m_toggleBtnErrorPopup ->SetValue(false); + m_toggleBtnErrorExit ->SetValue(false); + switch (cfg.handleError) + { + case ON_ERROR_IGNORE: + m_toggleBtnErrorIgnore->SetValue(true); + break; + case ON_ERROR_POPUP: + m_toggleBtnErrorPopup->SetValue(true); + break; + case ON_ERROR_EXIT: + m_toggleBtnErrorExit->SetValue(true); + break; + } + m_panelOverview->Layout (); //adjust stuff inside scrolled window m_panelOverview->Refresh(); //refresh filter button (if nothing else) } @@ -448,12 +415,6 @@ void BatchDialog::OnCheckSaveLog(wxCommandEvent& event) } -void BatchDialog::OnChangeMaxLogCountTxt(wxCommandEvent& event) -{ - updateGui(); -} - - void BatchDialog::OnFilesDropped(FileDropEvent& event) { loadBatchFile(event.getFiles()); @@ -537,26 +498,29 @@ void BatchDialog::OnLoadBatchJob(wxCommandEvent& event) inline -FolderPairEnh getEnhancedPair(const DirectoryPairBatch* panel) +FolderPairEnh getPairCfg(const DirectoryPairBatch& panel) { - return FolderPairEnh(toZ(panel->getLeftDir()), - toZ(panel->getRightDir()), - panel->getAltCompConfig(), - panel->getAltSyncConfig(), - panel->getAltFilterConfig()); + return FolderPairEnh(toZ(panel.getLeftDir()), + toZ(panel.getRightDir()), + panel.getAltCompConfig(), + panel.getAltSyncConfig(), + panel.getAltFilterConfig()); } bool BatchDialog::saveBatchFile(const wxString& filename) { - const xmlAccess::XmlBatchConfig batchCfg = getConfig(); + const XmlBatchConfig batchCfg = getConfig(); + + //a good place to commit current "on completion" history item + m_comboBoxExecFinished->addItemHistory(); //write config to XML try { - xmlAccess::writeConfig(batchCfg, toZ(filename)); + writeConfig(batchCfg, toZ(filename)); } - catch (const xmlAccess::FfsXmlError& error) + catch (const FfsXmlError& error) { wxMessageBox(error.toString().c_str(), _("Error"), wxOK | wxICON_ERROR, this); return false; @@ -583,17 +547,17 @@ void BatchDialog::loadBatchFile(const std::vector<wxString>& filenames) return; //load XML settings - xmlAccess::XmlBatchConfig batchCfg; //structure to receive gui settings + XmlBatchConfig batchCfg; //structure to receive gui settings try { //open a *.ffs_gui or *.ffs_batch file! - xmlAccess::convertConfig(toZ(filenames), batchCfg); //throw FfsXmlError + convertConfig(toZ(filenames), batchCfg); //throw FfsXmlError - //xmlAccess::readConfig(filename, batchCfg); + //readConfig(filename, batchCfg); } - catch (const xmlAccess::FfsXmlError& error) + catch (const FfsXmlError& error) { - if (error.getSeverity() == xmlAccess::FfsXmlError::WARNING) + if (error.getSeverity() == FfsXmlError::WARNING) wxMessageBox(error.toString(), _("Warning"), wxOK | wxICON_WARNING, this); else { @@ -615,20 +579,23 @@ void BatchDialog::loadBatchFile(const std::vector<wxString>& filenames) } -void BatchDialog::setConfig(const xmlAccess::XmlBatchConfig& batchCfg) +void BatchDialog::setConfig(const XmlBatchConfig& batchCfg) { wxWindowUpdateLocker dummy(this); //avoid display distortion - //make working copy - localBatchCfg = batchCfg; + localBatchCfg = batchCfg; //contains some parameters not owned by GUI controls - m_checkBoxShowProgress->SetValue(batchCfg.showProgress); + //transfer parameter ownership to GUI - //error handling is dependent from m_checkBoxShowProgress! /|\ \|/ - setSelectionHandleError(batchCfg.handleError); + m_checkBoxShowProgress->SetValue(batchCfg.showProgress); + logfileDir->setName(utfCvrtTo<wxString>(batchCfg.logFileDirectory)); + m_comboBoxExecFinished->setValue(batchCfg.mainCfg.onCompletion); - logfileDir->setName(batchCfg.logFileDirectory); - m_spinCtrlLogCountMax->SetValue(static_cast<int>(batchCfg.logFileCountMax)); //attention: this one emits a "change value" event!! => updateGui() called implicitly! + //map single parameter "logfiles limit" to all three checkboxs and spin ctrl: + m_checkBoxGenerateLogfile->SetValue(batchCfg.logfilesCountLimit != 0); + m_checkBoxLogfilesLimit ->SetValue(batchCfg.logfilesCountLimit >= 0); + m_spinCtrlLogfileLimit ->SetValue(batchCfg.logfilesCountLimit >= 0 ? batchCfg.logfilesCountLimit : 100 /*XmlBatchConfig().logfilesCountLimit*/); + //attention: emits a "change value" event!! => updateGui() called implicitly! //set first folder pair firstFolderPair->setValues(toWx(batchCfg.mainCfg.firstPair.leftDirectory), @@ -637,10 +604,8 @@ void BatchDialog::setConfig(const xmlAccess::XmlBatchConfig& batchCfg) batchCfg.mainCfg.firstPair.altSyncConfig, batchCfg.mainCfg.firstPair.localFilter); - //remove existing additional folder pairs - clearAddFolderPairs(); - //set additional pairs + clearAddFolderPairs(); addFolderPair(batchCfg.mainCfg.additionalPairs); updateGui(); //re-evaluate gui after config changes @@ -651,9 +616,9 @@ void BatchDialog::setConfig(const xmlAccess::XmlBatchConfig& batchCfg) } -xmlAccess::XmlBatchConfig BatchDialog::getConfig() const +XmlBatchConfig BatchDialog::getConfig() const { - xmlAccess::XmlBatchConfig batchCfg = localBatchCfg; + XmlBatchConfig batchCfg = localBatchCfg; //load parameter with ownership within wxWidgets controls... @@ -663,18 +628,17 @@ xmlAccess::XmlBatchConfig BatchDialog::getConfig() const firstFolderPair->getAltCompConfig(), firstFolderPair->getAltSyncConfig(), firstFolderPair->getAltFilterConfig()); - //add additional pairs batchCfg.mainCfg.additionalPairs.clear(); std::transform(additionalFolderPairs.begin(), additionalFolderPairs.end(), - std::back_inserter(batchCfg.mainCfg.additionalPairs), getEnhancedPair); - + std::back_inserter(batchCfg.mainCfg.additionalPairs), [](const DirectoryPairBatch* dp) { return getPairCfg(*dp); }); //load structure with batch settings "batchCfg" batchCfg.showProgress = m_checkBoxShowProgress->GetValue(); - batchCfg.logFileDirectory = logfileDir->getName(); - batchCfg.logFileCountMax = m_spinCtrlLogCountMax->GetValue(); - batchCfg.handleError = getEnumVal(enumDescrMap, *m_choiceHandleError); + batchCfg.logFileDirectory = utfCvrtTo<Zstring>(logfileDir->getName()); + batchCfg.mainCfg.onCompletion = m_comboBoxExecFinished->getValue(); + //get single parameter "logfiles limit" from all three checkboxes and spin ctrl: + batchCfg.logfilesCountLimit = m_checkBoxGenerateLogfile->GetValue() ? (m_checkBoxLogfilesLimit->GetValue() ? m_spinCtrlLogfileLimit->GetValue() : -1) : 0; return batchCfg; } @@ -720,7 +684,7 @@ void BatchDialog::OnRemoveTopFolderPair(wxCommandEvent& event) if (!additionalFolderPairs.empty()) { //get settings from second folder pair - const FolderPairEnh cfgSecond = getEnhancedPair(additionalFolderPairs[0]); + const FolderPairEnh cfgSecond = getPairCfg(*additionalFolderPairs[0]); //reset first pair firstFolderPair->setValues(toWx(cfgSecond.leftDirectory), @@ -743,21 +707,14 @@ void BatchDialog::updateGuiForFolderPair() m_bpButtonRemovePair->Show(); //adapt local filter and sync cfg for first folder pair - if (additionalFolderPairs.empty() && - firstFolderPair->getAltCompConfig().get() == nullptr && - firstFolderPair->getAltSyncConfig().get() == nullptr && - isNullFilter(firstFolderPair->getAltFilterConfig())) - { - m_bpButtonAltCompCfg ->Hide(); - m_bpButtonLocalFilter->Hide(); - m_bpButtonAltSyncCfg ->Hide(); - } - else - { - m_bpButtonAltCompCfg ->Show(); - m_bpButtonLocalFilter->Show(); - m_bpButtonAltSyncCfg ->Show(); - } + const bool showLocalCfgFirstPair = !additionalFolderPairs.empty() || + firstFolderPair->getAltCompConfig().get() != nullptr || + firstFolderPair->getAltSyncConfig().get() != nullptr || + !isNullFilter(firstFolderPair->getAltFilterConfig()); + + m_bpButtonAltCompCfg ->Show(showLocalCfgFirstPair); + m_bpButtonAltSyncCfg ->Show(showLocalCfgFirstPair); + m_bpButtonLocalFilter->Show(showLocalCfgFirstPair); //update controls const int maxAddFolderPairsVisible = 2; @@ -866,7 +823,7 @@ void BatchDialog::clearAddFolderPairs() void zen::showSyncBatchDlg(wxWindow* parent, const wxString& referenceFile, - const xmlAccess::XmlBatchConfig& batchCfg, + const XmlBatchConfig& batchCfg, const std::shared_ptr<FolderHistory>& folderHistLeft, const std::shared_ptr<FolderHistory>& folderHistRight, std::vector<std::wstring>& execFinishedhistory, diff --git a/ui/batch_config.h b/ui/batch_config.h index 04f0bf04..e448fba4 100644 --- a/ui/batch_config.h +++ b/ui/batch_config.h @@ -1,7 +1,7 @@ // ************************************************************************** // * 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 (zhnmju123 AT gmx DOT de) - All Rights Reserved * +// * Copyright (C) ZenJu (zenju AT gmx DOT de) - All Rights Reserved * // ************************************************************************** #ifndef BATCHCONFIG_H_INCLUDED diff --git a/ui/batch_status_handler.cpp b/ui/batch_status_handler.cpp index baab3ed3..0fa3d01d 100644 --- a/ui/batch_status_handler.cpp +++ b/ui/batch_status_handler.cpp @@ -1,7 +1,7 @@ // ************************************************************************** // * 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 (zhnmju123 AT gmx DOT de) - All Rights Reserved * +// * Copyright (C) ZenJu (zenju AT gmx DOT de) - All Rights Reserved * // ************************************************************************** #include "batch_status_handler.h" @@ -27,6 +27,7 @@ class FindLogfiles : public TraverseCallback public: FindLogfiles(const Zstring& prefix, std::vector<Zstring>& logfiles) : prefix_(prefix), logfiles_(logfiles) {} +private: virtual void onFile(const Zchar* shortName, const Zstring& fullName, const FileInfo& details) { const Zstring fileName(shortName); @@ -37,9 +38,8 @@ public: virtual std::shared_ptr<TraverseCallback> onDir (const Zchar* shortName, const Zstring& fullName) { return nullptr; } //DON'T traverse into subdirs virtual HandleLink onSymlink(const Zchar* shortName, const Zstring& fullName, const SymlinkInfo& details) { return LINK_SKIP; } - virtual HandleError onError (const std::wstring& errorText) { return ON_ERROR_IGNORE; } //errors are not really critical in this context + virtual HandleError onError (const std::wstring& msg) { return ON_ERROR_IGNORE; } //errors are not really critical in this context -private: const Zstring prefix_; std::vector<Zstring>& logfiles_; }; @@ -48,16 +48,16 @@ private: void limitLogfileCount(const Zstring& logdir, const std::wstring& jobname, size_t maxCount) //throw() { std::vector<Zstring> logFiles; - FindLogfiles traverseCallback(toZ(jobname), logFiles); + FindLogfiles traverseCallback(toZ(jobname), logFiles); //throw()! - traverseFolder(logdir, //throw(); + traverseFolder(logdir, traverseCallback); if (logFiles.size() <= maxCount) return; - //delete oldest logfiles - std::nth_element(logFiles.begin(), logFiles.end() - maxCount, logFiles.end()); //take advantage of logfile naming convention to find oldest files + //delete oldest logfiles: take advantage of logfile naming convention to find them + std::nth_element(logFiles.begin(), logFiles.end() - maxCount, logFiles.end(), LessFilename()); std::for_each(logFiles.begin(), logFiles.end() - maxCount, [](const Zstring& filename) { try { removeFile(filename); } catch (FileError&) {} }); @@ -66,7 +66,7 @@ void limitLogfileCount(const Zstring& logdir, const std::wstring& jobname, size_ std::unique_ptr<FileOutput> prepareNewLogfile(const Zstring& logfileDirectory, //throw FileError const std::wstring& jobName, - const std::wstring& timestamp) //return value always bound! + const TimeComp& timeStamp) //return value always bound! { //create logfile directory if required Zstring logfileDir = logfileDirectory.empty() ? @@ -76,7 +76,7 @@ std::unique_ptr<FileOutput> prepareNewLogfile(const Zstring& logfileDirectory, / makeDirectory(logfileDir); //throw FileError //assemble logfile name - const Zstring body = appendSeparator(logfileDir) + toZ(jobName) + Zstr(" ") + utfCvrtTo<Zstring>(timestamp); + const Zstring body = appendSeparator(logfileDir) + toZ(jobName) + Zstr(" ") + formatTime<Zstring>(Zstr("%Y-%m-%d %H%M%S"), timeStamp); //ensure uniqueness for (int i = 0;; ++i) @@ -97,9 +97,9 @@ std::unique_ptr<FileOutput> prepareNewLogfile(const Zstring& logfileDirectory, / //############################################################################################################################## BatchStatusHandler::BatchStatusHandler(bool showProgress, const std::wstring& jobName, - const std::wstring& timestamp, - const wxString& logfileDirectory, //may be empty - size_t logFileCountMax, + const TimeComp& timeStamp, + const Zstring& logfileDirectory, //may be empty + int logfilesCountLimit, const xmlAccess::OnError handleError, const SwitchToGui& switchBatchToGui, //functionality to change from batch mode to GUI mode FfsReturnCode& returnCode, @@ -113,16 +113,17 @@ BatchStatusHandler::BatchStatusHandler(bool showProgress, syncStatusFrame(*this, *this, nullptr, showProgress, jobName, execWhenFinished, execFinishedHistory), jobName_(jobName) { - if (logFileCountMax > 0) //init log file: starts internal timer! - if (!tryReportingError([&] + if (logfilesCountLimit != 0) //init log file: starts internal timer! { - logFile = prepareNewLogfile(toZ(logfileDirectory), jobName, timestamp); //throw FileError; return value always bound! + if (!tryReportingError([&] { logFile = prepareNewLogfile(logfileDirectory, jobName, timeStamp); }, //throw FileError; return value always bound! + *this)) + { + returnCode_ = FFS_RC_ABORTED; + throw BatchAbortProcess(); + } - limitLogfileCount(beforeLast(logFile->getFilename(), FILE_NAME_SEPARATOR), jobName_, logFileCountMax); //throw() - }, *this)) - { - returnCode_ = FFS_RC_ABORTED; - throw BatchAbortProcess(); + if (logfilesCountLimit >= 0) + limitLogfileCount(beforeLast(logFile->getFilename(), FILE_NAME_SEPARATOR), jobName_, logfilesCountLimit); //throw() } totalTime.Start(); //measure total time @@ -203,7 +204,10 @@ BatchStatusHandler::~BatchStatusHandler() if (isCloseProgressDlgCommand(finalCommand)) showFinalResults = false; //take precedence over current visibility status else if (!finalCommand.empty()) - shellExecute(finalCommand); + { + auto cmdexp = utfCvrtTo<wxString>(expandMacros(utfCvrtTo<Zstring>(finalCommand))); + shellExecute(cmdexp); + } } if (showFinalResults) //warning: wxWindow::Show() is called within processHasFinished()! diff --git a/ui/batch_status_handler.h b/ui/batch_status_handler.h index c6def13c..77a32f28 100644 --- a/ui/batch_status_handler.h +++ b/ui/batch_status_handler.h @@ -1,7 +1,7 @@ // ************************************************************************** // * 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 (zhnmju123 AT gmx DOT de) - All Rights Reserved * +// * Copyright (C) ZenJu (zenju AT gmx DOT de) - All Rights Reserved * // ************************************************************************** #ifndef BATCHSTATUSHANDLER_H_INCLUDED @@ -9,6 +9,7 @@ #include <zen/error_log.h> #include <zen/file_io.h> +#include <zen/time.h> #include "../lib/status_handler.h" #include "../lib/process_xml.h" #include "progress_indicator.h" @@ -25,9 +26,9 @@ class BatchStatusHandler : public zen::StatusHandler public: BatchStatusHandler(bool showProgress, //defines: -start minimized and -quit immediately when finished const std::wstring& jobName, //should not be empty for a batch job! - const std::wstring& timestamp, - const wxString& logfileDirectory, - size_t logFileCountMax, //0 if logging shall be inactive + const zen::TimeComp& timeStamp, + const Zstring& logfileDirectory, + int logfilesCountLimit, //0: logging inactive; < 0: no limit const xmlAccess::OnError handleError, const zen::SwitchToGui& switchBatchToGui, //functionality to change from batch mode to GUI mode zen::FfsReturnCode& returnCode, diff --git a/ui/check_version.cpp b/ui/check_version.cpp index 56896836..2a243a27 100644 --- a/ui/check_version.cpp +++ b/ui/check_version.cpp @@ -1,7 +1,7 @@ // ************************************************************************** // * 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 (zhnmju123 AT gmx DOT de) - All Rights Reserved * +// * Copyright (C) ZenJu (zenju AT gmx DOT de) - All Rights Reserved * // ************************************************************************** #include "check_version.h" diff --git a/ui/check_version.h b/ui/check_version.h index 5a0bbd73..5c85893e 100644 --- a/ui/check_version.h +++ b/ui/check_version.h @@ -1,7 +1,7 @@ // ************************************************************************** // * 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 (zhnmju123 AT gmx DOT de) - All Rights Reserved * +// * Copyright (C) ZenJu (zenju AT gmx DOT de) - All Rights Reserved * // ************************************************************************** #ifndef UPDATEVERSION_H_INCLUDED diff --git a/ui/column_attr.h b/ui/column_attr.h index ed98f403..414bb483 100644 --- a/ui/column_attr.h +++ b/ui/column_attr.h @@ -1,7 +1,7 @@ // ************************************************************************** // * 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 (zhnmju123 AT gmx DOT de) - All Rights Reserved * +// * Copyright (C) ZenJu (zenju AT gmx DOT de) - All Rights Reserved * // ************************************************************************** #ifndef COL_ATTR_HEADER_189467891346732143214 diff --git a/ui/custom_grid.cpp b/ui/custom_grid.cpp index 0e27f21e..9db6a405 100644 --- a/ui/custom_grid.cpp +++ b/ui/custom_grid.cpp @@ -1,7 +1,7 @@ // ************************************************************************** // * 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 (zhnmju123 AT gmx DOT de) - All Rights Reserved * +// * Copyright (C) ZenJu (zenju AT gmx DOT de) - All Rights Reserved * // ************************************************************************** #include "custom_grid.h" @@ -1399,7 +1399,7 @@ private: //(h-scrollbar is shown due to v-scrollbar consuming horizontal width, ect...) //while in fact both are NOT needed, this special case results in a bogus need for scrollbars! //see https://sourceforge.net/tracker/?func=detail&aid=3514183&group_id=234430&atid=1093083 - // => since we're outside the Grid abstraction, we should not duplicate code to handle this special case as it seems to be insignificant + // => since we're outside the Grid abstraction, we should not duplicate code to handle this special case as it seems to be insignificant }; Grid::ScrollBarStatus sbStatusX = needsHorizontalScrollbars(gridL_) || diff --git a/ui/custom_grid.h b/ui/custom_grid.h index 98092ade..8a91e0bc 100644 --- a/ui/custom_grid.h +++ b/ui/custom_grid.h @@ -1,7 +1,7 @@ // ************************************************************************** // * 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 (zhnmju123 AT gmx DOT de) - All Rights Reserved * +// * Copyright (C) ZenJu (zenju AT gmx DOT de) - All Rights Reserved * // ************************************************************************** #ifndef CUSTOMGRID_H_INCLUDED diff --git a/ui/dir_name.cpp b/ui/dir_name.cpp index 3d8db37d..493a7642 100644 --- a/ui/dir_name.cpp +++ b/ui/dir_name.cpp @@ -1,31 +1,41 @@ // ************************************************************************** // * 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 (zhnmju123 AT gmx DOT de) - All Rights Reserved * +// * Copyright (C) ZenJu (zenju AT gmx DOT de) - All Rights Reserved * // ************************************************************************** #include "dir_name.h" +#include <zen/thread.h> +#include <zen/file_handling.h> #include <wx/dnd.h> #include <wx/window.h> #include <wx/textctrl.h> #include <wx/statbox.h> -#include <zen/thread.h> -#include <zen/file_handling.h> -#include "../lib/resolve_path.h" +#include <wx/dirdlg.h> +#include <wx/msgdlg.h> #include <wx+/string_conv.h> +#include "../lib/resolve_path.h" #include "folder_history_box.h" +#ifdef FFS_WIN +#include <zen/dll.h> +#include <zen/win_ver.h> +#include "IFileDialog_Vista\ifile_dialog.h" +#endif + using namespace zen; +const wxEventType zen::EVENT_ON_DIR_SELECTED = wxNewEventType(); + namespace { -void setDirectoryNameImpl(const wxString& dirname, wxDirPickerCtrl* dirPicker, wxWindow& tooltipWnd, wxStaticText* staticText, size_t timeout) +void setDirectoryNameImpl(const wxString& dirname, wxWindow& tooltipWnd, wxStaticText* staticText) { const wxString dirFormatted = utfCvrtTo<wxString>(getFormattedDirectoryName(toZ(dirname))); tooltipWnd.SetToolTip(nullptr); //workaround wxComboBox bug http://trac.wxwidgets.org/ticket/10512 / http://trac.wxwidgets.org/ticket/12659 - tooltipWnd.SetToolTip(dirFormatted); //only lord knows when the real bugfix reaches mere mortals via an official release + tooltipWnd.SetToolTip(dirFormatted); //who knows when the real bugfix reaches mere mortals via an official release... if (staticText) { @@ -37,78 +47,69 @@ void setDirectoryNameImpl(const wxString& dirname, wxDirPickerCtrl* dirPicker, w staticText->SetLabel(dirNormalized == dirFormatted ? wxString(_("Drag && drop")) : dirFormatted); } - - if (dirPicker && !dirFormatted.empty()) - { - Zstring dir = toZ(dirFormatted); //convert to Zstring first: we don't want to pass wxString by value and risk MT issues! - auto ft = async([=] { return zen::dirExists(dir); }); - - if (ft.timed_wait(boost::posix_time::milliseconds(timeout)) && ft.get()) //potentially slow network access: wait 200ms at most - dirPicker->SetPath(dirFormatted); - } } void setDirectoryName(const wxString& dirname, wxTextCtrl* txtCtrl, - wxDirPickerCtrl* dirPicker, wxWindow& tooltipWnd, - wxStaticText* staticText, - size_t timeout = 200) //pointers are optional + wxStaticText* staticText) //pointers are optional { if (txtCtrl) txtCtrl->ChangeValue(dirname); - setDirectoryNameImpl(dirname, dirPicker, tooltipWnd, staticText, timeout); + setDirectoryNameImpl(dirname, tooltipWnd, staticText); } void setDirectoryName(const wxString& dirname, FolderHistoryBox* comboBox, - wxDirPickerCtrl* dirPicker, wxWindow& tooltipWnd, - wxStaticText* staticText, - size_t timeout = 200) //pointers are optional + wxStaticText* staticText) //pointers are optional { if (comboBox) comboBox->setValue(dirname); - setDirectoryNameImpl(dirname, dirPicker, tooltipWnd, staticText, timeout); + setDirectoryNameImpl(dirname, tooltipWnd, staticText); } } //############################################################################################################## template <class NameControl> -DirectoryName<NameControl>::DirectoryName(wxWindow& dropWindow, - wxDirPickerCtrl& dirPicker, - NameControl& dirName, - wxStaticText* staticText, - wxWindow* dropWindow2) : +DirectoryName<NameControl>::DirectoryName(wxWindow& dropWindow, + wxButton& selectButton, + NameControl& dirName, + wxStaticText* staticText, + wxWindow* dropWindow2) : dropWindow_(dropWindow), dropWindow2_(dropWindow2), - dirPicker_(dirPicker), + selectButton_(selectButton), dirName_(dirName), staticText_(staticText) { //prepare drag & drop - setupFileDrop(dropWindow); - dropWindow.Connect(EVENT_DROP_FILE, FileDropEventHandler(DirectoryName::OnFilesDropped), nullptr, this); + setupFileDrop(dropWindow_); + dropWindow_.Connect(EVENT_DROP_FILE, FileDropEventHandler(DirectoryName::OnFilesDropped), nullptr, this); - if (dropWindow2) + if (dropWindow2_) { - setupFileDrop(*dropWindow2); - dropWindow2->Connect(EVENT_DROP_FILE, FileDropEventHandler(DirectoryName::OnFilesDropped), nullptr, this); + setupFileDrop(*dropWindow2_); + dropWindow2_->Connect(EVENT_DROP_FILE, FileDropEventHandler(DirectoryName::OnFilesDropped), nullptr, this); } //keep dirPicker and dirName synchronous - dirName_ .Connect(wxEVT_COMMAND_TEXT_UPDATED, wxCommandEventHandler( DirectoryName::OnWriteDirManually), nullptr, this); - dirPicker_.Connect(wxEVT_COMMAND_DIRPICKER_CHANGED, wxFileDirPickerEventHandler(DirectoryName::OnDirSelected ), nullptr, this); + dirName_ .Connect(wxEVT_COMMAND_TEXT_UPDATED, wxCommandEventHandler (DirectoryName::OnWriteDirManually), nullptr, this); + selectButton_.Connect(wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler (DirectoryName::OnSelectDir ), nullptr, this); } template <class NameControl> DirectoryName<NameControl>::~DirectoryName() { - dirName_ .Disconnect(wxEVT_COMMAND_TEXT_UPDATED, wxCommandEventHandler( DirectoryName::OnWriteDirManually), nullptr, this); - dirPicker_.Disconnect(wxEVT_COMMAND_DIRPICKER_CHANGED, wxFileDirPickerEventHandler(DirectoryName::OnDirSelected ), nullptr, this); + dropWindow_.Disconnect(EVENT_DROP_FILE, FileDropEventHandler(DirectoryName::OnFilesDropped), nullptr, this); + if (dropWindow2_) + dropWindow2_->Disconnect(EVENT_DROP_FILE, FileDropEventHandler(DirectoryName::OnFilesDropped), nullptr, this); + + dirName_ .Disconnect(wxEVT_COMMAND_TEXT_UPDATED, wxCommandEventHandler (DirectoryName::OnWriteDirManually), nullptr, this); + selectButton_.Disconnect(wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler (DirectoryName::OnSelectDir ), nullptr, this); } @@ -123,7 +124,7 @@ void DirectoryName<NameControl>::OnFilesDropped(FileDropEvent& event) { const wxString fileName = event.getFiles()[0]; if (dirExists(toZ(fileName))) - setDirectoryName(fileName, &dirName_, &dirPicker_, dirName_, staticText_); + setDirectoryName(fileName, &dirName_, dirName_, staticText_); else { wxString parentName = beforeLast(fileName, utfCvrtTo<wxString>(FILE_NAME_SEPARATOR)); //returns empty string if ch not found @@ -132,10 +133,14 @@ void DirectoryName<NameControl>::OnFilesDropped(FileDropEvent& event) parentName += FILE_NAME_SEPARATOR; #endif if (dirExists(toZ(parentName))) - setDirectoryName(parentName, &dirName_, &dirPicker_, dirName_, staticText_); + setDirectoryName(parentName, &dirName_, dirName_, staticText_); else //set original name unconditionally: usecase: inactive mapped network shares - setDirectoryName(fileName, &dirName_, &dirPicker_, dirName_, staticText_); + setDirectoryName(fileName, &dirName_, dirName_, staticText_); } + + //notify action invoked by user + wxCommandEvent dummy(EVENT_ON_DIR_SELECTED); + ProcessEvent(dummy); } else event.Skip(); //let other handlers try!!! @@ -145,17 +150,75 @@ void DirectoryName<NameControl>::OnFilesDropped(FileDropEvent& event) template <class NameControl> void DirectoryName<NameControl>::OnWriteDirManually(wxCommandEvent& event) { - setDirectoryName(event.GetString(), static_cast<NameControl*>(nullptr), &dirPicker_, dirName_, staticText_, 100); //potentially slow network access: wait 100 ms at most + setDirectoryName(event.GetString(), static_cast<NameControl*>(nullptr), dirName_, staticText_); //potentially slow network access: wait 100 ms at most + + //wxCommandEvent dummy(EVENT_ON_DIR_SELECTED); -> don't annoy the user! + //ProcessEvent(dummy); event.Skip(); } template <class NameControl> -void DirectoryName<NameControl>::OnDirSelected(wxFileDirPickerEvent& event) +void DirectoryName<NameControl>::OnSelectDir(wxCommandEvent& event) { - const wxString newPath = event.GetPath(); - setDirectoryName(newPath, &dirName_, nullptr, dirName_, staticText_); - event.Skip(); + wxString defaultDirname; //default selection for dir picker + { + const Zstring dirFmt = getFormattedDirectoryName(toZ(getName())); + if (!dirFmt.empty()) + { + //convert to Zstring first: we don't want to pass wxString by value and risk MT issues! + auto ft = async([=] { return zen::dirExists(dirFmt); }); + + if (ft.timed_wait(boost::posix_time::milliseconds(200)) && ft.get()) //potentially slow network access: wait 200ms at most + defaultDirname = utfCvrtTo<wxString>(dirFmt); + } + } + + //wxDirDialog internally uses lame looking SHBrowseForFolder(); Better use IFileDialog() instead! (remembers size and position!) + std::unique_ptr<wxString> newFolder; +#ifdef FFS_WIN + if (vistaOrLater()) + { + using namespace ifile; + const DllFun<FunType_showFolderPicker> showFolderPicker(getDllName(), funName_showFolderPicker); + const DllFun<FunType_freeString> freeString (getDllName(), funName_freeString); + if (showFolderPicker && freeString) + { + const wchar_t* selectedFolder = nullptr; + const wchar_t* errorMsg = nullptr; + bool cancelled = false; + ZEN_ON_SCOPE_EXIT(freeString(selectedFolder)); + ZEN_ON_SCOPE_EXIT(freeString(errorMsg)); + + showFolderPicker(static_cast<HWND>(selectButton_.GetHWND()), //in; ==HWND + defaultDirname.empty() ? nullptr : defaultDirname.c_str(), //in, optional! + selectedFolder, //out: call freeString() after use! + cancelled, //out + errorMsg); //out, optional: call freeString() after use! + if (errorMsg) + { + wxMessageBox(errorMsg, _("Error"), wxOK | wxICON_ERROR); + return; + } + if (cancelled || !selectedFolder) + return; + newFolder = make_unique<wxString>(selectedFolder); + } + } +#endif + if (!newFolder.get()) + { + wxDirDialog dirPicker(&selectButton_, _("Select a folder"), defaultDirname); //put modal dialog on stack: creating on freestore leads to memleak! + if (dirPicker.ShowModal() != wxID_OK) + return; + newFolder = make_unique<wxString>(dirPicker.GetPath()); + } + + setDirectoryName(*newFolder, &dirName_, dirName_, staticText_); + + //notify action invoked by user + wxCommandEvent dummy(EVENT_ON_DIR_SELECTED); + ProcessEvent(dummy); } @@ -169,7 +232,7 @@ wxString DirectoryName<NameControl>::getName() const template <class NameControl> void DirectoryName<NameControl>::setName(const wxString& dirname) { - setDirectoryName(dirname, &dirName_, &dirPicker_, dirName_, staticText_); + setDirectoryName(dirname, &dirName_, dirName_, staticText_); } diff --git a/ui/dir_name.h b/ui/dir_name.h index e49b9302..3540e087 100644 --- a/ui/dir_name.h +++ b/ui/dir_name.h @@ -1,7 +1,7 @@ // ************************************************************************** // * 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 (zhnmju123 AT gmx DOT de) - All Rights Reserved * +// * Copyright (C) ZenJu (zenju AT gmx DOT de) - All Rights Reserved * // ************************************************************************** #ifndef DRAGANDDROP_H_INCLUDED @@ -10,23 +10,34 @@ #include <vector> #include <wx/event.h> #include <wx/sizer.h> -#include <wx/filepicker.h> #include <wx+/file_drop.h> #include <wx/stattext.h> +#include <wx/button.h> namespace zen { -//handle drag and drop, tooltip, label and manual input, coordinating a wxWindow, wxDirPickerCtrl, and wxComboBox/wxTextCtrl +//handle drag and drop, tooltip, label and manual input, coordinating a wxWindow, wxButton, and wxComboBox/wxTextCtrl +/* +Reasons NOT to use wxDirPickerCtrl, but wxButton instead: + - Crash on GTK 2: http://favapps.wordpress.com/2012/06/11/freefilesync-crash-in-linux-when-syncing-solved/ + - selection dialog remembers size, but NOT position => if user enlarges window, the next time he opens the dialog it may leap out of visible screen + - still uses outdated ::SHBrowseForFolder() (Windows 7) + - hard-codes "Browse" button label +*/ + +//emit event when directory is changed by the user: +extern const wxEventType EVENT_ON_DIR_SELECTED; +//example: wnd.Connect(EVENT_ON_DIR_SELECTED, wxCommandEventHandler(MyDlg::OnDirSelected), nullptr, this); template <class NameControl> //NameControl may be wxTextCtrl, FolderHistoryBox -class DirectoryName: private wxEvtHandler +class DirectoryName: public wxEvtHandler { public: - DirectoryName(wxWindow& dropWindow, - wxDirPickerCtrl& dirPicker, - NameControl& dirName, - wxStaticText* staticText = nullptr, - wxWindow* dropWindow2 = nullptr); //optional + DirectoryName(wxWindow& dropWindow, + wxButton& selectButton, + NameControl& dirName, + wxStaticText* staticText = nullptr, //optional + wxWindow* dropWindow2 = nullptr); // ~DirectoryName(); @@ -38,13 +49,13 @@ private: void OnFilesDropped(FileDropEvent& event); void OnWriteDirManually(wxCommandEvent& event); - void OnDirSelected(wxFileDirPickerEvent& event); + void OnSelectDir(wxCommandEvent& event); - const wxWindow& dropWindow_; - const wxWindow* dropWindow2_; - wxDirPickerCtrl& dirPicker_; - NameControl& dirName_; - wxStaticText* staticText_; //optional + wxWindow& dropWindow_; + wxWindow* dropWindow2_; + wxButton& selectButton_; + NameControl& dirName_; + wxStaticText* staticText_; //optional }; } diff --git a/ui/exec_finished_box.cpp b/ui/exec_finished_box.cpp index e776c673..0586e8e5 100644 --- a/ui/exec_finished_box.cpp +++ b/ui/exec_finished_box.cpp @@ -1,7 +1,7 @@ // ************************************************************************** // * 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 (zhnmju123 AT gmx DOT de) - All Rights Reserved * +// * Copyright (C) ZenJu (zenju AT gmx DOT de) - All Rights Reserved * // ************************************************************************** #include "exec_finished_box.h" @@ -18,7 +18,7 @@ using namespace zen; namespace { -const std::wstring closeProgressDlg = L"Close progress dialog"; //special command //mark for extraction: _("Close progress dialog") +const std::wstring cmdTxtCloseProgressDlg = L"Close progress dialog"; //special command //mark for extraction: _("Close progress dialog") const std::wstring separationLine(L"---------------------------------------------------------------------------------------------------------------"); @@ -56,7 +56,7 @@ std::vector<std::pair<std::wstring, std::wstring>> getDefaultCommands() //(gui n return output; } -const wxEventType wxEVT_REPLACE_BUILT_IN_COMMANDS = wxNewEventType(); +const wxEventType wxEVT_VALIDATE_USER_SELECTION = wxNewEventType(); } @@ -64,36 +64,7 @@ bool isCloseProgressDlgCommand(const std::wstring& value) { std::wstring tmp = value; trim(tmp); - return tmp == closeProgressDlg; -} - - -void addValueToHistory(const std::wstring& value, std::vector<std::wstring>& history, size_t historyMax) -{ - std::wstring command = value; - trim(command); - - bool skipCmd = command == separationLine || //do not add sep. line - command == closeProgressDlg || //do not add special command - command.empty(); - - //do not add built-in commands to history - if (!skipCmd) - { - const auto& defaultCommands = getDefaultCommands(); - for (auto iter = defaultCommands.begin(); iter != defaultCommands.end(); ++iter) - if (command == iter->first || command == iter->second) - { - skipCmd = true; - break; - } - } - - if (!skipCmd) - history.insert(history.begin(), command); - - if (history.size() > historyMax) - history.resize(historyMax); + return tmp == cmdTxtCloseProgressDlg; } @@ -109,6 +80,7 @@ ExecFinishedBox::ExecFinishedBox(wxWindow* parent, const wxString& name) : wxComboBox(parent, id, value, pos, size, n, choices, style, validator, name), history_(nullptr), + historyMax_(0), defaultCommands(getDefaultCommands()) { //##################################### @@ -120,7 +92,38 @@ ExecFinishedBox::ExecFinishedBox(wxWindow* parent, Connect(wxEVT_COMMAND_COMBOBOX_SELECTED, wxCommandEventHandler(ExecFinishedBox::OnSelection ), nullptr, this); Connect(wxEVT_MOUSEWHEEL, wxMouseEventHandler (ExecFinishedBox::OnMouseWheel), nullptr, this); - Connect(wxEVT_REPLACE_BUILT_IN_COMMANDS, wxCommandEventHandler(ExecFinishedBox::OnReplaceBuiltInCmds), nullptr, this); + Connect(wxEVT_VALIDATE_USER_SELECTION, wxCommandEventHandler(ExecFinishedBox::OnValidateSelection), nullptr, this); +} + + +void ExecFinishedBox::addItemHistory() +{ + if (history_) + { + std::wstring command = getValue(); + trim(command); + + bool skipCmd = command == separationLine || //do not add sep. line + command == cmdTxtCloseProgressDlg || //do not add special command + command.empty(); + + //do not add built-in commands to history + if (!skipCmd) + { + for (auto iter = defaultCommands.begin(); iter != defaultCommands.end(); ++iter) + if (command == iter->first || command == iter->second) + { + skipCmd = true; + break; + } + } + + if (!skipCmd) + history_->insert(history_->begin(), command); + + if (history_->size() > historyMax_) + history_->resize(historyMax_); + } } @@ -131,8 +134,8 @@ std::wstring ExecFinishedBox::getValue() const { std::wstring tmp = value; trim(tmp); - if (tmp == implementation::translate(closeProgressDlg)) //have this symbolic constant translated properly - return closeProgressDlg; + if (tmp == implementation::translate(cmdTxtCloseProgressDlg)) //have this symbolic constant translated properly + return cmdTxtCloseProgressDlg; } return value; @@ -144,8 +147,8 @@ void ExecFinishedBox::setValue(const std::wstring& value) std::wstring tmp = value; trim(tmp); - if (tmp == closeProgressDlg) - setValueAndUpdateList(implementation::translate(closeProgressDlg)); //have this symbolic constant translated properly + if (tmp == cmdTxtCloseProgressDlg) + setValueAndUpdateList(implementation::translate(cmdTxtCloseProgressDlg)); //have this symbolic constant translated properly else setValueAndUpdateList(value); } @@ -158,7 +161,7 @@ void ExecFinishedBox::setValueAndUpdateList(const std::wstring& value) std::deque<std::wstring> items; //1. special command - items.push_back(implementation::translate(closeProgressDlg)); + items.push_back(implementation::translate(cmdTxtCloseProgressDlg)); //2. built in commands for (auto iter = defaultCommands.begin(); iter != defaultCommands.end(); ++iter) @@ -191,7 +194,7 @@ void ExecFinishedBox::setValueAndUpdateList(const std::wstring& value) void ExecFinishedBox::OnSelection(wxCommandEvent& event) { - wxCommandEvent dummy2(wxEVT_REPLACE_BUILT_IN_COMMANDS); //we cannot replace built-in commands at this position in call stack, so defer to a later time! + wxCommandEvent dummy2(wxEVT_VALIDATE_USER_SELECTION); //we cannot replace built-in commands at this position in call stack, so defer to a later time! if (auto handler = GetEventHandler()) handler->AddPendingEvent(dummy2); @@ -199,7 +202,7 @@ void ExecFinishedBox::OnSelection(wxCommandEvent& event) } -void ExecFinishedBox::OnReplaceBuiltInCmds(wxCommandEvent& event) +void ExecFinishedBox::OnValidateSelection(wxCommandEvent& event) { const auto& value = getValue(); diff --git a/ui/exec_finished_box.h b/ui/exec_finished_box.h index 7578acc6..b7232711 100644 --- a/ui/exec_finished_box.h +++ b/ui/exec_finished_box.h @@ -1,7 +1,7 @@ // ************************************************************************** // * 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 (zhnmju123 AT gmx DOT de) - All Rights Reserved * +// * Copyright (C) ZenJu (zenju AT gmx DOT de) - All Rights Reserved * // ************************************************************************** #ifndef EXEC_FINISHED_BOX_18947773210473214 @@ -13,14 +13,11 @@ #include <wx/combobox.h> #include <zen/string_tools.h> - //combobox with history function + functionality to delete items (DEL) //special command bool isCloseProgressDlgCommand(const std::wstring& value); -void addValueToHistory(const std::wstring& value, std::vector<std::wstring>& history, size_t historyMax); - class ExecFinishedBox : public wxComboBox { @@ -36,7 +33,8 @@ public: const wxValidator& validator = wxDefaultValidator, const wxString& name = wxComboBoxNameStr); - void setHistoryRef(std::vector<std::wstring>& history) { history_ = &history; } + void initHistory(std::vector<std::wstring>& history, size_t historyMax) { history_ = &history; historyMax_ = historyMax; } + void addItemHistory(); //adds current item to history // use these two accessors instead of GetValue()/SetValue(): std::wstring getValue() const; @@ -47,12 +45,13 @@ private: void OnKeyEvent(wxKeyEvent& event); void OnMouseWheel(wxMouseEvent& event) {} //swallow! this gives confusing UI feedback anyway void OnSelection(wxCommandEvent& event); - void OnReplaceBuiltInCmds(wxCommandEvent& event); + void OnValidateSelection(wxCommandEvent& event); void OnUpdateList(wxEvent& event); void setValueAndUpdateList(const std::wstring& value); std::vector<std::wstring>* history_; + size_t historyMax_; const std::vector<std::pair<std::wstring, std::wstring>> defaultCommands; }; diff --git a/ui/folder_history_box.cpp b/ui/folder_history_box.cpp index 2b773c20..528a36ce 100644 --- a/ui/folder_history_box.cpp +++ b/ui/folder_history_box.cpp @@ -1,7 +1,7 @@ // ************************************************************************** // * 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 (zhnmju123 AT gmx DOT de) - All Rights Reserved * +// * Copyright (C) ZenJu (zenju AT gmx DOT de) - All Rights Reserved * // ************************************************************************** #include "folder_history_box.h" @@ -12,6 +12,10 @@ using namespace zen; +namespace +{ +const wxEventType wxEVT_VALIDATE_USER_SELECTION = wxNewEventType(); +} FolderHistoryBox::FolderHistoryBox(wxWindow* parent, wxWindowID id, @@ -41,6 +45,8 @@ FolderHistoryBox::FolderHistoryBox(wxWindow* parent, Connect(wxEVT_COMMAND_COMBOBOX_DROPDOWN, wxCommandEventHandler(FolderHistoryBox::OnShowDropDown), nullptr, this); Connect(wxEVT_COMMAND_COMBOBOX_CLOSEUP, wxCommandEventHandler(FolderHistoryBox::OnHideDropDown), nullptr, this); #endif + +Connect(wxEVT_VALIDATE_USER_SELECTION, wxCommandEventHandler(FolderHistoryBox::OnValidateSelection), nullptr, this); } @@ -78,7 +84,7 @@ void FolderHistoryBox::setValueAndUpdateList(const wxString& dirname) //std::sort(tmp.begin(), tmp.end(), LessFilename()); if (!dirList.empty() && !tmp.empty()) - dirList.push_back(FolderHistory::lineSeparator()); + dirList.push_back(toZ(FolderHistory::separationLine())); dirList.insert(dirList.end(), tmp.begin(), tmp.end()); } @@ -99,10 +105,22 @@ void FolderHistoryBox::setValueAndUpdateList(const wxString& dirname) void FolderHistoryBox::OnSelection(wxCommandEvent& event) { + wxCommandEvent dummy2(wxEVT_VALIDATE_USER_SELECTION); //we cannot replace built-in commands at this position in call stack, so defer to a later time! + if (auto handler = GetEventHandler()) + handler->AddPendingEvent(dummy2); + event.Skip(); } +void FolderHistoryBox::OnValidateSelection(wxCommandEvent& event) +{ + //const auto& value = GetValue(); + //if (value == FolderHistory::separationLine()) + // setValueAndUpdateList(wxString()); -> not good enough (resolved folder name not updated) +} + + void FolderHistoryBox::OnKeyEvent(wxKeyEvent& event) { const int keyCode = event.GetKeyCode(); diff --git a/ui/folder_history_box.h b/ui/folder_history_box.h index 68197786..49dec582 100644 --- a/ui/folder_history_box.h +++ b/ui/folder_history_box.h @@ -1,7 +1,7 @@ // ************************************************************************** // * 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 (zhnmju123 AT gmx DOT de) - All Rights Reserved * +// * Copyright (C) ZenJu (zenju AT gmx DOT de) - All Rights Reserved * // ************************************************************************** #ifndef CUSTOMCOMBOBOX_H_INCLUDED @@ -11,6 +11,7 @@ #include <memory> #include <zen/zstring.h> #include <zen/stl_tools.h> +#include <zen/utf.h> //combobox with history function + functionality to delete items (DEL) @@ -30,11 +31,11 @@ public: const std::vector<Zstring>& getList() const { return dirnames_; } - static const Zstring lineSeparator() { return Zstr("---------------------------------------------------------------------------------------------------------------"); } + static const wxString separationLine() { return L"---------------------------------------------------------------------------------------------------------------"; } void addItem(const Zstring& dirname) { - if (dirname.empty() || dirname == lineSeparator()) + if (dirname.empty() || dirname == zen::utfCvrtTo<Zstring>(separationLine())) return; Zstring nameTmp = dirname; @@ -88,6 +89,7 @@ private: void OnKeyEvent(wxKeyEvent& event); void OnMouseWheel(wxMouseEvent& event); void OnSelection(wxCommandEvent& event); + void OnValidateSelection(wxCommandEvent& event); void OnUpdateList(wxEvent& event) { setValueAndUpdateList(GetValue()); event.Skip(); } void setValueAndUpdateList(const wxString& dirname); diff --git a/ui/folder_pair.h b/ui/folder_pair.h index c9f42259..eab07b68 100644 --- a/ui/folder_pair.h +++ b/ui/folder_pair.h @@ -1,7 +1,7 @@ // ************************************************************************** // * 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 (zhnmju123 AT gmx DOT de) - All Rights Reserved * +// * Copyright (C) ZenJu (zenju AT gmx DOT de) - All Rights Reserved * // ************************************************************************** #ifndef FOLDERPAIR_H_INCLUDED diff --git a/ui/grid_view.cpp b/ui/grid_view.cpp index 8764e233..5045fca4 100644 --- a/ui/grid_view.cpp +++ b/ui/grid_view.cpp @@ -1,7 +1,7 @@ // ************************************************************************** // * 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 (zhnmju123 AT gmx DOT de) - All Rights Reserved * +// * Copyright (C) ZenJu (zenju AT gmx DOT de) - All Rights Reserved * // ************************************************************************** #include "grid_view.h" diff --git a/ui/grid_view.h b/ui/grid_view.h index 5fc80338..0cb5d285 100644 --- a/ui/grid_view.h +++ b/ui/grid_view.h @@ -1,7 +1,7 @@ // ************************************************************************** // * 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 (zhnmju123 AT gmx DOT de) - All Rights Reserved * +// * Copyright (C) ZenJu (zenju AT gmx DOT de) - All Rights Reserved * // ************************************************************************** #ifndef GRIDVIEW_H_INCLUDED diff --git a/ui/gui_generated.cpp b/ui/gui_generated.cpp index 1f58d6a5..50c5ea62 100644 --- a/ui/gui_generated.cpp +++ b/ui/gui_generated.cpp @@ -47,7 +47,7 @@ MainDialogGenerated::MainDialogGenerated( wxWindow* parent, wxWindowID id, const m_menuItemSave = new wxMenuItem( m_menuFile, wxID_SAVE, wxString( _("&Save") ) + wxT('\t') + wxT("Ctrl+S"), wxEmptyString, wxITEM_NORMAL ); m_menuFile->Append( m_menuItemSave ); - m_menuItemSaveAs = new wxMenuItem( m_menuFile, wxID_SAVEAS, wxString( _("Save &As...") ) , wxEmptyString, wxITEM_NORMAL ); + m_menuItemSaveAs = new wxMenuItem( m_menuFile, wxID_SAVEAS, wxString( _("Save &as...") ) , wxEmptyString, wxITEM_NORMAL ); m_menuFile->Append( m_menuItemSaveAs ); m_menuFile->AppendSeparator(); @@ -238,10 +238,10 @@ MainDialogGenerated::MainDialogGenerated( wxWindow* parent, wxWindowID id, const m_directoryLeft = new FolderHistoryBox( m_panelTopLeft, wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0, NULL, 0 ); bSizer182->Add( m_directoryLeft, 1, wxALIGN_CENTER_VERTICAL, 5 ); - m_dirPickerLeft = new zen::DirPickerCtrl( m_panelTopLeft, wxID_ANY, wxEmptyString, _("Select a folder"), wxDefaultPosition, wxDefaultSize, 0 ); - m_dirPickerLeft->SetToolTip( _("Select a folder") ); + m_buttonSelectDirLeft = new wxButton( m_panelTopLeft, wxID_ANY, _("Browse"), wxDefaultPosition, wxDefaultSize, 0 ); + m_buttonSelectDirLeft->SetToolTip( _("Select a folder") ); - bSizer182->Add( m_dirPickerLeft, 0, wxALIGN_CENTER_VERTICAL, 5 ); + bSizer182->Add( m_buttonSelectDirLeft, 0, wxALIGN_CENTER_VERTICAL, 5 ); bSizer180->Add( bSizer182, 0, wxEXPAND, 5 ); @@ -316,10 +316,10 @@ MainDialogGenerated::MainDialogGenerated( wxWindow* parent, wxWindowID id, const m_directoryRight = new FolderHistoryBox( m_panelTopRight, wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0, NULL, 0 ); bSizer179->Add( m_directoryRight, 1, wxALIGN_CENTER_VERTICAL, 5 ); - m_dirPickerRight = new zen::DirPickerCtrl( m_panelTopRight, wxID_ANY, wxEmptyString, _("Select a folder"), wxDefaultPosition, wxDefaultSize, 0 ); - m_dirPickerRight->SetToolTip( _("Select a folder") ); + m_buttonSelectDirRight = new wxButton( m_panelTopRight, wxID_ANY, _("Browse"), wxDefaultPosition, wxDefaultSize, 0 ); + m_buttonSelectDirRight->SetToolTip( _("Select a folder") ); - bSizer179->Add( m_dirPickerRight, 0, wxALIGN_CENTER_VERTICAL, 5 ); + bSizer179->Add( m_buttonSelectDirRight, 0, wxALIGN_CENTER_VERTICAL, 5 ); bSizer183->Add( bSizer179, 0, wxALIGN_CENTER_HORIZONTAL|wxALIGN_CENTER_VERTICAL|wxEXPAND, 5 ); @@ -558,10 +558,10 @@ MainDialogGenerated::MainDialogGenerated( wxWindow* parent, wxWindowID id, const m_bpButtonFilter = new wxBitmapButton( m_panelFilter, wxID_ANY, wxNullBitmap, wxDefaultPosition, wxSize( 40,40 ), wxBU_AUTODRAW|wxFULL_REPAINT_ON_RESIZE ); bSizer171->Add( m_bpButtonFilter, 0, wxALIGN_CENTER_VERTICAL|wxRIGHT, 5 ); - m_checkBoxHideFilt = new wxCheckBox( m_panelFilter, wxID_ANY, _("Hide excluded items"), wxDefaultPosition, wxDefaultSize, 0 ); - m_checkBoxHideFilt->SetToolTip( _("Hide filtered or temporarily excluded files") ); + m_checkBoxShowExcluded = new wxCheckBox( m_panelFilter, wxID_ANY, _("Show excluded items"), wxDefaultPosition, wxDefaultSize, 0 ); + m_checkBoxShowExcluded->SetToolTip( _("Show filtered or temporarily excluded files") ); - bSizer171->Add( m_checkBoxHideFilt, 0, wxALIGN_CENTER_VERTICAL, 5 ); + bSizer171->Add( m_checkBoxShowExcluded, 0, wxALIGN_CENTER_VERTICAL, 5 ); m_panelFilter->SetSizer( bSizer171 ); @@ -849,15 +849,13 @@ MainDialogGenerated::MainDialogGenerated( wxWindow* parent, wxWindowID id, const m_buttonStartSync->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( MainDialogGenerated::OnStartSync ), NULL, this ); m_bpButtonAddPair->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( MainDialogGenerated::OnAddFolderPair ), NULL, this ); m_bpButtonRemovePair->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( MainDialogGenerated::OnRemoveTopFolderPair ), NULL, this ); - m_dirPickerLeft->Connect( wxEVT_COMMAND_DIRPICKER_CHANGED, wxFileDirPickerEventHandler( MainDialogGenerated::OnDirSelected ), NULL, this ); m_bpButtonSwapSides->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( MainDialogGenerated::OnSwapSides ), NULL, this ); - m_dirPickerRight->Connect( wxEVT_COMMAND_DIRPICKER_CHANGED, wxFileDirPickerEventHandler( MainDialogGenerated::OnDirSelected ), NULL, this ); m_bpButtonLoad->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( MainDialogGenerated::OnConfigLoad ), NULL, this ); m_bpButtonSave->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( MainDialogGenerated::OnConfigSaveAs ), NULL, this ); m_listBoxHistory->Connect( wxEVT_CHAR, wxKeyEventHandler( MainDialogGenerated::OnCfgHistoryKeyEvent ), NULL, this ); m_listBoxHistory->Connect( wxEVT_COMMAND_LISTBOX_SELECTED, wxCommandEventHandler( MainDialogGenerated::OnLoadFromHistory ), NULL, this ); m_bpButtonFilter->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( MainDialogGenerated::OnConfigureFilter ), NULL, this ); - m_checkBoxHideFilt->Connect( wxEVT_COMMAND_CHECKBOX_CLICKED, wxCommandEventHandler( MainDialogGenerated::OnHideFilteredButton ), NULL, this ); + m_checkBoxShowExcluded->Connect( wxEVT_COMMAND_CHECKBOX_CLICKED, wxCommandEventHandler( MainDialogGenerated::OnShowExcluded ), NULL, this ); m_bpButtonSyncCreateLeft->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( MainDialogGenerated::OnSyncCreateLeft ), NULL, this ); m_bpButtonSyncDirOverwLeft->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( MainDialogGenerated::OnSyncDirLeft ), NULL, this ); m_bpButtonSyncDeleteLeft->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( MainDialogGenerated::OnSyncDeleteLeft ), NULL, this ); @@ -897,15 +895,13 @@ MainDialogGenerated::~MainDialogGenerated() m_buttonStartSync->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( MainDialogGenerated::OnStartSync ), NULL, this ); m_bpButtonAddPair->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( MainDialogGenerated::OnAddFolderPair ), NULL, this ); m_bpButtonRemovePair->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( MainDialogGenerated::OnRemoveTopFolderPair ), NULL, this ); - m_dirPickerLeft->Disconnect( wxEVT_COMMAND_DIRPICKER_CHANGED, wxFileDirPickerEventHandler( MainDialogGenerated::OnDirSelected ), NULL, this ); m_bpButtonSwapSides->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( MainDialogGenerated::OnSwapSides ), NULL, this ); - m_dirPickerRight->Disconnect( wxEVT_COMMAND_DIRPICKER_CHANGED, wxFileDirPickerEventHandler( MainDialogGenerated::OnDirSelected ), NULL, this ); m_bpButtonLoad->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( MainDialogGenerated::OnConfigLoad ), NULL, this ); m_bpButtonSave->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( MainDialogGenerated::OnConfigSaveAs ), NULL, this ); m_listBoxHistory->Disconnect( wxEVT_CHAR, wxKeyEventHandler( MainDialogGenerated::OnCfgHistoryKeyEvent ), NULL, this ); m_listBoxHistory->Disconnect( wxEVT_COMMAND_LISTBOX_SELECTED, wxCommandEventHandler( MainDialogGenerated::OnLoadFromHistory ), NULL, this ); m_bpButtonFilter->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( MainDialogGenerated::OnConfigureFilter ), NULL, this ); - m_checkBoxHideFilt->Disconnect( wxEVT_COMMAND_CHECKBOX_CLICKED, wxCommandEventHandler( MainDialogGenerated::OnHideFilteredButton ), NULL, this ); + m_checkBoxShowExcluded->Disconnect( wxEVT_COMMAND_CHECKBOX_CLICKED, wxCommandEventHandler( MainDialogGenerated::OnShowExcluded ), NULL, this ); m_bpButtonSyncCreateLeft->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( MainDialogGenerated::OnSyncCreateLeft ), NULL, this ); m_bpButtonSyncDirOverwLeft->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( MainDialogGenerated::OnSyncDirLeft ), NULL, this ); m_bpButtonSyncDeleteLeft->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( MainDialogGenerated::OnSyncDeleteLeft ), NULL, this ); @@ -942,10 +938,10 @@ FolderPairGenerated::FolderPairGenerated( wxWindow* parent, wxWindowID id, const m_directoryLeft = new FolderHistoryBox( m_panelLeft, wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0, NULL, 0 ); bSizer134->Add( m_directoryLeft, 1, wxALIGN_CENTER_VERTICAL, 5 ); - m_dirPickerLeft = new zen::DirPickerCtrl( m_panelLeft, wxID_ANY, wxEmptyString, _("Select a folder"), wxDefaultPosition, wxDefaultSize, 0 ); - m_dirPickerLeft->SetToolTip( _("Select a folder") ); + m_buttonSelectDirLeft = new wxButton( m_panelLeft, wxID_ANY, _("Browse"), wxDefaultPosition, wxDefaultSize, 0 ); + m_buttonSelectDirLeft->SetToolTip( _("Select a folder") ); - bSizer134->Add( m_dirPickerLeft, 0, wxALIGN_CENTER_VERTICAL, 5 ); + bSizer134->Add( m_buttonSelectDirLeft, 0, wxALIGN_CENTER_VERTICAL, 5 ); m_panelLeft->SetSizer( bSizer134 ); @@ -987,10 +983,10 @@ FolderPairGenerated::FolderPairGenerated( wxWindow* parent, wxWindowID id, const m_directoryRight = new FolderHistoryBox( m_panelRight, wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0, NULL, 0 ); bSizer135->Add( m_directoryRight, 1, wxALIGN_CENTER_VERTICAL, 5 ); - m_dirPickerRight = new zen::DirPickerCtrl( m_panelRight, wxID_ANY, wxEmptyString, _("Select a folder"), wxDefaultPosition, wxDefaultSize, 0 ); - m_dirPickerRight->SetToolTip( _("Select a folder") ); + m_buttonSelectDirRight = new wxButton( m_panelRight, wxID_ANY, _("Browse"), wxDefaultPosition, wxDefaultSize, 0 ); + m_buttonSelectDirRight->SetToolTip( _("Select a folder") ); - bSizer135->Add( m_dirPickerRight, 0, wxALIGN_CENTER_VERTICAL, 5 ); + bSizer135->Add( m_buttonSelectDirRight, 0, wxALIGN_CENTER_VERTICAL, 5 ); m_panelRight->SetSizer( bSizer135 ); @@ -1366,10 +1362,10 @@ BatchDlgGenerated::BatchDlgGenerated( wxWindow* parent, wxWindowID id, const wxS m_directoryLeft = new FolderHistoryBox( m_panelLeft, wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0, NULL, 0 ); bSizer1141->Add( m_directoryLeft, 1, wxALIGN_CENTER_VERTICAL, 5 ); - m_dirPickerLeft = new zen::DirPickerCtrl( m_panelLeft, wxID_ANY, wxEmptyString, _("Select a folder"), wxDefaultPosition, wxDefaultSize, 0 ); - m_dirPickerLeft->SetToolTip( _("Select a folder") ); + m_buttonSelectDirLeft = new wxButton( m_panelLeft, wxID_ANY, _("Browse"), wxDefaultPosition, wxDefaultSize, 0 ); + m_buttonSelectDirLeft->SetToolTip( _("Select a folder") ); - bSizer1141->Add( m_dirPickerLeft, 0, wxALIGN_CENTER_VERTICAL, 5 ); + bSizer1141->Add( m_buttonSelectDirLeft, 0, wxALIGN_CENTER_VERTICAL, 5 ); m_panelLeft->SetSizer( bSizer1141 ); @@ -1384,10 +1380,10 @@ BatchDlgGenerated::BatchDlgGenerated( wxWindow* parent, wxWindowID id, const wxS m_directoryRight = new FolderHistoryBox( m_panelRight, wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0, NULL, 0 ); bSizer115->Add( m_directoryRight, 1, wxALIGN_CENTER_VERTICAL, 5 ); - m_dirPickerRight = new zen::DirPickerCtrl( m_panelRight, wxID_ANY, wxEmptyString, _("Select a folder"), wxDefaultPosition, wxDefaultSize, 0 ); - m_dirPickerRight->SetToolTip( _("Select a folder") ); + m_buttonSelectDirRight = new wxButton( m_panelRight, wxID_ANY, _("Browse"), wxDefaultPosition, wxDefaultSize, 0 ); + m_buttonSelectDirRight->SetToolTip( _("Select a folder") ); - bSizer115->Add( m_dirPickerRight, 0, wxALIGN_CENTER_VERTICAL, 5 ); + bSizer115->Add( m_buttonSelectDirRight, 0, wxALIGN_CENTER_VERTICAL, 5 ); m_panelRight->SetSizer( bSizer115 ); @@ -1428,9 +1424,6 @@ BatchDlgGenerated::BatchDlgGenerated( wxWindow* parent, wxWindowID id, const wxS bSizer120->Add( m_scrolledWindow6, 1, wxEXPAND, 5 ); - bSizer120->Add( 0, 5, 0, wxALIGN_CENTER_HORIZONTAL, 5 ); - - bSizer67->Add( bSizer120, 1, wxALIGN_CENTER_VERTICAL|wxALL|wxEXPAND, 10 ); @@ -1445,87 +1438,76 @@ BatchDlgGenerated::BatchDlgGenerated( wxWindow* parent, wxWindowID id, const wxS wxBoxSizer* bSizer172; bSizer172 = new wxBoxSizer( wxVERTICAL ); - wxBoxSizer* bSizer1722; - bSizer1722 = new wxBoxSizer( wxHORIZONTAL ); - - wxStaticBoxSizer* sbSizer24; - sbSizer24 = new wxStaticBoxSizer( new wxStaticBox( m_panelBatchSettings, wxID_ANY, _("Status feedback") ), wxHORIZONTAL ); - - m_checkBoxShowProgress = new wxCheckBox( m_panelBatchSettings, wxID_ANY, _("Show progress dialog"), wxDefaultPosition, wxDefaultSize, 0 ); - sbSizer24->Add( m_checkBoxShowProgress, 1, wxALIGN_CENTER_VERTICAL|wxALL, 5 ); + wxBoxSizer* bSizer180; + bSizer180 = new wxBoxSizer( wxHORIZONTAL ); - wxBoxSizer* bSizer1702; - bSizer1702 = new wxBoxSizer( wxHORIZONTAL ); + sbSizerErrorHandling = new wxStaticBoxSizer( new wxStaticBox( m_panelBatchSettings, wxID_ANY, _("Error handling") ), wxHORIZONTAL ); - m_staticText961 = new wxStaticText( m_panelBatchSettings, wxID_ANY, _("Error handling"), wxDefaultPosition, wxDefaultSize, 0 ); - m_staticText961->Wrap( -1 ); - bSizer1702->Add( m_staticText961, 0, wxALIGN_CENTER_VERTICAL|wxRIGHT, 5 ); + m_toggleBtnErrorIgnore = new wxToggleButton( m_panelBatchSettings, wxID_ANY, _("Ignore"), wxDefaultPosition, wxDefaultSize, 0 ); + m_toggleBtnErrorIgnore->SetToolTip( _("Hide all error and warning messages") ); - wxArrayString m_choiceHandleErrorChoices; - m_choiceHandleError = new wxChoice( m_panelBatchSettings, wxID_ANY, wxDefaultPosition, wxDefaultSize, m_choiceHandleErrorChoices, 0 ); - m_choiceHandleError->SetSelection( 0 ); - bSizer1702->Add( m_choiceHandleError, 0, wxALIGN_CENTER_VERTICAL, 5 ); + sbSizerErrorHandling->Add( m_toggleBtnErrorIgnore, 0, wxRIGHT|wxALIGN_CENTER_VERTICAL, 5 ); + m_toggleBtnErrorPopup = new wxToggleButton( m_panelBatchSettings, wxID_ANY, _("Pop-up"), wxDefaultPosition, wxDefaultSize, 0 ); + m_toggleBtnErrorPopup->SetToolTip( _("Show pop-up on errors or warnings") ); - sbSizer24->Add( bSizer1702, 0, wxALIGN_CENTER_VERTICAL|wxALL, 5 ); + sbSizerErrorHandling->Add( m_toggleBtnErrorPopup, 0, wxALIGN_CENTER_VERTICAL|wxRIGHT, 5 ); + m_toggleBtnErrorExit = new wxToggleButton( m_panelBatchSettings, wxID_ANY, _("Exit"), wxDefaultPosition, wxDefaultSize, 0 ); + m_toggleBtnErrorExit->SetToolTip( _("Abort synchronization on first error") ); - bSizer1722->Add( sbSizer24, 1, wxALIGN_CENTER_VERTICAL, 5 ); + sbSizerErrorHandling->Add( m_toggleBtnErrorExit, 0, wxALIGN_CENTER_VERTICAL, 5 ); - bSizer1722->Add( 10, 0, 0, 0, 5 ); + bSizer180->Add( sbSizerErrorHandling, 0, wxALIGN_CENTER_VERTICAL|wxRIGHT|wxEXPAND, 5 ); + sbSizerExecFinished = new wxStaticBoxSizer( new wxStaticBox( m_panelBatchSettings, wxID_ANY, _("On completion:") ), wxHORIZONTAL ); - bSizer172->Add( bSizer1722, 0, wxEXPAND, 5 ); + m_comboBoxExecFinished = new ExecFinishedBox( m_panelBatchSettings, wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0, NULL, 0 ); + sbSizerExecFinished->Add( m_comboBoxExecFinished, 1, wxALIGN_CENTER_VERTICAL, 5 ); - bSizer172->Add( 0, 5, 0, 0, 5 ); + bSizer180->Add( sbSizerExecFinished, 1, wxALIGN_CENTER_VERTICAL|wxEXPAND, 5 ); - sbSizerLogfileDir = new wxStaticBoxSizer( new wxStaticBox( m_panelBatchSettings, wxID_ANY, _("Logging") ), wxVERTICAL ); - wxBoxSizer* bSizer152; - bSizer152 = new wxBoxSizer( wxHORIZONTAL ); + bSizer172->Add( bSizer180, 0, wxEXPAND, 5 ); - m_staticText96 = new wxStaticText( m_panelBatchSettings, wxID_ANY, _("Maximum number of log files:"), wxDefaultPosition, wxDefaultSize, 0 ); - m_staticText96->Wrap( -1 ); - bSizer152->Add( m_staticText96, 1, wxALIGN_CENTER_VERTICAL|wxLEFT, 5 ); - m_spinCtrlLogCountMax = new wxSpinCtrl( m_panelBatchSettings, wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, wxSP_ARROW_KEYS, 0, 2000000000, 0 ); - bSizer152->Add( m_spinCtrlLogCountMax, 0, wxALIGN_CENTER_VERTICAL, 5 ); + bSizer172->Add( 0, 5, 0, 0, 5 ); + m_checkBoxShowProgress = new wxCheckBox( m_panelBatchSettings, wxID_ANY, _("Show progress dialog"), wxDefaultPosition, wxDefaultSize, 0 ); + bSizer172->Add( m_checkBoxShowProgress, 0, wxALIGN_CENTER_VERTICAL|wxALL|wxEXPAND, 5 ); - sbSizerLogfileDir->Add( bSizer152, 0, wxEXPAND|wxTOP|wxRIGHT|wxLEFT, 5 ); + m_checkBoxGenerateLogfile = new wxCheckBox( m_panelBatchSettings, wxID_ANY, _("Generate log file"), wxDefaultPosition, wxDefaultSize, 0 ); + bSizer172->Add( m_checkBoxGenerateLogfile, 0, wxEXPAND|wxALL, 5 ); m_panelLogfile = new wxPanel( m_panelBatchSettings, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxTAB_TRAVERSAL ); wxBoxSizer* bSizer1721; - bSizer1721 = new wxBoxSizer( wxVERTICAL ); + bSizer1721 = new wxBoxSizer( wxHORIZONTAL ); - m_staticText94 = new wxStaticText( m_panelLogfile, wxID_ANY, _("Select folder to save log files:"), wxDefaultPosition, wxDefaultSize, 0 ); - m_staticText94->Wrap( -1 ); - bSizer1721->Add( m_staticText94, 0, wxTOP|wxBOTTOM|wxLEFT, 5 ); + m_comboBoxLogfileDir = new FolderHistoryBox( m_panelLogfile, wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0, NULL, 0 ); + bSizer1721->Add( m_comboBoxLogfileDir, 1, wxALIGN_CENTER_VERTICAL, 5 ); - wxBoxSizer* bSizer170; - bSizer170 = new wxBoxSizer( wxHORIZONTAL ); + m_buttonSelectLogfileDir = new wxButton( m_panelLogfile, wxID_ANY, _("Browse"), wxDefaultPosition, wxDefaultSize, 0 ); + m_buttonSelectLogfileDir->SetToolTip( _("Select folder to save log files") ); - m_comboBoxLogfileDir = new FolderHistoryBox( m_panelLogfile, wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0, NULL, 0 ); - bSizer170->Add( m_comboBoxLogfileDir, 1, wxALIGN_CENTER_VERTICAL, 5 ); + bSizer1721->Add( m_buttonSelectLogfileDir, 0, wxALIGN_CENTER_VERTICAL, 5 ); - m_dirPickerLogfileDir = new zen::DirPickerCtrl( m_panelLogfile, wxID_ANY, wxEmptyString, _("Select a folder"), wxDefaultPosition, wxDefaultSize, 0 ); - m_dirPickerLogfileDir->SetToolTip( _("Select a folder") ); + m_checkBoxLogfilesLimit = new wxCheckBox( m_panelLogfile, wxID_ANY, _("Limit"), wxDefaultPosition, wxDefaultSize, 0 ); + m_checkBoxLogfilesLimit->SetToolTip( _("Limit maximum number of log files") ); - bSizer170->Add( m_dirPickerLogfileDir, 0, wxALIGN_CENTER_VERTICAL, 5 ); + bSizer1721->Add( m_checkBoxLogfilesLimit, 0, wxALL|wxALIGN_CENTER_VERTICAL, 5 ); + m_spinCtrlLogfileLimit = new wxSpinCtrl( m_panelLogfile, wxID_ANY, wxEmptyString, wxDefaultPosition, wxSize( 50,-1 ), wxSP_ARROW_KEYS, 1, 2000000000, 1 ); + m_spinCtrlLogfileLimit->SetToolTip( _("Limit maximum number of log files") ); - bSizer1721->Add( bSizer170, 0, wxEXPAND, 5 ); + bSizer1721->Add( m_spinCtrlLogfileLimit, 0, wxALIGN_CENTER_VERTICAL, 5 ); m_panelLogfile->SetSizer( bSizer1721 ); m_panelLogfile->Layout(); bSizer1721->Fit( m_panelLogfile ); - sbSizerLogfileDir->Add( m_panelLogfile, 0, wxEXPAND|wxBOTTOM|wxRIGHT|wxLEFT, 5 ); - - - bSizer172->Add( sbSizerLogfileDir, 0, wxEXPAND, 5 ); + bSizer172->Add( m_panelLogfile, 0, wxALIGN_CENTER_VERTICAL|wxEXPAND, 5 ); bSizer117->Add( bSizer172, 1, wxEXPAND|wxALL, 10 ); @@ -1546,7 +1528,7 @@ BatchDlgGenerated::BatchDlgGenerated( wxWindow* parent, wxWindowID id, const wxS bSizer68->Add( m_buttonLoad, 0, wxALIGN_CENTER_VERTICAL|wxTOP|wxBOTTOM|wxLEFT, 5 ); - m_buttonSave = new wxButton( this, wxID_SAVE, _("Save &As..."), wxDefaultPosition, wxSize( -1,30 ), 0 ); + m_buttonSave = new wxButton( this, wxID_SAVE, _("Save &as..."), wxDefaultPosition, wxSize( -1,30 ), 0 ); m_buttonSave->SetDefault(); m_buttonSave->SetFont( wxFont( 10, 70, 90, 92, false, wxEmptyString ) ); @@ -1575,8 +1557,11 @@ BatchDlgGenerated::BatchDlgGenerated( wxWindow* parent, wxWindowID id, const wxS m_bpButtonSyncConfig->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( BatchDlgGenerated::OnSyncSettings ), NULL, this ); m_bpButtonAddPair->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( BatchDlgGenerated::OnAddFolderPair ), NULL, this ); m_bpButtonRemovePair->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( BatchDlgGenerated::OnRemoveTopFolderPair ), NULL, this ); - m_choiceHandleError->Connect( wxEVT_COMMAND_CHOICE_SELECTED, wxCommandEventHandler( BatchDlgGenerated::OnChangeErrorHandling ), NULL, this ); - m_spinCtrlLogCountMax->Connect( wxEVT_COMMAND_TEXT_UPDATED, wxCommandEventHandler( BatchDlgGenerated::OnChangeMaxLogCountTxt ), NULL, this ); + m_toggleBtnErrorIgnore->Connect( wxEVT_COMMAND_TOGGLEBUTTON_CLICKED, wxCommandEventHandler( BatchDlgGenerated::OnErrorIgnore ), NULL, this ); + m_toggleBtnErrorPopup->Connect( wxEVT_COMMAND_TOGGLEBUTTON_CLICKED, wxCommandEventHandler( BatchDlgGenerated::OnErrorPopup ), NULL, this ); + m_toggleBtnErrorExit->Connect( wxEVT_COMMAND_TOGGLEBUTTON_CLICKED, wxCommandEventHandler( BatchDlgGenerated::OnErrorExit ), NULL, this ); + m_checkBoxGenerateLogfile->Connect( wxEVT_COMMAND_CHECKBOX_CLICKED, wxCommandEventHandler( BatchDlgGenerated::OnToggleGenerateLogfile ), NULL, this ); + m_checkBoxLogfilesLimit->Connect( wxEVT_COMMAND_CHECKBOX_CLICKED, wxCommandEventHandler( BatchDlgGenerated::OnToggleLogfilesLimit ), NULL, this ); m_buttonLoad->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( BatchDlgGenerated::OnLoadBatchJob ), NULL, this ); m_buttonSave->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( BatchDlgGenerated::OnSaveBatchJob ), NULL, this ); m_button6->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( BatchDlgGenerated::OnCancel ), NULL, this ); @@ -1592,8 +1577,11 @@ BatchDlgGenerated::~BatchDlgGenerated() m_bpButtonSyncConfig->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( BatchDlgGenerated::OnSyncSettings ), NULL, this ); m_bpButtonAddPair->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( BatchDlgGenerated::OnAddFolderPair ), NULL, this ); m_bpButtonRemovePair->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( BatchDlgGenerated::OnRemoveTopFolderPair ), NULL, this ); - m_choiceHandleError->Disconnect( wxEVT_COMMAND_CHOICE_SELECTED, wxCommandEventHandler( BatchDlgGenerated::OnChangeErrorHandling ), NULL, this ); - m_spinCtrlLogCountMax->Disconnect( wxEVT_COMMAND_TEXT_UPDATED, wxCommandEventHandler( BatchDlgGenerated::OnChangeMaxLogCountTxt ), NULL, this ); + m_toggleBtnErrorIgnore->Disconnect( wxEVT_COMMAND_TOGGLEBUTTON_CLICKED, wxCommandEventHandler( BatchDlgGenerated::OnErrorIgnore ), NULL, this ); + m_toggleBtnErrorPopup->Disconnect( wxEVT_COMMAND_TOGGLEBUTTON_CLICKED, wxCommandEventHandler( BatchDlgGenerated::OnErrorPopup ), NULL, this ); + m_toggleBtnErrorExit->Disconnect( wxEVT_COMMAND_TOGGLEBUTTON_CLICKED, wxCommandEventHandler( BatchDlgGenerated::OnErrorExit ), NULL, this ); + m_checkBoxGenerateLogfile->Disconnect( wxEVT_COMMAND_CHECKBOX_CLICKED, wxCommandEventHandler( BatchDlgGenerated::OnToggleGenerateLogfile ), NULL, this ); + m_checkBoxLogfilesLimit->Disconnect( wxEVT_COMMAND_CHECKBOX_CLICKED, wxCommandEventHandler( BatchDlgGenerated::OnToggleLogfilesLimit ), NULL, this ); m_buttonLoad->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( BatchDlgGenerated::OnLoadBatchJob ), NULL, this ); m_buttonSave->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( BatchDlgGenerated::OnSaveBatchJob ), NULL, this ); m_button6->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( BatchDlgGenerated::OnCancel ), NULL, this ); @@ -1669,10 +1657,10 @@ BatchFolderPairGenerated::BatchFolderPairGenerated( wxWindow* parent, wxWindowID m_directoryLeft = new FolderHistoryBox( m_panelLeft, wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0, NULL, 0 ); bSizer114->Add( m_directoryLeft, 1, wxALIGN_CENTER_VERTICAL, 5 ); - m_dirPickerLeft = new zen::DirPickerCtrl( m_panelLeft, wxID_ANY, wxEmptyString, _("Select a folder"), wxDefaultPosition, wxDefaultSize, 0 ); - m_dirPickerLeft->SetToolTip( _("Select a folder") ); + m_buttonSelectDirLeft = new wxButton( m_panelLeft, wxID_ANY, _("Browse"), wxDefaultPosition, wxDefaultSize, 0 ); + m_buttonSelectDirLeft->SetToolTip( _("Select a folder") ); - bSizer114->Add( m_dirPickerLeft, 0, wxALIGN_CENTER_VERTICAL, 5 ); + bSizer114->Add( m_buttonSelectDirLeft, 0, wxALIGN_CENTER_VERTICAL, 5 ); m_panelLeft->SetSizer( bSizer114 ); @@ -1687,10 +1675,10 @@ BatchFolderPairGenerated::BatchFolderPairGenerated( wxWindow* parent, wxWindowID m_directoryRight = new FolderHistoryBox( m_panelRight, wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0, NULL, 0 ); bSizer115->Add( m_directoryRight, 1, wxALIGN_CENTER_VERTICAL, 5 ); - m_dirPickerRight = new zen::DirPickerCtrl( m_panelRight, wxID_ANY, wxEmptyString, _("Select a folder"), wxDefaultPosition, wxDefaultSize, 0 ); - m_dirPickerRight->SetToolTip( _("Select a folder") ); + m_buttonSelectDirRight = new wxButton( m_panelRight, wxID_ANY, _("Browse"), wxDefaultPosition, wxDefaultSize, 0 ); + m_buttonSelectDirRight->SetToolTip( _("Select a folder") ); - bSizer115->Add( m_dirPickerRight, 0, wxALIGN_CENTER_VERTICAL, 5 ); + bSizer115->Add( m_buttonSelectDirRight, 0, wxALIGN_CENTER_VERTICAL, 5 ); m_panelRight->SetSizer( bSizer115 ); @@ -1732,6 +1720,131 @@ BatchFolderPairGenerated::~BatchFolderPairGenerated() { } +CmpCfgDlgGenerated::CmpCfgDlgGenerated( wxWindow* parent, wxWindowID id, const wxString& title, const wxPoint& pos, const wxSize& size, long style ) : wxDialog( parent, id, title, pos, size, style ) +{ + this->SetSizeHints( wxDefaultSize, wxDefaultSize ); + + wxBoxSizer* bSizer136; + bSizer136 = new wxBoxSizer( wxVERTICAL ); + + wxBoxSizer* bSizer55; + bSizer55 = new wxBoxSizer( wxVERTICAL ); + + wxStaticBoxSizer* sbSizer6; + sbSizer6 = new wxStaticBoxSizer( new wxStaticBox( this, wxID_ANY, _("Compare by...") ), wxHORIZONTAL ); + + wxFlexGridSizer* fgSizer16; + fgSizer16 = new wxFlexGridSizer( 2, 2, 8, 5 ); + fgSizer16->SetFlexibleDirection( wxBOTH ); + fgSizer16->SetNonFlexibleGrowMode( wxFLEX_GROWMODE_SPECIFIED ); + + m_bitmapByTime = new wxStaticBitmap( this, wxID_ANY, wxNullBitmap, wxDefaultPosition, wxDefaultSize, 0 ); + m_bitmapByTime->SetToolTip( _("Files are found equal if\n - last write time and date\n - file size\nare the same") ); + + fgSizer16->Add( m_bitmapByTime, 0, wxALIGN_CENTER_VERTICAL|wxALIGN_CENTER_HORIZONTAL, 5 ); + + m_toggleBtnTimeSize = new wxToggleButton( this, wxID_ANY, _("File time and size"), wxDefaultPosition, wxSize( -1,40 ), 0 ); + m_toggleBtnTimeSize->SetFont( wxFont( 11, 70, 90, 92, false, wxEmptyString ) ); + m_toggleBtnTimeSize->SetToolTip( _("Files are found equal if\n - last write time and date\n - file size\nare the same") ); + + fgSizer16->Add( m_toggleBtnTimeSize, 0, wxEXPAND|wxALIGN_CENTER_VERTICAL, 5 ); + + m_bitmapByContent = new wxStaticBitmap( this, wxID_ANY, wxNullBitmap, wxDefaultPosition, wxDefaultSize, 0 ); + m_bitmapByContent->SetToolTip( _("Files are found equal if\n - file content\nis the same") ); + + fgSizer16->Add( m_bitmapByContent, 0, wxALIGN_CENTER_VERTICAL|wxALIGN_CENTER_HORIZONTAL, 5 ); + + m_toggleBtnContent = new wxToggleButton( this, wxID_ANY, _("File content"), wxDefaultPosition, wxSize( -1,40 ), 0 ); + m_toggleBtnContent->SetFont( wxFont( 11, 70, 90, 92, false, wxEmptyString ) ); + m_toggleBtnContent->SetToolTip( _("Files are found equal if\n - file content\nis the same") ); + + fgSizer16->Add( m_toggleBtnContent, 0, wxALIGN_CENTER_VERTICAL|wxEXPAND, 5 ); + + + sbSizer6->Add( fgSizer16, 1, wxALIGN_CENTER_VERTICAL|wxEXPAND, 5 ); + + + bSizer55->Add( sbSizer6, 0, wxALIGN_CENTER_VERTICAL|wxEXPAND, 2 ); + + + bSizer55->Add( 0, 4, 0, 0, 5 ); + + wxBoxSizer* bSizer177; + bSizer177 = new wxBoxSizer( wxHORIZONTAL ); + + wxStaticBoxSizer* sbSizer25; + sbSizer25 = new wxStaticBoxSizer( new wxStaticBox( this, wxID_ANY, _("Symbolic Link handling") ), wxVERTICAL ); + + wxArrayString m_choiceHandleSymlinksChoices; + m_choiceHandleSymlinks = new wxChoice( this, wxID_ANY, wxDefaultPosition, wxDefaultSize, m_choiceHandleSymlinksChoices, 0 ); + m_choiceHandleSymlinks->SetSelection( -1 ); + sbSizer25->Add( m_choiceHandleSymlinks, 0, wxALIGN_CENTER_VERTICAL|wxALIGN_CENTER_HORIZONTAL, 5 ); + + + bSizer177->Add( sbSizer25, 1, wxALIGN_CENTER_VERTICAL, 5 ); + + m_bpButtonHelp = new wxBitmapButton( this, wxID_HELP, wxNullBitmap, wxDefaultPosition, wxSize( 40,40 ), wxBU_AUTODRAW ); + m_bpButtonHelp->SetToolTip( _("Help") ); + + bSizer177->Add( m_bpButtonHelp, 0, wxALIGN_CENTER_VERTICAL|wxLEFT, 5 ); + + + bSizer55->Add( bSizer177, 0, wxEXPAND, 5 ); + + wxBoxSizer* bSizer22; + bSizer22 = new wxBoxSizer( wxHORIZONTAL ); + + m_button10 = new wxButton( this, wxID_OK, _("OK"), wxDefaultPosition, wxSize( -1,30 ), 0 ); + m_button10->SetDefault(); + m_button10->SetFont( wxFont( 10, 70, 90, 92, false, wxEmptyString ) ); + + bSizer22->Add( m_button10, 0, wxALIGN_CENTER_VERTICAL|wxTOP|wxBOTTOM|wxLEFT, 5 ); + + m_button6 = new wxButton( this, wxID_CANCEL, _("Cancel"), wxDefaultPosition, wxSize( -1,30 ), 0 ); + m_button6->SetFont( wxFont( 10, 70, 90, 90, false, wxEmptyString ) ); + + bSizer22->Add( m_button6, 0, wxALL|wxALIGN_CENTER_HORIZONTAL|wxALIGN_CENTER_VERTICAL, 5 ); + + + bSizer55->Add( bSizer22, 0, wxALIGN_CENTER_HORIZONTAL, 5 ); + + + bSizer136->Add( bSizer55, 0, wxALIGN_CENTER_VERTICAL|wxALL, 5 ); + + + this->SetSizer( bSizer136 ); + this->Layout(); + bSizer136->Fit( this ); + + this->Centre( wxBOTH ); + + // Connect Events + this->Connect( wxEVT_CLOSE_WINDOW, wxCloseEventHandler( CmpCfgDlgGenerated::OnClose ) ); + m_toggleBtnTimeSize->Connect( wxEVT_LEFT_DCLICK, wxMouseEventHandler( CmpCfgDlgGenerated::OnTimeSizeDouble ), NULL, this ); + m_toggleBtnTimeSize->Connect( wxEVT_COMMAND_TOGGLEBUTTON_CLICKED, wxCommandEventHandler( CmpCfgDlgGenerated::OnTimeSize ), NULL, this ); + m_toggleBtnContent->Connect( wxEVT_LEFT_DCLICK, wxMouseEventHandler( CmpCfgDlgGenerated::OnContentDouble ), NULL, this ); + m_toggleBtnContent->Connect( wxEVT_COMMAND_TOGGLEBUTTON_CLICKED, wxCommandEventHandler( CmpCfgDlgGenerated::OnContent ), NULL, this ); + m_choiceHandleSymlinks->Connect( wxEVT_COMMAND_CHOICE_SELECTED, wxCommandEventHandler( CmpCfgDlgGenerated::OnChangeErrorHandling ), NULL, this ); + m_bpButtonHelp->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( CmpCfgDlgGenerated::OnShowHelp ), NULL, this ); + m_button10->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( CmpCfgDlgGenerated::OnOkay ), NULL, this ); + m_button6->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( CmpCfgDlgGenerated::OnCancel ), NULL, this ); +} + +CmpCfgDlgGenerated::~CmpCfgDlgGenerated() +{ + // Disconnect Events + this->Disconnect( wxEVT_CLOSE_WINDOW, wxCloseEventHandler( CmpCfgDlgGenerated::OnClose ) ); + m_toggleBtnTimeSize->Disconnect( wxEVT_LEFT_DCLICK, wxMouseEventHandler( CmpCfgDlgGenerated::OnTimeSizeDouble ), NULL, this ); + m_toggleBtnTimeSize->Disconnect( wxEVT_COMMAND_TOGGLEBUTTON_CLICKED, wxCommandEventHandler( CmpCfgDlgGenerated::OnTimeSize ), NULL, this ); + m_toggleBtnContent->Disconnect( wxEVT_LEFT_DCLICK, wxMouseEventHandler( CmpCfgDlgGenerated::OnContentDouble ), NULL, this ); + m_toggleBtnContent->Disconnect( wxEVT_COMMAND_TOGGLEBUTTON_CLICKED, wxCommandEventHandler( CmpCfgDlgGenerated::OnContent ), NULL, this ); + m_choiceHandleSymlinks->Disconnect( wxEVT_COMMAND_CHOICE_SELECTED, wxCommandEventHandler( CmpCfgDlgGenerated::OnChangeErrorHandling ), NULL, this ); + m_bpButtonHelp->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( CmpCfgDlgGenerated::OnShowHelp ), NULL, this ); + m_button10->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( CmpCfgDlgGenerated::OnOkay ), NULL, this ); + m_button6->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( CmpCfgDlgGenerated::OnCancel ), NULL, this ); + +} + SyncCfgDlgGenerated::SyncCfgDlgGenerated( wxWindow* parent, wxWindowID id, const wxString& title, const wxPoint& pos, const wxSize& size, long style ) : wxDialog( parent, id, title, pos, size, style ) { this->SetSizeHints( wxDefaultSize, wxDefaultSize ); @@ -1749,62 +1862,41 @@ SyncCfgDlgGenerated::SyncCfgDlgGenerated( wxWindow* parent, wxWindowID id, const sbSizer7 = new wxStaticBoxSizer( new wxStaticBox( this, wxID_ANY, _("Select variant:") ), wxVERTICAL ); wxFlexGridSizer* fgSizer1; - fgSizer1 = new wxFlexGridSizer( 4, 3, 8, 5 ); + fgSizer1 = new wxFlexGridSizer( 4, 2, 8, 5 ); fgSizer1->SetFlexibleDirection( wxHORIZONTAL ); fgSizer1->SetNonFlexibleGrowMode( wxFLEX_GROWMODE_SPECIFIED ); - m_radioBtnAutomatic = new wxRadioButton( this, wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, wxRB_GROUP ); - m_radioBtnAutomatic->SetValue( true ); - m_radioBtnAutomatic->SetFont( wxFont( 11, 70, 90, 92, false, wxEmptyString ) ); - - fgSizer1->Add( m_radioBtnAutomatic, 0, wxALIGN_CENTER_VERTICAL, 5 ); + m_toggleBtnAutomatic = new wxToggleButton( this, wxID_ANY, _("<Automatic>"), wxDefaultPosition, wxDefaultSize, 0 ); + m_toggleBtnAutomatic->SetFont( wxFont( 11, 70, 90, 92, false, wxEmptyString ) ); - m_buttonAutomatic = new wxButton( this, wxID_ANY, _("<Automatic>"), wxDefaultPosition, wxSize( -1,-1 ), 0 ); - m_buttonAutomatic->SetFont( wxFont( 11, 70, 90, 92, false, wxEmptyString ) ); - - fgSizer1->Add( m_buttonAutomatic, 0, wxALIGN_CENTER_VERTICAL|wxEXPAND, 5 ); + fgSizer1->Add( m_toggleBtnAutomatic, 0, wxEXPAND|wxALIGN_CENTER_VERTICAL, 5 ); m_staticTextAutomatic = new wxStaticText( this, wxID_ANY, _("Identify and propagate changes on both sides using a database. Deletions, renaming and conflicts are detected automatically."), wxDefaultPosition, wxDefaultSize, 0 ); m_staticTextAutomatic->Wrap( 410 ); fgSizer1->Add( m_staticTextAutomatic, 0, wxALIGN_CENTER_VERTICAL|wxLEFT, 5 ); - m_radioBtnMirror = new wxRadioButton( this, wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0 ); - m_radioBtnMirror->SetFont( wxFont( 11, 70, 90, 92, false, wxEmptyString ) ); - - fgSizer1->Add( m_radioBtnMirror, 0, wxALIGN_CENTER_VERTICAL, 5 ); + m_toggleBtnMirror = new wxToggleButton( this, wxID_ANY, _("Mirror ->>"), wxDefaultPosition, wxDefaultSize, 0 ); + m_toggleBtnMirror->SetFont( wxFont( 11, 70, 90, 92, false, wxEmptyString ) ); - m_buttonMirror = new wxButton( this, wxID_ANY, _("Mirror ->>"), wxDefaultPosition, wxSize( -1,-1 ), 0 ); - m_buttonMirror->SetFont( wxFont( 11, 70, 90, 92, false, wxEmptyString ) ); - - fgSizer1->Add( m_buttonMirror, 0, wxALIGN_CENTER_VERTICAL|wxEXPAND, 5 ); + fgSizer1->Add( m_toggleBtnMirror, 0, wxALIGN_CENTER_VERTICAL|wxEXPAND, 5 ); m_staticTextMirror = new wxStaticText( this, wxID_ANY, _("Mirror backup of left folder. Right folder is modified to exactly match left folder after synchronization."), wxDefaultPosition, wxDefaultSize, 0 ); m_staticTextMirror->Wrap( 410 ); fgSizer1->Add( m_staticTextMirror, 0, wxLEFT|wxALIGN_CENTER_VERTICAL, 5 ); - m_radioBtnUpdate = new wxRadioButton( this, wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0 ); - m_radioBtnUpdate->SetFont( wxFont( 11, 70, 90, 92, false, wxEmptyString ) ); - - fgSizer1->Add( m_radioBtnUpdate, 0, wxALIGN_CENTER_VERTICAL, 5 ); + m_toggleBtnUpdate = new wxToggleButton( this, wxID_ANY, _("Update ->"), wxDefaultPosition, wxDefaultSize, 0 ); + m_toggleBtnUpdate->SetFont( wxFont( 11, 70, 90, 92, false, wxEmptyString ) ); - m_buttonUpdate = new wxButton( this, wxID_ANY, _("Update ->"), wxDefaultPosition, wxSize( -1,-1 ), 0 ); - m_buttonUpdate->SetFont( wxFont( 11, 70, 90, 92, false, wxEmptyString ) ); - - fgSizer1->Add( m_buttonUpdate, 0, wxALIGN_CENTER_VERTICAL|wxEXPAND, 5 ); + fgSizer1->Add( m_toggleBtnUpdate, 0, wxALIGN_CENTER_VERTICAL|wxEXPAND, 5 ); m_staticTextUpdate = new wxStaticText( this, wxID_ANY, _("Copy new or updated files to right folder."), wxDefaultPosition, wxDefaultSize, 0 ); m_staticTextUpdate->Wrap( 410 ); fgSizer1->Add( m_staticTextUpdate, 0, wxALIGN_CENTER_VERTICAL|wxLEFT, 5 ); - m_radioBtnCustom = new wxRadioButton( this, wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0 ); - m_radioBtnCustom->SetFont( wxFont( 11, 70, 90, 92, false, wxEmptyString ) ); - - fgSizer1->Add( m_radioBtnCustom, 0, wxALIGN_CENTER_VERTICAL, 5 ); + m_toggleBtnCustom = new wxToggleButton( this, wxID_ANY, _("Custom"), wxDefaultPosition, wxDefaultSize, 0 ); + m_toggleBtnCustom->SetFont( wxFont( 11, 70, 90, 92, false, wxEmptyString ) ); - m_buttonCustom = new wxButton( this, wxID_ANY, _("Custom"), wxDefaultPosition, wxSize( -1,-1 ), 0 ); - m_buttonCustom->SetFont( wxFont( 11, 70, 90, 92, false, wxEmptyString ) ); - - fgSizer1->Add( m_buttonCustom, 0, wxALIGN_CENTER_VERTICAL|wxEXPAND, 5 ); + fgSizer1->Add( m_toggleBtnCustom, 0, wxALIGN_CENTER_VERTICAL|wxEXPAND, 5 ); m_staticTextCustom = new wxStaticText( this, wxID_ANY, _("Configure your own synchronization rules."), wxDefaultPosition, wxDefaultSize, 0 ); m_staticTextCustom->Wrap( 410 ); @@ -1819,43 +1911,80 @@ SyncCfgDlgGenerated::SyncCfgDlgGenerated( wxWindow* parent, wxWindowID id, const bSizer29->Add( 0, 5, 1, 0, 5 ); - sbSizerCustDelDir = new wxStaticBoxSizer( new wxStaticBox( this, wxID_ANY, _("Deletion handling") ), wxHORIZONTAL ); + wxStaticBoxSizer* sbSizer27; + sbSizer27 = new wxStaticBoxSizer( new wxStaticBox( this, wxID_ANY, _("Deletion handling") ), wxVERTICAL ); + + wxBoxSizer* bSizer180; + bSizer180 = new wxBoxSizer( wxHORIZONTAL ); + + m_toggleBtnPermanent = new wxToggleButton( this, wxID_ANY, _("Permanent"), wxDefaultPosition, wxDefaultSize, 0 ); + m_toggleBtnPermanent->SetToolTip( _("Delete or overwrite files permanently") ); - wxArrayString m_choiceHandleDeletionChoices; - m_choiceHandleDeletion = new wxChoice( this, wxID_ANY, wxDefaultPosition, wxDefaultSize, m_choiceHandleDeletionChoices, 0 ); - m_choiceHandleDeletion->SetSelection( 0 ); - sbSizerCustDelDir->Add( m_choiceHandleDeletion, 0, wxALIGN_CENTER_VERTICAL|wxRIGHT, 5 ); + bSizer180->Add( m_toggleBtnPermanent, 0, wxRIGHT|wxALIGN_CENTER_VERTICAL, 5 ); - m_panelCustomDeletionDir = new wxPanel( this, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxTAB_TRAVERSAL ); + m_toggleBtnRecycler = new wxToggleButton( this, wxID_ANY, _("Recycle Bin"), wxDefaultPosition, wxDefaultSize, 0 ); + m_toggleBtnRecycler->SetToolTip( _("Use Recycle Bin when deleting or overwriting files") ); + + bSizer180->Add( m_toggleBtnRecycler, 0, wxRIGHT|wxALIGN_CENTER_VERTICAL, 5 ); + + m_toggleBtnVersioning = new wxToggleButton( this, wxID_ANY, _("Versioning"), wxDefaultPosition, wxDefaultSize, 0 ); + m_toggleBtnVersioning->SetToolTip( _("Move time-stamped files into specified folder") ); + + bSizer180->Add( m_toggleBtnVersioning, 0, wxALIGN_CENTER_VERTICAL, 5 ); + + + bSizer180->Add( 0, 0, 1, wxEXPAND, 5 ); + + m_checkBoxVersionsLimit = new wxCheckBox( this, wxID_ANY, _("Limit"), wxDefaultPosition, wxDefaultSize, 0 ); + m_checkBoxVersionsLimit->SetToolTip( _("Limit maximum number of versions per file") ); + + bSizer180->Add( m_checkBoxVersionsLimit, 0, wxALIGN_CENTER_VERTICAL|wxALL, 5 ); + + m_spinCtrlVersionsLimit = new wxSpinCtrl( this, wxID_ANY, wxEmptyString, wxDefaultPosition, wxSize( 50,-1 ), wxSP_ARROW_KEYS, 1, 2000000000, 1 ); + m_spinCtrlVersionsLimit->SetToolTip( _("Limit maximum number of versions per file") ); + + bSizer180->Add( m_spinCtrlVersionsLimit, 0, wxALIGN_CENTER_VERTICAL, 5 ); + + + sbSizer27->Add( bSizer180, 0, wxEXPAND, 5 ); + + m_panelVersioning = new wxPanel( this, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxTAB_TRAVERSAL ); wxBoxSizer* bSizer1151; bSizer1151 = new wxBoxSizer( wxHORIZONTAL ); - m_customDelFolder = new FolderHistoryBox( m_panelCustomDeletionDir, wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0, NULL, 0 ); - bSizer1151->Add( m_customDelFolder, 1, wxALIGN_CENTER_VERTICAL, 5 ); + m_versioningFolder = new FolderHistoryBox( m_panelVersioning, wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0, NULL, 0 ); + bSizer1151->Add( m_versioningFolder, 1, wxALIGN_CENTER_VERTICAL, 5 ); + + m_buttonSelectDirVersioning = new wxButton( m_panelVersioning, wxID_ANY, _("Browse"), wxDefaultPosition, wxDefaultSize, 0 ); + m_buttonSelectDirVersioning->SetToolTip( _("Select a folder") ); - m_dirPickerCustomDelFolder = new zen::DirPickerCtrl( m_panelCustomDeletionDir, wxID_ANY, wxEmptyString, _("Select a folder"), wxDefaultPosition, wxDefaultSize, 0 ); - bSizer1151->Add( m_dirPickerCustomDelFolder, 0, wxALIGN_CENTER_VERTICAL, 5 ); + bSizer1151->Add( m_buttonSelectDirVersioning, 0, wxALIGN_CENTER_VERTICAL, 5 ); - m_panelCustomDeletionDir->SetSizer( bSizer1151 ); - m_panelCustomDeletionDir->Layout(); - bSizer1151->Fit( m_panelCustomDeletionDir ); - sbSizerCustDelDir->Add( m_panelCustomDeletionDir, 1, wxALIGN_CENTER_VERTICAL, 5 ); + m_panelVersioning->SetSizer( bSizer1151 ); + m_panelVersioning->Layout(); + bSizer1151->Fit( m_panelVersioning ); + sbSizer27->Add( m_panelVersioning, 0, wxALIGN_CENTER_VERTICAL|wxEXPAND|wxTOP, 5 ); - bSizer29->Add( sbSizerCustDelDir, 0, wxEXPAND, 5 ); + bSizer29->Add( sbSizer27, 0, wxEXPAND, 5 ); bSizer201 = new wxBoxSizer( wxHORIZONTAL ); sbSizerErrorHandling = new wxStaticBoxSizer( new wxStaticBox( this, wxID_ANY, _("Error handling") ), wxHORIZONTAL ); - wxArrayString m_choiceHandleErrorChoices; - m_choiceHandleError = new wxChoice( this, wxID_ANY, wxDefaultPosition, wxDefaultSize, m_choiceHandleErrorChoices, 0 ); - m_choiceHandleError->SetSelection( 0 ); - sbSizerErrorHandling->Add( m_choiceHandleError, 0, wxALIGN_CENTER_VERTICAL, 5 ); + m_toggleBtnErrorIgnore = new wxToggleButton( this, wxID_ANY, _("Ignore"), wxDefaultPosition, wxDefaultSize, 0 ); + m_toggleBtnErrorIgnore->SetToolTip( _("Hide all error and warning messages") ); + sbSizerErrorHandling->Add( m_toggleBtnErrorIgnore, 0, wxRIGHT|wxALIGN_CENTER_VERTICAL, 5 ); - bSizer201->Add( sbSizerErrorHandling, 0, wxRIGHT|wxALIGN_CENTER_VERTICAL, 10 ); + m_toggleBtnErrorPopup = new wxToggleButton( this, wxID_ANY, _("Pop-up"), wxDefaultPosition, wxDefaultSize, 0 ); + m_toggleBtnErrorPopup->SetToolTip( _("Show pop-up on errors or warnings") ); + + sbSizerErrorHandling->Add( m_toggleBtnErrorPopup, 0, wxALIGN_CENTER_VERTICAL, 5 ); + + + bSizer201->Add( sbSizerErrorHandling, 0, wxRIGHT|wxALIGN_CENTER_VERTICAL|wxEXPAND, 5 ); sbSizerExecFinished = new wxStaticBoxSizer( new wxStaticBox( this, wxID_ANY, _("On completion:") ), wxHORIZONTAL ); @@ -1863,7 +1992,7 @@ SyncCfgDlgGenerated::SyncCfgDlgGenerated( wxWindow* parent, wxWindowID id, const sbSizerExecFinished->Add( m_comboBoxExecFinished, 1, wxALIGN_CENTER_VERTICAL, 5 ); - bSizer201->Add( sbSizerExecFinished, 1, wxALIGN_CENTER_VERTICAL, 5 ); + bSizer201->Add( sbSizerExecFinished, 1, wxALIGN_CENTER_VERTICAL|wxEXPAND, 5 ); bSizer29->Add( bSizer201, 0, wxEXPAND|wxTOP, 5 ); @@ -1885,26 +2014,23 @@ SyncCfgDlgGenerated::SyncCfgDlgGenerated( wxWindow* parent, wxWindowID id, const sbSizerSyncDirections = new wxBoxSizer( wxVERTICAL ); - wxGridSizer* gSizer3; - gSizer3 = new wxGridSizer( 1, 2, 0, 5 ); + wxBoxSizer* bSizer1801; + bSizer1801 = new wxBoxSizer( wxHORIZONTAL ); - m_staticText21 = new wxStaticText( this, wxID_ANY, _("Category"), wxDefaultPosition, wxDefaultSize, 0 ); + m_staticText21 = new wxStaticText( this, wxID_ANY, _("Category"), wxDefaultPosition, wxDefaultSize, wxALIGN_CENTRE ); m_staticText21->Wrap( -1 ); m_staticText21->SetFont( wxFont( 8, 70, 90, 92, false, wxEmptyString ) ); - gSizer3->Add( m_staticText21, 0, wxALIGN_CENTER_HORIZONTAL|wxALIGN_CENTER_VERTICAL, 5 ); + bSizer1801->Add( m_staticText21, 1, wxALIGN_CENTER_HORIZONTAL|wxALIGN_CENTER_VERTICAL, 5 ); - m_staticText31 = new wxStaticText( this, wxID_ANY, _("Action"), wxDefaultPosition, wxDefaultSize, 0 ); + m_staticText31 = new wxStaticText( this, wxID_ANY, _("Action"), wxDefaultPosition, wxDefaultSize, wxALIGN_CENTRE ); m_staticText31->Wrap( -1 ); m_staticText31->SetFont( wxFont( 8, 70, 90, 92, false, wxEmptyString ) ); - gSizer3->Add( m_staticText31, 0, wxALIGN_CENTER_VERTICAL|wxALIGN_CENTER_HORIZONTAL, 5 ); + bSizer1801->Add( m_staticText31, 1, wxALIGN_CENTER_VERTICAL|wxALIGN_CENTER_HORIZONTAL, 5 ); - sbSizerSyncDirections->Add( gSizer3, 0, wxBOTTOM|wxEXPAND, 5 ); - - wxBoxSizer* bSizer121; - bSizer121 = new wxBoxSizer( wxVERTICAL ); + sbSizerSyncDirections->Add( bSizer1801, 0, wxEXPAND, 5 ); bSizerLeftOnly = new wxBoxSizer( wxHORIZONTAL ); @@ -1920,7 +2046,7 @@ SyncCfgDlgGenerated::SyncCfgDlgGenerated( wxWindow* parent, wxWindowID id, const bSizerLeftOnly->Add( m_bpButtonLeftOnly, 0, wxALIGN_CENTER_HORIZONTAL|wxALIGN_CENTER_VERTICAL, 5 ); - bSizer121->Add( bSizerLeftOnly, 0, wxALIGN_CENTER_HORIZONTAL, 5 ); + sbSizerSyncDirections->Add( bSizerLeftOnly, 0, wxALIGN_CENTER_HORIZONTAL, 5 ); bSizerRightOnly = new wxBoxSizer( wxHORIZONTAL ); @@ -1936,7 +2062,7 @@ SyncCfgDlgGenerated::SyncCfgDlgGenerated( wxWindow* parent, wxWindowID id, const bSizerRightOnly->Add( m_bpButtonRightOnly, 0, wxALIGN_CENTER_HORIZONTAL|wxALIGN_CENTER_VERTICAL, 5 ); - bSizer121->Add( bSizerRightOnly, 0, wxALIGN_CENTER_HORIZONTAL, 5 ); + sbSizerSyncDirections->Add( bSizerRightOnly, 0, wxALIGN_CENTER_HORIZONTAL, 5 ); bSizerLeftNewer = new wxBoxSizer( wxHORIZONTAL ); @@ -1952,7 +2078,7 @@ SyncCfgDlgGenerated::SyncCfgDlgGenerated( wxWindow* parent, wxWindowID id, const bSizerLeftNewer->Add( m_bpButtonLeftNewer, 0, wxALIGN_CENTER_HORIZONTAL|wxALIGN_CENTER_VERTICAL, 5 ); - bSizer121->Add( bSizerLeftNewer, 0, wxALIGN_CENTER_HORIZONTAL, 5 ); + sbSizerSyncDirections->Add( bSizerLeftNewer, 0, wxALIGN_CENTER_HORIZONTAL, 5 ); bSizerRightNewer = new wxBoxSizer( wxHORIZONTAL ); @@ -1968,7 +2094,7 @@ SyncCfgDlgGenerated::SyncCfgDlgGenerated( wxWindow* parent, wxWindowID id, const bSizerRightNewer->Add( m_bpButtonRightNewer, 0, wxALIGN_CENTER_HORIZONTAL|wxALIGN_CENTER_VERTICAL, 5 ); - bSizer121->Add( bSizerRightNewer, 0, wxALIGN_CENTER_HORIZONTAL, 5 ); + sbSizerSyncDirections->Add( bSizerRightNewer, 0, wxALIGN_CENTER_HORIZONTAL, 5 ); bSizerDifferent = new wxBoxSizer( wxHORIZONTAL ); @@ -1984,7 +2110,7 @@ SyncCfgDlgGenerated::SyncCfgDlgGenerated( wxWindow* parent, wxWindowID id, const bSizerDifferent->Add( m_bpButtonDifferent, 0, wxALIGN_CENTER_HORIZONTAL|wxALIGN_CENTER_VERTICAL, 5 ); - bSizer121->Add( bSizerDifferent, 0, wxALIGN_CENTER_HORIZONTAL, 5 ); + sbSizerSyncDirections->Add( bSizerDifferent, 0, wxALIGN_CENTER_HORIZONTAL, 5 ); bSizerConflict = new wxBoxSizer( wxHORIZONTAL ); @@ -2000,10 +2126,7 @@ SyncCfgDlgGenerated::SyncCfgDlgGenerated( wxWindow* parent, wxWindowID id, const bSizerConflict->Add( m_bpButtonConflict, 0, wxALIGN_CENTER_HORIZONTAL|wxALIGN_CENTER_VERTICAL, 5 ); - bSizer121->Add( bSizerConflict, 0, wxALIGN_CENTER_HORIZONTAL, 5 ); - - - sbSizerSyncDirections->Add( bSizer121, 0, wxALIGN_CENTER_HORIZONTAL, 5 ); + sbSizerSyncDirections->Add( bSizerConflict, 0, wxALIGN_CENTER_HORIZONTAL, 5 ); sbSizer2453245->Add( sbSizerSyncDirections, 0, wxEXPAND, 5 ); @@ -2043,20 +2166,20 @@ SyncCfgDlgGenerated::SyncCfgDlgGenerated( wxWindow* parent, wxWindowID id, const // Connect Events this->Connect( wxEVT_CLOSE_WINDOW, wxCloseEventHandler( SyncCfgDlgGenerated::OnClose ) ); - m_radioBtnAutomatic->Connect( wxEVT_COMMAND_RADIOBUTTON_SELECTED, wxCommandEventHandler( SyncCfgDlgGenerated::OnSyncAutomatic ), NULL, this ); - m_buttonAutomatic->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( SyncCfgDlgGenerated::OnSyncAutomatic ), NULL, this ); - m_buttonAutomatic->Connect( wxEVT_LEFT_DCLICK, wxMouseEventHandler( SyncCfgDlgGenerated::OnSyncAutomaticDouble ), NULL, this ); - m_radioBtnMirror->Connect( wxEVT_COMMAND_RADIOBUTTON_SELECTED, wxCommandEventHandler( SyncCfgDlgGenerated::OnSyncMirror ), NULL, this ); - m_buttonMirror->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( SyncCfgDlgGenerated::OnSyncMirror ), NULL, this ); - m_buttonMirror->Connect( wxEVT_LEFT_DCLICK, wxMouseEventHandler( SyncCfgDlgGenerated::OnSyncMirrorDouble ), NULL, this ); - m_radioBtnUpdate->Connect( wxEVT_COMMAND_RADIOBUTTON_SELECTED, wxCommandEventHandler( SyncCfgDlgGenerated::OnSyncUpdate ), NULL, this ); - m_buttonUpdate->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( SyncCfgDlgGenerated::OnSyncUpdate ), NULL, this ); - m_buttonUpdate->Connect( wxEVT_LEFT_DCLICK, wxMouseEventHandler( SyncCfgDlgGenerated::OnSyncUpdateDouble ), NULL, this ); - m_radioBtnCustom->Connect( wxEVT_COMMAND_RADIOBUTTON_SELECTED, wxCommandEventHandler( SyncCfgDlgGenerated::OnSyncCustom ), NULL, this ); - m_buttonCustom->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( SyncCfgDlgGenerated::OnSyncCustom ), NULL, this ); - m_buttonCustom->Connect( wxEVT_LEFT_DCLICK, wxMouseEventHandler( SyncCfgDlgGenerated::OnSyncCustomDouble ), NULL, this ); - m_choiceHandleDeletion->Connect( wxEVT_COMMAND_CHOICE_SELECTED, wxCommandEventHandler( SyncCfgDlgGenerated::OnChangeDeletionHandling ), NULL, this ); - m_choiceHandleError->Connect( wxEVT_COMMAND_CHOICE_SELECTED, wxCommandEventHandler( SyncCfgDlgGenerated::OnChangeErrorHandling ), NULL, this ); + m_toggleBtnAutomatic->Connect( wxEVT_LEFT_DCLICK, wxMouseEventHandler( SyncCfgDlgGenerated::OnSyncAutomaticDouble ), NULL, this ); + m_toggleBtnAutomatic->Connect( wxEVT_COMMAND_TOGGLEBUTTON_CLICKED, wxCommandEventHandler( SyncCfgDlgGenerated::OnSyncAutomatic ), NULL, this ); + m_toggleBtnMirror->Connect( wxEVT_LEFT_DCLICK, wxMouseEventHandler( SyncCfgDlgGenerated::OnSyncMirrorDouble ), NULL, this ); + m_toggleBtnMirror->Connect( wxEVT_COMMAND_TOGGLEBUTTON_CLICKED, wxCommandEventHandler( SyncCfgDlgGenerated::OnSyncMirror ), NULL, this ); + m_toggleBtnUpdate->Connect( wxEVT_LEFT_DCLICK, wxMouseEventHandler( SyncCfgDlgGenerated::OnSyncUpdateDouble ), NULL, this ); + m_toggleBtnUpdate->Connect( wxEVT_COMMAND_TOGGLEBUTTON_CLICKED, wxCommandEventHandler( SyncCfgDlgGenerated::OnSyncUpdate ), NULL, this ); + m_toggleBtnCustom->Connect( wxEVT_LEFT_DCLICK, wxMouseEventHandler( SyncCfgDlgGenerated::OnSyncCustomDouble ), NULL, this ); + m_toggleBtnCustom->Connect( wxEVT_COMMAND_TOGGLEBUTTON_CLICKED, wxCommandEventHandler( SyncCfgDlgGenerated::OnSyncCustom ), NULL, this ); + m_toggleBtnPermanent->Connect( wxEVT_COMMAND_TOGGLEBUTTON_CLICKED, wxCommandEventHandler( SyncCfgDlgGenerated::OnDeletionPermanent ), NULL, this ); + m_toggleBtnRecycler->Connect( wxEVT_COMMAND_TOGGLEBUTTON_CLICKED, wxCommandEventHandler( SyncCfgDlgGenerated::OnDeletionRecycler ), NULL, this ); + m_toggleBtnVersioning->Connect( wxEVT_COMMAND_TOGGLEBUTTON_CLICKED, wxCommandEventHandler( SyncCfgDlgGenerated::OnDeletionVersioning ), NULL, this ); + m_checkBoxVersionsLimit->Connect( wxEVT_COMMAND_CHECKBOX_CLICKED, wxCommandEventHandler( SyncCfgDlgGenerated::OnToggleVersionsLimit ), NULL, this ); + m_toggleBtnErrorIgnore->Connect( wxEVT_COMMAND_TOGGLEBUTTON_CLICKED, wxCommandEventHandler( SyncCfgDlgGenerated::OnErrorIgnore ), NULL, this ); + m_toggleBtnErrorPopup->Connect( wxEVT_COMMAND_TOGGLEBUTTON_CLICKED, wxCommandEventHandler( SyncCfgDlgGenerated::OnErrorPopup ), NULL, this ); m_bpButtonLeftOnly->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( SyncCfgDlgGenerated::OnExLeftSideOnly ), NULL, this ); m_bpButtonRightOnly->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( SyncCfgDlgGenerated::OnExRightSideOnly ), NULL, this ); m_bpButtonLeftNewer->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( SyncCfgDlgGenerated::OnLeftNewer ), NULL, this ); @@ -2071,20 +2194,20 @@ SyncCfgDlgGenerated::~SyncCfgDlgGenerated() { // Disconnect Events this->Disconnect( wxEVT_CLOSE_WINDOW, wxCloseEventHandler( SyncCfgDlgGenerated::OnClose ) ); - m_radioBtnAutomatic->Disconnect( wxEVT_COMMAND_RADIOBUTTON_SELECTED, wxCommandEventHandler( SyncCfgDlgGenerated::OnSyncAutomatic ), NULL, this ); - m_buttonAutomatic->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( SyncCfgDlgGenerated::OnSyncAutomatic ), NULL, this ); - m_buttonAutomatic->Disconnect( wxEVT_LEFT_DCLICK, wxMouseEventHandler( SyncCfgDlgGenerated::OnSyncAutomaticDouble ), NULL, this ); - m_radioBtnMirror->Disconnect( wxEVT_COMMAND_RADIOBUTTON_SELECTED, wxCommandEventHandler( SyncCfgDlgGenerated::OnSyncMirror ), NULL, this ); - m_buttonMirror->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( SyncCfgDlgGenerated::OnSyncMirror ), NULL, this ); - m_buttonMirror->Disconnect( wxEVT_LEFT_DCLICK, wxMouseEventHandler( SyncCfgDlgGenerated::OnSyncMirrorDouble ), NULL, this ); - m_radioBtnUpdate->Disconnect( wxEVT_COMMAND_RADIOBUTTON_SELECTED, wxCommandEventHandler( SyncCfgDlgGenerated::OnSyncUpdate ), NULL, this ); - m_buttonUpdate->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( SyncCfgDlgGenerated::OnSyncUpdate ), NULL, this ); - m_buttonUpdate->Disconnect( wxEVT_LEFT_DCLICK, wxMouseEventHandler( SyncCfgDlgGenerated::OnSyncUpdateDouble ), NULL, this ); - m_radioBtnCustom->Disconnect( wxEVT_COMMAND_RADIOBUTTON_SELECTED, wxCommandEventHandler( SyncCfgDlgGenerated::OnSyncCustom ), NULL, this ); - m_buttonCustom->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( SyncCfgDlgGenerated::OnSyncCustom ), NULL, this ); - m_buttonCustom->Disconnect( wxEVT_LEFT_DCLICK, wxMouseEventHandler( SyncCfgDlgGenerated::OnSyncCustomDouble ), NULL, this ); - m_choiceHandleDeletion->Disconnect( wxEVT_COMMAND_CHOICE_SELECTED, wxCommandEventHandler( SyncCfgDlgGenerated::OnChangeDeletionHandling ), NULL, this ); - m_choiceHandleError->Disconnect( wxEVT_COMMAND_CHOICE_SELECTED, wxCommandEventHandler( SyncCfgDlgGenerated::OnChangeErrorHandling ), NULL, this ); + m_toggleBtnAutomatic->Disconnect( wxEVT_LEFT_DCLICK, wxMouseEventHandler( SyncCfgDlgGenerated::OnSyncAutomaticDouble ), NULL, this ); + m_toggleBtnAutomatic->Disconnect( wxEVT_COMMAND_TOGGLEBUTTON_CLICKED, wxCommandEventHandler( SyncCfgDlgGenerated::OnSyncAutomatic ), NULL, this ); + m_toggleBtnMirror->Disconnect( wxEVT_LEFT_DCLICK, wxMouseEventHandler( SyncCfgDlgGenerated::OnSyncMirrorDouble ), NULL, this ); + m_toggleBtnMirror->Disconnect( wxEVT_COMMAND_TOGGLEBUTTON_CLICKED, wxCommandEventHandler( SyncCfgDlgGenerated::OnSyncMirror ), NULL, this ); + m_toggleBtnUpdate->Disconnect( wxEVT_LEFT_DCLICK, wxMouseEventHandler( SyncCfgDlgGenerated::OnSyncUpdateDouble ), NULL, this ); + m_toggleBtnUpdate->Disconnect( wxEVT_COMMAND_TOGGLEBUTTON_CLICKED, wxCommandEventHandler( SyncCfgDlgGenerated::OnSyncUpdate ), NULL, this ); + m_toggleBtnCustom->Disconnect( wxEVT_LEFT_DCLICK, wxMouseEventHandler( SyncCfgDlgGenerated::OnSyncCustomDouble ), NULL, this ); + m_toggleBtnCustom->Disconnect( wxEVT_COMMAND_TOGGLEBUTTON_CLICKED, wxCommandEventHandler( SyncCfgDlgGenerated::OnSyncCustom ), NULL, this ); + m_toggleBtnPermanent->Disconnect( wxEVT_COMMAND_TOGGLEBUTTON_CLICKED, wxCommandEventHandler( SyncCfgDlgGenerated::OnDeletionPermanent ), NULL, this ); + m_toggleBtnRecycler->Disconnect( wxEVT_COMMAND_TOGGLEBUTTON_CLICKED, wxCommandEventHandler( SyncCfgDlgGenerated::OnDeletionRecycler ), NULL, this ); + m_toggleBtnVersioning->Disconnect( wxEVT_COMMAND_TOGGLEBUTTON_CLICKED, wxCommandEventHandler( SyncCfgDlgGenerated::OnDeletionVersioning ), NULL, this ); + m_checkBoxVersionsLimit->Disconnect( wxEVT_COMMAND_CHECKBOX_CLICKED, wxCommandEventHandler( SyncCfgDlgGenerated::OnToggleVersionsLimit ), NULL, this ); + m_toggleBtnErrorIgnore->Disconnect( wxEVT_COMMAND_TOGGLEBUTTON_CLICKED, wxCommandEventHandler( SyncCfgDlgGenerated::OnErrorIgnore ), NULL, this ); + m_toggleBtnErrorPopup->Disconnect( wxEVT_COMMAND_TOGGLEBUTTON_CLICKED, wxCommandEventHandler( SyncCfgDlgGenerated::OnErrorPopup ), NULL, this ); m_bpButtonLeftOnly->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( SyncCfgDlgGenerated::OnExLeftSideOnly ), NULL, this ); m_bpButtonRightOnly->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( SyncCfgDlgGenerated::OnExRightSideOnly ), NULL, this ); m_bpButtonLeftNewer->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( SyncCfgDlgGenerated::OnLeftNewer ), NULL, this ); @@ -2096,146 +2219,6 @@ SyncCfgDlgGenerated::~SyncCfgDlgGenerated() } -CmpCfgDlgGenerated::CmpCfgDlgGenerated( wxWindow* parent, wxWindowID id, const wxString& title, const wxPoint& pos, const wxSize& size, long style ) : wxDialog( parent, id, title, pos, size, style ) -{ - this->SetSizeHints( wxDefaultSize, wxDefaultSize ); - - wxBoxSizer* bSizer136; - bSizer136 = new wxBoxSizer( wxVERTICAL ); - - wxBoxSizer* bSizer55; - bSizer55 = new wxBoxSizer( wxVERTICAL ); - - wxStaticBoxSizer* sbSizer6; - sbSizer6 = new wxStaticBoxSizer( new wxStaticBox( this, wxID_ANY, _("Compare by...") ), wxHORIZONTAL ); - - wxFlexGridSizer* fgSizer16; - fgSizer16 = new wxFlexGridSizer( 2, 3, 0, 0 ); - fgSizer16->SetFlexibleDirection( wxBOTH ); - fgSizer16->SetNonFlexibleGrowMode( wxFLEX_GROWMODE_SPECIFIED ); - - m_radioBtnSizeDate = new wxRadioButton( this, wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, wxRB_GROUP ); - m_radioBtnSizeDate->SetValue( true ); - m_radioBtnSizeDate->SetToolTip( _("Files are found equal if\n - last write time and date\n - file size\nare the same") ); - - fgSizer16->Add( m_radioBtnSizeDate, 0, wxALIGN_CENTER_VERTICAL, 5 ); - - m_bitmapByTime = new wxStaticBitmap( this, wxID_ANY, wxNullBitmap, wxDefaultPosition, wxDefaultSize, 0 ); - m_bitmapByTime->SetToolTip( _("Files are found equal if\n - last write time and date\n - file size\nare the same") ); - - fgSizer16->Add( m_bitmapByTime, 0, wxALIGN_CENTER_VERTICAL|wxALIGN_CENTER_HORIZONTAL, 5 ); - - m_buttonTimeSize = new wxButton( this, wxID_ANY, _("File time and size"), wxDefaultPosition, wxSize( -1,42 ), 0 ); - m_buttonTimeSize->SetFont( wxFont( 11, 70, 90, 92, false, wxEmptyString ) ); - m_buttonTimeSize->SetToolTip( _("Files are found equal if\n - last write time and date\n - file size\nare the same") ); - - fgSizer16->Add( m_buttonTimeSize, 0, wxALIGN_CENTER_VERTICAL|wxEXPAND|wxALL, 5 ); - - m_radioBtnContent = new wxRadioButton( this, wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0 ); - m_radioBtnContent->SetToolTip( _("Files are found equal if\n - file content\nis the same") ); - - fgSizer16->Add( m_radioBtnContent, 0, wxALIGN_CENTER_VERTICAL, 5 ); - - m_bitmapByContent = new wxStaticBitmap( this, wxID_ANY, wxNullBitmap, wxDefaultPosition, wxDefaultSize, 0 ); - m_bitmapByContent->SetToolTip( _("Files are found equal if\n - file content\nis the same") ); - - fgSizer16->Add( m_bitmapByContent, 0, wxALIGN_CENTER_VERTICAL|wxALIGN_CENTER_HORIZONTAL, 5 ); - - m_buttonContent = new wxButton( this, wxID_ANY, _("File content"), wxDefaultPosition, wxSize( -1,42 ), 0 ); - m_buttonContent->SetFont( wxFont( 11, 70, 90, 92, false, wxEmptyString ) ); - m_buttonContent->SetToolTip( _("Files are found equal if\n - file content\nis the same") ); - - fgSizer16->Add( m_buttonContent, 0, wxALIGN_CENTER_VERTICAL|wxEXPAND|wxBOTTOM|wxRIGHT|wxLEFT, 5 ); - - - sbSizer6->Add( fgSizer16, 1, wxALIGN_CENTER_VERTICAL|wxEXPAND, 5 ); - - - bSizer55->Add( sbSizer6, 0, wxALIGN_CENTER_VERTICAL|wxEXPAND, 2 ); - - - bSizer55->Add( 0, 4, 0, 0, 5 ); - - wxBoxSizer* bSizer177; - bSizer177 = new wxBoxSizer( wxHORIZONTAL ); - - wxStaticBoxSizer* sbSizer25; - sbSizer25 = new wxStaticBoxSizer( new wxStaticBox( this, wxID_ANY, _("Symbolic Link handling") ), wxVERTICAL ); - - wxArrayString m_choiceHandleSymlinksChoices; - m_choiceHandleSymlinks = new wxChoice( this, wxID_ANY, wxDefaultPosition, wxDefaultSize, m_choiceHandleSymlinksChoices, 0 ); - m_choiceHandleSymlinks->SetSelection( -1 ); - sbSizer25->Add( m_choiceHandleSymlinks, 0, wxALIGN_CENTER_VERTICAL|wxALIGN_CENTER_HORIZONTAL, 5 ); - - - bSizer177->Add( sbSizer25, 1, wxALIGN_CENTER_VERTICAL, 5 ); - - m_bpButtonHelp = new wxBitmapButton( this, wxID_HELP, wxNullBitmap, wxDefaultPosition, wxSize( 40,40 ), wxBU_AUTODRAW ); - m_bpButtonHelp->SetToolTip( _("Help") ); - - bSizer177->Add( m_bpButtonHelp, 0, wxALIGN_CENTER_VERTICAL|wxLEFT, 5 ); - - - bSizer55->Add( bSizer177, 0, wxEXPAND, 5 ); - - wxBoxSizer* bSizer22; - bSizer22 = new wxBoxSizer( wxHORIZONTAL ); - - m_button10 = new wxButton( this, wxID_OK, _("OK"), wxDefaultPosition, wxSize( -1,30 ), 0 ); - m_button10->SetDefault(); - m_button10->SetFont( wxFont( 10, 70, 90, 92, false, wxEmptyString ) ); - - bSizer22->Add( m_button10, 0, wxALIGN_CENTER_VERTICAL|wxTOP|wxBOTTOM|wxLEFT, 5 ); - - m_button6 = new wxButton( this, wxID_CANCEL, _("Cancel"), wxDefaultPosition, wxSize( -1,30 ), 0 ); - m_button6->SetFont( wxFont( 10, 70, 90, 90, false, wxEmptyString ) ); - - bSizer22->Add( m_button6, 0, wxALL|wxALIGN_CENTER_HORIZONTAL|wxALIGN_CENTER_VERTICAL, 5 ); - - - bSizer55->Add( bSizer22, 0, wxALIGN_CENTER_HORIZONTAL, 5 ); - - - bSizer136->Add( bSizer55, 0, wxALIGN_CENTER_VERTICAL|wxALL, 5 ); - - - this->SetSizer( bSizer136 ); - this->Layout(); - bSizer136->Fit( this ); - - this->Centre( wxBOTH ); - - // Connect Events - this->Connect( wxEVT_CLOSE_WINDOW, wxCloseEventHandler( CmpCfgDlgGenerated::OnClose ) ); - m_radioBtnSizeDate->Connect( wxEVT_COMMAND_RADIOBUTTON_SELECTED, wxCommandEventHandler( CmpCfgDlgGenerated::OnTimeSize ), NULL, this ); - m_buttonTimeSize->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( CmpCfgDlgGenerated::OnTimeSize ), NULL, this ); - m_buttonTimeSize->Connect( wxEVT_LEFT_DCLICK, wxMouseEventHandler( CmpCfgDlgGenerated::OnTimeSizeDouble ), NULL, this ); - m_radioBtnContent->Connect( wxEVT_COMMAND_RADIOBUTTON_SELECTED, wxCommandEventHandler( CmpCfgDlgGenerated::OnContent ), NULL, this ); - m_buttonContent->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( CmpCfgDlgGenerated::OnContent ), NULL, this ); - m_buttonContent->Connect( wxEVT_LEFT_DCLICK, wxMouseEventHandler( CmpCfgDlgGenerated::OnContentDouble ), NULL, this ); - m_choiceHandleSymlinks->Connect( wxEVT_COMMAND_CHOICE_SELECTED, wxCommandEventHandler( CmpCfgDlgGenerated::OnChangeErrorHandling ), NULL, this ); - m_bpButtonHelp->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( CmpCfgDlgGenerated::OnShowHelp ), NULL, this ); - m_button10->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( CmpCfgDlgGenerated::OnOkay ), NULL, this ); - m_button6->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( CmpCfgDlgGenerated::OnCancel ), NULL, this ); -} - -CmpCfgDlgGenerated::~CmpCfgDlgGenerated() -{ - // Disconnect Events - this->Disconnect( wxEVT_CLOSE_WINDOW, wxCloseEventHandler( CmpCfgDlgGenerated::OnClose ) ); - m_radioBtnSizeDate->Disconnect( wxEVT_COMMAND_RADIOBUTTON_SELECTED, wxCommandEventHandler( CmpCfgDlgGenerated::OnTimeSize ), NULL, this ); - m_buttonTimeSize->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( CmpCfgDlgGenerated::OnTimeSize ), NULL, this ); - m_buttonTimeSize->Disconnect( wxEVT_LEFT_DCLICK, wxMouseEventHandler( CmpCfgDlgGenerated::OnTimeSizeDouble ), NULL, this ); - m_radioBtnContent->Disconnect( wxEVT_COMMAND_RADIOBUTTON_SELECTED, wxCommandEventHandler( CmpCfgDlgGenerated::OnContent ), NULL, this ); - m_buttonContent->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( CmpCfgDlgGenerated::OnContent ), NULL, this ); - m_buttonContent->Disconnect( wxEVT_LEFT_DCLICK, wxMouseEventHandler( CmpCfgDlgGenerated::OnContentDouble ), NULL, this ); - m_choiceHandleSymlinks->Disconnect( wxEVT_COMMAND_CHOICE_SELECTED, wxCommandEventHandler( CmpCfgDlgGenerated::OnChangeErrorHandling ), NULL, this ); - m_bpButtonHelp->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( CmpCfgDlgGenerated::OnShowHelp ), NULL, this ); - m_button10->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( CmpCfgDlgGenerated::OnOkay ), NULL, this ); - m_button6->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( CmpCfgDlgGenerated::OnCancel ), NULL, this ); - -} - SyncStatusDlgGenerated::SyncStatusDlgGenerated( wxWindow* parent, wxWindowID id, const wxString& title, const wxPoint& pos, const wxSize& size, long style ) : wxFrame( parent, id, title, pos, size, style ) { this->SetSizeHints( wxSize( 470,260 ), wxDefaultSize ); @@ -2669,10 +2652,10 @@ AboutDlgGenerated::AboutDlgGenerated( wxWindow* parent, wxWindowID id, const wxS bSizerCodeInfo->Add( bSizer167, 0, wxALIGN_CENTER_HORIZONTAL, 5 ); - m_hyperlink21 = new wxHyperlinkCtrl( m_panel33, wxID_ANY, _("- ZenJu -"), wxT("mailto:zhnmju123@gmx.de"), wxDefaultPosition, wxDefaultSize, wxHL_DEFAULT_STYLE ); + m_hyperlink21 = new wxHyperlinkCtrl( m_panel33, wxID_ANY, _("- ZenJu -"), wxT("mailto:zenju@gmx.de"), wxDefaultPosition, wxDefaultSize, wxHL_DEFAULT_STYLE ); m_hyperlink21->SetFont( wxFont( 10, 74, 93, 92, false, wxT("Segoe Print") ) ); m_hyperlink21->SetBackgroundColour( wxSystemSettings::GetColour( wxSYS_COLOUR_WINDOW ) ); - m_hyperlink21->SetToolTip( _("zhnmju123@gmx.de") ); + m_hyperlink21->SetToolTip( _("zenju@gmx.de") ); bSizerCodeInfo->Add( m_hyperlink21, 0, wxALIGN_CENTER_HORIZONTAL, 5 ); @@ -2704,10 +2687,10 @@ AboutDlgGenerated::AboutDlgGenerated( wxWindow* parent, wxWindowID id, const wxS bSizer178->Add( m_staticText83, 0, wxALL, 5 ); - m_hyperlink3 = new wxHyperlinkCtrl( m_panel39, wxID_ANY, _("Donate with PayPal"), wxT("https://www.paypal.com/cgi-bin/webscr?cmd=_donations&business=zhnmju123@gmx.de&lc=US¤cy_code=EUR"), wxDefaultPosition, wxDefaultSize, wxHL_DEFAULT_STYLE ); - m_hyperlink3->SetFont( wxFont( 10, 70, 90, 92, true, wxEmptyString ) ); + m_hyperlink3 = new wxHyperlinkCtrl( m_panel39, wxID_ANY, _("Donate with PayPal"), wxT("https://www.paypal.com/cgi-bin/webscr?cmd=_donations&business=zenju@gmx.de&no_shipping=1&lc=US¤cy_code=EUR"), wxDefaultPosition, wxDefaultSize, wxHL_DEFAULT_STYLE ); + m_hyperlink3->SetFont( wxFont( 11, 70, 90, 92, true, wxEmptyString ) ); m_hyperlink3->SetBackgroundColour( wxColour( 221, 221, 255 ) ); - m_hyperlink3->SetToolTip( _("https://www.paypal.com/cgi-bin/webscr?cmd=_donations&business=zhnmju123@gmx.de&lc=US¤cy_code=EUR") ); + m_hyperlink3->SetToolTip( _("https://www.paypal.com/cgi-bin/webscr?cmd=_donations&business=zenju@gmx.de&no_shipping=1&lc=US¤cy_code=EUR") ); bSizer178->Add( m_hyperlink3, 0, wxALIGN_CENTER_VERTICAL|wxALIGN_RIGHT|wxBOTTOM|wxRIGHT|wxLEFT, 5 ); @@ -2738,7 +2721,7 @@ AboutDlgGenerated::AboutDlgGenerated( wxWindow* parent, wxWindowID id, const wxS bSizerTranslators = new wxBoxSizer( wxVERTICAL ); - m_staticText54 = new wxStaticText( m_scrolledWindowTranslators, wxID_ANY, _("Big thanks for localizing FreeFileSync goes out to:"), wxDefaultPosition, wxDefaultSize, 0 ); + m_staticText54 = new wxStaticText( m_scrolledWindowTranslators, wxID_ANY, _("Many thanks for localization:"), wxDefaultPosition, wxDefaultSize, 0 ); m_staticText54->Wrap( -1 ); m_staticText54->SetFont( wxFont( wxNORMAL_FONT->GetPointSize(), 70, 90, 92, false, wxEmptyString ) ); @@ -2792,9 +2775,9 @@ AboutDlgGenerated::AboutDlgGenerated( wxWindow* parent, wxWindowID id, const wxS bSizer1711->Add( 0, 0, 1, wxEXPAND, 5 ); - m_hyperlink2 = new wxHyperlinkCtrl( this, wxID_ANY, _("Email"), wxT("mailto:zhnmju123@gmx.de"), wxDefaultPosition, wxDefaultSize, wxHL_DEFAULT_STYLE ); + m_hyperlink2 = new wxHyperlinkCtrl( this, wxID_ANY, _("Email"), wxT("mailto:zenju@gmx.de"), wxDefaultPosition, wxDefaultSize, wxHL_DEFAULT_STYLE ); m_hyperlink2->SetFont( wxFont( 10, 70, 90, 92, true, wxEmptyString ) ); - m_hyperlink2->SetToolTip( _("zhnmju123@gmx.de") ); + m_hyperlink2->SetToolTip( _("zenju@gmx.de") ); bSizer1711->Add( m_hyperlink2, 0, wxALIGN_CENTER_VERTICAL, 5 ); @@ -3002,19 +2985,16 @@ DeleteDlgGenerated::DeleteDlgGenerated( wxWindow* parent, wxWindowID id, const w wxBoxSizer* bSizer99; bSizer99 = new wxBoxSizer( wxVERTICAL ); - m_checkBoxUseRecycler = new wxCheckBox( m_panel36, wxID_ANY, _("Use Recycle Bin"), wxDefaultPosition, wxDefaultSize, 0 ); - bSizer99->Add( m_checkBoxUseRecycler, 0, wxALIGN_CENTER_VERTICAL|wxBOTTOM, 5 ); + m_checkBoxUseRecycler = new wxCheckBox( m_panel36, wxID_ANY, _("Recycle Bin"), wxDefaultPosition, wxDefaultSize, 0 ); + bSizer99->Add( m_checkBoxUseRecycler, 0, wxALIGN_CENTER_VERTICAL|wxBOTTOM|wxEXPAND, 5 ); m_checkBoxDeleteBothSides = new wxCheckBox( m_panel36, wxID_ANY, _("Delete on both sides"), wxDefaultPosition, wxDefaultSize, 0 ); m_checkBoxDeleteBothSides->SetToolTip( _("Delete on both sides even if the file is selected on one side only") ); - bSizer99->Add( m_checkBoxDeleteBothSides, 0, wxALIGN_CENTER_VERTICAL, 5 ); - - - bSizer179->Add( bSizer99, 0, wxALIGN_CENTER_HORIZONTAL|wxALL|wxALIGN_CENTER_VERTICAL, 5 ); + bSizer99->Add( m_checkBoxDeleteBothSides, 0, wxALIGN_CENTER_VERTICAL|wxEXPAND, 5 ); - bSizer179->Add( 0, 0, 1, wxEXPAND, 5 ); + bSizer179->Add( bSizer99, 1, wxALIGN_CENTER_HORIZONTAL|wxALL|wxALIGN_CENTER_VERTICAL, 5 ); wxBoxSizer* bSizer25; bSizer25 = new wxBoxSizer( wxHORIZONTAL ); @@ -3640,7 +3620,7 @@ SyncPreviewDlgGenerated::SyncPreviewDlgGenerated( wxWindow* parent, wxWindowID i wxBoxSizer* bSizer142; bSizer142 = new wxBoxSizer( wxHORIZONTAL ); - m_checkBoxDontShowAgain = new wxCheckBox( this, wxID_ANY, _("Do not show this dialog again"), wxDefaultPosition, wxDefaultSize, 0 ); + m_checkBoxDontShowAgain = new wxCheckBox( this, wxID_ANY, _("Don't show this dialog again"), wxDefaultPosition, wxDefaultSize, 0 ); bSizer142->Add( m_checkBoxDontShowAgain, 0, wxALIGN_CENTER_HORIZONTAL|wxALL|wxALIGN_CENTER_VERTICAL, 5 ); diff --git a/ui/gui_generated.h b/ui/gui_generated.h index 29ef091d..42f33064 100644 --- a/ui/gui_generated.h +++ b/ui/gui_generated.h @@ -14,7 +14,6 @@ #include "wx_form_build_hide_warnings.h" #include "../wx+/button.h" #include "folder_history_box.h" -#include "../wx+/dir_picker.h" #include "../wx+/grid.h" #include "triple_splitter.h" #include "../wx+/toggle_button.h" @@ -35,7 +34,6 @@ #include <wx/bmpbuttn.h> #include <wx/panel.h> #include <wx/combobox.h> -#include <wx/filepicker.h> #include <wx/scrolwin.h> #include <wx/statbmp.h> #include <wx/statline.h> @@ -45,11 +43,11 @@ #include <wx/textctrl.h> #include <wx/gauge.h> #include <wx/statbox.h> -#include <wx/choice.h> +#include <wx/tglbtn.h> #include <wx/spinctrl.h> #include <wx/notebook.h> #include <wx/dialog.h> -#include <wx/radiobut.h> +#include <wx/choice.h> #include <wx/animate.h> #include <wx/listbook.h> #include <wx/listctrl.h> @@ -100,9 +98,11 @@ protected: wxPanel* m_panelDirectoryPairs; wxStaticText* m_staticTextFinalPathLeft; wxBitmapButton* m_bpButtonAddPair; + wxButton* m_buttonSelectDirLeft; wxPanel* m_panelTopMiddle; wxBitmapButton* m_bpButtonSwapSides; wxStaticText* m_staticTextFinalPathRight; + wxButton* m_buttonSelectDirRight; wxScrolledWindow* m_scrolledWindowFolderPairs; wxBoxSizer* bSizerAddFolderPairs; zen::Grid* m_gridNavi; @@ -136,7 +136,7 @@ protected: wxListBox* m_listBoxHistory; wxPanel* m_panelFilter; wxBitmapButton* m_bpButtonFilter; - wxCheckBox* m_checkBoxHideFilt; + wxCheckBox* m_checkBoxShowExcluded; wxPanel* m_panelStatistics; wxBoxSizer* bSizer1801; wxStaticBitmap* m_bitmapCreateLeft; @@ -189,12 +189,11 @@ protected: virtual void OnSyncSettings( wxCommandEvent& event ) { event.Skip(); } virtual void OnAddFolderPair( wxCommandEvent& event ) { event.Skip(); } virtual void OnRemoveTopFolderPair( wxCommandEvent& event ) { event.Skip(); } - virtual void OnDirSelected( wxFileDirPickerEvent& event ) { event.Skip(); } virtual void OnSwapSides( wxCommandEvent& event ) { event.Skip(); } virtual void OnCfgHistoryKeyEvent( wxKeyEvent& event ) { event.Skip(); } virtual void OnLoadFromHistory( wxCommandEvent& event ) { event.Skip(); } virtual void OnConfigureFilter( wxCommandEvent& event ) { event.Skip(); } - virtual void OnHideFilteredButton( wxCommandEvent& event ) { event.Skip(); } + virtual void OnShowExcluded( wxCommandEvent& event ) { event.Skip(); } virtual void OnSyncCreateLeft( wxCommandEvent& event ) { event.Skip(); } virtual void OnSyncDirLeft( wxCommandEvent& event ) { event.Skip(); } virtual void OnSyncDeleteLeft( wxCommandEvent& event ) { event.Skip(); } @@ -215,13 +214,11 @@ public: wxPanel* m_panelTopLeft; wxBitmapButton* m_bpButtonRemovePair; FolderHistoryBox* m_directoryLeft; - zen::DirPickerCtrl* m_dirPickerLeft; wxBitmapButton* m_bpButtonAltCompCfg; wxBitmapButton* m_bpButtonLocalFilter; wxBitmapButton* m_bpButtonAltSyncCfg; wxPanel* m_panelTopRight; FolderHistoryBox* m_directoryRight; - zen::DirPickerCtrl* m_dirPickerRight; wxBoxSizer* bSizerStatistics; wxBoxSizer* bSizerData; @@ -239,19 +236,19 @@ class FolderPairGenerated : public wxPanel private: protected: + wxButton* m_buttonSelectDirLeft; + wxButton* m_buttonSelectDirRight; public: wxPanel* m_panelLeft; wxBitmapButton* m_bpButtonRemovePair; FolderHistoryBox* m_directoryLeft; - zen::DirPickerCtrl* m_dirPickerLeft; wxPanel* m_panel20; wxBitmapButton* m_bpButtonAltCompCfg; wxBitmapButton* m_bpButtonLocalFilter; wxBitmapButton* m_bpButtonAltSyncCfg; wxPanel* m_panelRight; FolderHistoryBox* m_directoryRight; - zen::DirPickerCtrl* m_dirPickerRight; FolderPairGenerated( wxWindow* parent, wxWindowID id = wxID_ANY, const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxSize( -1,-1 ), long style = wxTAB_TRAVERSAL ); ~FolderPairGenerated(); @@ -316,17 +313,22 @@ protected: wxPanel* m_panelMainPair; wxStaticText* m_staticText532; wxStaticText* m_staticText5411; + wxButton* m_buttonSelectDirLeft; + wxButton* m_buttonSelectDirRight; wxBoxSizer* bSizerAddFolderPairs; wxPanel* m_panelBatchSettings; + wxStaticBoxSizer* sbSizerErrorHandling; + wxToggleButton* m_toggleBtnErrorIgnore; + wxToggleButton* m_toggleBtnErrorPopup; + wxToggleButton* m_toggleBtnErrorExit; + wxStaticBoxSizer* sbSizerExecFinished; + ExecFinishedBox* m_comboBoxExecFinished; wxCheckBox* m_checkBoxShowProgress; - wxStaticText* m_staticText961; - wxChoice* m_choiceHandleError; - wxStaticBoxSizer* sbSizerLogfileDir; - wxStaticText* m_staticText96; - wxSpinCtrl* m_spinCtrlLogCountMax; + wxCheckBox* m_checkBoxGenerateLogfile; wxPanel* m_panelLogfile; - wxStaticText* m_staticText94; - zen::DirPickerCtrl* m_dirPickerLogfileDir; + wxButton* m_buttonSelectLogfileDir; + wxCheckBox* m_checkBoxLogfilesLimit; + wxSpinCtrl* m_spinCtrlLogfileLimit; wxButton* m_buttonLoad; wxButton* m_buttonSave; wxButton* m_button6; @@ -339,8 +341,11 @@ protected: virtual void OnSyncSettings( wxCommandEvent& event ) { event.Skip(); } virtual void OnAddFolderPair( wxCommandEvent& event ) { event.Skip(); } virtual void OnRemoveTopFolderPair( wxCommandEvent& event ) { event.Skip(); } - virtual void OnChangeErrorHandling( wxCommandEvent& event ) { event.Skip(); } - virtual void OnChangeMaxLogCountTxt( wxCommandEvent& event ) { event.Skip(); } + virtual void OnErrorIgnore( wxCommandEvent& event ) { event.Skip(); } + virtual void OnErrorPopup( wxCommandEvent& event ) { event.Skip(); } + virtual void OnErrorExit( wxCommandEvent& event ) { event.Skip(); } + virtual void OnToggleGenerateLogfile( wxCommandEvent& event ) { event.Skip(); } + virtual void OnToggleLogfilesLimit( wxCommandEvent& event ) { event.Skip(); } virtual void OnLoadBatchJob( wxCommandEvent& event ) { event.Skip(); } virtual void OnSaveBatchJob( wxCommandEvent& event ) { event.Skip(); } virtual void OnCancel( wxCommandEvent& event ) { event.Skip(); } @@ -352,10 +357,8 @@ public: wxBitmapButton* m_bpButtonRemovePair; wxPanel* m_panelLeft; FolderHistoryBox* m_directoryLeft; - zen::DirPickerCtrl* m_dirPickerLeft; wxPanel* m_panelRight; FolderHistoryBox* m_directoryRight; - zen::DirPickerCtrl* m_dirPickerRight; wxBitmapButton* m_bpButtonAltCompCfg; wxBitmapButton* m_bpButtonLocalFilter; wxBitmapButton* m_bpButtonAltSyncCfg; @@ -378,14 +381,14 @@ protected: wxStaticText* m_staticText53; wxStaticText* m_staticText541; wxPanel* m_panelLeft; + wxButton* m_buttonSelectDirLeft; wxPanel* m_panelRight; + wxButton* m_buttonSelectDirRight; public: wxBitmapButton* m_bpButtonRemovePair; FolderHistoryBox* m_directoryLeft; - zen::DirPickerCtrl* m_dirPickerLeft; FolderHistoryBox* m_directoryRight; - zen::DirPickerCtrl* m_dirPickerRight; wxBitmapButton* m_bpButtonAltCompCfg; wxBitmapButton* m_bpButtonLocalFilter; wxBitmapButton* m_bpButtonAltSyncCfg; @@ -396,6 +399,42 @@ public: }; /////////////////////////////////////////////////////////////////////////////// +/// Class CmpCfgDlgGenerated +/////////////////////////////////////////////////////////////////////////////// +class CmpCfgDlgGenerated : public wxDialog +{ +private: + +protected: + wxStaticBitmap* m_bitmapByTime; + wxToggleButton* m_toggleBtnTimeSize; + wxStaticBitmap* m_bitmapByContent; + wxToggleButton* m_toggleBtnContent; + wxChoice* m_choiceHandleSymlinks; + wxBitmapButton* m_bpButtonHelp; + wxButton* m_button10; + wxButton* m_button6; + + // Virtual event handlers, overide them in your derived class + virtual void OnClose( wxCloseEvent& event ) { event.Skip(); } + virtual void OnTimeSizeDouble( wxMouseEvent& event ) { event.Skip(); } + virtual void OnTimeSize( wxCommandEvent& event ) { event.Skip(); } + virtual void OnContentDouble( wxMouseEvent& event ) { event.Skip(); } + virtual void OnContent( wxCommandEvent& event ) { event.Skip(); } + virtual void OnChangeErrorHandling( wxCommandEvent& event ) { event.Skip(); } + virtual void OnShowHelp( wxCommandEvent& event ) { event.Skip(); } + virtual void OnOkay( wxCommandEvent& event ) { event.Skip(); } + virtual void OnCancel( wxCommandEvent& event ) { event.Skip(); } + + +public: + + CmpCfgDlgGenerated( wxWindow* parent, wxWindowID id = wxID_ANY, const wxString& title = _("Comparison settings"), const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxDefaultSize, long style = wxDEFAULT_DIALOG_STYLE ); + ~CmpCfgDlgGenerated(); + +}; + +/////////////////////////////////////////////////////////////////////////////// /// Class SyncCfgDlgGenerated /////////////////////////////////////////////////////////////////////////////// class SyncCfgDlgGenerated : public wxDialog @@ -403,26 +442,26 @@ class SyncCfgDlgGenerated : public wxDialog private: protected: - wxRadioButton* m_radioBtnAutomatic; - wxButton* m_buttonAutomatic; + wxToggleButton* m_toggleBtnAutomatic; wxStaticText* m_staticTextAutomatic; - wxRadioButton* m_radioBtnMirror; - wxButton* m_buttonMirror; + wxToggleButton* m_toggleBtnMirror; wxStaticText* m_staticTextMirror; - wxRadioButton* m_radioBtnUpdate; - wxButton* m_buttonUpdate; + wxToggleButton* m_toggleBtnUpdate; wxStaticText* m_staticTextUpdate; - wxRadioButton* m_radioBtnCustom; - wxButton* m_buttonCustom; + wxToggleButton* m_toggleBtnCustom; wxStaticText* m_staticTextCustom; - wxStaticBoxSizer* sbSizerCustDelDir; - wxChoice* m_choiceHandleDeletion; - wxPanel* m_panelCustomDeletionDir; - FolderHistoryBox* m_customDelFolder; - zen::DirPickerCtrl* m_dirPickerCustomDelFolder; + wxToggleButton* m_toggleBtnPermanent; + wxToggleButton* m_toggleBtnRecycler; + wxToggleButton* m_toggleBtnVersioning; + wxCheckBox* m_checkBoxVersionsLimit; + wxSpinCtrl* m_spinCtrlVersionsLimit; + wxPanel* m_panelVersioning; + FolderHistoryBox* m_versioningFolder; + wxButton* m_buttonSelectDirVersioning; wxBoxSizer* bSizer201; wxStaticBoxSizer* sbSizerErrorHandling; - wxChoice* m_choiceHandleError; + wxToggleButton* m_toggleBtnErrorIgnore; + wxToggleButton* m_toggleBtnErrorPopup; wxStaticBoxSizer* sbSizerExecFinished; ExecFinishedBox* m_comboBoxExecFinished; wxStaticBitmap* m_bitmapDatabase; @@ -452,16 +491,20 @@ protected: // Virtual event handlers, overide them in your derived class virtual void OnClose( wxCloseEvent& event ) { event.Skip(); } - virtual void OnSyncAutomatic( wxCommandEvent& event ) { event.Skip(); } virtual void OnSyncAutomaticDouble( wxMouseEvent& event ) { event.Skip(); } - virtual void OnSyncMirror( wxCommandEvent& event ) { event.Skip(); } + virtual void OnSyncAutomatic( wxCommandEvent& event ) { event.Skip(); } virtual void OnSyncMirrorDouble( wxMouseEvent& event ) { event.Skip(); } - virtual void OnSyncUpdate( wxCommandEvent& event ) { event.Skip(); } + virtual void OnSyncMirror( wxCommandEvent& event ) { event.Skip(); } virtual void OnSyncUpdateDouble( wxMouseEvent& event ) { event.Skip(); } - virtual void OnSyncCustom( wxCommandEvent& event ) { event.Skip(); } + virtual void OnSyncUpdate( wxCommandEvent& event ) { event.Skip(); } virtual void OnSyncCustomDouble( wxMouseEvent& event ) { event.Skip(); } - virtual void OnChangeDeletionHandling( wxCommandEvent& event ) { event.Skip(); } - virtual void OnChangeErrorHandling( wxCommandEvent& event ) { event.Skip(); } + virtual void OnSyncCustom( wxCommandEvent& event ) { event.Skip(); } + virtual void OnDeletionPermanent( wxCommandEvent& event ) { event.Skip(); } + virtual void OnDeletionRecycler( wxCommandEvent& event ) { event.Skip(); } + virtual void OnDeletionVersioning( wxCommandEvent& event ) { event.Skip(); } + virtual void OnToggleVersionsLimit( wxCommandEvent& event ) { event.Skip(); } + virtual void OnErrorIgnore( wxCommandEvent& event ) { event.Skip(); } + virtual void OnErrorPopup( wxCommandEvent& event ) { event.Skip(); } virtual void OnExLeftSideOnly( wxCommandEvent& event ) { event.Skip(); } virtual void OnExRightSideOnly( wxCommandEvent& event ) { event.Skip(); } virtual void OnLeftNewer( wxCommandEvent& event ) { event.Skip(); } @@ -480,44 +523,6 @@ public: }; /////////////////////////////////////////////////////////////////////////////// -/// Class CmpCfgDlgGenerated -/////////////////////////////////////////////////////////////////////////////// -class CmpCfgDlgGenerated : public wxDialog -{ -private: - -protected: - wxRadioButton* m_radioBtnSizeDate; - wxStaticBitmap* m_bitmapByTime; - wxButton* m_buttonTimeSize; - wxRadioButton* m_radioBtnContent; - wxStaticBitmap* m_bitmapByContent; - wxButton* m_buttonContent; - wxChoice* m_choiceHandleSymlinks; - wxBitmapButton* m_bpButtonHelp; - wxButton* m_button10; - wxButton* m_button6; - - // Virtual event handlers, overide them in your derived class - virtual void OnClose( wxCloseEvent& event ) { event.Skip(); } - virtual void OnTimeSize( wxCommandEvent& event ) { event.Skip(); } - virtual void OnTimeSizeDouble( wxMouseEvent& event ) { event.Skip(); } - virtual void OnContent( wxCommandEvent& event ) { event.Skip(); } - virtual void OnContentDouble( wxMouseEvent& event ) { event.Skip(); } - virtual void OnChangeErrorHandling( wxCommandEvent& event ) { event.Skip(); } - virtual void OnShowHelp( wxCommandEvent& event ) { event.Skip(); } - virtual void OnOkay( wxCommandEvent& event ) { event.Skip(); } - virtual void OnCancel( wxCommandEvent& event ) { event.Skip(); } - - -public: - - CmpCfgDlgGenerated( wxWindow* parent, wxWindowID id = wxID_ANY, const wxString& title = _("Comparison settings"), const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxDefaultSize, long style = wxDEFAULT_DIALOG_STYLE ); - ~CmpCfgDlgGenerated(); - -}; - -/////////////////////////////////////////////////////////////////////////////// /// Class SyncStatusDlgGenerated /////////////////////////////////////////////////////////////////////////////// class SyncStatusDlgGenerated : public wxFrame diff --git a/ui/gui_status_handler.cpp b/ui/gui_status_handler.cpp index b25e4249..54dd7b40 100644 --- a/ui/gui_status_handler.cpp +++ b/ui/gui_status_handler.cpp @@ -1,7 +1,7 @@ // ************************************************************************** // * 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 (zhnmju123 AT gmx DOT de) - All Rights Reserved * +// * Copyright (C) ZenJu (zenju AT gmx DOT de) - All Rights Reserved * // ************************************************************************** #include "gui_status_handler.h" @@ -11,6 +11,7 @@ #include "main_dlg.h" #include "exec_finished_box.h" #include "../lib/generate_logfile.h" +#include "../lib/resolve_path.h" using namespace zen; using namespace xmlAccess; @@ -236,7 +237,10 @@ SyncStatusHandler::~SyncStatusHandler() if (isCloseProgressDlgCommand(finalCommand)) showFinalResults = false; //take precedence over current visibility status else if (!finalCommand.empty()) - shellExecute(finalCommand); + { + auto cmdexp = utfCvrtTo<wxString>(expandMacros(utfCvrtTo<Zstring>(finalCommand))); + shellExecute(cmdexp); + } } //notify to syncStatusFrame that current process has ended diff --git a/ui/gui_status_handler.h b/ui/gui_status_handler.h index 0bda9923..3cc0a6bf 100644 --- a/ui/gui_status_handler.h +++ b/ui/gui_status_handler.h @@ -1,7 +1,7 @@ // ************************************************************************** // * 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 (zhnmju123 AT gmx DOT de) - All Rights Reserved * +// * Copyright (C) ZenJu (zenju AT gmx DOT de) - All Rights Reserved * // ************************************************************************** #ifndef GUISTATUSHANDLER_H_INCLUDED diff --git a/ui/main_dlg.cpp b/ui/main_dlg.cpp index 7681cde2..894b0b11 100644 --- a/ui/main_dlg.cpp +++ b/ui/main_dlg.cpp @@ -1,7 +1,7 @@ // ************************************************************************** // * 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 (zhnmju123 AT gmx DOT de) - All Rights Reserved * +// * Copyright (C) ZenJu (zenju AT gmx DOT de) - All Rights Reserved * // ************************************************************************** #include "main_dlg.h" @@ -16,10 +16,10 @@ #include <wx/display.h> #include <wx/app.h> #include <wx/dcmemory.h> +#include <wx/filedlg.h> #include <wx+/context_menu.h> #include "folder_history_box.h" #include <wx+/button.h> -#include <wx+/dir_picker.h> #include "../comparison.h" #include "../synchronization.h" #include "../algorithm.h" @@ -62,11 +62,12 @@ using namespace std::rel_ops; namespace { -struct wxClientDataString : public wxClientData //we need a wxClientData derived class to tell wxWidgets to take object ownership! +struct wxClientHistoryData: public wxClientData //we need a wxClientData derived class to tell wxWidgets to take object ownership! { - wxClientDataString(const wxString& name) : name_(name) {} + wxClientHistoryData(const wxString& cfgFile, int lastUseIndex) : cfgFile_(cfgFile), lastUseIndex_(lastUseIndex) {} - wxString name_; + wxString cfgFile_; + int lastUseIndex_; //support sorting history by last usage, the higher the index the more recent the usage }; IconBuffer::IconSize convert(xmlAccess::FileIconSize isize) @@ -92,12 +93,11 @@ public: DirectoryNameMainImpl(MainDialog& mainDlg, wxWindow& dropWindow1, Grid& dropGrid, - wxDirPickerCtrl& dirPicker, + wxButton& dirSelectButton, FolderHistoryBox& dirName, wxStaticText& staticText) : - DirectoryName(dropWindow1, dirPicker, dirName, &staticText, &dropGrid.getMainWin()), - mainDlg_(mainDlg), - dropGrid_(dropGrid) {} + DirectoryName(dropWindow1, dirSelectButton, dirName, &staticText, &dropGrid.getMainWin()), + mainDlg_(mainDlg) {} virtual bool acceptDrop(const std::vector<wxString>& droppedFiles, const wxPoint& clientPos, const wxWindow& wnd) { @@ -117,7 +117,7 @@ public: break; } - mainDlg_.clearGrid(); + //mainDlg_.clearGrid(); return true; } @@ -126,7 +126,6 @@ private: DirectoryNameMainImpl& operator=(const DirectoryNameMainImpl&); MainDialog& mainDlg_; - Grid& dropGrid_; }; //------------------------------------------------------------------ @@ -194,8 +193,12 @@ public: DirectoryPair(wxWindow* parent, MainDialog& mainDialog) : FolderPairGenerated(parent), FolderPairCallback<FolderPairGenerated>(static_cast<FolderPairGenerated&>(*this), mainDialog), //pass FolderPairGenerated part... - dirNameLeft (*m_panelLeft, *m_dirPickerLeft, *m_directoryLeft), - dirNameRight(*m_panelRight, *m_dirPickerRight, *m_directoryRight) {} + dirNameLeft (*m_panelLeft, *m_buttonSelectDirLeft, *m_directoryLeft), + dirNameRight(*m_panelRight, *m_buttonSelectDirRight, *m_directoryRight) + { + dirNameLeft .Connect(EVENT_ON_DIR_SELECTED, wxCommandEventHandler(MainDialog::OnDirSelected), nullptr, &mainDialog); + dirNameRight.Connect(EVENT_ON_DIR_SELECTED, wxCommandEventHandler(MainDialog::OnDirSelected), nullptr, &mainDialog); + } void setValues(const wxString& leftDir, const wxString& rightDir, @@ -227,15 +230,19 @@ public: dirNameLeft(mainDialog, *mainDialog.m_panelTopLeft, *mainDialog.m_gridMainL, - *mainDialog.m_dirPickerLeft, + *mainDialog.m_buttonSelectDirLeft, *mainDialog.m_directoryLeft, *mainDialog.m_staticTextFinalPathLeft), dirNameRight(mainDialog, *mainDialog.m_panelTopRight, *mainDialog.m_gridMainR, - *mainDialog.m_dirPickerRight, + *mainDialog.m_buttonSelectDirRight, *mainDialog.m_directoryRight, - *mainDialog.m_staticTextFinalPathRight) {} + *mainDialog.m_staticTextFinalPathRight) + { + dirNameLeft .Connect(EVENT_ON_DIR_SELECTED, wxCommandEventHandler(MainDialog::OnDirSelected), nullptr, &mainDialog); + dirNameRight.Connect(EVENT_ON_DIR_SELECTED, wxCommandEventHandler(MainDialog::OnDirSelected), nullptr, &mainDialog); + } void setValues(const wxString& leftDir, const wxString& rightDir, @@ -493,7 +500,7 @@ void MainDialog::init(const xmlAccess::XmlGuiConfig& guiCfg, wxAuiPaneInfo().Name(wxT("Panel3")).CenterPane().PaneBorder(false)); auiMgr.AddPane(m_gridNavi, - wxAuiPaneInfo().Name(L"Panel10").Left().Layer(3).Caption(_("Overview")).MinSize(350, m_gridNavi->GetSize().GetHeight())); //MinSize(): just default size, see comment below + wxAuiPaneInfo().Name(L"Panel10").Left().Layer(3).Caption(_("Overview")).MinSize(230, m_gridNavi->GetSize().GetHeight())); //MinSize(): just default size, see comment below auiMgr.AddPane(m_panelConfig, wxAuiPaneInfo().Name(wxT("Panel4")).Layer(4).Bottom().Row(1).Position(0).Caption(_("Configuration")).MinSize(m_listBoxHistory->GetSize().GetWidth(), m_panelConfig->GetSize().GetHeight())); @@ -664,7 +671,7 @@ void MainDialog::init(const xmlAccess::XmlGuiConfig& guiCfg, //Connect(wxEVT_MOVE, wxSizeEventHandler(MainDialog::OnResize), nullptr, this); //calculate witdh of folder pair manually (if scrollbars are visible) - m_panelTopLeft->Connect(wxEVT_SIZE, wxEventHandler(MainDialog::OnResizeFolderPairs), nullptr, this); + m_panelTopLeft->Connect(wxEVT_SIZE, wxEventHandler(MainDialog::OnResizeLeftFolderWidth), nullptr, this); //dynamically change sizer direction depending on size m_panelConfig ->Connect(wxEVT_SIZE, wxEventHandler(MainDialog::OnResizeConfigPanel), nullptr, this); @@ -688,7 +695,7 @@ void MainDialog::init(const xmlAccess::XmlGuiConfig& guiCfg, //asynchronous call to wxWindow::Layout(): fix superfluous frame on right and bottom when FFS is started in fullscreen mode Connect(wxEVT_IDLE, wxIdleEventHandler(MainDialog::OnLayoutWindowAsync), nullptr, this); wxCommandEvent evtDummy; //call once before OnLayoutWindowAsync() - OnResizeFolderPairs(evtDummy); // + OnResizeLeftFolderWidth(evtDummy); // //---------------------------------------------------------------------------------------------------------------------------------------------------------------- //some convenience: if FFS is started with a *.ffs_gui file as commandline parameter AND all directories contained exist, comparison shall be started right away @@ -771,10 +778,14 @@ void MainDialog::setGlobalCfgOnInit(const xmlAccess::XmlGlobalSettings& globalSe treeDataView->setSortDirection(globalSettings.gui.naviLastSortColumn, globalSettings.gui.naviLastSortAscending); + //-------------------------------------------------------------------------------- //load list of last used configuration files std::vector<wxString> cfgFileNames = globalSettings.gui.cfgFileHistory; - cfgFileNames.push_back(lastRunConfigName()); //make sure <Last session> is always part of history list + std::reverse(cfgFileNames.begin(), cfgFileNames.end()); //list is stored with last used files first in xml, however addFileToCfgHistory() needs them last!!! + + cfgFileNames.push_back(lastRunConfigName()); //make sure <Last session> is always part of history list (if existing) addFileToCfgHistory(cfgFileNames); + //-------------------------------------------------------------------------------- //load list of last used folders *folderHistoryLeft = FolderHistory(globalSettings.gui.folderHistoryLeft, globalSettings.gui.folderHistMax); @@ -794,8 +805,12 @@ void MainDialog::setGlobalCfgOnInit(const xmlAccess::XmlGlobalSettings& globalSe auiMgr.LoadPerspective(globalSettings.gui.guiPerspectiveLast); //restore original captions - for (CaptionNameMapping::const_iterator i = captionNameMap.begin(); i != captionNameMap.end(); ++i) - auiMgr.GetPane(i->second).Caption(i->first); + for (auto iter = captionNameMap.begin(); iter != captionNameMap.end(); ++iter) + auiMgr.GetPane(iter->second).Caption(iter->first); + + //if MainDialog::onQueryEndSession() is called while comparison is active, this panel is saved and restored as "visible" + auiMgr.GetPane(compareStatus->getAsWindow()).Hide(); + auiMgr.Update(); } @@ -809,18 +824,6 @@ xmlAccess::XmlGlobalSettings MainDialog::getGlobalCfgBeforeExit() globalSettings.programLanguage = getLanguage(); - //write global settings to (global) variable stored in application instance - if (IsIconized()) //we need to (reliably) retrieve non-iconized, non-maximized size and position - Iconize(false); - - globalSettings.gui.isMaximized = IsMaximized(); //evaluate AFTER uniconizing! - - if (IsMaximized()) - Maximize(false); - - globalSettings.gui.dlgSize = GetSize(); - globalSettings.gui.dlgPos = GetPosition(); - //retrieve column attributes globalSettings.gui.columnAttribLeft = gridview::convertConfig(m_gridMainL->getColumnConfig()); globalSettings.gui.columnAttribRight = gridview::convertConfig(m_gridMainR->getColumnConfig()); @@ -833,13 +836,24 @@ xmlAccess::XmlGlobalSettings MainDialog::getGlobalCfgBeforeExit() globalSettings.gui.naviLastSortColumn = sortInfo.first; globalSettings.gui.naviLastSortAscending = sortInfo.second; + //-------------------------------------------------------------------------------- //write list of last used configuration files - std::vector<wxString> cfgFileHistory; + typedef std::pair<wxString, int> HistItem; //(cfg-file/last use index) + std::vector<HistItem> historyDetail; for (unsigned int i = 0; i < m_listBoxHistory->GetCount(); ++i) - if (auto clientString = dynamic_cast<wxClientDataString*>(m_listBoxHistory->GetClientObject(i))) - cfgFileHistory.push_back(clientString->name_); + if (auto clientString = dynamic_cast<const wxClientHistoryData*>(m_listBoxHistory->GetClientObject(i))) + historyDetail.push_back(std::make_pair(clientString->cfgFile_, clientString->lastUseIndex_)); + //sort by last use, most recent items *first* (looks better in xml than the reverse) + std::sort(historyDetail.begin(), historyDetail.end(), [](const HistItem& lhs, const HistItem& rhs) { return lhs.second > rhs.second; }); + + std::vector<wxString> history; + std::transform(historyDetail.begin(), historyDetail.end(), std::back_inserter(history), [](const HistItem& item) { return item.first; }); + + if (history.size() > globalSettings.gui.cfgFileHistMax) //erase oldest elements + history.resize(globalSettings.gui.cfgFileHistMax); - globalSettings.gui.cfgFileHistory = cfgFileHistory; + globalSettings.gui.cfgFileHistory = history; + //-------------------------------------------------------------------------------- globalSettings.gui.lastUsedConfigFiles = activeConfigFiles; //write list of last used folders @@ -848,6 +862,19 @@ xmlAccess::XmlGlobalSettings MainDialog::getGlobalCfgBeforeExit() globalSettings.gui.guiPerspectiveLast = auiMgr.SavePerspective(); + //we need to portably retrieve non-iconized, non-maximized size and position (non-portable: GetWindowPlacement()) + //call *after* wxAuiManager::SavePerspective()! + if (IsIconized()) + Iconize(false); + + globalSettings.gui.isMaximized = IsMaximized(); //evaluate AFTER uniconizing! + + if (IsMaximized()) + Maximize(false); + + globalSettings.gui.dlgSize = GetSize(); + globalSettings.gui.dlgPos = GetPosition(); + return globalSettings; } @@ -871,7 +898,7 @@ void MainDialog::setSyncDirManually(const std::vector<FileSystemObject*>& select void MainDialog::setManualFilter(const std::vector<FileSystemObject*>& selection, bool setIncluded) { //if hidefiltered is active, there should be no filtered elements on screen => current element was filtered out - assert(!currentCfg.hideFilteredElements || !setIncluded); + assert(currentCfg.showFilteredElements || !setIncluded); if (!selection.empty()) { @@ -1184,11 +1211,15 @@ void MainDialog::openExternalApplication(const wxString& commandline, const zen: wxString command = commandline; - auto tryReplace = [&](const wxString& phrase, const wxString& replacement) -> bool + auto tryReplace = [&](wxString phrase, const wxString& replacement) -> bool { - if (command.find(phrase) != wxString::npos) + wxString cmdTmp = command.Upper(); //case insensitive search + phrase.MakeUpper(); // + + size_t pos = cmdTmp.find(phrase); + if (pos != wxString::npos) { - replace(command, phrase, replacement); + command.replace(pos, phrase.size(), replacement); if (replacement.empty()) return false; } @@ -1196,10 +1227,10 @@ void MainDialog::openExternalApplication(const wxString& commandline, const zen: }; bool expandSuccess = - /**/ tryReplace(L"%nameCo", nameCo); //attention: replace %nameCo, %dirCo BEFORE %name, %dir to handle dependency - expandSuccess = tryReplace(L"%dirCo", dirCo ) && expandSuccess; // - expandSuccess = tryReplace(L"%name", name ) && expandSuccess; //prevent short-cut behavior! - expandSuccess = tryReplace(L"%dir", dir ) && expandSuccess; // + /**/ tryReplace(L"%item_path%" , name ); //prevent short-cut behavior! + expandSuccess = tryReplace(L"%item_folder%" , dir ) && expandSuccess; // + expandSuccess = tryReplace(L"%item2_path%" , nameCo) && expandSuccess; // + expandSuccess = tryReplace(L"%item2_folder%", dirCo ) && expandSuccess; // const bool openFileBrowser = [&]() -> bool { @@ -1208,8 +1239,11 @@ void MainDialog::openExternalApplication(const wxString& commandline, const zen: }(); if (!openFileBrowser || expandSuccess) - zen::shellExecute(command); //just execute, show error message if command is malformed - else //support built-in fallback! + { + auto cmdExp = utfCvrtTo<wxString>(expandMacros(utfCvrtTo<Zstring>(command))); + zen::shellExecute(cmdExp); //just execute, show error message if command is malformed + } + else //failed to expand file browser command: support built-in fallback instead of an error! { wxString fallbackDir; if (fsObj) @@ -1410,7 +1444,7 @@ void MainDialog::OnResizeStatisticsPanel(wxEvent& event) } -void MainDialog::OnResizeFolderPairs(wxEvent& event) +void MainDialog::OnResizeLeftFolderWidth(wxEvent& event) { //adapt left-shift display distortion caused by scrollbars for multiple folder pairs const int width = m_panelTopLeft->GetSize().GetWidth(); @@ -1418,7 +1452,6 @@ void MainDialog::OnResizeFolderPairs(wxEvent& event) [&](DirectoryPair* dirPair) { dirPair->m_panelLeft->SetMinSize(wxSize(width, -1)); - }); event.Skip(); @@ -2186,19 +2219,17 @@ void MainDialog::OnSyncSettingsContext(wxMouseEvent& event) } -void MainDialog::OnDirSelected(wxFileDirPickerEvent& event) +void MainDialog::onNaviPanelFilesDropped(FileDropEvent& event) { - //left and right directory text-control and dirpicker are synchronized by MainFolderDragDrop automatically - - clearGrid(); //disable the sync button - + loadConfiguration(event.getFiles()); event.Skip(); } -void MainDialog::onNaviPanelFilesDropped(FileDropEvent& event) +void MainDialog::OnDirSelected(wxCommandEvent& event) { - loadConfiguration(event.getFiles()); + //left and right directory text-control and dirpicker are synchronized by MainFolderDragDrop automatically + clearGrid(); //disable the sync button event.Skip(); } @@ -2225,10 +2256,17 @@ void MainDialog::addFileToCfgHistory(const std::vector<wxString>& filenames) //potentially slow network access: give all checks 500ms to finish wait_for_all_timed(fileEx.begin(), fileEx.end(), boost::posix_time::milliseconds(500)); + //------------------------------------------------------------------------------------------ + //determine highest "last use" index number of m_listBoxHistory + int lastUseIndexMax = 0; + for (int i = 0; i < static_cast<int>(m_listBoxHistory->GetCount()); ++i) + if (auto histData = dynamic_cast<const wxClientHistoryData*>(m_listBoxHistory->GetClientObject(i))) + if (histData->lastUseIndex_ > lastUseIndexMax) + lastUseIndexMax = histData->lastUseIndex_; - std::deque<bool> selections(m_listBoxHistory->GetCount()); + std::deque<bool> selections(m_listBoxHistory->GetCount()); //items to select after update of history list auto futIter = fileEx.begin(); for (auto iter = filenames.begin(); iter != filenames.end(); ++iter, ++futIter) @@ -2238,37 +2276,28 @@ void MainDialog::addFileToCfgHistory(const std::vector<wxString>& filenames) continue; const wxString& filename = *iter; - const Zstring file = toZ(filename); - - int posFound = -1; - for (int i = 0; i < static_cast<int>(m_listBoxHistory->GetCount()); ++i) + auto findItem = [&]() -> int { - wxClientDataString* cData = dynamic_cast<wxClientDataString*>(m_listBoxHistory->GetClientObject(i)); - if (cData) - { - const wxString& filenameTmp = cData->name_; + for (int i = 0; i < static_cast<int>(m_listBoxHistory->GetCount()); ++i) + if (auto histData = dynamic_cast<const wxClientHistoryData*>(m_listBoxHistory->GetClientObject(i))) + if (samePhysicalFile(toZ(filename), toZ(histData->cfgFile_))) + return i; + return -1; + }; - //tests if the same filenames are specified, even if they are relative to the current working directory/include symlinks or \\?\ prefix - if (zen::samePhysicalFile(toZ(filename), toZ(filenameTmp))) - { - posFound = i; - break; - } - } + const int itemPos = findItem(); + if (itemPos >= 0) //update + { + if (auto histData = dynamic_cast<wxClientHistoryData*>(m_listBoxHistory->GetClientObject(itemPos))) + histData->lastUseIndex_ = ++lastUseIndexMax; + selections[itemPos] = true; } - - if (posFound != -1) - selections[posFound] = true; - else + else //insert { - int newPos = -1; - //the default config file should receive a different name on GUI - if (zen::samePhysicalFile(toZ(lastRunConfigName()), toZ(filename))) - newPos = m_listBoxHistory->Append(_("<Last session>"), new wxClientDataString(filename)); - else - newPos = m_listBoxHistory->Append(getFormattedHistoryElement(filename), new wxClientDataString(filename)); - + const wxString label = samePhysicalFile(toZ(lastRunConfigName()), toZ(filename)) ? //give default config file a different name + _("<Last session>") : getFormattedHistoryElement(filename); + const int newPos = m_listBoxHistory->Append(label, new wxClientHistoryData(filename, ++lastUseIndexMax)); //*insert* into sorted list selections.insert(selections.begin() + newPos, true); } } @@ -2376,7 +2405,7 @@ bool MainDialog::saveOldConfig() //return false on user abort ReturnQuestionDlg::BUTTON_YES | ReturnQuestionDlg::BUTTON_NO | ReturnQuestionDlg::BUTTON_CANCEL, replaceCpy(_("Do you want to save changes to %x?"), L"%x", fmtFileName(afterLast(utfCvrtTo<Zstring>(filename), FILE_NAME_SEPARATOR))), filename, //caption - _("Save"), _("Don't Save"), + _("&Save"), _("Do&n't save"), &cb)) { case ReturnQuestionDlg::BUTTON_YES: @@ -2443,8 +2472,8 @@ void MainDialog::OnLoadFromHistory(wxCommandEvent& event) std::for_each(selections.begin(), selections.end(), [&](int pos) { - if (auto cData = dynamic_cast<wxClientDataString*>(m_listBoxHistory->GetClientObject(pos))) - filenames.push_back(cData->name_); + if (auto histData = dynamic_cast<const wxClientHistoryData*>(m_listBoxHistory->GetClientObject(pos))) + filenames.push_back(histData->cfgFile_); }); if (!filenames.empty()) @@ -2649,7 +2678,7 @@ void MainDialog::setConfig(const xmlAccess::XmlGuiConfig& newGuiCfg) //read GUI layout - m_checkBoxHideFilt->SetValue(currentCfg.hideFilteredElements); + m_checkBoxShowExcluded->SetValue(currentCfg.showFilteredElements); showSyncAction(currentCfg.showSyncAction); @@ -2710,7 +2739,7 @@ void MainDialog::updateGuiAfterFilterChange(int delay) { //signal UI that grids need to be refreshed on next Update() - if (currentCfg.hideFilteredElements) + if (!currentCfg.showFilteredElements) { gridview::refresh(*m_gridMainL, *m_gridMainC, *m_gridMainR); m_gridMainL->Update(); @@ -2724,12 +2753,12 @@ void MainDialog::updateGuiAfterFilterChange(int delay) } -void MainDialog::OnHideFilteredButton(wxCommandEvent& event) +void MainDialog::OnShowExcluded(wxCommandEvent& event) { //toggle showing filtered rows - currentCfg.hideFilteredElements = !currentCfg.hideFilteredElements; - //make sure, checkbox and "hideFiltered" are in sync - m_checkBoxHideFilt->SetValue(currentCfg.hideFilteredElements); + currentCfg.showFilteredElements = !currentCfg.showFilteredElements; + //make sure, checkbox and value are in sync + m_checkBoxShowExcluded->SetValue(currentCfg.showFilteredElements); updateGui(); } @@ -3043,15 +3072,14 @@ void MainDialog::OnCompare(wxCommandEvent& event) } } - //begin comparison - zen::CompareProcess compProc(globalCfg.fileTimeTolerance, - globalCfg.optDialogs, - true, //allow pw prompt - globalCfg.runWithBackgroundPriority, - statusHandler); - - //technical representation of comparison data - compProc.startCompareProcess(cmpConfig, folderCmp); //throw GuiAbortProcess + //COMPARE DIRECTORIES + compare(globalCfg.fileTimeTolerance, + globalCfg.optDialogs, + true, //allow pw prompt + globalCfg.runWithBackgroundPriority, + cmpConfig, + folderCmp, + statusHandler); //throw GuiAbortProcess } catch (GuiAbortProcess&) { @@ -3082,7 +3110,7 @@ void MainDialog::OnCompare(wxCommandEvent& event) //prepare status information if (allElementsEqual(folderCmp)) - flashStatusInformation(_("All directories in sync!")); + flashStatusInformation(_("All folders are in sync!")); } @@ -3265,24 +3293,21 @@ void MainDialog::OnStartSync(wxCommandEvent& event) } } - //start synchronization and mark all elements processed - zen::SyncProcess syncProc(xmlAccess::extractJobName(activeFileName), - formatTime<std::wstring>(L"%Y-%m-%d %H%M%S"), - globalCfg.optDialogs, - globalCfg.verifyFileCopy, - globalCfg.copyLockedFiles, - globalCfg.copyFilePermissions, - globalCfg.transactionalFileCopy, - globalCfg.runWithBackgroundPriority, - statusHandler); - + //START SYNCHRONIZATION const std::vector<zen::FolderPairSyncCfg> syncProcessCfg = zen::extractSyncCfg(guiCfg.mainCfg); - - //make sure syncProcessCfg and dataToSync have same size and correspond! if (syncProcessCfg.size() != folderCmp.size()) throw std::logic_error("Programming Error: Contract violation!"); //should never happen: sync button is deactivated if they are not in sync - syncProc.startSynchronizationProcess(syncProcessCfg, folderCmp); + synchronize(localTime(), + globalCfg.optDialogs, + globalCfg.verifyFileCopy, + globalCfg.copyLockedFiles, + globalCfg.copyFilePermissions, + globalCfg.transactionalFileCopy, + globalCfg.runWithBackgroundPriority, + syncProcessCfg, + folderCmp, + statusHandler); //play (optional) sound notification after sync has completed (GUI and batch mode) const wxString soundFile = toWx(zen::getResourceDir()) + L"Sync_Complete.wav"; @@ -3379,6 +3404,7 @@ void MainDialog::OnSwapSides(wxCommandEvent& event) m_bpButtonLeftNewer->setActive(m_bpButtonRightNewer->isActive()); m_bpButtonRightNewer->setActive(tmp); + /* for sync preview and "mirror" variant swapping may create strange effect: tmp = m_bpButtonSyncCreateLeft->isActive(); m_bpButtonSyncCreateLeft->setActive(m_bpButtonSyncCreateRight->isActive()); m_bpButtonSyncCreateRight->setActive(tmp); @@ -3390,6 +3416,7 @@ void MainDialog::OnSwapSides(wxCommandEvent& event) tmp = m_bpButtonSyncDirOverwLeft->isActive(); m_bpButtonSyncDirOverwLeft->setActive(m_bpButtonSyncDirOverwRight->isActive()); m_bpButtonSyncDirOverwRight->setActive(tmp); + */ //swap grid information zen::swapGrids(getConfig().mainCfg, folderCmp); @@ -3427,7 +3454,7 @@ void MainDialog::updateGridViewData() if (showSyncAction_) { - const GridView::StatusSyncPreview result = gridDataView->updateSyncPreview(currentCfg.hideFilteredElements, + const GridView::StatusSyncPreview result = gridDataView->updateSyncPreview(!currentCfg.showFilteredElements, m_bpButtonSyncCreateLeft-> isActive(), m_bpButtonSyncCreateRight-> isActive(), m_bpButtonSyncDeleteLeft-> isActive(), @@ -3475,7 +3502,7 @@ void MainDialog::updateGridViewData() } else { - const GridView::StatusCmpResult result = gridDataView->updateCmpResult(currentCfg.hideFilteredElements, + const GridView::StatusCmpResult result = gridDataView->updateCmpResult(!currentCfg.showFilteredElements, m_bpButtonLeftOnly-> isActive(), m_bpButtonRightOnly-> isActive(), m_bpButtonLeftNewer-> isActive(), @@ -3518,7 +3545,7 @@ void MainDialog::updateGridViewData() //navigation tree if (showSyncAction_) - treeDataView->updateSyncPreview(currentCfg.hideFilteredElements, + treeDataView->updateSyncPreview(!currentCfg.showFilteredElements, m_bpButtonSyncCreateLeft-> isActive(), m_bpButtonSyncCreateRight-> isActive(), m_bpButtonSyncDeleteLeft-> isActive(), @@ -3529,7 +3556,7 @@ void MainDialog::updateGridViewData() m_bpButtonEqual-> isActive(), m_bpButtonConflict-> isActive()); else - treeDataView->updateCmpResult(currentCfg.hideFilteredElements, + treeDataView->updateCmpResult(!currentCfg.showFilteredElements, m_bpButtonLeftOnly-> isActive(), m_bpButtonRightOnly-> isActive(), m_bpButtonLeftNewer-> isActive(), @@ -3664,51 +3691,38 @@ void MainDialog::updateGuiForFolderPair() wxWindowUpdateLocker dummy(this); //adapt delete top folder pair button - if (additionalFolderPairs.empty()) - m_bpButtonRemovePair->Hide(); - else - m_bpButtonRemovePair->Show(); + m_bpButtonRemovePair->Show(!additionalFolderPairs.empty()); m_panelTopLeft->Layout(); //adapt local filter and sync cfg for first folder pair - if (additionalFolderPairs.empty() && - firstFolderPair->getAltCompConfig().get() == nullptr && - firstFolderPair->getAltSyncConfig().get() == nullptr && - isNullFilter(firstFolderPair->getAltFilterConfig())) - { - m_bpButtonAltCompCfg ->Hide(); - m_bpButtonAltSyncCfg ->Hide(); - m_bpButtonLocalFilter->Hide(); - - setImage(*m_bpButtonSwapSides, GlobalResources::getImage(L"swap")); - } - else - { - m_bpButtonAltCompCfg ->Show(); - m_bpButtonAltSyncCfg ->Show(); - m_bpButtonLocalFilter->Show(); - - setImage(*m_bpButtonSwapSides, GlobalResources::getImage(L"swapSlim")); - } + const bool showLocalCfgFirstPair = !additionalFolderPairs.empty() || + firstFolderPair->getAltCompConfig().get() != nullptr || + firstFolderPair->getAltSyncConfig().get() != nullptr || + !isNullFilter(firstFolderPair->getAltFilterConfig()); + + m_bpButtonAltCompCfg ->Show(showLocalCfgFirstPair); + m_bpButtonAltSyncCfg ->Show(showLocalCfgFirstPair); + m_bpButtonLocalFilter->Show(showLocalCfgFirstPair); + setImage(*m_bpButtonSwapSides, GlobalResources::getImage(showLocalCfgFirstPair ? L"swapSlim" : L"swap")); m_panelTopMiddle->Layout(); int addPairMinimalHeight = 0; int addPairOptimalHeight = 0; if (!additionalFolderPairs.empty()) { - int pairHeight = additionalFolderPairs[0]->GetSize().GetHeight(); - addPairMinimalHeight = std::min<double>(1.5, additionalFolderPairs.size()) * pairHeight; //have 0.5 * height indicate that more folders are there + const int pairHeight = additionalFolderPairs[0]->GetSize().GetHeight(); + addPairMinimalHeight = std::min<double>(1.5, additionalFolderPairs.size()) * pairHeight; //have 1.5 * height indicate that more folders are there addPairOptimalHeight = std::min<double>(globalCfg.gui.maxFolderPairsVisible - 1 + 0.5, //subtract first/main folder pair and add 0.5 to indicate additional folders additionalFolderPairs.size()) * pairHeight; addPairOptimalHeight = std::max(addPairOptimalHeight, addPairMinimalHeight); //implicitly handle corrupted values for "maxFolderPairsVisible" } + const int firstPairHeight = m_panelDirectoryPairs->ClientToWindowSize(m_panelTopLeft->GetSize()).GetHeight(); //include m_panelDirectoryPairs window borders! + //######################################################################################################################## //wxAUI hack: set minimum height to desired value, then call wxAuiPaneInfo::Fixed() to apply it - const int panelNewHeight = m_panelDirectoryPairs->ClientToWindowSize(m_panelTopLeft->GetSize()).GetHeight(); //respect m_panelDirectoryPairs window borders! - - auiMgr.GetPane(m_panelDirectoryPairs).MinSize(-1, panelNewHeight + addPairOptimalHeight); + auiMgr.GetPane(m_panelDirectoryPairs).MinSize(-1, firstPairHeight + addPairOptimalHeight); auiMgr.GetPane(m_panelDirectoryPairs).Fixed(); auiMgr.Update(); @@ -3717,8 +3731,8 @@ void MainDialog::updateGuiForFolderPair() auiMgr.Update(); //######################################################################################################################## - //ensure additional folder pairs are at least partially visible - auiMgr.GetPane(m_panelDirectoryPairs).MinSize(-1, m_panelTopLeft->GetSize().GetHeight() + addPairMinimalHeight); + //make sure user cannot fully shrink additional folder pairs + auiMgr.GetPane(m_panelDirectoryPairs).MinSize(-1, firstPairHeight + addPairMinimalHeight); auiMgr.Update(); m_scrolledWindowFolderPairs->Fit(); //adjust scrolled window size diff --git a/ui/main_dlg.h b/ui/main_dlg.h index 63eef25a..d6965375 100644 --- a/ui/main_dlg.h +++ b/ui/main_dlg.h @@ -1,7 +1,7 @@ // ************************************************************************** // * 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 (zhnmju123 AT gmx DOT de) - All Rights Reserved * +// * Copyright (C) ZenJu (zenju AT gmx DOT de) - All Rights Reserved * // ************************************************************************** #ifndef MAINDIALOG_H @@ -48,6 +48,7 @@ private: friend class SyncStatusHandler; friend class ManualDeletionHandler; friend class DirectoryPairFirst; + friend class DirectoryPair; friend class DirectoryNameMainImpl; template <class GuiPanel> friend class FolderPairCallback; @@ -119,11 +120,11 @@ private: void onGridButtonEventL(wxKeyEvent& event); void onGridButtonEventC(wxKeyEvent& event); void onGridButtonEventR(wxKeyEvent& event); - void onGridButtonEvent(wxKeyEvent& event, zen::Grid& grid, bool leftSide); + void onGridButtonEvent (wxKeyEvent& event, zen::Grid& grid, bool leftSide); - void onTreeButtonEvent (wxKeyEvent& event); - void OnContextSetLayout (wxMouseEvent& event); - void OnGlobalKeyEvent (wxKeyEvent& event); + void onTreeButtonEvent (wxKeyEvent& event); + void OnContextSetLayout(wxMouseEvent& event); + void OnGlobalKeyEvent (wxKeyEvent& event); void OnCompSettingsContext(wxMouseEvent& event); void OnSyncSettingsContext(wxMouseEvent& event); @@ -142,7 +143,8 @@ private: void onNaviSelection(zen::GridRangeSelectEvent& event); void onNaviPanelFilesDropped(zen::FileDropEvent& event); - void OnDirSelected(wxFileDirPickerEvent& event); + + void OnDirSelected(wxCommandEvent& event); void onCheckRows (zen::CheckRowsEvent& event); void onSetSyncDirection(zen::SyncDirectionEvent& event); @@ -151,9 +153,9 @@ private: void onGridDoubleClickR(zen::GridClickEvent& event); void onGridDoubleClickRim(int row, bool leftSide); - void onGridLabelLeftClickC (zen::GridClickEvent& event); - void onGridLabelLeftClickL (zen::GridClickEvent& event); - void onGridLabelLeftClickR (zen::GridClickEvent& event); + void onGridLabelLeftClickC(zen::GridClickEvent& event); + void onGridLabelLeftClickL(zen::GridClickEvent& event); + void onGridLabelLeftClickR(zen::GridClickEvent& event); void onGridLabelLeftClick(bool onLeft, zen::ColumnTypeRim type); void onGridLabelContextL(zen::GridClickEvent& event); @@ -161,44 +163,44 @@ private: void onGridLabelContextR(zen::GridClickEvent& event); void onGridLabelContext(zen::Grid& grid, zen::ColumnTypeRim type, const std::vector<zen::ColumnAttributeRim>& defaultColumnAttributes); - void OnLeftOnlyFiles( wxCommandEvent& event); - void OnRightOnlyFiles( wxCommandEvent& event); - void OnLeftNewerFiles( wxCommandEvent& event); - void OnRightNewerFiles( wxCommandEvent& event); - void OnEqualFiles( wxCommandEvent& event); - void OnDifferentFiles( wxCommandEvent& event); - void OnConflictFiles( wxCommandEvent& event); - - void OnSyncCreateLeft( wxCommandEvent& event); - void OnSyncCreateRight( wxCommandEvent& event); - void OnSyncDeleteLeft( wxCommandEvent& event); - void OnSyncDeleteRight( wxCommandEvent& event); - void OnSyncDirLeft( wxCommandEvent& event); - void OnSyncDirRight( wxCommandEvent& event); - void OnSyncDirNone( wxCommandEvent& event); - - void OnConfigNew( wxCommandEvent& event); - void OnConfigSave( wxCommandEvent& event); - void OnConfigSaveAs( wxCommandEvent& event); - void OnConfigLoad( wxCommandEvent& event); - void OnLoadFromHistory( wxCommandEvent& event); - - void OnCfgHistoryKeyEvent( wxKeyEvent& event); - void OnRegularUpdateCheck( wxIdleEvent& event); - void OnLayoutWindowAsync( wxIdleEvent& event); - - void OnResizeFolderPairs( wxEvent& event); - void OnResizeConfigPanel( wxEvent& event); - void OnResizeViewPanel( wxEvent& event); + void OnLeftOnlyFiles (wxCommandEvent& event); + void OnRightOnlyFiles (wxCommandEvent& event); + void OnLeftNewerFiles (wxCommandEvent& event); + void OnRightNewerFiles(wxCommandEvent& event); + void OnEqualFiles (wxCommandEvent& event); + void OnDifferentFiles (wxCommandEvent& event); + void OnConflictFiles (wxCommandEvent& event); + + void OnSyncCreateLeft (wxCommandEvent& event); + void OnSyncCreateRight(wxCommandEvent& event); + void OnSyncDeleteLeft (wxCommandEvent& event); + void OnSyncDeleteRight(wxCommandEvent& event); + void OnSyncDirLeft (wxCommandEvent& event); + void OnSyncDirRight (wxCommandEvent& event); + void OnSyncDirNone (wxCommandEvent& event); + + void OnConfigNew (wxCommandEvent& event); + void OnConfigSave (wxCommandEvent& event); + void OnConfigSaveAs (wxCommandEvent& event); + void OnConfigLoad (wxCommandEvent& event); + void OnLoadFromHistory(wxCommandEvent& event); + + void OnCfgHistoryKeyEvent(wxKeyEvent& event); + void OnRegularUpdateCheck(wxIdleEvent& event); + void OnLayoutWindowAsync (wxIdleEvent& event); + + void OnResizeLeftFolderWidth(wxEvent& event); + void OnResizeConfigPanel (wxEvent& event); + void OnResizeViewPanel (wxEvent& event); void OnResizeStatisticsPanel(wxEvent& event); - void OnHideFilteredButton( wxCommandEvent& event); - void OnConfigureFilter( wxCommandEvent& event); - void OnSwapSides( wxCommandEvent& event); - void OnCompare( wxCommandEvent& event); - void OnSyncSettings( wxCommandEvent& event); - void OnCmpSettings( wxCommandEvent& event); - void OnStartSync( wxCommandEvent& event); - void OnClose( wxCloseEvent& event); + void OnShowExcluded (wxCommandEvent& event); + void OnConfigureFilter (wxCommandEvent& event); + void OnSwapSides (wxCommandEvent& event); + void OnCompare (wxCommandEvent& event); + void OnSyncSettings (wxCommandEvent& event); + void OnCmpSettings (wxCommandEvent& event); + void OnStartSync (wxCommandEvent& event); + void OnClose (wxCloseEvent& event); void updateGuiAfterFilterChange(int delay); @@ -210,22 +212,22 @@ private: void updateSyncEnabledStatus(); - void OnAddFolderPair( wxCommandEvent& event); - void OnRemoveFolderPair( wxCommandEvent& event); - void OnRemoveTopFolderPair( wxCommandEvent& event); + void OnAddFolderPair (wxCommandEvent& event); + void OnRemoveFolderPair (wxCommandEvent& event); + void OnRemoveTopFolderPair(wxCommandEvent& event); void applyFilterConfig(); void applySyncConfig(); //menu events - void OnMenuGlobalSettings( wxCommandEvent& event); - void OnMenuExportFileList( wxCommandEvent& event); - void OnMenuBatchJob( wxCommandEvent& event); - void OnMenuCheckVersion( wxCommandEvent& event); - void OnMenuAbout( wxCommandEvent& event); - void OnShowHelp( wxCommandEvent& event); - void OnMenuQuit( wxCommandEvent& event); - void OnMenuLanguageSwitch( wxCommandEvent& event); + void OnMenuGlobalSettings(wxCommandEvent& event); + void OnMenuExportFileList(wxCommandEvent& event); + void OnMenuBatchJob (wxCommandEvent& event); + void OnMenuCheckVersion (wxCommandEvent& event); + void OnMenuAbout (wxCommandEvent& event); + void OnShowHelp (wxCommandEvent& event); + void OnMenuQuit (wxCommandEvent& event); + void OnMenuLanguageSwitch(wxCommandEvent& event); void switchProgramLanguage(int langID); diff --git a/ui/msg_popup.cpp b/ui/msg_popup.cpp index 09bf24c9..bdb51701 100644 --- a/ui/msg_popup.cpp +++ b/ui/msg_popup.cpp @@ -1,7 +1,7 @@ // ************************************************************************** // * 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 (zhnmju123 AT gmx DOT de) - All Rights Reserved * +// * Copyright (C) ZenJu (zenju AT gmx DOT de) - All Rights Reserved * // ************************************************************************** #include "msg_popup.h" @@ -150,7 +150,7 @@ WarningDlg::WarningDlg(wxWindow* parent, int activeButtons, const wxString& mes SetTitle(_("Warning")); m_bitmapMsgType->SetBitmap(GlobalResources::getImage(L"warning")); m_textCtrlMessage->SetValue(messageText); - checkBoxDontShowAgain.SetLabel(_("Do not show this dialog again")); + checkBoxDontShowAgain.SetLabel(_("Don't show this dialog again")); buttonIgnore.SetLabel(_("&Ignore")); buttonSwitch.SetLabel(_("&Switch")); buttonIgnore.SetId(wxID_IGNORE); diff --git a/ui/msg_popup.h b/ui/msg_popup.h index 48a4e8cb..fd68c3f4 100644 --- a/ui/msg_popup.h +++ b/ui/msg_popup.h @@ -1,7 +1,7 @@ // ************************************************************************** // * 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 (zhnmju123 AT gmx DOT de) - All Rights Reserved * +// * Copyright (C) ZenJu (zenju AT gmx DOT de) - All Rights Reserved * // ************************************************************************** #ifndef MESSAGEPOPUP_H_INCLUDED diff --git a/ui/progress_indicator.cpp b/ui/progress_indicator.cpp index ff2df809..2583ecb8 100644 --- a/ui/progress_indicator.cpp +++ b/ui/progress_indicator.cpp @@ -1,7 +1,7 @@ // ************************************************************************** // * 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 (zhnmju123 AT gmx DOT de) - All Rights Reserved * +// * Copyright (C) ZenJu (zenju AT gmx DOT de) - All Rights Reserved * // ************************************************************************** #include "progress_indicator.h" @@ -680,8 +680,9 @@ SyncStatus::SyncStatusImpl::SyncStatusImpl(AbortCallback& abortCb, m_panelGraph->addData(graphDataBytes, Graph2D::LineAttributes().setLineWidth(2).setColor(wxColor(0, 192, 0))); //medium green //allow changing on completion command - m_comboBoxExecFinished->setValue (execWhenFinished); - m_comboBoxExecFinished->setHistoryRef(execFinishedHistory); + + m_comboBoxExecFinished->initHistory(execFinishedHistory, execFinishedHistory.size()); //-> we won't use addItemHistory() later + m_comboBoxExecFinished->setValue(execWhenFinished); updateDialogStatus(); //null-status will be shown while waiting for dir locks (if at all) diff --git a/ui/progress_indicator.h b/ui/progress_indicator.h index cd974408..5df04fd4 100644 --- a/ui/progress_indicator.h +++ b/ui/progress_indicator.h @@ -1,7 +1,7 @@ // ************************************************************************** // * 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 (zhnmju123 AT gmx DOT de) - All Rights Reserved * +// * Copyright (C) ZenJu (zenju AT gmx DOT de) - All Rights Reserved * // ************************************************************************** #ifndef PROGRESSINDICATOR_H_INCLUDED diff --git a/ui/search.cpp b/ui/search.cpp index 2a9aabfb..46138875 100644 --- a/ui/search.cpp +++ b/ui/search.cpp @@ -1,7 +1,7 @@ // ************************************************************************** // * 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 (zhnmju123 AT gmx DOT de) - All Rights Reserved * +// * Copyright (C) ZenJu (zenju AT gmx DOT de) - All Rights Reserved * // ************************************************************************** #include "search.h" diff --git a/ui/search.h b/ui/search.h index 95811244..eee4af4d 100644 --- a/ui/search.h +++ b/ui/search.h @@ -1,7 +1,7 @@ // ************************************************************************** // * 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 (zhnmju123 AT gmx DOT de) - All Rights Reserved * +// * Copyright (C) ZenJu (zenju AT gmx DOT de) - All Rights Reserved * // ************************************************************************** #ifndef SEARCH_H_INCLUDED diff --git a/ui/small_dlgs.cpp b/ui/small_dlgs.cpp index bfe8de9c..a1aca6dd 100644 --- a/ui/small_dlgs.cpp +++ b/ui/small_dlgs.cpp @@ -1,7 +1,7 @@ // ************************************************************************** // * 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 (zhnmju123 AT gmx DOT de) - All Rights Reserved * +// * Copyright (C) ZenJu (zenju AT gmx DOT de) - All Rights Reserved * // ************************************************************************** #include "gui_generated.h" @@ -89,7 +89,7 @@ AboutDlg::AboutDlg(wxWindow* parent) : AboutDlgGenerated(parent) build += L" x86"; assert_static(zen::is32BitBuild || zen::is64BitBuild); - m_build->SetLabel(replaceCpy(_("(Build: %x)"), L"%x", build)); + m_build->SetLabel(replaceCpy(_("Build: %x"), L"%x", build)); //m_animationControl1->SetAnimation(GlobalResources::instance().animationMoney); //m_animationControl1->Play(); @@ -543,8 +543,8 @@ private: void OnCancel(wxCommandEvent& event) { EndModal(ReturnSmallDlg::BUTTON_CANCEL); } void OnShowHelp(wxCommandEvent& event) { displayHelpEntry(L"html/Comparison Settings.html"); } - void OnTimeSize(wxCommandEvent& event) { m_radioBtnSizeDate->SetValue(true); updateGui(); } - void OnContent (wxCommandEvent& event) { m_radioBtnContent ->SetValue(true); updateGui(); } + void OnTimeSize(wxCommandEvent& event) { compareVar = CMP_BY_TIME_SIZE; updateGui(); } + void OnContent (wxCommandEvent& event) { compareVar = CMP_BY_CONTENT; updateGui(); } void OnTimeSizeDouble(wxMouseEvent& event); void OnFilesizeDouble(wxMouseEvent& event); @@ -552,8 +552,8 @@ private: void updateGui(); - CompConfig& cmpConfigOut; - + CompConfig& cmpConfigOut; //for output only + CompareVariant compareVar; zen::EnumDescrList<SymLinkHandling> enumDescrHandleSyml; }; @@ -561,43 +561,45 @@ private: CompareCfgDialog::CompareCfgDialog(wxWindow* parent, CompConfig& cmpConfig) : CmpCfgDlgGenerated(parent), - cmpConfigOut(cmpConfig) + cmpConfigOut(cmpConfig), + compareVar(cmpConfig.compareVar) { #ifdef FFS_WIN new zen::MouseMoveWindow(*this); //allow moving main dialog by clicking (nearly) anywhere...; ownership passed to "this" #endif + m_bpButtonHelp->SetBitmapLabel(GlobalResources::getImage(L"help")); enumDescrHandleSyml. add(SYMLINK_IGNORE, _("Exclude")). add(SYMLINK_USE_DIRECTLY, _("Direct")). add(SYMLINK_FOLLOW_LINK, _("Follow")); + setEnumVal(enumDescrHandleSyml, *m_choiceHandleSymlinks, cmpConfig.handleSymlinks); + //move dialog up so that compare-config button and first config-variant are on same level // Move(wxPoint(position.x, std::max(0, position.y - (m_buttonTimeSize->GetScreenPosition() - GetScreenPosition()).y))); - m_bpButtonHelp ->SetBitmapLabel(GlobalResources::getImage(L"help")); + updateGui(); + Fit(); +} + + +void CompareCfgDialog::updateGui() +{ + //update toggle buttons -> they have no parameter-ownership at all! + m_toggleBtnTimeSize->SetValue(false); + m_toggleBtnContent ->SetValue(false); - switch (cmpConfig.compareVar) + switch (compareVar) { case CMP_BY_TIME_SIZE: - m_radioBtnSizeDate->SetValue(true); - m_buttonContent->SetFocus(); //set focus on the other button + m_toggleBtnTimeSize->SetValue(true); break; case CMP_BY_CONTENT: - m_radioBtnContent->SetValue(true); - m_buttonTimeSize->SetFocus(); //set focus on the other button + m_toggleBtnContent->SetValue(true); break; } - setEnumVal(enumDescrHandleSyml, *m_choiceHandleSymlinks, cmpConfig.handleSymlinks); - - updateGui(); - Fit(); -} - - -void CompareCfgDialog::updateGui() -{ auto setBitmap = [](wxStaticBitmap& bmpCtrl, bool active, const wxBitmap& bmp) { if (active) @@ -605,19 +607,14 @@ void CompareCfgDialog::updateGui() else bmpCtrl.SetBitmap(greyScale(bmp)); }; - - setBitmap(*m_bitmapByTime, m_radioBtnSizeDate->GetValue(), GlobalResources::getImage(L"clock")); - setBitmap(*m_bitmapByContent, m_radioBtnContent ->GetValue(), GlobalResources::getImage(L"cmpByContent")); + setBitmap(*m_bitmapByTime, compareVar == CMP_BY_TIME_SIZE, GlobalResources::getImage(L"clock")); + setBitmap(*m_bitmapByContent, compareVar == CMP_BY_CONTENT, GlobalResources::getImage(L"cmpByContent")); } void CompareCfgDialog::OnOkay(wxCommandEvent& event) { - if (m_radioBtnContent->GetValue()) - cmpConfigOut.compareVar = CMP_BY_CONTENT; - else - cmpConfigOut.compareVar = CMP_BY_TIME_SIZE; - + cmpConfigOut.compareVar = compareVar; cmpConfigOut.handleSymlinks = getEnumVal(enumDescrHandleSyml, *m_choiceHandleSymlinks); EndModal(ReturnSmallDlg::BUTTON_OKAY); @@ -696,11 +693,11 @@ GlobalSettingsDlg::GlobalSettingsDlg(wxWindow* parent, xmlAccess::XmlGlobalSetti set(globalSettings.gui.externelApplications); - const wxString toolTip = wxString(_("Integrate external applications into context menu. The following macros are available:")) + wxT("\n\n") + - wxT("%name \t") + _("- full file or folder name") + wxT("\n") + - wxT("%dir \t") + _("- folder part only") + wxT("\n") + - wxT("%nameCo \t") + _("- Other side's counterpart to %name") + wxT("\n") + - wxT("%dirCo \t") + _("- Other side's counterpart to %dir"); + const wxString toolTip = wxString(_("Integrate external applications into context menu. The following macros are available:")) + L"\n\n" + + L"%item_path% \t" + _("- full file or folder name") + L"\n" + + L"%item_folder% \t" + _("- folder part only") + L"\n" + + L"%item2_path% \t" + _("- Other side's counterpart to %item_path%") + L"\n" + + L"%item2_folder% \t" + _("- Other side's counterpart to %item_folder%"); m_gridCustomCommand->GetGridWindow()->SetToolTip(toolTip); m_gridCustomCommand->GetGridColLabelWindow()->SetToolTip(toolTip); diff --git a/ui/small_dlgs.h b/ui/small_dlgs.h index 98a072cf..b375aff2 100644 --- a/ui/small_dlgs.h +++ b/ui/small_dlgs.h @@ -1,7 +1,7 @@ // ************************************************************************** // * 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 (zhnmju123 AT gmx DOT de) - All Rights Reserved * +// * Copyright (C) ZenJu (zenju AT gmx DOT de) - All Rights Reserved * // ************************************************************************** #ifndef SMALLDIALOGS_H_INCLUDED diff --git a/ui/sorting.h b/ui/sorting.h index ad54bfbe..31146037 100644 --- a/ui/sorting.h +++ b/ui/sorting.h @@ -1,7 +1,7 @@ // ************************************************************************** // * 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 (zhnmju123 AT gmx DOT de) - All Rights Reserved * +// * Copyright (C) ZenJu (zenju AT gmx DOT de) - All Rights Reserved * // ************************************************************************** #ifndef SORTING_H_INCLUDED diff --git a/ui/switch_to_gui.h b/ui/switch_to_gui.h index a9a717cb..e4a14f8f 100644 --- a/ui/switch_to_gui.h +++ b/ui/switch_to_gui.h @@ -1,7 +1,7 @@ // ************************************************************************** // * 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 (zhnmju123 AT gmx DOT de) - All Rights Reserved * +// * Copyright (C) ZenJu (zenju AT gmx DOT de) - All Rights Reserved * // ************************************************************************** #ifndef SWITCHTOGUI_H_INCLUDED diff --git a/ui/sync_cfg.cpp b/ui/sync_cfg.cpp index 794569cc..d8d238b3 100644 --- a/ui/sync_cfg.cpp +++ b/ui/sync_cfg.cpp @@ -1,22 +1,21 @@ // ************************************************************************** // * 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 (zhnmju123 AT gmx DOT de) - All Rights Reserved * +// * Copyright (C) ZenJu (zenju AT gmx DOT de) - All Rights Reserved * // ************************************************************************** #include "sync_cfg.h" #include <memory> -#include "../lib/resources.h" -#include "dir_name.h" #include <wx/wupdlock.h> #include <wx+/mouse_move_dlg.h> -#include <wx+/dir_picker.h> #include <wx+/rtl.h> -#include "gui_generated.h" #include <wx+/choice_enum.h> #include <wx+/image_tools.h> -#include "../file_hierarchy.h" +#include "gui_generated.h" #include "exec_finished_box.h" +#include "dir_name.h" +#include "../file_hierarchy.h" +#include "../lib/resources.h" using namespace zen; using namespace xmlAccess; @@ -32,22 +31,22 @@ public: ExecWhenFinishedCfg* execWhenFinished); //optional input parameter private: - virtual void OnSyncAutomatic( wxCommandEvent& event); - virtual void OnSyncMirror( wxCommandEvent& event); - virtual void OnSyncUpdate( wxCommandEvent& event); - virtual void OnSyncCustom( wxCommandEvent& event); - - virtual void OnSyncAutomaticDouble( wxMouseEvent& event); - virtual void OnSyncMirrorDouble( wxMouseEvent& event); - virtual void OnSyncUpdateDouble( wxMouseEvent& event); - virtual void OnSyncCustomDouble( wxMouseEvent& event); - - virtual void OnExLeftSideOnly( wxCommandEvent& event); - virtual void OnExRightSideOnly( wxCommandEvent& event); - virtual void OnLeftNewer( wxCommandEvent& event); - virtual void OnRightNewer( wxCommandEvent& event); - virtual void OnDifferent( wxCommandEvent& event); - virtual void OnConflict( wxCommandEvent& event); + virtual void OnSyncAutomatic(wxCommandEvent& event) { directionCfg.var = DirectionConfig::AUTOMATIC; updateGui(); } + virtual void OnSyncMirror (wxCommandEvent& event) { directionCfg.var = DirectionConfig::MIRROR; updateGui(); } + virtual void OnSyncUpdate (wxCommandEvent& event) { directionCfg.var = DirectionConfig::UPDATE; updateGui(); } + virtual void OnSyncCustom (wxCommandEvent& event) { directionCfg.var = DirectionConfig::CUSTOM; updateGui(); } + + virtual void OnSyncAutomaticDouble(wxMouseEvent& event); + virtual void OnSyncMirrorDouble (wxMouseEvent& event); + virtual void OnSyncUpdateDouble (wxMouseEvent& event); + virtual void OnSyncCustomDouble (wxMouseEvent& event); + + virtual void OnExLeftSideOnly (wxCommandEvent& event); + virtual void OnExRightSideOnly(wxCommandEvent& event); + virtual void OnLeftNewer (wxCommandEvent& event); + virtual void OnRightNewer (wxCommandEvent& event); + virtual void OnDifferent (wxCommandEvent& event); + virtual void OnConflict (wxCommandEvent& event); virtual void OnClose (wxCloseEvent& event) { EndModal(ReturnSyncConfig::BUTTON_CANCEL); } virtual void OnCancel(wxCommandEvent& event) { EndModal(ReturnSyncConfig::BUTTON_CANCEL); } @@ -55,40 +54,37 @@ private: void updateGui(); - void OnChangeErrorHandling(wxCommandEvent& event); - void OnChangeDeletionHandling(wxCommandEvent& event); + virtual void OnDeletionPermanent (wxCommandEvent& event) { handleDeletion = DELETE_PERMANENTLY; updateGui(); } + virtual void OnDeletionRecycler (wxCommandEvent& event) { handleDeletion = DELETE_TO_RECYCLER; updateGui(); } + virtual void OnDeletionVersioning (wxCommandEvent& event) { handleDeletion = DELETE_TO_VERSIONING; updateGui(); } - const zen::CompareVariant cmpVariant; + virtual void OnErrorPopup (wxCommandEvent& event) { handleGuiError = ON_GUIERROR_POPUP; updateGui(); } + virtual void OnErrorIgnore(wxCommandEvent& event) { handleGuiError = ON_GUIERROR_IGNORE; updateGui(); } - //temporal copy of maindialog.cfg.directionCfg -> ownership NOT within GUI controls! - DirectionConfig currentDirectionCfg; + virtual void OnToggleVersionsLimit(wxCommandEvent& event) { updateGui(); } + + //parameters with ownership NOT within GUI controls! + DirectionConfig directionCfg; + const CompareVariant cmpVariant; + DeletionPolicy handleDeletion; //use Recycler, delete permanently or move to user-defined location + OnGuiError handleGuiError; //changing data SyncConfig& syncCfgOut; xmlAccess::OnGuiError* refHandleError; ExecWhenFinishedCfg* refExecWhenFinished; - DirectoryName<FolderHistoryBox> customDelFolder; - - EnumDescrList<zen::DeletionPolicy> enumDelhandDescr; - EnumDescrList<xmlAccess::OnGuiError> enumErrhandDescr; + DirectoryName<FolderHistoryBox> versioningFolder; }; - void updateConfigIcons(const DirectionConfig& directionCfg, wxBitmapButton* buttonLeftOnly, wxBitmapButton* buttonRightOnly, wxBitmapButton* buttonLeftNewer, wxBitmapButton* buttonRightNewer, wxBitmapButton* buttonDifferent, - wxBitmapButton* buttonConflict, - wxStaticBitmap* bitmapLeftOnly, - wxStaticBitmap* bitmapRightOnly, - wxStaticBitmap* bitmapLeftNewer, - wxStaticBitmap* bitmapRightNewer, - wxStaticBitmap* bitmapDifferent, - wxStaticBitmap* bitmapConflict) //sizer containing all sync-directions + wxBitmapButton* buttonConflict) { if (directionCfg.var != DirectionConfig::AUTOMATIC) //automatic mode needs no sync-directions { @@ -199,35 +195,28 @@ SyncCfgDialog::SyncCfgDialog(wxWindow* parent, xmlAccess::OnGuiError* handleError, ExecWhenFinishedCfg* execWhenFinished) : SyncCfgDlgGenerated(parent), + directionCfg(syncCfg.directionCfg), //make working copy cmpVariant(compareVar), - currentDirectionCfg(syncCfg.directionCfg), //make working copy + handleDeletion(syncCfg.handleDeletion), + handleGuiError(ON_GUIERROR_POPUP), //dummy init syncCfgOut(syncCfg), refHandleError(handleError), refExecWhenFinished(execWhenFinished), - customDelFolder(*m_panelCustomDeletionDir, *m_dirPickerCustomDelFolder, *m_customDelFolder) + versioningFolder(*m_panelVersioning, *m_buttonSelectDirVersioning, *m_versioningFolder) { #ifdef FFS_WIN new zen::MouseMoveWindow(*this); //allow moving main dialog by clicking (nearly) anywhere...; ownership passed to "this" #endif - enumDelhandDescr. - add(DELETE_PERMANENTLY, _("Delete permanently"), _("Delete or overwrite files permanently")). - add(MOVE_TO_RECYCLE_BIN, _("Use Recycle Bin"), _("Use Recycle Bin when deleting or overwriting files")). - add(MOVE_TO_CUSTOM_DIRECTORY, _("Versioning"), _("Move files into a time-stamped subfolder")); - - enumErrhandDescr. - add(ON_GUIERROR_POPUP, _("Show pop-up"), _("Show pop-up on errors or warnings")). - add(ON_GUIERROR_IGNORE, _("Ignore errors"), _("Hide all error and warning messages")); - - - //a proper set-method may be in order some time... - setEnumVal(enumDelhandDescr, *m_choiceHandleDeletion, syncCfg.handleDeletion); - customDelFolder.setName(utfCvrtTo<wxString>(syncCfg.customDeletionDirectory)); + versioningFolder.setName(utfCvrtTo<wxString>(syncCfg.versioningDirectory)); + //map single parameter "version limit" to both checkbox and spin ctrl: + m_checkBoxVersionsLimit->SetValue(syncCfg.versionCountLimit >= 0); + m_spinCtrlVersionsLimit->SetValue(syncCfg.versionCountLimit >= 0 ? syncCfg.versionCountLimit : 10 /*SyncConfig().versionCountLimit*/); updateGui(); //error handling if (handleError) - setEnumVal(enumErrhandDescr, *m_choiceHandleError, *handleError); + handleGuiError = *handleError; else { sbSizerErrorHandling->Show(false); @@ -236,7 +225,7 @@ SyncCfgDialog::SyncCfgDialog(wxWindow* parent, if (execWhenFinished) { - m_comboBoxExecFinished->setHistoryRef(*execWhenFinished->history); + m_comboBoxExecFinished->initHistory(*execWhenFinished->history, execWhenFinished->historyMax); m_comboBoxExecFinished->setValue(*execWhenFinished->command); } else @@ -263,13 +252,13 @@ SyncCfgDialog::SyncCfgDialog(wxWindow* parent, Fit(); } -//################################################################################################################# +//################################################################################################################# void SyncCfgDialog::updateGui() { //wxWindowUpdateLocker dummy(this); //avoid display distortion - wxWindowUpdateLocker dummy2(m_panelCustomDeletionDir); //avoid display distortion + wxWindowUpdateLocker dummy2(m_panelVersioning); //avoid display distortion wxWindowUpdateLocker dummy3(m_bpButtonLeftOnly); wxWindowUpdateLocker dummy4(m_bpButtonRightOnly); wxWindowUpdateLocker dummy5(m_bpButtonLeftNewer); @@ -277,137 +266,123 @@ void SyncCfgDialog::updateGui() wxWindowUpdateLocker dummy7(m_bpButtonDifferent); wxWindowUpdateLocker dummy8(m_bpButtonConflict); - updateConfigIcons(currentDirectionCfg, + updateConfigIcons(directionCfg, m_bpButtonLeftOnly, m_bpButtonRightOnly, m_bpButtonLeftNewer, m_bpButtonRightNewer, m_bpButtonDifferent, - m_bpButtonConflict, - m_bitmapLeftOnly, - m_bitmapRightOnly, - m_bitmapLeftNewer, - m_bitmapRightNewer, - m_bitmapDifferent, - m_bitmapConflict); + m_bpButtonConflict); //display only relevant sync options - m_bitmapDatabase->Show(true); - sbSizerSyncDirections->Show(true); + m_bitmapDatabase ->Show(directionCfg.var == DirectionConfig::AUTOMATIC); + sbSizerSyncDirections->Show(directionCfg.var != DirectionConfig::AUTOMATIC); - if (currentDirectionCfg.var == DirectionConfig::AUTOMATIC) - { - sbSizerSyncDirections->Show(false); - } - else + switch (cmpVariant) { - m_bitmapDatabase->Show(false); - switch (cmpVariant) - { - case CMP_BY_TIME_SIZE: - bSizerDifferent ->Show(false); - break; + case CMP_BY_TIME_SIZE: + bSizerDifferent ->Show(false); + break; - case CMP_BY_CONTENT: - bSizerLeftNewer ->Show(false); - bSizerRightNewer->Show(false); - break; - } + case CMP_BY_CONTENT: + bSizerLeftNewer ->Show(false); + bSizerRightNewer->Show(false); + break; } - //set radiobuttons -> have no parameter-ownership at all! + //update toggle buttons -> they have no parameter-ownership at all! m_staticTextAutomatic->SetForegroundColour(wxSystemSettings::GetColour(wxSYS_COLOUR_GRAYTEXT)); m_staticTextMirror ->SetForegroundColour(wxSystemSettings::GetColour(wxSYS_COLOUR_GRAYTEXT)); m_staticTextUpdate ->SetForegroundColour(wxSystemSettings::GetColour(wxSYS_COLOUR_GRAYTEXT)); m_staticTextCustom ->SetForegroundColour(wxSystemSettings::GetColour(wxSYS_COLOUR_GRAYTEXT)); - switch (currentDirectionCfg.var) + + m_toggleBtnAutomatic->SetValue(false); + m_toggleBtnMirror ->SetValue(false); + m_toggleBtnUpdate ->SetValue(false); + m_toggleBtnCustom ->SetValue(false); + + switch (directionCfg.var) { case DirectionConfig::AUTOMATIC: - m_radioBtnAutomatic->SetValue(true); //automatic mode + m_toggleBtnAutomatic->SetValue(true); m_staticTextAutomatic->SetForegroundColour(wxSystemSettings::GetColour(wxSYS_COLOUR_WINDOWTEXT)); break; case DirectionConfig::MIRROR: - m_radioBtnMirror->SetValue(true); //one way -> + m_toggleBtnMirror->SetValue(true); m_staticTextMirror->SetForegroundColour(wxSystemSettings::GetColour(wxSYS_COLOUR_WINDOWTEXT)); break; case DirectionConfig::UPDATE: - m_radioBtnUpdate->SetValue(true); //Update -> + m_toggleBtnUpdate->SetValue(true); m_staticTextUpdate->SetForegroundColour(wxSystemSettings::GetColour(wxSYS_COLOUR_WINDOWTEXT)); break; case DirectionConfig::CUSTOM: - m_radioBtnCustom->SetValue(true); //custom + m_toggleBtnCustom->SetValue(true); m_staticTextCustom->SetForegroundColour(wxSystemSettings::GetColour(wxSYS_COLOUR_WINDOWTEXT)); break; } + m_toggleBtnPermanent ->SetValue(false); + m_toggleBtnRecycler ->SetValue(false); + m_toggleBtnVersioning->SetValue(false); + switch (handleDeletion) + { + case DELETE_PERMANENTLY: + m_toggleBtnPermanent->SetValue(true); + break; + case DELETE_TO_RECYCLER: + m_toggleBtnRecycler->SetValue(true); + break; + case DELETE_TO_VERSIONING: + m_toggleBtnVersioning->SetValue(true); + break; + } + + m_panelVersioning ->Show(handleDeletion == DELETE_TO_VERSIONING); + m_checkBoxVersionsLimit->Show(handleDeletion == DELETE_TO_VERSIONING); + m_spinCtrlVersionsLimit->Show(handleDeletion == DELETE_TO_VERSIONING); + m_spinCtrlVersionsLimit->Enable(m_checkBoxVersionsLimit->GetValue()); + + m_toggleBtnErrorIgnore->SetValue(false); + m_toggleBtnErrorPopup ->SetValue(false); + switch (handleGuiError) + { + case ON_GUIERROR_IGNORE: + m_toggleBtnErrorIgnore->SetValue(true); + break; + case ON_GUIERROR_POPUP: + m_toggleBtnErrorPopup->SetValue(true); + break; + } + Layout(); + Refresh(); //removes a few artifacts when toggling display of versioning folder GetSizer()->SetSizeHints(this); //this works like a charm for GTK2 with window resizing problems!!! (includes call to Fit()) - - m_panelCustomDeletionDir->Enable(getEnumVal(enumDelhandDescr, *m_choiceHandleDeletion) == zen::MOVE_TO_CUSTOM_DIRECTORY); } void SyncCfgDialog::OnApply(wxCommandEvent& event) { //write configuration to main dialog - syncCfgOut.directionCfg = currentDirectionCfg; - syncCfgOut.handleDeletion = getEnumVal(enumDelhandDescr, *m_choiceHandleDeletion); - syncCfgOut.customDeletionDirectory = utfCvrtTo<Zstring>(customDelFolder.getName()); + syncCfgOut.directionCfg = directionCfg; + syncCfgOut.handleDeletion = handleDeletion; + syncCfgOut.versioningDirectory = utfCvrtTo<Zstring>(versioningFolder.getName()); + //get single parameter "version limit" from both checkbox and spin ctrl: + syncCfgOut.versionCountLimit = m_checkBoxVersionsLimit->GetValue() ? m_spinCtrlVersionsLimit->GetValue() : -1; if (refHandleError) - *refHandleError = getEnumVal(enumErrhandDescr, *m_choiceHandleError); + *refHandleError = handleGuiError; if (refExecWhenFinished) { *refExecWhenFinished->command = m_comboBoxExecFinished->getValue(); - addValueToHistory(*refExecWhenFinished->command, *refExecWhenFinished->history, refExecWhenFinished->historyMax); + //a good place to commit current "on completion" history item + m_comboBoxExecFinished->addItemHistory(); } EndModal(ReturnSyncConfig::BUTTON_OKAY); } -void SyncCfgDialog::OnChangeErrorHandling(wxCommandEvent& event) -{ - updateTooltipEnumVal(enumErrhandDescr, *m_choiceHandleError); -} - - -void SyncCfgDialog::OnChangeDeletionHandling(wxCommandEvent& event) -{ - updateTooltipEnumVal(enumDelhandDescr, *m_choiceHandleDeletion); - updateGui(); -} - - -void SyncCfgDialog::OnSyncAutomatic(wxCommandEvent& event) -{ - currentDirectionCfg.var = DirectionConfig::AUTOMATIC; - updateGui(); -} - - -void SyncCfgDialog::OnSyncMirror(wxCommandEvent& event) -{ - currentDirectionCfg.var = DirectionConfig::MIRROR; - updateGui(); -} - - -void SyncCfgDialog::OnSyncUpdate(wxCommandEvent& event) -{ - currentDirectionCfg.var = DirectionConfig::UPDATE; - updateGui(); -} - - -void SyncCfgDialog::OnSyncCustom(wxCommandEvent& event) -{ - currentDirectionCfg.var = DirectionConfig::CUSTOM; - updateGui(); -} - - void SyncCfgDialog::OnSyncAutomaticDouble(wxMouseEvent& event) { wxCommandEvent dummy; @@ -436,7 +411,8 @@ void SyncCfgDialog::OnSyncCustomDouble(wxMouseEvent& event) OnApply(dummy); } - +namespace +{ void toggleSyncDirection(SyncDirection& current) { switch (current) @@ -492,46 +468,46 @@ void pressCustomDir(DirectionConfig& directionCfg, SyncDirection& syncdir) break; } } - +} void SyncCfgDialog::OnExLeftSideOnly(wxCommandEvent& event ) { - pressCustomDir(currentDirectionCfg, currentDirectionCfg.custom.exLeftSideOnly); + pressCustomDir(directionCfg, directionCfg.custom.exLeftSideOnly); updateGui(); } void SyncCfgDialog::OnExRightSideOnly(wxCommandEvent& event ) { - pressCustomDir(currentDirectionCfg, currentDirectionCfg.custom.exRightSideOnly); + pressCustomDir(directionCfg, directionCfg.custom.exRightSideOnly); updateGui(); } void SyncCfgDialog::OnLeftNewer(wxCommandEvent& event ) { - pressCustomDir(currentDirectionCfg, currentDirectionCfg.custom.leftNewer); + pressCustomDir(directionCfg, directionCfg.custom.leftNewer); updateGui(); } void SyncCfgDialog::OnRightNewer(wxCommandEvent& event ) { - pressCustomDir(currentDirectionCfg, currentDirectionCfg.custom.rightNewer); + pressCustomDir(directionCfg, directionCfg.custom.rightNewer); updateGui(); } void SyncCfgDialog::OnDifferent(wxCommandEvent& event ) { - pressCustomDir(currentDirectionCfg, currentDirectionCfg.custom.different); + pressCustomDir(directionCfg, directionCfg.custom.different); updateGui(); } void SyncCfgDialog::OnConflict(wxCommandEvent& event) { - pressCustomDir(currentDirectionCfg, currentDirectionCfg.custom.conflict); + pressCustomDir(directionCfg, directionCfg.custom.conflict); updateGui(); } @@ -550,4 +526,3 @@ ReturnSyncConfig::ButtonPressed zen::showSyncConfigDlg(wxWindow* parent, return static_cast<ReturnSyncConfig::ButtonPressed>(syncDlg.ShowModal()); } - diff --git a/ui/sync_cfg.h b/ui/sync_cfg.h index 3d5eb88c..350dd71e 100644 --- a/ui/sync_cfg.h +++ b/ui/sync_cfg.h @@ -1,7 +1,7 @@ // ************************************************************************** // * 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 (zhnmju123 AT gmx DOT de) - All Rights Reserved * +// * Copyright (C) ZenJu (zenju AT gmx DOT de) - All Rights Reserved * // ************************************************************************** #ifndef SYNCCONFIG_H_INCLUDED diff --git a/ui/taskbar.cpp b/ui/taskbar.cpp index 0611d739..864db24d 100644 --- a/ui/taskbar.cpp +++ b/ui/taskbar.cpp @@ -1,7 +1,7 @@ // ************************************************************************** // * 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 (zhnmju123 AT gmx DOT de) - All Rights Reserved * +// * Copyright (C) ZenJu (zenju AT gmx DOT de) - All Rights Reserved * // ************************************************************************** // #include "taskbar.h" @@ -29,8 +29,8 @@ class Taskbar::Pimpl //throw TaskbarNotAvailable public: Pimpl(const wxTopLevelWindow& window) : assocWindow(window.GetHWND()), - setStatus_ (getDllName(), setStatusFctName), - setProgress_(getDllName(), setProgressFctName) + setStatus_ (getDllName(), funName_setStatus), + setProgress_(getDllName(), funName_setProgress) { if (!assocWindow || !setProgress_ || !setStatus_) throw TaskbarNotAvailable(); @@ -73,8 +73,8 @@ public: private: void* assocWindow; //HWND - const DllFun<SetStatusFct> setStatus_; - const DllFun<SetProgressFct> setProgress_; + const DllFun<FunType_setStatus> setStatus_; + const DllFun<FunType_setProgress> setProgress_; }; #elif defined HAVE_UBUNTU_UNITY //Ubuntu unity diff --git a/ui/taskbar.h b/ui/taskbar.h index 048bf9e8..80900af4 100644 --- a/ui/taskbar.h +++ b/ui/taskbar.h @@ -1,7 +1,7 @@ // ************************************************************************** // * 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 (zhnmju123 AT gmx DOT de) - All Rights Reserved * +// * Copyright (C) ZenJu (zenju AT gmx DOT de) - All Rights Reserved * // ************************************************************************** #ifndef TASKBARPROGRESS_H_INCLUDED diff --git a/ui/tray_icon.cpp b/ui/tray_icon.cpp index cd61ae29..95df6bb3 100644 --- a/ui/tray_icon.cpp +++ b/ui/tray_icon.cpp @@ -1,7 +1,7 @@ // ************************************************************************** // * 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 (zhnmju123 AT gmx DOT de) - All Rights Reserved * +// * Copyright (C) ZenJu (zenju AT gmx DOT de) - All Rights Reserved * // ************************************************************************** #include "tray_icon.h" diff --git a/ui/tray_icon.h b/ui/tray_icon.h index 50480b54..9337a648 100644 --- a/ui/tray_icon.h +++ b/ui/tray_icon.h @@ -1,7 +1,7 @@ // ************************************************************************** // * 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 (zhnmju123 AT gmx DOT de) - All Rights Reserved * +// * Copyright (C) ZenJu (zenju AT gmx DOT de) - All Rights Reserved * // ************************************************************************** #ifndef TRAYICON_H_INCLUDED diff --git a/ui/tree_view.cpp b/ui/tree_view.cpp index e4dc022e..578690d9 100644 --- a/ui/tree_view.cpp +++ b/ui/tree_view.cpp @@ -1,7 +1,7 @@ // ************************************************************************** // * 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 (zhnmju123 AT gmx DOT de) - All Rights Reserved * +// * Copyright (C) ZenJu (zenju AT gmx DOT de) - All Rights Reserved * // ************************************************************************** #include <set> diff --git a/ui/tree_view.h b/ui/tree_view.h index 331e1f30..42970342 100644 --- a/ui/tree_view.h +++ b/ui/tree_view.h @@ -1,7 +1,7 @@ // ************************************************************************** // * 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 (zhnmju123 AT gmx DOT de) - All Rights Reserved * +// * Copyright (C) ZenJu (zenju AT gmx DOT de) - All Rights Reserved * // ************************************************************************** #ifndef TREE_H_INCLUDED_841703190201835280256673425 diff --git a/ui/triple_splitter.cpp b/ui/triple_splitter.cpp index 5783bc4f..bbbc684a 100644 --- a/ui/triple_splitter.cpp +++ b/ui/triple_splitter.cpp @@ -1,7 +1,7 @@ // ************************************************************************** // * 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 (zhnmju123 AT gmx DOT de) - All Rights Reserved * +// * Copyright (C) ZenJu (zenju AT gmx DOT de) - All Rights Reserved * // ************************************************************************** #include "triple_splitter.h" @@ -189,6 +189,10 @@ void TripleSplitter::onMouseMovement(wxMouseEvent& event) { centerOffset = activeMove->getCenterPosXStart() - getCenterPosXOptimal() + event.GetPosition().x - activeMove->getMousePosXStart(); + //CAVEAT: centerOffset is evaluated *before* normalization in getCenterPosX()! + //This can lead to the strange effect of window not immediately resizing when centerOffset is extremely off limits => normalize right here + centerOffset = getCenterPosX() - getCenterPosXOptimal(); + updateWindowSizes(); Update(); //no time to wait until idle event! } diff --git a/ui/triple_splitter.h b/ui/triple_splitter.h index e95671c7..5fd189a5 100644 --- a/ui/triple_splitter.h +++ b/ui/triple_splitter.h @@ -1,7 +1,7 @@ // ************************************************************************** // * 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 (zhnmju123 AT gmx DOT de) - All Rights Reserved * +// * Copyright (C) ZenJu (zenju AT gmx DOT de) - All Rights Reserved * // ************************************************************************** #ifndef TRIPPLE_SPLIT_HEADER_8257804292846842573942534254 diff --git a/ui/wx_form_build_hide_warnings.h b/ui/wx_form_build_hide_warnings.h index 5b852e0f..1b43db2f 100644 --- a/ui/wx_form_build_hide_warnings.h +++ b/ui/wx_form_build_hide_warnings.h @@ -1,7 +1,7 @@ // ************************************************************************** // * 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 (zhnmju123 AT gmx DOT de) - All Rights Reserved * +// * Copyright (C) ZenJu (zenju AT gmx DOT de) - All Rights Reserved * // ************************************************************************** #ifndef WX_FORM_BUILD_230948324234234 |