diff options
author | Daniel Wilhelm <daniel@wili.li> | 2014-04-18 16:54:32 +0200 |
---|---|---|
committer | Daniel Wilhelm <daniel@wili.li> | 2014-04-18 16:54:32 +0200 |
commit | cbb59ba3fb48fb87065469eaa1b4a34a18851b9e (patch) | |
tree | 6f43ab99e0f22a33fccb941ab0441d1bee38adf9 /ui | |
parent | 1.11 (diff) | |
download | FreeFileSync-cbb59ba3fb48fb87065469eaa1b4a34a18851b9e.tar.gz FreeFileSync-cbb59ba3fb48fb87065469eaa1b4a34a18851b9e.tar.bz2 FreeFileSync-cbb59ba3fb48fb87065469eaa1b4a34a18851b9e.zip |
1.12
Diffstat (limited to 'ui')
-rw-r--r-- | ui/MainDialog.cpp | 882 | ||||
-rw-r--r-- | ui/MainDialog.h | 42 | ||||
-rw-r--r-- | ui/SmallDialogs.cpp | 200 | ||||
-rw-r--r-- | ui/SmallDialogs.h | 41 | ||||
-rw-r--r-- | ui/SyncDialog.cpp | 144 | ||||
-rw-r--r-- | ui/guiGenerated.cpp | 231 | ||||
-rw-r--r-- | ui/guiGenerated.h | 90 |
7 files changed, 925 insertions, 705 deletions
diff --git a/ui/MainDialog.cpp b/ui/MainDialog.cpp index 47926383..3f845364 100644 --- a/ui/MainDialog.cpp +++ b/ui/MainDialog.cpp @@ -15,16 +15,18 @@ #include <wx/file.h> #include "../library/customGrid.h" #include <algorithm> -#include "../library/processXml.h" +#include "../library/sorting.h" #include <wx/msgdlg.h> using namespace globalFunctions; using namespace xmlAccess; + int leadingPanel = 0; -MainDialog::MainDialog(wxFrame* frame, const wxString& cfgFileName, CustomLocale* language) : +MainDialog::MainDialog(wxFrame* frame, const wxString& cfgFileName, CustomLocale* language, xmlAccess::XmlGlobalSettings& settings) : GuiGenerated(frame), + globalSettings(settings), programLanguage(language), filteringInitialized(false), filteringPending(false), @@ -49,6 +51,7 @@ MainDialog::MainDialog(wxFrame* frame, const wxString& cfgFileName, CustomLocale //initialize and load configuration readConfigurationFromXml(cfgFileName, true); + readGlobalSettings(); leftOnlyFilesActive = true; leftNewerFilesActive = true; @@ -186,6 +189,9 @@ MainDialog::MainDialog(wxFrame* frame, const wxString& cfgFileName, CustomLocale case wxLANGUAGE_JAPANESE: m_menuItemJapanese->Check(); break; + case wxLANGUAGE_DUTCH: + m_menuItemDutch->Check(); + break; default: m_menuItemEnglish->Check(); } @@ -238,16 +244,62 @@ MainDialog::~MainDialog() //save configuration writeConfigurationToXml(FreeFileSync::FfsLastConfigFile); //don't trow exceptions in destructors + writeGlobalSettings(); if (restartOnExit) //this is needed so that restart happens AFTER configuration was written! { //create new dialog - MainDialog* frame = new MainDialog(NULL, FreeFileSync::FfsLastConfigFile, programLanguage); + MainDialog* frame = new MainDialog(NULL, FreeFileSync::FfsLastConfigFile, programLanguage, globalSettings); frame->SetIcon(*globalResource.programIcon); //set application icon frame->Show(); } } +void MainDialog::readGlobalSettings() +{ + //apply window size and position at program startup ONLY + widthNotMaximized = globalSettings.gui.widthNotMaximized; + heightNotMaximized = globalSettings.gui.heightNotMaximized; + posXNotMaximized = globalSettings.gui.posXNotMaximized; + posYNotMaximized = globalSettings.gui.posYNotMaximized; + + //apply window size and position + if ( widthNotMaximized != wxDefaultCoord && + heightNotMaximized != wxDefaultCoord && + posXNotMaximized != wxDefaultCoord && + posYNotMaximized != wxDefaultCoord) + SetSize(posXNotMaximized, posYNotMaximized, widthNotMaximized, heightNotMaximized); + + Maximize(globalSettings.gui.isMaximized); + + //read column widths + for (int i = 0; i < m_grid1->GetNumberCols() && i < int(globalSettings.gui.columnWidthLeft.size()); ++i) + m_grid1->SetColSize(i, globalSettings.gui.columnWidthLeft[i]); + + for (int i = 0; i < m_grid2->GetNumberCols() && i < int(globalSettings.gui.columnWidthRight.size()); ++i) + m_grid2->SetColSize(i, globalSettings.gui.columnWidthRight[i]); +} + + +void MainDialog::writeGlobalSettings() +{ + //write global settings to (global) variable stored in application instance + globalSettings.gui.widthNotMaximized = widthNotMaximized; + globalSettings.gui.heightNotMaximized = heightNotMaximized; + globalSettings.gui.posXNotMaximized = posXNotMaximized; + globalSettings.gui.posYNotMaximized = posYNotMaximized; + globalSettings.gui.isMaximized = IsMaximized(); + + globalSettings.gui.columnWidthLeft.clear(); + for (int i = 0; i < m_grid1->GetNumberCols(); ++i) + globalSettings.gui.columnWidthLeft.push_back(m_grid1->GetColSize(i)); + + globalSettings.gui.columnWidthRight.clear(); + for (int i = 0; i < m_grid2->GetNumberCols(); ++i) + globalSettings.gui.columnWidthRight.push_back(m_grid2->GetColSize(i)); +} + + void MainDialog::onGrid1access(wxEvent& event) { if (leadingPanel != 1) @@ -307,7 +359,7 @@ void MainDialog::filterRangeTemp(const set<int>& rowsToFilterOnUI_View) { int gridSizeUI = gridRefUI.size(); - bool newSelection = false; //default: deselect range + bool newSelection = false; //default: deselect range //leadingRow determines de-/selection of all other rows int leadingRow = *rowsToFilterOnUI_View.begin(); @@ -315,7 +367,7 @@ void MainDialog::filterRangeTemp(const set<int>& rowsToFilterOnUI_View) newSelection = !currentGridData[gridRefUI[leadingRow]].selectedForSynchronization; if (hideFilteredElements) - assert (!newSelection); //if hidefiltered is active, there should be no filtered elements on screen => current element was filtered out + assert(!newSelection); //if hidefiltered is active, there should be no filtered elements on screen => current element was filtered out //get all lines that need to be filtered (e.g. if a folder is marked, then its subelements should be marked as well) @@ -340,33 +392,12 @@ void MainDialog::filterRangeTemp(const set<int>& rowsToFilterOnUI_View) m_grid1->ForceRefresh(); m_grid2->ForceRefresh(); m_grid3->ForceRefresh(); + Update(); //show changes resulting from ForceRefresh() if (hideFilteredElements) { - Update(); //show changes resulting from ForceRefresh() - - wxLongLong waitBegin = wxGetLocalTimeMillis(); - - //determine rows that are currently filtered out on current UI view (and need to be removed) - set<int> filteredOutRowsOnUI; - for (GridView::iterator i = gridRefUI.begin(); i != gridRefUI.end(); ++i) - { - const FileCompareLine& gridLine = currentGridData[*i]; - - if (!gridLine.selectedForSynchronization) - filteredOutRowsOnUI.insert(i - gridRefUI.begin()); - } - - //some delay to show user the rows he has filtered out before they are removed - unsigned long waitRemaining = max(400 - (wxGetLocalTimeMillis() - waitBegin).GetLo(), unsigned(0)); - wxMilliSleep(waitRemaining); //400 ms delay before rows are removed from UI - - //delete rows, that are filtered out: - removeRowsFromVector(gridRefUI, filteredOutRowsOnUI); - - //redraw grid necessary to update new dimensions - writeGrid(currentGridData, true); //use UI buffer, just a re-dimensioning of grids - updateStatusInformation(gridRefUI); //status information has to be recalculated! + wxMilliSleep(400); //some delay to show user the rows he has filtered out before they are removed + writeGrid(currentGridData); //redraw grid to remove excluded elements (keeping sort sequence) } } @@ -379,6 +410,7 @@ void MainDialog::filterRangeTemp(const set<int>& rowsToFilterOnUI_View) m_grid3->ClearSelection(); } + /*grid event choreography: 1. UI-Mouse-Down => OnGridSelectCell 2. UI-Mouse-Up => SelectRangeEvent (if at least two rows are marked) @@ -572,18 +604,18 @@ set<int> MainDialog::getSelectedRows() } -class DeleteStatusUpdater : public StatusUpdater +class DeleteErrorHandler : public ErrorHandler { public: - DeleteStatusUpdater(bool& unsolvedErrorOccured) : continueOnError(false), unsolvedErrors(unsolvedErrorOccured) {} - ~DeleteStatusUpdater() {} + DeleteErrorHandler(bool& unsolvedErrorOccured) : continueOnError(false), unsolvedErrors(unsolvedErrorOccured) {} + ~DeleteErrorHandler() {} - int reportError(const wxString& text) + Response reportError(const wxString& text) { if (continueOnError) { unsolvedErrors = true; - return StatusUpdater::continueNext; + return ErrorHandler::CONTINUE_NEXT; } wxString errorMessage = text + _("\n\nInformation: If you skip the error and continue or abort a re-compare will be necessary!"); @@ -595,12 +627,12 @@ public: switch (rv) { - case ErrorDlg::continueButtonPressed: + case ErrorDlg::BUTTON_CONTINUE: unsolvedErrors = true; - return StatusUpdater::continueNext; - case ErrorDlg::retryButtonPressed: - return StatusUpdater::retry; - case ErrorDlg::abortButtonPressed: + return ErrorHandler::CONTINUE_NEXT; + case ErrorDlg::BUTTON_RETRY: + return ErrorHandler::RETRY; + case ErrorDlg::BUTTON_ABORT: { unsolvedErrors = true; throw AbortThisProcess(); @@ -609,14 +641,9 @@ public: assert (false); } - return StatusUpdater::continueNext; //dummy return value + return ErrorHandler::CONTINUE_NEXT; //dummy return value } - void updateStatusText(const wxString& text) {} - void initNewProcess(int objectsTotal, double dataTotal, int processID) {} - void updateProcessedData(int objectsProcessed, double dataProcessed) {} - void forceUiRefresh() {} private: - void abortThisProcess() {} bool continueOnError; bool& unsolvedErrors; @@ -644,11 +671,11 @@ void MainDialog::deleteFilesOnGrid(const set<int>& rowsToDeleteOnUI) { const FileCompareLine& currentCmpLine = currentGridData[*i]; - if (currentCmpLine.fileDescrLeft.objType != TYPE_NOTHING) - filesToDelete+= currentCmpLine.fileDescrLeft.filename + wxT("\n"); + if (currentCmpLine.fileDescrLeft.objType != FileDescrLine::TYPE_NOTHING) + filesToDelete+= currentCmpLine.fileDescrLeft.fullName + wxT("\n"); - if (currentCmpLine.fileDescrRight.objType != TYPE_NOTHING) - filesToDelete+= currentCmpLine.fileDescrRight.filename + wxT("\n"); + if (currentCmpLine.fileDescrRight.objType != FileDescrLine::TYPE_NOTHING) + filesToDelete+= currentCmpLine.fileDescrRight.fullName + wxT("\n"); filesToDelete+= wxT("\n"); } @@ -657,38 +684,35 @@ void MainDialog::deleteFilesOnGrid(const set<int>& rowsToDeleteOnUI) switch (confirmDeletion->ShowModal()) { - case DeleteDialog::okayButtonPressed: + case DeleteDialog::BUTTON_OKAY: { bool unsolvedErrorOccured = false; //if an error is skipped a re-compare will be necessary! try - { //class errors when deleting files/folders - DeleteStatusUpdater deleteStatusUpdater(unsolvedErrorOccured); + { //handle errors when deleting files/folders + DeleteErrorHandler errorHandler(unsolvedErrorOccured); - FreeFileSync::deleteOnGridAndHD(currentGridData, rowsToDeleteOnGrid, &deleteStatusUpdater, cfg.useRecycleBin); + FreeFileSync::deleteOnGridAndHD(currentGridData, rowsToDeleteOnGrid, &errorHandler, cfg.useRecycleBin); } catch (AbortThisProcess& theException) {} - //disable the sync button if errors occured during deletion if (unsolvedErrorOccured) enableSynchronization(false); - //redraw grid neccessary to update new dimensions and for UI-Backend data linkage - writeGrid(currentGridData); //do NOT use UI buffer here + writeGrid(currentGridData); - m_grid1->ClearSelection(); //clear selection on grid - m_grid2->ClearSelection(); //clear selection on grid - m_grid3->ClearSelection(); //clear selection on grid + m_grid1->ClearSelection(); + m_grid2->ClearSelection(); + m_grid3->ClearSelection(); } break; - case DeleteDialog::cancelButtonPressed: + case DeleteDialog::BUTTON_CANCEL: default: break; - } } } @@ -703,10 +727,9 @@ void MainDialog::openWithFileBrowser(int rowNumber, int gridNr) if (0 <= rowNumber && rowNumber < int(gridRefUI.size())) { - wxString filename = currentGridData[gridRefUI[rowNumber]].fileDescrLeft.filename; - - if (!filename.IsEmpty()) - command = wxString(wxT("explorer /select,")) + filename; + const FileDescrLine& fileDescr = currentGridData[gridRefUI[rowNumber]].fileDescrLeft; + if (fileDescr.objType != FileDescrLine::TYPE_NOTHING) + command = wxString(wxT("explorer /select,")) + fileDescr.fullName; } wxExecute(command); } @@ -716,10 +739,9 @@ void MainDialog::openWithFileBrowser(int rowNumber, int gridNr) if (0 <= rowNumber && rowNumber < int(gridRefUI.size())) { - wxString filename = currentGridData[gridRefUI[rowNumber]].fileDescrRight.filename; - - if (!filename.IsEmpty()) - command = wxString(wxT("explorer /select,")) + filename; + const FileDescrLine& fileDescr = currentGridData[gridRefUI[rowNumber]].fileDescrRight; + if (fileDescr.objType != FileDescrLine::TYPE_NOTHING) + command = wxString(wxT("explorer /select,")) + fileDescr.fullName; } wxExecute(command); } @@ -816,57 +838,13 @@ void MainDialog::onGrid3ButtonEvent(wxKeyEvent& event) } -inline -wxString getFilename(const FileDescrLine* fileDescr) -{ - if (!fileDescr || fileDescr->objType != TYPE_FILE) - return wxEmptyString; - else - return fileDescr->relFilename.AfterLast(GlobalResources::fileNameSeparator); -} - - -inline -wxString getFileExtension(const FileDescrLine* fileDescr) -{ - if (!fileDescr || fileDescr->objType != TYPE_FILE) - return wxEmptyString; - else - { - wxString filename = getFilename(fileDescr); - - if (filename.Find(wxChar('.')) != wxNOT_FOUND) //be careful: AfterLast will return the whole string if '.' is not found! - return filename.AfterLast(wxChar('.')); - else - return wxEmptyString; - } -} - - -inline -wxString getDirname(const FileDescrLine* fileDescr) -{ - if (!fileDescr || fileDescr->objType != TYPE_DIRECTORY) - return wxEmptyString; - else - return fileDescr->filename.AfterLast(GlobalResources::fileNameSeparator); -} - - -inline -wxString getRelativeName(const FileDescrLine* fileDescr) -{ - if (!fileDescr || fileDescr->objType == TYPE_NOTHING) - return wxEmptyString; - else - return fileDescr->relFilename; -} - - void MainDialog::OnOpenContextMenu(wxGridEvent& event) { set<int> selection = getSelectedRows(); + exFilterCandidateExtension.Clear(); + exFilterCandidateObj.clear(); + //####################################################### //re-create context menu delete contextMenu; @@ -875,31 +853,49 @@ void MainDialog::OnOpenContextMenu(wxGridEvent& event) //dynamic filter determination if (selection.size() > 0) { - const FileCompareLine& cmpLine = currentGridData[gridRefUI[*selection.begin()]]; + const FileCompareLine& firstLine = currentGridData[gridRefUI[*selection.begin()]]; - if (cmpLine.selectedForSynchronization) + if (firstLine.selectedForSynchronization) contextMenu->Append(CONTEXT_FILTER_TEMP, _("Exclude temporarily")); else contextMenu->Append(CONTEXT_FILTER_TEMP, _("Include temporarily")); - - const FileDescrLine* fileDescr = NULL; + //get list of relative file/dir-names into vectors + FilterObject newFilterEntry; if (leadingPanel == 1) - fileDescr = &cmpLine.fileDescrLeft; + for (set<int>::iterator i = selection.begin(); i != selection.end(); ++i) + { + const FileCompareLine& line = currentGridData[gridRefUI[*i]]; + newFilterEntry.relativeName = line.fileDescrLeft.relativeName; + newFilterEntry.type = line.fileDescrLeft.objType; + if (!newFilterEntry.relativeName.IsEmpty()) + exFilterCandidateObj.push_back(newFilterEntry); + } else if (leadingPanel == 2) - fileDescr = &cmpLine.fileDescrRight; + for (set<int>::iterator i = selection.begin(); i != selection.end(); ++i) + { + const FileCompareLine& line = currentGridData[gridRefUI[*i]]; + newFilterEntry.relativeName = line.fileDescrRight.relativeName; + newFilterEntry.type = line.fileDescrRight.objType; + if (!newFilterEntry.relativeName.IsEmpty()) + exFilterCandidateObj.push_back(newFilterEntry); + } - exFilterCandidateExtension = getFileExtension(fileDescr); //avoid re-determination in onContextMenuSelection() - if (!exFilterCandidateExtension.IsEmpty()) - contextMenu->Append(CONTEXT_EXCLUDE_EXT, wxString(_("Add to exclude filter: ")) + wxT("*.") + exFilterCandidateExtension); - exFilterCandidateFilename = getFilename(fileDescr); - if (!exFilterCandidateFilename.IsEmpty()) - contextMenu->Append(CONTEXT_EXCLUDE_FILE, wxString(_("Add to exclude filter: ")) + exFilterCandidateFilename); + if (exFilterCandidateObj.size() > 0 && exFilterCandidateObj[0].type == FileDescrLine::TYPE_FILE) + { + const wxString filename = exFilterCandidateObj[0].relativeName.AfterLast(GlobalResources::fileNameSeparator); + if (filename.Find(wxChar('.')) != wxNOT_FOUND) //be careful: AfterLast will return the whole string if '.' is not found! + { + exFilterCandidateExtension = filename.AfterLast(wxChar('.')); + contextMenu->Append(CONTEXT_EXCLUDE_EXT, wxString(_("Add to exclude filter: ")) + wxT("*.") + exFilterCandidateExtension); + } + } - exFilterCandidateDirname = getDirname(fileDescr); - if (!exFilterCandidateDirname.IsEmpty()) - contextMenu->Append(CONTEXT_EXCLUDE_DIR, wxString(_("Add to exclude filter: ")) + exFilterCandidateDirname); + if (exFilterCandidateObj.size() == 1) + contextMenu->Append(CONTEXT_EXCLUDE_OBJ, wxString(_("Add to exclude filter: ")) + exFilterCandidateObj[0].relativeName); + else if (exFilterCandidateObj.size() > 1) + contextMenu->Append(CONTEXT_EXCLUDE_OBJ, wxString(_("Add to exclude filter: ")) + _("<multiple selection>")); } else contextMenu->Append(CONTEXT_FILTER_TEMP, _("Exclude temporarily")); //this element should always be visible @@ -967,31 +963,26 @@ void MainDialog::onContextMenuSelection(wxCommandEvent& event) writeGrid(currentGridData); } } - else if (eventId == CONTEXT_EXCLUDE_FILE) - { - if (!exFilterCandidateFilename.IsEmpty()) - { - if (!cfg.excludeFilter.IsEmpty() && !cfg.excludeFilter.EndsWith(wxT("\n"))) - cfg.excludeFilter+= wxT("\n"); - - cfg.excludeFilter+= wxString(wxT("*")) + GlobalResources::fileNameSeparator + exFilterCandidateFilename; - - cfg.filterIsActive = true; - updateFilterButton(m_bpButtonFilter, cfg.filterIsActive); - - FreeFileSync::filterCurrentGridData(currentGridData, cfg.includeFilter, cfg.excludeFilter); - writeGrid(currentGridData); - } - } - else if (eventId == CONTEXT_EXCLUDE_DIR) + else if (eventId == CONTEXT_EXCLUDE_OBJ) { - if (!exFilterCandidateDirname.IsEmpty()) + if (exFilterCandidateObj.size() > 0) //check needed to determine if filtering is needed { - if (!cfg.excludeFilter.IsEmpty() && !cfg.excludeFilter.EndsWith(wxT("\n"))) - cfg.excludeFilter+= wxT("\n"); + for (vector<FilterObject>::const_iterator i = exFilterCandidateObj.begin(); i != exFilterCandidateObj.end(); ++i) + { + if (!cfg.excludeFilter.IsEmpty() && !cfg.excludeFilter.EndsWith(wxT("\n"))) + cfg.excludeFilter+= wxT("\n"); - cfg.excludeFilter+= wxString(wxT("*")) + GlobalResources::fileNameSeparator + exFilterCandidateDirname + wxT("\n"); - cfg.excludeFilter+= wxString(wxT("*")) + GlobalResources::fileNameSeparator + exFilterCandidateDirname + GlobalResources::fileNameSeparator + wxT("*"); + if (i->type == FileDescrLine::TYPE_FILE) + { + cfg.excludeFilter+= wxString(wxT("*")) + GlobalResources::fileNameSeparator + i->relativeName; + } + else if (i->type == FileDescrLine::TYPE_DIRECTORY) + { + cfg.excludeFilter+= wxString(wxT("*")) + GlobalResources::fileNameSeparator + i->relativeName + wxT("\n"); + cfg.excludeFilter+= wxString(wxT("*")) + GlobalResources::fileNameSeparator + i->relativeName + GlobalResources::fileNameSeparator + wxT("*"); + } + else assert(false); + } cfg.filterIsActive = true; updateFilterButton(m_bpButtonFilter, cfg.filterIsActive); @@ -1358,161 +1349,87 @@ void MainDialog::OnQuit(wxCommandEvent &event) } -void MainDialog::loadDefaultConfiguration() -{ - //default values - cfg.syncConfiguration.exLeftSideOnly = SYNC_DIR_RIGHT; - cfg.syncConfiguration.exRightSideOnly = SYNC_DIR_RIGHT; - cfg.syncConfiguration.leftNewer = SYNC_DIR_RIGHT; - cfg.syncConfiguration.rightNewer = SYNC_DIR_RIGHT; - cfg.syncConfiguration.different = SYNC_DIR_RIGHT; - - cfg.compareVar = CMP_BY_TIME_SIZE; //compare algorithm - updateCompareButtons(); - - cfg.includeFilter = wxT("*"); //include all files/folders - cfg.excludeFilter = wxEmptyString; //exclude nothing - - //set status of filter button - cfg.filterIsActive = false; //do not filter by default - updateFilterButton(m_bpButtonFilter, cfg.filterIsActive); - - cfg.useRecycleBin = FreeFileSync::recycleBinExists(); //enable if OS supports it; else user will have to activate first and then get the error message - cfg.continueOnError = false; - - //set status of "hide filtered items" checkbox - hideFilteredElements = false; //show filtered items - m_checkBoxHideFilt->SetValue(hideFilteredElements); - - widthNotMaximized = wxDefaultCoord; - heightNotMaximized = wxDefaultCoord; - posXNotMaximized = wxDefaultCoord; - posYNotMaximized = wxDefaultCoord; -} - - bool MainDialog::readConfigurationFromXml(const wxString& filename, bool programStartup) { //load XML - XmlInput inputFile(filename, XML_GUI_CONFIG); - - if (!inputFile.loadedSuccessfully()) - { //handle error: file load - if (programStartup) - loadDefaultConfiguration(); - else - wxMessageBox(wxString(_("Could not open configuration file ")) + wxT("\"") + filename + wxT("\""), _("Error"), wxOK | wxICON_ERROR); - return false; + XmlGuiConfig guiCfg; //structure to receive gui settings, already defaulted!! + try + { + guiCfg = xmlAccess::readGuiConfig(filename); } - - XmlMainConfig mainCfg; //structure to receive main settings - XmlGuiConfig guiCfg; //structure to receive gui settings - if ( inputFile.readXmlMainConfig(mainCfg) && //read main configuration settings - inputFile.readXmlGuiConfig(guiCfg)) //read GUI layout configuration + catch (const FileError& error) { - //load main configuration into instance - cfg = mainCfg.cfg; + if (programStartup && filename == FreeFileSync::FfsLastConfigFile && !wxFileExists(filename)) //do not show error in this case + ; + else if (!programStartup) + { + wxMessageBox(error.show(), _("Error"), wxOK | wxICON_ERROR); + return false; + } + else //program startup: show error message and load defaults + wxMessageBox(error.show(), _("Error"), wxOK | wxICON_ERROR); + } - //update visible config on main window - updateCompareButtons(); - updateFilterButton(m_bpButtonFilter, cfg.filterIsActive); + //load main configuration into instance + cfg = guiCfg.mainCfg; - //read folder pairs, but first: clear existing pairs: - removeFolderPair(true); + //update visible config on main window + updateCompareButtons(); + updateFilterButton(m_bpButtonFilter, cfg.filterIsActive); - //set main folder pair - if (mainCfg.directoryPairs.size() > 0) - { - vector<FolderPair>::const_iterator i = mainCfg.directoryPairs.begin(); + //read folder pairs, but first: clear existing pairs: + removeFolderPair(true); - m_directoryLeft->SetValue(i->leftDirectory); - wxString leftDirFormatted = FreeFileSync::getFormattedDirectoryName(i->leftDirectory); - if (wxDirExists(leftDirFormatted)) - m_dirPicker1->SetPath(leftDirFormatted); + //set main folder pair + if (guiCfg.directoryPairs.size() > 0) + { + vector<FolderPair>::const_iterator i = guiCfg.directoryPairs.begin(); - m_directoryRight->SetValue(i->rightDirectory); - wxString rightDirFormatted = FreeFileSync::getFormattedDirectoryName(i->rightDirectory); - if (wxDirExists(rightDirFormatted)) - m_dirPicker2->SetPath(rightDirFormatted); + m_directoryLeft->SetValue(i->leftDirectory); + wxString leftDirFormatted = FreeFileSync::getFormattedDirectoryName(i->leftDirectory); + if (wxDirExists(leftDirFormatted)) + m_dirPicker1->SetPath(leftDirFormatted); - //set additional pairs - for (vector<FolderPair>::const_iterator i = mainCfg.directoryPairs.begin() + 1; i != mainCfg.directoryPairs.end(); ++i) - addFolderPair(i->leftDirectory, i->rightDirectory); - } + m_directoryRight->SetValue(i->rightDirectory); + wxString rightDirFormatted = FreeFileSync::getFormattedDirectoryName(i->rightDirectory); + if (wxDirExists(rightDirFormatted)) + m_dirPicker2->SetPath(rightDirFormatted); - //read GUI layout (optional!) - hideFilteredElements = guiCfg.hideFilteredElements; - m_checkBoxHideFilt->SetValue(hideFilteredElements); + //set additional pairs + for (vector<FolderPair>::const_iterator i = guiCfg.directoryPairs.begin() + 1; i != guiCfg.directoryPairs.end(); ++i) + addFolderPair(i->leftDirectory, i->rightDirectory); + } - //apply window size and position at program startup ONLY - if (programStartup) - { - if ( guiCfg.widthNotMaximized != -1 && - guiCfg.heightNotMaximized != -1 && - guiCfg.posXNotMaximized != -1 && - guiCfg.posYNotMaximized != -1) - { - widthNotMaximized = guiCfg.widthNotMaximized; - heightNotMaximized = guiCfg.heightNotMaximized; - posXNotMaximized = guiCfg.posXNotMaximized; - posYNotMaximized = guiCfg.posYNotMaximized; - - //apply window size and position - SetSize(posXNotMaximized, posYNotMaximized, widthNotMaximized, heightNotMaximized); - Maximize(guiCfg.isMaximized); - } - //read column widths - for (int i = 0; i < m_grid1->GetNumberCols() && i < int(guiCfg.columnWidthLeft.size()); ++i) - m_grid1->SetColSize(i, guiCfg.columnWidthLeft[i]); + //read GUI layout (optional!) + hideFilteredElements = guiCfg.hideFilteredElements; + m_checkBoxHideFilt->SetValue(hideFilteredElements); - for (int i = 0; i < m_grid2->GetNumberCols() && i < int(guiCfg.columnWidthRight.size()); ++i) - m_grid2->SetColSize(i, guiCfg.columnWidthRight[i]); - } - //########################################################### - addCfgFileToHistory(filename); //put filename on list of last used config files - return true; - } - else - { //handle error: parsing - wxMessageBox(wxString(_("Error parsing configuration file ")) + wxT("\"") + filename + wxT("\""), _("Error"), wxOK | wxICON_ERROR); - if (programStartup) - loadDefaultConfiguration(); - return false; - } + //########################################################### + addCfgFileToHistory(filename); //put filename on list of last used config files + return true; } bool MainDialog::writeConfigurationToXml(const wxString& filename) { - XmlOutput outputFile(filename, XML_GUI_CONFIG); + XmlGuiConfig guiCfg; //load structure with basic settings "mainCfg" - XmlMainConfig mainCfg; - mainCfg.cfg = cfg; - GetFolderPairs(mainCfg.directoryPairs); + guiCfg.mainCfg = cfg; + GetFolderPairs(guiCfg.directoryPairs); - //load structure with gui settings "guiCfg" - XmlGuiConfig guiCfg; + //load structure with gui settings guiCfg.hideFilteredElements = hideFilteredElements; - guiCfg.widthNotMaximized = widthNotMaximized; - guiCfg.heightNotMaximized = heightNotMaximized; - guiCfg.posXNotMaximized = posXNotMaximized; - guiCfg.posYNotMaximized = posYNotMaximized; - guiCfg.isMaximized = IsMaximized(); - - for (int i = 0; i < m_grid1->GetNumberCols(); ++i) - guiCfg.columnWidthLeft.push_back(m_grid1->GetColSize(i)); - for (int i = 0; i < m_grid2->GetNumberCols(); ++i) - guiCfg.columnWidthRight.push_back(m_grid2->GetColSize(i)); - - //populate and write XML tree - if ( !outputFile.writeXmlMainConfig(mainCfg) || //add basic configuration settings - !outputFile.writeXmlGuiConfig(guiCfg) || //add GUI layout configuration settings - !outputFile.writeToFile()) //save XML + //write config to XML + try + { + xmlAccess::writeGuiConfig(filename, guiCfg); + } + catch (const FileError& error) { - wxMessageBox(wxString(_("Could not write configuration file ")) + wxT("\"") + filename + wxT("\""), _("Error"), wxOK | wxICON_ERROR); + wxMessageBox(error.show(), _("Error"), wxOK | wxICON_ERROR); return false; } @@ -1563,7 +1480,7 @@ void MainDialog::OnConfigureFilter(wxHyperlinkEvent &event) wxString beforeImage = cfg.includeFilter + wxChar(1) + cfg.excludeFilter; FilterDlg* filterDlg = new FilterDlg(this, cfg.includeFilter, cfg.excludeFilter); - if (filterDlg->ShowModal() == FilterDlg::okayButtonPressed) + if (filterDlg->ShowModal() == FilterDlg::BUTTON_OKAY) { wxString afterImage = cfg.includeFilter + wxChar(1) + cfg.excludeFilter; @@ -1640,34 +1557,70 @@ void MainDialog::OnEqualFiles(wxCommandEvent& event) void MainDialog::updateViewFilterButtons() { if (leftOnlyFilesActive) - m_bpButtonLeftOnly->SetBitmapLabel(*globalResource.bitmapLeftOnly); + { + m_bpButtonLeftOnly->SetBitmapLabel(*globalResource.bitmapLeftOnlyAct); + m_bpButtonLeftOnly->SetToolTip(_("Hide files that exist on left side only")); + } else + { m_bpButtonLeftOnly->SetBitmapLabel(*globalResource.bitmapLeftOnlyDeact); + m_bpButtonLeftOnly->SetToolTip(_("Show files that exist on left side only")); + } if (leftNewerFilesActive) - m_bpButtonLeftNewer->SetBitmapLabel(*globalResource.bitmapLeftNewer); + { + m_bpButtonLeftNewer->SetBitmapLabel(*globalResource.bitmapLeftNewerAct); + m_bpButtonLeftNewer->SetToolTip(_("Hide files that are newer on left")); + } else + { m_bpButtonLeftNewer->SetBitmapLabel(*globalResource.bitmapLeftNewerDeact); + m_bpButtonLeftNewer->SetToolTip(_("Show files that are newer on left")); + } if (equalFilesActive) - m_bpButtonEqual->SetBitmapLabel(*globalResource.bitmapEqual); + { + m_bpButtonEqual->SetBitmapLabel(*globalResource.bitmapEqualAct); + m_bpButtonEqual->SetToolTip(_("Hide files that are equal")); + } else + { m_bpButtonEqual->SetBitmapLabel(*globalResource.bitmapEqualDeact); + m_bpButtonEqual->SetToolTip(_("Show files that are equal")); + } if (differentFilesActive) - m_bpButtonDifferent->SetBitmapLabel(*globalResource.bitmapDifferent); + { + m_bpButtonDifferent->SetBitmapLabel(*globalResource.bitmapDifferentAct); + m_bpButtonDifferent->SetToolTip(_("Hide files that are different")); + } else + { m_bpButtonDifferent->SetBitmapLabel(*globalResource.bitmapDifferentDeact); + m_bpButtonDifferent->SetToolTip(_("Show files that are different")); + } if (rightNewerFilesActive) - m_bpButtonRightNewer->SetBitmapLabel(*globalResource.bitmapRightNewer); + { + m_bpButtonRightNewer->SetBitmapLabel(*globalResource.bitmapRightNewerAct); + m_bpButtonRightNewer->SetToolTip(_("Hide files that are newer on right")); + } else + { m_bpButtonRightNewer->SetBitmapLabel(*globalResource.bitmapRightNewerDeact); + m_bpButtonRightNewer->SetToolTip(_("Show files that are newer on right")); + } if (rightOnlyFilesActive) - m_bpButtonRightOnly->SetBitmapLabel(*globalResource.bitmapRightOnly); + { + m_bpButtonRightOnly->SetBitmapLabel(*globalResource.bitmapRightOnlyAct); + m_bpButtonRightOnly->SetToolTip(_("Hide files that exist on right side only")); + } else + { m_bpButtonRightOnly->SetBitmapLabel(*globalResource.bitmapRightOnlyDeact); + m_bpButtonRightOnly->SetToolTip(_("Show files that exist on right side only")); + } } @@ -1772,13 +1725,10 @@ void MainDialog::OnCompare(wxCommandEvent &event) CompareStatusUpdater statusUpdater(this); cmpStatusUpdaterTmp = &statusUpdater; - //unsigned int startTime3 = GetTickCount(); - FreeFileSync::startCompareProcess(currentGridData, - directoryPairsFormatted, + FreeFileSync::startCompareProcess(directoryPairsFormatted, cfg.compareVar, + currentGridData, &statusUpdater); - //wxMessageBox(numberToWxString(unsigned(GetTickCount()) - startTime3)); - //filter currentGridData if option is set if (cfg.filterIsActive) @@ -1802,6 +1752,10 @@ void MainDialog::OnCompare(wxCommandEvent &event) { //once compare is finished enable the sync button enableSynchronization(true); m_bpButtonSync->SetFocus(); + + //hide sort direction indicator on GUI grids + m_grid1->setSortMarker(-1); + m_grid2->setSortMarker(-1); } wxEndBusyCursor(); @@ -1817,23 +1771,17 @@ void MainDialog::OnAbortCompare(wxCommandEvent& event) } -void MainDialog::writeGrid(const FileCompareResult& gridData, bool useUI_GridCache) +void MainDialog::writeGrid(const FileCompareResult& gridData) { m_grid1->BeginBatch(); m_grid2->BeginBatch(); m_grid3->BeginBatch(); - if (!useUI_GridCache) - { - //unsigned int startTime = GetTickCount(); - mapGridDataToUI(gridRefUI, gridData); //update gridRefUI - //wxMessageBox(wxString("Benchmark: ") + numberToWxString(unsigned(GetTickCount()) - startTime) + " ms"); - - updateStatusInformation(gridRefUI); //write status information for gridRefUI - } + mapGridDataToUI(gridRefUI, gridData); //update gridRefUI + updateStatusInformation(gridRefUI); //write status information for gridRefUI - //all three grids retrieve their data directly from currentGridData!!! - //the only thing left to do is notify the grids to update their sizes (nr of rows), since this has to be communicated via messages by the grids + //all three grids retrieve their data directly via gridRefUI!!! + //the only thing left to do is notify the grids to update their sizes (nr of rows), since this has to be communicated by the grids via messages m_grid1->updateGridSizes(); m_grid2->updateGridSizes(); m_grid3->updateGridSizes(); @@ -1847,11 +1795,6 @@ void MainDialog::writeGrid(const FileCompareResult& gridData, bool useUI_GridCac m_grid2->SetRowLabelSize(nrOfDigits * 8 + 4); } - //hide sort direction indicator on UI grids - m_grid1->setSortMarker(-1); - m_grid2->setSortMarker(-1); - - m_grid1->EndBatch(); m_grid2->EndBatch(); m_grid3->EndBatch(); @@ -1884,17 +1827,13 @@ void MainDialog::OnSync(wxCommandEvent& event) wxBeginBusyCursor(); clearStatusBar(); - try { //class handling status updates and error messages SyncStatusUpdater statusUpdater(this, cfg.continueOnError); //start synchronization and return elements that were not sync'ed in currentGridData - - //unsigned int startTime3 = GetTickCount(); FreeFileSync::startSynchronizationProcess(currentGridData, cfg.syncConfiguration, &statusUpdater, cfg.useRecycleBin); - //wxMessageBox(numberToWxString(unsigned(GetTickCount()) - startTime3)); } catch (AbortThisProcess& theException) { //do NOT disable the sync button: user might want to try to sync the REMAINING rows @@ -1912,7 +1851,6 @@ void MainDialog::OnSync(wxCommandEvent& event) enableSynchronization(false); } - wxEndBusyCursor(); } event.Skip(); @@ -1933,170 +1871,37 @@ void MainDialog::OnRightGridDoubleClick(wxGridEvent& event) } -//these three global variables are ONLY used for the sorting in the following methods -unsigned int currentSortColumn = 0; -bool sortAscending = true; -FileCompareResult* currentGridDataPtr = 0; - -inline -bool cmpString(const wxString& a, const wxString& b) -{ - if (a.IsEmpty()) - return false; // if a and b are empty: false, if a empty, b not empty: also false, since empty rows should appear at the end - else if (b.IsEmpty()) - return true; // empty rows after filled rows: return true - - //if a and b not empty: - if (sortAscending) - return (a < b); - else return (a > b); -} - - -inline -bool cmpLargeInt(const wxULongLong& a, const wxULongLong& b) -{ - if (sortAscending) - return (a < b); - - return (a > b); -} - - -bool sortGridLeft(const GridViewLine a, const GridViewLine b) -{ - const FileDescrLine& gridDataLineA = (*currentGridDataPtr)[a].fileDescrLeft; - const FileDescrLine& gridDataLineB = (*currentGridDataPtr)[b].fileDescrLeft; - - wxString stringA; - wxString stringB; - - switch (currentSortColumn) - { - case 0: - //presort types: first files, then directories then empty rows - if (gridDataLineA.objType == TYPE_NOTHING) - return false; //empty rows always last - else if (gridDataLineB.objType == TYPE_NOTHING) - return true; //empty rows always last - else if (gridDataLineA.objType == TYPE_DIRECTORY) - return false; - else if (gridDataLineB.objType == TYPE_DIRECTORY) - return true; - else - return cmpString(gridDataLineA.relFilename.AfterLast(GlobalResources::fileNameSeparator), - gridDataLineB.relFilename.AfterLast(GlobalResources::fileNameSeparator)); - case 1: - if (gridDataLineA.objType == TYPE_DIRECTORY) - stringA = gridDataLineA.relFilename; - else - stringA = gridDataLineA.relFilename.BeforeLast(GlobalResources::fileNameSeparator); - - if (gridDataLineB.objType == TYPE_DIRECTORY) - stringB = gridDataLineB.relFilename; - else - stringB = gridDataLineB.relFilename.BeforeLast(GlobalResources::fileNameSeparator); - - return cmpString(stringA, stringB); - - case 2: - //presort types: first files, then directories then empty rows - if (gridDataLineA.objType == TYPE_NOTHING) - return false; //empty rows always last - else if (gridDataLineB.objType == TYPE_NOTHING) - return true; //empty rows always last - else if (gridDataLineA.objType == TYPE_DIRECTORY) - return false; - else if (gridDataLineB.objType == TYPE_DIRECTORY) - return true; - else //use unformatted filesizes and sort by size - return cmpLargeInt(gridDataLineA.fileSize, gridDataLineB.fileSize); - - case 3: - return cmpString(gridDataLineA.lastWriteTime, gridDataLineB.lastWriteTime); - - default: - assert(false); - return true; //dummy command - } -} - - -bool sortGridRight(const GridViewLine a, const GridViewLine b) -{ - const FileDescrLine& gridDataLineA = (*currentGridDataPtr)[a].fileDescrRight; - const FileDescrLine& gridDataLineB = (*currentGridDataPtr)[b].fileDescrRight; - - wxString stringA; - wxString stringB; - - switch (currentSortColumn) - { - case 0: - //presort types: first files, then directories then empty rows - if (gridDataLineA.objType == TYPE_NOTHING) - return false; //empty rows always last - else if (gridDataLineB.objType == TYPE_NOTHING) - return true; //empty rows always last - else if (gridDataLineA.objType == TYPE_DIRECTORY) - return false; - else if (gridDataLineB.objType == TYPE_DIRECTORY) - return true; - else - return cmpString(gridDataLineA.relFilename.AfterLast(GlobalResources::fileNameSeparator), - gridDataLineB.relFilename.AfterLast(GlobalResources::fileNameSeparator)); - - case 1: - if (gridDataLineA.objType == TYPE_DIRECTORY) - stringA = gridDataLineA.relFilename; - else - stringA = gridDataLineA.relFilename.BeforeLast(GlobalResources::fileNameSeparator); - - if (gridDataLineB.objType == TYPE_DIRECTORY) - stringB = gridDataLineB.relFilename; - else - stringB = gridDataLineB.relFilename.BeforeLast(GlobalResources::fileNameSeparator); - - return cmpString(stringA, stringB); - - case 2: - //presort types: first files, then directories then empty rows - if (gridDataLineA.objType == TYPE_NOTHING) - return false; //empty rows always last - else if (gridDataLineB.objType == TYPE_NOTHING) - return true; //empty rows always last - else if (gridDataLineA.objType == TYPE_DIRECTORY) - return false; - else if (gridDataLineB.objType == TYPE_DIRECTORY) - return true; - else //use unformatted filesizes and sort by size - return cmpLargeInt(gridDataLineA.fileSize, gridDataLineB.fileSize); - - case 3: - return cmpString(gridDataLineA.lastWriteTime, gridDataLineB.lastWriteTime); - - default: - assert(false); - return true; //dummy command - } -} - - void MainDialog::OnSortLeftGrid(wxGridEvent& event) { static bool columnSortAscending[4] = {true, true, false, true}; - currentSortColumn = event.GetCol(); - currentGridDataPtr = ¤tGridData; + int currentSortColumn = event.GetCol(); if (0 <= currentSortColumn && currentSortColumn <= 3) { - sortAscending = columnSortAscending[currentSortColumn]; - columnSortAscending[currentSortColumn] = !columnSortAscending[currentSortColumn]; - sort(gridRefUI.begin(), gridRefUI.end(), sortGridLeft); + bool& sortAscending = columnSortAscending[currentSortColumn]; - m_grid1->ForceRefresh(); - m_grid2->ForceRefresh(); - m_grid3->ForceRefresh(); + if (currentSortColumn == 0) + { + if (sortAscending) sort(currentGridData.begin(), currentGridData.end(), sortByFileName<true, SORT_ON_LEFT>); //probably faster than qsort(), since gridRefUI is vector<int> + else sort(currentGridData.begin(), currentGridData.end(), sortByFileName<false, SORT_ON_LEFT>); + } + else if (currentSortColumn == 1) + { + if (sortAscending) sort(currentGridData.begin(), currentGridData.end(), sortByRelativeName<true, SORT_ON_LEFT>); + else sort(currentGridData.begin(), currentGridData.end(), sortByRelativeName<false, SORT_ON_LEFT>); + } + else if (currentSortColumn == 2) + { + if (sortAscending) sort(currentGridData.begin(), currentGridData.end(), sortByFileSize<true, SORT_ON_LEFT>); + else sort(currentGridData.begin(), currentGridData.end(), sortByFileSize<false, SORT_ON_LEFT>); + } + else if (currentSortColumn == 3) + { + if (sortAscending) sort(currentGridData.begin(), currentGridData.end(), sortByDate<true, SORT_ON_LEFT>); + else sort(currentGridData.begin(), currentGridData.end(), sortByDate<false, SORT_ON_LEFT>); + } + + writeGrid(currentGridData); //needed to refresh gridRefUI references //set sort direction indicator on UI if (sortAscending) @@ -2104,6 +1909,8 @@ void MainDialog::OnSortLeftGrid(wxGridEvent& event) else m_grid1->setSortMarker(currentSortColumn, globalResource.bitmapSmallDown); m_grid2->setSortMarker(-1); + + sortAscending = !sortAscending; } event.Skip(); } @@ -2113,17 +1920,33 @@ void MainDialog::OnSortRightGrid(wxGridEvent& event) { static bool columnSortAscending[4] = {true, true, false, true}; - currentSortColumn = event.GetCol(); - currentGridDataPtr = ¤tGridData; + int currentSortColumn = event.GetCol(); if (0 <= currentSortColumn && currentSortColumn <= 3) { - sortAscending = columnSortAscending[currentSortColumn]; - columnSortAscending[currentSortColumn] = !columnSortAscending[currentSortColumn]; - sort(gridRefUI.begin(), gridRefUI.end(), sortGridRight); + bool& sortAscending = columnSortAscending[currentSortColumn]; - m_grid1->ForceRefresh(); - m_grid2->ForceRefresh(); - m_grid3->ForceRefresh(); + if (currentSortColumn == 0) + { + if (sortAscending) sort(currentGridData.begin(), currentGridData.end(), sortByFileName<true, SORT_ON_RIGHT>); + else sort(currentGridData.begin(), currentGridData.end(), sortByFileName<false, SORT_ON_RIGHT>); + } + else if (currentSortColumn == 1) + { + if (sortAscending) sort(currentGridData.begin(), currentGridData.end(), sortByRelativeName<true, SORT_ON_RIGHT>); + else sort(currentGridData.begin(), currentGridData.end(), sortByRelativeName<false, SORT_ON_RIGHT>); + } + else if (currentSortColumn == 2) + { + if (sortAscending) sort(currentGridData.begin(), currentGridData.end(), sortByFileSize<true, SORT_ON_RIGHT>); + else sort(currentGridData.begin(), currentGridData.end(), sortByFileSize<false, SORT_ON_RIGHT>); + } + else if (currentSortColumn == 3) + { + if (sortAscending) sort(currentGridData.begin(), currentGridData.end(), sortByDate<true, SORT_ON_RIGHT>); + else sort(currentGridData.begin(), currentGridData.end(), sortByDate<false, SORT_ON_RIGHT>); + } + + writeGrid(currentGridData); //needed to refresh gridRefUI references //set sort direction indicator on UI m_grid1->setSortMarker(-1); @@ -2131,6 +1954,8 @@ void MainDialog::OnSortRightGrid(wxGridEvent& event) m_grid2->setSortMarker(currentSortColumn, globalResource.bitmapSmallUp); else m_grid2->setSortMarker(currentSortColumn, globalResource.bitmapSmallDown); + + sortAscending = !sortAscending; } event.Skip(); } @@ -2180,26 +2005,26 @@ void MainDialog::updateStatusInformation(const GridView& visibleGrid) const FileCompareLine& refLine = currentGridData[*i]; //calculate total number of bytes for each side - if (refLine.fileDescrLeft.objType == TYPE_FILE) + if (refLine.fileDescrLeft.objType == FileDescrLine::TYPE_FILE) { filesizeLeftView+= refLine.fileDescrLeft.fileSize; ++filesOnLeftView; } - else if (refLine.fileDescrLeft.objType == TYPE_DIRECTORY) + else if (refLine.fileDescrLeft.objType == FileDescrLine::TYPE_DIRECTORY) ++foldersOnLeftView; - if (refLine.fileDescrRight.objType == TYPE_FILE) + if (refLine.fileDescrRight.objType == FileDescrLine::TYPE_FILE) { filesizeRightView+= refLine.fileDescrRight.fileSize; ++filesOnRightView; } - else if (refLine.fileDescrRight.objType == TYPE_DIRECTORY) + else if (refLine.fileDescrRight.objType == FileDescrLine::TYPE_DIRECTORY) ++foldersOnRightView; } //################################################# -// format numbers to text +//format numbers to text: -//show status information on "root" level. This cannot be accomplished in writeGrid since filesizes are already formatted for display there +//show status information on "root" level. if (foldersOnLeftView) { wxString folderCount = numberToWxString(foldersOnLeftView); @@ -2292,6 +2117,10 @@ void MainDialog::mapGridDataToUI(GridView& output, const FileCompareResult& file unsigned int currentRow = 0; for (FileCompareResult::const_iterator i = fileCmpResult.begin(); i != fileCmpResult.end(); ++i, ++currentRow) { + //hide filtered row, if corresponding option is set + if (hideFilteredElements && !i->selectedForSynchronization) + continue; + //process UI filter settings switch (i->cmpResult) { @@ -2322,11 +2151,6 @@ void MainDialog::mapGridDataToUI(GridView& output, const FileCompareResult& file default: assert (false); } - - //hide filtered row, if corresponding option is set - if (hideFilteredElements && !i->selectedForSynchronization) - continue; - output.push_back(currentRow); } @@ -2476,7 +2300,7 @@ void MainDialog::removeFolderPair(bool removeAll) CompareStatusUpdater::CompareStatusUpdater(MainDialog* dlg) : mainDialog(dlg), continueOnError(false), - currentProcess(-1) + currentProcess(StatusHandler::PROCESS_NONE) { //prevent user input during "compare", do not disable maindialog since abort-button would also be disabled //it's not nice, but works - even has the advantage that certain actions are still possible: exit, about.. @@ -2578,13 +2402,13 @@ void CompareStatusUpdater::updateStatusText(const wxString& text) } -void CompareStatusUpdater::initNewProcess(int objectsTotal, double dataTotal, int processID) +void CompareStatusUpdater::initNewProcess(int objectsTotal, double dataTotal, Process processID) { currentProcess = processID; - if (currentProcess == FreeFileSync::scanningFilesProcess) + if (currentProcess == StatusHandler::PROCESS_SCANNING) ; - else if (currentProcess == FreeFileSync::compareFileContentProcess) + else if (currentProcess == StatusHandler::PROCESS_COMPARING_CONTENT) { mainDialog->compareStatus->switchToCompareBytewise(objectsTotal, dataTotal); mainDialog->Layout(); @@ -2597,18 +2421,18 @@ void CompareStatusUpdater::initNewProcess(int objectsTotal, double dataTotal, in inline void CompareStatusUpdater::updateProcessedData(int objectsProcessed, double dataProcessed) { - if (currentProcess == FreeFileSync::scanningFilesProcess) + if (currentProcess == StatusHandler::PROCESS_SCANNING) mainDialog->compareStatus->incScannedObjects_NoUpdate(objectsProcessed); - else if (currentProcess == FreeFileSync::compareFileContentProcess) + else if (currentProcess == StatusHandler::PROCESS_COMPARING_CONTENT) mainDialog->compareStatus->incProcessedCmpData_NoUpdate(objectsProcessed, dataProcessed); else assert(false); } -int CompareStatusUpdater::reportError(const wxString& text) +ErrorHandler::Response CompareStatusUpdater::reportError(const wxString& text) { if (continueOnError) - return StatusUpdater::continueNext; + return ErrorHandler::CONTINUE_NEXT; mainDialog->compareStatus->updateStatusPanelNow(); @@ -2621,11 +2445,11 @@ int CompareStatusUpdater::reportError(const wxString& text) switch (rv) { - case ErrorDlg::continueButtonPressed: - return StatusUpdater::continueNext; - case ErrorDlg::retryButtonPressed: - return StatusUpdater::retry; - case ErrorDlg::abortButtonPressed: + case ErrorDlg::BUTTON_CONTINUE: + return ErrorHandler::CONTINUE_NEXT; + case ErrorDlg::BUTTON_RETRY: + return ErrorHandler::RETRY; + case ErrorDlg::BUTTON_ABORT: { abortionRequested = true; throw AbortThisProcess(); @@ -2634,7 +2458,7 @@ int CompareStatusUpdater::reportError(const wxString& text) assert (false); } - return StatusUpdater::continueNext; //dummy return value + return ErrorHandler::CONTINUE_NEXT; //dummy return value } @@ -2703,9 +2527,9 @@ void SyncStatusUpdater::updateStatusText(const wxString& text) } -void SyncStatusUpdater::initNewProcess(int objectsTotal, double dataTotal, int processID) +void SyncStatusUpdater::initNewProcess(int objectsTotal, double dataTotal, Process processID) { - assert (processID == FreeFileSync::synchronizeFilesProcess); + assert (processID == StatusHandler::PROCESS_SYNCHRONIZING); syncStatusFrame->resetGauge(objectsTotal, dataTotal); syncStatusFrame->setCurrentStatus(SyncStatus::SYNCHRONIZING); @@ -2719,12 +2543,12 @@ void SyncStatusUpdater::updateProcessedData(int objectsProcessed, double dataPro } -int SyncStatusUpdater::reportError(const wxString& text) +ErrorHandler::Response SyncStatusUpdater::reportError(const wxString& text) { if (continueError) { unhandledErrors.Add(text); - return StatusUpdater::continueNext; + return ErrorHandler::CONTINUE_NEXT; } wxString errorMessage = text + _("\n\nContinue with next object, retry or abort synchronization?"); @@ -2736,12 +2560,12 @@ int SyncStatusUpdater::reportError(const wxString& text) switch (rv) { - case ErrorDlg::continueButtonPressed: + case ErrorDlg::BUTTON_CONTINUE: unhandledErrors.Add(text); - return StatusUpdater::continueNext; - case ErrorDlg::retryButtonPressed: - return StatusUpdater::retry; - case ErrorDlg::abortButtonPressed: + return ErrorHandler::CONTINUE_NEXT; + case ErrorDlg::BUTTON_RETRY: + return ErrorHandler::RETRY; + case ErrorDlg::BUTTON_ABORT: { unhandledErrors.Add(text); abortionRequested = true; @@ -2749,7 +2573,7 @@ int SyncStatusUpdater::reportError(const wxString& text) } default: assert (false); - return StatusUpdater::continueNext; + return ErrorHandler::CONTINUE_NEXT; } } @@ -2824,7 +2648,7 @@ void MainDialog::OnMenuExportFileList(wxCommandEvent& event) } else { - wxMessageBox(wxString(_("Could not write to ")) + wxT("\"") + fileName + wxT("\""), _("An exception occured!"), wxOK | wxICON_ERROR); + wxMessageBox(wxString(_("Could not write to ")) + wxT("\"") + fileName + wxT("\""), _("Error"), wxOK | wxICON_ERROR); } } @@ -2832,6 +2656,15 @@ void MainDialog::OnMenuExportFileList(wxCommandEvent& event) } +void MainDialog::OnMenuAdjustFileTimes(wxCommandEvent& event) +{ + ModifyFilesDlg* modifyDlg = new ModifyFilesDlg(this, FreeFileSync::getFormattedDirectoryName(m_directoryLeft->GetValue()), 0); + modifyDlg->ShowModal(); + + event.Skip(); +} + + void MainDialog::OnMenuBatchJob(wxCommandEvent& event) { vector<FolderPair> folderPairs; @@ -2862,7 +2695,7 @@ void MainDialog::OnMenuQuit(wxCommandEvent& event) void MainDialog::OnMenuLangEnglish(wxCommandEvent& event) { - programLanguage->loadLanguageFile(wxLANGUAGE_ENGLISH); //language is a global attribute + programLanguage->setLanguage(wxLANGUAGE_ENGLISH); //language is a global attribute restartOnExit = true; Destroy(); event.Skip(); @@ -2871,7 +2704,7 @@ void MainDialog::OnMenuLangEnglish(wxCommandEvent& event) void MainDialog::OnMenuLangGerman(wxCommandEvent& event) { - programLanguage->loadLanguageFile(wxLANGUAGE_GERMAN); //language is a global attribute + programLanguage->setLanguage(wxLANGUAGE_GERMAN); //language is a global attribute restartOnExit = true; Destroy(); event.Skip(); @@ -2880,7 +2713,7 @@ void MainDialog::OnMenuLangGerman(wxCommandEvent& event) void MainDialog::OnMenuLangFrench(wxCommandEvent& event) { - programLanguage->loadLanguageFile(wxLANGUAGE_FRENCH); //language is a global attribute + programLanguage->setLanguage(wxLANGUAGE_FRENCH); //language is a global attribute restartOnExit = true; Destroy(); event.Skip(); @@ -2889,7 +2722,16 @@ void MainDialog::OnMenuLangFrench(wxCommandEvent& event) void MainDialog::OnMenuLangJapanese(wxCommandEvent& event) { - programLanguage->loadLanguageFile(wxLANGUAGE_JAPANESE); //language is a global attribute + programLanguage->setLanguage(wxLANGUAGE_JAPANESE); //language is a global attribute + restartOnExit = true; + Destroy(); + event.Skip(); +} + + +void MainDialog::OnMenuLangDutch(wxCommandEvent& event) +{ + programLanguage->setLanguage(wxLANGUAGE_DUTCH); //language is a global attribute restartOnExit = true; Destroy(); event.Skip(); diff --git a/ui/MainDialog.h b/ui/MainDialog.h index 908434ea..e3f72e03 100644 --- a/ui/MainDialog.h +++ b/ui/MainDialog.h @@ -19,6 +19,7 @@ #include <wx/dnd.h> #include <wx/config.h> #include <stack> +#include "../library/processXml.h" using namespace std; @@ -27,8 +28,7 @@ enum ContextItem { CONTEXT_FILTER_TEMP = 10, CONTEXT_EXCLUDE_EXT, - CONTEXT_EXCLUDE_FILE, - CONTEXT_EXCLUDE_DIR, + CONTEXT_EXCLUDE_OBJ, CONTEXT_CLIPBOARD, CONTEXT_EXPLORER, CONTEXT_DELETE_FILES @@ -46,15 +46,17 @@ class MainDialog : public GuiGenerated friend class FileDropEvent; public: - MainDialog(wxFrame* frame, const wxString& cfgFileName, CustomLocale* language); + MainDialog(wxFrame* frame, const wxString& cfgFileName, CustomLocale* language, xmlAccess::XmlGlobalSettings& settings); ~MainDialog(); private: //configuration load/save - void loadDefaultConfiguration(); bool readConfigurationFromXml(const wxString& filename, bool programStartup = false); bool writeConfigurationToXml(const wxString& filename); + void readGlobalSettings(); + void writeGlobalSettings(); + void updateViewFilterButtons(); void updateFilterButton(wxBitmapButton* filterButton, bool isActive); void updateCompareButtons(); @@ -65,7 +67,7 @@ private: void removeFolderPair(bool removeAll = false); //main method for putting gridData on UI: maps data respecting current view settings - void writeGrid(const FileCompareResult& gridData, bool useUI_GridCache = false); + void writeGrid(const FileCompareResult& gridData); void mapGridDataToUI(GridView& output, const FileCompareResult& fileCmpResult); void updateStatusInformation(const GridView& output); @@ -138,6 +140,7 @@ private: //menu events void OnMenuExportFileList( wxCommandEvent& event); + void OnMenuAdjustFileTimes( wxCommandEvent& event); void OnMenuBatchJob( wxCommandEvent& event); void OnMenuAbout( wxCommandEvent& event); void OnMenuQuit( wxCommandEvent& event); @@ -145,11 +148,15 @@ private: void OnMenuLangGerman( wxCommandEvent& event); void OnMenuLangFrench( wxCommandEvent& event); void OnMenuLangJapanese( wxCommandEvent& event); + void OnMenuLangDutch( wxCommandEvent& event); void enableSynchronization(bool value); //*********************************************** - //global application variables are stored here: + //application variables are stored here: + + //global settings used by GUI and batch mode + xmlAccess::XmlGlobalSettings& globalSettings; //technical representation of grid-data FileCompareResult currentGridData; @@ -205,9 +212,14 @@ private: bool filteringInitialized; bool filteringPending; + //temporal variables used by exclude via context menu wxString exFilterCandidateExtension; - wxString exFilterCandidateFilename; - wxString exFilterCandidateDirname; + struct FilterObject + { + wxString relativeName; + FileDescrLine::ObjectType type; + }; + vector<FilterObject> exFilterCandidateObj; bool synchronizationEnabled; //determines whether synchronization should be allowed @@ -241,16 +253,16 @@ private: //classes handling sync and compare error as well as status information -class CompareStatusUpdater : public StatusUpdater +class CompareStatusUpdater : public StatusHandler { public: CompareStatusUpdater(MainDialog* dlg); ~CompareStatusUpdater(); void updateStatusText(const wxString& text); - void initNewProcess(int objectsTotal, double dataTotal, int processID); + void initNewProcess(int objectsTotal, double dataTotal, Process processID); void updateProcessedData(int objectsProcessed, double dataProcessed); - int reportError(const wxString& text); + ErrorHandler::Response reportError(const wxString& text); void forceUiRefresh(); @@ -259,20 +271,20 @@ private: MainDialog* mainDialog; bool continueOnError; - int currentProcess; + Process currentProcess; }; -class SyncStatusUpdater : public StatusUpdater +class SyncStatusUpdater : public StatusHandler { public: SyncStatusUpdater(wxWindow* dlg, bool continueOnError); ~SyncStatusUpdater(); void updateStatusText(const wxString& text); - void initNewProcess(int objectsTotal, double dataTotal, int processID); + void initNewProcess(int objectsTotal, double dataTotal, Process processID); void updateProcessedData(int objectsProcessed, double dataProcessed); - int reportError(const wxString& text); + ErrorHandler::Response reportError(const wxString& text); void forceUiRefresh(); diff --git a/ui/SmallDialogs.cpp b/ui/SmallDialogs.cpp index fd09e17a..0886bb03 100644 --- a/ui/SmallDialogs.cpp +++ b/ui/SmallDialogs.cpp @@ -1,7 +1,7 @@ #include "smallDialogs.h" #include "../library/globalFunctions.h" -//#include <fstream> #include "../library/resources.h" +#include <wx/msgdlg.h> using namespace globalFunctions; @@ -150,7 +150,7 @@ void FilterDlg::OnOK(wxCommandEvent& event) excludeFilter = m_textCtrlExclude->GetValue(); //when leaving dialog: filter and redraw grid, if filter is active - EndModal(okayButtonPressed); + EndModal(BUTTON_OKAY); } @@ -181,29 +181,29 @@ DeleteDialog::~DeleteDialog() {} void DeleteDialog::OnOK(wxCommandEvent& event) { - EndModal(okayButtonPressed); + EndModal(BUTTON_OKAY); } void DeleteDialog::OnCancel(wxCommandEvent& event) { - EndModal(cancelButtonPressed); + EndModal(BUTTON_CANCEL); } void DeleteDialog::OnClose(wxCloseEvent& event) { - EndModal(cancelButtonPressed); + EndModal(BUTTON_CANCEL); } //######################################################################################## ErrorDlg::ErrorDlg(const wxString messageText, bool& continueError) : - ErrorDlgGenerated(0), + ErrorDlgGenerated(NULL), continueOnError(continueError) { m_bitmap10->SetBitmap(*globalResource.bitmapWarning); m_textCtrl8->SetValue(messageText); - m_buttonContinue->SetFocus(); + m_buttonRetry->SetFocus(); } ErrorDlg::~ErrorDlg() {} @@ -212,31 +212,156 @@ ErrorDlg::~ErrorDlg() {} void ErrorDlg::OnClose(wxCloseEvent& event) { //continueOnError = m_checkBoxContinueError->GetValue(); -> not needed here - EndModal(abortButtonPressed); + EndModal(BUTTON_ABORT); } void ErrorDlg::OnContinue(wxCommandEvent& event) { continueOnError = m_checkBoxContinueError->GetValue(); - EndModal(continueButtonPressed); + EndModal(BUTTON_CONTINUE); } void ErrorDlg::OnRetry(wxCommandEvent& event) { //continueOnError = m_checkBoxContinueError->GetValue(); -> not needed here - EndModal(retryButtonPressed); + EndModal(BUTTON_RETRY); } void ErrorDlg::OnAbort(wxCommandEvent& event) { //continueOnError = m_checkBoxContinueError->GetValue(); -> not needed here - EndModal(abortButtonPressed); + EndModal(BUTTON_ABORT); } + + //######################################################################################## +ModifyFilesDlg::ModifyFilesDlg(wxWindow* window, const wxString& parentDirectory, const int timeShift) : + ModifyFilesDlgGenerated(window) +{ + m_dirPicker->SetPath(parentDirectory); + m_textCtrlDirectory->SetValue(parentDirectory); + m_spinCtrlTimeShift->SetValue(timeShift); + + m_buttonApply->SetFocus(); +} + + +ModifyFilesDlg::~ModifyFilesDlg() {} + + +class ModifyErrorHandler : public ErrorHandler +{ +public: + ModifyErrorHandler(bool& unsolvedErrorOccured) : + continueOnError(false), + unsolvedErrors(unsolvedErrorOccured) {} + + ~ModifyErrorHandler() {} + + Response reportError(const wxString& text) + { + if (continueOnError) + { + unsolvedErrors = true; + return ErrorHandler::CONTINUE_NEXT; + } + + ErrorDlg* errorDlg = new ErrorDlg(text, continueOnError); + + int rv = errorDlg->ShowModal(); + errorDlg->Destroy(); + switch (rv) + { + case ErrorDlg::BUTTON_CONTINUE: + unsolvedErrors = true; + return ErrorHandler::CONTINUE_NEXT; + case ErrorDlg::BUTTON_RETRY: + return ErrorHandler::RETRY; + case ErrorDlg::BUTTON_ABORT: + { + unsolvedErrors = true; + throw AbortThisProcess(); + } + default: + assert (false); + } + + return ErrorHandler::CONTINUE_NEXT; //dummy return value + } +private: + + bool continueOnError; + bool& unsolvedErrors; +}; + + +void ModifyFilesDlg::OnApply(wxCommandEvent& event) +{ + const int timeToShift = m_spinCtrlTimeShift->GetValue(); + const wxString parentDir = m_textCtrlDirectory->GetValue(); + + if (!wxDirExists(parentDir)) + { + wxMessageBox(wxString(_("Directory does not exist: ")) + wxT("\"") + parentDir + wxT("\""), _("Error"), wxOK | wxICON_ERROR); + return; + } + + bool unsolvedErrorOccured = false; //if an error is skipped a re-compare will be necessary! + try + { + ModifyErrorHandler errorHandler(unsolvedErrorOccured); + FreeFileSync::adjustModificationTimes(parentDir, timeToShift, &errorHandler); + } + catch (const AbortThisProcess& theException) + { + EndModal(0); + } + + if (unsolvedErrorOccured) + wxMessageBox(_("Unresolved errors occured during operation!"), _("Info"), wxOK); + else + wxMessageBox(_("All file times have been adjusted successfully!"), _("Info"), wxOK); + EndModal(0); +} + + +void ModifyFilesDlg::OnCancel(wxCommandEvent& event) +{ + EndModal(0); +} + + +void ModifyFilesDlg::OnClose(wxCloseEvent& event) +{ + EndModal(0); +} + + +void ModifyFilesDlg::OnWriteDirManually(wxCommandEvent& event) +{ + wxString newDir = FreeFileSync::getFormattedDirectoryName(event.GetString()); + if (wxDirExists(newDir)) + m_dirPicker->SetPath(newDir); + + event.Skip(); +} + + +void ModifyFilesDlg::OnDirSelected(wxFileDirPickerEvent& event) +{ + const wxString newPath = event.GetPath(); + m_textCtrlDirectory->SetValue(newPath); + + event.Skip(); +} + + + +//######################################################################################## /* class for calculation of remaining time: ---------------------------------------- @@ -330,9 +455,9 @@ wxLongLong RemainingTime::getRemainingTime(double processedDataSinceLastCall, in //######################################################################################## -SyncStatus::SyncStatus(StatusUpdater* updater, wxWindow* parentWindow) : +SyncStatus::SyncStatus(StatusHandler* updater, wxWindow* parentWindow) : SyncStatusDlgGenerated(parentWindow), - currentStatusUpdater(updater), + currentStatusHandler(updater), windowToDis(parentWindow), currentProcessIsRunning(true), totalData(0), @@ -403,18 +528,23 @@ void SyncStatus::updateStatusDialogNow() m_gauge1->SetValue(int(currentData * scalingFactor)); //status text - m_textCtrlInfo->SetValue(currentStatusText); + if (m_textCtrlInfo->GetValue() != currentStatusText) //avoid screen flicker + m_textCtrlInfo->SetValue(currentStatusText); //remaining objects - m_staticTextRemainingObj->SetLabel(numberToWxString(totalObjects - currentObjects)); - + const wxString remainingObjTmp = numberToWxString(totalObjects - currentObjects); + if (m_staticTextRemainingObj->GetLabel() != remainingObjTmp) //avoid screen flicker + m_staticTextRemainingObj->SetLabel(remainingObjTmp); //remaining bytes left for copy - const wxString remainingBytes = FreeFileSync::formatFilesizeToShortString(totalData - currentData); - m_staticTextDataRemaining->SetLabel(remainingBytes); + const wxString remainingBytesTmp = FreeFileSync::formatFilesizeToShortString(totalData - currentData); + if (m_staticTextDataRemaining->GetLabel() != remainingBytesTmp) //avoid screen flicker + m_staticTextDataRemaining->SetLabel(remainingBytesTmp); //time elapsed - m_staticTextTimeElapsed->SetLabel((wxTimeSpan::Milliseconds(timeElapsed.Time())).Format()); + const wxString timeElapsedTmp = (wxTimeSpan::Milliseconds(timeElapsed.Time())).Format(); + if (m_staticTextTimeElapsed->GetLabel() != timeElapsedTmp) //avoid screen flicker + m_staticTextTimeElapsed->SetLabel(timeElapsedTmp); //do the ui update bSizer28->Layout(); @@ -472,8 +602,8 @@ void SyncStatus::setCurrentStatus(SyncStatusID id) } -void SyncStatus::processHasFinished(SyncStatusID id) //essential to call this in StatusUpdater derived class destructor -{ //at the LATEST(!) to prevent access to currentStatusUpdater +void SyncStatus::processHasFinished(SyncStatusID id) //essential to call this in StatusHandler derived class destructor +{ //at the LATEST(!) to prevent access to currentStatusHandler currentProcessIsRunning = false; //enable okay and close events; may be set ONLY in this method setCurrentStatus(id); @@ -532,7 +662,7 @@ void SyncStatus::OnAbort(wxCommandEvent& event) setStatusText_NoUpdate(_("Abort requested: Waiting for current operation to finish...")); //no Layout() or UI-update here to avoid cascaded Yield()-call - currentStatusUpdater->requestAbortion(); + currentStatusHandler->requestAbortion(); } } @@ -540,7 +670,8 @@ void SyncStatus::OnAbort(wxCommandEvent& event) void SyncStatus::OnClose(wxCloseEvent& event) { processPaused = false; - if (currentProcessIsRunning) currentStatusUpdater->requestAbortion(); + if (currentProcessIsRunning) + currentStatusHandler->requestAbortion(); else Destroy(); } @@ -635,19 +766,26 @@ void CompareStatus::setStatusText_NoUpdate(const wxString& text) void CompareStatus::updateStatusPanelNow() { //status texts - m_textCtrlFilename->SetValue(currentStatusText); + if (m_textCtrlFilename->GetValue() != currentStatusText) //avoid screen flicker + m_textCtrlFilename->SetValue(currentStatusText); - m_staticTextScanned->SetLabel(numberToWxString(scannedObjects)); + //nr of scanned objects + const wxString scannedObjTmp = numberToWxString(scannedObjects); + if (m_staticTextScanned->GetLabel() != scannedObjTmp) //avoid screen flicker + m_staticTextScanned->SetLabel(scannedObjTmp); //progress indicator for "compare file content" m_gauge2->SetValue(int(processedCmpData * scalingFactorCmp)); - //remaining file to compare - m_staticTextFilesToCompare->SetLabel(numberToWxString(totalCmpObjects - processedCmpObjects)); + //remaining files left for file comparison + const wxString filesToCompareTmp = numberToWxString(totalCmpObjects - processedCmpObjects); + if (m_staticTextFilesToCompare->GetLabel() != filesToCompareTmp) //avoid screen flicker + m_staticTextFilesToCompare->SetLabel(filesToCompareTmp); //remaining bytes left for file comparison - const wxString remainingBytes = FreeFileSync::formatFilesizeToShortString(totalCmpData - processedCmpData); - m_staticTextDataToCompare->SetLabel(remainingBytes); + const wxString remainingBytesTmp = FreeFileSync::formatFilesizeToShortString(totalCmpData - processedCmpData); + if (m_staticTextDataToCompare->GetLabel() != remainingBytesTmp) //avoid screen flicker + m_staticTextDataToCompare->SetLabel(remainingBytesTmp); /* //remaining time in seconds @@ -659,7 +797,9 @@ void CompareStatus::updateStatusPanelNow() */ //time elapsed - m_staticTextTimeElapsed->SetLabel((wxTimeSpan::Milliseconds(timeElapsed.Time())).Format()); + const wxString timeElapsedTmp = (wxTimeSpan::Milliseconds(timeElapsed.Time())).Format(); + if (m_staticTextTimeElapsed->GetLabel() != timeElapsedTmp) //avoid screen flicker + m_staticTextTimeElapsed->SetLabel(timeElapsedTmp); //do the ui update bSizer42->Layout(); diff --git a/ui/SmallDialogs.h b/ui/SmallDialogs.h index b70e6105..7efb4dbe 100644 --- a/ui/SmallDialogs.h +++ b/ui/SmallDialogs.h @@ -35,7 +35,10 @@ public: FilterDlg(wxWindow* window, wxString& filterIncl, wxString& filterExcl); ~FilterDlg(); - static const int okayButtonPressed = 25; + enum + { + BUTTON_OKAY + }; private: void OnHelp(wxCommandEvent& event); @@ -55,8 +58,11 @@ public: DeleteDialog(const wxString& headerText, const wxString& messageText, wxWindow* main); ~DeleteDialog(); - static const int okayButtonPressed = 35; - static const int cancelButtonPressed = 45; + enum + { + BUTTON_OKAY, + BUTTON_CANCEL + }; private: void OnOK(wxCommandEvent& event); @@ -71,9 +77,12 @@ public: ErrorDlg(const wxString messageText, bool& continueError); ~ErrorDlg(); - static const int continueButtonPressed = 35; - static const int retryButtonPressed = 45; - static const int abortButtonPressed = 55; + enum + { + BUTTON_CONTINUE, + BUTTON_RETRY, + BUTTON_ABORT + }; private: void OnClose(wxCloseEvent& event); @@ -85,10 +94,26 @@ private: }; +class ModifyFilesDlg : public ModifyFilesDlgGenerated +{ +public: + ModifyFilesDlg(wxWindow* window, const wxString& parentDirectory, const int timeShift); + ~ModifyFilesDlg(); + +private: + void OnApply(wxCommandEvent& event); + void OnCancel(wxCommandEvent& event); + void OnClose(wxCloseEvent& event); + + void OnWriteDirManually(wxCommandEvent& event); + void OnDirSelected(wxFileDirPickerEvent& event); +}; + + class SyncStatus : public SyncStatusDlgGenerated { public: - SyncStatus(StatusUpdater* updater, wxWindow* parentWindow = NULL); + SyncStatus(StatusHandler* updater, wxWindow* parentWindow = NULL); ~SyncStatus(); enum SyncStatusID @@ -118,7 +143,7 @@ private: wxStopWatch timeElapsed; - StatusUpdater* currentStatusUpdater; + StatusHandler* currentStatusHandler; wxWindow* windowToDis; bool currentProcessIsRunning; diff --git a/ui/SyncDialog.cpp b/ui/SyncDialog.cpp index ad1c1a21..7a1d4602 100644 --- a/ui/SyncDialog.cpp +++ b/ui/SyncDialog.cpp @@ -31,11 +31,11 @@ SyncDialog::SyncDialog(wxWindow* window, //set icons for this dialog m_bpButton18->SetBitmapLabel(*globalResource.bitmapStartSync); m_bpButton18->SetBitmapDisabled(*globalResource.bitmapStartSyncDis); - m_bitmap13->SetBitmap(*globalResource.bitmapLeftOnlyDeact); - m_bitmap14->SetBitmap(*globalResource.bitmapRightOnlyDeact); - m_bitmap15->SetBitmap(*globalResource.bitmapLeftNewerDeact); - m_bitmap16->SetBitmap(*globalResource.bitmapRightNewerDeact); - m_bitmap17->SetBitmap(*globalResource.bitmapDifferentDeact); + m_bitmap13->SetBitmap(*globalResource.bitmapLeftOnly); + m_bitmap14->SetBitmap(*globalResource.bitmapRightOnly); + m_bitmap15->SetBitmap(*globalResource.bitmapLeftNewer); + m_bitmap16->SetBitmap(*globalResource.bitmapRightNewer); + m_bitmap17->SetBitmap(*globalResource.bitmapDifferent); if (synchronizationEnabled) m_bpButton18->Enable(); @@ -46,18 +46,18 @@ SyncDialog::SyncDialog(wxWindow* window, } //set radiobutton - if (localSyncConfiguration.exLeftSideOnly == SYNC_DIR_RIGHT && - localSyncConfiguration.exRightSideOnly == SYNC_DIR_RIGHT && - localSyncConfiguration.leftNewer == SYNC_DIR_RIGHT && - localSyncConfiguration.rightNewer == SYNC_DIR_RIGHT && - localSyncConfiguration.different == SYNC_DIR_RIGHT) + if ( localSyncConfiguration.exLeftSideOnly == SyncConfiguration::SYNC_DIR_RIGHT && + localSyncConfiguration.exRightSideOnly == SyncConfiguration::SYNC_DIR_RIGHT && + localSyncConfiguration.leftNewer == SyncConfiguration::SYNC_DIR_RIGHT && + localSyncConfiguration.rightNewer == SyncConfiguration::SYNC_DIR_RIGHT && + localSyncConfiguration.different == SyncConfiguration::SYNC_DIR_RIGHT) m_radioBtn1->SetValue(true); //one way -> - else if (localSyncConfiguration.exLeftSideOnly == SYNC_DIR_RIGHT && - localSyncConfiguration.exRightSideOnly == SYNC_DIR_LEFT && - localSyncConfiguration.leftNewer == SYNC_DIR_RIGHT && - localSyncConfiguration.rightNewer == SYNC_DIR_LEFT && - localSyncConfiguration.different == SYNC_DIR_NONE) + else if (localSyncConfiguration.exLeftSideOnly == SyncConfiguration::SYNC_DIR_RIGHT && + localSyncConfiguration.exRightSideOnly == SyncConfiguration::SYNC_DIR_LEFT && + localSyncConfiguration.leftNewer == SyncConfiguration::SYNC_DIR_RIGHT && + localSyncConfiguration.rightNewer == SyncConfiguration::SYNC_DIR_LEFT && + localSyncConfiguration.different == SyncConfiguration::SYNC_DIR_NONE) m_radioBtn2->SetValue(true); //two way <-> else @@ -81,81 +81,81 @@ void SyncDialog::updateConfigIcons(wxBitmapButton* button1, wxBitmapButton* button5, const SyncConfiguration& syncConfig) { - if (syncConfig.exLeftSideOnly == SYNC_DIR_RIGHT) + if (syncConfig.exLeftSideOnly == SyncConfiguration::SYNC_DIR_RIGHT) { button1->SetBitmapLabel(*globalResource.bitmapArrowRightCr); button1->SetToolTip(_("Copy from left to right")); } - else if (syncConfig.exLeftSideOnly == SYNC_DIR_LEFT) + else if (syncConfig.exLeftSideOnly == SyncConfiguration::SYNC_DIR_LEFT) { button1->SetBitmapLabel(*globalResource.bitmapDeleteLeft); button1->SetToolTip(_("Delete files/folders existing on left side only")); } - else if (syncConfig.exLeftSideOnly == SYNC_DIR_NONE) + else if (syncConfig.exLeftSideOnly == SyncConfiguration::SYNC_DIR_NONE) { button1->SetBitmapLabel(*globalResource.bitmapArrowNone); button1->SetToolTip(_("Do nothing")); } - if (syncConfig.exRightSideOnly == SYNC_DIR_RIGHT) + if (syncConfig.exRightSideOnly == SyncConfiguration::SYNC_DIR_RIGHT) { button2->SetBitmapLabel(*globalResource.bitmapDeleteRight); button2->SetToolTip(_("Delete files/folders existing on right side only")); } - else if (syncConfig.exRightSideOnly == SYNC_DIR_LEFT) + else if (syncConfig.exRightSideOnly == SyncConfiguration::SYNC_DIR_LEFT) { button2->SetBitmapLabel(*globalResource.bitmapArrowLeftCr); button2->SetToolTip(_("Copy from right to left")); } - else if (syncConfig.exRightSideOnly == SYNC_DIR_NONE) + else if (syncConfig.exRightSideOnly == SyncConfiguration::SYNC_DIR_NONE) { button2->SetBitmapLabel(*globalResource.bitmapArrowNone); button2->SetToolTip(_("Do nothing")); } - if (syncConfig.leftNewer == SYNC_DIR_RIGHT) + if (syncConfig.leftNewer == SyncConfiguration::SYNC_DIR_RIGHT) { button3->SetBitmapLabel(*globalResource.bitmapArrowRight); button3->SetToolTip(_("Copy from left to right overwriting")); } - else if (syncConfig.leftNewer == SYNC_DIR_LEFT) + else if (syncConfig.leftNewer == SyncConfiguration::SYNC_DIR_LEFT) { button3->SetBitmapLabel(*globalResource.bitmapArrowLeft); button3->SetToolTip(_("Copy from right to left overwriting")); } - else if (syncConfig.leftNewer == SYNC_DIR_NONE) + else if (syncConfig.leftNewer == SyncConfiguration::SYNC_DIR_NONE) { button3->SetBitmapLabel(*globalResource.bitmapArrowNone); button3->SetToolTip(_("Do nothing")); } - if (syncConfig.rightNewer == SYNC_DIR_RIGHT) + if (syncConfig.rightNewer == SyncConfiguration::SYNC_DIR_RIGHT) { button4->SetBitmapLabel(*globalResource.bitmapArrowRight); button4->SetToolTip(_("Copy from left to right overwriting")); } - else if (syncConfig.rightNewer == SYNC_DIR_LEFT) + else if (syncConfig.rightNewer == SyncConfiguration::SYNC_DIR_LEFT) { button4->SetBitmapLabel(*globalResource.bitmapArrowLeft); button4->SetToolTip(_("Copy from right to left overwriting")); } - else if (syncConfig.rightNewer == SYNC_DIR_NONE) + else if (syncConfig.rightNewer == SyncConfiguration::SYNC_DIR_NONE) { button4->SetBitmapLabel(*globalResource.bitmapArrowNone); button4->SetToolTip(_("Do nothing")); } - if (syncConfig.different == SYNC_DIR_RIGHT) + if (syncConfig.different == SyncConfiguration::SYNC_DIR_RIGHT) { button5->SetBitmapLabel(*globalResource.bitmapArrowRight); button5->SetToolTip(_("Copy from left to right overwriting")); } - else if (syncConfig.different == SYNC_DIR_LEFT) + else if (syncConfig.different == SyncConfiguration::SYNC_DIR_LEFT) { button5->SetBitmapLabel(*globalResource.bitmapArrowLeft); button5->SetToolTip(_("Copy from right to left overwriting")); } - else if (syncConfig.different == SYNC_DIR_NONE) + else if (syncConfig.different == SyncConfiguration::SYNC_DIR_NONE) { button5->SetBitmapLabel(*globalResource.bitmapArrowNone); button5->SetToolTip(_("Do nothing")); @@ -257,11 +257,11 @@ void SyncDialog::OnSelectRecycleBin(wxCommandEvent& event) void SyncDialog::OnSyncLeftToRight(wxCommandEvent& event) { - localSyncConfiguration.exLeftSideOnly = SYNC_DIR_RIGHT; - localSyncConfiguration.exRightSideOnly = SYNC_DIR_RIGHT; - localSyncConfiguration.leftNewer = SYNC_DIR_RIGHT; - localSyncConfiguration.rightNewer = SYNC_DIR_RIGHT; - localSyncConfiguration.different = SYNC_DIR_RIGHT; + localSyncConfiguration.exLeftSideOnly = SyncConfiguration::SYNC_DIR_RIGHT; + localSyncConfiguration.exRightSideOnly = SyncConfiguration::SYNC_DIR_RIGHT; + localSyncConfiguration.leftNewer = SyncConfiguration::SYNC_DIR_RIGHT; + localSyncConfiguration.rightNewer = SyncConfiguration::SYNC_DIR_RIGHT; + localSyncConfiguration.different = SyncConfiguration::SYNC_DIR_RIGHT; updateConfigIcons(m_bpButton5, m_bpButton6, m_bpButton7, m_bpButton8, m_bpButton9, localSyncConfiguration); calculatePreview(); @@ -273,11 +273,11 @@ void SyncDialog::OnSyncLeftToRight(wxCommandEvent& event) void SyncDialog::OnSyncBothSides(wxCommandEvent& event) { - localSyncConfiguration.exLeftSideOnly = SYNC_DIR_RIGHT; - localSyncConfiguration.exRightSideOnly = SYNC_DIR_LEFT; - localSyncConfiguration.leftNewer = SYNC_DIR_RIGHT; - localSyncConfiguration.rightNewer = SYNC_DIR_LEFT; - localSyncConfiguration.different = SYNC_DIR_NONE; + localSyncConfiguration.exLeftSideOnly = SyncConfiguration::SYNC_DIR_RIGHT; + localSyncConfiguration.exRightSideOnly = SyncConfiguration::SYNC_DIR_LEFT; + localSyncConfiguration.leftNewer = SyncConfiguration::SYNC_DIR_RIGHT; + localSyncConfiguration.rightNewer = SyncConfiguration::SYNC_DIR_LEFT; + localSyncConfiguration.different = SyncConfiguration::SYNC_DIR_NONE; updateConfigIcons(m_bpButton5, m_bpButton6, m_bpButton7, m_bpButton8, m_bpButton9, localSyncConfiguration); calculatePreview(); @@ -287,14 +287,14 @@ void SyncDialog::OnSyncBothSides(wxCommandEvent& event) } -void toggleSyncDirection(SyncDirection& current) +void toggleSyncDirection(SyncConfiguration::Direction& current) { - if (current == SYNC_DIR_RIGHT) - current = SYNC_DIR_LEFT; - else if (current == SYNC_DIR_LEFT) - current = SYNC_DIR_NONE; - else if (current== SYNC_DIR_NONE) - current = SYNC_DIR_RIGHT; + if (current == SyncConfiguration::SYNC_DIR_RIGHT) + current = SyncConfiguration::SYNC_DIR_LEFT; + else if (current == SyncConfiguration::SYNC_DIR_LEFT) + current = SyncConfiguration::SYNC_DIR_NONE; + else if (current== SyncConfiguration::SYNC_DIR_NONE) + current = SyncConfiguration::SYNC_DIR_RIGHT; else assert (false); } @@ -403,11 +403,11 @@ BatchDialog::BatchDialog(wxWindow* window, //set icons for this dialog - m_bitmap13->SetBitmap(*globalResource.bitmapLeftOnlyDeact); - m_bitmap14->SetBitmap(*globalResource.bitmapRightOnlyDeact); - m_bitmap15->SetBitmap(*globalResource.bitmapLeftNewerDeact); - m_bitmap16->SetBitmap(*globalResource.bitmapRightNewerDeact); - m_bitmap17->SetBitmap(*globalResource.bitmapDifferentDeact); + m_bitmap13->SetBitmap(*globalResource.bitmapLeftOnly); + m_bitmap14->SetBitmap(*globalResource.bitmapRightOnly); + m_bitmap15->SetBitmap(*globalResource.bitmapLeftNewer); + m_bitmap16->SetBitmap(*globalResource.bitmapRightNewer); + m_bitmap17->SetBitmap(*globalResource.bitmapDifferent); m_bitmap8->SetBitmap(*globalResource.bitmapInclude); m_bitmap9->SetBitmap(*globalResource.bitmapExclude); @@ -542,31 +542,28 @@ void BatchDialog::OnCreateBatchJob(wxCommandEvent& event) //create batch file if (createBatchFile(fileName)) EndModal(batchFileCreated); - else - wxMessageBox(wxString(_("Could not create file ")) + wxT("\"") + fileName + wxT("\""), _("Error"), wxOK | wxICON_ERROR); } } bool BatchDialog::createBatchFile(const wxString& filename) { - XmlOutput outputFile(filename, XML_BATCH_CONFIG); + XmlBatchConfig batchCfg; //load structure with basic settings "mainCfg" - XmlMainConfig mainCfg; if (m_radioBtnSizeDate->GetValue()) - mainCfg.cfg.compareVar = CMP_BY_TIME_SIZE; + batchCfg.mainCfg.compareVar = CMP_BY_TIME_SIZE; else if (m_radioBtnContent->GetValue()) - mainCfg.cfg.compareVar = CMP_BY_CONTENT; + batchCfg.mainCfg.compareVar = CMP_BY_CONTENT; else return false; - mainCfg.cfg.syncConfiguration = localSyncConfiguration; - mainCfg.cfg.filterIsActive = filterIsActive; - mainCfg.cfg.includeFilter = m_textCtrlInclude->GetValue(); - mainCfg.cfg.excludeFilter = m_textCtrlExclude->GetValue(); - mainCfg.cfg.useRecycleBin = m_checkBoxUseRecycler->GetValue(); - mainCfg.cfg.continueOnError = m_checkBoxContinueError->GetValue(); + batchCfg.mainCfg.syncConfiguration = localSyncConfiguration; + batchCfg.mainCfg.filterIsActive = filterIsActive; + batchCfg.mainCfg.includeFilter = m_textCtrlInclude->GetValue(); + batchCfg.mainCfg.excludeFilter = m_textCtrlExclude->GetValue(); + batchCfg.mainCfg.useRecycleBin = m_checkBoxUseRecycler->GetValue(); + batchCfg.mainCfg.continueOnError = m_checkBoxContinueError->GetValue(); for (unsigned int i = 0; i < localFolderPairs.size(); ++i) { @@ -574,20 +571,23 @@ bool BatchDialog::createBatchFile(const wxString& filename) newPair.leftDirectory = localFolderPairs[i]->m_directoryLeft->GetValue(); newPair.rightDirectory = localFolderPairs[i]->m_directoryRight->GetValue(); - mainCfg.directoryPairs.push_back(newPair); + batchCfg.directoryPairs.push_back(newPair); } //load structure with batch settings "batchCfg" - XmlBatchConfig batchCfg; batchCfg.silent = m_checkBoxSilent->GetValue(); - //populate and write XML tree - if ( !outputFile.writeXmlMainConfig(mainCfg) || //add basic configuration settings - !outputFile.writeXmlBatchConfig(batchCfg) || //add batch configuration settings - !outputFile.writeToFile()) //save XML + //write config to XML + try + { + xmlAccess::writeBatchConfig(filename, batchCfg); + } + catch (const FileError& error) + { + wxMessageBox(error.show(), _("Error"), wxOK | wxICON_ERROR); return false; - else - return true; + } + return true; } diff --git a/ui/guiGenerated.cpp b/ui/guiGenerated.cpp index 06f82d9f..e78dc2e9 100644 --- a/ui/guiGenerated.cpp +++ b/ui/guiGenerated.cpp @@ -17,6 +17,16 @@ GuiGenerated::GuiGenerated( wxWindow* parent, wxWindowID id, const wxString& tit m_menubar1 = new wxMenuBar( 0 ); m_menu1 = new wxMenu(); + wxMenuItem* m_menuItem10; + m_menuItem10 = new wxMenuItem( m_menu1, wxID_ANY, wxString( _("1. &Compare") ) + wxT('\t') + wxT("ALT-C"), wxEmptyString, wxITEM_NORMAL ); + m_menu1->Append( m_menuItem10 ); + + wxMenuItem* m_menuItem11; + m_menuItem11 = new wxMenuItem( m_menu1, wxID_ANY, wxString( _("2. &Synchronize...") ) + wxT('\t') + wxT("ALT-S"), wxEmptyString, wxITEM_NORMAL ); + m_menu1->Append( m_menuItem11 ); + + m_menu1->AppendSeparator(); + wxMenuItem* m_menuItem4; m_menuItem4 = new wxMenuItem( m_menu1, wxID_EXIT, wxString( _("&Quit") ) + wxT('\t') + wxT("CTRL-Q"), wxEmptyString, wxITEM_NORMAL ); m_menu1->Append( m_menuItem4 ); @@ -24,20 +34,19 @@ GuiGenerated::GuiGenerated( wxWindow* parent, wxWindowID id, const wxString& tit m_menubar1->Append( m_menu1, _("&File") ); m_menu3 = new wxMenu(); - wxMenuItem* m_menuItem5; - m_menuItem5 = new wxMenuItem( m_menu3, wxID_ANY, wxString( _("&Export file list") ) , wxEmptyString, wxITEM_NORMAL ); - m_menu3->Append( m_menuItem5 ); - m_menu31 = new wxMenu(); - m_menuItemEnglish = new wxMenuItem( m_menu31, wxID_ANY, wxString( _("English") ) , wxEmptyString, wxITEM_RADIO ); - m_menu31->Append( m_menuItemEnglish ); - m_menuItemGerman = new wxMenuItem( m_menu31, wxID_ANY, wxString( _("Deutsch") ) , wxEmptyString, wxITEM_RADIO ); m_menu31->Append( m_menuItemGerman ); + m_menuItemEnglish = new wxMenuItem( m_menu31, wxID_ANY, wxString( _("English") ) , wxEmptyString, wxITEM_RADIO ); + m_menu31->Append( m_menuItemEnglish ); + m_menuItemFrench = new wxMenuItem( m_menu31, wxID_ANY, wxString( _("Français") ) , wxEmptyString, wxITEM_RADIO ); m_menu31->Append( m_menuItemFrench ); + m_menuItemDutch = new wxMenuItem( m_menu31, wxID_ANY, wxString( _("Nederlands") ) , wxEmptyString, wxITEM_RADIO ); + m_menu31->Append( m_menuItemDutch ); + m_menuItemJapanese = new wxMenuItem( m_menu31, wxID_ANY, wxString( _("日本語") ) , wxEmptyString, wxITEM_RADIO ); m_menu31->Append( m_menuItemJapanese ); @@ -45,10 +54,18 @@ GuiGenerated::GuiGenerated( wxWindow* parent, wxWindowID id, const wxString& tit m_menu3->AppendSeparator(); + wxMenuItem* m_menuItem9; + m_menuItem9 = new wxMenuItem( m_menu3, wxID_ANY, wxString( _("&Adjust file times") ) , wxEmptyString, wxITEM_NORMAL ); + m_menu3->Append( m_menuItem9 ); + wxMenuItem* m_menuItem7; m_menuItem7 = new wxMenuItem( m_menu3, wxID_ANY, wxString( _("&Create batch job") ) , wxEmptyString, wxITEM_NORMAL ); m_menu3->Append( m_menuItem7 ); + wxMenuItem* m_menuItem5; + m_menuItem5 = new wxMenuItem( m_menu3, wxID_ANY, wxString( _("&Export file list") ) , wxEmptyString, wxITEM_NORMAL ); + m_menu3->Append( m_menuItem5 ); + m_menubar1->Append( m_menu3, _("&Advanced") ); m_menu2 = new wxMenu(); @@ -101,7 +118,7 @@ GuiGenerated::GuiGenerated( wxWindow* parent, wxWindowID id, const wxString& tit m_radioBtnSizeDate = new wxRadioButton( m_panel71, wxID_ANY, _("File size and date"), wxDefaultPosition, wxDefaultSize, 0 ); m_radioBtnSizeDate->SetValue( true ); - m_radioBtnSizeDate->SetToolTip( _("Files are found equal if\n - filesize\n - last write time (UTC) and date\nare the same.") ); + m_radioBtnSizeDate->SetToolTip( _("Files are found equal if\n - filesize\n - last write time and date\nare the same.") ); bSizer45->Add( m_radioBtnSizeDate, 0, 0, 5 ); @@ -420,45 +437,21 @@ GuiGenerated::GuiGenerated( wxWindow* parent, wxWindowID id, const wxString& tit sbSizer31->Add( 0, 0, 1, wxEXPAND, 5 ); m_bpButtonLeftOnly = new wxBitmapButton( m_panel12, wxID_ANY, wxNullBitmap, wxDefaultPosition, wxSize( 40,40 ), wxBU_AUTODRAW ); - m_bpButtonLeftOnly->SetToolTip( _("Show files that exist on left side only") ); - - m_bpButtonLeftOnly->SetToolTip( _("Show files that exist on left side only") ); - sbSizer31->Add( m_bpButtonLeftOnly, 0, wxALIGN_CENTER_VERTICAL, 5 ); m_bpButtonLeftNewer = new wxBitmapButton( m_panel12, wxID_ANY, wxNullBitmap, wxDefaultPosition, wxSize( 40,40 ), wxBU_AUTODRAW ); - m_bpButtonLeftNewer->SetToolTip( _("Show files that are newer on left") ); - - m_bpButtonLeftNewer->SetToolTip( _("Show files that are newer on left") ); - sbSizer31->Add( m_bpButtonLeftNewer, 0, wxALIGN_CENTER_VERTICAL, 5 ); m_bpButtonEqual = new wxBitmapButton( m_panel12, wxID_ANY, wxNullBitmap, wxDefaultPosition, wxSize( 40,40 ), wxBU_AUTODRAW ); - m_bpButtonEqual->SetToolTip( _("Show files that are equal") ); - - m_bpButtonEqual->SetToolTip( _("Show files that are equal") ); - sbSizer31->Add( m_bpButtonEqual, 0, wxALIGN_CENTER_VERTICAL, 5 ); m_bpButtonDifferent = new wxBitmapButton( m_panel12, wxID_ANY, wxNullBitmap, wxDefaultPosition, wxSize( 40,40 ), wxBU_AUTODRAW ); - m_bpButtonDifferent->SetToolTip( _("Show files that are different") ); - - m_bpButtonDifferent->SetToolTip( _("Show files that are different") ); - sbSizer31->Add( m_bpButtonDifferent, 0, wxALIGN_CENTER_VERTICAL, 5 ); m_bpButtonRightNewer = new wxBitmapButton( m_panel12, wxID_ANY, wxNullBitmap, wxDefaultPosition, wxSize( 40,40 ), wxBU_AUTODRAW ); - m_bpButtonRightNewer->SetToolTip( _("Show files that are newer on right") ); - - m_bpButtonRightNewer->SetToolTip( _("Show files that are newer on right") ); - sbSizer31->Add( m_bpButtonRightNewer, 0, wxALIGN_CENTER_VERTICAL, 5 ); m_bpButtonRightOnly = new wxBitmapButton( m_panel12, wxID_ANY, wxNullBitmap, wxDefaultPosition, wxSize( 40,40 ), wxBU_AUTODRAW ); - m_bpButtonRightOnly->SetToolTip( _("Show files that exist on right side only") ); - - m_bpButtonRightOnly->SetToolTip( _("Show files that exist on right side only") ); - sbSizer31->Add( m_bpButtonRightOnly, 0, wxALIGN_CENTER_VERTICAL, 5 ); @@ -557,13 +550,17 @@ GuiGenerated::GuiGenerated( wxWindow* parent, wxWindowID id, const wxString& tit // Connect Events this->Connect( wxEVT_CLOSE_WINDOW, wxCloseEventHandler( GuiGenerated::OnClose ) ); + this->Connect( m_menuItem10->GetId(), wxEVT_COMMAND_MENU_SELECTED, wxCommandEventHandler( GuiGenerated::OnCompare ) ); + this->Connect( m_menuItem11->GetId(), wxEVT_COMMAND_MENU_SELECTED, wxCommandEventHandler( GuiGenerated::OnSync ) ); this->Connect( m_menuItem4->GetId(), wxEVT_COMMAND_MENU_SELECTED, wxCommandEventHandler( GuiGenerated::OnMenuQuit ) ); - this->Connect( m_menuItem5->GetId(), wxEVT_COMMAND_MENU_SELECTED, wxCommandEventHandler( GuiGenerated::OnMenuExportFileList ) ); - this->Connect( m_menuItemEnglish->GetId(), wxEVT_COMMAND_MENU_SELECTED, wxCommandEventHandler( GuiGenerated::OnMenuLangEnglish ) ); this->Connect( m_menuItemGerman->GetId(), wxEVT_COMMAND_MENU_SELECTED, wxCommandEventHandler( GuiGenerated::OnMenuLangGerman ) ); + this->Connect( m_menuItemEnglish->GetId(), wxEVT_COMMAND_MENU_SELECTED, wxCommandEventHandler( GuiGenerated::OnMenuLangEnglish ) ); this->Connect( m_menuItemFrench->GetId(), wxEVT_COMMAND_MENU_SELECTED, wxCommandEventHandler( GuiGenerated::OnMenuLangFrench ) ); + this->Connect( m_menuItemDutch->GetId(), wxEVT_COMMAND_MENU_SELECTED, wxCommandEventHandler( GuiGenerated::OnMenuLangDutch ) ); this->Connect( m_menuItemJapanese->GetId(), wxEVT_COMMAND_MENU_SELECTED, wxCommandEventHandler( GuiGenerated::OnMenuLangJapanese ) ); + this->Connect( m_menuItem9->GetId(), wxEVT_COMMAND_MENU_SELECTED, wxCommandEventHandler( GuiGenerated::OnMenuAdjustFileTimes ) ); this->Connect( m_menuItem7->GetId(), wxEVT_COMMAND_MENU_SELECTED, wxCommandEventHandler( GuiGenerated::OnMenuBatchJob ) ); + this->Connect( m_menuItem5->GetId(), wxEVT_COMMAND_MENU_SELECTED, wxCommandEventHandler( GuiGenerated::OnMenuExportFileList ) ); this->Connect( m_menuItem3->GetId(), wxEVT_COMMAND_MENU_SELECTED, wxCommandEventHandler( GuiGenerated::OnMenuAbout ) ); m_bpButtonCompare->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( GuiGenerated::OnCompare ), NULL, this ); m_buttonAbort->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( GuiGenerated::OnAbortCompare ), NULL, this ); @@ -604,13 +601,17 @@ GuiGenerated::~GuiGenerated() { // Disconnect Events this->Disconnect( wxEVT_CLOSE_WINDOW, wxCloseEventHandler( GuiGenerated::OnClose ) ); + this->Disconnect( wxID_ANY, wxEVT_COMMAND_MENU_SELECTED, wxCommandEventHandler( GuiGenerated::OnCompare ) ); + this->Disconnect( wxID_ANY, wxEVT_COMMAND_MENU_SELECTED, wxCommandEventHandler( GuiGenerated::OnSync ) ); this->Disconnect( wxID_ANY, wxEVT_COMMAND_MENU_SELECTED, wxCommandEventHandler( GuiGenerated::OnMenuQuit ) ); - this->Disconnect( wxID_ANY, wxEVT_COMMAND_MENU_SELECTED, wxCommandEventHandler( GuiGenerated::OnMenuExportFileList ) ); - this->Disconnect( wxID_ANY, wxEVT_COMMAND_MENU_SELECTED, wxCommandEventHandler( GuiGenerated::OnMenuLangEnglish ) ); this->Disconnect( wxID_ANY, wxEVT_COMMAND_MENU_SELECTED, wxCommandEventHandler( GuiGenerated::OnMenuLangGerman ) ); + this->Disconnect( wxID_ANY, wxEVT_COMMAND_MENU_SELECTED, wxCommandEventHandler( GuiGenerated::OnMenuLangEnglish ) ); this->Disconnect( wxID_ANY, wxEVT_COMMAND_MENU_SELECTED, wxCommandEventHandler( GuiGenerated::OnMenuLangFrench ) ); + this->Disconnect( wxID_ANY, wxEVT_COMMAND_MENU_SELECTED, wxCommandEventHandler( GuiGenerated::OnMenuLangDutch ) ); this->Disconnect( wxID_ANY, wxEVT_COMMAND_MENU_SELECTED, wxCommandEventHandler( GuiGenerated::OnMenuLangJapanese ) ); + this->Disconnect( wxID_ANY, wxEVT_COMMAND_MENU_SELECTED, wxCommandEventHandler( GuiGenerated::OnMenuAdjustFileTimes ) ); this->Disconnect( wxID_ANY, wxEVT_COMMAND_MENU_SELECTED, wxCommandEventHandler( GuiGenerated::OnMenuBatchJob ) ); + this->Disconnect( wxID_ANY, wxEVT_COMMAND_MENU_SELECTED, wxCommandEventHandler( GuiGenerated::OnMenuExportFileList ) ); this->Disconnect( wxID_ANY, wxEVT_COMMAND_MENU_SELECTED, wxCommandEventHandler( GuiGenerated::OnMenuAbout ) ); m_bpButtonCompare->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( GuiGenerated::OnCompare ), NULL, this ); m_buttonAbort->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( GuiGenerated::OnAbortCompare ), NULL, this ); @@ -737,7 +738,7 @@ BatchDlgGenerated::BatchDlgGenerated( wxWindow* parent, wxWindowID id, const wxS m_staticText54->Wrap( 380 ); m_staticText54->SetFont( wxFont( wxNORMAL_FONT->GetPointSize(), 70, 90, 90, false, wxT("Tahoma") ) ); - bSizer69->Add( m_staticText54, 0, wxALL|wxALIGN_CENTER_HORIZONTAL, 5 ); + bSizer69->Add( m_staticText54, 0, wxALIGN_CENTER_HORIZONTAL|wxALL, 5 ); bSizer69->Add( 0, 5, 0, 0, 5 ); @@ -777,7 +778,7 @@ BatchDlgGenerated::BatchDlgGenerated( wxWindow* parent, wxWindowID id, const wxS m_radioBtnSizeDate = new wxRadioButton( this, wxID_ANY, _("File size and date"), wxDefaultPosition, wxDefaultSize, 0 ); m_radioBtnSizeDate->SetValue( true ); - m_radioBtnSizeDate->SetToolTip( _("Files are found equal if\n - filesize\n - last write time (UTC) and date\nare the same.") ); + m_radioBtnSizeDate->SetToolTip( _("Files are found equal if\n - filesize\n - last write time and date\nare the same.") ); sbSizer6->Add( m_radioBtnSizeDate, 0, 0, 5 ); @@ -975,7 +976,7 @@ BatchDlgGenerated::BatchDlgGenerated( wxWindow* parent, wxWindowID id, const wxS bSizer69->Add( bSizer68, 0, wxALIGN_CENTER_HORIZONTAL, 5 ); - bSizer54->Add( bSizer69, 0, wxALL|wxALIGN_CENTER_HORIZONTAL, 5 ); + bSizer54->Add( bSizer69, 0, wxALIGN_CENTER_HORIZONTAL|wxALL, 5 ); this->SetSizer( bSizer54 ); this->Layout(); @@ -1705,7 +1706,7 @@ HelpDlgGenerated::HelpDlgGenerated( wxWindow* parent, wxWindowID id, const wxStr m_staticText56->Wrap( -1 ); m_staticText56->SetFont( wxFont( 16, 74, 90, 92, false, wxT("Tahoma") ) ); - bSizer72->Add( m_staticText56, 0, wxALIGN_CENTER_HORIZONTAL|wxALL, 5 ); + bSizer72->Add( m_staticText56, 0, wxALIGN_CENTER_HORIZONTAL|wxALL|wxALIGN_CENTER_VERTICAL, 5 ); bSizer72->Add( 20, 0, 0, 0, 5 ); @@ -1922,7 +1923,7 @@ AboutDlgGenerated::AboutDlgGenerated( wxWindow* parent, wxWindowID id, const wxS m_scrolledWindow3 = new wxScrolledWindow( this, wxID_ANY, wxDefaultPosition, wxSize( -1,-1 ), wxDOUBLE_BORDER|wxHSCROLL|wxVSCROLL ); m_scrolledWindow3->SetScrollRate( 5, 5 ); m_scrolledWindow3->SetBackgroundColour( wxSystemSettings::GetColour( wxSYS_COLOUR_ACTIVEBORDER ) ); - m_scrolledWindow3->SetMinSize( wxSize( -1,70 ) ); + m_scrolledWindow3->SetMinSize( wxSize( -1,90 ) ); m_scrolledWindow3->SetMaxSize( wxSize( -1,100 ) ); wxBoxSizer* bSizer72; @@ -1941,19 +1942,27 @@ AboutDlgGenerated::AboutDlgGenerated( wxWindow* parent, wxWindowID id, const wxS m_staticText68 = new wxStaticText( m_scrolledWindow3, wxID_ANY, _("Jean-François Hartmann"), wxDefaultPosition, wxDefaultSize, 0 ); m_staticText68->Wrap( -1 ); - fgSizer9->Add( m_staticText68, 0, 0, 5 ); + fgSizer9->Add( m_staticText68, 0, wxALIGN_CENTER_VERTICAL, 5 ); m_staticText69 = new wxStaticText( m_scrolledWindow3, wxID_ANY, _("Français"), wxDefaultPosition, wxDefaultSize, 0 ); m_staticText69->Wrap( -1 ); - fgSizer9->Add( m_staticText69, 0, 0, 5 ); + fgSizer9->Add( m_staticText69, 0, wxALIGN_CENTER_VERTICAL, 5 ); m_staticText70 = new wxStaticText( m_scrolledWindow3, wxID_ANY, _("Tilt"), wxDefaultPosition, wxDefaultSize, 0 ); m_staticText70->Wrap( -1 ); - fgSizer9->Add( m_staticText70, 0, 0, 5 ); + fgSizer9->Add( m_staticText70, 0, wxALIGN_CENTER_VERTICAL, 5 ); m_staticText71 = new wxStaticText( m_scrolledWindow3, wxID_ANY, _("日本語"), wxDefaultPosition, wxDefaultSize, 0 ); m_staticText71->Wrap( -1 ); - fgSizer9->Add( m_staticText71, 0, 0, 5 ); + fgSizer9->Add( m_staticText71, 0, wxALIGN_CENTER_VERTICAL, 5 ); + + m_staticText711 = new wxStaticText( m_scrolledWindow3, wxID_ANY, _("M.D. Vrakking"), wxDefaultPosition, wxDefaultSize, 0 ); + m_staticText711->Wrap( -1 ); + fgSizer9->Add( m_staticText711, 0, wxALIGN_CENTER_VERTICAL, 5 ); + + m_staticText712 = new wxStaticText( m_scrolledWindow3, wxID_ANY, _("Nederlands"), wxDefaultPosition, wxDefaultSize, 0 ); + m_staticText712->Wrap( -1 ); + fgSizer9->Add( m_staticText712, 0, wxALIGN_CENTER_VERTICAL, 5 ); bSizer72->Add( fgSizer9, 0, wxALIGN_CENTER_HORIZONTAL|wxBOTTOM, 5 ); @@ -2108,12 +2117,12 @@ ErrorDlgGenerated::ErrorDlgGenerated( wxWindow* parent, wxWindowID id, const wxS bSizer25 = new wxBoxSizer( wxHORIZONTAL ); m_buttonContinue = new wxButton( this, wxID_OK, _("&Continue"), wxDefaultPosition, wxSize( -1,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_RETRY, _("&Retry"), wxDefaultPosition, wxSize( -1,30 ), 0 ); + m_buttonRetry->SetDefault(); m_buttonRetry->SetFont( wxFont( 10, 74, 90, 90, false, wxT("Tahoma") ) ); bSizer25->Add( m_buttonRetry, 0, wxTOP|wxBOTTOM|wxLEFT, 5 ); @@ -2271,9 +2280,21 @@ FilterDlgGenerated::FilterDlgGenerated( wxWindow* parent, wxWindowID id, const w bSizer52->Add( m_staticText45, 0, wxBOTTOM, 5 ); - m_staticText18 = new wxStaticText( m_panel13, wxID_ANY, _("1. Enter full file or directory names separated by ';' or a new line.\n2. Use wildcard characters '*' and '?'."), wxDefaultPosition, wxDefaultSize, 0 ); - m_staticText18->Wrap( -1 ); - bSizer52->Add( m_staticText18, 0, wxBOTTOM, 5 ); + m_staticText83 = new wxStaticText( m_panel13, wxID_ANY, _("1. Enter full file or directory names separated by ';' or a new line."), wxDefaultPosition, wxDefaultSize, 0 ); + m_staticText83->Wrap( -1 ); + bSizer52->Add( m_staticText83, 0, 0, 5 ); + + m_staticText84 = new wxStaticText( m_panel13, wxID_ANY, _("2. Use wildcard characters '*' and '?'."), wxDefaultPosition, wxDefaultSize, 0 ); + m_staticText84->Wrap( -1 ); + bSizer52->Add( m_staticText84, 0, 0, 5 ); + + m_staticText85 = new wxStaticText( m_panel13, wxID_ANY, _("3. Exclude files directly on main grid via context menu."), wxDefaultPosition, wxDefaultSize, 0 ); + m_staticText85->Wrap( -1 ); + bSizer52->Add( m_staticText85, 0, 0, 5 ); + + m_staticText86 = new wxStaticText( m_panel13, wxID_ANY, _("4. Keep the number of entries small for best performance."), wxDefaultPosition, wxDefaultSize, 0 ); + m_staticText86->Wrap( -1 ); + bSizer52->Add( m_staticText86, 0, wxBOTTOM, 5 ); bSizer69->Add( bSizer52, 0, wxALIGN_CENTER_HORIZONTAL, 5 ); @@ -2399,3 +2420,115 @@ FilterDlgGenerated::~FilterDlgGenerated() m_button17->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( FilterDlgGenerated::OnCancel ), NULL, this ); m_button10->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( FilterDlgGenerated::OnOK ), NULL, this ); } + +ModifyFilesDlgGenerated::ModifyFilesDlgGenerated( 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* bSizer80; + bSizer80 = new wxBoxSizer( wxVERTICAL ); + + m_panel8 = new wxPanel( this, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxSIMPLE_BORDER|wxTAB_TRAVERSAL ); + m_panel8->SetBackgroundColour( wxSystemSettings::GetColour( wxSYS_COLOUR_3DLIGHT ) ); + + wxBoxSizer* bSizer72; + bSizer72 = new wxBoxSizer( wxVERTICAL ); + + + bSizer72->Add( 20, 0, 0, 0, 5 ); + + m_staticText56 = new wxStaticText( m_panel8, wxID_ANY, _("Adjust file times"), wxDefaultPosition, wxDefaultSize, 0 ); + m_staticText56->Wrap( -1 ); + m_staticText56->SetFont( wxFont( 16, 74, 90, 92, false, wxT("Tahoma") ) ); + + bSizer72->Add( m_staticText56, 0, wxALIGN_CENTER_HORIZONTAL|wxALIGN_CENTER_VERTICAL|wxALL, 5 ); + + + bSizer72->Add( 20, 0, 0, 0, 5 ); + + m_panel8->SetSizer( bSizer72 ); + m_panel8->Layout(); + bSizer72->Fit( m_panel8 ); + bSizer80->Add( m_panel8, 0, wxALL|wxALIGN_CENTER_HORIZONTAL, 5 ); + + + bSizer80->Add( 0, 5, 0, wxEXPAND, 5 ); + + wxBoxSizer* bSizer84; + bSizer84 = new wxBoxSizer( wxHORIZONTAL ); + + + bSizer84->Add( 10, 0, 0, wxEXPAND, 5 ); + + m_staticTextHeader = new wxStaticText( this, wxID_ANY, _("Adjust modification times of all files contained in the specified folder and its subfolders. This manual adaption might become necessary if you are synchronizing against a FAT32 drive and the daylight saving time is switched. For an overview about the issue see this article:"), wxDefaultPosition, wxDefaultSize, 0 ); + m_staticTextHeader->Wrap( 400 ); + m_staticTextHeader->SetFont( wxFont( 8, 74, 90, 90, false, wxT("Tahoma") ) ); + + bSizer84->Add( m_staticTextHeader, 0, wxALL, 5 ); + + + bSizer84->Add( 10, 0, 0, wxEXPAND, 5 ); + + bSizer80->Add( bSizer84, 0, wxALIGN_CENTER_HORIZONTAL, 5 ); + + m_hyperlink6 = new wxHyperlinkCtrl( this, wxID_ANY, _("http://www.codeproject.com/KB/datetime/dstbugs.aspx"), wxT("http://www.codeproject.com/KB/datetime/dstbugs.aspx"), wxDefaultPosition, wxDefaultSize, wxHL_DEFAULT_STYLE ); + bSizer80->Add( m_hyperlink6, 0, wxALL|wxALIGN_CENTER_HORIZONTAL, 5 ); + + + bSizer80->Add( 0, 5, 0, wxEXPAND, 5 ); + + wxStaticBoxSizer* sbSizer24; + sbSizer24 = new wxStaticBoxSizer( new wxStaticBox( this, wxID_ANY, _("Select folder") ), wxHORIZONTAL ); + + m_textCtrlDirectory = new wxTextCtrl( this, wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0 ); + sbSizer24->Add( m_textCtrlDirectory, 1, wxALIGN_CENTER_VERTICAL|wxLEFT, 5 ); + + m_dirPicker = new wxDirPickerCtrl( this, wxID_ANY, wxEmptyString, _("Select a folder"), wxDefaultPosition, wxDefaultSize, wxDIRP_DIR_MUST_EXIST ); + sbSizer24->Add( m_dirPicker, 0, wxALIGN_CENTER_VERTICAL|wxRIGHT, 5 ); + + bSizer80->Add( sbSizer24, 0, wxEXPAND|wxALL, 5 ); + + wxStaticBoxSizer* sbSizer23; + sbSizer23 = new wxStaticBoxSizer( new wxStaticBox( this, wxID_ANY, _("Time shift in seconds") ), wxVERTICAL ); + + m_spinCtrlTimeShift = new wxSpinCtrl( this, wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, wxSP_ARROW_KEYS, -2100000000, 2100000000, 0 ); + sbSizer23->Add( m_spinCtrlTimeShift, 0, wxRIGHT|wxLEFT, 5 ); + + bSizer80->Add( sbSizer23, 0, wxALL|wxEXPAND, 5 ); + + wxBoxSizer* bSizer83; + bSizer83 = new wxBoxSizer( wxHORIZONTAL ); + + m_button21 = new wxButton( this, wxID_CANCEL, _("&Cancel"), wxDefaultPosition, wxSize( -1,30 ), 0 ); + m_button21->SetFont( wxFont( 10, 74, 90, 90, false, wxT("Tahoma") ) ); + + bSizer83->Add( m_button21, 0, wxALL|wxALIGN_CENTER_VERTICAL, 5 ); + + m_buttonApply = new wxButton( this, wxID_ANY, _("Apply"), wxDefaultPosition, wxSize( -1,35 ), 0 ); + m_buttonApply->SetFont( wxFont( 10, 74, 90, 92, false, wxT("Tahoma") ) ); + + bSizer83->Add( m_buttonApply, 0, wxALL|wxALIGN_CENTER_VERTICAL, 5 ); + + bSizer80->Add( bSizer83, 0, wxALIGN_CENTER_HORIZONTAL, 5 ); + + this->SetSizer( bSizer80 ); + this->Layout(); + bSizer80->Fit( this ); + + // Connect Events + this->Connect( wxEVT_CLOSE_WINDOW, wxCloseEventHandler( ModifyFilesDlgGenerated::OnClose ) ); + m_textCtrlDirectory->Connect( wxEVT_COMMAND_TEXT_UPDATED, wxCommandEventHandler( ModifyFilesDlgGenerated::OnWriteDirManually ), NULL, this ); + m_dirPicker->Connect( wxEVT_COMMAND_DIRPICKER_CHANGED, wxFileDirPickerEventHandler( ModifyFilesDlgGenerated::OnDirSelected ), NULL, this ); + m_button21->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( ModifyFilesDlgGenerated::OnCancel ), NULL, this ); + m_buttonApply->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( ModifyFilesDlgGenerated::OnApply ), NULL, this ); +} + +ModifyFilesDlgGenerated::~ModifyFilesDlgGenerated() +{ + // Disconnect Events + this->Disconnect( wxEVT_CLOSE_WINDOW, wxCloseEventHandler( ModifyFilesDlgGenerated::OnClose ) ); + m_textCtrlDirectory->Disconnect( wxEVT_COMMAND_TEXT_UPDATED, wxCommandEventHandler( ModifyFilesDlgGenerated::OnWriteDirManually ), NULL, this ); + m_dirPicker->Disconnect( wxEVT_COMMAND_DIRPICKER_CHANGED, wxFileDirPickerEventHandler( ModifyFilesDlgGenerated::OnDirSelected ), NULL, this ); + m_button21->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( ModifyFilesDlgGenerated::OnCancel ), NULL, this ); + m_buttonApply->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( ModifyFilesDlgGenerated::OnApply ), NULL, this ); +} diff --git a/ui/guiGenerated.h b/ui/guiGenerated.h index 7df68fd7..81875ec6 100644 --- a/ui/guiGenerated.h +++ b/ui/guiGenerated.h @@ -43,6 +43,7 @@ class CustomGrid; #include <wx/animate.h> #include <wx/treectrl.h> #include <wx/notebook.h> +#include <wx/spinctrl.h> /////////////////////////////////////////////////////////////////////////// @@ -59,9 +60,10 @@ protected: wxMenu* m_menu1; wxMenu* m_menu3; wxMenu* m_menu31; - wxMenuItem* m_menuItemEnglish; wxMenuItem* m_menuItemGerman; + wxMenuItem* m_menuItemEnglish; wxMenuItem* m_menuItemFrench; + wxMenuItem* m_menuItemDutch; wxMenuItem* m_menuItemJapanese; wxMenu* m_menu2; wxBoxSizer* bSizer1; @@ -134,15 +136,15 @@ protected: { event.Skip(); } - virtual void OnMenuQuit( wxCommandEvent& event ) + virtual void OnCompare( wxCommandEvent& event ) { event.Skip(); } - virtual void OnMenuExportFileList( wxCommandEvent& event ) + virtual void OnSync( wxCommandEvent& event ) { event.Skip(); } - virtual void OnMenuLangEnglish( wxCommandEvent& event ) + virtual void OnMenuQuit( wxCommandEvent& event ) { event.Skip(); } @@ -150,23 +152,35 @@ protected: { event.Skip(); } + virtual void OnMenuLangEnglish( wxCommandEvent& event ) + { + event.Skip(); + } virtual void OnMenuLangFrench( wxCommandEvent& event ) { event.Skip(); } + virtual void OnMenuLangDutch( wxCommandEvent& event ) + { + event.Skip(); + } virtual void OnMenuLangJapanese( wxCommandEvent& event ) { event.Skip(); } + virtual void OnMenuAdjustFileTimes( wxCommandEvent& event ) + { + event.Skip(); + } virtual void OnMenuBatchJob( wxCommandEvent& event ) { event.Skip(); } - virtual void OnMenuAbout( wxCommandEvent& event ) + virtual void OnMenuExportFileList( wxCommandEvent& event ) { event.Skip(); } - virtual void OnCompare( wxCommandEvent& event ) + virtual void OnMenuAbout( wxCommandEvent& event ) { event.Skip(); } @@ -198,10 +212,6 @@ protected: { event.Skip(); } - virtual void OnSync( wxCommandEvent& event ) - { - event.Skip(); - } virtual void OnWriteDirManually( wxCommandEvent& event ) { event.Skip(); @@ -730,6 +740,8 @@ protected: wxStaticText* m_staticText69; wxStaticText* m_staticText70; wxStaticText* m_staticText71; + wxStaticText* m_staticText711; + wxStaticText* m_staticText712; wxStaticLine* m_staticline3; wxStaticText* m_staticText131; wxStaticBitmap* m_bitmap9; @@ -862,7 +874,10 @@ protected: wxPanel* m_panel13; wxStaticLine* m_staticline10; wxStaticText* m_staticText45; - wxStaticText* m_staticText18; + wxStaticText* m_staticText83; + wxStaticText* m_staticText84; + wxStaticText* m_staticText85; + wxStaticText* m_staticText86; wxStaticText* m_staticText181; wxStaticText* m_staticText1811; @@ -908,4 +923,57 @@ public: }; +/////////////////////////////////////////////////////////////////////////////// +/// Class ModifyFilesDlgGenerated +/////////////////////////////////////////////////////////////////////////////// +class ModifyFilesDlgGenerated : public wxDialog +{ +private: + +protected: + wxPanel* m_panel8; + + wxStaticText* m_staticText56; + + + + wxStaticText* m_staticTextHeader; + + wxHyperlinkCtrl* m_hyperlink6; + + wxTextCtrl* m_textCtrlDirectory; + wxDirPickerCtrl* m_dirPicker; + wxSpinCtrl* m_spinCtrlTimeShift; + wxButton* m_button21; + wxButton* m_buttonApply; + + // Virtual event handlers, overide them in your derived class + virtual void OnClose( wxCloseEvent& event ) + { + event.Skip(); + } + virtual void OnWriteDirManually( wxCommandEvent& event ) + { + event.Skip(); + } + virtual void OnDirSelected( wxFileDirPickerEvent& event ) + { + event.Skip(); + } + virtual void OnCancel( wxCommandEvent& event ) + { + event.Skip(); + } + virtual void OnApply( wxCommandEvent& event ) + { + event.Skip(); + } + + +public: + ModifyFilesDlgGenerated( wxWindow* parent, wxWindowID id = wxID_ANY, const wxString& title = wxEmptyString, const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxDefaultSize, long style = wxDEFAULT_DIALOG_STYLE ); + ~ModifyFilesDlgGenerated(); + +}; + #endif //__guiGenerated__ |