summaryrefslogtreecommitdiff
path: root/RealtimeSync
diff options
context:
space:
mode:
authorDaniel Wilhelm <daniel@wili.li>2014-04-18 17:29:28 +0200
committerDaniel Wilhelm <daniel@wili.li>2014-04-18 17:29:28 +0200
commit75c07011b7c4d06acd7b45dabdcd60ab9d80f385 (patch)
tree8853c3978dd152ef377e652239448b1352320206 /RealtimeSync
parent5.22 (diff)
downloadFreeFileSync-75c07011b7c4d06acd7b45dabdcd60ab9d80f385.tar.gz
FreeFileSync-75c07011b7c4d06acd7b45dabdcd60ab9d80f385.tar.bz2
FreeFileSync-75c07011b7c4d06acd7b45dabdcd60ab9d80f385.zip
5.23
Diffstat (limited to 'RealtimeSync')
-rw-r--r--RealtimeSync/RealtimeSync.icobin111386 -> 0 bytes
-rw-r--r--RealtimeSync/RealtimeSync.vcxproj264
-rw-r--r--RealtimeSync/app_icon.h40
-rw-r--r--RealtimeSync/application.cpp172
-rw-r--r--RealtimeSync/application.h25
-rw-r--r--RealtimeSync/gui_generated.cpp283
-rw-r--r--RealtimeSync/gui_generated.h117
-rw-r--r--RealtimeSync/main_dlg.cpp534
-rw-r--r--RealtimeSync/main_dlg.h80
-rw-r--r--RealtimeSync/makefile101
-rw-r--r--RealtimeSync/monitor.cpp281
-rw-r--r--RealtimeSync/monitor.h38
-rw-r--r--RealtimeSync/tray_menu.cpp342
-rw-r--r--RealtimeSync/tray_menu.h23
-rw-r--r--RealtimeSync/xml_ffs.cpp79
-rw-r--r--RealtimeSync/xml_ffs.h23
-rw-r--r--RealtimeSync/xml_proc.cpp75
-rw-r--r--RealtimeSync/xml_proc.h30
18 files changed, 0 insertions, 2507 deletions
diff --git a/RealtimeSync/RealtimeSync.ico b/RealtimeSync/RealtimeSync.ico
deleted file mode 100644
index f9012b12..00000000
--- a/RealtimeSync/RealtimeSync.ico
+++ /dev/null
Binary files differ
diff --git a/RealtimeSync/RealtimeSync.vcxproj b/RealtimeSync/RealtimeSync.vcxproj
deleted file mode 100644
index 99f64740..00000000
--- a/RealtimeSync/RealtimeSync.vcxproj
+++ /dev/null
@@ -1,264 +0,0 @@
-<?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>
- <PropertyGroup Label="Globals">
- <ProjectGuid>{A80B97E9-807C-47A1-803A-27565A1BD526}</ProjectGuid>
- <Keyword>Win32Proj</Keyword>
- <RootNamespace>RealtimeSync</RootNamespace>
- <VCTargetsPath Condition="'$(VCTargetsPath11)' != '' and '$(VSVersion)' == '' and $(VisualStudioVersion) == ''">$(VCTargetsPath11)</VCTargetsPath>
- </PropertyGroup>
- <Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
- <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration">
- <ConfigurationType>Application</ConfigurationType>
- <UseDebugLibraries>true</UseDebugLibraries>
- <CharacterSet>Unicode</CharacterSet>
- <PlatformToolset>v120_xp</PlatformToolset>
- </PropertyGroup>
- <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="Configuration">
- <ConfigurationType>Application</ConfigurationType>
- <UseDebugLibraries>true</UseDebugLibraries>
- <CharacterSet>Unicode</CharacterSet>
- <PlatformToolset>v120_xp</PlatformToolset>
- </PropertyGroup>
- <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration">
- <ConfigurationType>Application</ConfigurationType>
- <UseDebugLibraries>false</UseDebugLibraries>
- <WholeProgramOptimization>true</WholeProgramOptimization>
- <CharacterSet>Unicode</CharacterSet>
- <PlatformToolset>v120_xp</PlatformToolset>
- </PropertyGroup>
- <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="Configuration">
- <ConfigurationType>Application</ConfigurationType>
- <UseDebugLibraries>false</UseDebugLibraries>
- <WholeProgramOptimization>true</WholeProgramOptimization>
- <CharacterSet>Unicode</CharacterSet>
- <PlatformToolset>v120_xp</PlatformToolset>
- </PropertyGroup>
- <Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
- <ImportGroup Label="ExtensionSettings">
- </ImportGroup>
- <ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
- <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>
- <ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
- <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>
- <PropertyGroup Label="UserMacros" />
- <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
- <OutDir>..\BUILD\Bin\</OutDir>
- <IntDir>..\OBJ\$(ProjectName)_VCPP_$(PlatformName)_$(Configuration)\</IntDir>
- <GenerateManifest>false</GenerateManifest>
- <TargetName>$(ProjectName)_$(PlatformName)</TargetName>
- </PropertyGroup>
- <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
- <OutDir>..\BUILD\Bin\</OutDir>
- <IntDir>..\OBJ\$(ProjectName)_VCPP_$(PlatformName)_$(Configuration)\</IntDir>
- <GenerateManifest>false</GenerateManifest>
- <TargetName>$(ProjectName)_$(PlatformName)</TargetName>
- </PropertyGroup>
- <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
- <LinkIncremental>false</LinkIncremental>
- <OutDir>..\BUILD\Bin\</OutDir>
- <IntDir>..\OBJ\$(ProjectName)_VCPP_$(PlatformName)_$(Configuration)\</IntDir>
- <GenerateManifest>false</GenerateManifest>
- <TargetName>$(ProjectName)_$(PlatformName)</TargetName>
- </PropertyGroup>
- <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
- <LinkIncremental>false</LinkIncremental>
- <OutDir>..\BUILD\Bin\</OutDir>
- <IntDir>..\OBJ\$(ProjectName)_VCPP_$(PlatformName)_$(Configuration)\</IntDir>
- <GenerateManifest>false</GenerateManifest>
- <TargetName>$(ProjectName)_$(PlatformName)</TargetName>
- </PropertyGroup>
- <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
- <ClCompile>
- <PrecompiledHeader>Use</PrecompiledHeader>
- <WarningLevel>Level4</WarningLevel>
- <Optimization>Disabled</Optimization>
- <PreprocessorDefinitions>_SCL_SECURE_NO_WARNINGS;wxUSE_UNICODE;__WXMSW__;ZEN_WIN;WXINTL_NO_GETTEXT_MACRO;__WXDEBUG__;WXUSINGDLL;_DEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
- <AdditionalIncludeDirectories>C:\Data\C++\Boost;C:\Data\C++\wxWidgets\include;C:\Data\C++\wxWidgets\lib\vc12_x86_debug_dll\mswud;..</AdditionalIncludeDirectories>
- <PrecompiledHeaderFile>wx+/pch.h</PrecompiledHeaderFile>
- <DisableSpecificWarnings>4100;4512</DisableSpecificWarnings>
- <MultiProcessorCompilation>true</MultiProcessorCompilation>
- <PrecompiledHeaderOutputFile>$(IntDir)pch.obj</PrecompiledHeaderOutputFile>
- <ForcedIncludeFiles>zen/warn_static.h;wx+/pch.h</ForcedIncludeFiles>
- <DebugInformationFormat>EditAndContinue</DebugInformationFormat>
- <MinimalRebuild>false</MinimalRebuild>
- <SmallerTypeCheck>true</SmallerTypeCheck>
- </ClCompile>
- <Link>
- <SubSystem>Windows</SubSystem>
- <GenerateDebugInformation>true</GenerateDebugInformation>
- <OutputFile>$(OutDir)$(TargetName)$(TargetExt)</OutputFile>
- <AdditionalDependencies>wxmsw29ud_adv.lib;wxmsw29ud_core.lib;wxbase29ud.lib;wxpngd.lib;wxzlibd.lib;wxbase29ud_net.lib;comctl32.lib;ws2_32.lib;Rpcrt4.lib;winmm.lib;%(AdditionalDependencies)</AdditionalDependencies>
- <AdditionalLibraryDirectories>C:\Data\C++\Boost\stage\lib;C:\Data\C++\wxWidgets\lib\vc12_x86_debug_dll</AdditionalLibraryDirectories>
- </Link>
- <ResourceCompile>
- <AdditionalIncludeDirectories>C:\Data\C++\wxWidgets\include</AdditionalIncludeDirectories>
- <PreprocessorDefinitions>%(PreprocessorDefinitions);ZEN_ARCHITECTURE_X86</PreprocessorDefinitions>
- </ResourceCompile>
- </ItemDefinitionGroup>
- <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
- <ClCompile>
- <PrecompiledHeader>Use</PrecompiledHeader>
- <WarningLevel>Level4</WarningLevel>
- <Optimization>Disabled</Optimization>
- <PreprocessorDefinitions>_SCL_SECURE_NO_WARNINGS;wxUSE_UNICODE;__WXMSW__;ZEN_WIN;WXINTL_NO_GETTEXT_MACRO;__WXDEBUG__;WXUSINGDLL;_DEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
- <AdditionalIncludeDirectories>C:\Data\C++\Boost;C:\Data\C++\wxWidgets\include;C:\Data\C++\wxWidgets\lib\vc12_x64_debug_dll\mswud;..</AdditionalIncludeDirectories>
- <PrecompiledHeaderFile>wx+/pch.h</PrecompiledHeaderFile>
- <DisableSpecificWarnings>4100;4512</DisableSpecificWarnings>
- <MultiProcessorCompilation>true</MultiProcessorCompilation>
- <PrecompiledHeaderOutputFile>$(IntDir)pch.obj</PrecompiledHeaderOutputFile>
- <ForcedIncludeFiles>zen/warn_static.h;wx+/pch.h</ForcedIncludeFiles>
- <DebugInformationFormat>ProgramDatabase</DebugInformationFormat>
- <SuppressStartupBanner>true</SuppressStartupBanner>
- <MinimalRebuild>false</MinimalRebuild>
- <ShowIncludes>false</ShowIncludes>
- <SmallerTypeCheck>true</SmallerTypeCheck>
- </ClCompile>
- <Link>
- <SubSystem>Windows</SubSystem>
- <GenerateDebugInformation>true</GenerateDebugInformation>
- <OutputFile>$(OutDir)$(TargetName)$(TargetExt)</OutputFile>
- <AdditionalDependencies>wxmsw29ud_adv.lib;wxmsw29ud_core.lib;wxbase29ud.lib;wxpngd.lib;wxzlibd.lib;wxbase29ud_net.lib;comctl32.lib;ws2_32.lib;Rpcrt4.lib;winmm.lib;%(AdditionalDependencies)</AdditionalDependencies>
- <AdditionalLibraryDirectories>C:\Data\C++\Boost\stage_x64\lib;C:\Data\C++\wxWidgets\lib\vc12_x64_debug_dll</AdditionalLibraryDirectories>
- <LinkStatus>
- </LinkStatus>
- </Link>
- <ResourceCompile>
- <AdditionalIncludeDirectories>C:\Data\C++\wxWidgets\include</AdditionalIncludeDirectories>
- <PreprocessorDefinitions>%(PreprocessorDefinitions);ZEN_ARCHITECTURE_X64</PreprocessorDefinitions>
- </ResourceCompile>
- </ItemDefinitionGroup>
- <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
- <ClCompile>
- <WarningLevel>Level4</WarningLevel>
- <PrecompiledHeader>NotUsing</PrecompiledHeader>
- <Optimization>MaxSpeed</Optimization>
- <FunctionLevelLinking>true</FunctionLevelLinking>
- <PreprocessorDefinitions>_SCL_SECURE_NO_WARNINGS;wxUSE_UNICODE;__WXMSW__;ZEN_WIN;WXINTL_NO_GETTEXT_MACRO;NDEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
- <AdditionalIncludeDirectories>C:\Data\C++\Boost;C:\Data\C++\wxWidgets\include;C:\Data\C++\wxWidgets\lib\vc12_x86_release_lib\mswu;..</AdditionalIncludeDirectories>
- <FavorSizeOrSpeed>Speed</FavorSizeOrSpeed>
- <DisableSpecificWarnings>4100;4512;4996</DisableSpecificWarnings>
- <RuntimeLibrary>MultiThreaded</RuntimeLibrary>
- <MultiProcessorCompilation>true</MultiProcessorCompilation>
- <ForcedIncludeFiles>zen/warn_static.h</ForcedIncludeFiles>
- </ClCompile>
- <Link>
- <SubSystem>Windows</SubSystem>
- <GenerateDebugInformation>false</GenerateDebugInformation>
- <EnableCOMDATFolding>true</EnableCOMDATFolding>
- <OptimizeReferences>true</OptimizeReferences>
- <AdditionalDependencies>wxbase29u.lib;wxmsw29u_adv.lib;wxmsw29u_core.lib;wxpng.lib;wxzlib.lib;wxbase29u_net.lib;comctl32.lib;ws2_32.lib;winmm.lib;Rpcrt4.lib;%(AdditionalDependencies)</AdditionalDependencies>
- <OutputFile>$(OutDir)$(TargetName)$(TargetExt)</OutputFile>
- <AdditionalLibraryDirectories>C:\Data\C++\Boost\stage\lib;C:\Data\C++\wxWidgets\lib\vc12_x86_release_lib</AdditionalLibraryDirectories>
- </Link>
- <ResourceCompile>
- <AdditionalIncludeDirectories>C:\Data\C++\wxWidgets\include</AdditionalIncludeDirectories>
- <PreprocessorDefinitions>%(PreprocessorDefinitions);ZEN_ARCHITECTURE_X86</PreprocessorDefinitions>
- </ResourceCompile>
- <PostBuildEvent>
- <Command>"C:\Data\C++\CodeSigning\SignCode.cmd" "$(TargetPath)"</Command>
- </PostBuildEvent>
- </ItemDefinitionGroup>
- <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
- <ClCompile>
- <WarningLevel>Level4</WarningLevel>
- <PrecompiledHeader>NotUsing</PrecompiledHeader>
- <Optimization>MaxSpeed</Optimization>
- <FunctionLevelLinking>true</FunctionLevelLinking>
- <PreprocessorDefinitions>_SCL_SECURE_NO_WARNINGS;wxUSE_UNICODE;__WXMSW__;ZEN_WIN;WXINTL_NO_GETTEXT_MACRO;NDEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
- <AdditionalIncludeDirectories>C:\Data\C++\Boost;C:\Data\C++\wxWidgets\include;C:\Data\C++\wxWidgets\lib\vc12_x64_release_lib\mswu;..</AdditionalIncludeDirectories>
- <FavorSizeOrSpeed>Speed</FavorSizeOrSpeed>
- <DisableSpecificWarnings>4100;4512;4996</DisableSpecificWarnings>
- <RuntimeLibrary>MultiThreaded</RuntimeLibrary>
- <MultiProcessorCompilation>true</MultiProcessorCompilation>
- <ForcedIncludeFiles>zen/warn_static.h</ForcedIncludeFiles>
- </ClCompile>
- <Link>
- <SubSystem>Windows</SubSystem>
- <GenerateDebugInformation>false</GenerateDebugInformation>
- <EnableCOMDATFolding>true</EnableCOMDATFolding>
- <OptimizeReferences>true</OptimizeReferences>
- <AdditionalDependencies>wxmsw29u_adv.lib;wxmsw29u_core.lib;wxbase29u.lib;wxpng.lib;wxzlib.lib;wxbase29u_net.lib;comctl32.lib;ws2_32.lib;winmm.lib;Rpcrt4.lib;%(AdditionalDependencies)</AdditionalDependencies>
- <OutputFile>$(OutDir)$(TargetName)$(TargetExt)</OutputFile>
- <AdditionalLibraryDirectories>C:\Data\C++\Boost\stage_x64\lib;C:\Data\C++\wxWidgets\lib\vc12_x64_release_lib</AdditionalLibraryDirectories>
- </Link>
- <ResourceCompile>
- <AdditionalIncludeDirectories>C:\Data\C++\wxWidgets\include</AdditionalIncludeDirectories>
- <PreprocessorDefinitions>%(PreprocessorDefinitions);ZEN_ARCHITECTURE_X64</PreprocessorDefinitions>
- </ResourceCompile>
- <PostBuildEvent>
- <Command>"C:\Data\C++\CodeSigning\SignCode.cmd" "$(TargetPath)"</Command>
- </PostBuildEvent>
- </ItemDefinitionGroup>
- <ItemGroup>
- <ClCompile Include="..\lib\ffs_paths.cpp" />
- <ClCompile Include="..\lib\localization.cpp" />
- <ClCompile Include="..\lib\process_xml.cpp" />
- <ClCompile Include="..\lib\resolve_path.cpp" />
- <ClCompile Include="..\lib\xml_base.cpp" />
- <ClCompile Include="..\structures.cpp" />
- <ClCompile Include="..\ui\dir_name.cpp" />
- <ClCompile Include="..\ui\folder_history_box.cpp" />
- <ClCompile Include="..\wx+\create_pch.cpp">
- <PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">Create</PrecompiledHeader>
- <PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">Create</PrecompiledHeader>
- </ClCompile>
- <ClCompile Include="..\wx+\image_resources.cpp" />
- <ClCompile Include="..\wx+\image_tools.cpp" />
- <ClCompile Include="..\wx+\mouse_move_dlg.cpp" />
- <ClCompile Include="..\wx+\popup_dlg.cpp" />
- <ClCompile Include="..\wx+\popup_dlg_generated.cpp" />
- <ClCompile Include="..\zen\debug_memory_leaks.cpp" />
- <ClCompile Include="..\zen\dir_watcher.cpp" />
- <ClCompile Include="..\zen\dst_hack.cpp" />
- <ClCompile Include="..\zen\file_handling.cpp" />
- <ClCompile Include="..\zen\file_io.cpp" />
- <ClCompile Include="..\zen\file_traverser.cpp" />
- <ClCompile Include="..\zen\format_unit.cpp" />
- <ClCompile Include="..\zen\notify_removal.cpp" />
- <ClCompile Include="..\zen\privilege.cpp" />
- <ClCompile Include="..\zen\scroll_window_under_cursor.cpp" />
- <ClCompile Include="..\zen\zstring.cpp" />
- <ClCompile Include="application.cpp" />
- <ClCompile Include="gui_generated.cpp" />
- <ClCompile Include="main_dlg.cpp" />
- <ClCompile Include="monitor.cpp" />
- <ClCompile Include="tray_menu.cpp" />
- <ClCompile Include="xml_ffs.cpp" />
- <ClCompile Include="xml_proc.cpp" />
- </ItemGroup>
- <ItemGroup>
- <ResourceCompile Include="resource.rc" />
- </ItemGroup>
- <ItemGroup>
- <None Include="RealtimeSync.fbp" />
- </ItemGroup>
- <Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
- <ImportGroup Label="ExtensionTargets">
- </ImportGroup>
-</Project> \ No newline at end of file
diff --git a/RealtimeSync/app_icon.h b/RealtimeSync/app_icon.h
deleted file mode 100644
index fcd2b548..00000000
--- a/RealtimeSync/app_icon.h
+++ /dev/null
@@ -1,40 +0,0 @@
-// **************************************************************************
-// * This file is part of the FreeFileSync project. It is distributed under *
-// * GNU General Public License: http://www.gnu.org/licenses/gpl.html *
-// * Copyright (C) Zenju (zenju AT gmx DOT de) - All Rights Reserved *
-// **************************************************************************
-
-#ifndef RTS_APP_ICON_8914578394545
-#define RTS_APP_ICON_8914578394545
-
-#include <wx/icon.h>
-#include <wx+/image_resources.h>
-
-namespace zen
-{
-inline
-wxIcon getRtsIcon()
-{
- //wxWidgets' bitmap to icon conversion on OS X can only deal with very specific sizes => check on all platforms!
- assert(getResourceImage(L"RealtimeSync").GetWidth () == getResourceImage(L"RealtimeSync").GetHeight() &&
- getResourceImage(L"RealtimeSync").GetWidth() % 128 == 0);
-#ifdef ZEN_WIN
- //for compatibility it seems we need to stick with a "real" icon
- return wxIcon(L"A_RTS_ICON");
-
-#elif defined ZEN_LINUX
- //attention: make sure to not implicitly call "instance()" again => deadlock on Linux
- wxIcon icon;
- icon.CopyFromBitmap(getResourceImage(L"RealtimeSync")); //use big logo bitmap for better quality
- return icon;
-
-#elif defined ZEN_MAC
- wxIcon icon;
- icon.CopyFromBitmap(getResourceImage(L"RealtimeSync").ConvertToImage().Scale(128, 128, wxIMAGE_QUALITY_HIGH)); //"von hinten durch die Brust ins Auge"
- return icon;
-#endif
-}
-}
-
-
-#endif //RTS_APP_ICON_8914578394545
diff --git a/RealtimeSync/application.cpp b/RealtimeSync/application.cpp
deleted file mode 100644
index a0d693d6..00000000
--- a/RealtimeSync/application.cpp
+++ /dev/null
@@ -1,172 +0,0 @@
-// **************************************************************************
-// * This file is part of the FreeFileSync project. It is distributed under *
-// * GNU General Public License: http://www.gnu.org/licenses/gpl.html *
-// * Copyright (C) Zenju (zenju AT gmx DOT de) - All Rights Reserved *
-// **************************************************************************
-
-#include "application.h"
-#include "main_dlg.h"
-#include <zen/file_handling.h>
-#include <zen/thread.h>
-#include <wx/event.h>
-#include <wx/log.h>
-#include <wx/tooltip.h>
-#include <wx+/string_conv.h>
-#include <wx+/popup_dlg.h>
-#include <wx+/image_resources.h>
-#include "xml_ffs.h"
-#include "../lib/localization.h"
-#include "../lib/ffs_paths.h"
-#include "../lib/return_codes.h"
-#include "lib/error_log.h"
-
-#ifdef ZEN_WIN
-#include <zen/win_ver.h>
-
-#elif defined ZEN_LINUX
-#include <gtk/gtk.h>
-#endif
-
-using namespace zen;
-
-
-IMPLEMENT_APP(Application);
-
-namespace
-{
-/*
-boost::thread::id mainThreadId = boost::this_thread::get_id();
-
-void onTerminationRequested()
-{
-std::wstring msg = boost::this_thread::get_id() == mainThreadId ?
- L"Termination requested in main thread!\n\n" :
- L"Termination requested in worker thread!\n\n";
-msg += L"Please file a bug report at: http://sourceforge.net/projects/freefilesync";
-
-wxSafeShowMessage(_("An exception occurred"), msg);
-std::abort();
-}
-*/
-#ifdef _MSC_VER
-void crtInvalidParameterHandler(const wchar_t* expression, const wchar_t* function, const wchar_t* file, unsigned int line, uintptr_t pReserved) { assert(false); }
-#endif
-
-const wxEventType EVENT_ENTER_EVENT_LOOP = wxNewEventType();
-}
-
-
-bool Application::OnInit()
-{
- //std::set_terminate(onTerminationRequested); //unlike wxWidgets uncaught exception handling, this works for all worker threads
-
-#ifdef ZEN_WIN
-#ifdef _MSC_VER
- _set_invalid_parameter_handler(crtInvalidParameterHandler); //see comment in <zen/time.h>
-#endif
- //Quote: "Best practice is that all applications call the process-wide SetErrorMode function with a parameter of
- //SEM_FAILCRITICALERRORS at startup. This is to prevent error mode dialogs from hanging the application."
- ::SetErrorMode(SEM_FAILCRITICALERRORS);
-
-#elif defined ZEN_LINUX
- ::gtk_rc_parse((zen::getResourceDir() + "styles.gtk_rc").c_str()); //remove inner border from bitmap buttons
-#endif
-
-#ifdef ZEN_WIN
- wxToolTip::SetMaxWidth(-1); //disable tooltip wrapping -> Windows only
-#endif
- //Windows User Experience Interaction Guidelines: tool tips should have 5s timeout, info tips no timeout => compromise:
- wxToolTip::SetAutoPop(7000); //http://msdn.microsoft.com/en-us/library/windows/desktop/aa511495.aspx
-
- SetAppName(L"RealtimeSync");
-
- initResourceImages(getResourceDir() + Zstr("Resources.zip"));
-
- //do not call wxApp::OnInit() to avoid using default commandline parser
-
- //Note: app start is deferred: -> see FreeFileSync
- Connect(EVENT_ENTER_EVENT_LOOP, wxEventHandler(Application::onEnterEventLoop), nullptr, this);
- wxCommandEvent scrollEvent(EVENT_ENTER_EVENT_LOOP);
- AddPendingEvent(scrollEvent);
-
- return true; //true: continue processing; false: exit immediately.
-}
-
-
-int Application::OnExit()
-{
- releaseWxLocale();
- return wxApp::OnExit();
-}
-
-
-void Application::onEnterEventLoop(wxEvent& event)
-{
- Disconnect(EVENT_ENTER_EVENT_LOOP, wxEventHandler(Application::onEnterEventLoop), nullptr, this);
-
- try
- {
- setLanguage(rts::getProgramLanguage()); //throw FileError
- }
- catch (const FileError& e)
- {
- showNotificationDialog(nullptr, DialogInfoType::ERROR2, PopupDialogCfg().setDetailInstructions(e.toString()));
- //continue!
- }
-
- //try to set config/batch-filename set by %1 parameter
- std::vector<Zstring> commandArgs;
- for (int i = 1; i < argc; ++i)
- {
- Zstring filename = toZ(argv[i]);
-
- if (!fileExists(filename)) //be a little tolerant
- {
- if (fileExists(filename + Zstr(".ffs_real")))
- filename += Zstr(".ffs_real");
- else if (fileExists(filename + Zstr(".ffs_batch")))
- filename += Zstr(".ffs_batch");
- else
- {
- showNotificationDialog(nullptr, DialogInfoType::ERROR2, PopupDialogCfg().setMainInstructions(replaceCpy(_("Cannot open file %x."), L"%x", fmtFileName(filename))));
- return;
- }
- }
- commandArgs.push_back(filename);
- }
-
- Zstring cfgFilename;
- if (!commandArgs.empty())
- cfgFilename = commandArgs[0];
-
- MainDialog::create(cfgFilename);
-}
-
-
-int Application::OnRun()
-{
-
- auto processException = [](const std::wstring& msg)
- {
- //it's not always possible to display a message box, e.g. corrupted stack, however low-level file output works!
- logError(utfCvrtTo<std::string>(msg));
- wxSafeShowMessage(_("An exception occurred"), msg);
- };
-
- try
- {
- wxApp::OnRun();
- }
- catch (const std::exception& e) //catch all STL exceptions
- {
- processException(utfCvrtTo<std::wstring>(e.what()));
- return FFS_RC_EXCEPTION;
- }
- catch (...) //catch the rest
- {
- processException(L"Unknown error.");
- return FFS_RC_EXCEPTION;
- }
-
- return FFS_RC_SUCCESS; //program's return code
-}
diff --git a/RealtimeSync/application.h b/RealtimeSync/application.h
deleted file mode 100644
index 2edef90c..00000000
--- a/RealtimeSync/application.h
+++ /dev/null
@@ -1,25 +0,0 @@
-// **************************************************************************
-// * This file is part of the FreeFileSync project. It is distributed under *
-// * GNU General Public License: http://www.gnu.org/licenses/gpl.html *
-// * Copyright (C) Zenju (zenju AT gmx DOT de) - All Rights Reserved *
-// **************************************************************************
-
-#ifndef REALTIMESYNCAPP_H
-#define REALTIMESYNCAPP_H
-
-#include <wx/app.h>
-
-class Application : public wxApp
-{
-public:
- virtual bool OnInit();
- virtual int OnExit();
- virtual int OnRun();
- virtual bool OnExceptionInMainLoop() { throw; } //just re-throw and avoid display of additional messagebox: it will be caught in OnRun()
-
-private:
- void onEnterEventLoop(wxEvent& event);
- //virtual wxLayoutDirection GetLayoutDirection() const { return wxLayout_LeftToRight; }
-};
-
-#endif // REALTIMESYNCAPP_H
diff --git a/RealtimeSync/gui_generated.cpp b/RealtimeSync/gui_generated.cpp
deleted file mode 100644
index 3b3ad3fe..00000000
--- a/RealtimeSync/gui_generated.cpp
+++ /dev/null
@@ -1,283 +0,0 @@
-///////////////////////////////////////////////////////////////////////////
-// C++ code generated with wxFormBuilder (version Oct 8 2012)
-// http://www.wxformbuilder.org/
-//
-// PLEASE DO "NOT" EDIT THIS FILE!
-///////////////////////////////////////////////////////////////////////////
-
-#include "../wx+/bitmap_button.h"
-
-#include "gui_generated.h"
-
-///////////////////////////////////////////////////////////////////////////
-
-MainDlgGenerated::MainDlgGenerated( 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( -1,-1 ), wxDefaultSize );
- this->SetBackgroundColour( wxSystemSettings::GetColour( wxSYS_COLOUR_BTNFACE ) );
-
- m_menubar1 = new wxMenuBar( 0 );
- m_menuFile = new wxMenu();
- wxMenuItem* m_menuItem13;
- m_menuItem13 = new wxMenuItem( m_menuFile, wxID_OPEN, wxString( _("&Open...") ) + wxT('\t') + wxT("CTRL+O"), wxEmptyString, wxITEM_NORMAL );
- m_menuFile->Append( m_menuItem13 );
-
- wxMenuItem* m_menuItem14;
- m_menuItem14 = new wxMenuItem( m_menuFile, wxID_SAVEAS, wxString( _("Save &as...") ) , wxEmptyString, wxITEM_NORMAL );
- m_menuFile->Append( m_menuItem14 );
-
- m_menuFile->AppendSeparator();
-
- wxMenuItem* m_menuItem4;
- m_menuItem4 = new wxMenuItem( m_menuFile, wxID_EXIT, wxString( _("&Quit") ) , wxEmptyString, wxITEM_NORMAL );
- m_menuFile->Append( m_menuItem4 );
-
- m_menubar1->Append( m_menuFile, _("&Program") );
-
- m_menuHelp = new wxMenu();
- wxMenuItem* m_menuItemContent;
- m_menuItemContent = new wxMenuItem( m_menuHelp, wxID_HELP, wxString( _("&View help") ) + wxT('\t') + wxT("F1"), wxEmptyString, wxITEM_NORMAL );
- m_menuHelp->Append( m_menuItemContent );
-
- m_menuHelp->AppendSeparator();
-
- m_menuItemAbout = new wxMenuItem( m_menuHelp, wxID_ABOUT, wxString( _("&About") ) + wxT('\t') + wxT("SHIFT+F1"), wxEmptyString, wxITEM_NORMAL );
- m_menuHelp->Append( m_menuItemAbout );
-
- m_menubar1->Append( m_menuHelp, _("&Help") );
-
- this->SetMenuBar( m_menubar1 );
-
- bSizerMain = new wxBoxSizer( wxVERTICAL );
-
- wxBoxSizer* bSizer161;
- bSizer161 = new wxBoxSizer( wxVERTICAL );
-
- wxBoxSizer* bSizer16;
- bSizer16 = new wxBoxSizer( wxHORIZONTAL );
-
- m_staticText9 = new wxStaticText( this, wxID_ANY, _("Usage:"), wxDefaultPosition, wxDefaultSize, 0 );
- m_staticText9->Wrap( -1 );
- m_staticText9->SetFont( wxFont( wxNORMAL_FONT->GetPointSize(), 70, 90, 92, false, wxEmptyString ) );
-
- bSizer16->Add( m_staticText9, 0, wxALL, 5 );
-
- wxBoxSizer* bSizer15;
- bSizer15 = new wxBoxSizer( wxVERTICAL );
-
- m_staticText3 = new wxStaticText( this, wxID_ANY, _("1. Select folders to watch."), wxDefaultPosition, wxDefaultSize, 0 );
- m_staticText3->Wrap( -1 );
- bSizer15->Add( m_staticText3, 0, 0, 5 );
-
- m_staticText4 = new wxStaticText( this, wxID_ANY, _("2. Enter a command line."), wxDefaultPosition, wxDefaultSize, 0 );
- m_staticText4->Wrap( -1 );
- bSizer15->Add( m_staticText4, 0, 0, 5 );
-
- m_staticText5 = new wxStaticText( this, wxID_ANY, _("3. Press 'Start'."), wxDefaultPosition, wxDefaultSize, 0 );
- m_staticText5->Wrap( -1 );
- bSizer15->Add( m_staticText5, 0, 0, 5 );
-
-
- bSizer16->Add( bSizer15, 0, wxALL, 5 );
-
-
- bSizer161->Add( bSizer16, 0, 0, 5 );
-
- m_staticText811 = new wxStaticText( this, wxID_ANY, _("To get started just import a .ffs_batch file."), wxDefaultPosition, wxDefaultSize, 0 );
- m_staticText811->Wrap( -1 );
- m_staticText811->SetForegroundColour( wxSystemSettings::GetColour( wxSYS_COLOUR_GRAYTEXT ) );
-
- bSizer161->Add( m_staticText811, 0, wxALIGN_CENTER_HORIZONTAL|wxBOTTOM|wxRIGHT|wxLEFT, 5 );
-
-
- bSizerMain->Add( bSizer161, 0, wxALL|wxEXPAND, 5 );
-
- m_staticline2 = new wxStaticLine( this, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxLI_HORIZONTAL );
- bSizerMain->Add( m_staticline2, 0, wxEXPAND, 5 );
-
- m_panelMain = new wxPanel( this, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxTAB_TRAVERSAL );
- m_panelMain->SetBackgroundColour( wxSystemSettings::GetColour( wxSYS_COLOUR_WINDOW ) );
-
- wxBoxSizer* bSizer1;
- bSizer1 = new wxBoxSizer( wxVERTICAL );
-
- wxBoxSizer* bSizer151;
- bSizer151 = new wxBoxSizer( wxVERTICAL );
-
- m_staticText7 = new wxStaticText( m_panelMain, wxID_ANY, _("Folders to watch:"), wxDefaultPosition, wxDefaultSize, 0 );
- m_staticText7->Wrap( -1 );
- bSizer151->Add( m_staticText7, 0, wxALL, 5 );
-
- m_panelMainFolder = new wxPanel( m_panelMain, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxTAB_TRAVERSAL );
- m_panelMainFolder->SetBackgroundColour( wxSystemSettings::GetColour( wxSYS_COLOUR_WINDOW ) );
-
- wxFlexGridSizer* fgSizer1;
- fgSizer1 = new wxFlexGridSizer( 0, 2, 0, 0 );
- fgSizer1->AddGrowableCol( 1 );
- fgSizer1->SetFlexibleDirection( wxBOTH );
- fgSizer1->SetNonFlexibleGrowMode( wxFLEX_GROWMODE_ALL );
-
-
- fgSizer1->Add( 0, 0, 1, wxEXPAND, 5 );
-
- m_staticTextFinalPath = new wxStaticText( m_panelMainFolder, wxID_ANY, _("dummy"), wxDefaultPosition, wxDefaultSize, 0 );
- m_staticTextFinalPath->Wrap( -1 );
- fgSizer1->Add( m_staticTextFinalPath, 0, wxALIGN_CENTER_VERTICAL|wxALL, 2 );
-
- wxBoxSizer* bSizer20;
- bSizer20 = new wxBoxSizer( wxHORIZONTAL );
-
- m_bpButtonAddFolder = new wxBitmapButton( m_panelMainFolder, wxID_ANY, wxNullBitmap, wxDefaultPosition, wxSize( 25,25 ), wxBU_AUTODRAW );
- m_bpButtonAddFolder->SetToolTip( _("Add folder") );
-
- bSizer20->Add( m_bpButtonAddFolder, 0, wxALIGN_CENTER_HORIZONTAL|wxALIGN_CENTER_VERTICAL, 5 );
-
- m_bpButtonRemoveTopFolder = new wxBitmapButton( m_panelMainFolder, wxID_ANY, wxNullBitmap, wxDefaultPosition, wxSize( 25,25 ), wxBU_AUTODRAW );
- m_bpButtonRemoveTopFolder->SetToolTip( _("Remove folder") );
-
- bSizer20->Add( m_bpButtonRemoveTopFolder, 0, wxALIGN_CENTER_HORIZONTAL|wxALIGN_CENTER_VERTICAL, 5 );
-
-
- fgSizer1->Add( bSizer20, 0, wxALIGN_CENTER_HORIZONTAL|wxALIGN_CENTER_VERTICAL, 5 );
-
- wxBoxSizer* bSizer19;
- bSizer19 = new wxBoxSizer( wxHORIZONTAL );
-
- m_txtCtrlDirectoryMain = new wxTextCtrl( m_panelMainFolder, wxID_ANY, wxEmptyString, wxDefaultPosition, wxSize( 300,-1 ), 0 );
- m_txtCtrlDirectoryMain->SetMaxLength( 0 );
- bSizer19->Add( m_txtCtrlDirectoryMain, 1, wxALIGN_CENTER_VERTICAL, 5 );
-
- m_buttonSelectDirMain = new wxButton( m_panelMainFolder, wxID_ANY, _("Browse"), wxDefaultPosition, wxDefaultSize, 0 );
- m_buttonSelectDirMain->SetToolTip( _("Select a folder") );
-
- bSizer19->Add( m_buttonSelectDirMain, 0, wxALIGN_CENTER_VERTICAL, 5 );
-
-
- fgSizer1->Add( bSizer19, 0, wxEXPAND|wxALIGN_CENTER_VERTICAL, 5 );
-
-
- m_panelMainFolder->SetSizer( fgSizer1 );
- m_panelMainFolder->Layout();
- fgSizer1->Fit( m_panelMainFolder );
- bSizer151->Add( m_panelMainFolder, 0, wxRIGHT|wxLEFT|wxEXPAND, 5 );
-
- m_scrolledWinFolders = new wxScrolledWindow( m_panelMain, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxHSCROLL|wxVSCROLL );
- m_scrolledWinFolders->SetScrollRate( 10, 10 );
- m_scrolledWinFolders->SetBackgroundColour( wxSystemSettings::GetColour( wxSYS_COLOUR_WINDOW ) );
-
- bSizerFolders = new wxBoxSizer( wxVERTICAL );
-
-
- m_scrolledWinFolders->SetSizer( bSizerFolders );
- m_scrolledWinFolders->Layout();
- bSizerFolders->Fit( m_scrolledWinFolders );
- bSizer151->Add( m_scrolledWinFolders, 1, wxEXPAND|wxBOTTOM|wxRIGHT|wxLEFT, 5 );
-
-
- bSizer1->Add( bSizer151, 1, wxALL|wxEXPAND, 5 );
-
- m_staticline212 = new wxStaticLine( m_panelMain, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxLI_HORIZONTAL );
- bSizer1->Add( m_staticline212, 0, wxEXPAND, 5 );
-
- wxBoxSizer* bSizer14;
- bSizer14 = new wxBoxSizer( wxHORIZONTAL );
-
- m_staticText8 = new wxStaticText( m_panelMain, wxID_ANY, _("Idle time (in seconds):"), wxDefaultPosition, wxDefaultSize, 0 );
- m_staticText8->Wrap( -1 );
- bSizer14->Add( m_staticText8, 0, wxALIGN_CENTER_VERTICAL|wxTOP|wxBOTTOM|wxLEFT, 5 );
-
- m_spinCtrlDelay = new wxSpinCtrl( m_panelMain, wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, wxSP_ARROW_KEYS, 0, 2000000000, 0 );
- m_spinCtrlDelay->SetToolTip( _("Idle time between last detected change and execution of command") );
-
- bSizer14->Add( m_spinCtrlDelay, 0, wxALIGN_CENTER_HORIZONTAL|wxALIGN_CENTER_VERTICAL|wxALL, 5 );
-
-
- bSizer1->Add( bSizer14, 0, wxALIGN_RIGHT|wxEXPAND|wxALL, 5 );
-
- m_staticline211 = new wxStaticLine( m_panelMain, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxLI_HORIZONTAL );
- bSizer1->Add( m_staticline211, 0, wxEXPAND, 5 );
-
- wxBoxSizer* bSizer141;
- bSizer141 = new wxBoxSizer( wxVERTICAL );
-
- m_staticText6 = new wxStaticText( m_panelMain, wxID_ANY, _("Command line:"), wxDefaultPosition, wxDefaultSize, 0 );
- m_staticText6->Wrap( -1 );
- bSizer141->Add( m_staticText6, 0, wxALL, 5 );
-
- m_textCtrlCommand = new wxTextCtrl( m_panelMain, wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0 );
- m_textCtrlCommand->SetMaxLength( 0 );
- m_textCtrlCommand->SetToolTip( _("The command is triggered if:\n- files or subfolders change\n- new folders arrive (e.g. USB stick insert)") );
-
- bSizer141->Add( m_textCtrlCommand, 0, wxBOTTOM|wxRIGHT|wxLEFT|wxEXPAND, 5 );
-
-
- bSizer1->Add( bSizer141, 0, wxALL|wxEXPAND, 5 );
-
-
- m_panelMain->SetSizer( bSizer1 );
- m_panelMain->Layout();
- bSizer1->Fit( m_panelMain );
- bSizerMain->Add( m_panelMain, 1, wxEXPAND, 5 );
-
- m_staticline5 = new wxStaticLine( this, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxLI_HORIZONTAL );
- bSizerMain->Add( m_staticline5, 0, wxEXPAND, 5 );
-
- m_buttonStart = new zen::BitmapTextButton( this, wxID_OK, _("&Start"), wxDefaultPosition, wxSize( -1,-1 ), 0 );
- m_buttonStart->SetDefault();
- m_buttonStart->SetFont( wxFont( wxNORMAL_FONT->GetPointSize(), 70, 90, 92, false, wxEmptyString ) );
-
- bSizerMain->Add( m_buttonStart, 0, wxALIGN_CENTER_HORIZONTAL|wxALL, 5 );
-
-
- this->SetSizer( bSizerMain );
- this->Layout();
- bSizerMain->Fit( this );
-
- this->Centre( wxBOTH );
-
- // Connect Events
- this->Connect( wxEVT_CLOSE_WINDOW, wxCloseEventHandler( MainDlgGenerated::OnClose ) );
- this->Connect( m_menuItem13->GetId(), wxEVT_COMMAND_MENU_SELECTED, wxCommandEventHandler( MainDlgGenerated::OnConfigLoad ) );
- this->Connect( m_menuItem14->GetId(), wxEVT_COMMAND_MENU_SELECTED, wxCommandEventHandler( MainDlgGenerated::OnConfigSave ) );
- this->Connect( m_menuItem4->GetId(), wxEVT_COMMAND_MENU_SELECTED, wxCommandEventHandler( MainDlgGenerated::OnMenuQuit ) );
- this->Connect( m_menuItemContent->GetId(), wxEVT_COMMAND_MENU_SELECTED, wxCommandEventHandler( MainDlgGenerated::OnShowHelp ) );
- this->Connect( m_menuItemAbout->GetId(), wxEVT_COMMAND_MENU_SELECTED, wxCommandEventHandler( MainDlgGenerated::OnMenuAbout ) );
- m_bpButtonAddFolder->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( MainDlgGenerated::OnAddFolder ), NULL, this );
- m_bpButtonRemoveTopFolder->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( MainDlgGenerated::OnRemoveTopFolder ), NULL, this );
- m_buttonStart->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( MainDlgGenerated::OnStart ), NULL, this );
-}
-
-MainDlgGenerated::~MainDlgGenerated()
-{
-}
-
-FolderGenerated::FolderGenerated( wxWindow* parent, wxWindowID id, const wxPoint& pos, const wxSize& size, long style ) : wxPanel( parent, id, pos, size, style )
-{
- this->SetBackgroundColour( wxSystemSettings::GetColour( wxSYS_COLOUR_WINDOW ) );
-
- wxBoxSizer* bSizer114;
- bSizer114 = new wxBoxSizer( wxHORIZONTAL );
-
- m_bpButtonRemoveFolder = new wxBitmapButton( this, wxID_ANY, wxNullBitmap, wxDefaultPosition, wxSize( 25,25 ), wxBU_AUTODRAW );
- m_bpButtonRemoveFolder->SetToolTip( _("Remove folder") );
-
- bSizer114->Add( m_bpButtonRemoveFolder, 0, wxALIGN_CENTER_VERTICAL, 5 );
-
- m_txtCtrlDirectory = new wxTextCtrl( this, wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0 );
- m_txtCtrlDirectory->SetMaxLength( 0 );
- bSizer114->Add( m_txtCtrlDirectory, 1, wxALIGN_CENTER_VERTICAL, 5 );
-
- m_buttonSelectDir = new wxButton( this, wxID_ANY, _("Browse"), wxDefaultPosition, wxDefaultSize, 0 );
- m_buttonSelectDir->SetToolTip( _("Select a folder") );
-
- bSizer114->Add( m_buttonSelectDir, 0, wxALIGN_CENTER_VERTICAL, 5 );
-
-
- this->SetSizer( bSizer114 );
- this->Layout();
- bSizer114->Fit( this );
-}
-
-FolderGenerated::~FolderGenerated()
-{
-}
diff --git a/RealtimeSync/gui_generated.h b/RealtimeSync/gui_generated.h
deleted file mode 100644
index a816e10a..00000000
--- a/RealtimeSync/gui_generated.h
+++ /dev/null
@@ -1,117 +0,0 @@
-///////////////////////////////////////////////////////////////////////////
-// C++ code generated with wxFormBuilder (version Oct 8 2012)
-// http://www.wxformbuilder.org/
-//
-// PLEASE DO "NOT" EDIT THIS FILE!
-///////////////////////////////////////////////////////////////////////////
-
-#ifndef __GUI_GENERATED_H__
-#define __GUI_GENERATED_H__
-
-#include <wx/artprov.h>
-#include <wx/xrc/xmlres.h>
-#include <wx/intl.h>
-namespace zen { class BitmapTextButton; }
-
-#include <wx/string.h>
-#include <wx/bitmap.h>
-#include <wx/image.h>
-#include <wx/icon.h>
-#include <wx/menu.h>
-#include <wx/gdicmn.h>
-#include <wx/font.h>
-#include <wx/colour.h>
-#include <wx/settings.h>
-#include <wx/stattext.h>
-#include <wx/sizer.h>
-#include <wx/statline.h>
-#include <wx/bmpbuttn.h>
-#include <wx/button.h>
-#include <wx/textctrl.h>
-#include <wx/panel.h>
-#include <wx/scrolwin.h>
-#include <wx/spinctrl.h>
-#include <wx/frame.h>
-
-#include "zen/i18n.h"
-
-///////////////////////////////////////////////////////////////////////////
-
-///////////////////////////////////////////////////////////////////////////////
-/// Class MainDlgGenerated
-///////////////////////////////////////////////////////////////////////////////
-class MainDlgGenerated : public wxFrame
-{
-private:
-
-protected:
- wxMenuBar* m_menubar1;
- wxMenu* m_menuFile;
- wxMenu* m_menuHelp;
- wxMenuItem* m_menuItemAbout;
- wxBoxSizer* bSizerMain;
- wxStaticText* m_staticText9;
- wxStaticText* m_staticText3;
- wxStaticText* m_staticText4;
- wxStaticText* m_staticText5;
- wxStaticText* m_staticText811;
- wxStaticLine* m_staticline2;
- wxPanel* m_panelMain;
- wxStaticText* m_staticText7;
- wxPanel* m_panelMainFolder;
- wxStaticText* m_staticTextFinalPath;
- wxBitmapButton* m_bpButtonAddFolder;
- wxBitmapButton* m_bpButtonRemoveTopFolder;
- wxTextCtrl* m_txtCtrlDirectoryMain;
- wxButton* m_buttonSelectDirMain;
- wxScrolledWindow* m_scrolledWinFolders;
- wxBoxSizer* bSizerFolders;
- wxStaticLine* m_staticline212;
- wxStaticText* m_staticText8;
- wxSpinCtrl* m_spinCtrlDelay;
- wxStaticLine* m_staticline211;
- wxStaticText* m_staticText6;
- wxTextCtrl* m_textCtrlCommand;
- wxStaticLine* m_staticline5;
- zen::BitmapTextButton* m_buttonStart;
-
- // Virtual event handlers, overide them in your derived class
- virtual void OnClose( wxCloseEvent& event ) { event.Skip(); }
- virtual void OnConfigLoad( wxCommandEvent& event ) { event.Skip(); }
- virtual void OnConfigSave( wxCommandEvent& event ) { event.Skip(); }
- virtual void OnMenuQuit( wxCommandEvent& event ) { event.Skip(); }
- virtual void OnShowHelp( wxCommandEvent& event ) { event.Skip(); }
- virtual void OnMenuAbout( wxCommandEvent& event ) { event.Skip(); }
- virtual void OnAddFolder( wxCommandEvent& event ) { event.Skip(); }
- virtual void OnRemoveTopFolder( wxCommandEvent& event ) { event.Skip(); }
- virtual void OnStart( wxCommandEvent& event ) { event.Skip(); }
-
-
-public:
-
- MainDlgGenerated( wxWindow* parent, wxWindowID id = wxID_ANY, const wxString& title = _("dummy"), const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxSize( -1,-1 ), long style = wxDEFAULT_FRAME_STYLE|wxTAB_TRAVERSAL );
-
- ~MainDlgGenerated();
-
-};
-
-///////////////////////////////////////////////////////////////////////////////
-/// Class FolderGenerated
-///////////////////////////////////////////////////////////////////////////////
-class FolderGenerated : public wxPanel
-{
-private:
-
-protected:
- wxButton* m_buttonSelectDir;
-
-public:
- wxBitmapButton* m_bpButtonRemoveFolder;
- wxTextCtrl* m_txtCtrlDirectory;
-
- FolderGenerated( wxWindow* parent, wxWindowID id = wxID_ANY, const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxSize( -1,-1 ), long style = 0 );
- ~FolderGenerated();
-
-};
-
-#endif //__GUI_GENERATED_H__
diff --git a/RealtimeSync/main_dlg.cpp b/RealtimeSync/main_dlg.cpp
deleted file mode 100644
index f29f396b..00000000
--- a/RealtimeSync/main_dlg.cpp
+++ /dev/null
@@ -1,534 +0,0 @@
-// **************************************************************************
-// * This file is part of the FreeFileSync project. It is distributed under *
-// * GNU General Public License: http://www.gnu.org/licenses/gpl.html *
-// * Copyright (C) Zenju (zenju AT gmx DOT de) - All Rights Reserved *
-// **************************************************************************
-
-#include "main_dlg.h"
-#include <wx/wupdlock.h>
-#include <wx/filedlg.h>
-#include <wx+/bitmap_button.h>
-#include <wx+/string_conv.h>
-#include <wx+/mouse_move_dlg.h>
-#include <wx+/font_size.h>
-#include <wx+/popup_dlg.h>
-#include <wx+/image_resources.h>
-#include <zen/assert_static.h>
-#include <zen/file_handling.h>
-#include <zen/build_info.h>
-#include "xml_proc.h"
-#include "tray_menu.h"
-#include "xml_ffs.h"
-#include "app_icon.h"
-#include "../lib/help_provider.h"
-#include "../lib/process_xml.h"
-#include "../lib/ffs_paths.h"
-#ifdef ZEN_LINUX
-#include <gtk/gtk.h>
-#elif defined ZEN_MAC
-#include <ApplicationServices/ApplicationServices.h>
-#endif
-
-using namespace zen;
-
-
-class DirectoryPanel : public FolderGenerated
-{
-public:
- DirectoryPanel(wxWindow* parent) :
- FolderGenerated(parent),
- dirName(*this, *m_buttonSelectDir, *m_txtCtrlDirectory)
- {
-#ifdef ZEN_LINUX
- //file drag and drop directly into the text control unhelpfully inserts in format "file://..<cr><nl>"; see folder_history_box.cpp
- if (GtkWidget* widget = m_txtCtrlDirectory->GetConnectWidget())
- ::gtk_drag_dest_unset(widget);
-#endif
- }
-
- void setName(const wxString& dirname) { dirName.setName(dirname); }
- wxString getName() const { return dirName.getName(); }
-
-private:
- zen::DirectoryName<wxTextCtrl> dirName;
-};
-
-
-void MainDialog::create(const Zstring& cfgFile)
-{
- /*MainDialog* frame = */ new MainDialog(nullptr, cfgFile);
-}
-
-
-MainDialog::MainDialog(wxDialog* dlg, const Zstring& cfgFileName)
- : MainDlgGenerated(dlg)
-{
-#ifdef ZEN_WIN
- new MouseMoveWindow(*this); //ownership passed to "this"
- wxWindowUpdateLocker dummy(this); //leads to GUI corruption problems on Linux/OS X!
-#endif
-
-#ifdef ZEN_LINUX
- //file drag and drop directly into the text control unhelpfully inserts in format "file://..<cr><nl>"; see folder_history_box.cpp
- if (GtkWidget* widget = m_txtCtrlDirectoryMain->GetConnectWidget())
- ::gtk_drag_dest_unset(widget);
-#endif
-
- SetIcon(getRtsIcon()); //set application icon
-
- setRelativeFontSize(*m_buttonStart, 1.5);
-
- m_bpButtonRemoveTopFolder->Hide();
- m_panelMainFolder->Layout();
-
- m_bpButtonAddFolder ->SetBitmapLabel(getResourceImage(L"item_add"));
- m_bpButtonRemoveTopFolder->SetBitmapLabel(getResourceImage(L"item_remove"));
- setBitmapTextLabel(*m_buttonStart, getResourceImage(L"startRts").ConvertToImage(), m_buttonStart->GetLabel(), 5, 8);
-
-
- //register key event
- Connect(wxEVT_CHAR_HOOK, wxKeyEventHandler(MainDialog::OnKeyPressed), nullptr, this);
-
- //prepare drag & drop
- dirNameFirst.reset(new DirectoryName<wxTextCtrl>(*m_panelMainFolder, *m_buttonSelectDirMain, *m_txtCtrlDirectoryMain, m_staticTextFinalPath));
-
- //--------------------------- load config values ------------------------------------
- xmlAccess::XmlRealConfig newConfig;
-
- const Zstring currentConfigFile = cfgFileName.empty() ? lastConfigFileName() : cfgFileName;
- bool loadCfgSuccess = false;
- if (!cfgFileName.empty() || fileExists(lastConfigFileName()))
- try
- {
- rts::readRealOrBatchConfig(currentConfigFile, newConfig); //throw FfsXmlError
- loadCfgSuccess = true;
- }
- catch (const xmlAccess::FfsXmlError& e)
- {
- if (e.getSeverity() == xmlAccess::FfsXmlError::WARNING)
- showNotificationDialog(this, DialogInfoType::WARNING, PopupDialogCfg().setDetailInstructions(e.toString()));
- else
- showNotificationDialog(this, DialogInfoType::ERROR2, PopupDialogCfg().setDetailInstructions(e.toString()));
- }
-
- const bool startWatchingImmediately = loadCfgSuccess && !cfgFileName.empty();
-
- setConfiguration(newConfig);
- setLastUsedConfig(currentConfigFile);
- //-----------------------------------------------------------------------------------------
-
- if (startWatchingImmediately) //start watch mode directly
- {
- wxCommandEvent dummy2(wxEVT_COMMAND_BUTTON_CLICKED);
- this->OnStart(dummy2);
- //don't Show()!
- }
- else
- {
- m_buttonStart->SetFocus(); //don't "steal" focus if program is running from sys-tray"
- Show();
-#ifdef ZEN_MAC
- ProcessSerialNumber psn = { 0, kCurrentProcess };
- ::SetFrontProcess(&psn); //call before TransformProcessType() so that OSX menu is updated correctly
- ::TransformProcessType(&psn, kProcessTransformToForegroundApplication); //show dock icon, even if we're not an application bundle
- //if the executable is not yet in a bundle or if it is called through a launcher, we need to set focus manually:
-#endif
- }
-
- //drag and drop .ffs_real and .ffs_batch on main dialog
- setupFileDrop(*m_panelMain);
- m_panelMain->Connect(EVENT_DROP_FILE, FileDropEventHandler(MainDialog::onFilesDropped), nullptr, this);
-
- timerForAsyncTasks.Connect(wxEVT_TIMER, wxEventHandler(MainDialog::onProcessAsyncTasks), nullptr, this);
-}
-
-
-MainDialog::~MainDialog()
-{
- //save current configuration
- const xmlAccess::XmlRealConfig currentCfg = getConfiguration();
-
- try //write config to XML
- {
- writeRealConfig(currentCfg, lastConfigFileName()); //throw FfsXmlError
- }
- catch (const xmlAccess::FfsXmlError& e)
- {
- showNotificationDialog(this, DialogInfoType::ERROR2, PopupDialogCfg().setDetailInstructions(e.toString()));
- }
-}
-
-
-void MainDialog::onProcessAsyncTasks(wxEvent& event)
-{
- //schedule and run long-running tasks asynchronously
- asyncTasks.evalResults(); //process results on GUI queue
- if (asyncTasks.empty())
- timerForAsyncTasks.Stop();
-}
-
-
-const Zstring& MainDialog::lastConfigFileName()
-{
- static Zstring instance = zen::getConfigDir() + Zstr("LastRun.ffs_real");
- return instance;
-}
-
-
-void MainDialog::OnShowHelp(wxCommandEvent& event)
-{
- zen::displayHelpEntry(L"html/RealtimeSync.html", this);
-}
-
-
-void MainDialog::OnMenuAbout(wxCommandEvent& event)
-{
- //build information
- wxString build = __TDATE__;
-#if wxUSE_UNICODE
- build += L" - Unicode";
-#else
- build += L" - ANSI";
-#endif //wxUSE_UNICODE
-
- //compile time info about 32/64-bit build
- if (zen::is64BitBuild)
- build += L" x64";
- else
- build += L" x86";
- assert_static(zen::is32BitBuild || zen::is64BitBuild);
-
- showNotificationDialog(this, DialogInfoType::INFO, PopupDialogCfg().
- setTitle(_("About")).
- setMainInstructions(L"RealtimeSync" L"\n\n" + replaceCpy(_("Build: %x"), L"%x", build)));
-}
-
-
-void MainDialog::OnKeyPressed(wxKeyEvent& event)
-{
- const int keyCode = event.GetKeyCode();
- if (keyCode == WXK_ESCAPE)
- {
- Close();
- return;
- }
- event.Skip();
-}
-
-
-void MainDialog::OnStart(wxCommandEvent& event)
-{
- xmlAccess::XmlRealConfig currentCfg = getConfiguration();
-
- Hide();
-#ifdef ZEN_MAC
- //hide dock icon: else user is able to forcefully show the hidden main dialog by clicking on the icon!!
- ProcessSerialNumber psn = { 0, kCurrentProcess };
- ::TransformProcessType(&psn, kProcessTransformToUIElementApplication);
-#endif
-
- switch (rts::startDirectoryMonitor(currentCfg, xmlAccess::extractJobName(utfCvrtTo<Zstring>(currentConfigFileName))))
- {
- case rts::EXIT_APP:
- Close();
- return;
-
- case rts::SHOW_GUI:
- break;
- }
- Show(); //don't show for EXIT_APP
-#ifdef ZEN_MAC
- ::SetFrontProcess(&psn); //call before TransformProcessType() so that OSX menu is updated correctly
- //why isn't this covered by wxWindows::Raise()??
- ::TransformProcessType(&psn, kProcessTransformToForegroundApplication); //show dock icon again
-#endif
- Raise();
-}
-
-
-void MainDialog::OnConfigSave(wxCommandEvent& event)
-{
- Zstring defaultFileName = currentConfigFileName.empty() ? Zstr("Realtime.ffs_real") : currentConfigFileName;
- //attention: currentConfigFileName may be an imported *.ffs_batch file! We don't want to overwrite it with a GUI config!
- if (endsWith(defaultFileName, Zstr(".ffs_batch")))
- replace(defaultFileName, Zstr(".ffs_batch"), Zstr(".ffs_real"), false);
-
-
- wxFileDialog filePicker(this,
- wxEmptyString,
- //OS X really needs dir/file separated like this:
- utfCvrtTo<wxString>(beforeLast(defaultFileName, FILE_NAME_SEPARATOR)), //default dir; empty string if / not found
- utfCvrtTo<wxString>(afterLast (defaultFileName, FILE_NAME_SEPARATOR)), //default file; whole string if / not found
- wxString(L"RealtimeSync (*.ffs_real)|*.ffs_real") + L"|" +_("All files") + L" (*.*)|*",
- wxFD_SAVE | wxFD_OVERWRITE_PROMPT);
- if (filePicker.ShowModal() != wxID_OK)
- return;
-
- const Zstring newFileName = utfCvrtTo<Zstring>(filePicker.GetPath());
-
- //write config to XML
- const xmlAccess::XmlRealConfig currentCfg = getConfiguration();
- try
- {
- writeRealConfig(currentCfg, newFileName); //throw FfsXmlError
- setLastUsedConfig(newFileName);
- }
- catch (const xmlAccess::FfsXmlError& e)
- {
- showNotificationDialog(this, DialogInfoType::ERROR2, PopupDialogCfg().setDetailInstructions(e.toString()));
- }
-}
-
-
-void MainDialog::loadConfig(const Zstring& filename)
-{
- xmlAccess::XmlRealConfig newConfig;
-
- try
- {
- rts::readRealOrBatchConfig(filename, newConfig);
- }
- catch (const xmlAccess::FfsXmlError& e)
- {
- if (e.getSeverity() == xmlAccess::FfsXmlError::WARNING)
- showNotificationDialog(this, DialogInfoType::WARNING, PopupDialogCfg().setDetailInstructions(e.toString()));
- else
- {
- showNotificationDialog(this, DialogInfoType::ERROR2, PopupDialogCfg().setDetailInstructions(e.toString()));
- return;
- }
- }
-
- setConfiguration(newConfig);
- setLastUsedConfig(filename);
-}
-
-
-void MainDialog::setLastUsedConfig(const Zstring& filename)
-{
- //set title
- if (filename == lastConfigFileName())
- {
- SetTitle(L"RealtimeSync - " + _("Automated Synchronization"));
- currentConfigFileName.clear();
- }
- else
- {
- SetTitle(utfCvrtTo<wxString>(filename));
- currentConfigFileName = filename;
- }
-}
-
-
-void MainDialog::OnConfigLoad(wxCommandEvent& event)
-{
- wxFileDialog filePicker(this,
- wxEmptyString,
- utfCvrtTo<wxString>(beforeLast(currentConfigFileName, FILE_NAME_SEPARATOR)), //default dir; empty string if / not found
- wxEmptyString,
- wxString(L"RealtimeSync (*.ffs_real; *.ffs_batch)|*.ffs_real;*.ffs_batch") + L"|" +_("All files") + L" (*.*)|*",
- wxFD_OPEN);
- if (filePicker.ShowModal() == wxID_OK)
- loadConfig(utfCvrtTo<Zstring>(filePicker.GetPath()));
-}
-
-
-void MainDialog::onFilesDropped(FileDropEvent& event)
-{
- const auto& files = event.getFiles();
- if (!files.empty())
- loadConfig(utfCvrtTo<Zstring>(files[0]));
-}
-
-
-void MainDialog::setConfiguration(const xmlAccess::XmlRealConfig& cfg)
-{
- //clear existing folders
- dirNameFirst->setName(wxString());
- clearAddFolders();
-
- if (!cfg.directories.empty())
- {
- //fill top folder
- dirNameFirst->setName(utfCvrtTo<wxString>(*cfg.directories.begin()));
-
- //fill additional folders
- addFolder(std::vector<Zstring>(cfg.directories.begin() + 1, cfg.directories.end()));
- }
-
- //fill commandline
- m_textCtrlCommand->SetValue(utfCvrtTo<wxString>(cfg.commandline));
-
- //set delay
- m_spinCtrlDelay->SetValue(static_cast<int>(cfg.delay));
-}
-
-
-xmlAccess::XmlRealConfig MainDialog::getConfiguration()
-{
- xmlAccess::XmlRealConfig output;
-
- output.directories.push_back(utfCvrtTo<Zstring>(dirNameFirst->getName()));
- for (auto it = dirNamesExtra.begin(); it != dirNamesExtra.end(); ++it)
- output.directories.push_back(utfCvrtTo<Zstring>((*it)->getName()));
-
- output.commandline = utfCvrtTo<Zstring>(m_textCtrlCommand->GetValue());
- output.delay = m_spinCtrlDelay->GetValue();
-
- return output;
-}
-
-
-void MainDialog::OnAddFolder(wxCommandEvent& event)
-{
- const Zstring topFolder = utfCvrtTo<Zstring>(dirNameFirst->getName());
-
- //clear existing top folder first
- dirNameFirst->setName(wxString());
-
- std::vector<Zstring> newFolders;
- newFolders.push_back(topFolder);
-
- addFolder(newFolders, true); //add pair in front of additonal pairs
-}
-
-
-void MainDialog::OnRemoveFolder(wxCommandEvent& event)
-{
- //find folder pair originating the event
- const wxObject* const eventObj = event.GetEventObject();
- for (auto it = dirNamesExtra.begin(); it != dirNamesExtra.end(); ++it)
- if (eventObj == static_cast<wxObject*>((*it)->m_bpButtonRemoveFolder))
- {
- removeAddFolder(it - dirNamesExtra.begin());
- return;
- }
-}
-
-
-void MainDialog::OnRemoveTopFolder(wxCommandEvent& event)
-{
- if (dirNamesExtra.size() > 0)
- {
- const wxString topDir = (*dirNamesExtra.begin())->getName();
-
- dirNameFirst->setName(topDir);
-
- removeAddFolder(0); //remove first of additional folders
- }
-}
-
-
-#ifdef ZEN_WIN
-static const size_t MAX_ADD_FOLDERS = 8;
-#elif defined ZEN_LINUX || defined ZEN_MAC
-static const size_t MAX_ADD_FOLDERS = 6;
-#endif
-
-
-void MainDialog::addFolder(const std::vector<Zstring>& newFolders, bool addFront)
-{
- if (newFolders.size() == 0)
- return;
-
-#ifdef ZEN_WIN
- wxWindowUpdateLocker dummy(this); //leads to GUI corruption problems on Linux/OS X!
-#endif
-
- int folderHeight = 0;
- for (auto it = newFolders.begin(); it != newFolders.end(); ++it)
- {
- //add new folder pair
- DirectoryPanel* newFolder = new DirectoryPanel(m_scrolledWinFolders);
- newFolder->m_bpButtonRemoveFolder->SetBitmapLabel(getResourceImage(L"item_remove"));
-
- //get size of scrolled window
- folderHeight = newFolder->GetSize().GetHeight();
-
- if (addFront)
- {
- bSizerFolders->Insert(0, newFolder, 0, wxEXPAND, 5);
- dirNamesExtra.insert(dirNamesExtra.begin(), newFolder);
- }
- else
- {
- bSizerFolders->Add(newFolder, 0, wxEXPAND, 5);
- dirNamesExtra.push_back(newFolder);
- }
-
- //register events
- newFolder->m_bpButtonRemoveFolder->Connect(wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler(MainDialog::OnRemoveFolder), nullptr, this );
-
- //insert directory name
- newFolder->setName(utfCvrtTo<wxString>(*it));
- }
-
- //set size of scrolled window
- const size_t additionalRows = std::min(dirNamesExtra.size(), MAX_ADD_FOLDERS); //up to MAX_ADD_FOLDERS additional folders shall be shown
- m_scrolledWinFolders->SetMinSize(wxSize( -1, folderHeight * static_cast<int>(additionalRows)));
-
- //adapt delete top folder pair button
- m_bpButtonRemoveTopFolder->Show();
-
- GetSizer()->SetSizeHints(this); //~=Fit() + SetMinSize()
- Layout();
- Refresh(); //remove a little flicker near the start button
-}
-
-
-void MainDialog::removeAddFolder(size_t pos)
-{
-#ifdef ZEN_WIN
- wxWindowUpdateLocker dummy(this); //leads to GUI corruption problems on Linux/OS X!
-#endif
-
- if (pos < dirNamesExtra.size())
- {
- //remove folder pairs from window
- DirectoryPanel* pairToDelete = dirNamesExtra[pos];
- const int folderHeight = pairToDelete->GetSize().GetHeight();
-
- bSizerFolders->Detach(pairToDelete); //Remove() does not work on Window*, so do it manually
- dirNamesExtra.erase(dirNamesExtra.begin() + pos); //remove last element in vector
- //more (non-portable) wxWidgets bullshit: on OS X wxWindow::Destroy() screws up and calls "operator delete" directly rather than
- //the deferred deletion it is expected to do (and which is implemented correctly on Windows and Linux)
- //http://bb10.com/python-wxpython-devel/2012-09/msg00004.html
- //=> since we're in a mouse button callback of a sub-component of "pairToDelete" we need to delay deletion ourselves:
- processAsync2([] {}, [pairToDelete] { pairToDelete->Destroy(); });
-
- //set size of scrolled window
- const size_t additionalRows = std::min(dirNamesExtra.size(), MAX_ADD_FOLDERS); //up to MAX_ADD_FOLDERS additional folders shall be shown
- m_scrolledWinFolders->SetMinSize(wxSize( -1, folderHeight * static_cast<int>(additionalRows)));
-
- //adapt delete top folder pair button
- if (dirNamesExtra.size() == 0)
- {
- m_bpButtonRemoveTopFolder->Hide();
- m_panelMainFolder->Layout();
- }
-
- GetSizer()->SetSizeHints(this); //~=Fit() + SetMinSize()
- Layout();
- Refresh(); //remove a little flicker near the start button
- }
-}
-
-
-void MainDialog::clearAddFolders()
-{
-#ifdef ZEN_WIN
- wxWindowUpdateLocker dummy(this); //leads to GUI corruption problems on Linux/OS X!
-#endif
-
- bSizerFolders->Clear(true);
- dirNamesExtra.clear();
-
- m_scrolledWinFolders->SetMinSize(wxSize(-1, 0));
-
- m_bpButtonRemoveTopFolder->Hide();
- m_panelMainFolder->Layout();
-
- GetSizer()->SetSizeHints(this); //~=Fit()
- Layout();
- Refresh(); //remove a little flicker near the start button
-}
diff --git a/RealtimeSync/main_dlg.h b/RealtimeSync/main_dlg.h
deleted file mode 100644
index 9e5537f0..00000000
--- a/RealtimeSync/main_dlg.h
+++ /dev/null
@@ -1,80 +0,0 @@
-// **************************************************************************
-// * This file is part of the FreeFileSync project. It is distributed under *
-// * GNU General Public License: http://www.gnu.org/licenses/gpl.html *
-// * Copyright (C) Zenju (zenju AT gmx DOT de) - All Rights Reserved *
-// **************************************************************************
-
-#ifndef REALTIMESYNCMAIN_H
-#define REALTIMESYNCMAIN_H
-
-#include "gui_generated.h"
-#include <vector>
-#include <memory>
-#include <zen/zstring.h>
-#include <zen/async_task.h>
-#include <wx+/file_drop.h>
-#include <wx/timer.h>
-#include "../ui/dir_name.h"
-
-namespace xmlAccess
-{
-struct XmlRealConfig;
-}
-class DirectoryPanel;
-
-
-class MainDialog: public MainDlgGenerated
-{
-public:
- static void create(const Zstring& cfgFile);
-
-private:
- MainDialog(wxDialog* dlg, const Zstring& cfgFileName);
- ~MainDialog();
-
- void loadConfig(const Zstring& filename);
-
- virtual void OnClose (wxCloseEvent& event) { Destroy(); }
- virtual void OnShowHelp (wxCommandEvent& event);
- virtual void OnMenuAbout (wxCommandEvent& event);
- virtual void OnAddFolder (wxCommandEvent& event);
- virtual void OnRemoveFolder (wxCommandEvent& event);
- virtual void OnRemoveTopFolder(wxCommandEvent& event);
- virtual void OnKeyPressed (wxKeyEvent& event);
- virtual void OnStart (wxCommandEvent& event);
- virtual void OnConfigSave (wxCommandEvent& event);
- virtual void OnConfigLoad (wxCommandEvent& event);
- virtual void OnMenuQuit (wxCommandEvent& event) { Close(); }
- void onFilesDropped(zen::FileDropEvent& event);
-
- void setConfiguration(const xmlAccess::XmlRealConfig& cfg);
- xmlAccess::XmlRealConfig getConfiguration();
- void setLastUsedConfig(const Zstring& filename);
-
- void layoutAsync(); //call Layout() asynchronously
-
- //void addFolder(const Zstring& dirname, bool addFront = false);
- void addFolder(const std::vector<Zstring>& newFolders, bool addFront = false);
- void removeAddFolder(size_t pos);
- void clearAddFolders();
-
- static const Zstring& lastConfigFileName();
-
- std::unique_ptr<zen::DirectoryName<wxTextCtrl>> dirNameFirst;
- std::vector<DirectoryPanel*> dirNamesExtra; //additional pairs to the standard pair
-
- Zstring currentConfigFileName;
-
- void onProcessAsyncTasks(wxEvent& event);
-
- template <class Fun, class Fun2>
- void processAsync(Fun doAsync, Fun2 evalOnGui) { asyncTasks.add(doAsync, evalOnGui); timerForAsyncTasks.Start(50); /*timer interval in [ms] */ }
- template <class Fun, class Fun2>
- void processAsync2(Fun doAsync, Fun2 evalOnGui) { asyncTasks.add2(doAsync, evalOnGui); timerForAsyncTasks.Start(50); /*timer interval in [ms] */ }
-
- //schedule and run long-running tasks asynchronously, but process results on GUI queue
- zen::AsyncTasks asyncTasks;
- wxTimer timerForAsyncTasks; //don't use wxWidgets idle handling => repeated idle requests/consumption hogs 100% cpu!
-};
-
-#endif // REALTIMESYNCMAIN_H
diff --git a/RealtimeSync/makefile b/RealtimeSync/makefile
deleted file mode 100644
index 8098d586..00000000
--- a/RealtimeSync/makefile
+++ /dev/null
@@ -1,101 +0,0 @@
-BLAH_BLUBB_123=
-#for some buggy reason the first row in the make file has no effect on Suse Linux! => make sure there's no important command
-APPNAME = RealtimeSync
-prefix = /usr
-BINDIR = $(DESTDIR)$(prefix)/bin
-
-CXXFLAGS = -std=c++11 -Wall -pipe -O3 -DNDEBUG -DwxUSE_UNICODE -DWXINTL_NO_GETTEXT_MACRO -I.. -include "zen/i18n.h" -include "zen/warn_static.h"
-LINKFLAGS =
-
-#distinguish Linux/Mac builds
-OPERATING_SYSTEM_NAME := $(shell uname)
-
-#################### Linux ############################
-ifeq ($(OPERATING_SYSTEM_NAME), Linux)
-COMPILER_BIN=g++ -pthread
-CXXFLAGS += -DZEN_LINUX
-
-#Gtk - support "no button border"
-CXXFLAGS += `pkg-config --cflags gtk+-2.0`
-LINKFLAGS += `pkg-config --libs gtk+-2.0`
-
-ifeq ($(BUILD),Launchpad)
-#default build/Launchpad
-CXXFLAGS += `wx-config --cxxflags --debug=no`
-LINKFLAGS += `wx-config --libs --debug=no` -lboost_thread -lboost_system -lz
-else
-#static wxWidgets and boost library linkage for precompiled release
-WX_CONFIG_BIN =$(HOME)/Desktop/wxWidgets-2.9.5/lib/release/bin/wx-config
-CXXFLAGS += -I$(HOME)/Desktop/boost_1_54_0
-BOOST_LIB_DIR =$(HOME)/Desktop/boost_1_54_0/stage/lib
-
-CXXFLAGS += `$(WX_CONFIG_BIN) --cxxflags --debug=no --static=yes`
-LINKFLAGS += `$(WX_CONFIG_BIN) --libs --debug=no --static=yes` $(BOOST_LIB_DIR)/libboost_thread.a $(BOOST_LIB_DIR)/libboost_system.a -lX11
-endif
-
-endif
-#################### OS X ############################
-ifeq ($(OPERATING_SYSTEM_NAME), Darwin)
-COMPILER_BIN=clang++ -stdlib=libc++
-CXXFLAGS += -DZEN_MAC
-
-WX_CONFIG_BIN =$(HOME)/Desktop/wxWidgets-2.9.5/lib/release/bin/wx-config
-CXXFLAGS += -I$(HOME)/Desktop/boost_1_54_0
-BOOST_LIB_DIR =$(HOME)/Desktop/boost_1_54_0/stage/lib
-MACOS_SDK =-mmacosx-version-min=10.7 -isysroot /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.8.sdk
-#-Wl,-Bstatic not supported on OSX!
-
-# link wxWidgets and boost statically -> check dependencies with: otool -L RealtimeSync
-CXXFLAGS += $(MACOS_SDK) `$(WX_CONFIG_BIN) --cxxflags --debug=no --static=yes`
-LINKFLAGS += $(MACOS_SDK) `$(WX_CONFIG_BIN) --libs --debug=no --static=yes` $(BOOST_LIB_DIR)/libboost_thread.a $(BOOST_LIB_DIR)/libboost_system.a
-
-endif
-######################################################
-
-CPP_LIST= #internal list of all *.cpp files needed for compilation
-CPP_LIST+=application.cpp
-CPP_LIST+=gui_generated.cpp
-CPP_LIST+=main_dlg.cpp
-CPP_LIST+=tray_menu.cpp
-CPP_LIST+=monitor.cpp
-CPP_LIST+=xml_ffs.cpp
-CPP_LIST+=xml_proc.cpp
-CPP_LIST+=../structures.cpp
-CPP_LIST+=../ui/dir_name.cpp
-CPP_LIST+=../ui/folder_history_box.cpp
-CPP_LIST+=../lib/localization.cpp
-CPP_LIST+=../lib/process_xml.cpp
-CPP_LIST+=../lib/resolve_path.cpp
-CPP_LIST+=../lib/xml_base.cpp
-CPP_LIST+=../lib/ffs_paths.cpp
-CPP_LIST+=../zen/dir_watcher.cpp
-CPP_LIST+=../zen/file_handling.cpp
-CPP_LIST+=../zen/file_io.cpp
-CPP_LIST+=../zen/file_traverser.cpp
-CPP_LIST+=../zen/zstring.cpp
-CPP_LIST+=../zen/format_unit.cpp
-CPP_LIST+=../wx+/image_tools.cpp
-CPP_LIST+=../wx+/image_resources.cpp
-CPP_LIST+=../wx+/popup_dlg.cpp
-CPP_LIST+=../wx+/popup_dlg_generated.cpp
-
-#list of all *.o files (we need the "RTS" subdirectory to handle "../*.cpp" files
-OBJECT_LIST=$(CPP_LIST:%.cpp=../OBJ/RTS_GCC_Make_Release/RTS/%.o)
-
-all: RealtimeSync
-
-../OBJ/RTS_GCC_Make_Release/RTS/%.o : %.cpp
- mkdir -p $(dir $@)
- $(COMPILER_BIN) $(CXXFLAGS) -c $< -o $@
-
-RealtimeSync: $(OBJECT_LIST)
- $(COMPILER_BIN) -o ../BUILD/$(APPNAME) $(OBJECT_LIST) $(LINKFLAGS)
-
-clean:
- rm -rf ../OBJ/RTS_GCC_Make_Release
- rm -f ../BUILD/$(APPNAME)
- rm -f ../wx+/pch.h.gch
-
-install:
- mkdir -p $(BINDIR)
- cp ../BUILD/$(APPNAME) $(BINDIR)
diff --git a/RealtimeSync/monitor.cpp b/RealtimeSync/monitor.cpp
deleted file mode 100644
index 88536281..00000000
--- a/RealtimeSync/monitor.cpp
+++ /dev/null
@@ -1,281 +0,0 @@
-// **************************************************************************
-// * This file is part of the FreeFileSync project. It is distributed under *
-// * GNU General Public License: http://www.gnu.org/licenses/gpl.html *
-// * Copyright (C) Zenju (zenju AT gmx DOT de) - All Rights Reserved *
-// **************************************************************************
-
-#include "monitor.h"
-#include <ctime>
-#include <set>
-#include <zen/file_handling.h>
-#include <zen/dir_watcher.h>
-#include <zen/thread.h>
-#include <zen/tick_count.h>
-#include <wx/utils.h>
-#include "../lib/resolve_path.h"
-//#include "../library/db_file.h" //SYNC_DB_FILE_ENDING -> complete file too much of a dependency; file ending too little to decouple into single header
-//#include "../library/lock_holder.h" //LOCK_FILE_ENDING
-
-using namespace zen;
-
-
-namespace
-{
-const int CHECK_DIR_INTERVAL = 1; //unit: [s]
-
-
-std::vector<Zstring> getFormattedDirs(const std::vector<Zstring>& dirs) //throw FileError
-{
- std::set<Zstring, LessFilename> tmp; //make unique
-
- std::transform(dirs.begin(), dirs.end(), std::inserter(tmp, tmp.end()),
- [](const Zstring& dirnameNonFmt) { return getFormattedDirectoryName(dirnameNonFmt); });
-
- return std::vector<Zstring>(tmp.begin(), tmp.end());
-}
-
-
-//wait until changes are detected or if a directory is not available (anymore)
-struct WaitResult
-{
- enum ChangeType
- {
- CHANGE_DETECTED,
- CHANGE_DIR_MISSING
- };
-
- WaitResult(const zen::DirWatcher::Entry& changedItem) : type(CHANGE_DETECTED), changedItem_(changedItem) {}
- WaitResult(const Zstring& dirname) : type(CHANGE_DIR_MISSING), dirname_(dirname) {}
-
- ChangeType type;
- zen::DirWatcher::Entry changedItem_; //for type == CHANGE_DETECTED: file or directory
- Zstring dirname_; //for type == CHANGE_DIR_MISSING
-};
-
-
-WaitResult waitForChanges(const std::vector<Zstring>& dirNamesNonFmt, //throw FileError
- const std::function<void(bool)>& onRefreshGui) //bool: readyForSync
-{
- const std::vector<Zstring> dirNamesFmt = getFormattedDirs(dirNamesNonFmt); //throw FileError
- if (dirNamesFmt.empty()) //pathological case, but we have to check else this function will wait endlessly
- throw zen::FileError(_("A folder input field is empty.")); //should have been checked by caller!
-
- //detect when volumes are removed/are not available anymore
- std::vector<std::pair<Zstring, std::shared_ptr<DirWatcher>>> watches;
-
- for (auto it = dirNamesFmt.begin(); it != dirNamesFmt.end(); ++it)
- {
- const Zstring& dirnameFmt = *it;
- try
- {
- //a non-existent network path may block, so check existence asynchronously!
- auto ftDirExists = async([=] { return zen::dirExists(dirnameFmt); });
- //we need to check dirExists(), not somethingExists(): it's not clear if DirWatcher detects a type clash (file instead of directory!)
- while (!ftDirExists.timed_wait(boost::posix_time::milliseconds(rts::UI_UPDATE_INTERVAL / 2)))
- onRefreshGui(false); //may throw!
- if (!ftDirExists.get())
- return WaitResult(dirnameFmt);
-
- watches.push_back(std::make_pair(dirnameFmt, std::make_shared<DirWatcher>(dirnameFmt))); //throw FileError
- }
- catch (FileError&)
- {
- if (!somethingExists(dirnameFmt)) //a benign(?) race condition with FileError
- return WaitResult(dirnameFmt);
- throw;
- }
- }
-
- const std::int64_t TICKS_DIR_CHECK_INTERVAL = CHECK_DIR_INTERVAL * ticksPerSec(); //0 on error
- TickVal lastCheck = getTicks(); //0 on error
- while (true)
- {
- const bool checkDirExistNow = [&]() -> bool //checking once per sec should suffice
- {
- const TickVal now = getTicks(); //0 on error
- if (dist(lastCheck, now) >= TICKS_DIR_CHECK_INTERVAL)
- {
- lastCheck = now;
- return true;
- }
- return false;
- }();
-
-
- for (auto it = watches.begin(); it != watches.end(); ++it)
- {
- const Zstring& dirname = it->first;
- DirWatcher& watcher = *(it->second);
-
- //IMPORTANT CHECK: dirwatcher has problems detecting removal of top watched directories!
- if (checkDirExistNow)
- if (!dirExists(dirname)) //catch errors related to directory removal, e.g. ERROR_NETNAME_DELETED -> somethingExists() is NOT sufficient here!
- return WaitResult(dirname);
- try
- {
- std::vector<DirWatcher::Entry> changedItems = watcher.getChanges([&] { onRefreshGui(false); /*may throw!*/ }); //throw FileError
-
- //remove to be ignored changes
- vector_remove_if(changedItems, [](const DirWatcher::Entry& e)
- {
- return endsWith(e.filename_, Zstr(".ffs_lock")) || //sync.ffs_lock, sync.Del.ffs_lock
- endsWith(e.filename_, Zstr(".ffs_db")); //sync.ffs_db, .sync.tmp.ffs_db
- //no need to ignore temporal recycle bin directory: this must be caused by a file deletion anyway
- });
-
- if (!changedItems.empty())
- {
- /*
- std::for_each(changedItems.begin(), changedItems.end(),
- [](const Zstring& fn) { wxMessageBox(toWx(fn));});
- */
- return WaitResult(changedItems[0]); //directory change detected
- }
-
- }
- catch (FileError&)
- {
- if (!somethingExists(dirname)) //a benign(?) race condition with FileError
- return WaitResult(dirname);
- throw;
- }
- }
-
- boost::this_thread::sleep(boost::posix_time::milliseconds(rts::UI_UPDATE_INTERVAL / 2));
- onRefreshGui(true); //throw ?: may start sync at this presumably idle time
- }
-}
-
-
-//wait until all directories become available (again) + logs in network share
-void waitForMissingDirs(const std::vector<Zstring>& dirNamesNonFmt, //throw FileError
- const std::function<void(const Zstring&)>& onRefreshGui) //Zstring: the directory that is currently being waited for
-{
- while (true)
- {
- //support specifying volume by name => call getFormattedDirectoryName() repeatedly
- const std::vector<Zstring>& dirNamesFmt = getFormattedDirs(dirNamesNonFmt); //throw FileError
-
- bool allExisting = true;
- for (auto it = dirNamesFmt.begin(); it != dirNamesFmt.end(); ++it)
- {
- const Zstring dirnameFmt = *it;
- auto ftDirExisting = async([=]() -> bool
- {
-#ifdef ZEN_WIN
- //1. login to network share, if necessary -> we probably do NOT want multiple concurrent runs: GUI!?
- loginNetworkShare(dirnameFmt, false); //login networks shares, no PW prompt -> is this really RTS's job?
-#endif
- //2. check dir existence
- return zen::dirExists(dirnameFmt);
- });
- while (!ftDirExisting.timed_wait(boost::posix_time::milliseconds(rts::UI_UPDATE_INTERVAL / 2)))
- onRefreshGui(dirnameFmt); //may throw!
-
- if (!ftDirExisting.get())
- {
- allExisting = false;
- //wait some time...
- const int refreshInterval = rts::UI_UPDATE_INTERVAL / 2;
- assert_static(CHECK_DIR_INTERVAL * 1000 % refreshInterval == 0);
- for (int i = 0; i < CHECK_DIR_INTERVAL * 1000 / refreshInterval; ++i)
- {
- onRefreshGui(dirnameFmt); //may throw!
- boost::this_thread::sleep(boost::posix_time::milliseconds(refreshInterval));
- }
- break;
- }
- }
- if (allExisting)
- return;
- }
-}
-
-
-inline
-wxString toString(DirWatcher::ActionType type)
-{
- switch (type)
- {
- case DirWatcher::ACTION_CREATE:
- return L"CREATE";
- case DirWatcher::ACTION_UPDATE:
- return L"UPDATE";
- case DirWatcher::ACTION_DELETE:
- return L"DELETE";
- }
- return L"ERROR";
-}
-
-struct ExecCommandNowException {};
-}
-
-
-void rts::monitorDirectories(const std::vector<Zstring>& dirNamesNonFmt, unsigned int delay, rts::MonitorCallback& callback)
-{
- if (dirNamesNonFmt.empty())
- {
- assert(false);
- return;
- }
-
- auto execMonitoring = [&] //throw FileError
- {
- callback.setPhase(MonitorCallback::MONITOR_PHASE_WAITING);
- waitForMissingDirs(dirNamesNonFmt, [&](const Zstring& dirname) { callback.requestUiRefresh(); }); //throw FileError
- callback.setPhase(MonitorCallback::MONITOR_PHASE_ACTIVE);
-
- //schedule initial execution (*after* all directories have arrived, which could take some time which we don't want to include)
- time_t nextExecDate = std::time(nullptr) + delay;
-
- while (true) //loop over command invocations
- {
- DirWatcher::Entry lastChangeDetected;
- try
- {
- while (true) //loop over detected changes
- {
- //wait for changes (and for all directories to become available)
- WaitResult res = waitForChanges(dirNamesNonFmt, [&](bool readyForSync) //throw FileError, ExecCommandNowException
- {
- if (readyForSync)
- if (nextExecDate <= std::time(nullptr))
- throw ExecCommandNowException(); //abort wait and start sync
- callback.requestUiRefresh();
- });
- switch (res.type)
- {
- case WaitResult::CHANGE_DIR_MISSING: //don't execute the command before all directories are available!
- callback.setPhase(MonitorCallback::MONITOR_PHASE_WAITING);
- waitForMissingDirs(dirNamesNonFmt, [&](const Zstring& dirname) { callback.requestUiRefresh(); }); //throw FileError
- callback.setPhase(MonitorCallback::MONITOR_PHASE_ACTIVE);
- break;
-
- case WaitResult::CHANGE_DETECTED:
- lastChangeDetected = res.changedItem_;
- break;
- }
- nextExecDate = std::time(nullptr) + delay;
- }
- }
- catch (ExecCommandNowException&) {}
-
- ::wxSetEnv(L"change_path", utfCvrtTo<wxString>(lastChangeDetected.filename_)); //some way to output what file changed to the user
- ::wxSetEnv(L"change_action", toString(lastChangeDetected.action_)); //
-
- //execute command
- callback.executeExternalCommand();
- nextExecDate = std::numeric_limits<time_t>::max();
- }
- };
-
- while (true)
- try
- {
- execMonitoring(); //throw FileError
- }
- catch (const zen::FileError& e)
- {
- callback.reportError(e.toString());
- }
-}
diff --git a/RealtimeSync/monitor.h b/RealtimeSync/monitor.h
deleted file mode 100644
index 0b9dfbc0..00000000
--- a/RealtimeSync/monitor.h
+++ /dev/null
@@ -1,38 +0,0 @@
-// **************************************************************************
-// * This file is part of the FreeFileSync project. It is distributed under *
-// * GNU General Public License: http://www.gnu.org/licenses/gpl.html *
-// * Copyright (C) Zenju (zenju AT gmx DOT de) - All Rights Reserved *
-// **************************************************************************
-
-#ifndef MONITOR_HEADER_345087425834253425
-#define MONITOR_HEADER_345087425834253425
-
-#include <functional>
-#include <zen/zstring.h>
-
-namespace rts
-{
-const int UI_UPDATE_INTERVAL = 100; //unit: [ms]; perform ui updates not more often than necessary, 100 seems to be a good value with only a minimal performance loss
-
-
-struct MonitorCallback
-{
- virtual ~MonitorCallback() {}
-
- enum WatchPhase
- {
- MONITOR_PHASE_ACTIVE,
- MONITOR_PHASE_WAITING,
- };
- virtual void setPhase(WatchPhase mode) = 0;
- virtual void executeExternalCommand() = 0;
- virtual void requestUiRefresh() = 0;
- virtual void reportError(const std::wstring& msg) = 0; //automatically retries after return!
-};
-void monitorDirectories(const std::vector<Zstring>& dirNamesNonFmt,
- //non-formatted dirnames that yet require call to getFormattedDirectoryName(); empty directories must be checked by caller!
- unsigned int delay,
- MonitorCallback& callback);
-}
-
-#endif //MONITOR_HEADER_345087425834253425
diff --git a/RealtimeSync/tray_menu.cpp b/RealtimeSync/tray_menu.cpp
deleted file mode 100644
index 6e67b5ec..00000000
--- a/RealtimeSync/tray_menu.cpp
+++ /dev/null
@@ -1,342 +0,0 @@
-// **************************************************************************
-// * This file is part of the FreeFileSync project. It is distributed under *
-// * GNU General Public License: http://www.gnu.org/licenses/gpl.html *
-// * Copyright (C) Zenju (zenju AT gmx DOT de) - All Rights Reserved *
-// **************************************************************************
-
-#include "tray_menu.h"
-#include <zen/thread.h>
-#include <zen/tick_count.h>
-#include <wx/taskbar.h>
-#include <wx/icon.h> //Linux needs this
-#include <wx/app.h>
-#include <wx/menu.h>
-#include <wx/timer.h>
-#include <wx+/image_tools.h>
-#include <zen/shell_execute.h>
-#include <wx+/popup_dlg.h>
-#include <wx+/image_resources.h>
-#include "monitor.h"
-#include "../lib/resolve_path.h"
-
-using namespace rts;
-using namespace zen;
-
-
-namespace
-{
-const std::int64_t TICKS_UPDATE_INTERVAL = rts::UI_UPDATE_INTERVAL* ticksPerSec() / 1000;
-TickVal lastExec = getTicks();
-
-bool updateUiIsAllowed()
-{
- const TickVal now = getTicks(); //0 on error
- if (dist(lastExec, now) >= TICKS_UPDATE_INTERVAL) //perform ui updates not more often than necessary
- {
- lastExec = now;
- return true;
- }
- return false;
-}
-
-
-enum TrayMode
-{
- TRAY_MODE_ACTIVE,
- TRAY_MODE_WAITING,
- TRAY_MODE_ERROR,
-};
-
-
-class TrayIconObject : public wxTaskBarIcon
-{
-public:
- TrayIconObject(const wxString& jobname) :
- resumeRequested(false),
- abortRequested(false),
- showErrorMsgRequested(false),
- mode(TRAY_MODE_ACTIVE),
- iconFlashStatusLast(false),
- jobName_(jobname),
-#if defined ZEN_WIN || defined ZEN_MAC //16x16 seems to be the only size that is shown correctly on OS X
- trayBmp(getResourceImage(L"RTS_tray_16x16")) //use a 16x16 bitmap
-#elif defined ZEN_LINUX
- trayBmp(getResourceImage(L"RTS_tray_24x24")) //use a 24x24 bitmap for perfect fit
-#endif
- {
- Connect(wxEVT_TASKBAR_LEFT_DCLICK, wxEventHandler(TrayIconObject::OnDoubleClick), nullptr, this);
- setMode(mode);
- }
-
- //require polling:
- bool resumeIsRequested() const { return resumeRequested; }
- bool abortIsRequested () const { return abortRequested; }
-
- //during TRAY_MODE_ERROR those two functions are available:
- void clearShowErrorRequested() { assert(mode == TRAY_MODE_ERROR); showErrorMsgRequested = false; }
- bool getShowErrorRequested() const { assert(mode == TRAY_MODE_ERROR); return showErrorMsgRequested; }
-
- void setMode(TrayMode m)
- {
- mode = m;
- timer.Stop();
- timer.Disconnect(wxEVT_TIMER, wxEventHandler(TrayIconObject::OnErrorFlashIcon), nullptr, this);
- switch (m)
- {
- case TRAY_MODE_ACTIVE:
- setTrayIcon(trayBmp, _("Directory monitoring active"));
- break;
-
- case TRAY_MODE_WAITING:
- setTrayIcon(greyScale(trayBmp), _("Waiting until all directories are available..."));
- break;
-
- case TRAY_MODE_ERROR:
- timer.Connect(wxEVT_TIMER, wxEventHandler(TrayIconObject::OnErrorFlashIcon), nullptr, this);
- timer.Start(500); //timer interval in [ms]
- break;
- }
- }
-
-private:
- void OnErrorFlashIcon(wxEvent& event)
- {
- iconFlashStatusLast = !iconFlashStatusLast;
- setTrayIcon(iconFlashStatusLast ? trayBmp : greyScale(trayBmp), _("Error"));
- }
-
- void setTrayIcon(const wxBitmap& bmp, const wxString& statusTxt)
- {
- wxIcon realtimeIcon;
- realtimeIcon.CopyFromBitmap(bmp);
- wxString tooltip = L"RealtimeSync\n" + statusTxt;
- if (!jobName_.empty())
- tooltip += L"\n\"" + jobName_ + L"\"";
- SetIcon(realtimeIcon, tooltip);
- }
-
- enum Selection
- {
- CONTEXT_RESTORE = 1, //wxWidgets: "A MenuItem ID of zero does not work under Mac"
- CONTEXT_SHOW_ERROR,
- CONTEXT_ABORT = wxID_EXIT
- };
-
- virtual wxMenu* CreatePopupMenu()
- {
- wxMenu* contextMenu = new wxMenu;
-
- wxMenuItem* defaultItem = nullptr;
- switch (mode)
- {
- case TRAY_MODE_ACTIVE:
- case TRAY_MODE_WAITING:
- defaultItem = new wxMenuItem(contextMenu, CONTEXT_RESTORE, _("&Restore"));
- break;
- case TRAY_MODE_ERROR:
- defaultItem = new wxMenuItem(contextMenu, CONTEXT_SHOW_ERROR, _("&Show error"));
- break;
- }
-#ifdef ZEN_WIN //no wxMenuItem::SetFont() on Linux and OS X: wasn't wxWidgets supposed to be *portable* at some point in time?????
- defaultItem->SetFont(wxNORMAL_FONT->Bold());
-#endif
- contextMenu->Append(defaultItem);
-
- contextMenu->AppendSeparator();
- contextMenu->Append(CONTEXT_ABORT, _("&Exit"));
- //event handling
- contextMenu->Connect(wxEVT_COMMAND_MENU_SELECTED, wxCommandEventHandler(TrayIconObject::OnContextMenuSelection), nullptr, this);
-
- return contextMenu; //ownership transferred to caller
- }
-
- void OnContextMenuSelection(wxCommandEvent& event)
- {
- switch (static_cast<Selection>(event.GetId()))
- {
- case CONTEXT_ABORT:
- abortRequested = true;
- break;
-
- case CONTEXT_RESTORE:
- resumeRequested = true;
- break;
-
- case CONTEXT_SHOW_ERROR:
- showErrorMsgRequested = true;
- break;
- }
- }
-
- void OnDoubleClick(wxEvent& event)
- {
- switch (mode)
- {
- case TRAY_MODE_ACTIVE:
- case TRAY_MODE_WAITING:
- resumeRequested = true; //never throw exceptions through a C-Layer call stack (GUI)!
- break;
- case TRAY_MODE_ERROR:
- showErrorMsgRequested = true;
- break;
- }
- }
-
- bool resumeRequested;
- bool abortRequested;
- bool showErrorMsgRequested;
-
- TrayMode mode;
-
- bool iconFlashStatusLast; //flash try icon for TRAY_MODE_ERROR
- wxTimer timer; //
-
- const wxString jobName_; //RTS job name, may be empty
- const wxBitmap trayBmp;
-};
-
-
-struct AbortMonitoring //exception class
-{
- AbortMonitoring(AbortReason reasonCode) : reasonCode_(reasonCode) {}
- AbortReason reasonCode_;
-};
-
-
-//=> don't derive from wxEvtHandler or any other wxWidgets object unless instance is safely deleted (deferred) during idle event!!tray_icon.h
-class TrayIconHolder
-{
-public:
- TrayIconHolder(const wxString& jobname) :
- trayObj(new TrayIconObject(jobname)) {}
-
- ~TrayIconHolder()
- {
- //harmonize with tray_icon.cpp!!!
- trayObj->RemoveIcon();
- //use wxWidgets delayed destruction: delete during next idle loop iteration (handle late window messages, e.g. when double-clicking)
- wxPendingDelete.Append(trayObj);
- }
-
- void doUiRefreshNow() //throw AbortMonitoring
- {
- wxTheApp->Yield(); //yield is UI-layer which is represented by this tray icon
-
- //advantage of polling vs callbacks: we can throw exceptions!
- if (trayObj->resumeIsRequested())
- throw AbortMonitoring(SHOW_GUI);
-
- if (trayObj->abortIsRequested())
- throw AbortMonitoring(EXIT_APP);
- }
-
- void setMode(TrayMode m) { trayObj->setMode(m); }
-
- bool getShowErrorRequested() const { return trayObj->getShowErrorRequested(); }
- void clearShowErrorRequested() { trayObj->clearShowErrorRequested(); }
-
-private:
- TrayIconObject* trayObj;
-};
-
-//##############################################################################################################
-}
-
-
-rts::AbortReason rts::startDirectoryMonitor(const xmlAccess::XmlRealConfig& config, const wxString& jobname)
-{
- std::vector<Zstring> dirNamesNonFmt = config.directories;
- vector_remove_if(dirNamesNonFmt, [](Zstring str) -> bool { trim(str); return str.empty(); }); //remove empty entries WITHOUT formatting paths yet!
-
- if (dirNamesNonFmt.empty())
- {
- showNotificationDialog(nullptr, DialogInfoType::ERROR2, PopupDialogCfg().setMainInstructions(_("A folder input field is empty.")));
- return SHOW_GUI;
- }
-
- Zstring cmdLine = config.commandline;
- trim(cmdLine);
-
- if (cmdLine.empty())
- {
- showNotificationDialog(nullptr, DialogInfoType::ERROR2, PopupDialogCfg().setMainInstructions(_("Incorrect command line:") + L" \"\""));
- return SHOW_GUI;
- }
-
- struct MonitorCallbackImpl : public MonitorCallback
- {
- MonitorCallbackImpl(const wxString& jobname,
- const Zstring& cmdLine) : trayIcon(jobname), cmdLine_(cmdLine) {}
-
- virtual void setPhase(WatchPhase mode)
- {
- switch (mode)
- {
- case MONITOR_PHASE_ACTIVE:
- trayIcon.setMode(TRAY_MODE_ACTIVE);
- break;
- case MONITOR_PHASE_WAITING:
- trayIcon.setMode(TRAY_MODE_WAITING);
- break;
- }
- }
-
- virtual void executeExternalCommand()
- {
- auto cmdLineExp = expandMacros(cmdLine_);
- try
- {
- shellExecute2(cmdLineExp, EXEC_TYPE_SYNC); //throw FileError
- }
- catch (const FileError& e)
- {
- warn_static("fix dialog hiding on OSX !!")
- showNotificationDialog(nullptr, DialogInfoType::ERROR2, PopupDialogCfg().setDetailInstructions(e.toString()));
- }
- }
-
- virtual void requestUiRefresh()
- {
- if (updateUiIsAllowed())
- trayIcon.doUiRefreshNow(); //throw AbortMonitoring
- }
-
- virtual void reportError(const std::wstring& msg)
- {
- trayIcon.setMode(TRAY_MODE_ERROR);
- trayIcon.clearShowErrorRequested();
-
- //wait for some time, then return to retry
- assert_static(15 * 1000 % UI_UPDATE_INTERVAL == 0);
- for (int i = 0; i < 15 * 1000 / UI_UPDATE_INTERVAL; ++i)
- {
- trayIcon.doUiRefreshNow(); //throw AbortMonitoring
-
- if (trayIcon.getShowErrorRequested())
- switch (showConfirmationDialog(nullptr, DialogInfoType::ERROR2, PopupDialogCfg().
- setDetailInstructions(msg), _("&Retry")))
- {
- case ConfirmationButton::DO_IT: //retry
- return;
- case ConfirmationButton::CANCEL:
- throw AbortMonitoring(SHOW_GUI);
- }
- boost::this_thread::sleep(boost::posix_time::milliseconds(UI_UPDATE_INTERVAL));
- }
- }
-
- TrayIconHolder trayIcon;
- const Zstring cmdLine_;
- } cb(jobname, cmdLine);
-
- try
- {
- monitorDirectories(dirNamesNonFmt, config.delay, cb); //cb: throw AbortMonitoring
- assert(false);
- return SHOW_GUI;
- }
- catch (const AbortMonitoring& ab)
- {
- return ab.reasonCode_;
- }
-}
diff --git a/RealtimeSync/tray_menu.h b/RealtimeSync/tray_menu.h
deleted file mode 100644
index 1f71a017..00000000
--- a/RealtimeSync/tray_menu.h
+++ /dev/null
@@ -1,23 +0,0 @@
-// **************************************************************************
-// * This file is part of the FreeFileSync project. It is distributed under *
-// * GNU General Public License: http://www.gnu.org/licenses/gpl.html *
-// * Copyright (C) Zenju (zenju AT gmx DOT de) - All Rights Reserved *
-// **************************************************************************
-
-#ifndef TRAY_583967857420987534253245
-#define TRAY_583967857420987534253245
-
-#include <wx/string.h>
-#include "xml_proc.h"
-
-namespace rts
-{
-enum AbortReason
-{
- SHOW_GUI,
- EXIT_APP
-};
-AbortReason startDirectoryMonitor(const xmlAccess::XmlRealConfig& config, const wxString& jobname); //jobname may be empty
-}
-
-#endif //TRAY_583967857420987534253245
diff --git a/RealtimeSync/xml_ffs.cpp b/RealtimeSync/xml_ffs.cpp
deleted file mode 100644
index 149b0bbe..00000000
--- a/RealtimeSync/xml_ffs.cpp
+++ /dev/null
@@ -1,79 +0,0 @@
-// **************************************************************************
-// * This file is part of the FreeFileSync project. It is distributed under *
-// * GNU General Public License: http://www.gnu.org/licenses/gpl.html *
-// * Copyright (C) Zenju (zenju AT gmx DOT de) - All Rights Reserved *
-// **************************************************************************
-
-#include "xml_ffs.h"
-#include "../lib/ffs_paths.h"
-#include <zen/zstring.h>
-//#include <wx+/string_conv.h>
-
-//include FreeFileSync xml headers
-#include "../lib/process_xml.h"
-
-using namespace zen;
-
-
-xmlAccess::XmlRealConfig convertBatchToReal(const xmlAccess::XmlBatchConfig& batchCfg, const Zstring& filename)
-{
- std::set<Zstring, LessFilename> uniqueFolders;
-
- //add main folders
- uniqueFolders.insert(batchCfg.mainCfg.firstPair.leftDirectory);
- uniqueFolders.insert(batchCfg.mainCfg.firstPair.rightDirectory);
-
- //additional folders
- std::for_each(batchCfg.mainCfg.additionalPairs.begin(), batchCfg.mainCfg.additionalPairs.end(),
- [&](const FolderPairEnh & fp)
- {
- uniqueFolders.insert(fp.leftDirectory);
- uniqueFolders.insert(fp.rightDirectory);
- });
-
- uniqueFolders.erase(Zstring());
-
- xmlAccess::XmlRealConfig output;
- output.directories.assign(uniqueFolders.begin(), uniqueFolders.end());
- output.commandline = Zstr("\"") + zen::getFreeFileSyncLauncher() + Zstr("\" \"") + filename + Zstr("\"");
- return output;
-}
-
-
-void rts::readRealOrBatchConfig(const Zstring& filename, xmlAccess::XmlRealConfig& config) //throw xmlAccess::FfsXmlError;
-{
- if (xmlAccess::getXmlType(filename) != xmlAccess::XML_TYPE_BATCH)
- {
- xmlAccess::readRealConfig(filename, config);
- return;
- }
-
- //convert batch config to RealtimeSync config
- xmlAccess::XmlBatchConfig batchCfg;
- try
- {
- xmlAccess::readConfig(filename, batchCfg); //throw xmlAccess::FfsXmlError;
- }
- catch (const xmlAccess::FfsXmlError& e)
- {
- if (e.getSeverity() == xmlAccess::FfsXmlError::WARNING)
- config = convertBatchToReal(batchCfg, filename); //do work despite parsing errors, then re-throw
-
- throw; //
- }
- config = convertBatchToReal(batchCfg, filename);
-}
-
-
-int rts::getProgramLanguage()
-{
- xmlAccess::XmlGlobalSettings settings;
-
- try
- {
- xmlAccess::readConfig(settings);
- }
- catch (const xmlAccess::FfsXmlError&) {} //user default language if error occurred
-
- return settings.programLanguage;
-}
diff --git a/RealtimeSync/xml_ffs.h b/RealtimeSync/xml_ffs.h
deleted file mode 100644
index 90c1c6ca..00000000
--- a/RealtimeSync/xml_ffs.h
+++ /dev/null
@@ -1,23 +0,0 @@
-// **************************************************************************
-// * This file is part of the FreeFileSync project. It is distributed under *
-// * GNU General Public License: http://www.gnu.org/licenses/gpl.html *
-// * Copyright (C) Zenju (zenju AT gmx DOT de) - All Rights Reserved *
-// **************************************************************************
-
-#ifndef XMLFREEFILESYNC_H_INCLUDED
-#define XMLFREEFILESYNC_H_INCLUDED
-
-#include "xml_proc.h"
-#include <zen/zstring.h>
-
-
-//reuse (some of) FreeFileSync's xml files
-
-namespace rts
-{
-void readRealOrBatchConfig(const Zstring& filename, xmlAccess::XmlRealConfig& config); //throw FfsXmlError
-
-int getProgramLanguage();
-}
-
-#endif // XMLFREEFILESYNC_H_INCLUDED
diff --git a/RealtimeSync/xml_proc.cpp b/RealtimeSync/xml_proc.cpp
deleted file mode 100644
index db235ecb..00000000
--- a/RealtimeSync/xml_proc.cpp
+++ /dev/null
@@ -1,75 +0,0 @@
-// **************************************************************************
-// * This file is part of the FreeFileSync project. It is distributed under *
-// * GNU General Public License: http://www.gnu.org/licenses/gpl.html *
-// * Copyright (C) Zenju (zenju AT gmx DOT de) - All Rights Reserved *
-// **************************************************************************
-
-#include "xml_proc.h"
-#include <wx/filefn.h>
-#include <zen/file_handling.h>
-#include <wx+/string_conv.h>
-
-using namespace zen;
-using namespace xmlAccess;
-
-
-namespace
-{
-void readConfig(const XmlIn& in, XmlRealConfig& config)
-{
- in["Directories"](config.directories);
- in["Delay" ](config.delay);
- in["Commandline"](config.commandline);
-}
-
-
-bool isXmlTypeRTS(const XmlDoc& doc) //throw()
-{
- if (doc.root().getNameAs<std::string>() == "FreeFileSync")
- {
- std::string type;
- if (doc.root().getAttribute("XmlType", type))
- return type == "REAL";
- }
- return false;
-}
-}
-
-
-void xmlAccess::readRealConfig(const Zstring& filename, XmlRealConfig& config)
-{
- XmlDoc doc = loadXmlDocument(filename); //throw FfsXmlError
-
- if (!isXmlTypeRTS(doc))
- throw FfsXmlError(replaceCpy(_("File %x does not contain a valid configuration."), L"%x", fmtFileName(filename)));
-
- XmlIn in(doc);
- ::readConfig(in, config);
-
- if (in.errorsOccured())
- throw FfsXmlError(replaceCpy(_("Configuration file %x loaded partially only."), L"%x", fmtFileName(filename)) + L"\n\n" +
- getErrorMessageFormatted(in.getErrorsAs<std::wstring>()), FfsXmlError::WARNING);
-}
-
-
-namespace
-{
-void writeConfig(const XmlRealConfig& config, XmlOut& out)
-{
- out["Directories"](config.directories);
- out["Delay" ](config.delay);
- out["Commandline"](config.commandline);
-}
-}
-
-
-void xmlAccess::writeRealConfig(const XmlRealConfig& config, const Zstring& filename)
-{
- XmlDoc doc("FreeFileSync");
- doc.root().setAttribute("XmlType", "REAL");
-
- XmlOut out(doc);
- writeConfig(config, out);
-
- saveXmlDocument(doc, filename); //throw FfsXmlError
-}
diff --git a/RealtimeSync/xml_proc.h b/RealtimeSync/xml_proc.h
deleted file mode 100644
index 671a237f..00000000
--- a/RealtimeSync/xml_proc.h
+++ /dev/null
@@ -1,30 +0,0 @@
-// **************************************************************************
-// * This file is part of the FreeFileSync project. It is distributed under *
-// * GNU General Public License: http://www.gnu.org/licenses/gpl.html *
-// * Copyright (C) Zenju (zenju AT gmx DOT de) - All Rights Reserved *
-// **************************************************************************
-
-#ifndef XMLPROCESSING_H_INCLUDED
-#define XMLPROCESSING_H_INCLUDED
-
-#include <vector>
-//#include <wx/string.h>
-#include <zen/zstring.h>
-#include "../lib/xml_base.h"
-
-
-namespace xmlAccess
-{
-struct XmlRealConfig
-{
- XmlRealConfig() : delay(10) {}
- std::vector<Zstring> directories;
- Zstring commandline;
- unsigned int delay;
-};
-
-void readRealConfig(const Zstring& filename, XmlRealConfig& config); //throw FfsXmlError
-void writeRealConfig(const XmlRealConfig& config, const Zstring& filename); //throw FfsXmlError
-}
-
-#endif // XMLPROCESSING_H_INCLUDED
bgstack15