diff options
-rw-r--r-- | Application.cpp | 60 | ||||
-rw-r--r-- | Application.h | 4 | ||||
-rw-r--r-- | COMPILE.cmd | 20 | ||||
-rw-r--r-- | FreeFileSync.cbp | 45 | ||||
-rw-r--r-- | FreeFileSync.cpp | 389 | ||||
-rw-r--r-- | FreeFileSync.h | 91 | ||||
-rw-r--r-- | Readme.txt | 3 | ||||
-rw-r--r-- | Resources.dat | bin | 75817 -> 83337 bytes | |||
-rw-r--r-- | language.dat | 10 | ||||
-rw-r--r-- | library/CustomGrid.cpp | 2 | ||||
-rw-r--r-- | library/CustomGrid.h | 2 | ||||
-rw-r--r-- | library/globalFunctions.cpp | 14 | ||||
-rw-r--r-- | library/globalFunctions.h | 4 | ||||
-rw-r--r-- | ui/MainDialog.cpp | 809 | ||||
-rw-r--r-- | ui/MainDialog.h | 97 | ||||
-rw-r--r-- | ui/Resources.cpp | 4 | ||||
-rw-r--r-- | ui/Resources.h | 1 | ||||
-rw-r--r-- | ui/SmallDialogs.cpp | 71 | ||||
-rw-r--r-- | ui/SmallDialogs.h | 31 | ||||
-rw-r--r-- | ui/SyncDialog.cpp | 11 | ||||
-rw-r--r-- | ui/SyncDialog.h | 3 | ||||
-rw-r--r-- | ui/guiGenerated.cpp (renamed from ui/GUI_Generated.cpp) | 416 | ||||
-rw-r--r-- | ui/guiGenerated.h (renamed from ui/GUI_Generated.h) | 119 |
23 files changed, 1599 insertions, 607 deletions
diff --git a/Application.cpp b/Application.cpp index 1ce4739e..2c08f988 100644 --- a/Application.cpp +++ b/Application.cpp @@ -7,14 +7,14 @@ * License: **************************************************************/ -#include "Application.h" -#include "UI\MainDialog.h" +#include "application.h" +#include "ui/mainDialog.h" #include <wx/stdpaths.h> #include <wx/filename.h> #include <stdexcept> //for std::runtime_error #include <wx/wfstream.h> #include <wx/zipstrm.h> -#include "library\globalFunctions.h" +#include "library/globalFunctions.h" IMPLEMENT_APP(Application); @@ -31,12 +31,12 @@ bool Application::ProcessIdle() } //Note: initialization is done in the FIRST idle event instead in OnInit. Reason: Commandline mode requires the wxApp eventhandler to be established -//for UI update events. This is not given in OnInit. +//for UI update events. This is not the case in OnInit. bool Application::OnInit() { returnValue = 0; - //do not call wxApp::OnInit() to avoid parsing commandline now but use own parser later + //do not call wxApp::OnInit() to avoid parsing commandline now, instead use own parser later return true; } @@ -56,17 +56,30 @@ void Application::initialize() //load icon and animation resources (also needed for commandline: status dialog, error dialog GlobalResources::loadResourceFiles(); - if (parsedCommandline()) //Note: "return false" is a must here for commandline usage with "-silent" since program crashes if "return true" and no windows have been created + //test if ffs is to be started on UI with config file passed as commandline parameter + wxString configFileUI = FreeFileSync::FFS_LastConfigFile; + if (argc >= 2 && wxFileExists(argv[1]) && FreeFileSync::isFFS_ConfigFile(argv[1])) + configFileUI = argv[1]; + + //should it start in commandline mode? + else if (argc > 1) + { + parseCommandline(); + if (applicationRunsOnCommandLineWithoutWindows) { - ExitMainLoop(); //exit programm on next main loop iteration + ExitMainLoop(); //exit programm on next main loop iteration return; } else - return; //wait for the user to close the status window + return; //wait for the user to close the status window + } + else + ; //no parameters passed, continue with UI + //show UI dialog - MainDialog* frame = new MainDialog(0L); + MainDialog* frame = new MainDialog(0L, configFileUI); frame->SetIcon(wxICON(aaaa)); // To Set App Icon frame->Show(); @@ -151,7 +164,7 @@ void Application::closeLog() } -bool Application::parsedCommandline() +void Application::parseCommandline() { //commandline-descriptor must be initialized here AFTER the program language is set const wxCmdLineEntryDesc cmdLineDesc [] = @@ -233,15 +246,11 @@ bool Application::parsedCommandline() } }; - - if (argc <= 1) - return false; //no parameters passed, continue with UI - //now set the parser with all MANDATORY options and parameters wxCmdLineParser parser(cmdLineDesc, argc, argv); parser.SetSwitchChars(wxT("-")); if (parser.Parse() != 0) //if commandline is used incorrectly display help dialog and exit program - return true; + return; //commandline parameters wxString cmp; @@ -262,7 +271,7 @@ bool Application::parsedCommandline() parser.GetParamCount() != 2) { parser.Usage(); - return true; + return; } cmp.UpperCase(); @@ -295,7 +304,7 @@ bool Application::parsedCommandline() (cfg[4] != 'L' && cfg[4] != 'R' && cfg[4] != 'N')) { parser.Usage(); - return true; + return; } //init logfile @@ -312,7 +321,7 @@ bool Application::parsedCommandline() else wxMessageBox(errorMessage, _("Warning"), wxICON_WARNING); returnValue = -2; - return true; + return; } else if (!wxDirExists(rightDir)) { @@ -322,7 +331,7 @@ bool Application::parsedCommandline() else wxMessageBox(errorMessage, _("Warning"), wxICON_WARNING); returnValue = -2; - return true; + return; } //until here all options and parameters are consistent @@ -378,7 +387,7 @@ bool Application::parsedCommandline() else statusUpdater.updateFinalStatus(errorMessage); returnValue = -3; - return true; + return; } //APPLY FILTERS @@ -408,10 +417,10 @@ bool Application::parsedCommandline() if (silent) closeLog(); returnValue = -4; - return true; + return; } - return true; //exit program and skip UI dialogs + return; //exit program and skip UI dialogs } //###################################################################################################### @@ -457,7 +466,12 @@ void CommandLineStatusUpdater::updateStatus(const wxString& text) { if (!silentMode) - syncStatusFrame->setStatusText_NoUpdate(text); + { + if (switchedToSynchronisation) + syncStatusFrame->setStatusText_NoUpdate(text); + else + syncStatusFrame->setStatusText_NoUpdate(_("Scanning... ") + text); + } } diff --git a/Application.h b/Application.h index 362f8269..bcf49d00 100644 --- a/Application.h +++ b/Application.h @@ -15,7 +15,7 @@ #include <set> #include <fstream> #include "FreeFileSync.h" -#include "ui\SmallDialogs.h" +#include "ui/smallDialogs.h" struct TranslationLine { @@ -72,7 +72,7 @@ public: void closeLog(); private: - bool parsedCommandline(); + void parseCommandline(); bool applicationRunsOnCommandLineWithoutWindows; diff --git a/COMPILE.cmd b/COMPILE.cmd index f43e171a..7df1cd02 100644 --- a/COMPILE.cmd +++ b/COMPILE.cmd @@ -1,16 +1,16 @@ set widgets=C:\Programme\CodeBlocks\wxWidgets set sources=C:\Programme\CodeBlocks\Projects\FreeFileSync -mingw32-g++.exe -Wall -pipe -mthreads -D__GNUWIN32__ -D__WXMSW__ -O2 -DNDEBUG -I%widgets%\include -I%widgets%\contrib\include -I%widgets%\lib\gcc_lib\msw -c %sources%\Application.cpp -o obj\Release\Application.o -mingw32-g++.exe -Wall -pipe -mthreads -D__GNUWIN32__ -D__WXMSW__ -O2 -DNDEBUG -I%widgets%\include -I%widgets%\contrib\include -I%widgets%\lib\gcc_lib\msw -c %sources%\FreeFileSync.cpp -o obj\Release\FreeFileSync.o -mingw32-g++.exe -Wall -pipe -mthreads -D__GNUWIN32__ -D__WXMSW__ -O2 -DNDEBUG -I%widgets%\include -I%widgets%\contrib\include -I%widgets%\lib\gcc_lib\msw -c %sources%\Library\globalFunctions.cpp -o obj\Release\Library\globalFunctions.o -mingw32-g++.exe -Wall -pipe -mthreads -D__GNUWIN32__ -D__WXMSW__ -O2 -DNDEBUG -I%widgets%\include -I%widgets%\contrib\include -I%widgets%\lib\gcc_lib\msw -c %sources%\UI\GUI_Generated.cpp -o obj\Release\UI\GUI_Generated.o -mingw32-g++.exe -Wall -pipe -mthreads -D__GNUWIN32__ -D__WXMSW__ -O2 -DNDEBUG -I%widgets%\include -I%widgets%\contrib\include -I%widgets%\lib\gcc_lib\msw -c %sources%\UI\MainDialog.cpp -o obj\Release\UI\MainDialog.o -mingw32-g++.exe -Wall -pipe -mthreads -D__GNUWIN32__ -D__WXMSW__ -O2 -DNDEBUG -I%widgets%\include -I%widgets%\contrib\include -I%widgets%\lib\gcc_lib\msw -c %sources%\UI\SyncDialog.cpp -o obj\Release\UI\SyncDialog.o -mingw32-g++.exe -Wall -pipe -mthreads -D__GNUWIN32__ -D__WXMSW__ -O2 -DNDEBUG -I%widgets%\include -I%widgets%\contrib\include -I%widgets%\lib\gcc_lib\msw -c %sources%\library\CustomGrid.cpp -o obj\Release\library\CustomGrid.o -mingw32-g++.exe -Wall -pipe -mthreads -D__GNUWIN32__ -D__WXMSW__ -O2 -DNDEBUG -I%widgets%\include -I%widgets%\contrib\include -I%widgets%\lib\gcc_lib\msw -c %sources%\ui\Resources.cpp -o obj\Release\ui\Resources.o -mingw32-g++.exe -Wall -pipe -mthreads -D__GNUWIN32__ -D__WXMSW__ -O2 -DNDEBUG -I%widgets%\include -I%widgets%\contrib\include -I%widgets%\lib\gcc_lib\msw -c %sources%\ui\SmallDialogs.cpp -o obj\Release\ui\SmallDialogs.o +mingw32-g++.exe -Wall -pipe -mthreads -D__GNUWIN32__ -D__WXMSW__ -DFFS_WIN -O2 -DNDEBUG -I%widgets%\include -I%widgets%\contrib\include -I%widgets%\lib\gcc_lib\msw -c %sources%\Application.cpp -o obj\Release\Application.o +mingw32-g++.exe -Wall -pipe -mthreads -D__GNUWIN32__ -D__WXMSW__ -DFFS_WIN -O2 -DNDEBUG -I%widgets%\include -I%widgets%\contrib\include -I%widgets%\lib\gcc_lib\msw -c %sources%\FreeFileSync.cpp -o obj\Release\FreeFileSync.o +mingw32-g++.exe -Wall -pipe -mthreads -D__GNUWIN32__ -D__WXMSW__ -DFFS_WIN -O2 -DNDEBUG -I%widgets%\include -I%widgets%\contrib\include -I%widgets%\lib\gcc_lib\msw -c %sources%\Library\globalFunctions.cpp -o obj\Release\Library\globalFunctions.o +mingw32-g++.exe -Wall -pipe -mthreads -D__GNUWIN32__ -D__WXMSW__ -DFFS_WIN -O2 -DNDEBUG -I%widgets%\include -I%widgets%\contrib\include -I%widgets%\lib\gcc_lib\msw -c %sources%\UI\GUI_Generated.cpp -o obj\Release\UI\GUI_Generated.o +mingw32-g++.exe -Wall -pipe -mthreads -D__GNUWIN32__ -D__WXMSW__ -DFFS_WIN -O2 -DNDEBUG -I%widgets%\include -I%widgets%\contrib\include -I%widgets%\lib\gcc_lib\msw -c %sources%\UI\MainDialog.cpp -o obj\Release\UI\MainDialog.o +mingw32-g++.exe -Wall -pipe -mthreads -D__GNUWIN32__ -D__WXMSW__ -DFFS_WIN -O2 -DNDEBUG -I%widgets%\include -I%widgets%\contrib\include -I%widgets%\lib\gcc_lib\msw -c %sources%\UI\SyncDialog.cpp -o obj\Release\UI\SyncDialog.o +mingw32-g++.exe -Wall -pipe -mthreads -D__GNUWIN32__ -D__WXMSW__ -DFFS_WIN -O2 -DNDEBUG -I%widgets%\include -I%widgets%\contrib\include -I%widgets%\lib\gcc_lib\msw -c %sources%\library\CustomGrid.cpp -o obj\Release\library\CustomGrid.o +mingw32-g++.exe -Wall -pipe -mthreads -D__GNUWIN32__ -D__WXMSW__ -DFFS_WIN -O2 -DNDEBUG -I%widgets%\include -I%widgets%\contrib\include -I%widgets%\lib\gcc_lib\msw -c %sources%\ui\Resources.cpp -o obj\Release\ui\Resources.o +mingw32-g++.exe -Wall -pipe -mthreads -D__GNUWIN32__ -D__WXMSW__ -DFFS_WIN -O2 -DNDEBUG -I%widgets%\include -I%widgets%\contrib\include -I%widgets%\lib\gcc_lib\msw -c %sources%\ui\SmallDialogs.cpp -o obj\Release\ui\SmallDialogs.o +mingw32-gcc.exe -Wall -pipe -mthreads -D__GNUWIN32__ -D__WXMSW__ -DFFS_WIN -O2 -DNDEBUG -I%widgets%\wxWidgets\include -I%widgets%\contrib\include -I%widgets%\lib\gcc_lib\msw -c %sources%\Library\md5.c -o obj\Release\Library\md5.o windres.exe -i %sources%\resource.rc -J rc -o obj\Release\resource.res -O coff -I%widgets%\include -I%widgets%\lib\gcc_lib\msw -mingw32-gcc.exe -Wall -pipe -mthreads -D__GNUWIN32__ -D__WXMSW__ -O2 -DNDEBUG -I%widgets%\wxWidgets\include -I%widgets%\contrib\include -I%widgets%\lib\gcc_lib\msw -c %sources%\Library\md5.c -o obj\Release\Library\md5.o mingw32-g++.exe -L%widgets%\lib\gcc_lib -o FreeFileSync.exe obj\Release\Application.o obj\Release\FreeFileSync.o obj\Release\Library\globalFunctions.o obj\Release\Library\md5.o obj\Release\UI\GUI_Generated.o obj\Release\UI\MainDialog.o obj\Release\UI\SyncDialog.o obj\Release\library\CustomGrid.o obj\Release\ui\Resources.o obj\Release\ui\SmallDialogs.o obj\Release\resource.res -s -mthreads -lwxmsw28_adv -lwxmsw28_core -lwxbase28 -lwxpng -lwxzlib -lkernel32 -luser32 -lgdi32 -lwinspool -lcomdlg32 -ladvapi32 -lshell32 -lole32 -loleaut32 -luuid -lcomctl32 -lwsock32 -lodbc32 Library\GMP\lib\libgmpxx.a Library\GMP\lib\libgmp.a -mwindows pause
\ No newline at end of file diff --git a/FreeFileSync.cbp b/FreeFileSync.cbp index 66270622..780e4977 100644 --- a/FreeFileSync.cbp +++ b/FreeFileSync.cbp @@ -61,6 +61,7 @@ <Add option='[[if (PLATFORM == PLATFORM_MSW && (GetCompilerFactory().GetCompilerVersionString(_T("gcc")) >= _T("4.0.0"))) print(_T("-Wno-attributes"));]]' /> <Add option="-D__GNUWIN32__" /> <Add option="-D__WXMSW__" /> + <Add option="-DFFS_WIN" /> <Add directory="C:\Programme\CodeBlocks\wxWidgets\include" /> <Add directory="C:\Programme\CodeBlocks\wxWidgets\contrib\include" /> </Compiler> @@ -82,37 +83,37 @@ <Add library="libcomctl32.a" /> <Add library="libwsock32.a" /> <Add library="libodbc32.a" /> - <Add library="Library\GMP\lib\libgmpxx.a" /> - <Add library="Library\GMP\lib\libgmp.a" /> + <Add library="library\gmp\lib\libgmpxx.a" /> + <Add library="library\gmp\lib\libgmp.a" /> </Linker> - <Unit filename="Application.cpp" /> - <Unit filename="Application.h" /> <Unit filename="FreeFileSync.cpp" /> <Unit filename="FreeFileSync.h" /> - <Unit filename="Library\GMP\include\gmp.h" /> - <Unit filename="Library\globalFunctions.cpp" /> - <Unit filename="Library\globalFunctions.h" /> - <Unit filename="Library\md5.c"> + <Unit filename="WxWizFrame.fbp" /> + <Unit filename="application.cpp" /> + <Unit filename="application.h" /> + <Unit filename="library\customGrid.cpp" /> + <Unit filename="library\customGrid.h" /> + <Unit filename="library\globalFunctions.cpp" /> + <Unit filename="library\globalFunctions.h" /> + <Unit filename="library\gmp\include\gmp.h" /> + <Unit filename="library\md5.c"> <Option compilerVar="CC" /> </Unit> - <Unit filename="Library\md5.h" /> - <Unit filename="UI\GUI_Generated.cpp" /> - <Unit filename="UI\GUI_Generated.h" /> - <Unit filename="UI\MainDialog.cpp" /> - <Unit filename="UI\MainDialog.h" /> - <Unit filename="UI\SyncDialog.cpp" /> - <Unit filename="UI\SyncDialog.h" /> - <Unit filename="WxWizFrame.fbp" /> - <Unit filename="library\CustomGrid.cpp" /> - <Unit filename="library\CustomGrid.h" /> + <Unit filename="library\md5.h" /> <Unit filename="library\wxWidgets.h" /> <Unit filename="resource.rc"> <Option compilerVar="WINDRES" /> </Unit> - <Unit filename="ui\Resources.cpp" /> - <Unit filename="ui\Resources.h" /> - <Unit filename="ui\SmallDialogs.cpp" /> - <Unit filename="ui\SmallDialogs.h" /> + <Unit filename="ui\guiGenerated.cpp" /> + <Unit filename="ui\guiGenerated.h" /> + <Unit filename="ui\mainDialog.cpp" /> + <Unit filename="ui\mainDialog.h" /> + <Unit filename="ui\resources.cpp" /> + <Unit filename="ui\resources.h" /> + <Unit filename="ui\smallDialogs.cpp" /> + <Unit filename="ui\smallDialogs.h" /> + <Unit filename="ui\syncDialog.cpp" /> + <Unit filename="ui\syncDialog.h" /> <Extensions> <code_completion /> <envvars /> diff --git a/FreeFileSync.cpp b/FreeFileSync.cpp index 6269fd60..01031f9b 100644 --- a/FreeFileSync.cpp +++ b/FreeFileSync.cpp @@ -4,12 +4,16 @@ #include "FreeFileSync.h" #include "library\md5.h" #include <stdexcept> //for std::runtime_error -#include "library\globalfunctions.h" -#include "library\GMP\include\gmp.h" +#include "library/globalFunctions.h" +#include "library/gmp/include\gmp.h" #include <wx/filename.h> +#include <fstream> using namespace GlobalFunctions; +const wxString FreeFileSync::FFS_ConfigFileID = "FFS_CONFIG"; +const wxString FreeFileSync::FFS_LastConfigFile = "LastRun.FFS"; + inline wxString formatTime(unsigned int number) { @@ -35,7 +39,7 @@ wxString formatTime(unsigned int number) } -bool filetimeCmpSmallerThan(const FILETIME a,const FILETIME b) +bool filetimeCmpSmallerThan(const FILETIME a, const FILETIME b) { if (a.dwHighDateTime != b.dwHighDateTime) return (a.dwHighDateTime < b.dwHighDateTime); @@ -59,7 +63,7 @@ void FreeFileSync::getFileInformation(FileInfo& output, const wxString& filename HANDLE fileHandle; if ((fileHandle = FindFirstFile(filename.c_str(), &winFileInfo)) == INVALID_HANDLE_VALUE) - throw FileError((wxString(_("Could not retrieve file info for: ")) + "\"" + filename.c_str() + "\"").c_str()); + throw FileError(wxString(_("Could not retrieve file info for: ")) + "\"" + filename + "\""); FindClose(fileHandle); @@ -115,6 +119,7 @@ void FreeFileSync::getFileInformation(FileInfo& output, const wxString& filename mpz_clear(largeInt); } + wxString FreeFileSync::calculateMD5Hash(const wxString& filename) { const unsigned int bufferSize = 4096; @@ -127,7 +132,7 @@ wxString FreeFileSync::calculateMD5Hash(const wxString& filename) md5_init(&state); FILE* inputFile = fopen( filename.c_str(), "rb"); if (!inputFile) - throw FileError((wxString(_("Could not open file: ")) + "\"" + filename + "\"").c_str()); + throw FileError(wxString(_("Could not open file: ")) + "\"" + filename + "\""); do { unsigned int length = fread(buffer, 1, bufferSize, inputFile); @@ -460,18 +465,16 @@ private: }; -void FreeFileSync::moveToRecycleBin(const char* filename) +void FreeFileSync::moveToRecycleBin(const wxString& filename) { - BOOL aborted = false; + bool aborted = false; SHFILEOPSTRUCT fileOp; - char filenameDoubleNull[MAX_PATH + 1]; - strcpy (filenameDoubleNull, filename); - filenameDoubleNull[strlen(filenameDoubleNull) + 1] = 0; + wxString filenameDoubleNull = filename + char(0); fileOp.hwnd = NULL; fileOp.wFunc = FO_DELETE; - fileOp.pFrom = filenameDoubleNull; + fileOp.pFrom = filenameDoubleNull.c_str(); fileOp.pTo = NULL; fileOp.fFlags = FOF_ALLOWUNDO | FOF_NOCONFIRMATION | FOF_SILENT; fileOp.fAnyOperationsAborted = aborted; @@ -479,14 +482,14 @@ void FreeFileSync::moveToRecycleBin(const char* filename) fileOp.lpszProgressTitle = NULL; if (fileOperation(&fileOp //Pointer to an SHFILEOPSTRUCT structure that contains information the function needs to carry out. - ) != 0 || aborted) throw FileError(string(_("Error moving file ")) + filename + _(" to recycle bin!")); + ) != 0 || aborted) throw FileError(wxString(_("Error moving file ")) + "\"" + filename + "\"" + _(" to recycle bin!")); } inline -void FreeFileSync::removeFile(const char* filename) +void FreeFileSync::removeFile(const wxString& filename) { - if (!wxFileExists(filename)) return; + if (!wxFileExists(filename)) return; //this is NOT an error situation: the manual deletion relies on it! if (recycleBinAvailable) { @@ -495,17 +498,19 @@ void FreeFileSync::removeFile(const char* filename) } if (!SetFileAttributes( - filename, // address of filename + filename.c_str(), // address of filename FILE_ATTRIBUTE_NORMAL // address of attributes to set - )) throw FileError(string(_("Error deleting file ")) + filename); + )) throw FileError(wxString(_("Error deleting file ")) + "\"" + filename + "\""); - if (!DeleteFile(filename)) throw FileError(string(_("Error deleting file ")) + filename); + + if (!wxRemoveFile(filename)) + throw FileError(wxString(_("Error deleting file ")) + "\"" + filename + "\""); } -void FreeFileSync::removeDirectory(const char* directory) +void FreeFileSync::removeDirectory(const wxString& directory) { - if (!wxDirExists(directory)) return; + if (!wxDirExists(directory)) return; //this is NOT an error situation: the manual deletion relies on it! if (recycleBinAvailable) { @@ -513,38 +518,47 @@ void FreeFileSync::removeDirectory(const char* directory) return; } - wxDir dir(directory); - - //get all files and directories from current directory (and subdirectories) wxArrayString fileList; wxArrayString dirList; - GetAllFilesSimple traverser(fileList, dirList); - dir.Traverse(traverser); + + { //own scope for directory access to not disturb deletion! + wxDir dir(directory); + + //get all files and directories from current directory (and subdirectories) + GetAllFilesSimple traverser(fileList, dirList); + dir.Traverse(traverser); + } for (unsigned int j = 0; j < fileList.GetCount(); ++j) - removeFile(fileList[j].c_str()); + removeFile(fileList[j]); dirList.Insert(directory, 0); //this directory will be deleted last for (int j = int(dirList.GetCount()) - 1; j >= 0 ; --j) - if (!RemoveDirectory(dirList[j].c_str() // address of directory to remove - )) throw FileError(string(_("Error deleting directory ")) + dirList[j].c_str()); + + if (!wxRmdir(dirList[j])) + throw FileError(wxString(_("Error deleting directory ")) + "\"" + dirList[j] + "\""); +} + + +inline +void FreeFileSync::copyfile(const wxString& source, const wxString& target) +{ + if (!wxCopyFile(source, target, false)) //return false if file exists + throw FileError(wxString(_("Error copying file ")) + "\"" + source + "\"" + _(" to ") + "\"" + target + "\""); } inline -void FreeFileSync::copyOverwriting(const char* source, const char* target) +void FreeFileSync::copyOverwriting(const wxString& source, const wxString& target) { if (!SetFileAttributes( - target, // address of filename + target.c_str(), // address of filename FILE_ATTRIBUTE_NORMAL // address of attributes to set - )) throw FileError(string(_("Error overwriting file ")) + target); + )) throw FileError(wxString(_("Error overwriting file ")) + "\"" + target + "\""); - if (!CopyFile( - source, // pointer to name of an existing file - target, // pointer to filename to copy to - FALSE // overwrite if file exists - )) throw FileError(string(_("Error copying file ")) + source + _(" to ") + target); + if (!wxCopyFile(source, target, true)) //if file exists it will be overwritten + throw FileError(wxString(_("Error copying file ")) + "\"" + source + "\"" + _(" to ") + "\"" + target + "\""); } @@ -556,84 +570,82 @@ void FreeFileSync::createDirectory(const wxString& directory, int level) if (level == 50) //catch endless loop return; -//try to create directory - if (CreateDirectory( - directory.c_str(), // pointer to a directory path string - NULL // pointer to a security descriptor - )) return; + //try to create directory + if (wxMkdir(directory)) + return; //if not successfull try to create containing folders first - wxString createFirstDir = wxDir(directory).GetName().BeforeLast('\\'); + wxString createFirstDir = wxDir(directory).GetName().BeforeLast(FileNameSeparator); //call function recursively if (createFirstDir.IsEmpty()) return; - createDirectory(createFirstDir, level + 1); //now creation should be possible - if (!CreateDirectory( - directory.c_str(), // pointer to a directory path string - NULL // pointer to a security descriptor - )) + if (!wxMkdir(directory)) { if (level == 0) - throw FileError(string(_("Error creating directory ")) + directory.c_str()); + throw FileError(wxString(_("Error creating directory ")) + "\"" + directory + "\""); } } -void FreeFileSync::copyfile(const char* source, const char* target) -{ - if (!CopyFile( - source, // pointer to name of an existing file - target, // pointer to filename to copy to - TRUE // break if file exists - )) throw FileError(string(_("Error copying file ")) + source + _(" to ") + target); -} - - void FreeFileSync::copyCreatingDirs(const wxString& source, const wxString& target) { wxString targetPath = wxFileName(target).GetPath(); createDirectory(targetPath); - if (!CopyFile( - source.c_str(), // pointer to name of an existing file - target.c_str(), // pointer to filename to copy to - TRUE // break if file exists - )) throw FileError(string(_("Error copying file ")) + source.c_str() + _(" to ") + target.c_str()); + if (!wxCopyFile(source, target, false)) //error if file exists + throw FileError(wxString(_("Error copying file ")) + "\"" + source + "\"" + _(" to ") + "\"" + target + "\""); } //########################################################################################### -wxCriticalSection CopyThread::copyFileCritSec; -bool CopyThread::threadIsFinished = true; -bool CopyThread::threadWasSuccessful = true; +class CopyThread : public wxThread +{ +public: + CopyThread(const wxString& sourceFile, const wxString& targetFile) : + source(sourceFile), + target(targetFile) + {} -CopyThread::CopyThread(const wxString& sourceFile, const wxString& targetFile) : - source(sourceFile), - target(targetFile) -{} + ~CopyThread() {} + ExitCode Entry() + { + bool success = (CopyFile( + source.c_str(), // pointer to name of an existing file + target.c_str(), // pointer to filename to copy to + TRUE // break if file exists + )); -wxThread::ExitCode CopyThread::Entry() -{ - bool success = (CopyFile( - source.c_str(), // pointer to name of an existing file - target.c_str(), // pointer to filename to copy to - TRUE // break if file exists - )); + copyFileCritSec.Enter(); - copyFileCritSec.Enter(); + //report status to main thread + threadIsFinished = true; + threadWasSuccessful = success; - //report status to main thread - threadIsFinished = true; - threadWasSuccessful = success; + copyFileCritSec.Leave(); - copyFileCritSec.Leave(); + return 0; + } + + static wxCriticalSection copyFileCritSec; + + //shared thread data -> protect with critical section! + static bool threadIsFinished; + static bool threadWasSuccessful; + // + +private: + const wxString& source; + const wxString& target; +}; + +wxCriticalSection CopyThread::copyFileCritSec; +bool CopyThread::threadIsFinished = true; +bool CopyThread::threadWasSuccessful = true; - return 0; -} void FreeFileSync::copyfileMultithreaded(const wxString& source, const wxString& target, StatusUpdater* updateClass) @@ -659,7 +671,7 @@ void FreeFileSync::copyfileMultithreaded(const wxString& source, const wxString& { if (!CopyThread::threadWasSuccessful) { - throw FileError(string(_("Error copying file ")) + source.c_str() + _(" to ") + target.c_str()); + throw FileError(wxString(_("Error copying file ")) + "\"" + source + "\"" + _(" to ") + "\"" + target + "\""); } else return; } @@ -687,6 +699,9 @@ FreeFileSync::FreeFileSync() else recycleBinAvailable = true; } + + //prevent logging of wxWidgets + noWxLogs = new wxLogNull; } @@ -694,6 +709,8 @@ FreeFileSync::~FreeFileSync() { if (recycleBinAvailable) FreeLibrary(hinstShell); + + delete noWxLogs; } @@ -817,11 +834,11 @@ mpz_class FreeFileSync::calcTotalBytesToTransfer(const FileCompareResult& fileCm } -void FreeFileSync::synchronizeFile(const FileCompareLine& filename, const SyncConfiguration& config, StatusUpdater* statusUpdater) +bool FreeFileSync::synchronizeFile(const FileCompareLine& filename, const SyncConfiguration& config, StatusUpdater* statusUpdater) { assert (statusUpdater); - if (!filename.selectedForSynchronization) return; + if (!filename.selectedForSynchronization) return false; wxString target; @@ -833,7 +850,7 @@ void FreeFileSync::synchronizeFile(const FileCompareLine& filename, const SyncCo { case SyncDirLeft: //delete files on left statusUpdater->updateStatus(wxString(_("Deleting file ") + filename.fileDescrLeft.filename)); - removeFile(filename.fileDescrLeft.filename.c_str()); + removeFile(filename.fileDescrLeft.filename); break; case SyncDirRight: //copy files to right target = filename.fileDescrRight.directory + filename.fileDescrLeft.relFilename.c_str(); @@ -843,6 +860,7 @@ void FreeFileSync::synchronizeFile(const FileCompareLine& filename, const SyncCo copyfileMultithreaded(filename.fileDescrLeft.filename, target, statusUpdater); break; case SyncDirNone: + return false; break; default: assert (false); @@ -861,9 +879,10 @@ void FreeFileSync::synchronizeFile(const FileCompareLine& filename, const SyncCo break; case SyncDirRight: //delete files on right statusUpdater->updateStatus(wxString(_("Deleting file ") + filename.fileDescrRight.filename)); - removeFile(filename.fileDescrRight.filename.c_str()); + removeFile(filename.fileDescrRight.filename); break; case SyncDirNone: + return false; break; default: assert (false); @@ -879,17 +898,18 @@ void FreeFileSync::synchronizeFile(const FileCompareLine& filename, const SyncCo statusUpdater->updateStatus(wxString(_("Copying file ")) + filename.fileDescrRight.filename + _(" overwriting ") + filename.fileDescrLeft.filename); - removeFile(filename.fileDescrLeft.filename.c_str()); //only used if switch activated by user, else file is simply deleted + removeFile(filename.fileDescrLeft.filename); //only used if switch activated by user, else file is simply deleted copyfileMultithreaded(filename.fileDescrRight.filename, filename.fileDescrLeft.filename, statusUpdater); break; case SyncDirRight: //copy from left to right statusUpdater->updateStatus(wxString(_("Copying file ")) + filename.fileDescrLeft.filename + _(" overwriting ") + filename.fileDescrRight.filename); - removeFile(filename.fileDescrRight.filename.c_str()); //only used if switch activated by user, else file is simply deleted + removeFile(filename.fileDescrRight.filename); //only used if switch activated by user, else file is simply deleted copyfileMultithreaded(filename.fileDescrLeft.filename, filename.fileDescrRight.filename, statusUpdater); break; case SyncDirNone: + return false; break; default: assert (false); @@ -897,20 +917,21 @@ void FreeFileSync::synchronizeFile(const FileCompareLine& filename, const SyncCo break; case FilesEqual: + return false; break; default: assert (false); } - return; + return true; } -void FreeFileSync::synchronizeFolder(const FileCompareLine& filename, const SyncConfiguration& config, StatusUpdater* statusUpdater) +bool FreeFileSync::synchronizeFolder(const FileCompareLine& filename, const SyncConfiguration& config, StatusUpdater* statusUpdater) { assert (statusUpdater); - if (!filename.selectedForSynchronization) return; + if (!filename.selectedForSynchronization) return false; wxString target; @@ -922,7 +943,7 @@ void FreeFileSync::synchronizeFolder(const FileCompareLine& filename, const Sync { case SyncDirLeft: //delete folders on left statusUpdater->updateStatus(wxString(_("Deleting folder ") + filename.fileDescrLeft.filename)); - removeDirectory(filename.fileDescrLeft.filename.c_str()); + removeDirectory(filename.fileDescrLeft.filename); break; case SyncDirRight: //create folders on right target = filename.fileDescrRight.directory + filename.fileDescrLeft.relFilename; @@ -930,10 +951,11 @@ void FreeFileSync::synchronizeFolder(const FileCompareLine& filename, const Sync //some check to catch the error that directory on source has been deleted externally after the "compare"... if (!wxDirExists(filename.fileDescrLeft.filename)) - throw FileError(string(_("Error: Source directory does not exist anymore: ")) + filename.fileDescrLeft.filename.c_str()); + throw FileError(wxString(_("Error: Source directory does not exist anymore: ")) + "\"" + filename.fileDescrLeft.filename + "\""); createDirectory(target); break; case SyncDirNone: + return false; break; default: assert (false); @@ -949,14 +971,15 @@ void FreeFileSync::synchronizeFolder(const FileCompareLine& filename, const Sync //some check to catch the error that directory on source has been deleted externally after the "compare"... if (!wxDirExists(filename.fileDescrRight.filename)) - throw FileError(string(_("Error: Source directory does not exist anymore: ")) + filename.fileDescrRight.filename.c_str()); + throw FileError(wxString(_("Error: Source directory does not exist anymore: ")) + filename.fileDescrRight.filename); createDirectory(target); break; case SyncDirRight: //delete folders on right statusUpdater->updateStatus(wxString(_("Deleting folder ") + filename.fileDescrRight.filename)); - removeDirectory(filename.fileDescrRight.filename.c_str()); + removeDirectory(filename.fileDescrRight.filename); break; case SyncDirNone: + return false; break; default: assert (false); @@ -964,6 +987,7 @@ void FreeFileSync::synchronizeFolder(const FileCompareLine& filename, const Sync break; case FilesEqual: + return false; break; case RightFileNewer: case LeftFileNewer: @@ -971,14 +995,12 @@ void FreeFileSync::synchronizeFolder(const FileCompareLine& filename, const Sync default: assert (false); } - return; + return true; } wxString FreeFileSync::formatFilesizeToShortString(const mpz_class& filesize) { - const char* DigitsSeparator = _("."); - mpf_class nrOfBytes = filesize; wxString unit = " Byte"; @@ -1010,16 +1032,16 @@ wxString FreeFileSync::formatFilesizeToShortString(const mpz_class& filesize) mp_exp_t exponent = 0; - string temp; + wxString temp; if (unit == " Byte") //no decimal places in case of bytes { temp = nrOfBytes.get_str(exponent, 10, 3); - if (!temp.length()) //if nrOfBytes is zero GMP returns an empty string + if (!temp.Len()) //if nrOfBytes is zero GMP returns an empty string temp = "0"; } else { - temp = string(nrOfBytes.get_str(exponent, 10, 3) + "000").substr(0, 3); //returns mantisse of length 3 in all cases + temp = wxString(nrOfBytes.get_str(exponent, 10, 3) + "000").substr(0, 3); //returns mantisse of length 3 in all cases if (exponent < 0 || exponent > 3) temp = _("Error"); @@ -1027,18 +1049,18 @@ wxString FreeFileSync::formatFilesizeToShortString(const mpz_class& filesize) switch (exponent) { case 0: - temp = string("0") + DigitsSeparator + temp.substr(0, 2); //shorten mantisse as a 0 will be inserted + temp = wxString("0") + FloatingPointSeparator + temp.substr(0, 2); //shorten mantisse as a 0 will be inserted break; case 1: case 2: - temp.insert(exponent, DigitsSeparator); + temp.insert(exponent, FloatingPointSeparator); break; case 3: break; } } temp+= unit; - return temp.c_str(); + return temp; } @@ -1147,10 +1169,10 @@ wxString FreeFileSync::getFormattedDirectoryName(const wxString& dirname) { //this formatting is needed since functions in FreeFileSync.cpp expect the directory to end with '\' to be able to split the relative names //Actually all it needs, is the length of the directory - //let wxWidgets do the directory formatting, e.g. replace '/' with '\' + //let wxWidgets do the directory formatting, e.g. replace '/' with '\' for Windows wxString result = wxDir(dirname).GetName(); - result.Append('\\'); + result.Append(FileNameSeparator); return result; } @@ -1192,7 +1214,10 @@ void FreeFileSync::startSynchronizationProcess(FileCompareResult& grid, const Sy try { - fileSyncObject.synchronizeFolder(*i, config, statusUpdater); + if (fileSyncObject.synchronizeFolder(*i, config, statusUpdater)) + //progress indicator update + //indicator is updated only if directory is synched correctly (and if some sync was done)! + statusUpdater->updateProgressIndicator(0); //each call represents one processed file/directory break; } catch (FileError& error) @@ -1211,9 +1236,6 @@ void FreeFileSync::startSynchronizationProcess(FileCompareResult& grid, const Sy assert (false); } } - //progress indicator update - //indicator is updated no matter if errors occured or not! - statusUpdater->updateProgressIndicator(0); //each call represents one processed file/directory } } @@ -1235,7 +1257,16 @@ void FreeFileSync::startSynchronizationProcess(FileCompareResult& grid, const Sy try { - fileSyncObject.synchronizeFile(*i, config, statusUpdater); + if (fileSyncObject.synchronizeFile(*i, config, statusUpdater)) + { + //progress indicator update + //indicator is updated only if file is synched correctly (and if some sync was done)! + mpz_t largeTmpInt; + mpz_init(largeTmpInt); + FreeFileSync::getBytesToTransfer(largeTmpInt, *i, config); + statusUpdater->updateProgressIndicator(mpz_get_d(largeTmpInt)); + mpz_clear(largeTmpInt); + } break; } catch (FileError& error) @@ -1254,13 +1285,6 @@ void FreeFileSync::startSynchronizationProcess(FileCompareResult& grid, const Sy assert (false); } } - //progress indicator update - //indicator is updated no matter if errors occured or not! - mpz_t largeTmpInt; - mpz_init(largeTmpInt); - FreeFileSync::getBytesToTransfer(largeTmpInt, *i, config); - statusUpdater->updateProgressIndicator(mpz_get_d(largeTmpInt)); - mpz_clear(largeTmpInt); } } } @@ -1276,3 +1300,128 @@ void FreeFileSync::startSynchronizationProcess(FileCompareResult& grid, const Sy } } + +bool FreeFileSync::isFFS_ConfigFile(const wxString& filename) +{ + ifstream config(filename.c_str()); + if (!config) + return false; + + char bigBuffer[10000]; + + //read FFS identifier + config.get(bigBuffer, FreeFileSync::FFS_ConfigFileID.Len() + 1); + + return (FFS_ConfigFileID == wxString(bigBuffer)); +} + + +//add(!) all files and subfolder gridlines that are dependent from the directory +void FreeFileSync::addSubElements(set<int>& subElements, const FileCompareResult& grid, const FileCompareLine& relevantRow) +{ + wxString relevantDirectory; + + if (relevantRow.fileDescrLeft.objType == IsDirectory) + relevantDirectory = relevantRow.fileDescrLeft.relFilename; + + else if (relevantRow.fileDescrRight.objType == IsDirectory) + relevantDirectory = relevantRow.fileDescrRight.relFilename; + + else + return; + + for (FileCompareResult::const_iterator i = grid.begin(); i != grid.end(); ++i) + if (i->fileDescrLeft.relFilename.StartsWith(relevantDirectory) || + i->fileDescrRight.relFilename.StartsWith(relevantDirectory)) + subElements.insert(i - grid.begin()); +} + + +void FreeFileSync::deleteOnGridAndHD(FileCompareResult& grid, const set<int>& rowsToDelete, StatusUpdater* statusUpdater, bool useRecycleBin) +{ + FreeFileSync fileSyncObject; //currently only needed for recycle bin + fileSyncObject.setRecycleBinUsage(useRecycleBin); + + set<int> rowsToDeleteInGrid; + + //remove from hd + for (set<int>::iterator i = rowsToDelete.begin(); i != rowsToDelete.end(); ++i) + { + const FileCompareLine& currentCmpLine = grid[*i]; + + while (true) + { + try + { + if (currentCmpLine.fileDescrLeft.objType == IsFile) + fileSyncObject.removeFile(currentCmpLine.fileDescrLeft.filename); + else if (currentCmpLine.fileDescrLeft.objType == IsDirectory) + fileSyncObject.removeDirectory(currentCmpLine.fileDescrLeft.filename); + + if (currentCmpLine.fileDescrRight.objType == IsFile) + fileSyncObject.removeFile(currentCmpLine.fileDescrRight.filename); + else if (currentCmpLine.fileDescrRight.objType == IsDirectory) + fileSyncObject.removeDirectory(currentCmpLine.fileDescrRight.filename); + + rowsToDeleteInGrid.insert(*i); + + break; + } + catch (FileError& error) + { + + //if (updateClass) -> is mandatory + int rv = statusUpdater->reportError(error.show()); + + if (rv == StatusUpdater::Continue) + break; + + else if (rv == StatusUpdater::Retry) + ; //continue with loop + else + assert (false); + } + } + } + + //retrieve all files and subfolder gridlines that are dependent from deleted directories and add them to the list + set<int> additionalRowsToDelete; + for (set<int>::iterator i = rowsToDeleteInGrid.begin(); i != rowsToDeleteInGrid.end(); ++i) + addSubElements(additionalRowsToDelete, grid, grid[*i]); + + for (set<int>::iterator i = additionalRowsToDelete.begin(); i != additionalRowsToDelete.end(); ++i) + rowsToDeleteInGrid.insert(*i); + + + //remove deleted rows from grid + + //for (set<int>::reverse_iterator i = rowsToDeleteInGrid.rbegin(); i != rowsToDeleteInGrid.rend(); ++i) + // grid.erase(grid.begin() + *i); + + //Note: the following lines are a performance optimization for deleting elements from a vector. It is incredibly faster to create a new + //vector and leave specific elements out than to delete row by row and force recopying of most elements for each single deletion (linear vs quadratic runtime) + + FileCompareResult temp; + int rowNr = 0; + int rowToSkip = -1; + + set<int>::iterator rowToSkipIndex = rowsToDeleteInGrid.begin(); + + if (rowToSkipIndex != rowsToDeleteInGrid.end()) + rowToSkip = *rowToSkipIndex; + + for (FileCompareResult::iterator i = grid.begin(); i != grid.end(); ++i, ++rowNr) + { + if (rowNr != rowToSkip) + temp.push_back(*i); + else + { + rowToSkipIndex++; + if (rowToSkipIndex != rowsToDeleteInGrid.end()) + rowToSkip = *rowToSkipIndex; + } + } + grid.swap(temp); +} + + diff --git a/FreeFileSync.h b/FreeFileSync.h index 62abc81d..9285ba7c 100644 --- a/FreeFileSync.h +++ b/FreeFileSync.h @@ -6,7 +6,8 @@ #include <vector> #include <wx/dir.h> #include <windows.h> -#include "library\GMP\include\gmpxx.h" +#include "library/gmp/include/gmpxx.h" +#include <wx/log.h> using namespace std; @@ -54,18 +55,38 @@ struct FileDescrLine //the following operators are needed by template class "set" //DO NOT CHANGE THESE RELATIONS!!! + +#ifdef FFS_WIN + //Windows does NOT distinguish between upper/lower-case bool operator>(const FileDescrLine& b ) const - { //Windows does NOT distinguish upper/lower-case + { return (relFilename.CmpNoCase(b.relFilename) > 0); } bool operator<(const FileDescrLine& b) const - { //Windows does NOT distinguish upper/lower-case + { return (relFilename.CmpNoCase(b.relFilename) < 0); } bool operator==(const FileDescrLine& b) const - { //Windows does NOT distinguish upper/lower-case + { return (relFilename.CmpNoCase(b.relFilename) == 0); } +#endif // FFS_WIN + +#ifdef FFS_LINUX + //Linux DOES distinguish between upper/lower-case + bool operator>(const FileDescrLine& b ) const + { + return (relFilename.Cmp(b.relFilename) > 0); + } + bool operator<(const FileDescrLine& b) const + { + return (relFilename.Cmp(b.relFilename) < 0); + } + bool operator==(const FileDescrLine& b) const + { + return (relFilename.Cmp(b.relFilename) == 0); + } +#endif // FFS_LINUX }; typedef set<FileDescrLine> DirectoryDescrType; @@ -156,6 +177,7 @@ public: FreeFileSync(); ~FreeFileSync(); + friend class MainDialog; friend class GetAllFilesFull; friend class CopyThread; @@ -165,9 +187,12 @@ public: //main function for synchronization static void startSynchronizationProcess(FileCompareResult& grid, const SyncConfiguration& config, StatusUpdater* statusUpdater, bool useRecycleBin); - static bool recycleBinExists(); //test existence of Recycle Bin API + static bool recycleBinExists(); //test existence of Recycle Bin API bool setRecycleBinUsage(bool activate); //enables/disables Recycle Bin usage (but only if usage is possible at all): RV: Setting was successful or not + static void deleteOnGridAndHD(FileCompareResult& grid, const set<int>& rowsToDelete, StatusUpdater* statusUpdater, bool useRecycleBin); +static void addSubElements(set<int>& subElements, const FileCompareResult& grid, const FileCompareLine& relevantRow); + static void filterCurrentGridData(FileCompareResult& currentGridData, const wxString& includeFilter, const wxString& excludeFilter); static void removeFilterOnCurrentGridData(FileCompareResult& currentGridData); @@ -177,19 +202,24 @@ public: static mpz_class calcTotalBytesToTransfer(const FileCompareResult& fileCmpResult, const SyncConfiguration& config); static void swapGrids(FileCompareResult& grid); + static bool isFFS_ConfigFile(const wxString& filename); + + static const wxString FFS_ConfigFileID; + static const wxString FFS_LastConfigFile; + private: - void synchronizeFile(const FileCompareLine& filename, const SyncConfiguration& config, StatusUpdater* statusUpdater); // true if successful - void synchronizeFolder(const FileCompareLine& filename, const SyncConfiguration& config, StatusUpdater* statusUpdater); // true if successful - - //windows file copy functionality - void removeDirectory(const char* directory); - void removeFile(const char* filename); - static void copyOverwriting(const char* source, const char* target); - static void copyfile(const char* source, const char* target); - static void copyCreatingDirs(const wxString& source, const wxString& target); - static void createDirectory(const wxString& directory, int level = 0); //level is used internally only + bool synchronizeFile(const FileCompareLine& filename, const SyncConfiguration& config, StatusUpdater* statusUpdater); // false if nothing was to be done + bool synchronizeFolder(const FileCompareLine& filename, const SyncConfiguration& config, StatusUpdater* statusUpdater); // false if nothing was to be done + + //file copy functionality -> keep instance-bound to to be able to prevent wxWidgets-logging + void removeDirectory(const wxString& directory); + void removeFile(const wxString& filename); + void copyOverwriting(const wxString& source, const wxString& target); + void copyfile(const wxString& source, const wxString& target); + void copyCreatingDirs(const wxString& source, const wxString& target); + void createDirectory(const wxString& directory, int level = 0); //level is used internally only //some special file functions - void moveToRecycleBin(const char* filename); + void moveToRecycleBin(const wxString& filename); void copyfileMultithreaded(const wxString& source, const wxString& target, StatusUpdater* updateClass); @@ -202,6 +232,7 @@ private: static wxString calculateMD5Hash(const wxString& filename); bool recycleBinAvailable; + wxLogNull* noWxLogs; HINSTANCE hinstShell; DLLFUNC fileOperation; }; @@ -210,15 +241,15 @@ private: class FileError //Exception class used to notify file/directory copy/delete errors { public: - FileError(string txt) : errorMessage(txt) {} + FileError(const wxString& txt) : errorMessage(txt) {} - string show() + wxString show() { return errorMessage; } private: - string errorMessage; + wxString errorMessage; }; @@ -229,26 +260,4 @@ public: ~AbortThisProcess() {} }; - -class CopyThread : public wxThread -{ -public: - CopyThread(const wxString& sourceFile, const wxString& targetFile); - ~CopyThread() {} - - ExitCode Entry(); - - static wxCriticalSection copyFileCritSec; - - //shared thread data -> protect with critical section! - static bool threadIsFinished; - static bool threadWasSuccessful; - // - -private: - const wxString& source; - const wxString& target; -}; - - #endif // FREEFILESYNC_H_INCLUDED @@ -1,4 +1,4 @@ -FreeFileSync v1.2 +FreeFileSync v1.3 ----------------- Usage @@ -19,6 +19,7 @@ Features - Only necessary functionality on UI: no overloaded menus or icon jungle. - Select folders via drag & drop. - Your last configuration and screen settings are loaded on startup and saved on exit. + - Maintain and load different configurations by drag&drop, load-button or commandline - Double-click to show file in explorer. - copy & paste support to export file-lists. - Progress indicators, status information and error reporting diff --git a/Resources.dat b/Resources.dat Binary files differindex 6574346e..6f9befc5 100644 --- a/Resources.dat +++ b/Resources.dat diff --git a/language.dat b/language.dat index adeaeec8..1fb4ea26 100644 --- a/language.dat +++ b/language.dat @@ -71,7 +71,7 @@ Abort Abbruch Aborted! -Abgebrochen! +Abbruch! About Info Action @@ -295,7 +295,7 @@ Ergebnis Retry Wiederholen Running... -Gestarted... +Synchronisiere... Scanning files/folders: Scanne Dateien/Ordner: Select a folder @@ -311,9 +311,9 @@ Sourcecode komplett in C++ geschrieben unter Verwendung von:\n\nMinGW \t\t- Wind Specify algorithm to test if files are equal:\n\n\t\tSIZEDATE: check filesize and date\n\t\tCONTENT: check file content\n Methode angeben, um gleiche Dateien zu erkennen:\n\n\t\tSIZEDATE: Prüfung auf Dateigröße und -datum\n\t\tCONTENT: Prüfung auf Dateiinhalt\n Specify names to be excluded separated by ';'. Wildcards '*' and '?' are supported. Default: \"\"\n -Auszuschließende Namen, getrennt durch ';', angeben. Platzhalter '*' und '?' werden unterstützt. Standard: \"\"\n +Auszuschließende Namen, getrennt durch ';' angeben. Platzhalter '*' und '?' werden unterstützt. Standard: \"\"\n Specify names to be included separated by ';'. Wildcards '*' and '?' are supported. Default: \"*\"\n -Einzuschließende Namen, getrennt durch ';', angeben. Platzhalter '*' und '?' werden unterstützt. Standard: \"*\"\n +Einzuschließende Namen, getrennt durch ';' angeben. Platzhalter '*' und '?' werden unterstützt. Standard: \"*\"\n Specify the sync-direction used for each type of file by a string of five chars:\n\n\t\tChar 1: Folders/files that exist on left side only\n\t\tChar 2: Folders/files that exist on right side only\n\t\tChar 3: Files that exist on both sides, left one is newer\n\t\tChar 4: Files that exist on both sides, right one is newer\n\t\tChar 5: Files that exist on both sides and are different\n\n\t\tSync-direction: L: left, R: right, N: none\n Synchronisationseinstellungen durch Zeichenkette der Länge 5 spezifizieren:\n\n\t\t1. Zeichen: Ordner/Dateien, die nur links existieren\n\t\t2. Zeichen: Ordner/Dateien, die nur rechts existieren\n\t\t3. Zeichen: Dateien, die auf beiden Seiten existieren; linke Datei ist neuer\n\t\t4. Zeichen: Dateien, die auf beiden Seiten existieren; rechte Datei ist neuer\n\t\t5. Zeichen: Dateien, die auf beiden Seiten existieren und verschieden sind\n\n\t\tSynchronisationsrichtung: L: links, R: rechts, N: nichts tun\n Start synchronizing files @@ -327,7 +327,7 @@ Synchronisationseinstellungen Synchronization status Synchronisation: Status Synchronize both sides simultaneously: Copy new or updated files in both directions. -Beide Seiten gleichzeitig synchronisieren: Kopiere neue oder aktualisierte Dateien auf die jeweils andere Seite. +Beide Seiten gleichzeitig synchronisieren: Neue oder aktualisierte Dateien auf die jeweils andere Seite kopieren. Two way <-> Beidseitig <-> Unable to create logfile! diff --git a/library/CustomGrid.cpp b/library/CustomGrid.cpp index 76e22441..876ad8f9 100644 --- a/library/CustomGrid.cpp +++ b/library/CustomGrid.cpp @@ -1,4 +1,4 @@ -#include "CustomGrid.h" +#include "customGrid.h" const unsigned int MinimumRows = 15; diff --git a/library/CustomGrid.h b/library/CustomGrid.h index 93a378b4..951aadc3 100644 --- a/library/CustomGrid.h +++ b/library/CustomGrid.h @@ -1,7 +1,7 @@ #ifndef CUSTOMGRID_H_INCLUDED #define CUSTOMGRID_H_INCLUDED -#include "../ui/MainDialog.h" +#include "../ui/mainDialog.h" #include <vector> #include <wx/grid.h> diff --git a/library/globalFunctions.cpp b/library/globalFunctions.cpp index d8a3a67b..70a5abaf 100644 --- a/library/globalFunctions.cpp +++ b/library/globalFunctions.cpp @@ -1,6 +1,18 @@ #include "globalFunctions.h" #include <wx/intl.h> +#ifdef FFS_WIN +const wxChar FileNameSeparator = '\\'; +#endif // FFS_WIN + +#ifdef FFS_LINUX +const wxChar FileNameSeparator = '/'; +#endif // FFS_LINUX + +const wxChar* FloatingPointSeparator = _("."); +const wxChar* NumberSeparator = _(","); + + inline int GlobalFunctions::round(const double d) { @@ -101,8 +113,6 @@ double GlobalFunctions::wxStringToDouble(const wxString& number) wxString& GlobalFunctions::includeNumberSeparator(wxString& number) { - const wxChar* NumberSeparator = _(","); - for (int i = number.size() - 3; i > 0; i-= 3) number.insert(i, NumberSeparator); return number; diff --git a/library/globalFunctions.h b/library/globalFunctions.h index 90c4aa99..b766a097 100644 --- a/library/globalFunctions.h +++ b/library/globalFunctions.h @@ -8,6 +8,10 @@ using namespace std; +extern const wxChar FileNameSeparator; +extern const wxChar* FloatingPointSeparator; +extern const wxChar* NumberSeparator; + namespace GlobalFunctions { int round(double d); //little rounding function diff --git a/ui/MainDialog.cpp b/ui/MainDialog.cpp index 97288b90..f063dfcb 100644 --- a/ui/MainDialog.cpp +++ b/ui/MainDialog.cpp @@ -7,13 +7,13 @@ * License: **************************************************************/ -#include "MainDialog.h" +#include "mainDialog.h" #include <wx/filename.h> #include <stdexcept> //for std::runtime_error -#include "..\library\globalfunctions.h" +#include "../library/globalFunctions.h" #include <fstream> #include <wx/clipbrd.h> -#include "..\library\CustomGrid.h" +#include "../library/customGrid.h" #include <cmath> #include <wx/msgdlg.h> @@ -21,17 +21,19 @@ using namespace GlobalFunctions; int leadingPanel = 0; -MainDialog::MainDialog(wxFrame* frame) : - GUI_Generated(frame), +MainDialog::MainDialog(wxFrame* frame, const wxString& cfgFileName) : + GuiGenerated(frame), parent(frame), - selectedRangeBegin(0), - selectedRangeEnd(0), + stackObjects(0), + selectedRange3Begin(0), + selectedRange3End(0), selectionLead(0), + filteringInitialized(false), filteringPending(false), cmpStatusUpdaterTmp(0) { //initialize sync configuration - readConfigurationFromHD("config.dat"); + readConfigurationFromHD(cfgFileName, true); //set icons for this dialog m_bpButton11->SetBitmapLabel(*GlobalResources::bitmapAbout); @@ -41,15 +43,16 @@ MainDialog::MainDialog(wxFrame* frame) : m_bpButtonSync->SetBitmapDisabled(*GlobalResources::bitmapSyncDisabled); m_bpButtonSwap->SetBitmapLabel(*GlobalResources::bitmapSwap); m_bpButton14->SetBitmapLabel(*GlobalResources::bitmapHelp); + m_bpButton201->SetBitmapLabel(*GlobalResources::bitmapSave); - m_panel1->DragAcceptFiles(true); - m_panel2->DragAcceptFiles(true); - m_panel1->Connect(wxEVT_DROP_FILES, wxDropFilesEventHandler(MainDialog::onFilesDroppedPanel1), NULL, this); - m_panel2->Connect(wxEVT_DROP_FILES, wxDropFilesEventHandler(MainDialog::onFilesDroppedPanel2), NULL, this); + //prepare drag & drop + m_panel1->SetDropTarget(new FileDropEvent(this, 1)); + m_panel2->SetDropTarget(new FileDropEvent(this, 2)); - //support for CTRL + C + //support for CTRL + C and DEL m_grid1->Connect(wxEVT_KEY_DOWN, wxKeyEventHandler(MainDialog::onGrid1ButtonEvent), NULL, this); m_grid2->Connect(wxEVT_KEY_DOWN, wxKeyEventHandler(MainDialog::onGrid2ButtonEvent), NULL, this); + m_grid3->Connect(wxEVT_KEY_DOWN, wxKeyEventHandler(MainDialog::onGrid3ButtonEvent), NULL, this); //identify leading grid by keyboard input or scroll action m_grid1->Connect(wxEVT_KEY_DOWN, wxEventHandler(MainDialog::onGrid1access), NULL, this); @@ -81,8 +84,12 @@ MainDialog::MainDialog(wxFrame* frame) : m_grid3->Connect(wxEVT_SCROLLWIN_LINEDOWN, wxEventHandler(MainDialog::onGrid3access), NULL, this); m_grid3->GetGridWindow()->Connect(wxEVT_LEFT_DOWN, wxEventHandler(MainDialog::onGrid3access), NULL, this); - m_grid3->GetGridWindow()->Connect(wxEVT_IDLE, wxEventHandler(MainDialog::OnIdleToFilterManually), NULL, this); + m_grid3->GetGridWindow()->Connect(wxEVT_IDLE, wxEventHandler(MainDialog::OnIdleEvent), NULL, this); m_grid3->GetGridWindow()->Connect(wxEVT_LEFT_UP, wxEventHandler(MainDialog::OnGrid3LeftMouseUp), NULL, this); + m_grid3->GetGridWindow()->Connect(wxEVT_LEFT_DOWN, wxEventHandler(MainDialog::OnGrid3LeftMouseDown), NULL, this); + + Connect(wxEVT_SIZE, wxEventHandler(MainDialog::onResizeMainWindow), NULL, this); + Connect(wxEVT_MOVE, wxEventHandler(MainDialog::onResizeMainWindow), NULL, this); wxString toolTip = wxString(_("Legend\n")) + _("---------\n") + @@ -108,7 +115,7 @@ MainDialog::MainDialog(wxFrame* frame) : updateViewFilterButtons(); //disable sync button as long as "compare" hasn't been triggered. - m_bpButtonSync->Enable(false); + m_bpButtonSync->Disable(); //make filesize right justified on grids wxGridCellAttr* cellAttributes = m_grid1->GetOrCreateCellAttr(0, 2); @@ -129,6 +136,18 @@ MainDialog::MainDialog(wxFrame* frame) : //mainly to update row label sizes... writeGrid(currentGridData); + + //load list of last used configuration files + cfgFileHistory = new wxConfig("FreeFileSync"); + for (int i = CfgHistroyLength - 1; i >= 0; --i) //put files in reverse order to history + { + const wxString key = "Selection" + numberToWxString(i); + + wxString value; + if (cfgFileHistory->Read(key, &value)) + addCfgFileToHistory(value); + } + m_choiceLoad->SetSelection(0); } @@ -143,9 +162,7 @@ MainDialog::~MainDialog() m_grid1->Disconnect(wxEVT_KEY_DOWN, wxKeyEventHandler(MainDialog::onGrid1ButtonEvent), NULL, this); m_grid2->Disconnect(wxEVT_KEY_DOWN, wxKeyEventHandler(MainDialog::onGrid2ButtonEvent), NULL, this); - - m_panel1->Disconnect(wxEVT_DROP_FILES, wxDropFilesEventHandler(MainDialog::onFilesDroppedPanel1), NULL, this); - m_panel2->Disconnect(wxEVT_DROP_FILES, wxDropFilesEventHandler(MainDialog::onFilesDroppedPanel2), NULL, this); + m_grid3->Disconnect(wxEVT_KEY_DOWN, wxKeyEventHandler(MainDialog::onGrid3ButtonEvent), NULL, this); m_grid1->Disconnect(wxEVT_KEY_DOWN, wxEventHandler(MainDialog::onGrid1access), NULL, this); m_grid1->Disconnect(wxEVT_SCROLLWIN_TOP, wxEventHandler(MainDialog::onGrid1access), NULL, this); @@ -176,12 +193,32 @@ MainDialog::~MainDialog() m_grid3->Disconnect(wxEVT_SCROLLWIN_LINEDOWN, wxEventHandler(MainDialog::onGrid3access), NULL, this); m_grid3->GetGridWindow()->Disconnect(wxEVT_LEFT_DOWN, wxEventHandler(MainDialog::onGrid3access), NULL, this); - m_grid3->GetGridWindow()->Disconnect(wxEVT_IDLE, wxEventHandler(MainDialog::OnIdleToFilterManually), NULL, this); + m_grid3->GetGridWindow()->Disconnect(wxEVT_IDLE, wxEventHandler(MainDialog::OnIdleEvent), NULL, this); m_grid3->GetGridWindow()->Disconnect(wxEVT_LEFT_UP, wxEventHandler(MainDialog::OnGrid3LeftMouseUp), NULL, this); + m_grid3->GetGridWindow()->Disconnect(wxEVT_LEFT_DOWN, wxEventHandler(MainDialog::OnGrid3LeftMouseDown), NULL, this); + + Disconnect(wxEVT_SIZE, wxEventHandler(MainDialog::onResizeMainWindow), NULL, this); + Disconnect(wxEVT_MOVE, wxEventHandler(MainDialog::onResizeMainWindow), NULL, this); + + //write list of last used configuration files + int vectorSize = cfgFileNames.size(); + for (int i = 0; i < CfgHistroyLength; ++i) + { + const wxString key = "Selection" + numberToWxString(i); + + if (i < vectorSize) + cfgFileHistory->Write(key, cfgFileNames[i]); + else + { + if (cfgFileHistory->Exists(key)) + cfgFileHistory->DeleteEntry(key); + } + } + delete cfgFileHistory; try { - writeConfigurationToHD("config.dat"); //don't trow exceptions in destructors + writeConfigurationToHD(FreeFileSync::FFS_LastConfigFile); //don't trow exceptions in destructors } catch (std::runtime_error& theException) { @@ -237,27 +274,47 @@ void MainDialog::filterRangeManual(int begin, int end, int leadingRow) if (topRow <= bottomRow) // bottomRow might be -1 ? { + bool newSelection = false; //default: deselect range - //lastSelected Row should be set in OnDeselectRow() - if (leadingRow < currentUI_Size) + //leadingRow should be set in OnGridSelectCell() + if (0 <= leadingRow && leadingRow < currentUI_Size) newSelection = !currentGridData[currentUI_View[leadingRow].linkToCurrentGridData].selectedForSynchronization; if (hideFiltered) assert (!newSelection); //if hidefiltered is active, there should be no filtered elements on screen => current element was filtered out - for (int i = topRow; i <= bottomRow; ++ i) + + //get all lines that need to be filtered (e.g. if a folder is marked, then its subelements should be marked as well) + set<int> rowsToFilterOnGridData; //rows to filter in backend + for (int i = topRow; i <= bottomRow; ++i) + { + unsigned int gridDataLine = currentUI_View[i].linkToCurrentGridData; + + rowsToFilterOnGridData.insert(gridDataLine); + FreeFileSync::addSubElements(rowsToFilterOnGridData, currentGridData, currentGridData[gridDataLine]); + } + + + //toggle selection of filtered rows + for (set<int>::iterator i = rowsToFilterOnGridData.begin(); i != rowsToFilterOnGridData.end(); ++i) + currentGridData[*i].selectedForSynchronization = newSelection; + + + set<int> filteredOutRowsOnUI; //determine rows that are currently filtered out on current UI view + + //update currentUI_View + for (UI_Grid::iterator i = currentUI_View.begin(); i != currentUI_View.end(); ++i) { - bool& currentSelection = currentGridData[currentUI_View[i].linkToCurrentGridData].selectedForSynchronization; - CompareFilesResult currentCmpResult = currentGridData[currentUI_View[i].linkToCurrentGridData].cmpResult; + const FileCompareLine& gridLine = currentGridData[i->linkToCurrentGridData]; - //toggle selection of current row - currentSelection = newSelection; + i->cmpResult = evaluateCmpResult(gridLine.cmpResult, gridLine.selectedForSynchronization); - //update currentUI_View, in case of sorting without refresh (mapping of griddata to ui model) - currentUI_View[i].cmpResult = evaluateCmpResult(currentCmpResult, currentSelection); + if (!gridLine.selectedForSynchronization) + filteredOutRowsOnUI.insert(i - currentUI_View.begin()); } + //signal UI that grids need to be refreshed on next Update() m_grid1->ForceRefresh(); m_grid2->ForceRefresh(); @@ -270,9 +327,39 @@ void MainDialog::filterRangeManual(int begin, int end, int leadingRow) wxMilliSleep(400); //delete rows, that are filtered out: - currentUI_View.erase(currentUI_View.begin() + topRow, currentUI_View.begin() + bottomRow + 1); - //redraw grid neccessary to update new dimensions + //for (set<int>::reverse_iterator i = filteredOutRowsOnUI.rbegin(); i != filteredOutRowsOnUI.rend(); ++i) + // currentUI_View.erase(currentUI_View.begin() + *i); + + //Note: the following lines are a performance optimization for deleting elements from a vector. It is incredibly faster to create a new + //vector and leave specific elements out than to delete row by row and force recopying of most elements for each single deletion (linear vs quadratic runtime) + + //Note: This is the most time consuming part in this whole method! + + UI_Grid temp; + int rowNr = 0; + int rowToSkip = -1; + + set<int>::iterator rowToSkipIndex = filteredOutRowsOnUI.begin(); + + if (rowToSkipIndex != filteredOutRowsOnUI.end()) + rowToSkip = *rowToSkipIndex; + + for (UI_Grid::iterator i = currentUI_View.begin(); i != currentUI_View.end(); ++i, ++rowNr) + { + if (rowNr != rowToSkip) + temp.push_back(*i); + else + { + rowToSkipIndex++; + if (rowToSkipIndex != filteredOutRowsOnUI.end()) + rowToSkip = *rowToSkipIndex; + } + } + currentUI_View.swap(temp); + + + //redraw grid necessary to update new dimensions writeGrid(currentGridData, true); //use UI buffer, no mapping from currentGridData to UI model again, just a re-dimensioning of grids updateStatusInformation(currentUI_View); //status information has to be recalculated! } @@ -282,7 +369,7 @@ void MainDialog::filterRangeManual(int begin, int end, int leadingRow) } /*grid event choreography: -1. UI-Mouse-Down => OnGrid3SelectCell +1. UI-Mouse-Down => OnGridSelectCell 2. UI-Mouse-Up => OnGrid3SelectRange (if at least two rows are marked) => the decision if a range or a single cell is selected can be made only after Mouse-UP. But OnGrid3SelectRange unfortunately is not always @@ -290,17 +377,25 @@ executed (e.g. if single cell selected) => new choreography: -1. UI-Mouse-Down => OnGrid3SelectCell +1. UI-Mouse-Down => OnGridSelectCell -> set leading row 2. UI-Mouse-Up => OnGrid3LeftMouseUp (notify that filtering shall be started on next idle event 3. UI-Mouse-Up => OnGrid3SelectRange, possibly -4. Idle event => OnIdleToFilterManually +4. Idle event => OnIdleEvent It's !crazy! but it works! */ -void MainDialog::OnGrid3SelectCell(wxGridEvent& event) +void MainDialog::OnGridSelectCell(wxGridEvent& event) { - selectionLead = selectedRangeBegin = selectedRangeEnd = event.GetRow(); + selectionLead = selectedRange3Begin = selectedRange3End = event.GetRow(); + event.Skip(); +} + + +void MainDialog::OnGrid3LeftMouseDown(wxEvent& event) +{ + + filteringInitialized = true; event.Skip(); } @@ -314,22 +409,45 @@ void MainDialog::OnGrid3LeftMouseUp(wxEvent& event) void MainDialog::OnGrid3SelectRange(wxGridRangeSelectEvent& event) { - if (event.Selecting()) + if (event.Selecting()) //this range event should only be processed on release left mouse button { - selectedRangeBegin = event.GetTopRow(); - selectedRangeEnd = event.GetBottomRow(); + selectedRange3Begin = event.GetTopRow(); + selectedRange3End = event.GetBottomRow(); } event.Skip(); } -void MainDialog::OnIdleToFilterManually(wxEvent& event) +void MainDialog::OnIdleEvent(wxEvent& event) { + //process manually filtered rows if (filteringPending) { filteringPending = false; - filterRangeManual(selectedRangeBegin, selectedRangeEnd, selectionLead); + + if (filteringInitialized) //filteringInitialized is being reset after each selection, since strangely it might happen, that the grid receives + { //a mouse up event, but no mouse down! (e.g. when window is maximized and cursor is on grid3) + filteringInitialized = false; + + filterRangeManual(selectedRange3Begin, selectedRange3End, selectionLead); + } } + + //------------------------------------------------------------------------------ + + //small routine to restore status information after some time + if (stackObjects > 0 ) //check if there is some work to do + { + wxLongLong currentTime = wxGetLocalTimeMillis(); + if (currentTime - lastStatusChange > 3000) //restore stackObject after three seconds + { + lastStatusChange = currentTime; + + stackObjects--; + m_statusBar1->PopStatusText(1); + } + } + event.Skip(); } @@ -416,12 +534,229 @@ void copySelectionToClipboard(wxGrid* grid) } +set<int> getSelectedRows(wxGrid* grid) +{ + set<int> output; + int rowTop, rowBottom; //coords of selection + + wxArrayInt selectedRows = grid->GetSelectedRows(); + if (!selectedRows.IsEmpty()) + { + for (unsigned int i = 0; i < selectedRows.GetCount(); ++i) + output.insert(selectedRows[i]); + } + + if (!grid->GetSelectedCols().IsEmpty()) //if a column is selected this is means all rows are marked for deletion + { + for (int k = 0; k < grid->GetNumberRows(); ++k) + output.insert(k); + } + + wxGridCellCoordsArray singlySelected = grid->GetSelectedCells(); + if (!singlySelected.IsEmpty()) + { + for (unsigned int k = 0; k < singlySelected.GetCount(); ++k) + output.insert(singlySelected[k].GetRow()); + } + + wxGridCellCoordsArray tmpArrayTop = grid->GetSelectionBlockTopLeft(); + if (!tmpArrayTop.IsEmpty()) + { + wxGridCellCoordsArray tmpArrayBottom = grid->GetSelectionBlockBottomRight(); + + unsigned int arrayCount = tmpArrayTop.GetCount(); + + if (arrayCount == tmpArrayBottom.GetCount()) + { + for (unsigned int i = 0; i < arrayCount; ++i) + { + rowTop = tmpArrayTop[i].GetRow(); + rowBottom = tmpArrayBottom[i].GetRow(); + + for (int k = rowTop; k <= rowBottom; ++k) + output.insert(k); + } + } + } + + return output; +} + + +void removeInvalidRows(set<int>& rows, const int currentUI_Size) +{ + set<int> validRows; //temporal table IS needed here + for (set<int>::iterator i = rows.begin(); i != rows.end(); ++i) + if (0 <= *i) + { + if (*i >= currentUI_Size) //set is sorted, so no need to continue here + break; + validRows.insert(*i); + } + rows = validRows; +} + + +class DeleteStatusUpdater : public StatusUpdater +{ +public: + DeleteStatusUpdater(bool& unsolvedErrorOccured) : suppressUI_Errormessages(false), unsolvedErrors(unsolvedErrorOccured) {} + ~DeleteStatusUpdater() {} + + int reportError(const wxString& text) + { + if (suppressUI_Errormessages) + { + unsolvedErrors = true; + return StatusUpdater::Continue; + } + + wxString errorMessage = text + _("\n\nInformation: If you skip the error and continue or abort a re-compare will be necessary!"); + + ErrorDlg* errorDlg = new ErrorDlg(errorMessage, suppressUI_Errormessages); + + int rv = errorDlg->ShowModal(); + errorDlg->Destroy(); + + switch (rv) + { + case ErrorDlg::ContinueButtonPressed: + unsolvedErrors = true; + return StatusUpdater::Continue; + case ErrorDlg::RetryButtonPressed: + return StatusUpdater::Retry; + case ErrorDlg::AbortButtonPressed: + { + unsolvedErrors = true; + throw AbortThisProcess(); + } + default: + assert (false); + } + + return StatusUpdater::Continue; //dummy return value + } + void updateStatus(const wxString& text) {} + void updateProgressIndicator(double number) {} + + +private: + bool suppressUI_Errormessages; + bool& unsolvedErrors; +}; + + +void MainDialog::deleteFilesOnGrid(wxGrid* grid) +{ + set<int> rowsToDeleteOnUI = getSelectedRows(grid); + + if (0 <= selectionLead && unsigned(selectionLead) < currentUI_View.size()) + rowsToDeleteOnUI.insert(selectionLead); //add row of the currently selected cell + + removeInvalidRows(rowsToDeleteOnUI, currentUI_View.size()); + + + if (rowsToDeleteOnUI.size()) + { + //map grid lines from UI to grid lines in backend + set<int> rowsToDeleteOnGrid; + for (set<int>::iterator i = rowsToDeleteOnUI.begin(); i != rowsToDeleteOnUI.end(); ++i) + rowsToDeleteOnGrid.insert(currentUI_View[*i].linkToCurrentGridData); + + wxString headerText; + wxString filesToDelete; + + if (useRecycleBin) + headerText = _("Do you really want to move the following objects(s) to the recycle bin?"); + else + headerText = _("Do you really want to delete the following objects(s)?"); + + for (set<int>::iterator i = rowsToDeleteOnGrid.begin(); i != rowsToDeleteOnGrid.end(); ++i) + { + const FileCompareLine& currentCmpLine = currentGridData[*i]; + + if (currentCmpLine.fileDescrLeft.objType != IsNothing) + filesToDelete+= currentCmpLine.fileDescrLeft.filename + "\n"; + + if (currentCmpLine.fileDescrRight.objType != IsNothing) + filesToDelete+= currentCmpLine.fileDescrRight.filename + "\n"; + + filesToDelete+= "\n"; + } + + DeleteDialog* confirmDeletion = new DeleteDialog(headerText, filesToDelete, this); //no destruction needed; attached to main window + + switch (confirmDeletion->ShowModal()) + { + case DeleteDialog::OkayButtonPressed: + { + bool unsolvedErrorOccured = false; //if an error is skipped a re-compare will be necessary! + + try + { //class errors when deleting files/folders + DeleteStatusUpdater deleteStatusUpdater(unsolvedErrorOccured); + + FreeFileSync::deleteOnGridAndHD(currentGridData, rowsToDeleteOnGrid, &deleteStatusUpdater, useRecycleBin); + } + catch (AbortThisProcess& theException) + {} + + + //disable the sync button if errors occured during deletion + if (unsolvedErrorOccured) + m_bpButtonSync->Disable(); + + + //redraw grid neccessary to update new dimensions and for UI-Backend data linkage + writeGrid(currentGridData); //do NOT use UI buffer here + } + break; + + case DeleteDialog::CancelButtonPressed: + default: + break; + + } + } +} + + +void MainDialog::pushStatusInformation(const wxString& text) +{ + lastStatusChange = wxGetLocalTimeMillis(); + stackObjects++; + m_statusBar1->PushStatusText(text, 1); +} + + +void MainDialog::writeStatusInformation(const wxString& text) +{ + stackObjects = 0; + m_statusBar1->SetStatusText(text, 1); +} + + +void MainDialog::onResizeMainWindow(wxEvent& event) +{ + if (!IsMaximized()) + { + GetSize(&widthNotMaximized, &heightNotMaximized); + GetPosition(&posXNotMaximized, &posYNotMaximized); + } + event.Skip(); +} + + void MainDialog::onGrid1ButtonEvent(wxKeyEvent& event) { //CTRL + C || CTRL + INS if (event.ControlDown() && event.GetKeyCode() == 67 || event.ControlDown() && event.GetKeyCode() == WXK_INSERT) copySelectionToClipboard(m_grid1); + + else if (event.GetKeyCode() == WXK_DELETE) + deleteFilesOnGrid(m_grid1); + event.Skip(); } @@ -431,6 +766,22 @@ void MainDialog::onGrid2ButtonEvent(wxKeyEvent& event) if (event.ControlDown() && event.GetKeyCode() == 67 || event.ControlDown() && event.GetKeyCode() == WXK_INSERT) copySelectionToClipboard(m_grid2); + else if (event.GetKeyCode() == WXK_DELETE) + deleteFilesOnGrid(m_grid2); + + event.Skip(); +} + + +void MainDialog::onGrid3ButtonEvent(wxKeyEvent& event) +{ + //CTRL + C || CTRL + INS + if (event.ControlDown() && event.GetKeyCode() == 67 || + event.ControlDown() && event.GetKeyCode() == WXK_INSERT) + copySelectionToClipboard(m_grid3); + else if (event.GetKeyCode() == WXK_DELETE) + deleteFilesOnGrid(m_grid3); + event.Skip(); } @@ -469,6 +820,7 @@ void MainDialog::OnDirChangedPanel1(wxFileDirPickerEvent& event) event.Skip(); } + void MainDialog::OnDirChangedPanel2(wxFileDirPickerEvent& event) { wxString newPath = m_dirPicker2->GetPath(); @@ -484,51 +836,230 @@ void MainDialog::OnDirChangedPanel2(wxFileDirPickerEvent& event) event.Skip(); } -void onFilesDropped(wxString elementName, wxTextCtrl* txtCtrl, wxDirPickerCtrl* dirPicker) + +void onFilesDropped(const wxString& elementName, wxTextCtrl* txtCtrl, wxDirPickerCtrl* dirPicker) { - if (wxDirExists(elementName)) + wxString fileName = elementName; + + if (wxDirExists(fileName)) { - txtCtrl->SetValue(elementName); - dirPicker->SetPath(elementName); + txtCtrl->SetValue(fileName); + dirPicker->SetPath(fileName); } else { - elementName = wxFileName(elementName).GetPath(); - if (wxDirExists(elementName)) + fileName = wxFileName(fileName).GetPath(); + if (wxDirExists(fileName)) { - txtCtrl->SetValue(elementName); - dirPicker->SetPath(elementName); + txtCtrl->SetValue(fileName); + dirPicker->SetPath(fileName); } } } -void MainDialog::onFilesDroppedPanel1(wxDropFilesEvent& event) +void MainDialog::clearStatusBar() +{ + stackObjects = 0; //prevent old stack objects from popping up + + m_statusBar1->SetStatusText(""); + m_statusBar1->SetStatusText("", 1); + m_statusBar1->SetStatusText("", 2); +} + + +wxString getFormattedHistoryElement(const wxString& filename) +{ + wxString output = wxFileName(filename).GetFullName(); + if (output.EndsWith(".FFS")) + output = output.BeforeLast('.'); + return output; +} + + +//tests if the same filenames are specified, even if they are relative to the current working directory +bool sameFileSpecified(const wxString& file1, const wxString& file2) +{ + wxString file1Full = file1; + wxString file2Full = file2; + + if (wxFileName(file1).GetPath() == wxEmptyString) + file1Full = wxFileName::GetCwd() + FileNameSeparator + file1; + + if (wxFileName(file2).GetPath() == wxEmptyString) + file2Full = wxFileName::GetCwd() + FileNameSeparator + file2; + + return (file1Full == file2Full); +} + + +void MainDialog::addCfgFileToHistory(const wxString& filename) { - if (event.m_noFiles >= 1) + //the default configFile should not be in the history + if (sameFileSpecified(FreeFileSync::FFS_LastConfigFile, filename)) + return; + + + bool duplicateEntry = false; + unsigned int duplicatePos = 0; + for (unsigned int i = 0; i < cfgFileNames.size(); ++i) + if (sameFileSpecified(cfgFileNames[i], filename)) + { + duplicateEntry = true; + duplicatePos = i; + break; + } + + + if (duplicateEntry) //if entry is in the list, then jump to element + { + m_choiceLoad->SetSelection(duplicatePos + 1); + } + else + { + cfgFileNames.insert(cfgFileNames.begin(), filename); + m_choiceLoad->Insert(getFormattedHistoryElement(filename), 1); //insert after "Load configuration..." + m_choiceLoad->SetSelection(1); + } + + //keep maximal size of history list + if (cfgFileNames.size() > unsigned(CfgHistroyLength)) { - onFilesDropped(event.GetFiles()[0], m_directoryPanel1, m_dirPicker1); + //delete last rows + cfgFileNames.erase(cfgFileNames.end() - 1); + m_choiceLoad->Delete(CfgHistroyLength); //don't forget: m_choiceLoad has (cfgHistroyLength + 1) elements + } +} + +bool FileDropEvent::OnDropFiles(wxCoord x, wxCoord y, const wxArrayString& filenames) +{ + if (filenames.IsEmpty()) + return false; + else + { //disable the sync button - m_bpButtonSync->Enable(false); + mainDlg->m_bpButtonSync->Disable(); + //clear grids - currentGridData.clear(); - writeGrid(currentGridData); + mainDlg->currentGridData.clear(); + mainDlg->writeGrid(mainDlg->currentGridData); + + mainDlg->clearStatusBar(); + + const wxString droppedFileName = filenames[0]; + + //test if ffs config file has been dropped + if (wxFileExists(droppedFileName) && FreeFileSync::isFFS_ConfigFile(droppedFileName)) + { + mainDlg->readConfigurationFromHD(droppedFileName); + + mainDlg->pushStatusInformation(_("Configuration loaded!")); + } + + else if (targetGrid == 1) + onFilesDropped(droppedFileName, mainDlg->m_directoryPanel1, mainDlg->m_dirPicker1); + + else if (targetGrid == 2) + onFilesDropped(droppedFileName, mainDlg->m_directoryPanel2, mainDlg->m_dirPicker2); } - event.Skip(); + return false; } -void MainDialog::onFilesDroppedPanel2(wxDropFilesEvent& event) + +void MainDialog::OnSaveConfig(wxCommandEvent& event) { - if (event.m_noFiles >= 1) + wxString defaultFileName = "SyncSettings.FFS"; + + //try to use last selected configuration file as default + int selectedItem; + if ((selectedItem = m_choiceLoad->GetSelection()) != wxNOT_FOUND) + if (1 <= selectedItem && unsigned(selectedItem) < m_choiceLoad->GetCount()) + if (unsigned(selectedItem - 1) < cfgFileNames.size()) + defaultFileName = cfgFileNames[selectedItem - 1]; + + + clearStatusBar(); + + wxFileDialog* filePicker = new wxFileDialog(this, "", "", defaultFileName, "*.*", wxFD_SAVE); + + if (filePicker->ShowModal() == wxID_OK) { - onFilesDropped(event.GetFiles()[0], m_directoryPanel2, m_dirPicker2); + wxString newFileName = filePicker->GetFilename(); - //disable the sync button - m_bpButtonSync->Enable(false); - //clear grids - currentGridData.clear(); - writeGrid(currentGridData); + if (wxFileExists(newFileName)) + { + wxMessageDialog* messageDlg = new wxMessageDialog(this, wxString("\"") + newFileName + "\"" + _(" already exists. Overwrite?"), _("Warning") , wxOK | wxCANCEL); + + if (messageDlg->ShowModal() != wxID_OK) + { + pushStatusInformation(_("Saved aborted!")); + return; + } + } + writeConfigurationToHD(newFileName); + + pushStatusInformation(_("Configuration saved!")); + } +} + + +void MainDialog::OnLoadConfiguration(wxCommandEvent& event) +{ + int selectedItem; + if ((selectedItem = m_choiceLoad->GetSelection()) != wxNOT_FOUND) + { + wxString newCfgFile; + + clearStatusBar(); + + switch (selectedItem) + { + case 0: //load config from file + wxFileDialog* filePicker = new wxFileDialog(this, "", "", "", "*.*", wxFD_OPEN); + + if (filePicker->ShowModal() == wxID_OK) + newCfgFile = filePicker->GetFilename(); + + break; + default: + if (1 <= selectedItem && unsigned(selectedItem) < m_choiceLoad->GetCount()) + { + if (unsigned(selectedItem - 1) < cfgFileNames.size()) + newCfgFile = cfgFileNames[selectedItem - 1]; + } + break; + } + + if (!newCfgFile.IsEmpty()) + { + if (wxFileExists(newCfgFile) && FreeFileSync::isFFS_ConfigFile(newCfgFile)) + { + readConfigurationFromHD(newCfgFile); + + pushStatusInformation(_("Configuration loaded!")); + } + else + wxMessageBox(_("The selected file does not contain a valid configuration!"), _("Warning"), wxOK); + } + } + event.Skip(); +} + + +void MainDialog::OnChoiceKeyEvent(wxKeyEvent& event) +{ + if (event.GetKeyCode() == WXK_DELETE) + { //try to delete the currently selected config history item + int selectedItem; + if ((selectedItem = m_choiceLoad->GetSelection()) != wxNOT_FOUND) + if (1 <= selectedItem && unsigned(selectedItem) < m_choiceLoad->GetCount()) + if (unsigned(selectedItem - 1) < cfgFileNames.size()) + { + //delete selected row + cfgFileNames.erase(cfgFileNames.begin() + selectedItem - 1); + m_choiceLoad->Delete(selectedItem); + } } event.Skip(); } @@ -556,7 +1087,7 @@ void MainDialog::OnQuit(wxCommandEvent &event) } -void MainDialog::readConfigurationFromHD(const wxString& filename) +void MainDialog::readConfigurationFromHD(const wxString& filename, bool programStartup) { //default values syncConfiguration.exLeftSideOnly = SyncDirRight; @@ -578,12 +1109,26 @@ void MainDialog::readConfigurationFromHD(const wxString& filename) filterIsActive = false; //do not filter by default useRecycleBin = false; //do not use: in case OS doesn't support this, user will have to activate first and then get the error message + + widthNotMaximized = wxDefaultCoord; + heightNotMaximized = wxDefaultCoord; + posXNotMaximized = wxDefaultCoord; + posYNotMaximized = wxDefaultCoord; //##################################################### ifstream config(filename.c_str()); if (!config) return; + //put filename on list of last used config files + addCfgFileToHistory(filename); + + char bigBuffer[10000]; + + + //read FFS identifier + config.get(bigBuffer, FreeFileSync::FFS_ConfigFileID.Len() + 1); + //read sync configuration syncConfiguration.exLeftSideOnly = SyncDirection(config.get()); syncConfiguration.exRightSideOnly = SyncDirection(config.get()); @@ -604,8 +1149,6 @@ void MainDialog::readConfigurationFromHD(const wxString& filename) assert (false); } - char bigBuffer[10000]; - //read column sizes for (int i = 0; i < m_grid1->GetNumberCols(); ++i) { @@ -619,17 +1162,30 @@ void MainDialog::readConfigurationFromHD(const wxString& filename) } //read application window size and position - Maximize(bool(config.get())); + bool startWindowMaximized = bool(config.get()); config.getline(bigBuffer, 100, char(0)); - int width = atoi(bigBuffer); + int widthTmp = atoi(bigBuffer); config.getline(bigBuffer, 100, char(0)); - int height = atoi(bigBuffer); + int heighthTmp = atoi(bigBuffer); + config.getline(bigBuffer, 100, char(0)); - int posX = atoi(bigBuffer); + int posX_Tmp = atoi(bigBuffer); config.getline(bigBuffer, 100, char(0)); - int posY = atoi(bigBuffer); - SetSize(posX, posY, width, height); + int posY_Tmp = atoi(bigBuffer); + + //apply window size and position at program startup ONLY + if (programStartup) + { + widthNotMaximized = widthTmp; + heightNotMaximized = heighthTmp; + posXNotMaximized = posX_Tmp; + posYNotMaximized = posY_Tmp; + + //apply window size and position + SetSize(posXNotMaximized, posYNotMaximized, widthNotMaximized, heightNotMaximized); + Maximize(startWindowMaximized); + } //read last directory selection config.getline(bigBuffer, 10000, char(0)); @@ -661,21 +1217,15 @@ void MainDialog::readConfigurationFromHD(const wxString& filename) void MainDialog::writeConfigurationToHD(const wxString& filename) { - DWORD dwFileAttributes; - - //make config file visible: needed for ofstream - if (wxFileExists(filename)) - { - dwFileAttributes = FILE_ATTRIBUTE_NORMAL; - if (!SetFileAttributes( - filename.c_str(), // address of filename - dwFileAttributes // address of attributes to set - )) throw runtime_error(string(_("Could not change attributes of ")) + filename.c_str()); - } - ofstream config(filename.c_str()); if (!config) - throw runtime_error(string(_("Could not open ")) + filename.c_str()); + throw runtime_error(string(_("Could not write to ")) + filename.c_str()); + + //put filename on list of last used config files + addCfgFileToHistory(filename); + + //write FFS identifier + config<<FreeFileSync::FFS_ConfigFileID.c_str(); //write sync configuration config<<char(syncConfiguration.exLeftSideOnly) @@ -698,20 +1248,16 @@ void MainDialog::writeConfigurationToHD(const wxString& filename) for (int i = 0; i < m_grid2->GetNumberCols(); ++i) config<<m_grid2->GetColSize(i)<<char(0); - //write application window size + //write application window size and position config<<char(IsMaximized()); + //window size - int width = 0; - int height = 0; - GetSize(&width, &height); - config<<width<<char(0); - config<<height<<char(0); + config<<widthNotMaximized<<char(0); + config<<heightNotMaximized<<char(0); + //window position - int posX = 0; - int posY = 0; - GetPosition(&posX, &posY); - config<<posX<<char(0); - config<<posY<<char(0); + config<<posXNotMaximized<<char(0); + config<<posYNotMaximized<<char(0); //write last directory selection config<<m_directoryPanel1->GetValue().c_str()<<char(0) @@ -727,13 +1273,6 @@ void MainDialog::writeConfigurationToHD(const wxString& filename) config<<char(useRecycleBin); config.close(); - - //hide config file - dwFileAttributes = FILE_ATTRIBUTE_HIDDEN; - if (!SetFileAttributes( - filename.c_str(), // address of filename - dwFileAttributes // address of attributes to set - )) throw runtime_error(string(_("Could not change attributes of ")) + filename.c_str()); } void MainDialog::OnAbout(wxCommandEvent &event) @@ -778,7 +1317,7 @@ void MainDialog::OnHideFilteredButton(wxCommandEvent &event) void MainDialog::OnConfigureFilter(wxHyperlinkEvent &event) { FilterDlg* filterDlg = new FilterDlg(this); - if (filterDlg->ShowModal() == OkayButtonPressed) + if (filterDlg->ShowModal() == FilterDlg::OkayButtonPressed) { if (filterIsActive) { @@ -888,11 +1427,8 @@ void MainDialog::OnCompare(wxCommandEvent &event) wxMessageBox(_("Please select directories for both sides!"), _("Information")); return; } - m_statusBar1->SetStatusText(""); - m_statusBar1->SetStatusText("", 1); - m_statusBar1->SetStatusText("", 2); - m_statusBar1->SetStatusText("", 3); - m_statusBar1->SetStatusText("", 4); + + clearStatusBar(); //check if directories exist if loaded by config file if (!wxDirExists(m_directoryPanel1->GetValue())) @@ -919,6 +1455,7 @@ void MainDialog::OnCompare(wxCommandEvent &event) { //class handling status display and error messages CompareStatusUpdater statusUpdater(this, m_statusBar1); cmpStatusUpdaterTmp = &statusUpdater; + stackObjects = 0; //unsigned int startTime3 = GetTickCount(); FreeFileSync::getModelDiff(currentGridData, @@ -937,13 +1474,14 @@ void MainDialog::OnCompare(wxCommandEvent &event) //once compare is finished enable the sync button m_bpButtonSync->Enable(true); + m_bpButtonSync->SetFocus(); cmpStatusUpdaterTmp = 0; } catch (AbortThisProcess& theException) { //disable the sync button - m_bpButtonSync->Enable(false); + m_bpButtonSync->Disable(); } wxEndBusyCursor(); @@ -1052,11 +1590,7 @@ void MainDialog::OnSync( wxCommandEvent& event ) { wxBeginBusyCursor(); - m_statusBar1->SetStatusText(""); - m_statusBar1->SetStatusText("", 1); - m_statusBar1->SetStatusText("", 2); - m_statusBar1->SetStatusText("", 3); - m_statusBar1->SetStatusText("", 4); + clearStatusBar(); //unsigned int startTime = GetTickCount(); synchronizeFolders(currentGridData, syncConfiguration); @@ -1334,6 +1868,7 @@ bool cmpGridSmallerThan(const UI_GridLine& a, const UI_GridLine& b) void MainDialog::updateStatusInformation(const UI_Grid& visibleGrid) { + stackObjects = 0; unsigned int objectsOnLeftView = 0; unsigned int objectsOnRightView = 0; mpz_t filesizeLeftView, filesizeRightView, tmpInt; @@ -1383,17 +1918,17 @@ void MainDialog::updateStatusInformation(const UI_Grid& visibleGrid) wxString objectsView = numberToWxString(visibleGrid.size()); GlobalFunctions::includeNumberSeparator(objectsView); if (currentGridData.size() == 1) - m_statusBar1->SetStatusText(objectsView + _(" of ") + objectsTotal + _(" row in view"), 2); + m_statusBar1->SetStatusText(objectsView + _(" of ") + objectsTotal + _(" row in view"), 1); else - m_statusBar1->SetStatusText(objectsView + _(" of ") + objectsTotal + _(" rows in view"), 2); + m_statusBar1->SetStatusText(objectsView + _(" of ") + objectsTotal + _(" rows in view"), 1); wxString objectsViewRight = numberToWxString(objectsOnRightView); GlobalFunctions::includeNumberSeparator(objectsViewRight); if (objectsOnRightView == 1) - m_statusBar1->SetStatusText(wxString(_("1 item on right, ")) + FreeFileSync::formatFilesizeToShortString(mpz_class(filesizeRightView)), 4); + m_statusBar1->SetStatusText(wxString(_("1 item on right, ")) + FreeFileSync::formatFilesizeToShortString(mpz_class(filesizeRightView)), 2); else - m_statusBar1->SetStatusText(objectsViewRight + _(" items on right, ") + FreeFileSync::formatFilesizeToShortString(mpz_class(filesizeRightView)), 4); + m_statusBar1->SetStatusText(objectsViewRight + _(" items on right, ") + FreeFileSync::formatFilesizeToShortString(mpz_class(filesizeRightView)), 2); //----------------------------------------------------- mpz_clear(filesizeLeftView); @@ -1448,8 +1983,8 @@ void MainDialog::mapFileModelToUI(UI_Grid& output, const FileCompareResult& file } else { - gridline.leftFilename = i->fileDescrLeft.relFilename.AfterLast('\\'); - gridline.leftRelativePath = i->fileDescrLeft.relFilename.BeforeLast('\\'); + gridline.leftFilename = i->fileDescrLeft.relFilename.AfterLast(FileNameSeparator); + gridline.leftRelativePath = i->fileDescrLeft.relFilename.BeforeLast(FileNameSeparator); gridline.leftSize = GlobalFunctions::includeNumberSeparator(fileSize = i->fileDescrLeft.fileSize); } gridline.leftDate = i->fileDescrLeft.lastWriteTime; @@ -1465,8 +2000,8 @@ void MainDialog::mapFileModelToUI(UI_Grid& output, const FileCompareResult& file } else { - gridline.rightFilename = i->fileDescrRight.relFilename.AfterLast('\\'); - gridline.rightRelativePath = i->fileDescrRight.relFilename.BeforeLast('\\'); + gridline.rightFilename = i->fileDescrRight.relFilename.AfterLast(FileNameSeparator); + gridline.rightRelativePath = i->fileDescrRight.relFilename.BeforeLast(FileNameSeparator); gridline.rightSize = GlobalFunctions::includeNumberSeparator(fileSize = i->fileDescrRight.fileSize); } gridline.rightDate = i->fileDescrRight.lastWriteTime; @@ -1483,8 +2018,11 @@ void MainDialog::mapFileModelToUI(UI_Grid& output, const FileCompareResult& file void updateUI_Now() { //process UI events and prevent application from "not responding" -> NO performance issue! - while (wxTheApp->Pending()) - wxTheApp->Dispatch(); + wxTheApp->Yield(); + + +// while (wxTheApp->Pending()) +// wxTheApp->Dispatch(); } @@ -1494,7 +2032,7 @@ bool updateUI_IsAllowed() wxLongLong newExec = wxGetLocalTimeMillis(); - if (newExec - lastExec > 100) //perform ui updates not more often than necessary, 100 seems to be a good value with only a minimal performance loss + if (newExec - lastExec >= 100) //perform ui updates not more often than necessary, 100 seems to be a good value with only a minimal performance loss { lastExec = newExec; return true; @@ -1531,12 +2069,15 @@ CompareStatusUpdater::CompareStatusUpdater(MainDialog* dlg, wxStatusBar* mainWin mainDialog->m_panel1->Disable(); mainDialog->m_panel2->Disable(); mainDialog->m_panel3->Disable(); + mainDialog->m_bpButton201->Disable(); + mainDialog->m_choiceLoad->Disable(); //show abort button - mainDialog->m_buttonAbort->Show(true); - mainDialog->m_bpButtonCompare->Show(false); + mainDialog->m_buttonAbort->Show(); + mainDialog->m_bpButtonCompare->Hide(); mainDialog->Layout(); mainDialog->Refresh(); + mainDialog->m_buttonAbort->SetFocus(); } CompareStatusUpdater::~CompareStatusUpdater() @@ -1560,12 +2101,14 @@ CompareStatusUpdater::~CompareStatusUpdater() mainDialog->m_panel1->Enable(); mainDialog->m_panel2->Enable(); mainDialog->m_panel3->Enable(); + mainDialog->m_bpButton201->Enable(); + mainDialog->m_choiceLoad->Enable(); if (abortionRequested) - mainDialog->m_statusBar1->SetStatusText(mainDialog->m_statusBar1->GetStatusText(2) + " - " + _("Aborted!"), 2); + mainDialog->pushStatusInformation(_("Operation aborted!")); - mainDialog->m_buttonAbort->Show(false); - mainDialog->m_bpButtonCompare->Show(true); + mainDialog->m_buttonAbort->Hide(); + mainDialog->m_bpButtonCompare->Show(); mainDialog->Layout(); mainDialog->Refresh(); } @@ -1619,7 +2162,7 @@ void CompareStatusUpdater::triggerUI_Refresh() if (updateUI_IsAllowed()) //test if specific time span between ui updates is over { - statusBar->SetStatusText(wxString(_("Scanning files/folders: ")) + numberToWxString(numberOfScannedObjects), 2); + statusBar->SetStatusText(wxString(_("Scanning files/folders: ")) + numberToWxString(numberOfScannedObjects), 1); updateUI_Now(); } } diff --git a/ui/MainDialog.h b/ui/MainDialog.h index 4c2486b9..7803cfd6 100644 --- a/ui/MainDialog.h +++ b/ui/MainDialog.h @@ -10,19 +10,18 @@ #ifndef MAINDIALOG_H #define MAINDIALOG_H -#include "..\library\wxWidgets.h" -#include "GUI_Generated.h" -#include "..\FreeFileSync.h" +#include "../library/wxWidgets.h" +#include "guiGenerated.h" +#include "../FreeFileSync.h" -#include "SyncDialog.h" -#include "SmallDialogs.h" -#include "Resources.h" +#include "syncDialog.h" +#include "smallDialogs.h" +#include "resources.h" +#include <wx/dnd.h> +#include <wx/config.h> using namespace std; -//configure filter dialog -const int OkayButtonPressed = 25; - const wxString ConstFilteredOut = "(-)"; struct UI_GridLine @@ -50,11 +49,12 @@ void updateUI_Now(); //do the updating extern int leadingPanel; class CompareStatusUpdater; +class FileDropEvent; -class MainDialog : public GUI_Generated +class MainDialog : public GuiGenerated { public: - MainDialog(wxFrame* frame); + MainDialog(wxFrame* frame, const wxString& cfgFileName); ~MainDialog(); private: @@ -62,8 +62,9 @@ private: friend class FilterDlg; friend class CompareStatusUpdater; friend class SyncStatusUpdater; + friend class FileDropEvent; - void readConfigurationFromHD(const wxString& filename); + void readConfigurationFromHD(const wxString& filename, bool programStartup = false); void writeConfigurationToHD(const wxString& filename); void loadResourceFiles(); @@ -72,37 +73,47 @@ private: void updateViewFilterButtons(); void updateFilterButton(); + void addCfgFileToHistory(const wxString& filename); + void synchronizeFolders(FileCompareResult& grid, const SyncConfiguration config); static wxString evaluateCmpResult(const CompareFilesResult result, const bool selectedForSynchronization); //main method for putting gridData on UI: maps data respecting current view settings void writeGrid(const FileCompareResult& gridData, bool useUI_GridCache = false); - void mapFileModelToUI(UI_Grid& output, const FileCompareResult& fileCmpResult); void updateStatusInformation(const UI_Grid& output); void filterRangeManual(int begin, int end, int leadingRow); + void deleteFilesOnGrid(wxGrid* grid); + + //work to be done in idle time + void OnIdleEvent(wxEvent& event); + + //delayed status information restore + void pushStatusInformation(const wxString& text); + void writeStatusInformation(const wxString& text); + void clearStatusBar(); - //Events + //events void onGrid1access(wxEvent& event); void onGrid2access(wxEvent& event); void onGrid3access(wxEvent& event); void onGrid1ButtonEvent(wxKeyEvent& event); void onGrid2ButtonEvent(wxKeyEvent& event); + void onGrid3ButtonEvent(wxKeyEvent& event); void OnEnterLeftDir(wxCommandEvent& event); void OnEnterRightDir(wxCommandEvent& event); void OnDirChangedPanel1(wxFileDirPickerEvent& event); void OnDirChangedPanel2(wxFileDirPickerEvent& event); - void onFilesDroppedPanel1(wxDropFilesEvent& event); - void onFilesDroppedPanel2(wxDropFilesEvent& event); - void OnGrid3SelectCell(wxGridEvent& event); + //manual filtering of rows: + void OnGridSelectCell(wxGridEvent& event); void OnGrid3SelectRange(wxGridRangeSelectEvent& event); void OnGrid3LeftMouseUp(wxEvent& event); - void OnIdleToFilterManually(wxEvent& event); + void OnGrid3LeftMouseDown(wxEvent& event); void OnLeftGridDoubleClick( wxGridEvent& event); void OnRightGridDoubleClick(wxGridEvent& event); @@ -116,6 +127,11 @@ private: void OnRightOnlyFiles( wxCommandEvent& event); void OnEqualFiles( wxCommandEvent& event); + void OnSaveConfig( wxCommandEvent& event); + void OnLoadConfiguration( wxCommandEvent& event); + void OnChoiceKeyEvent( wxKeyEvent& event ); + +void onResizeMainWindow(wxEvent& event); void OnAbortCompare( wxCommandEvent& event); void OnFilterButton( wxCommandEvent& event); void OnHideFilteredButton( wxCommandEvent& event); @@ -155,6 +171,12 @@ private: bool rightNewerFilesActive; bool rightOnlyFilesActive; + //ui settings + int widthNotMaximized; + int heightNotMaximized; + int posXNotMaximized; + int posYNotMaximized; + //other options bool useRecycleBin; //use Recycle bin when deleting or overwriting files while synchronizing @@ -162,10 +184,20 @@ private: wxFrame* parent; + //status information + wxLongLong lastStatusChange; + int stackObjects; + + //save the last used config filenames + wxConfig* cfgFileHistory; + vector<wxString> cfgFileNames; + static const int CfgHistroyLength = 10; + //variables for manual filtering of m_grid3 - int selectedRangeBegin; - int selectedRangeEnd; - int selectionLead; + int selectedRange3Begin; //only used for grid 3 + int selectedRange3End; //only used for grid 3 + int selectionLead; //used on all three grids + bool filteringInitialized; bool filteringPending; CompareStatusUpdater* cmpStatusUpdaterTmp; //used only by the abort button when comparing @@ -173,6 +205,29 @@ private: //###################################################################################### + +class FileDropEvent : public wxFileDropTarget +{ +public: + FileDropEvent(MainDialog* dlg, int grid) : + mainDlg(dlg), + targetGrid(grid) + { + assert(grid == 1 || grid == 2); + } + + ~FileDropEvent() {} + + //overwritten virtual method + bool OnDropFiles(wxCoord x, wxCoord y, const wxArrayString& filenames); + +private: + MainDialog* mainDlg; + int targetGrid; +}; + +//###################################################################################### + //classes handling sync and compare error as well as status information class CompareStatusUpdater : public StatusUpdater diff --git a/ui/Resources.cpp b/ui/Resources.cpp index d4db282c..a92c73f7 100644 --- a/ui/Resources.cpp +++ b/ui/Resources.cpp @@ -1,4 +1,4 @@ -#include "Resources.h" +#include "resources.h" #include <wx/wfstream.h> #include <wx/zipstrm.h> #include <wx/image.h> @@ -38,6 +38,7 @@ wxBitmap* GlobalResources::bitmapFilterOff = 0; wxBitmap* GlobalResources::bitmapWarning = 0; wxBitmap* GlobalResources::bitmapSmallUp = 0; wxBitmap* GlobalResources::bitmapSmallDown = 0; +wxBitmap* GlobalResources::bitmapSave = 0; wxAnimation* GlobalResources::animationMoney = 0; @@ -77,6 +78,7 @@ void GlobalResources::loadResourceFiles() bitmapResource["Warning.png"] = (bitmapWarning = new wxBitmap(wxNullBitmap)); bitmapResource["small arrow up.png"] = (bitmapSmallUp = new wxBitmap(wxNullBitmap)); bitmapResource["small arrow down.png"] = (bitmapSmallDown = new wxBitmap(wxNullBitmap)); + bitmapResource["save.png"] = (bitmapSave = new wxBitmap(wxNullBitmap)); animationMoney = new wxAnimation(wxNullAnimation); diff --git a/ui/Resources.h b/ui/Resources.h index fba26f03..fa7eaf29 100644 --- a/ui/Resources.h +++ b/ui/Resources.h @@ -47,6 +47,7 @@ public: static wxBitmap* bitmapWarning; static wxBitmap* bitmapSmallUp; static wxBitmap* bitmapSmallDown; + static wxBitmap* bitmapSave; static wxAnimation* animationMoney; diff --git a/ui/SmallDialogs.cpp b/ui/SmallDialogs.cpp index f6d29864..cf21bc22 100644 --- a/ui/SmallDialogs.cpp +++ b/ui/SmallDialogs.cpp @@ -1,5 +1,5 @@ -#include "SmallDialogs.h" -#include "..\library\globalFunctions.h" +#include "smallDialogs.h" +#include "../library/globalFunctions.h" AboutDlg::AboutDlg(MainDialog* window) : AboutDlgGenerated(window) { @@ -12,6 +12,8 @@ AboutDlg::AboutDlg(MainDialog* window) : AboutDlgGenerated(window) //build wxString build = wxString(_("(Build: ")) + __TDATE__ + ")"; m_build->SetLabel(build); + + m_button8->SetFocus(); } AboutDlg::~AboutDlg() {} @@ -28,7 +30,10 @@ void AboutDlg::OnOK(wxCommandEvent& event) //######################################################################################## -HelpDlg::HelpDlg(MainDialog* window) : HelpDlgGenerated(window) {} +HelpDlg::HelpDlg(MainDialog* window) : HelpDlgGenerated(window) +{ + m_button8->SetFocus(); +} HelpDlg::~HelpDlg() {} @@ -46,7 +51,9 @@ void HelpDlg::OnOK(wxCommandEvent& event) //######################################################################################## -FilterDlg::FilterDlg(MainDialog* window) : FilterDlgGenerated(window), mainDialog(window) +FilterDlg::FilterDlg(MainDialog* window) : + FilterDlgGenerated(window), + mainDialog(window) { m_bitmap8->SetBitmap(*GlobalResources::bitmapInclude); @@ -58,11 +65,13 @@ FilterDlg::FilterDlg(MainDialog* window) : FilterDlgGenerated(window), mainDialo FilterDlg::~FilterDlg() {} + void FilterDlg::OnClose(wxCloseEvent& event) { EndModal(0); } + void FilterDlg::OnOK(wxCommandEvent& event) { //only if user presses ApplyFilter, he wants the changes to be committed @@ -74,6 +83,12 @@ void FilterDlg::OnOK(wxCommandEvent& event) } +void FilterDlg::OnCancel(wxCommandEvent& event) +{ + EndModal(0); +} + + void FilterDlg::OnDefault(wxCommandEvent& event) { m_textCtrlInclude->SetValue("*"); @@ -84,6 +99,34 @@ void FilterDlg::OnDefault(wxCommandEvent& event) } //######################################################################################## +DeleteDialog::DeleteDialog(const wxString& headerText, const wxString& messageText, wxWindow* main) : + DeleteDialogGenerated(main) +{ + m_staticTextHeader->SetLabel(headerText); + m_textCtrlMessage->SetValue(messageText); + + m_buttonOK->SetFocus(); +} + +DeleteDialog::~DeleteDialog() {} + + +void DeleteDialog::OnOK(wxCommandEvent& event) +{ + EndModal(OkayButtonPressed); +} + +void DeleteDialog::OnCancel(wxCommandEvent& event) +{ + EndModal(CancelButtonPressed); +} + +void DeleteDialog::OnClose(wxCloseEvent& event) +{ + EndModal(CancelButtonPressed); +} +//######################################################################################## + ErrorDlg::ErrorDlg(const wxString messageText, bool& suppressErrormessages) : ErrorDlgGenerated(0), @@ -91,6 +134,8 @@ ErrorDlg::ErrorDlg(const wxString messageText, bool& suppressErrormessages) : { m_bitmap10->SetBitmap(*GlobalResources::bitmapWarning); m_textCtrl8->SetValue(messageText); + + m_buttonContinue->SetFocus(); } ErrorDlg::~ErrorDlg() {} @@ -134,6 +179,8 @@ SyncStatus::SyncStatus(StatusUpdater* updater, double gaugeTotalElements, wxWind resetGauge(gaugeTotalElements); + m_buttonAbort->SetFocus(); + if (windowToDis) //disable (main) window while this status dialog is shown windowToDis->Enable(false); } @@ -142,7 +189,10 @@ SyncStatus::SyncStatus(StatusUpdater* updater, double gaugeTotalElements, wxWind SyncStatus::~SyncStatus() { if (windowToDis) + { windowToDis->Enable(true); + windowToDis->Raise(); + } } @@ -183,14 +233,10 @@ void SyncStatus::updateStatusDialogNow() m_staticTextProcessedObj->SetLabel(GlobalFunctions::numberToWxString(numberOfProcessedObjects)); //remaining bytes left for copy - m_staticTextBytesCurrent->SetLabel(FreeFileSync::formatFilesizeToShortString(mpz_class(currentElements))); - - static double totalElementsLast = -1; - if (totalElementsLast != totalElements) - { - totalElementsLast = totalElements; - m_staticTextBytesTotal->SetLabel(FreeFileSync::formatFilesizeToShortString(mpz_class(totalElements))); - } + const wxString remainingBytes = + FreeFileSync::formatFilesizeToShortString(mpz_class(currentElements)) + "/" + + FreeFileSync::formatFilesizeToShortString(mpz_class(totalElements)); + m_staticTextBytesCopied->SetLabel(remainingBytes); //do the ui update updateUI_Now(); @@ -204,6 +250,7 @@ void SyncStatus::processHasFinished(const wxString& finalStatusText) //essential m_staticTextStatus->SetLabel(finalStatusText); m_buttonAbort->Hide(); m_buttonOK->Show(); + m_buttonOK->SetFocus(); updateStatusDialogNow(); //keep this sequence to avoid display distortion, if e.g. only 1 item is sync'ed Layout(); // diff --git a/ui/SmallDialogs.h b/ui/SmallDialogs.h index 77da9eac..c41ca2b8 100644 --- a/ui/SmallDialogs.h +++ b/ui/SmallDialogs.h @@ -1,7 +1,7 @@ #ifndef SMALLDIALOGS_H_INCLUDED #define SMALLDIALOGS_H_INCLUDED -#include "MainDialog.h" +#include "mainDialog.h" class MainDialog; @@ -13,7 +13,7 @@ public: private: void OnClose(wxCloseEvent& event); - void AboutDlg::OnOK(wxCommandEvent& event); + void OnOK(wxCommandEvent& event); }; @@ -35,24 +35,43 @@ public: FilterDlg(MainDialog* window); ~FilterDlg(); + static const int OkayButtonPressed = 25; + private: void OnDefault(wxCommandEvent& event); void OnOK(wxCommandEvent& event); + void OnCancel(wxCommandEvent& event); void OnClose(wxCloseEvent& event); MainDialog* mainDialog; }; +class DeleteDialog : public DeleteDialogGenerated +{ +public: + DeleteDialog(const wxString& headerText, const wxString& messageText, wxWindow* main); + ~DeleteDialog(); + + static const int OkayButtonPressed = 35; + static const int CancelButtonPressed = 45; + +private: + void OnOK(wxCommandEvent& event); + void OnCancel(wxCommandEvent& event); + void OnClose(wxCloseEvent& event); +}; + + class ErrorDlg : public ErrorDlgGenerated { public: ErrorDlg(const wxString messageText, bool& suppressErrormessages); ~ErrorDlg(); - static const int ContinueButtonPressed = 35; - static const int RetryButtonPressed = 45; - static const int AbortButtonPressed = 55; + static const int ContinueButtonPressed = 35; + static const int RetryButtonPressed = 45; + static const int AbortButtonPressed = 55; private: void OnClose(wxCloseEvent& event); @@ -87,7 +106,7 @@ private: bool currentProcessIsRunning; //gauge variables - double totalElements; //each element represents one byte for proper progress indicator scaling + double totalElements; //each element represents one byte for proper progress indicator scaling double currentElements; double scalingFactor; //nr of elements has to be normalized to smaller nr. because of range of int limitation diff --git a/ui/SyncDialog.cpp b/ui/SyncDialog.cpp index 2353e313..1f2804ae 100644 --- a/ui/SyncDialog.cpp +++ b/ui/SyncDialog.cpp @@ -1,5 +1,5 @@ -#include "SyncDialog.h" -#include "..\library\globalfunctions.h" +#include "syncDialog.h" +#include "../library/globalFunctions.h" SyncDialog::SyncDialog(MainDialog* window) : SyncDialogGenerated(window), mainDialog(window) @@ -136,6 +136,13 @@ void SyncDialog::OnClose(wxCloseEvent& event) EndModal(0); } + +void SyncDialog::OnCancel(wxCommandEvent& event) +{ + EndModal(0); +} + + void SyncDialog::OnBack(wxCommandEvent& event) { //write configuration to main dialog diff --git a/ui/SyncDialog.h b/ui/SyncDialog.h index a743279a..23d8ce5b 100644 --- a/ui/SyncDialog.h +++ b/ui/SyncDialog.h @@ -1,7 +1,7 @@ #ifndef SYNCDIALOG_H_INCLUDED #define SYNCDIALOG_H_INCLUDED -#include "MainDialog.h" +#include "mainDialog.h" class MainDialog; @@ -31,6 +31,7 @@ private: void OnStartSync(wxCommandEvent& event); void OnClose(wxCloseEvent& event); void OnBack(wxCommandEvent& event); + void OnCancel(wxCommandEvent& event); void OnSelectRecycleBin(wxCommandEvent& event); diff --git a/ui/GUI_Generated.cpp b/ui/guiGenerated.cpp index fc88dd7d..4308804e 100644 --- a/ui/GUI_Generated.cpp +++ b/ui/guiGenerated.cpp @@ -15,13 +15,13 @@ #include <wx/wx.h> #endif //WX_PRECOMP -#include "..\library\CustomGrid.h" +#include "..\library\customGrid.h" -#include "GUI_Generated.h" +#include "guiGenerated.h" /////////////////////////////////////////////////////////////////////////// -GUI_Generated::GUI_Generated( wxWindow* parent, wxWindowID id, const wxString& title, const wxPoint& pos, const wxSize& size, long style ) : wxFrame( parent, id, title, pos, size, style ) +GuiGenerated::GuiGenerated( wxWindow* parent, wxWindowID id, const wxString& title, const wxPoint& pos, const wxSize& size, long style ) : wxFrame( parent, id, title, pos, size, style ) { this->SetSizeHints( wxDefaultSize, wxDefaultSize ); @@ -36,7 +36,8 @@ GUI_Generated::GUI_Generated( wxWindow* parent, wxWindowID id, const wxString& t wxBoxSizer* bSizer30; bSizer30 = new wxBoxSizer( wxHORIZONTAL ); - m_bpButtonCompare = new wxBitmapButton( this, wxID_ANY, wxNullBitmap, wxDefaultPosition, wxSize( 190,37 ), wxBU_AUTODRAW|wxFULL_REPAINT_ON_RESIZE ); + m_bpButtonCompare = new wxBitmapButton( this, wxID_OK, wxNullBitmap, wxDefaultPosition, wxSize( 190,37 ), wxBU_AUTODRAW|wxFULL_REPAINT_ON_RESIZE ); + m_bpButtonCompare->SetDefault(); m_bpButtonCompare->SetToolTip( _("Compare both sides") ); m_bpButtonCompare->SetToolTip( _("Compare both sides") ); @@ -284,6 +285,24 @@ GUI_Generated::GUI_Generated( wxWindow* parent, wxWindowID id, const wxString& t bSizer3->Add( 0, 0, 1, wxEXPAND, 5 ); + m_bpButton201 = new wxBitmapButton( m_panel4, wxID_ANY, wxNullBitmap, wxDefaultPosition, wxSize( 40,40 ), wxBU_AUTODRAW ); + m_bpButton201->SetToolTip( _("Save current configuration to file") ); + + m_bpButton201->SetToolTip( _("Save current configuration to file") ); + + bSizer3->Add( m_bpButton201, 0, wxALL|wxALIGN_CENTER_VERTICAL, 5 ); + + wxString m_choiceLoadChoices[] = { _("Load configuration...") }; + int m_choiceLoadNChoices = sizeof( m_choiceLoadChoices ) / sizeof( wxString ); + m_choiceLoad = new wxChoice( m_panel4, wxID_ANY, wxDefaultPosition, wxSize( 140,-1 ), m_choiceLoadNChoices, m_choiceLoadChoices, 0 ); + m_choiceLoad->SetSelection( 0 ); + m_choiceLoad->SetToolTip( _("Load configuration from file:\n - use this choice box\n - drag & drop config file to this window\n - specify config file as first commandline parameter") ); + + bSizer3->Add( m_choiceLoad, 0, wxALL|wxALIGN_CENTER_VERTICAL, 5 ); + + + bSizer3->Add( 0, 0, 1, wxEXPAND, 5 ); + wxStaticBoxSizer* sbSizer31; sbSizer31 = new wxStaticBoxSizer( new wxStaticBox( m_panel4, wxID_ANY, _("Filter view") ), wxHORIZONTAL ); @@ -334,6 +353,12 @@ GUI_Generated::GUI_Generated( wxWindow* parent, wxWindowID id, const wxString& t bSizer3->Add( 0, 0, 1, wxEXPAND, 5 ); + + bSizer3->Add( 190, 0, 0, wxEXPAND, 5 ); + + + bSizer3->Add( 0, 0, 1, wxEXPAND, 5 ); + m_bpButton10 = new wxBitmapButton( m_panel4, wxID_ANY, wxNullBitmap, wxDefaultPosition, wxSize( 50,50 ), wxBU_AUTODRAW ); m_bpButton10->SetToolTip( _("Quit") ); @@ -348,72 +373,82 @@ GUI_Generated::GUI_Generated( wxWindow* parent, wxWindowID id, const wxString& t this->SetSizer( bSizer1 ); this->Layout(); - m_statusBar1 = this->CreateStatusBar( 5, wxST_SIZEGRIP, wxID_ANY ); + m_statusBar1 = this->CreateStatusBar( 3, wxST_SIZEGRIP, wxID_ANY ); // Connect Events - this->Connect( wxEVT_CLOSE_WINDOW, wxCloseEventHandler( GUI_Generated::OnClose ) ); - m_bpButtonCompare->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( GUI_Generated::OnCompare ), NULL, this ); - m_buttonAbort->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( GUI_Generated::OnAbortCompare ), NULL, this ); - m_radioBtnSizeDate->Connect( wxEVT_COMMAND_RADIOBUTTON_SELECTED, wxCommandEventHandler( GUI_Generated::OnChangeCompareVariant ), NULL, this ); - m_radioBtnContent->Connect( wxEVT_COMMAND_RADIOBUTTON_SELECTED, wxCommandEventHandler( GUI_Generated::OnChangeCompareVariant ), NULL, this ); - m_bpButton14->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( GUI_Generated::OnShowHelpDialog ), NULL, this ); - m_bpButtonFilter->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( GUI_Generated::OnFilterButton ), NULL, this ); - m_hyperlinkCfgFilter->Connect( wxEVT_COMMAND_HYPERLINK, wxHyperlinkEventHandler( GUI_Generated::OnConfigureFilter ), NULL, this ); - m_checkBoxHideFilt->Connect( wxEVT_COMMAND_CHECKBOX_CLICKED, wxCommandEventHandler( GUI_Generated::OnHideFilteredButton ), NULL, this ); - m_bpButtonSync->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( GUI_Generated::OnSync ), NULL, this ); - m_directoryPanel1->Connect( wxEVT_COMMAND_TEXT_UPDATED, wxCommandEventHandler( GUI_Generated::OnEnterLeftDir ), NULL, this ); - m_dirPicker1->Connect( wxEVT_COMMAND_DIRPICKER_CHANGED, wxFileDirPickerEventHandler( GUI_Generated::OnDirChangedPanel1 ), NULL, this ); - m_grid1->Connect( wxEVT_GRID_CELL_LEFT_DCLICK, wxGridEventHandler( GUI_Generated::OnLeftGridDoubleClick ), NULL, this ); - m_grid1->Connect( wxEVT_GRID_LABEL_LEFT_CLICK, wxGridEventHandler( GUI_Generated::OnSortLeftGrid ), NULL, this ); - m_bpButtonSwap->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( GUI_Generated::OnSwapDirs ), NULL, this ); - m_grid3->Connect( wxEVT_GRID_RANGE_SELECT, wxGridRangeSelectEventHandler( GUI_Generated::OnGrid3SelectRange ), NULL, this ); - m_grid3->Connect( wxEVT_GRID_SELECT_CELL, wxGridEventHandler( GUI_Generated::OnGrid3SelectCell ), NULL, this ); - m_directoryPanel2->Connect( wxEVT_COMMAND_TEXT_UPDATED, wxCommandEventHandler( GUI_Generated::OnEnterRightDir ), NULL, this ); - m_dirPicker2->Connect( wxEVT_COMMAND_DIRPICKER_CHANGED, wxFileDirPickerEventHandler( GUI_Generated::OnDirChangedPanel2 ), NULL, this ); - m_grid2->Connect( wxEVT_GRID_CELL_LEFT_DCLICK, wxGridEventHandler( GUI_Generated::OnRightGridDoubleClick ), NULL, this ); - m_grid2->Connect( wxEVT_GRID_LABEL_LEFT_CLICK, wxGridEventHandler( GUI_Generated::OnSortRightGrid ), NULL, this ); - m_bpButton11->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( GUI_Generated::OnAbout ), NULL, this ); - m_bpButton20->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( GUI_Generated::OnLeftOnlyFiles ), NULL, this ); - m_bpButton21->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( GUI_Generated::OnLeftNewerFiles ), NULL, this ); - m_bpButton25->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( GUI_Generated::OnEqualFiles ), NULL, this ); - m_bpButton22->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( GUI_Generated::OnDifferentFiles ), NULL, this ); - m_bpButton23->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( GUI_Generated::OnRightNewerFiles ), NULL, this ); - m_bpButton24->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( GUI_Generated::OnRightOnlyFiles ), NULL, this ); - m_bpButton10->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( GUI_Generated::OnQuit ), NULL, this ); + this->Connect( wxEVT_CLOSE_WINDOW, wxCloseEventHandler( GuiGenerated::OnClose ) ); + m_bpButtonCompare->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( GuiGenerated::OnCompare ), NULL, this ); + m_buttonAbort->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( GuiGenerated::OnAbortCompare ), NULL, this ); + m_radioBtnSizeDate->Connect( wxEVT_COMMAND_RADIOBUTTON_SELECTED, wxCommandEventHandler( GuiGenerated::OnChangeCompareVariant ), NULL, this ); + m_radioBtnContent->Connect( wxEVT_COMMAND_RADIOBUTTON_SELECTED, wxCommandEventHandler( GuiGenerated::OnChangeCompareVariant ), NULL, this ); + m_bpButton14->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( GuiGenerated::OnShowHelpDialog ), NULL, this ); + m_bpButtonFilter->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( GuiGenerated::OnFilterButton ), NULL, this ); + m_hyperlinkCfgFilter->Connect( wxEVT_COMMAND_HYPERLINK, wxHyperlinkEventHandler( GuiGenerated::OnConfigureFilter ), NULL, this ); + m_checkBoxHideFilt->Connect( wxEVT_COMMAND_CHECKBOX_CLICKED, wxCommandEventHandler( GuiGenerated::OnHideFilteredButton ), NULL, this ); + m_bpButtonSync->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( GuiGenerated::OnSync ), NULL, this ); + m_directoryPanel1->Connect( wxEVT_COMMAND_TEXT_UPDATED, wxCommandEventHandler( GuiGenerated::OnEnterLeftDir ), NULL, this ); + m_dirPicker1->Connect( wxEVT_COMMAND_DIRPICKER_CHANGED, wxFileDirPickerEventHandler( GuiGenerated::OnDirChangedPanel1 ), NULL, this ); + m_grid1->Connect( wxEVT_GRID_CELL_LEFT_DCLICK, wxGridEventHandler( GuiGenerated::OnLeftGridDoubleClick ), NULL, this ); + m_grid1->Connect( wxEVT_GRID_LABEL_LEFT_CLICK, wxGridEventHandler( GuiGenerated::OnSortLeftGrid ), NULL, this ); + m_grid1->Connect( wxEVT_GRID_SELECT_CELL, wxGridEventHandler( GuiGenerated::OnGridSelectCell ), NULL, this ); + m_bpButtonSwap->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( GuiGenerated::OnSwapDirs ), NULL, this ); + m_grid3->Connect( wxEVT_GRID_RANGE_SELECT, wxGridRangeSelectEventHandler( GuiGenerated::OnGrid3SelectRange ), NULL, this ); + m_grid3->Connect( wxEVT_GRID_SELECT_CELL, wxGridEventHandler( GuiGenerated::OnGridSelectCell ), NULL, this ); + m_directoryPanel2->Connect( wxEVT_COMMAND_TEXT_UPDATED, wxCommandEventHandler( GuiGenerated::OnEnterRightDir ), NULL, this ); + m_dirPicker2->Connect( wxEVT_COMMAND_DIRPICKER_CHANGED, wxFileDirPickerEventHandler( GuiGenerated::OnDirChangedPanel2 ), NULL, this ); + m_grid2->Connect( wxEVT_GRID_CELL_LEFT_DCLICK, wxGridEventHandler( GuiGenerated::OnRightGridDoubleClick ), NULL, this ); + m_grid2->Connect( wxEVT_GRID_LABEL_LEFT_CLICK, wxGridEventHandler( GuiGenerated::OnSortRightGrid ), NULL, this ); + m_grid2->Connect( wxEVT_GRID_SELECT_CELL, wxGridEventHandler( GuiGenerated::OnGridSelectCell ), NULL, this ); + m_bpButton11->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( GuiGenerated::OnAbout ), NULL, this ); + m_bpButton201->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( GuiGenerated::OnSaveConfig ), NULL, this ); + m_choiceLoad->Connect( wxEVT_CHAR, wxKeyEventHandler( GuiGenerated::OnChoiceKeyEvent ), NULL, this ); + m_choiceLoad->Connect( wxEVT_COMMAND_CHOICE_SELECTED, wxCommandEventHandler( GuiGenerated::OnLoadConfiguration ), NULL, this ); + m_bpButton20->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( GuiGenerated::OnLeftOnlyFiles ), NULL, this ); + m_bpButton21->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( GuiGenerated::OnLeftNewerFiles ), NULL, this ); + m_bpButton25->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( GuiGenerated::OnEqualFiles ), NULL, this ); + m_bpButton22->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( GuiGenerated::OnDifferentFiles ), NULL, this ); + m_bpButton23->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( GuiGenerated::OnRightNewerFiles ), NULL, this ); + m_bpButton24->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( GuiGenerated::OnRightOnlyFiles ), NULL, this ); + m_bpButton10->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( GuiGenerated::OnQuit ), NULL, this ); } -GUI_Generated::~GUI_Generated() +GuiGenerated::~GuiGenerated() { // Disconnect Events - this->Disconnect( wxEVT_CLOSE_WINDOW, wxCloseEventHandler( GUI_Generated::OnClose ) ); - m_bpButtonCompare->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( GUI_Generated::OnCompare ), NULL, this ); - m_buttonAbort->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( GUI_Generated::OnAbortCompare ), NULL, this ); - m_radioBtnSizeDate->Disconnect( wxEVT_COMMAND_RADIOBUTTON_SELECTED, wxCommandEventHandler( GUI_Generated::OnChangeCompareVariant ), NULL, this ); - m_radioBtnContent->Disconnect( wxEVT_COMMAND_RADIOBUTTON_SELECTED, wxCommandEventHandler( GUI_Generated::OnChangeCompareVariant ), NULL, this ); - m_bpButton14->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( GUI_Generated::OnShowHelpDialog ), NULL, this ); - m_bpButtonFilter->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( GUI_Generated::OnFilterButton ), NULL, this ); - m_hyperlinkCfgFilter->Disconnect( wxEVT_COMMAND_HYPERLINK, wxHyperlinkEventHandler( GUI_Generated::OnConfigureFilter ), NULL, this ); - m_checkBoxHideFilt->Disconnect( wxEVT_COMMAND_CHECKBOX_CLICKED, wxCommandEventHandler( GUI_Generated::OnHideFilteredButton ), NULL, this ); - m_bpButtonSync->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( GUI_Generated::OnSync ), NULL, this ); - m_directoryPanel1->Disconnect( wxEVT_COMMAND_TEXT_UPDATED, wxCommandEventHandler( GUI_Generated::OnEnterLeftDir ), NULL, this ); - m_dirPicker1->Disconnect( wxEVT_COMMAND_DIRPICKER_CHANGED, wxFileDirPickerEventHandler( GUI_Generated::OnDirChangedPanel1 ), NULL, this ); - m_grid1->Disconnect( wxEVT_GRID_CELL_LEFT_DCLICK, wxGridEventHandler( GUI_Generated::OnLeftGridDoubleClick ), NULL, this ); - m_grid1->Disconnect( wxEVT_GRID_LABEL_LEFT_CLICK, wxGridEventHandler( GUI_Generated::OnSortLeftGrid ), NULL, this ); - m_bpButtonSwap->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( GUI_Generated::OnSwapDirs ), NULL, this ); - m_grid3->Disconnect( wxEVT_GRID_RANGE_SELECT, wxGridRangeSelectEventHandler( GUI_Generated::OnGrid3SelectRange ), NULL, this ); - m_grid3->Disconnect( wxEVT_GRID_SELECT_CELL, wxGridEventHandler( GUI_Generated::OnGrid3SelectCell ), NULL, this ); - m_directoryPanel2->Disconnect( wxEVT_COMMAND_TEXT_UPDATED, wxCommandEventHandler( GUI_Generated::OnEnterRightDir ), NULL, this ); - m_dirPicker2->Disconnect( wxEVT_COMMAND_DIRPICKER_CHANGED, wxFileDirPickerEventHandler( GUI_Generated::OnDirChangedPanel2 ), NULL, this ); - m_grid2->Disconnect( wxEVT_GRID_CELL_LEFT_DCLICK, wxGridEventHandler( GUI_Generated::OnRightGridDoubleClick ), NULL, this ); - m_grid2->Disconnect( wxEVT_GRID_LABEL_LEFT_CLICK, wxGridEventHandler( GUI_Generated::OnSortRightGrid ), NULL, this ); - m_bpButton11->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( GUI_Generated::OnAbout ), NULL, this ); - m_bpButton20->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( GUI_Generated::OnLeftOnlyFiles ), NULL, this ); - m_bpButton21->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( GUI_Generated::OnLeftNewerFiles ), NULL, this ); - m_bpButton25->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( GUI_Generated::OnEqualFiles ), NULL, this ); - m_bpButton22->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( GUI_Generated::OnDifferentFiles ), NULL, this ); - m_bpButton23->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( GUI_Generated::OnRightNewerFiles ), NULL, this ); - m_bpButton24->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( GUI_Generated::OnRightOnlyFiles ), NULL, this ); - m_bpButton10->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( GUI_Generated::OnQuit ), NULL, this ); + this->Disconnect( wxEVT_CLOSE_WINDOW, wxCloseEventHandler( GuiGenerated::OnClose ) ); + m_bpButtonCompare->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( GuiGenerated::OnCompare ), NULL, this ); + m_buttonAbort->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( GuiGenerated::OnAbortCompare ), NULL, this ); + m_radioBtnSizeDate->Disconnect( wxEVT_COMMAND_RADIOBUTTON_SELECTED, wxCommandEventHandler( GuiGenerated::OnChangeCompareVariant ), NULL, this ); + m_radioBtnContent->Disconnect( wxEVT_COMMAND_RADIOBUTTON_SELECTED, wxCommandEventHandler( GuiGenerated::OnChangeCompareVariant ), NULL, this ); + m_bpButton14->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( GuiGenerated::OnShowHelpDialog ), NULL, this ); + m_bpButtonFilter->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( GuiGenerated::OnFilterButton ), NULL, this ); + m_hyperlinkCfgFilter->Disconnect( wxEVT_COMMAND_HYPERLINK, wxHyperlinkEventHandler( GuiGenerated::OnConfigureFilter ), NULL, this ); + m_checkBoxHideFilt->Disconnect( wxEVT_COMMAND_CHECKBOX_CLICKED, wxCommandEventHandler( GuiGenerated::OnHideFilteredButton ), NULL, this ); + m_bpButtonSync->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( GuiGenerated::OnSync ), NULL, this ); + m_directoryPanel1->Disconnect( wxEVT_COMMAND_TEXT_UPDATED, wxCommandEventHandler( GuiGenerated::OnEnterLeftDir ), NULL, this ); + m_dirPicker1->Disconnect( wxEVT_COMMAND_DIRPICKER_CHANGED, wxFileDirPickerEventHandler( GuiGenerated::OnDirChangedPanel1 ), NULL, this ); + m_grid1->Disconnect( wxEVT_GRID_CELL_LEFT_DCLICK, wxGridEventHandler( GuiGenerated::OnLeftGridDoubleClick ), NULL, this ); + m_grid1->Disconnect( wxEVT_GRID_LABEL_LEFT_CLICK, wxGridEventHandler( GuiGenerated::OnSortLeftGrid ), NULL, this ); + m_grid1->Disconnect( wxEVT_GRID_SELECT_CELL, wxGridEventHandler( GuiGenerated::OnGridSelectCell ), NULL, this ); + m_bpButtonSwap->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( GuiGenerated::OnSwapDirs ), NULL, this ); + m_grid3->Disconnect( wxEVT_GRID_RANGE_SELECT, wxGridRangeSelectEventHandler( GuiGenerated::OnGrid3SelectRange ), NULL, this ); + m_grid3->Disconnect( wxEVT_GRID_SELECT_CELL, wxGridEventHandler( GuiGenerated::OnGridSelectCell ), NULL, this ); + m_directoryPanel2->Disconnect( wxEVT_COMMAND_TEXT_UPDATED, wxCommandEventHandler( GuiGenerated::OnEnterRightDir ), NULL, this ); + m_dirPicker2->Disconnect( wxEVT_COMMAND_DIRPICKER_CHANGED, wxFileDirPickerEventHandler( GuiGenerated::OnDirChangedPanel2 ), NULL, this ); + m_grid2->Disconnect( wxEVT_GRID_CELL_LEFT_DCLICK, wxGridEventHandler( GuiGenerated::OnRightGridDoubleClick ), NULL, this ); + m_grid2->Disconnect( wxEVT_GRID_LABEL_LEFT_CLICK, wxGridEventHandler( GuiGenerated::OnSortRightGrid ), NULL, this ); + m_grid2->Disconnect( wxEVT_GRID_SELECT_CELL, wxGridEventHandler( GuiGenerated::OnGridSelectCell ), NULL, this ); + m_bpButton11->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( GuiGenerated::OnAbout ), NULL, this ); + m_bpButton201->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( GuiGenerated::OnSaveConfig ), NULL, this ); + m_choiceLoad->Disconnect( wxEVT_CHAR, wxKeyEventHandler( GuiGenerated::OnChoiceKeyEvent ), NULL, this ); + m_choiceLoad->Disconnect( wxEVT_COMMAND_CHOICE_SELECTED, wxCommandEventHandler( GuiGenerated::OnLoadConfiguration ), NULL, this ); + m_bpButton20->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( GuiGenerated::OnLeftOnlyFiles ), NULL, this ); + m_bpButton21->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( GuiGenerated::OnLeftNewerFiles ), NULL, this ); + m_bpButton25->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( GuiGenerated::OnEqualFiles ), NULL, this ); + m_bpButton22->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( GuiGenerated::OnDifferentFiles ), NULL, this ); + m_bpButton23->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( GuiGenerated::OnRightNewerFiles ), NULL, this ); + m_bpButton24->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( GuiGenerated::OnRightOnlyFiles ), NULL, this ); + m_bpButton10->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( GuiGenerated::OnQuit ), NULL, this ); } SyncDialogGenerated::SyncDialogGenerated( wxWindow* parent, wxWindowID id, const wxString& title, const wxPoint& pos, const wxSize& size, long style ) : wxDialog( parent, id, title, pos, size, style ) @@ -438,7 +473,8 @@ SyncDialogGenerated::SyncDialogGenerated( wxWindow* parent, wxWindowID id, const wxBoxSizer* bSizer201; bSizer201 = new wxBoxSizer( wxHORIZONTAL ); - m_bpButton18 = new wxBitmapButton( this, wxID_ANY, wxNullBitmap, wxDefaultPosition, wxSize( 140,58 ), wxBU_AUTODRAW ); + m_bpButton18 = new wxBitmapButton( this, wxID_OK, wxNullBitmap, wxDefaultPosition, wxSize( 140,58 ), wxBU_AUTODRAW ); + m_bpButton18->SetDefault(); m_bpButton18->SetToolTip( _("Start synchronizing files") ); m_bpButton18->SetToolTip( _("Start synchronizing files") ); @@ -542,10 +578,13 @@ SyncDialogGenerated::SyncDialogGenerated( wxWindow* parent, wxWindowID id, const wxBoxSizer* bSizer291; bSizer291 = new wxBoxSizer( wxHORIZONTAL ); - m_button6 = new wxButton( this, wxID_ANY, _("Back"), wxDefaultPosition, wxSize( 100,32 ), 0 ); + m_button6 = new wxButton( this, wxID_ANY, _("&Back"), wxDefaultPosition, wxSize( 100,32 ), 0 ); m_button6->SetFont( wxFont( 10, 74, 90, 90, false, wxT("Tahoma") ) ); - bSizer291->Add( m_button6, 0, wxBOTTOM|wxLEFT|wxALIGN_CENTER_VERTICAL, 5 ); + bSizer291->Add( m_button6, 0, wxALIGN_CENTER_VERTICAL|wxBOTTOM|wxLEFT, 5 ); + + m_button16 = new wxButton( this, wxID_CANCEL, _("dummyButton"), wxDefaultPosition, wxSize( 0,-1 ), 0 ); + bSizer291->Add( m_button16, 0, wxALL, 5 ); bSizer291->Add( 82, 0, 0, wxEXPAND|wxALIGN_CENTER_VERTICAL, 5 ); @@ -686,6 +725,7 @@ SyncDialogGenerated::SyncDialogGenerated( wxWindow* parent, wxWindowID id, const m_buttonTwoWay->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( SyncDialogGenerated::OnSyncBothSides ), NULL, this ); m_radioBtn3->Connect( wxEVT_COMMAND_RADIOBUTTON_SELECTED, wxCommandEventHandler( SyncDialogGenerated::OnSyncCostum ), NULL, this ); m_button6->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( SyncDialogGenerated::OnBack ), NULL, this ); + m_button16->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( SyncDialogGenerated::OnCancel ), NULL, this ); m_checkBoxUseRecycler->Connect( wxEVT_COMMAND_CHECKBOX_CLICKED, wxCommandEventHandler( SyncDialogGenerated::OnSelectRecycleBin ), NULL, this ); m_bpButton5->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( SyncDialogGenerated::OnExLeftSideOnly ), NULL, this ); m_bpButton6->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( SyncDialogGenerated::OnExRightSideOnly ), NULL, this ); @@ -705,6 +745,7 @@ SyncDialogGenerated::~SyncDialogGenerated() m_buttonTwoWay->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( SyncDialogGenerated::OnSyncBothSides ), NULL, this ); m_radioBtn3->Disconnect( wxEVT_COMMAND_RADIOBUTTON_SELECTED, wxCommandEventHandler( SyncDialogGenerated::OnSyncCostum ), NULL, this ); m_button6->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( SyncDialogGenerated::OnBack ), NULL, this ); + m_button16->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( SyncDialogGenerated::OnCancel ), NULL, this ); m_checkBoxUseRecycler->Disconnect( wxEVT_COMMAND_CHECKBOX_CLICKED, wxCommandEventHandler( SyncDialogGenerated::OnSelectRecycleBin ), NULL, this ); m_bpButton5->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( SyncDialogGenerated::OnExLeftSideOnly ), NULL, this ); m_bpButton6->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( SyncDialogGenerated::OnExRightSideOnly ), NULL, this ); @@ -737,7 +778,8 @@ HelpDlgGenerated::HelpDlgGenerated( wxWindow* parent, wxWindowID id, const wxStr bSizer20->Add( m_textCtrl8, 1, wxALL|wxALIGN_CENTER_HORIZONTAL|wxEXPAND, 5 ); - m_button8 = new wxButton( this, wxID_ANY, _("OK"), wxDefaultPosition, wxSize( 100,32 ), 0 ); + m_button8 = new wxButton( this, wxID_OK, _("OK"), wxDefaultPosition, wxSize( 100,32 ), 0 ); + m_button8->SetDefault(); m_button8->SetFont( wxFont( 10, 74, 90, 90, false, wxT("Tahoma") ) ); bSizer20->Add( m_button8, 0, wxALL|wxALIGN_CENTER_HORIZONTAL, 5 ); @@ -767,7 +809,7 @@ AboutDlgGenerated::AboutDlgGenerated( wxWindow* parent, wxWindowID id, const wxS bSizer31->Add( 0, 10, 0, wxEXPAND, 5 ); - m_staticText14 = new wxStaticText( this, wxID_ANY, _("FreeFileSync v1.2"), wxDefaultPosition, wxDefaultSize, 0 ); + m_staticText14 = new wxStaticText( this, wxID_ANY, _("FreeFileSync v1.3"), wxDefaultPosition, wxDefaultSize, 0 ); m_staticText14->Wrap( -1 ); m_staticText14->SetFont( wxFont( 16, 74, 90, 92, false, wxT("Tahoma") ) ); @@ -850,7 +892,8 @@ AboutDlgGenerated::AboutDlgGenerated( wxWindow* parent, wxWindowID id, const wxS bSizer31->Add( fgSizer2, 0, wxEXPAND|wxLEFT, 10 ); - m_button8 = new wxButton( this, wxID_ANY, _("OK"), wxDefaultPosition, wxSize( 100,32 ), 0 ); + m_button8 = new wxButton( this, wxID_OK, _("OK"), wxDefaultPosition, wxSize( 100,32 ), 0 ); + m_button8->SetDefault(); m_button8->SetFont( wxFont( 10, 74, 90, 90, false, wxT("Tahoma") ) ); bSizer31->Add( m_button8, 0, wxALIGN_CENTER_HORIZONTAL|wxBOTTOM|wxRIGHT|wxLEFT, 5 ); @@ -870,6 +913,133 @@ AboutDlgGenerated::~AboutDlgGenerated() m_button8->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( AboutDlgGenerated::OnOK ), NULL, this ); } +ErrorDlgGenerated::ErrorDlgGenerated( wxWindow* parent, wxWindowID id, const wxString& title, const wxPoint& pos, const wxSize& size, long style ) : wxDialog( parent, id, title, pos, size, style ) +{ + this->SetSizeHints( wxDefaultSize, wxDefaultSize ); + + wxBoxSizer* bSizer24; + bSizer24 = new wxBoxSizer( wxVERTICAL ); + + + bSizer24->Add( 0, 10, 0, wxEXPAND, 5 ); + + wxBoxSizer* bSizer26; + bSizer26 = new wxBoxSizer( wxHORIZONTAL ); + + m_bitmap10 = new wxStaticBitmap( this, wxID_ANY, wxNullBitmap, wxDefaultPosition, wxSize( 48,48 ), 0 ); + bSizer26->Add( m_bitmap10, 0, wxALL|wxALIGN_CENTER_VERTICAL, 5 ); + + m_textCtrl8 = new wxTextCtrl( this, wxID_ANY, wxEmptyString, wxDefaultPosition, wxSize( -1,-1 ), wxTE_MULTILINE|wxTE_READONLY ); + m_textCtrl8->SetBackgroundColour( wxSystemSettings::GetColour( wxSYS_COLOUR_ACTIVEBORDER ) ); + + bSizer26->Add( m_textCtrl8, 1, wxALIGN_CENTER_VERTICAL|wxEXPAND|wxBOTTOM|wxRIGHT|wxLEFT, 5 ); + + bSizer24->Add( bSizer26, 1, wxALIGN_CENTER_HORIZONTAL|wxEXPAND, 5 ); + + + bSizer24->Add( 0, 10, 0, wxEXPAND, 5 ); + + m_checkBoxSuppress = new wxCheckBox( this, wxID_ANY, _("Hide further messages during current process"), wxDefaultPosition, wxDefaultSize, 0 ); + + bSizer24->Add( m_checkBoxSuppress, 0, wxALL|wxALIGN_CENTER_HORIZONTAL, 5 ); + + + bSizer24->Add( 0, 10, 0, wxEXPAND, 5 ); + + wxBoxSizer* bSizer25; + bSizer25 = new wxBoxSizer( wxHORIZONTAL ); + + m_buttonContinue = new wxButton( this, wxID_OK, _("&Continue"), wxDefaultPosition, wxSize( 80,30 ), 0 ); + m_buttonContinue->SetDefault(); + m_buttonContinue->SetFont( wxFont( 10, 74, 90, 90, false, wxT("Tahoma") ) ); + + bSizer25->Add( m_buttonContinue, 0, wxTOP|wxBOTTOM|wxLEFT, 5 ); + + m_buttonRetry = new wxButton( this, wxID_ANY, _("&Retry"), wxDefaultPosition, wxSize( 80,30 ), 0 ); + m_buttonRetry->SetFont( wxFont( 10, 74, 90, 90, false, wxT("Tahoma") ) ); + + bSizer25->Add( m_buttonRetry, 0, wxTOP|wxBOTTOM|wxLEFT, 5 ); + + m_buttonAbort = new wxButton( this, wxID_CANCEL, _("&Abort"), wxDefaultPosition, wxSize( 80,30 ), 0 ); + m_buttonAbort->SetFont( wxFont( 10, 74, 90, 90, false, wxT("Tahoma") ) ); + + bSizer25->Add( m_buttonAbort, 0, wxALL, 5 ); + + bSizer24->Add( bSizer25, 0, wxALIGN_CENTER_HORIZONTAL, 5 ); + + this->SetSizer( bSizer24 ); + this->Layout(); + + // Connect Events + this->Connect( wxEVT_CLOSE_WINDOW, wxCloseEventHandler( ErrorDlgGenerated::OnClose ) ); + m_buttonContinue->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( ErrorDlgGenerated::OnContinue ), NULL, this ); + m_buttonRetry->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( ErrorDlgGenerated::OnRetry ), NULL, this ); + m_buttonAbort->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( ErrorDlgGenerated::OnAbort ), NULL, this ); +} + +ErrorDlgGenerated::~ErrorDlgGenerated() +{ + // Disconnect Events + this->Disconnect( wxEVT_CLOSE_WINDOW, wxCloseEventHandler( ErrorDlgGenerated::OnClose ) ); + m_buttonContinue->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( ErrorDlgGenerated::OnContinue ), NULL, this ); + m_buttonRetry->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( ErrorDlgGenerated::OnRetry ), NULL, this ); + m_buttonAbort->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( ErrorDlgGenerated::OnAbort ), NULL, this ); +} + +DeleteDialogGenerated::DeleteDialogGenerated( wxWindow* parent, wxWindowID id, const wxString& title, const wxPoint& pos, const wxSize& size, long style ) : wxDialog( parent, id, title, pos, size, style ) +{ + this->SetSizeHints( wxDefaultSize, wxDefaultSize ); + + wxBoxSizer* bSizer24; + bSizer24 = new wxBoxSizer( wxVERTICAL ); + + + bSizer24->Add( 0, 10, 0, wxEXPAND, 5 ); + + m_staticTextHeader = new wxStaticText( this, wxID_ANY, _("Dummy text"), wxDefaultPosition, wxDefaultSize, 0 ); + m_staticTextHeader->Wrap( -1 ); + m_staticTextHeader->SetFont( wxFont( 10, 74, 90, 90, false, wxT("Tahoma") ) ); + + bSizer24->Add( m_staticTextHeader, 0, wxALL|wxALIGN_CENTER_HORIZONTAL, 5 ); + + m_textCtrlMessage = new wxTextCtrl( this, wxID_ANY, wxEmptyString, wxDefaultPosition, wxSize( -1,-1 ), wxTE_MULTILINE|wxTE_READONLY ); + m_textCtrlMessage->SetBackgroundColour( wxSystemSettings::GetColour( wxSYS_COLOUR_ACTIVEBORDER ) ); + + bSizer24->Add( m_textCtrlMessage, 1, wxALL|wxALIGN_CENTER_VERTICAL|wxEXPAND, 5 ); + + wxBoxSizer* bSizer25; + bSizer25 = new wxBoxSizer( wxHORIZONTAL ); + + m_buttonOK = new wxButton( this, wxID_OK, _("OK"), wxDefaultPosition, wxSize( 80,30 ), 0 ); + m_buttonOK->SetDefault(); + m_buttonOK->SetFont( wxFont( 10, 74, 90, 90, false, wxT("Tahoma") ) ); + + bSizer25->Add( m_buttonOK, 0, wxTOP|wxBOTTOM|wxLEFT, 5 ); + + m_buttonCancel = new wxButton( this, wxID_CANCEL, _("Cancel"), wxDefaultPosition, wxSize( 80,30 ), 0 ); + m_buttonCancel->SetFont( wxFont( 10, 74, 90, 90, false, wxT("Tahoma") ) ); + + bSizer25->Add( m_buttonCancel, 0, wxALL, 5 ); + + bSizer24->Add( bSizer25, 0, wxALIGN_CENTER_HORIZONTAL, 5 ); + + this->SetSizer( bSizer24 ); + this->Layout(); + + // Connect Events + this->Connect( wxEVT_CLOSE_WINDOW, wxCloseEventHandler( DeleteDialogGenerated::OnClose ) ); + m_buttonOK->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DeleteDialogGenerated::OnOK ), NULL, this ); + m_buttonCancel->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DeleteDialogGenerated::OnCancel ), NULL, this ); +} + +DeleteDialogGenerated::~DeleteDialogGenerated() +{ + // Disconnect Events + this->Disconnect( wxEVT_CLOSE_WINDOW, wxCloseEventHandler( DeleteDialogGenerated::OnClose ) ); + m_buttonOK->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DeleteDialogGenerated::OnOK ), NULL, this ); + m_buttonCancel->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DeleteDialogGenerated::OnCancel ), NULL, this ); +} + FilterDlgGenerated::FilterDlgGenerated( wxWindow* parent, wxWindowID id, const wxString& title, const wxPoint& pos, const wxSize& size, long style ) : wxDialog( parent, id, title, pos, size, style ) { this->SetSizeHints( wxDefaultSize, wxDefaultSize ); @@ -945,7 +1115,7 @@ FilterDlgGenerated::FilterDlgGenerated( wxWindow* parent, wxWindowID id, const w wxBoxSizer* bSizer22; bSizer22 = new wxBoxSizer( wxHORIZONTAL ); - m_button9 = new wxButton( this, wxID_ANY, _("Default"), wxDefaultPosition, wxSize( 80,30 ), 0 ); + m_button9 = new wxButton( this, wxID_ANY, _("&Default"), wxDefaultPosition, wxSize( 80,30 ), 0 ); m_button9->SetFont( wxFont( 10, 74, 90, 90, false, wxT("Tahoma") ) ); bSizer22->Add( m_button9, 0, wxALL, 5 ); @@ -953,7 +1123,10 @@ FilterDlgGenerated::FilterDlgGenerated( wxWindow* parent, wxWindowID id, const w bSizer22->Add( 0, 0, 1, wxEXPAND, 5 ); - m_button10 = new wxButton( this, wxID_ANY, _("OK"), wxDefaultPosition, wxSize( 80,30 ), 0 ); + m_button17 = new wxButton( this, wxID_CANCEL, _("dummyButton"), wxDefaultPosition, wxSize( 0,-1 ), 0 ); + bSizer22->Add( m_button17, 0, wxALL, 5 ); + + m_button10 = new wxButton( this, wxID_OK, _("OK"), wxDefaultPosition, wxSize( 80,30 ), 0 ); m_button10->SetDefault(); m_button10->SetFont( wxFont( 10, 74, 90, 90, false, wxT("Tahoma") ) ); @@ -967,6 +1140,7 @@ FilterDlgGenerated::FilterDlgGenerated( wxWindow* parent, wxWindowID id, const w // Connect Events this->Connect( wxEVT_CLOSE_WINDOW, wxCloseEventHandler( FilterDlgGenerated::OnClose ) ); m_button9->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( FilterDlgGenerated::OnDefault ), NULL, this ); + m_button17->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( FilterDlgGenerated::OnCancel ), NULL, this ); m_button10->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( FilterDlgGenerated::OnOK ), NULL, this ); } @@ -975,81 +1149,10 @@ FilterDlgGenerated::~FilterDlgGenerated() // Disconnect Events this->Disconnect( wxEVT_CLOSE_WINDOW, wxCloseEventHandler( FilterDlgGenerated::OnClose ) ); m_button9->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( FilterDlgGenerated::OnDefault ), NULL, this ); + m_button17->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( FilterDlgGenerated::OnCancel ), NULL, this ); m_button10->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( FilterDlgGenerated::OnOK ), NULL, this ); } -ErrorDlgGenerated::ErrorDlgGenerated( wxWindow* parent, wxWindowID id, const wxString& title, const wxPoint& pos, const wxSize& size, long style ) : wxDialog( parent, id, title, pos, size, style ) -{ - this->SetSizeHints( wxDefaultSize, wxDefaultSize ); - - wxBoxSizer* bSizer24; - bSizer24 = new wxBoxSizer( wxVERTICAL ); - - - bSizer24->Add( 0, 0, 1, wxEXPAND, 5 ); - - wxBoxSizer* bSizer26; - bSizer26 = new wxBoxSizer( wxHORIZONTAL ); - - m_bitmap10 = new wxStaticBitmap( this, wxID_ANY, wxNullBitmap, wxDefaultPosition, wxSize( 48,48 ), 0 ); - bSizer26->Add( m_bitmap10, 0, wxALL|wxALIGN_CENTER_VERTICAL, 5 ); - - m_textCtrl8 = new wxTextCtrl( this, wxID_ANY, wxEmptyString, wxDefaultPosition, wxSize( 320,140 ), wxTE_MULTILINE|wxTE_READONLY ); - m_textCtrl8->SetBackgroundColour( wxSystemSettings::GetColour( wxSYS_COLOUR_ACTIVEBORDER ) ); - - bSizer26->Add( m_textCtrl8, 1, wxALL|wxALIGN_CENTER_VERTICAL|wxEXPAND, 5 ); - - bSizer24->Add( bSizer26, 0, wxALIGN_CENTER_HORIZONTAL, 5 ); - - - bSizer24->Add( 0, 0, 1, wxEXPAND, 5 ); - - m_checkBoxSuppress = new wxCheckBox( this, wxID_ANY, _("Hide further messages during current process"), wxDefaultPosition, wxDefaultSize, 0 ); - - bSizer24->Add( m_checkBoxSuppress, 0, wxALL|wxALIGN_CENTER_HORIZONTAL, 5 ); - - - bSizer24->Add( 0, 10, 0, wxEXPAND, 5 ); - - wxBoxSizer* bSizer25; - bSizer25 = new wxBoxSizer( wxHORIZONTAL ); - - m_buttonContinue = new wxButton( this, wxID_ANY, _("Continue"), wxDefaultPosition, wxSize( 80,30 ), 0 ); - m_buttonContinue->SetFont( wxFont( 10, 74, 90, 90, false, wxT("Tahoma") ) ); - - bSizer25->Add( m_buttonContinue, 0, wxTOP|wxBOTTOM|wxLEFT, 5 ); - - m_buttonRetry = new wxButton( this, wxID_ANY, _("Retry"), wxDefaultPosition, wxSize( 80,30 ), 0 ); - m_buttonRetry->SetFont( wxFont( 10, 74, 90, 90, false, wxT("Tahoma") ) ); - - bSizer25->Add( m_buttonRetry, 0, wxTOP|wxBOTTOM|wxLEFT, 5 ); - - m_buttonAbort = new wxButton( this, wxID_ANY, _("Abort"), wxDefaultPosition, wxSize( 80,30 ), 0 ); - m_buttonAbort->SetFont( wxFont( 10, 74, 90, 90, false, wxT("Tahoma") ) ); - - bSizer25->Add( m_buttonAbort, 0, wxALL, 5 ); - - bSizer24->Add( bSizer25, 0, wxALIGN_CENTER_HORIZONTAL, 5 ); - - this->SetSizer( bSizer24 ); - this->Layout(); - - // Connect Events - this->Connect( wxEVT_CLOSE_WINDOW, wxCloseEventHandler( ErrorDlgGenerated::OnClose ) ); - m_buttonContinue->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( ErrorDlgGenerated::OnContinue ), NULL, this ); - m_buttonRetry->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( ErrorDlgGenerated::OnRetry ), NULL, this ); - m_buttonAbort->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( ErrorDlgGenerated::OnAbort ), NULL, this ); -} - -ErrorDlgGenerated::~ErrorDlgGenerated() -{ - // Disconnect Events - this->Disconnect( wxEVT_CLOSE_WINDOW, wxCloseEventHandler( ErrorDlgGenerated::OnClose ) ); - m_buttonContinue->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( ErrorDlgGenerated::OnContinue ), NULL, this ); - m_buttonRetry->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( ErrorDlgGenerated::OnRetry ), NULL, this ); - m_buttonAbort->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( ErrorDlgGenerated::OnAbort ), NULL, this ); -} - SyncStatusGenerated::SyncStatusGenerated( wxWindow* parent, wxWindowID id, const wxString& title, const wxPoint& pos, const wxSize& size, long style ) : wxDialog( parent, id, title, pos, size, style ) { this->SetSizeHints( wxDefaultSize, wxDefaultSize ); @@ -1118,36 +1221,25 @@ SyncStatusGenerated::SyncStatusGenerated( wxWindow* parent, wxWindowID id, const bSizer32->Add( m_staticText26, 0, wxALIGN_CENTER_VERTICAL|wxTOP|wxBOTTOM|wxLEFT, 5 ); - m_staticTextBytesCurrent = new wxStaticText( this, wxID_ANY, _("10,0 MB"), wxDefaultPosition, wxDefaultSize, 0 ); - m_staticTextBytesCurrent->Wrap( -1 ); - m_staticTextBytesCurrent->SetFont( wxFont( 10, 74, 90, 92, false, wxT("Tahoma") ) ); - - bSizer32->Add( m_staticTextBytesCurrent, 0, wxALIGN_CENTER_VERTICAL|wxTOP|wxBOTTOM|wxLEFT, 5 ); - - m_staticText30 = new wxStaticText( this, wxID_ANY, _("/"), wxDefaultPosition, wxDefaultSize, 0 ); - m_staticText30->Wrap( -1 ); - m_staticText30->SetFont( wxFont( 10, 74, 90, 90, false, wxT("Tahoma") ) ); - - bSizer32->Add( m_staticText30, 0, wxALIGN_CENTER_VERTICAL, 5 ); - - m_staticTextBytesTotal = new wxStaticText( this, wxID_ANY, _("10,0 MB"), wxDefaultPosition, wxDefaultSize, 0 ); - m_staticTextBytesTotal->Wrap( -1 ); - m_staticTextBytesTotal->SetFont( wxFont( 10, 74, 90, 92, false, wxT("Tahoma") ) ); + m_staticTextBytesCopied = new wxStaticText( this, wxID_ANY, _("--,- MB"), wxDefaultPosition, wxDefaultSize, 0 ); + m_staticTextBytesCopied->Wrap( -1 ); + m_staticTextBytesCopied->SetFont( wxFont( 10, 74, 90, 92, false, wxT("Tahoma") ) ); - bSizer32->Add( m_staticTextBytesTotal, 0, wxALIGN_CENTER_VERTICAL|wxTOP|wxBOTTOM|wxRIGHT, 5 ); + bSizer32->Add( m_staticTextBytesCopied, 0, wxALIGN_CENTER_VERTICAL|wxTOP|wxBOTTOM|wxLEFT, 5 ); bSizer28->Add( bSizer32, 1, wxALIGN_CENTER_VERTICAL, 5 ); bSizer28->Add( 0, 0, 1, wxEXPAND, 5 ); - m_buttonOK = new wxButton( this, wxID_ANY, _("OK"), wxDefaultPosition, wxSize( 100,32 ), 0 ); + m_buttonOK = new wxButton( this, wxID_OK, _("OK"), wxDefaultPosition, wxSize( 100,32 ), 0 ); m_buttonOK->SetFont( wxFont( 10, 74, 90, 90, false, wxT("Tahoma") ) ); m_buttonOK->Hide(); bSizer28->Add( m_buttonOK, 0, wxALL|wxALIGN_CENTER_VERTICAL, 5 ); - m_buttonAbort = new wxButton( this, wxID_ANY, _("Abort"), wxDefaultPosition, wxSize( 100,32 ), 0 ); + m_buttonAbort = new wxButton( this, wxID_CANCEL, _("Abort"), wxDefaultPosition, wxSize( 100,32 ), 0 ); + m_buttonAbort->SetDefault(); m_buttonAbort->SetFont( wxFont( 10, 74, 90, 90, false, wxT("Tahoma") ) ); bSizer28->Add( m_buttonAbort, 0, wxALL|wxALIGN_CENTER_VERTICAL, 5 ); diff --git a/ui/GUI_Generated.h b/ui/guiGenerated.h index f7ef37a7..fe685d9c 100644 --- a/ui/GUI_Generated.h +++ b/ui/guiGenerated.h @@ -5,8 +5,8 @@ // PLEASE DO "NOT" EDIT THIS FILE! /////////////////////////////////////////////////////////////////////////// -#ifndef __GUI_Generated__ -#define __GUI_Generated__ +#ifndef __guiGenerated__ +#define __guiGenerated__ #include <wx/intl.h> @@ -31,6 +31,7 @@ class CustomGrid; #include <wx/filepicker.h> #include <wx/grid.h> #include <wx/panel.h> +#include <wx/choice.h> #include <wx/statusbr.h> #include <wx/frame.h> #include <wx/stattext.h> @@ -44,9 +45,9 @@ class CustomGrid; /////////////////////////////////////////////////////////////////////////////// -/// Class GUI_Generated +/// Class GuiGenerated /////////////////////////////////////////////////////////////////////////////// -class GUI_Generated : public wxFrame +class GuiGenerated : public wxFrame { private: @@ -78,6 +79,9 @@ class GUI_Generated : public wxFrame wxPanel* m_panel4; wxBitmapButton* m_bpButton11; + wxBitmapButton* m_bpButton201; + wxChoice* m_choiceLoad; + wxBitmapButton* m_bpButton20; wxBitmapButton* m_bpButton21; wxBitmapButton* m_bpButton25; @@ -85,6 +89,8 @@ class GUI_Generated : public wxFrame wxBitmapButton* m_bpButton23; wxBitmapButton* m_bpButton24; + + wxBitmapButton* m_bpButton10; wxStatusBar* m_statusBar1; @@ -102,14 +108,17 @@ class GUI_Generated : public wxFrame virtual void OnDirChangedPanel1( wxFileDirPickerEvent& event ){ event.Skip(); } virtual void OnLeftGridDoubleClick( wxGridEvent& event ){ event.Skip(); } virtual void OnSortLeftGrid( wxGridEvent& event ){ event.Skip(); } + virtual void OnGridSelectCell( wxGridEvent& event ){ event.Skip(); } virtual void OnSwapDirs( wxCommandEvent& event ){ event.Skip(); } virtual void OnGrid3SelectRange( wxGridRangeSelectEvent& event ){ event.Skip(); } - virtual void OnGrid3SelectCell( wxGridEvent& event ){ event.Skip(); } virtual void OnEnterRightDir( wxCommandEvent& event ){ event.Skip(); } virtual void OnDirChangedPanel2( wxFileDirPickerEvent& event ){ event.Skip(); } virtual void OnRightGridDoubleClick( wxGridEvent& event ){ event.Skip(); } virtual void OnSortRightGrid( wxGridEvent& event ){ event.Skip(); } virtual void OnAbout( wxCommandEvent& event ){ event.Skip(); } + virtual void OnSaveConfig( wxCommandEvent& event ){ event.Skip(); } + virtual void OnChoiceKeyEvent( wxKeyEvent& event ){ event.Skip(); } + virtual void OnLoadConfiguration( wxCommandEvent& event ){ event.Skip(); } virtual void OnLeftOnlyFiles( wxCommandEvent& event ){ event.Skip(); } virtual void OnLeftNewerFiles( wxCommandEvent& event ){ event.Skip(); } virtual void OnEqualFiles( wxCommandEvent& event ){ event.Skip(); } @@ -120,8 +129,8 @@ class GUI_Generated : public wxFrame public: - GUI_Generated( wxWindow* parent, wxWindowID id = wxID_ANY, const wxString& title = _("FreeFileSync - Folder Synchronization"), const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxSize( 930,603 ), long style = wxDEFAULT_FRAME_STYLE|wxTAB_TRAVERSAL ); - ~GUI_Generated(); + GuiGenerated( wxWindow* parent, wxWindowID id = wxID_ANY, const wxString& title = _("FreeFileSync - Folder Synchronization"), const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxSize( 930,603 ), long style = wxDEFAULT_FRAME_STYLE|wxTAB_TRAVERSAL ); + ~GuiGenerated(); }; @@ -152,6 +161,7 @@ class SyncDialogGenerated : public wxDialog wxButton* m_button6; + wxButton* m_button16; wxCheckBox* m_checkBoxUseRecycler; @@ -184,6 +194,7 @@ class SyncDialogGenerated : public wxDialog virtual void OnSyncBothSides( wxCommandEvent& event ){ event.Skip(); } virtual void OnSyncCostum( wxCommandEvent& event ){ event.Skip(); } virtual void OnBack( wxCommandEvent& event ){ event.Skip(); } + virtual void OnCancel( wxCommandEvent& event ){ event.Skip(); } virtual void OnSelectRecycleBin( wxCommandEvent& event ){ event.Skip(); } virtual void OnExLeftSideOnly( wxCommandEvent& event ){ event.Skip(); } virtual void OnExRightSideOnly( wxCommandEvent& event ){ event.Skip(); } @@ -256,75 +267,103 @@ class AboutDlgGenerated : public wxDialog public: - AboutDlgGenerated( wxWindow* parent, wxWindowID id = wxID_ANY, const wxString& title = _("About"), const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxSize( 438,495 ), long style = wxDEFAULT_DIALOG_STYLE ); + AboutDlgGenerated( wxWindow* parent, wxWindowID id = wxID_ANY, const wxString& title = _("About"), const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxSize( 439,510 ), long style = wxDEFAULT_DIALOG_STYLE ); ~AboutDlgGenerated(); }; /////////////////////////////////////////////////////////////////////////////// -/// Class FilterDlgGenerated +/// Class ErrorDlgGenerated /////////////////////////////////////////////////////////////////////////////// -class FilterDlgGenerated : public wxDialog +class ErrorDlgGenerated : public wxDialog { private: protected: - wxStaticText* m_staticText17; - wxStaticText* m_staticText18; + wxStaticBitmap* m_bitmap10; + wxTextCtrl* m_textCtrl8; - wxStaticText* m_staticText15; - wxStaticBitmap* m_bitmap8; - wxTextCtrl* m_textCtrlInclude; + wxCheckBox* m_checkBoxSuppress; - wxStaticText* m_staticText16; - wxStaticBitmap* m_bitmap9; - wxTextCtrl* m_textCtrlExclude; + wxButton* m_buttonContinue; + wxButton* m_buttonRetry; + wxButton* m_buttonAbort; - wxButton* m_button9; + // Virtual event handlers, overide them in your derived class + virtual void OnClose( wxCloseEvent& event ){ event.Skip(); } + virtual void OnContinue( wxCommandEvent& event ){ event.Skip(); } + virtual void OnRetry( wxCommandEvent& event ){ event.Skip(); } + virtual void OnAbort( wxCommandEvent& event ){ event.Skip(); } - wxButton* m_button10; + + public: + ErrorDlgGenerated( wxWindow* parent, wxWindowID id = wxID_ANY, const wxString& title = _("An error occured"), const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxSize( 411,266 ), long style = wxDEFAULT_DIALOG_STYLE|wxRESIZE_BORDER ); + ~ErrorDlgGenerated(); + +}; + +/////////////////////////////////////////////////////////////////////////////// +/// Class DeleteDialogGenerated +/////////////////////////////////////////////////////////////////////////////// +class DeleteDialogGenerated : public wxDialog +{ + private: + + protected: + + wxStaticText* m_staticTextHeader; + wxTextCtrl* m_textCtrlMessage; + wxButton* m_buttonOK; + wxButton* m_buttonCancel; // Virtual event handlers, overide them in your derived class virtual void OnClose( wxCloseEvent& event ){ event.Skip(); } - virtual void OnDefault( wxCommandEvent& event ){ event.Skip(); } virtual void OnOK( wxCommandEvent& event ){ event.Skip(); } + virtual void OnCancel( wxCommandEvent& event ){ event.Skip(); } public: - FilterDlgGenerated( wxWindow* parent, wxWindowID id = wxID_ANY, const wxString& title = _("Configure filter settings"), const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxSize( 484,350 ), long style = wxDEFAULT_DIALOG_STYLE ); - ~FilterDlgGenerated(); + DeleteDialogGenerated( wxWindow* parent, wxWindowID id = wxID_ANY, const wxString& title = _("Confirm"), const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxSize( 553,336 ), long style = wxDEFAULT_DIALOG_STYLE|wxRESIZE_BORDER ); + ~DeleteDialogGenerated(); }; /////////////////////////////////////////////////////////////////////////////// -/// Class ErrorDlgGenerated +/// Class FilterDlgGenerated /////////////////////////////////////////////////////////////////////////////// -class ErrorDlgGenerated : public wxDialog +class FilterDlgGenerated : public wxDialog { private: protected: + wxStaticText* m_staticText17; - wxStaticBitmap* m_bitmap10; - wxTextCtrl* m_textCtrl8; + wxStaticText* m_staticText18; - wxCheckBox* m_checkBoxSuppress; + wxStaticText* m_staticText15; + wxStaticBitmap* m_bitmap8; + wxTextCtrl* m_textCtrlInclude; - wxButton* m_buttonContinue; - wxButton* m_buttonRetry; - wxButton* m_buttonAbort; + wxStaticText* m_staticText16; + wxStaticBitmap* m_bitmap9; + wxTextCtrl* m_textCtrlExclude; + + wxButton* m_button9; + + wxButton* m_button17; + wxButton* m_button10; // Virtual event handlers, overide them in your derived class virtual void OnClose( wxCloseEvent& event ){ event.Skip(); } - virtual void OnContinue( wxCommandEvent& event ){ event.Skip(); } - virtual void OnRetry( wxCommandEvent& event ){ event.Skip(); } - virtual void OnAbort( wxCommandEvent& event ){ event.Skip(); } + virtual void OnDefault( wxCommandEvent& event ){ event.Skip(); } + virtual void OnCancel( wxCommandEvent& event ){ event.Skip(); } + virtual void OnOK( wxCommandEvent& event ){ event.Skip(); } public: - ErrorDlgGenerated( wxWindow* parent, wxWindowID id = wxID_ANY, const wxString& title = _("An error occured"), const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxSize( 411,266 ), long style = wxDEFAULT_DIALOG_STYLE ); - ~ErrorDlgGenerated(); + FilterDlgGenerated( wxWindow* parent, wxWindowID id = wxID_ANY, const wxString& title = _("Configure filter settings"), const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxSize( 484,350 ), long style = wxDEFAULT_DIALOG_STYLE ); + ~FilterDlgGenerated(); }; @@ -343,9 +382,7 @@ class SyncStatusGenerated : public wxDialog wxStaticText* m_staticText25; wxStaticText* m_staticTextProcessedObj; wxStaticText* m_staticText26; - wxStaticText* m_staticTextBytesCurrent; - wxStaticText* m_staticText30; - wxStaticText* m_staticTextBytesTotal; + wxStaticText* m_staticTextBytesCopied; wxStaticText* m_staticText32; @@ -363,9 +400,9 @@ class SyncStatusGenerated : public wxDialog wxGauge* m_gauge1; wxButton* m_buttonOK; wxButton* m_buttonAbort; - SyncStatusGenerated( wxWindow* parent, wxWindowID id = wxID_ANY, const wxString& title = wxEmptyString, const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxSize( 614,371 ), long style = wxDEFAULT_DIALOG_STYLE ); + SyncStatusGenerated( wxWindow* parent, wxWindowID id = wxID_ANY, const wxString& title = wxEmptyString, const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxSize( 614,371 ), long style = wxDEFAULT_DIALOG_STYLE|wxRESIZE_BORDER ); ~SyncStatusGenerated(); }; -#endif //__GUI_Generated__ +#endif //__guiGenerated__ |