summaryrefslogtreecommitdiff
path: root/ui
diff options
context:
space:
mode:
Diffstat (limited to 'ui')
-rw-r--r--ui/batch_config.cpp359
-rw-r--r--ui/batch_config.h84
-rw-r--r--ui/batch_status_handler.cpp64
-rw-r--r--ui/batch_status_handler.h10
-rw-r--r--ui/check_version.cpp22
-rw-r--r--ui/check_version.h2
-rw-r--r--ui/folder_pair.h22
-rw-r--r--ui/grid_view.cpp12
-rw-r--r--ui/grid_view.h14
-rw-r--r--ui/gui_generated.cpp337
-rw-r--r--ui/gui_generated.h41
-rw-r--r--ui/gui_status_handler.cpp190
-rw-r--r--ui/gui_status_handler.h24
-rw-r--r--ui/is_null_filter.h24
-rw-r--r--ui/main_dlg.cpp741
-rw-r--r--ui/main_dlg.h20
-rw-r--r--ui/msg_popup.cpp151
-rw-r--r--ui/msg_popup.h52
-rw-r--r--ui/progress_indicator.cpp120
-rw-r--r--ui/progress_indicator.h17
-rw-r--r--ui/search.cpp7
-rw-r--r--ui/search.h2
-rw-r--r--ui/small_dlgs.cpp462
-rw-r--r--ui/small_dlgs.h29
-rw-r--r--ui/sorting.h10
-rw-r--r--ui/switch_to_gui.cpp2
-rw-r--r--ui/switch_to_gui.h2
-rw-r--r--ui/sync_cfg.cpp650
-rw-r--r--ui/sync_cfg.h95
-rw-r--r--ui/tray_icon.cpp132
-rw-r--r--ui/tray_icon.h2
31 files changed, 1929 insertions, 1770 deletions
diff --git a/ui/batch_config.cpp b/ui/batch_config.cpp
index ca489916..18b8a555 100644
--- a/ui/batch_config.cpp
+++ b/ui/batch_config.cpp
@@ -13,70 +13,85 @@
#include "../shared/help_provider.h"
#include "../shared/file_handling.h"
#include "msg_popup.h"
+#include "gui_generated.h"
#include <wx/dnd.h>
#include <wx/msgdlg.h>
+#include "../shared/util.h"
#include "../shared/mouse_move_dlg.h"
-using namespace ffs3;
+using namespace zen;
+class DirectoryPairBatchFirst;
+class DirectoryPairBatch;
-class BatchFileDropEvent : public wxFileDropTarget
+
+class BatchDialog: public BatchDlgGenerated
{
+ friend class BatchFileDropEvent;
+ template <class GuiPanel>
+ friend class FolderPairCallback;
+
public:
- BatchFileDropEvent(BatchDialog& dlg) :
- batchDlg(dlg) {}
+ BatchDialog(wxWindow* window, const xmlAccess::XmlBatchConfig& batchCfg);
+ BatchDialog(wxWindow* window, const wxString& filename);
+ ~BatchDialog();
- virtual bool OnDropFiles(wxCoord x, wxCoord y, const wxArrayString& fileArray)
- {
- if (fileArray.IsEmpty())
- return false;
+private:
+ void init();
- std::vector<wxString> filenames;
- for (size_t i = 0; i < fileArray.GetCount(); ++i)
- filenames.push_back(fileArray[i]);
+ virtual void OnCmpSettings( wxCommandEvent& event);
+ virtual void OnSyncSettings( wxCommandEvent& event);
+ virtual void OnConfigureFilter( wxCommandEvent& event);
+ virtual void OnHelp( wxCommandEvent& event);
- switch (xmlAccess::getMergeType(filenames)) //throw ()
- {
- case xmlAccess::MERGE_BATCH:
- case xmlAccess::MERGE_GUI:
- case xmlAccess::MERGE_GUI_BATCH:
- if (filenames.size() == 1)
- {
- batchDlg.loadBatchFile(filenames[0]);
- return false;
- }
- else
- {
- xmlAccess::XmlBatchConfig batchCfg;
- try
- {
- convertConfig(filenames, batchCfg); //throw (xmlAccess::XmlError)
- }
- catch (const xmlAccess::XmlError& error)
- {
- if (error.getSeverity() == xmlAccess::XmlError::WARNING)
- wxMessageBox(error.msg(), _("Warning"), wxOK | wxICON_WARNING);
- else
- {
- wxMessageBox(error.msg(), _("Error"), wxOK | wxICON_ERROR);
- return false;
- }
- }
- batchDlg.loadBatchCfg(batchCfg);
- }
- break;
+ void OnGlobalFilterOpenContext(wxCommandEvent& event);
+ void OnGlobalFilterRemConfirm(wxCommandEvent& event);
+ virtual void OnCheckSilent( wxCommandEvent& event);
+ virtual void OnChangeMaxLogCountTxt(wxCommandEvent& event);
+ virtual void OnClose( wxCloseEvent& event);
+ virtual void OnCancel( wxCommandEvent& event);
+ virtual void OnSaveBatchJob( wxCommandEvent& event);
+ virtual void OnLoadBatchJob( wxCommandEvent& event);
+ virtual void OnAddFolderPair( wxCommandEvent& event);
+ virtual void OnRemoveFolderPair( wxCommandEvent& event);
+ virtual void OnRemoveTopFolderPair(wxCommandEvent& event);
+ void OnFilesDropped(FFSFileDropEvent& event);
- case xmlAccess::MERGE_OTHER:
- wxMessageBox(_("Invalid FreeFileSync config file!"), _("Error"), wxOK | wxICON_ERROR);
- break;
- }
+ void addFolderPair(const std::vector<zen::FolderPairEnh>& newPairs, bool addFront = false);
+ void removeAddFolderPair(const int pos);
+ void clearAddFolderPairs();
- return false;
- }
+ void updateGuiForFolderPair();
-private:
- BatchDialog& batchDlg;
+ void updateGui(); //re-evaluate gui after config changes
+
+ void showNotebookpage(wxWindow* page, const wxString& pageName, bool show);
+
+ //error handling
+ //xmlAccess::OnError getSelectionHandleError() const; -> obsolete, use getEnumVal()
+ void setSelectionHandleError(const xmlAccess::OnError value);
+ void OnChangeErrorHandling(wxCommandEvent& event);
+
+ bool saveBatchFile(const wxString& filename);
+ void loadBatchFile(const wxString& filename);
+ void loadBatchCfg(const xmlAccess::XmlBatchConfig& batchCfg);
+
+ xmlAccess::XmlBatchConfig getCurrentConfiguration() const;
+
+ boost::shared_ptr<DirectoryPairBatchFirst> firstFolderPair; //always bound!!!
+ std::vector<DirectoryPairBatch*> additionalFolderPairs;
+
+ //used when saving batch file
+ wxString proposedBatchFileName;
+
+ xmlAccess::XmlBatchConfig localBatchCfg;
+
+ std::auto_ptr<wxMenu> contextMenu;
+
+ std::auto_ptr<zen::DirectoryName> logfileDir;
+
+ zen::EnumDescrList<xmlAccess::OnError> enumDescrMap;
};
//###################################################################################################################################
@@ -144,20 +159,14 @@ public:
dirNameLeft (*m_panelLeft, *m_dirPickerLeft, *m_directoryLeft),
dirNameRight(*m_panelRight, *m_dirPickerRight, *m_directoryRight) {}
- void setValues(const Zstring& leftDir, const Zstring& rightDir, AltSyncCfgPtr syncCfg, const FilterConfig& filter)
+ void setValues(const wxString& leftDir, const wxString& rightDir, AltSyncCfgPtr syncCfg, const FilterConfig& filter)
{
setConfig(syncCfg, filter);
dirNameLeft.setName(leftDir);
dirNameRight.setName(rightDir);
}
- Zstring getLeftDir() const
- {
- return dirNameLeft.getName();
- }
- Zstring getRightDir() const
- {
- return dirNameRight.getName();
- }
+ wxString getLeftDir () const { return dirNameLeft .getName(); }
+ wxString getRightDir() const { return dirNameRight.getName(); }
private:
//support for drag and drop
@@ -180,20 +189,14 @@ public:
*batchDialog.m_dirPickerRight,
*batchDialog.m_directoryRight) {}
- void setValues(const Zstring& leftDir, const Zstring& rightDir, AltSyncCfgPtr syncCfg, const FilterConfig& filter)
+ void setValues(const wxString& leftDir, const wxString& rightDir, AltSyncCfgPtr syncCfg, const FilterConfig& filter)
{
setConfig(syncCfg, filter);
dirNameLeft.setName(leftDir);
dirNameRight.setName(rightDir);
}
- Zstring getLeftDir() const
- {
- return dirNameLeft.getName();
- }
- Zstring getRightDir() const
- {
- return dirNameRight.getName();
- }
+ wxString getLeftDir () const { return dirNameLeft .getName(); }
+ wxString getRightDir() const { return dirNameRight.getName(); }
private:
//support for drag and drop
@@ -225,17 +228,17 @@ BatchDialog::~BatchDialog() {} //non-inline destructor for std::auto_ptr to work
void BatchDialog::init()
{
#ifdef FFS_WIN
- new MouseMoveWindow(*this, //allow moving main dialog by clicking (nearly) anywhere...
- this,
- m_panelOverview,
- m_panelLogging,
- m_staticText56,
- m_staticText44,
- m_bitmap27); //ownership passed to "this"
+ new zen::MouseMoveWindow(*this); //allow moving main dialog by clicking (nearly) anywhere...; ownership passed to "this"
#endif
wxWindowUpdateLocker dummy(this); //avoid display distortion
+ enumDescrMap.
+ add(xmlAccess::ON_ERROR_POPUP , _("Show popup") , _("Show popup on errors or warnings")).
+ add(xmlAccess::ON_ERROR_IGNORE, _("Ignore errors") , _("Hide all error and warning messages")).
+ add(xmlAccess::ON_ERROR_EXIT , _("Exit instantly"), _("Abort synchronization immediately"));
+
+
m_bpButtonCmpConfig->SetBitmapLabel(GlobalResources::instance().getImage(wxT("cmpConfig")));
m_bpButtonSyncConfig->SetBitmapLabel(GlobalResources::instance().getImage(wxT("syncConfig")));
@@ -247,7 +250,9 @@ void BatchDialog::init()
m_bpButtonFilter->Connect(wxEVT_RIGHT_DOWN, wxCommandEventHandler(BatchDialog::OnGlobalFilterOpenContext), NULL, this);
//prepare drag & drop for loading of *.ffs_batch files
- SetDropTarget(new BatchFileDropEvent(*this));
+ setupFileDrop(*this);
+ Connect(FFS_DROP_FILE_EVENT, FFSFileDropEventHandler(BatchDialog::OnFilesDropped), NULL, this);
+
logfileDir.reset(new DirectoryName(*m_panelLogging, *m_dirPickerLogfileDir, *m_textCtrlLogfileDir, sbSizerLogfileDir));
//set icons for this dialog
@@ -259,72 +264,21 @@ void BatchDialog::init()
//------------------- error handling --------------------------
-xmlAccess::OnError BatchDialog::getSelectionHandleError() const
-{
- switch (m_choiceHandleError->GetSelection())
- {
- case 0:
- return xmlAccess::ON_ERROR_POPUP;
- case 1:
- return xmlAccess::ON_ERROR_IGNORE;
- case 2:
- return xmlAccess::ON_ERROR_EXIT;
- default:
- assert(false);
- return xmlAccess::ON_ERROR_POPUP;
- }
-}
-
-
-void BatchDialog::updateToolTipErrorHandling(const xmlAccess::OnError value)
-{
- switch (value)
- {
- case xmlAccess::ON_ERROR_POPUP:
- m_choiceHandleError->SetToolTip(_("Show popup on errors or warnings"));
- break;
- case xmlAccess::ON_ERROR_IGNORE:
- m_choiceHandleError->SetToolTip(_("Hide all error and warning messages"));
- break;
- case xmlAccess::ON_ERROR_EXIT:
- m_choiceHandleError->SetToolTip(_("Abort synchronization immediately"));
- break;
- }
-}
-
-
void BatchDialog::setSelectionHandleError(const xmlAccess::OnError value)
{
- m_choiceHandleError->Clear();
- m_choiceHandleError->Append(_("Show popup"));
- m_choiceHandleError->Append(_("Ignore errors"));
- if (m_checkBoxSilent->GetValue()) //this option shall be available for silent mode only!
- m_choiceHandleError->Append(_("Exit instantly"));
-
- //default
- m_choiceHandleError->SetSelection(0);
-
- switch (value)
+ if (m_checkBoxSilent->GetValue())
+ setEnumVal(enumDescrMap, *m_choiceHandleError, value);
+ else
{
- case xmlAccess::ON_ERROR_POPUP:
- m_choiceHandleError->SetSelection(0);
- break;
- case xmlAccess::ON_ERROR_IGNORE:
- m_choiceHandleError->SetSelection(1);
- break;
- case xmlAccess::ON_ERROR_EXIT:
- if (m_checkBoxSilent->GetValue()) //this option shall be available for silent mode only!
- m_choiceHandleError->SetSelection(2);
- break;
+ EnumDescrList<xmlAccess::OnError> tmp(enumDescrMap);
+ tmp.descrList.pop_back(); //remove "Exit instantly" -> this option shall be available for silent mode only!
+ setEnumVal(tmp, *m_choiceHandleError, value);
}
-
- updateToolTipErrorHandling(getSelectionHandleError());
}
-
void BatchDialog::OnChangeErrorHandling(wxCommandEvent& event)
{
- updateToolTipErrorHandling(getSelectionHandleError());
+ updateTooltipEnumVal(enumDescrMap, *m_choiceHandleError);
}
@@ -335,9 +289,9 @@ void BatchDialog::OnCmpSettings(wxCommandEvent& event)
wxPoint windowPos = m_bpButtonCmpConfig->GetScreenPosition();
windowPos.x += m_bpButtonCmpConfig->GetSize().GetWidth() + 5;
- if (ffs3::showCompareCfgDialog(windowPos,
- localBatchCfg.mainCfg.compareVar,
- localBatchCfg.mainCfg.handleSymlinks) == DefaultReturnCode::BUTTON_OKAY)
+ if (zen::showCompareCfgDialog(windowPos,
+ localBatchCfg.mainCfg.compareVar,
+ localBatchCfg.mainCfg.handleSymlinks) == ReturnSmallDlg::BUTTON_OKAY)
{
updateGui();
}
@@ -346,13 +300,11 @@ void BatchDialog::OnCmpSettings(wxCommandEvent& event)
void BatchDialog::OnSyncSettings(wxCommandEvent& event)
{
- SyncCfgDialog syncDlg(this,
- localBatchCfg.mainCfg.compareVar,
+ if (showSyncConfigDlg(localBatchCfg.mainCfg.compareVar,
localBatchCfg.mainCfg.syncConfiguration,
localBatchCfg.mainCfg.handleDeletion,
localBatchCfg.mainCfg.customDeletionDirectory,
- NULL);
- if (syncDlg.ShowModal() == SyncCfgDialog::BUTTON_APPLY)
+ NULL) == ReturnSyncConfig::BUTTON_OKAY) //optional input parameter
{
updateGui();
}
@@ -362,8 +314,7 @@ void BatchDialog::OnSyncSettings(wxCommandEvent& event)
void BatchDialog::OnConfigureFilter(wxCommandEvent& event)
{
if (showFilterDialog(true, //is main filter dialog
- localBatchCfg.mainCfg.globalFilter.includeFilter,
- localBatchCfg.mainCfg.globalFilter.excludeFilter) == DefaultReturnCode::BUTTON_OKAY)
+ localBatchCfg.mainCfg.globalFilter) == ReturnSmallDlg::BUTTON_OKAY)
{
updateGui();
}
@@ -427,7 +378,7 @@ void BatchDialog::OnCheckSilent(wxCommandEvent& event)
updateGui();
//reset error handling depending on "m_checkBoxSilent"
- setSelectionHandleError(getSelectionHandleError());
+ setSelectionHandleError(getEnumVal(enumDescrMap, *m_choiceHandleError));
}
@@ -437,12 +388,57 @@ void BatchDialog::OnChangeMaxLogCountTxt(wxCommandEvent& event)
}
+void BatchDialog::OnFilesDropped(FFSFileDropEvent& event)
+{
+ if (event.getFiles().empty())
+ return;
+
+ std::vector<wxString> fileList = event.getFiles();
+
+ switch (xmlAccess::getMergeType(fileList)) //throw ()
+ {
+ case xmlAccess::MERGE_BATCH:
+ case xmlAccess::MERGE_GUI:
+ case xmlAccess::MERGE_GUI_BATCH:
+ if (fileList.size() == 1)
+ {
+ loadBatchFile(fileList[0]);
+ return;
+ }
+ else
+ {
+ xmlAccess::XmlBatchConfig batchCfg;
+ try
+ {
+ convertConfig(fileList, batchCfg); //throw (xmlAccess::XmlError)
+ }
+ catch (const xmlAccess::XmlError& error)
+ {
+ if (error.getSeverity() == xmlAccess::XmlError::WARNING)
+ wxMessageBox(error.msg(), _("Warning"), wxOK | wxICON_WARNING);
+ else
+ {
+ wxMessageBox(error.msg(), _("Error"), wxOK | wxICON_ERROR);
+ return;
+ }
+ }
+ loadBatchCfg(batchCfg);
+ }
+ break;
+
+ case xmlAccess::MERGE_OTHER:
+ wxMessageBox(_("Invalid FreeFileSync config file!"), _("Error"), wxOK | wxICON_ERROR);
+ break;
+ }
+}
+
+
void BatchDialog::OnHelp(wxCommandEvent& event)
{
#ifdef FFS_WIN
- ffs3::displayHelpEntry(wxT("html\\advanced\\ScheduleBatch.html"));
+ zen::displayHelpEntry(wxT("html\\advanced\\ScheduleBatch.html"));
#elif defined FFS_LINUX
- ffs3::displayHelpEntry(wxT("html/advanced/ScheduleBatch.html"));
+ zen::displayHelpEntry(wxT("html/advanced/ScheduleBatch.html"));
#endif
}
@@ -478,13 +474,13 @@ void BatchDialog::showNotebookpage(wxWindow* page, const wxString& pageName, boo
void BatchDialog::OnClose(wxCloseEvent& event)
{
- EndModal(0);
+ EndModal(ReturnBatchConfig::BUTTON_CANCEL);
}
void BatchDialog::OnCancel(wxCommandEvent& event)
{
- EndModal(0);
+ EndModal(ReturnBatchConfig::BUTTON_CANCEL);
}
@@ -502,13 +498,10 @@ void BatchDialog::OnSaveBatchJob(wxCommandEvent& event)
if (filePicker.ShowModal() == wxID_OK)
{
const wxString newFileName = filePicker.GetPath();
- if (ffs3::fileExists(wxToZ(newFileName)))
+ if (zen::fileExists(wxToZ(newFileName)))
{
- QuestionDlg messageDlg(this,
- QuestionDlg::BUTTON_YES | QuestionDlg::BUTTON_CANCEL,
- wxString(_("File already exists. Overwrite?")) + wxT(" \"") + newFileName + wxT("\""));
-
- if (messageDlg.ShowModal() != QuestionDlg::BUTTON_YES)
+ if (showQuestionDlg(ReturnQuestionDlg::BUTTON_YES | ReturnQuestionDlg::BUTTON_CANCEL,
+ wxString(_("File already exists. Overwrite?")) + wxT(" \"") + newFileName + wxT("\"")) != ReturnQuestionDlg::BUTTON_YES)
{
OnSaveBatchJob(event); //retry
return;
@@ -517,7 +510,7 @@ void BatchDialog::OnSaveBatchJob(wxCommandEvent& event)
//create batch file
if (saveBatchFile(newFileName))
- EndModal(BATCH_FILE_SAVED);
+ EndModal(ReturnBatchConfig::BATCH_FILE_SAVED);
}
}
@@ -532,10 +525,10 @@ void BatchDialog::OnLoadBatchJob(wxCommandEvent& event)
inline
-FolderPairEnh getEnahncedPair(const DirectoryPairBatch* panel)
+FolderPairEnh getEnhancedPair(const DirectoryPairBatch* panel)
{
- return FolderPairEnh(panel->getLeftDir(),
- panel->getRightDir(),
+ return FolderPairEnh(wxToZ(panel->getLeftDir()),
+ wxToZ(panel->getRightDir()),
panel->getAltSyncConfig(),
panel->getAltFilterConfig());
}
@@ -548,22 +541,22 @@ xmlAccess::XmlBatchConfig BatchDialog::getCurrentConfiguration() const
//load parameter with ownership within wxWidgets controls...
//first folder pair
- batchCfg.mainCfg.firstPair = FolderPairEnh(firstFolderPair->getLeftDir(),
- firstFolderPair->getRightDir(),
+ batchCfg.mainCfg.firstPair = FolderPairEnh(wxToZ(firstFolderPair->getLeftDir()),
+ wxToZ(firstFolderPair->getRightDir()),
firstFolderPair->getAltSyncConfig(),
firstFolderPair->getAltFilterConfig());
//add additional pairs
batchCfg.mainCfg.additionalPairs.clear();
std::transform(additionalFolderPairs.begin(), additionalFolderPairs.end(),
- std::back_inserter(batchCfg.mainCfg.additionalPairs), getEnahncedPair);
+ std::back_inserter(batchCfg.mainCfg.additionalPairs), getEnhancedPair);
//load structure with batch settings "batchCfg"
batchCfg.silent = m_checkBoxSilent->GetValue();
- batchCfg.logFileDirectory = zToWx(logfileDir->getName());
+ batchCfg.logFileDirectory = logfileDir->getName();
batchCfg.logFileCountMax = m_spinCtrlLogCountMax->GetValue();
- batchCfg.handleError = getSelectionHandleError();
+ batchCfg.handleError = getEnumVal(enumDescrMap, *m_choiceHandleError);
return batchCfg;
}
@@ -633,12 +626,12 @@ void BatchDialog::loadBatchCfg(const xmlAccess::XmlBatchConfig& batchCfg)
//error handling is dependent from m_checkBoxSilent! /|\ \|/
setSelectionHandleError(batchCfg.handleError);
- logfileDir->setName(wxToZ(batchCfg.logFileDirectory));
+ logfileDir->setName(batchCfg.logFileDirectory);
m_spinCtrlLogCountMax->SetValue(static_cast<int>(batchCfg.logFileCountMax)); //attention: this one emits a "change value" event!! => updateGui() called implicitly!
//set first folder pair
- firstFolderPair->setValues(batchCfg.mainCfg.firstPair.leftDirectory,
- batchCfg.mainCfg.firstPair.rightDirectory,
+ firstFolderPair->setValues(zToWx(batchCfg.mainCfg.firstPair.leftDirectory),
+ zToWx(batchCfg.mainCfg.firstPair.rightDirectory),
batchCfg.mainCfg.firstPair.altSyncConfig,
batchCfg.mainCfg.firstPair.localFilter);
@@ -667,8 +660,8 @@ void BatchDialog::OnAddFolderPair(wxCommandEvent& event)
//clear first pair
const FolderPairEnh cfgEmpty;
- firstFolderPair->setValues(cfgEmpty.leftDirectory,
- cfgEmpty.rightDirectory,
+ firstFolderPair->setValues(zToWx(cfgEmpty.leftDirectory),
+ zToWx(cfgEmpty.rightDirectory),
cfgEmpty.altSyncConfig,
cfgEmpty.localFilter);
}
@@ -694,11 +687,11 @@ void BatchDialog::OnRemoveTopFolderPair(wxCommandEvent& event)
if (additionalFolderPairs.size() > 0)
{
//get settings from second folder pair
- const FolderPairEnh cfgSecond = getEnahncedPair(additionalFolderPairs[0]);
+ const FolderPairEnh cfgSecond = getEnhancedPair(additionalFolderPairs[0]);
//reset first pair
- firstFolderPair->setValues(cfgSecond.leftDirectory,
- cfgSecond.rightDirectory,
+ firstFolderPair->setValues(zToWx(cfgSecond.leftDirectory),
+ zToWx(cfgSecond.rightDirectory),
cfgSecond.altSyncConfig,
cfgSecond.localFilter);
@@ -718,8 +711,7 @@ void BatchDialog::updateGuiForFolderPair()
//adapt local filter and sync cfg for first folder pair
if (additionalFolderPairs.size() == 0 &&
firstFolderPair->getAltSyncConfig().get() == NULL &&
- NameFilter(firstFolderPair->getAltFilterConfig().includeFilter,
- firstFolderPair->getAltFilterConfig().excludeFilter).isNull())
+ isNullFilter(firstFolderPair->getAltFilterConfig()))
{
m_bpButtonLocalFilter->Hide();
m_bpButtonAltSyncCfg->Hide();
@@ -753,14 +745,14 @@ void BatchDialog::updateGuiForFolderPair()
}
-void BatchDialog::addFolderPair(const std::vector<ffs3::FolderPairEnh>& newPairs, bool addFront)
+void BatchDialog::addFolderPair(const std::vector<zen::FolderPairEnh>& newPairs, bool addFront)
{
wxWindowUpdateLocker dummy(m_panelOverview); //avoid display distortion
if (!newPairs.empty())
{
//add folder pairs
- for (std::vector<ffs3::FolderPairEnh>::const_iterator i = newPairs.begin(); i != newPairs.end(); ++i)
+ for (std::vector<zen::FolderPairEnh>::const_iterator i = newPairs.begin(); i != newPairs.end(); ++i)
{
DirectoryPairBatch* newPair = new DirectoryPairBatch(m_scrolledWindow6, *this);
@@ -779,8 +771,8 @@ void BatchDialog::addFolderPair(const std::vector<ffs3::FolderPairEnh>& newPairs
newPair->m_bpButtonRemovePair->Connect(wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler(BatchDialog::OnRemoveFolderPair), NULL, this );
//set alternate configuration
- newPair->setValues(i->leftDirectory,
- i->rightDirectory,
+ newPair->setValues(zToWx(i->leftDirectory),
+ zToWx(i->rightDirectory),
i->altSyncConfig,
i->localFilter);
}
@@ -893,3 +885,18 @@ bool BatchDialog::createBatchFile(const wxString& filename)
return true;
}
*/
+
+
+
+ReturnBatchConfig::ButtonPressed zen::showSyncBatchDlg(const wxString& filename)
+{
+ BatchDialog batchDlg(NULL, filename);
+ return static_cast<ReturnBatchConfig::ButtonPressed>(batchDlg.ShowModal());
+}
+
+
+ReturnBatchConfig::ButtonPressed zen::showSyncBatchDlg(const xmlAccess::XmlBatchConfig& batchCfg)
+{
+ BatchDialog batchDlg(NULL, batchCfg);
+ return static_cast<ReturnBatchConfig::ButtonPressed>(batchDlg.ShowModal());
+}
diff --git a/ui/batch_config.h b/ui/batch_config.h
index 88d5e4eb..574fef66 100644
--- a/ui/batch_config.h
+++ b/ui/batch_config.h
@@ -7,89 +7,23 @@
#ifndef BATCHCONFIG_H_INCLUDED
#define BATCHCONFIG_H_INCLUDED
-#include "gui_generated.h"
#include "../library/process_xml.h"
-namespace ffs3
+namespace zen
{
-class DirectoryName;
-}
-
-class DirectoryPairBatch;
-class DirectoryPairBatchFirst;
-
-
-class BatchDialog: public BatchDlgGenerated
+struct ReturnBatchConfig
{
- friend class BatchFileDropEvent;
- template <class GuiPanel>
- friend class FolderPairCallback;
-
-public:
- BatchDialog(wxWindow* window, const xmlAccess::XmlBatchConfig& batchCfg);
- BatchDialog(wxWindow* window, const wxString& filename);
- ~BatchDialog();
-
- enum
+ enum ButtonPressed
{
- BATCH_FILE_SAVED = 15
+ BUTTON_CANCEL,
+ BATCH_FILE_SAVED = 1
};
+};
-private:
- void init();
-
- virtual void OnCmpSettings( wxCommandEvent& event);
- virtual void OnSyncSettings( wxCommandEvent& event);
- virtual void OnConfigureFilter( wxCommandEvent& event);
-
- virtual void OnHelp( wxCommandEvent& event);
-
- void OnGlobalFilterOpenContext(wxCommandEvent& event);
- void OnGlobalFilterRemConfirm(wxCommandEvent& event);
- virtual void OnCheckSilent( wxCommandEvent& event);
- virtual void OnChangeMaxLogCountTxt(wxCommandEvent& event);
- virtual void OnClose( wxCloseEvent& event);
- virtual void OnCancel( wxCommandEvent& event);
- virtual void OnSaveBatchJob( wxCommandEvent& event);
- virtual void OnLoadBatchJob( wxCommandEvent& event);
- virtual void OnAddFolderPair( wxCommandEvent& event);
- virtual void OnRemoveFolderPair( wxCommandEvent& event);
- virtual void OnRemoveTopFolderPair(wxCommandEvent& event);
-
- void addFolderPair(const std::vector<ffs3::FolderPairEnh>& newPairs, bool addFront = false);
- void removeAddFolderPair(const int pos);
- void clearAddFolderPairs();
-
- void updateGuiForFolderPair();
-
- void updateGui(); //re-evaluate gui after config changes
-
- void showNotebookpage(wxWindow* page, const wxString& pageName, bool show);
-
- //error handling
- xmlAccess::OnError getSelectionHandleError() const;
- void setSelectionHandleError(const xmlAccess::OnError value);
- void OnChangeErrorHandling(wxCommandEvent& event);
- void updateToolTipErrorHandling(const xmlAccess::OnError value);
-
- bool saveBatchFile(const wxString& filename);
- void loadBatchFile(const wxString& filename);
- void loadBatchCfg(const xmlAccess::XmlBatchConfig& batchCfg);
-
- xmlAccess::XmlBatchConfig getCurrentConfiguration() const;
-
- boost::shared_ptr<DirectoryPairBatchFirst> firstFolderPair; //always bound!!!
- std::vector<DirectoryPairBatch*> additionalFolderPairs;
-
- //used when saving batch file
- wxString proposedBatchFileName;
-
- xmlAccess::XmlBatchConfig localBatchCfg;
-
- std::auto_ptr<wxMenu> contextMenu;
+ReturnBatchConfig::ButtonPressed showSyncBatchDlg(const wxString& filename);
+ReturnBatchConfig::ButtonPressed showSyncBatchDlg(const xmlAccess::XmlBatchConfig& batchCfg);
+}
- std::auto_ptr<ffs3::DirectoryName> logfileDir;
-};
#endif // BATCHCONFIG_H_INCLUDED
diff --git a/ui/batch_status_handler.cpp b/ui/batch_status_handler.cpp
index 859415fa..b9eff9fa 100644
--- a/ui/batch_status_handler.cpp
+++ b/ui/batch_status_handler.cpp
@@ -5,7 +5,6 @@
// **************************************************************************
//
#include "batch_status_handler.h"
-//#include "small_dlgs.h"
#include "msg_popup.h"
#include <wx/ffile.h>
#include <wx/msgdlg.h>
@@ -18,12 +17,12 @@
#include "../shared/util.h"
#include "../shared/file_traverser.h"
-using namespace ffs3;
+using namespace zen;
namespace
{
-class FindLogfiles : public ffs3::TraverseCallback
+class FindLogfiles : public zen::TraverseCallback
{
public:
FindLogfiles(const Zstring& prefix, std::vector<Zstring>& logfiles) : prefix_(prefix), logfiles_(logfiles) {}
@@ -53,7 +52,7 @@ void removeFileNoThrow(const Zstring& filename)
{
try
{
- ffs3::removeFile(filename);
+ zen::removeFile(filename);
}
catch(...) {}
}
@@ -132,11 +131,11 @@ private:
//create logfile directory
Zstring logfileDir = logfileDirectory.empty() ?
- wxToZ(ffs3::getConfigDir() + wxT("Logs")) :
- ffs3::getFormattedDirectoryName(wxToZ(logfileDirectory));
+ wxToZ(zen::getConfigDir() + wxT("Logs")) :
+ zen::getFormattedDirectoryName(wxToZ(logfileDirectory));
- if (!ffs3::dirExists(logfileDir))
- ffs3::createDirectory(logfileDir); //create recursively if necessary: may throw (FileError&)
+ if (!zen::dirExists(logfileDir))
+ zen::createDirectory(logfileDir); //create recursively if necessary: may throw (FileError&)
//assemble logfile name
if (!logfileDir.EndsWith(FILE_NAME_SEPARATOR))
@@ -155,8 +154,8 @@ private:
wxString output = logfileName + wxT(".log");
//ensure uniqueness
- for (int i = 1; ffs3::somethingExists(wxToZ(output)); ++i)
- output = logfileName + wxChar('_') + common::numberToString(i) + wxT(".log");
+ for (int i = 1; zen::somethingExists(wxToZ(output)); ++i)
+ output = logfileName + wxChar('_') + zen::toString<wxString>(i) + wxT(".log");
return output;
}
@@ -192,11 +191,11 @@ BatchStatusHandler::BatchStatusHandler(bool runSilent,
logFile.reset(new LogFile(*logfileDirectory, jobName));
logFile->limitLogfileCount(logFileMaxCount);
}
- catch (ffs3::FileError& error)
+ catch (zen::FileError& error)
{
wxMessageBox(error.msg(), _("Error"), wxOK | wxICON_ERROR);
returnValue = -7;
- throw ffs3::AbortThisProcess();
+ throw zen::AbortThisProcess();
}
}
@@ -241,7 +240,7 @@ BatchStatusHandler::~BatchStatusHandler()
else if (!exitWhenFinished || syncStatusFrame.getAsWindow()->IsShown()) //warning: wxWindow::Show() is called within processHasFinished()!
{
//notify about (logical) application main window => program won't quit, but stay on this dialog
- ffs3::AppMainWindow::setMainWindow(syncStatusFrame.getAsWindow());
+ zen::AppMainWindow::setMainWindow(syncStatusFrame.getAsWindow());
//notify to syncStatusFrame that current process has ended
if (abortIsRequested())
@@ -266,7 +265,7 @@ void BatchStatusHandler::reportInfo(const Zstring& text)
}
-void BatchStatusHandler::initNewProcess(int objectsTotal, wxLongLong dataTotal, StatusHandler::Process processID)
+void BatchStatusHandler::initNewProcess(int objectsTotal, zen::Int64 dataTotal, StatusHandler::Process processID)
{
currentProcess = processID;
@@ -292,7 +291,7 @@ void BatchStatusHandler::initNewProcess(int objectsTotal, wxLongLong dataTotal,
inline
-void BatchStatusHandler::updateProcessedData(int objectsProcessed, wxLongLong dataProcessed)
+void BatchStatusHandler::updateProcessedData(int objectsProcessed, zen::Int64 dataProcessed)
{
switch (currentProcess)
{
@@ -323,25 +322,21 @@ void BatchStatusHandler::reportWarning(const wxString& warningMessage, bool& war
{
//show popup and ask user how to handle warning
bool dontWarnAgain = false;
- WarningDlg warningDlg(NULL,
- WarningDlg::BUTTON_IGNORE | WarningDlg::BUTTON_SWITCH | WarningDlg::BUTTON_ABORT,
- warningMessage + wxT("\n\n") + _("Press \"Switch\" to open FreeFileSync GUI mode."),
- dontWarnAgain);
- warningDlg.Raise();
- const WarningDlg::Response rv = static_cast<WarningDlg::Response>(warningDlg.ShowModal());
- switch (rv)
+ switch (showWarningDlg(ReturnWarningDlg::BUTTON_IGNORE | ReturnWarningDlg::BUTTON_SWITCH | ReturnWarningDlg::BUTTON_ABORT,
+ warningMessage + wxT("\n\n") + _("Press \"Switch\" to open FreeFileSync GUI mode."),
+ dontWarnAgain))
{
- case WarningDlg::BUTTON_ABORT:
+ case ReturnWarningDlg::BUTTON_ABORT:
abortThisProcess();
break;
- case WarningDlg::BUTTON_SWITCH:
+ case ReturnWarningDlg::BUTTON_SWITCH:
errorLog.logMsg(_("Switching to FreeFileSync GUI mode..."), TYPE_WARNING);
switchToGuiRequested = true;
abortThisProcess();
break;
- case WarningDlg::BUTTON_IGNORE: //no unhandled error situation!
+ case ReturnWarningDlg::BUTTON_IGNORE: //no unhandled error situation!
warningActive = !dontWarnAgain;
break;
}
@@ -365,24 +360,21 @@ ErrorHandler::Response BatchStatusHandler::reportError(const wxString& errorMess
case xmlAccess::ON_ERROR_POPUP:
{
bool ignoreNextErrors = false;
- ErrorDlg errorDlg(NULL,
- ErrorDlg::BUTTON_IGNORE | ErrorDlg::BUTTON_RETRY | ErrorDlg::BUTTON_ABORT,
- errorMessage,
- ignoreNextErrors);
- errorDlg.Raise();
- const ErrorDlg::ReturnCodes rv = static_cast<ErrorDlg::ReturnCodes>(errorDlg.ShowModal());
- switch (rv)
+
+ switch (showErrorDlg(ReturnErrorDlg::BUTTON_IGNORE | ReturnErrorDlg::BUTTON_RETRY | ReturnErrorDlg::BUTTON_ABORT,
+ errorMessage,
+ ignoreNextErrors))
{
- case ErrorDlg::BUTTON_IGNORE:
+ case ReturnErrorDlg::BUTTON_IGNORE:
if (ignoreNextErrors) //falsify only
handleError_ = xmlAccess::ON_ERROR_IGNORE;
errorLog.logMsg(errorMessage, TYPE_ERROR);
return ErrorHandler::IGNORE_ERROR;
- case ErrorDlg::BUTTON_RETRY:
+ case ReturnErrorDlg::BUTTON_RETRY:
return ErrorHandler::RETRY;
- case ErrorDlg::BUTTON_ABORT:
+ case ReturnErrorDlg::BUTTON_ABORT:
errorLog.logMsg(errorMessage, TYPE_ERROR);
abortThisProcess();
}
@@ -423,5 +415,5 @@ void BatchStatusHandler::forceUiRefresh()
void BatchStatusHandler::abortThisProcess()
{
requestAbortion();
- throw ffs3::AbortThisProcess(); //abort can be triggered by syncStatusFrame
+ throw zen::AbortThisProcess(); //abort can be triggered by syncStatusFrame
}
diff --git a/ui/batch_status_handler.h b/ui/batch_status_handler.h
index 61d8bddc..0e03141e 100644
--- a/ui/batch_status_handler.h
+++ b/ui/batch_status_handler.h
@@ -25,12 +25,12 @@ public:
const wxString* logfileDirectory, //non-empty if logging shall be active
size_t logFileMaxCount,
const xmlAccess::OnError handleError,
- const ffs3::SwitchToGui& switchBatchToGui, //functionality to change from batch mode to GUI mode
+ const zen::SwitchToGui& switchBatchToGui, //functionality to change from batch mode to GUI mode
int& returnVal);
~BatchStatusHandler();
- virtual void initNewProcess(int objectsTotal, wxLongLong dataTotal, Process processID);
- virtual void updateProcessedData(int objectsProcessed, wxLongLong dataProcessed);
+ virtual void initNewProcess(int objectsTotal, zen::Int64 dataTotal, Process processID);
+ virtual void updateProcessedData(int objectsProcessed, zen::Int64 dataProcessed);
virtual void reportInfo(const Zstring& text);
virtual void forceUiRefresh();
@@ -41,11 +41,11 @@ public:
private:
virtual void abortThisProcess();
- const ffs3::SwitchToGui& switchBatchToGui_; //functionality to change from batch mode to GUI mode
+ const zen::SwitchToGui& switchBatchToGui_; //functionality to change from batch mode to GUI mode
bool exitWhenFinished;
bool switchToGuiRequested;
xmlAccess::OnError handleError_;
- ffs3::ErrorLogging errorLog; //list of non-resolved errors and warnings
+ zen::ErrorLogging errorLog; //list of non-resolved errors and warnings
Process currentProcess;
int& returnValue;
diff --git a/ui/check_version.cpp b/ui/check_version.cpp
index fa1b84a1..2147d717 100644
--- a/ui/check_version.cpp
+++ b/ui/check_version.cpp
@@ -11,10 +11,11 @@
#include "../version/version.h"
#include <wx/utils.h>
#include <wx/timer.h>
-#include "../shared/global_func.h"
+#include "../shared/string_tools.h"
#include "msg_popup.h"
#include "../shared/standard_paths.h"
#include <wx/tokenzr.h>
+#include "../shared/i18n.h"
class CloseConnectionOnExit
@@ -81,7 +82,7 @@ std::vector<size_t> parseVersion(const wxString& version)
while (tkz.HasMoreTokens())
{
const wxString& token = tkz.GetNextToken();
- output.push_back(common::stringToNumber<size_t>(token));
+ output.push_back(zen::toNumber<size_t>(token));
}
return output;
}
@@ -89,7 +90,7 @@ std::vector<size_t> parseVersion(const wxString& version)
bool newerVersionExists(const wxString& onlineVersion)
{
- std::vector<size_t> current = parseVersion(ffs3::currentVersion);
+ std::vector<size_t> current = parseVersion(zen::currentVersion);
std::vector<size_t> online = parseVersion(onlineVersion);
if (online.empty() || online[0] == 0) //onlineVersion may be "This website has been moved..." In this case better check for an update
@@ -100,7 +101,7 @@ bool newerVersionExists(const wxString& onlineVersion)
}
-void ffs3::checkForUpdateNow()
+void zen::checkForUpdateNow()
{
wxString onlineVersion;
if (!getOnlineVersion(onlineVersion))
@@ -120,10 +121,10 @@ void ffs3::checkForUpdateNow()
}
-void ffs3::checkForUpdatePeriodically(long& lastUpdateCheck)
+void zen::checkForUpdatePeriodically(long& lastUpdateCheck)
{
#ifdef FFS_LINUX
- if (!ffs3::isPortableVersion()) //don't check for updates in installer version -> else: handled by .deb
+ if (!zen::isPortableVersion()) //don't check for updates in installer version -> else: handled by .deb
return;
#endif
@@ -131,12 +132,9 @@ void ffs3::checkForUpdatePeriodically(long& lastUpdateCheck)
{
if (lastUpdateCheck == 0)
{
- QuestionDlg messageDlg(NULL,
- QuestionDlg::BUTTON_YES | QuestionDlg::BUTTON_NO,
- wxString(_("Do you want FreeFileSync to automatically check for updates every week?")) + wxT("\n") +
- _("(Requires an Internet connection!)"));
-
- const bool checkRegularly = messageDlg.ShowModal() == QuestionDlg::BUTTON_YES;
+ const bool checkRegularly = showQuestionDlg(ReturnQuestionDlg::BUTTON_YES | ReturnQuestionDlg::BUTTON_NO,
+ wxString(_("Do you want FreeFileSync to automatically check for updates every week?")) + wxT("\n") +
+ _("(Requires an Internet connection!)")) == ReturnQuestionDlg::BUTTON_YES;
if (checkRegularly)
{
lastUpdateCheck = 123; //some old date (few seconds after 1970)
diff --git a/ui/check_version.h b/ui/check_version.h
index f7fb409d..b9606987 100644
--- a/ui/check_version.h
+++ b/ui/check_version.h
@@ -8,7 +8,7 @@
#define UPDATEVERSION_H_INCLUDED
-namespace ffs3
+namespace zen
{
void checkForUpdateNow();
diff --git a/ui/folder_pair.h b/ui/folder_pair.h
index af614176..d72651c8 100644
--- a/ui/folder_pair.h
+++ b/ui/folder_pair.h
@@ -13,11 +13,12 @@
#include "small_dlgs.h"
#include "sync_cfg.h"
#include <wx/event.h>
-#include "is_null_filter.h"
+#include <wx/menu.h>
#include "../shared/util.h"
#include "../shared/string_conv.h"
+#include "../library/norm_filter.h"
-namespace ffs3
+namespace zen
{
//basic functionality for handling alternate folder pair configuration: change sync-cfg/filter cfg, right-click context menu, button icons...
@@ -25,7 +26,7 @@ template <class GuiPanel>
class FolderPairPanelBasic : private wxEvtHandler
{
public:
- typedef boost::shared_ptr<const ffs3::AlternateSyncConfig> AltSyncCfgPtr;
+ typedef boost::shared_ptr<const zen::AlternateSyncConfig> AltSyncCfgPtr;
AltSyncCfgPtr getAltSyncConfig() const
{
@@ -51,7 +52,7 @@ public:
{
basicPanel_.m_bpButtonAltSyncCfg->SetBitmapLabel(GlobalResources::instance().getImage(wxT("syncConfigSmall")));
basicPanel_.m_bpButtonAltSyncCfg->SetToolTip(wxString(_("Select alternate synchronization settings")) + wxT(" ") + common::LINE_BREAK +
- wxT("(") + getVariantName(altSyncConfig->syncConfiguration) + wxT(")"));
+ wxT("(") + getVariantName(altSyncConfig->syncConfiguration.var) + wxT(")"));
}
else
{
@@ -107,7 +108,7 @@ private:
contextMenu->Append(menuId, _("Clear filter settings"));
contextMenu->Connect(wxEVT_COMMAND_MENU_SELECTED, wxCommandEventHandler(FolderPairPanelBasic::OnLocalFilterCfgRemoveConfirm), NULL, this);
- if (NameFilter(localFilter.includeFilter, localFilter.excludeFilter).isNull())
+ if (isNullFilter(localFilter))
contextMenu->Enable(menuId, false); //disable menu item, if clicking wouldn't make sense anyway
basicPanel_.PopupMenu(contextMenu.get()); //show context menu
@@ -139,13 +140,13 @@ private:
mainCfg.customDeletionDirectory);
AlternateSyncConfig altSyncCfg = altSyncConfig.get() ? *altSyncConfig : syncConfigMain;
- SyncCfgDialog syncDlg(getParentWindow(),
- mainCfg.compareVar,
+
+
+ if (showSyncConfigDlg(mainCfg.compareVar,
altSyncCfg.syncConfiguration,
altSyncCfg.handleDeletion,
altSyncCfg.customDeletionDirectory,
- NULL);
- if (syncDlg.ShowModal() == SyncCfgDialog::BUTTON_APPLY)
+ NULL) == ReturnSyncConfig::BUTTON_OKAY) //optional input parameter
{
altSyncConfig.reset(new AlternateSyncConfig(altSyncCfg));
refreshButtons();
@@ -161,8 +162,7 @@ private:
FilterConfig localFiltTmp = localFilter;
if (showFilterDialog(false, //is local filter dialog
- localFiltTmp.includeFilter,
- localFiltTmp.excludeFilter) == DefaultReturnCode::BUTTON_OKAY)
+ localFiltTmp) == ReturnSmallDlg::BUTTON_OKAY)
{
localFilter = localFiltTmp;
refreshButtons();
diff --git a/ui/grid_view.cpp b/ui/grid_view.cpp
index 93f75b95..4db921fa 100644
--- a/ui/grid_view.cpp
+++ b/ui/grid_view.cpp
@@ -9,7 +9,7 @@
#include "../synchronization.h"
#include <boost/bind.hpp>
-using namespace ffs3;
+using namespace zen;
GridView::StatusCmpResult::StatusCmpResult() :
@@ -338,7 +338,7 @@ public:
};
-template <bool ascending, ffs3::SelectedSide side>
+template <bool ascending, zen::SelectedSide side>
class GridView::SortByRelName : public std::binary_function<RefIndex, RefIndex, bool>
{
public:
@@ -366,7 +366,7 @@ private:
};
-template <bool ascending, ffs3::SelectedSide side>
+template <bool ascending, zen::SelectedSide side>
class GridView::SortByFileName : public std::binary_function<RefIndex, RefIndex, bool>
{
public:
@@ -388,7 +388,7 @@ private:
};
-template <bool ascending, ffs3::SelectedSide side>
+template <bool ascending, zen::SelectedSide side>
class GridView::SortByFileSize : public std::binary_function<RefIndex, RefIndex, bool>
{
public:
@@ -410,7 +410,7 @@ private:
};
-template <bool ascending, ffs3::SelectedSide side>
+template <bool ascending, zen::SelectedSide side>
class GridView::SortByDate : public std::binary_function<RefIndex, RefIndex, bool>
{
public:
@@ -432,7 +432,7 @@ private:
};
-template <bool ascending, ffs3::SelectedSide side>
+template <bool ascending, zen::SelectedSide side>
class GridView::SortByExtension : public std::binary_function<RefIndex, RefIndex, bool>
{
public:
diff --git a/ui/grid_view.h b/ui/grid_view.h
index acc63ea5..b21bcde4 100644
--- a/ui/grid_view.h
+++ b/ui/grid_view.h
@@ -10,7 +10,7 @@
#include "../file_hierarchy.h"
-namespace ffs3
+namespace zen
{
//gui view of FolderComparison
class GridView
@@ -42,8 +42,8 @@ public:
unsigned int filesOnRightView;
unsigned int foldersOnRightView;
- wxULongLong filesizeLeftView;
- wxULongLong filesizeRightView;
+ zen::UInt64 filesizeLeftView;
+ zen::UInt64 filesizeRightView;
};
//comparison results view
@@ -75,8 +75,8 @@ public:
unsigned int filesOnRightView;
unsigned int foldersOnRightView;
- wxULongLong filesizeLeftView;
- wxULongLong filesizeRightView;
+ zen::UInt64 filesizeLeftView;
+ zen::UInt64 filesizeRightView;
};
//synchronization preview
@@ -219,14 +219,14 @@ size_t GridView::rowsTotal() const //total number of rows available
inline
-const ffs3::FileSystemObject* GridView::getReferencedRow(const RefIndex ref) const
+const zen::FileSystemObject* GridView::getReferencedRow(const RefIndex ref) const
{
return folderCmp[ref.folderIndex].retrieveById(ref.objId);
}
inline
-ffs3::FileSystemObject* GridView::getReferencedRow(const RefIndex ref)
+zen::FileSystemObject* GridView::getReferencedRow(const RefIndex ref)
{
//code re-use of const method: see Meyers Effective C++
return const_cast<FileSystemObject*>(static_cast<const GridView&>(*this).getReferencedRow(ref));
diff --git a/ui/gui_generated.cpp b/ui/gui_generated.cpp
index a1bc1679..d3d7488f 100644
--- a/ui/gui_generated.cpp
+++ b/ui/gui_generated.cpp
@@ -36,20 +36,20 @@ MainDialogGenerated::MainDialogGenerated( wxWindow* parent, wxWindowID id, const
wxMenuItem* m_separator2;
m_separator2 = m_menuFile->AppendSeparator();
- m_menuItemNew = new wxMenuItem( m_menuFile, wxID_ANY, wxString( _("&New") ) + wxT('\t') + wxT("CTRL-N"), wxEmptyString, wxITEM_NORMAL );
+ m_menuItemNew = new wxMenuItem( m_menuFile, wxID_ANY, wxString( _("&New") ) + wxT('\t') + wxT("Ctrl-N"), wxEmptyString, wxITEM_NORMAL );
m_menuFile->Append( m_menuItemNew );
- m_menuItemSave = new wxMenuItem( m_menuFile, wxID_ANY, wxString( _("S&ave configuration...") ) + wxT('\t') + wxT("CTRL-S"), wxEmptyString, wxITEM_NORMAL );
+ m_menuItemSave = new wxMenuItem( m_menuFile, wxID_ANY, wxString( _("S&ave configuration...") ) + wxT('\t') + wxT("Ctrl-S"), wxEmptyString, wxITEM_NORMAL );
m_menuFile->Append( m_menuItemSave );
- m_menuItemLoad = new wxMenuItem( m_menuFile, wxID_ANY, wxString( _("&Load configuration...") ) + wxT('\t') + wxT("CTRL-L"), wxEmptyString, wxITEM_NORMAL );
+ m_menuItemLoad = new wxMenuItem( m_menuFile, wxID_ANY, wxString( _("&Load configuration...") ) + wxT('\t') + wxT("Ctrl-L"), wxEmptyString, wxITEM_NORMAL );
m_menuFile->Append( m_menuItemLoad );
wxMenuItem* m_separator3;
m_separator3 = m_menuFile->AppendSeparator();
wxMenuItem* m_menuItem4;
- m_menuItem4 = new wxMenuItem( m_menuFile, wxID_EXIT, wxString( _("&Quit") ) + wxT('\t') + wxT("CTRL-Q"), wxEmptyString, wxITEM_NORMAL );
+ m_menuItem4 = new wxMenuItem( m_menuFile, wxID_EXIT, wxString( _("&Quit") ) + wxT('\t') + wxT("Ctrl-Q"), wxEmptyString, wxITEM_NORMAL );
m_menuFile->Append( m_menuItem4 );
m_menubar1->Append( m_menuFile, _("&Program") );
@@ -84,7 +84,7 @@ MainDialogGenerated::MainDialogGenerated( wxWindow* parent, wxWindowID id, const
wxMenuItem* m_separator5;
m_separator5 = m_menuHelp->AppendSeparator();
- m_menuItemAbout = new wxMenuItem( m_menuHelp, wxID_ABOUT, wxString( _("&About...") ) + wxT('\t') + wxT("SHIFT-F1"), wxEmptyString, wxITEM_NORMAL );
+ m_menuItemAbout = new wxMenuItem( m_menuHelp, wxID_ABOUT, wxString( _("&About...") ) + wxT('\t') + wxT("Shift-F1"), wxEmptyString, wxITEM_NORMAL );
m_menuHelp->Append( m_menuItemAbout );
m_menubar1->Append( m_menuHelp, _("&Help") );
@@ -96,8 +96,11 @@ MainDialogGenerated::MainDialogGenerated( wxWindow* parent, wxWindowID id, const
m_panelTopButtons = new wxPanel( this, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxRAISED_BORDER|wxTAB_TRAVERSAL );
bSizerTopButtons = new wxBoxSizer( wxHORIZONTAL );
+ wxBoxSizer* bSizer155;
+ bSizer155 = new wxBoxSizer( wxHORIZONTAL );
- bSizerTopButtons->Add( 15, 0, 0, wxALIGN_CENTER_VERTICAL, 5 );
+
+ bSizer155->Add( 15, 0, 0, wxALIGN_CENTER_VERTICAL, 5 );
wxFlexGridSizer* fgSizer121;
fgSizer121 = new wxFlexGridSizer( 2, 2, 0, 0 );
@@ -138,10 +141,15 @@ MainDialogGenerated::MainDialogGenerated( wxWindow* parent, wxWindowID id, const
fgSizer121->Add( m_bpButtonCmpConfig, 0, wxALIGN_CENTER_VERTICAL|wxLEFT, 3 );
- bSizerTopButtons->Add( fgSizer121, 0, wxALIGN_CENTER_VERTICAL|wxBOTTOM, 5 );
+ bSizer155->Add( fgSizer121, 0, wxALIGN_CENTER_VERTICAL|wxBOTTOM, 5 );
+
+ bSizerTopButtons->Add( bSizer155, 0, wxALIGN_CENTER_VERTICAL, 5 );
+
+ bSizerTopButtons->Add( 0, 0, 1, wxALIGN_CENTER_VERTICAL, 5 );
- bSizerTopButtons->Add( 0, 0, 1, 0, 5 );
+ wxBoxSizer* bSizer1551;
+ bSizer1551 = new wxBoxSizer( wxHORIZONTAL );
wxFlexGridSizer* fgSizer12;
fgSizer12 = new wxFlexGridSizer( 2, 2, 0, 0 );
@@ -169,10 +177,12 @@ MainDialogGenerated::MainDialogGenerated( wxWindow* parent, wxWindowID id, const
fgSizer12->Add( m_buttonStartSync, 0, wxALIGN_CENTER_VERTICAL, 5 );
- bSizerTopButtons->Add( fgSizer12, 0, wxALIGN_CENTER_VERTICAL|wxBOTTOM, 5 );
+ bSizer1551->Add( fgSizer12, 0, wxALIGN_CENTER_VERTICAL|wxBOTTOM, 5 );
- bSizerTopButtons->Add( 15, 0, 0, wxALIGN_CENTER_VERTICAL, 5 );
+ bSizer1551->Add( 15, 0, 0, wxALIGN_CENTER_VERTICAL, 5 );
+
+ bSizerTopButtons->Add( bSizer1551, 0, wxALIGN_CENTER_VERTICAL, 5 );
m_panelTopButtons->SetSizer( bSizerTopButtons );
m_panelTopButtons->Layout();
@@ -1581,7 +1591,7 @@ SyncCfgDlgGenerated::SyncCfgDlgGenerated( wxWindow* parent, wxWindowID id, const
fgSizer1->Add( m_buttonAutomatic, 0, wxALIGN_CENTER_VERTICAL|wxEXPAND, 5 );
m_staticText81 = new wxStaticText( this, wxID_ANY, _("Identify and propagate changes on both sides using a database. Deletions and conflicts are detected automatically."), wxDefaultPosition, wxDefaultSize, 0 );
- m_staticText81->Wrap( 300 );
+ m_staticText81->Wrap( 400 );
fgSizer1->Add( m_staticText81, 0, wxALIGN_CENTER_VERTICAL|wxLEFT, 5 );
m_radioBtnMirror = new wxRadioButton( this, wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0 );
@@ -1595,7 +1605,7 @@ SyncCfgDlgGenerated::SyncCfgDlgGenerated( wxWindow* parent, wxWindowID id, const
fgSizer1->Add( m_buttonOneWay, 0, wxALIGN_CENTER_VERTICAL|wxEXPAND, 5 );
m_staticText8 = new wxStaticText( this, wxID_ANY, _("Mirror backup of left folder. Right folder is modified to exactly match left folder after synchronization."), wxDefaultPosition, wxDefaultSize, 0 );
- m_staticText8->Wrap( 300 );
+ m_staticText8->Wrap( 400 );
fgSizer1->Add( m_staticText8, 0, wxLEFT|wxALIGN_CENTER_VERTICAL, 5 );
m_radioBtnUpdate = new wxRadioButton( this, wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0 );
@@ -1609,34 +1619,21 @@ SyncCfgDlgGenerated::SyncCfgDlgGenerated( wxWindow* parent, wxWindowID id, const
fgSizer1->Add( m_buttonUpdate, 0, wxALIGN_CENTER_VERTICAL|wxEXPAND, 5 );
m_staticText101 = new wxStaticText( this, wxID_ANY, _("Copy new or updated files to right folder."), wxDefaultPosition, wxDefaultSize, 0 );
- m_staticText101->Wrap( 300 );
+ m_staticText101->Wrap( 400 );
fgSizer1->Add( m_staticText101, 0, wxALIGN_CENTER_VERTICAL|wxLEFT, 5 );
m_radioBtnCustom = new wxRadioButton( this, wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0 );
m_radioBtnCustom->SetFont( wxFont( 11, 70, 90, 92, false, wxEmptyString ) );
- m_radioBtnCustom->Enable( false );
fgSizer1->Add( m_radioBtnCustom, 0, wxALIGN_CENTER_VERTICAL, 5 );
- wxBoxSizer* bSizer65;
- bSizer65 = new wxBoxSizer( wxVERTICAL );
-
-
- bSizer65->Add( 0, 0, 1, wxEXPAND, 5 );
+ m_buttonUpdate1 = new wxButton( this, wxID_ANY, _("Custom"), wxDefaultPosition, wxSize( -1,-1 ), 0 );
+ m_buttonUpdate1->SetFont( wxFont( 11, 70, 90, 92, false, wxEmptyString ) );
- m_staticText23 = new wxStaticText( this, wxID_ANY, _("Custom"), wxDefaultPosition, wxSize( -1,-1 ), wxALIGN_CENTRE|wxSTATIC_BORDER );
- m_staticText23->Wrap( -1 );
- m_staticText23->SetFont( wxFont( 11, 70, 90, 92, false, wxEmptyString ) );
-
- bSizer65->Add( m_staticText23, 0, wxALIGN_CENTER_VERTICAL|wxEXPAND, 5 );
-
-
- bSizer65->Add( 0, 0, 1, wxEXPAND, 5 );
-
- fgSizer1->Add( bSizer65, 0, wxALIGN_CENTER_VERTICAL|wxEXPAND, 5 );
+ fgSizer1->Add( m_buttonUpdate1, 0, wxALIGN_CENTER_VERTICAL|wxEXPAND, 5 );
m_staticText9 = new wxStaticText( this, wxID_ANY, _("Configure your own synchronization rules."), wxDefaultPosition, wxDefaultSize, 0 );
- m_staticText9->Wrap( 300 );
+ m_staticText9->Wrap( 400 );
fgSizer1->Add( m_staticText9, 0, wxALIGN_CENTER_VERTICAL|wxLEFT, 5 );
sbSizer7->Add( fgSizer1, 0, 0, 5 );
@@ -1849,11 +1846,12 @@ SyncCfgDlgGenerated::SyncCfgDlgGenerated( wxWindow* parent, wxWindowID id, const
this->Connect( wxEVT_CLOSE_WINDOW, wxCloseEventHandler( SyncCfgDlgGenerated::OnClose ) );
m_radioBtnAutomatic->Connect( wxEVT_COMMAND_RADIOBUTTON_SELECTED, wxCommandEventHandler( SyncCfgDlgGenerated::OnSyncAutomatic ), NULL, this );
m_buttonAutomatic->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( SyncCfgDlgGenerated::OnSyncAutomatic ), NULL, this );
- m_radioBtnMirror->Connect( wxEVT_COMMAND_RADIOBUTTON_SELECTED, wxCommandEventHandler( SyncCfgDlgGenerated::OnSyncLeftToRight ), NULL, this );
- m_buttonOneWay->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( SyncCfgDlgGenerated::OnSyncLeftToRight ), NULL, this );
+ m_radioBtnMirror->Connect( wxEVT_COMMAND_RADIOBUTTON_SELECTED, wxCommandEventHandler( SyncCfgDlgGenerated::OnSyncMirror ), NULL, this );
+ m_buttonOneWay->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( SyncCfgDlgGenerated::OnSyncMirror ), NULL, this );
m_radioBtnUpdate->Connect( wxEVT_COMMAND_RADIOBUTTON_SELECTED, wxCommandEventHandler( SyncCfgDlgGenerated::OnSyncUpdate ), NULL, this );
m_buttonUpdate->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( SyncCfgDlgGenerated::OnSyncUpdate ), NULL, this );
m_radioBtnCustom->Connect( wxEVT_COMMAND_RADIOBUTTON_SELECTED, wxCommandEventHandler( SyncCfgDlgGenerated::OnSyncCustom ), NULL, this );
+ m_buttonUpdate1->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( SyncCfgDlgGenerated::OnSyncCustom ), NULL, this );
m_choiceHandleError->Connect( wxEVT_COMMAND_CHOICE_SELECTED, wxCommandEventHandler( SyncCfgDlgGenerated::OnChangeErrorHandling ), NULL, this );
m_choiceHandleDeletion->Connect( wxEVT_COMMAND_CHOICE_SELECTED, wxCommandEventHandler( SyncCfgDlgGenerated::OnChangeDeletionHandling ), NULL, this );
m_buttonOK->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( SyncCfgDlgGenerated::OnApply ), NULL, this );
@@ -1872,11 +1870,12 @@ SyncCfgDlgGenerated::~SyncCfgDlgGenerated()
this->Disconnect( wxEVT_CLOSE_WINDOW, wxCloseEventHandler( SyncCfgDlgGenerated::OnClose ) );
m_radioBtnAutomatic->Disconnect( wxEVT_COMMAND_RADIOBUTTON_SELECTED, wxCommandEventHandler( SyncCfgDlgGenerated::OnSyncAutomatic ), NULL, this );
m_buttonAutomatic->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( SyncCfgDlgGenerated::OnSyncAutomatic ), NULL, this );
- m_radioBtnMirror->Disconnect( wxEVT_COMMAND_RADIOBUTTON_SELECTED, wxCommandEventHandler( SyncCfgDlgGenerated::OnSyncLeftToRight ), NULL, this );
- m_buttonOneWay->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( SyncCfgDlgGenerated::OnSyncLeftToRight ), NULL, this );
+ m_radioBtnMirror->Disconnect( wxEVT_COMMAND_RADIOBUTTON_SELECTED, wxCommandEventHandler( SyncCfgDlgGenerated::OnSyncMirror ), NULL, this );
+ m_buttonOneWay->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( SyncCfgDlgGenerated::OnSyncMirror ), NULL, this );
m_radioBtnUpdate->Disconnect( wxEVT_COMMAND_RADIOBUTTON_SELECTED, wxCommandEventHandler( SyncCfgDlgGenerated::OnSyncUpdate ), NULL, this );
m_buttonUpdate->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( SyncCfgDlgGenerated::OnSyncUpdate ), NULL, this );
m_radioBtnCustom->Disconnect( wxEVT_COMMAND_RADIOBUTTON_SELECTED, wxCommandEventHandler( SyncCfgDlgGenerated::OnSyncCustom ), NULL, this );
+ m_buttonUpdate1->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( SyncCfgDlgGenerated::OnSyncCustom ), NULL, this );
m_choiceHandleError->Disconnect( wxEVT_COMMAND_CHOICE_SELECTED, wxCommandEventHandler( SyncCfgDlgGenerated::OnChangeErrorHandling ), NULL, this );
m_choiceHandleDeletion->Disconnect( wxEVT_COMMAND_CHOICE_SELECTED, wxCommandEventHandler( SyncCfgDlgGenerated::OnChangeDeletionHandling ), NULL, this );
m_buttonOK->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( SyncCfgDlgGenerated::OnApply ), NULL, this );
@@ -1910,18 +1909,18 @@ CmpCfgDlgGenerated::CmpCfgDlgGenerated( wxWindow* parent, wxWindowID id, const w
m_radioBtnSizeDate = new wxRadioButton( this, wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, wxRB_GROUP );
m_radioBtnSizeDate->SetValue( true );
- m_radioBtnSizeDate->SetToolTip( _("Files are found equal if\n - filesize\n - last write time and date\nare the same") );
+ m_radioBtnSizeDate->SetToolTip( _("Files are found equal if\n - file size\n - last write time and date\nare the same") );
fgSizer16->Add( m_radioBtnSizeDate, 0, wxALIGN_CENTER_VERTICAL, 5 );
m_bitmapByTime = new wxStaticBitmap( this, wxID_ANY, wxNullBitmap, wxDefaultPosition, wxDefaultSize, 0 );
- m_bitmapByTime->SetToolTip( _("Files are found equal if\n - filesize\n - last write time and date\nare the same") );
+ m_bitmapByTime->SetToolTip( _("Files are found equal if\n - file size\n - last write time and date\nare the same") );
fgSizer16->Add( m_bitmapByTime, 0, wxALIGN_CENTER_VERTICAL|wxALIGN_CENTER_HORIZONTAL, 5 );
m_buttonTimeSize = new wxButton( this, wxID_ANY, _("File size and date"), wxDefaultPosition, wxSize( -1,42 ), 0 );
m_buttonTimeSize->SetFont( wxFont( 11, 70, 90, 92, false, wxEmptyString ) );
- m_buttonTimeSize->SetToolTip( _("Files are found equal if\n - filesize\n - last write time and date\nare the same") );
+ m_buttonTimeSize->SetToolTip( _("Files are found equal if\n - file size\n - last write time and date\nare the same") );
fgSizer16->Add( m_buttonTimeSize, 0, wxALIGN_CENTER_VERTICAL|wxEXPAND|wxALL, 5 );
@@ -2366,7 +2365,7 @@ HelpDlgGenerated::HelpDlgGenerated( wxWindow* parent, wxWindowID id, const wxStr
m_staticText61->Wrap( 500 );
bSizer70->Add( m_staticText61, 0, wxALL, 5 );
- m_treeCtrl1 = new wxTreeCtrl( m_scrolledWindow1, wxID_ANY, wxDefaultPosition, wxSize( -1,175 ), wxTR_DEFAULT_STYLE );
+ m_treeCtrl1 = new wxTreeCtrl( m_scrolledWindow1, wxID_ANY, wxDefaultPosition, wxSize( -1,220 ), wxTR_DEFAULT_STYLE );
m_treeCtrl1->SetBackgroundColour( wxColour( 208, 208, 208 ) );
bSizer70->Add( m_treeCtrl1, 0, wxALL|wxALIGN_CENTER_HORIZONTAL|wxEXPAND, 5 );
@@ -2395,7 +2394,7 @@ HelpDlgGenerated::HelpDlgGenerated( wxWindow* parent, wxWindowID id, const wxStr
m_staticText80->Wrap( -1 );
bSizer70->Add( m_staticText80, 0, wxRIGHT|wxLEFT, 5 );
- m_staticText78 = new wxStaticText( m_scrolledWindow1, wxID_ANY, _("- conflict"), wxDefaultPosition, wxDefaultSize, 0 );
+ m_staticText78 = new wxStaticText( m_scrolledWindow1, wxID_ANY, _("- conflict (same date, different size)"), wxDefaultPosition, wxDefaultSize, 0 );
m_staticText78->Wrap( -1 );
bSizer70->Add( m_staticText78, 0, wxRIGHT|wxLEFT, 5 );
@@ -2509,40 +2508,108 @@ AboutDlgGenerated::AboutDlgGenerated( wxWindow* parent, wxWindowID id, const wxS
wxBoxSizer* bSizer53;
bSizer53 = new wxBoxSizer( wxVERTICAL );
- m_scrolledWindowCodeInfo = new wxScrolledWindow( this, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxDOUBLE_BORDER|wxHSCROLL|wxVSCROLL );
- m_scrolledWindowCodeInfo->SetScrollRate( 5, 5 );
- m_scrolledWindowCodeInfo->SetBackgroundColour( wxColour( 208, 208, 208 ) );
- m_scrolledWindowCodeInfo->SetMinSize( wxSize( -1,120 ) );
+ m_panel33 = new wxPanel( this, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxDOUBLE_BORDER|wxTAB_TRAVERSAL );
+ m_panel33->SetBackgroundColour( wxColour( 208, 208, 208 ) );
bSizerCodeInfo = new wxBoxSizer( wxVERTICAL );
- m_staticText72 = new wxStaticText( m_scrolledWindowCodeInfo, wxID_ANY, _("Source code written completely in C++ utilizing:"), wxDefaultPosition, wxDefaultSize, 0 );
+ m_staticText72 = new wxStaticText( m_panel33, wxID_ANY, _("Source code written in C++ utilizing:"), wxDefaultPosition, wxDefaultSize, 0 );
m_staticText72->Wrap( -1 );
m_staticText72->SetFont( wxFont( wxNORMAL_FONT->GetPointSize(), 70, 90, 92, false, wxEmptyString ) );
- bSizerCodeInfo->Add( m_staticText72, 0, wxTOP|wxBOTTOM|wxLEFT|wxEXPAND, 5 );
+ bSizerCodeInfo->Add( m_staticText72, 0, wxTOP|wxBOTTOM|wxLEFT, 5 );
+
+ wxBoxSizer* bSizer167;
+ bSizer167 = new wxBoxSizer( wxVERTICAL );
+
+ wxBoxSizer* bSizer171;
+ bSizer171 = new wxBoxSizer( wxHORIZONTAL );
+
+ m_hyperlink9 = new wxHyperlinkCtrl( m_panel33, wxID_ANY, _("MinGW"), wxT("http://www.mingw.org"), wxDefaultPosition, wxDefaultSize, wxHL_DEFAULT_STYLE );
+ m_hyperlink9->SetBackgroundColour( wxColour( 208, 208, 208 ) );
+
+ bSizer171->Add( m_hyperlink9, 0, wxALIGN_CENTER_VERTICAL|wxRIGHT, 5 );
+
+ m_hyperlink10 = new wxHyperlinkCtrl( m_panel33, wxID_ANY, _("Code::Blocks"), wxT("http://www.codeblocks.org"), wxDefaultPosition, wxDefaultSize, wxHL_DEFAULT_STYLE );
+ m_hyperlink10->SetBackgroundColour( wxColour( 208, 208, 208 ) );
+
+ bSizer171->Add( m_hyperlink10, 0, wxALIGN_CENTER_VERTICAL|wxRIGHT, 5 );
+
+ m_hyperlink7 = new wxHyperlinkCtrl( m_panel33, wxID_ANY, _("wxWidgets"), wxT("http://www.wxwidgets.org"), wxDefaultPosition, wxDefaultSize, wxHL_DEFAULT_STYLE );
+ m_hyperlink7->SetBackgroundColour( wxColour( 208, 208, 208 ) );
+
+ bSizer171->Add( m_hyperlink7, 0, wxALIGN_CENTER_VERTICAL|wxRIGHT, 5 );
+
+ m_hyperlink13 = new wxHyperlinkCtrl( m_panel33, wxID_ANY, _("Boost"), wxT("http://www.boost.org"), wxDefaultPosition, wxDefaultSize, wxHL_DEFAULT_STYLE );
+ m_hyperlink13->SetBackgroundColour( wxColour( 208, 208, 208 ) );
+
+ bSizer171->Add( m_hyperlink13, 0, wxALIGN_CENTER_VERTICAL|wxRIGHT, 5 );
+
+ m_hyperlink14 = new wxHyperlinkCtrl( m_panel33, wxID_ANY, _("wxFormBuilder"), wxT("http://wxformbuilder.org"), wxDefaultPosition, wxDefaultSize, wxHL_DEFAULT_STYLE );
+ m_hyperlink14->SetBackgroundColour( wxColour( 208, 208, 208 ) );
- m_staticText73 = new wxStaticText( m_scrolledWindowCodeInfo, wxID_ANY, _(" MinGW \t- Windows port of GNU Compiler Collection\n wxWidgets \t- Open-Source GUI framework\n wxFormBuilder\t- wxWidgets GUI-builder\n CodeBlocks \t- Open-Source IDE"), wxDefaultPosition, wxDefaultSize, 0 );
- m_staticText73->Wrap( -1 );
- bSizerCodeInfo->Add( m_staticText73, 0, wxALL|wxEXPAND, 5 );
+ bSizer171->Add( m_hyperlink14, 0, wxALIGN_CENTER_VERTICAL|wxRIGHT, 5 );
- m_hyperlink21 = new wxHyperlinkCtrl( m_scrolledWindowCodeInfo, wxID_ANY, _("- ZenJu -"), wxT("mailto:zhnmju123@gmx.de"), wxDefaultPosition, wxDefaultSize, wxHL_DEFAULT_STYLE );
+ m_hyperlink16 = new wxHyperlinkCtrl( m_panel33, wxID_ANY, _("Artistic Style"), wxT("http://astyle.sourceforge.net"), wxDefaultPosition, wxDefaultSize, wxHL_DEFAULT_STYLE );
+ m_hyperlink16->SetBackgroundColour( wxColour( 208, 208, 208 ) );
+
+ bSizer171->Add( m_hyperlink16, 0, wxALIGN_CENTER_VERTICAL, 5 );
+
+ bSizer167->Add( bSizer171, 0, wxALIGN_CENTER_HORIZONTAL|wxBOTTOM, 5 );
+
+ wxBoxSizer* bSizer172;
+ bSizer172 = new wxBoxSizer( wxHORIZONTAL );
+
+ m_hyperlink8 = new wxHyperlinkCtrl( m_panel33, wxID_ANY, _("Loki"), wxT("http://sourceforge.net/projects/loki-lib"), wxDefaultPosition, wxDefaultSize, wxHL_DEFAULT_STYLE );
+ m_hyperlink8->SetBackgroundColour( wxColour( 208, 208, 208 ) );
+
+ bSizer172->Add( m_hyperlink8, 0, wxALIGN_CENTER_VERTICAL|wxRIGHT, 5 );
+
+ m_hyperlink15 = new wxHyperlinkCtrl( m_panel33, wxID_ANY, _("TinyXML"), wxT("http://www.grinninglizard.com/tinyxml"), wxDefaultPosition, wxDefaultSize, wxHL_DEFAULT_STYLE );
+ m_hyperlink15->SetBackgroundColour( wxColour( 208, 208, 208 ) );
+
+ bSizer172->Add( m_hyperlink15, 0, wxALIGN_CENTER_VERTICAL|wxRIGHT, 5 );
+
+ m_hyperlink11 = new wxHyperlinkCtrl( m_panel33, wxID_ANY, _("MS Visual C++"), wxT("http://msdn.microsoft.com/library/60k1461a.aspx"), wxDefaultPosition, wxDefaultSize, wxHL_DEFAULT_STYLE );
+ m_hyperlink11->SetBackgroundColour( wxColour( 208, 208, 208 ) );
+
+ bSizer172->Add( m_hyperlink11, 0, wxALIGN_CENTER_VERTICAL|wxRIGHT, 5 );
+
+ m_hyperlink12 = new wxHyperlinkCtrl( m_panel33, wxID_ANY, _("Google Test"), wxT("http://code.google.com/p/googletest"), wxDefaultPosition, wxDefaultSize, wxHL_DEFAULT_STYLE );
+ m_hyperlink12->SetBackgroundColour( wxColour( 208, 208, 208 ) );
+
+ bSizer172->Add( m_hyperlink12, 0, wxALIGN_CENTER_VERTICAL|wxRIGHT, 5 );
+
+ m_hyperlink17 = new wxHyperlinkCtrl( m_panel33, wxID_ANY, _("inotify"), wxT("http://inotify.aiken.cz"), wxDefaultPosition, wxDefaultSize, wxHL_DEFAULT_STYLE );
+ m_hyperlink17->SetBackgroundColour( wxColour( 208, 208, 208 ) );
+
+ bSizer172->Add( m_hyperlink17, 0, wxALIGN_CENTER_VERTICAL|wxRIGHT, 5 );
+
+ m_hyperlink18 = new wxHyperlinkCtrl( m_panel33, wxID_ANY, _("Unicode NSIS"), wxT("http://www.scratchpaper.com"), wxDefaultPosition, wxDefaultSize, wxHL_DEFAULT_STYLE );
+ m_hyperlink18->SetBackgroundColour( wxColour( 208, 208, 208 ) );
+
+ bSizer172->Add( m_hyperlink18, 0, wxALIGN_CENTER_VERTICAL|wxRIGHT, 5 );
+
+ bSizer167->Add( bSizer172, 0, wxALIGN_CENTER_HORIZONTAL, 5 );
+
+ bSizerCodeInfo->Add( bSizer167, 0, wxALIGN_CENTER_HORIZONTAL, 5 );
+
+ m_hyperlink21 = new wxHyperlinkCtrl( m_panel33, wxID_ANY, _("- ZenJu -"), wxT("mailto:zhnmju123@gmx.de"), wxDefaultPosition, wxDefaultSize, wxHL_DEFAULT_STYLE );
m_hyperlink21->SetFont( wxFont( 10, 74, 93, 92, false, wxT("Segoe Print") ) );
m_hyperlink21->SetBackgroundColour( wxColour( 208, 208, 208 ) );
m_hyperlink21->SetToolTip( _("zhnmju123@gmx.de") );
bSizerCodeInfo->Add( m_hyperlink21, 0, wxALIGN_CENTER_HORIZONTAL, 5 );
- m_scrolledWindowCodeInfo->SetSizer( bSizerCodeInfo );
- m_scrolledWindowCodeInfo->Layout();
- bSizerCodeInfo->Fit( m_scrolledWindowCodeInfo );
- bSizer53->Add( m_scrolledWindowCodeInfo, 0, wxALIGN_CENTER_HORIZONTAL|wxEXPAND|wxBOTTOM, 10 );
+ m_panel33->SetSizer( bSizerCodeInfo );
+ m_panel33->Layout();
+ bSizerCodeInfo->Fit( m_panel33 );
+ bSizer53->Add( m_panel33, 0, wxBOTTOM|wxALIGN_CENTER_HORIZONTAL|wxEXPAND, 5 );
m_scrolledWindowTranslators = new wxScrolledWindow( this, wxID_ANY, wxDefaultPosition, wxSize( -1,-1 ), wxDOUBLE_BORDER|wxHSCROLL|wxVSCROLL );
m_scrolledWindowTranslators->SetScrollRate( 5, 5 );
m_scrolledWindowTranslators->SetBackgroundColour( wxColour( 208, 208, 208 ) );
- m_scrolledWindowTranslators->SetMinSize( wxSize( -1,140 ) );
- m_scrolledWindowTranslators->SetMaxSize( wxSize( -1,145 ) );
+ m_scrolledWindowTranslators->SetMinSize( wxSize( -1,180 ) );
bSizerTranslators = new wxBoxSizer( wxVERTICAL );
@@ -2999,7 +3066,7 @@ DeleteDlgGenerated::~DeleteDlgGenerated()
FilterDlgGenerated::FilterDlgGenerated( wxWindow* parent, wxWindowID id, const wxString& title, const wxPoint& pos, const wxSize& size, long style ) : wxDialog( parent, id, title, pos, size, style )
{
- this->SetSizeHints( wxDefaultSize, wxDefaultSize );
+ this->SetSizeHints( wxSize( 370,380 ), wxDefaultSize );
wxBoxSizer* bSizer21;
bSizer21 = new wxBoxSizer( wxVERTICAL );
@@ -3035,8 +3102,8 @@ FilterDlgGenerated::FilterDlgGenerated( wxWindow* parent, wxWindowID id, const w
wxBoxSizer* bSizer70;
bSizer70 = new wxBoxSizer( wxHORIZONTAL );
- m_staticText44 = new wxStaticText( this, wxID_ANY, _("Only files/directories that pass filtering will be selected for synchronization. The filter will be applied to the name relative(!) to the base synchronization directories."), wxDefaultPosition, wxDefaultSize, 0 );
- m_staticText44->Wrap( 400 );
+ m_staticText44 = new wxStaticText( this, wxID_ANY, _("Only files/directories that match all filter settings will be selected for synchronization.\nNote: The name filter must be specified relative(!) to main synchronization directories."), wxDefaultPosition, wxSize( 550,-1 ), wxALIGN_CENTRE );
+ m_staticText44->Wrap( 550 );
bSizer70->Add( m_staticText44, 0, wxALIGN_CENTER_HORIZONTAL|wxALIGN_CENTER_VERTICAL, 5 );
m_bpButtonHelp = new wxBitmapButton( this, wxID_HELP, wxNullBitmap, wxDefaultPosition, wxSize( 40,40 ), wxBU_AUTODRAW );
@@ -3104,61 +3171,135 @@ FilterDlgGenerated::FilterDlgGenerated( wxWindow* parent, wxWindowID id, const w
bSizer69->Fit( m_panel13 );
bSizer21->Add( m_panel13, 0, wxALIGN_CENTER_HORIZONTAL|wxBOTTOM|wxEXPAND, 5 );
+
+ bSizer21->Add( 0, 0, 0, 0, 5 );
+
+ wxBoxSizer* bSizer159;
+ bSizer159 = new wxBoxSizer( wxHORIZONTAL );
+
+ wxBoxSizer* bSizer166;
+ bSizer166 = new wxBoxSizer( wxVERTICAL );
+
wxStaticBoxSizer* sbSizer8;
- sbSizer8 = new wxStaticBoxSizer( new wxStaticBox( this, wxID_ANY, wxEmptyString ), wxVERTICAL );
+ sbSizer8 = new wxStaticBoxSizer( new wxStaticBox( this, wxID_ANY, _("Include") ), wxHORIZONTAL );
- wxFlexGridSizer* fgSizer3;
- fgSizer3 = new wxFlexGridSizer( 2, 2, 0, 0 );
- fgSizer3->AddGrowableCol( 1 );
- fgSizer3->AddGrowableRow( 1 );
- fgSizer3->SetFlexibleDirection( wxBOTH );
- fgSizer3->SetNonFlexibleGrowMode( wxFLEX_GROWMODE_SPECIFIED );
+ m_bitmapInclude = new wxStaticBitmap( this, wxID_ANY, wxNullBitmap, wxDefaultPosition, wxSize( 30,30 ), 0 );
+ sbSizer8->Add( m_bitmapInclude, 0, wxALIGN_CENTER_VERTICAL|wxALIGN_CENTER_HORIZONTAL|wxRIGHT, 5 );
+ m_textCtrlInclude = new wxTextCtrl( this, wxID_ANY, wxEmptyString, wxDefaultPosition, wxSize( -1,-1 ), wxTE_MULTILINE );
+ sbSizer8->Add( m_textCtrlInclude, 1, wxALIGN_CENTER_VERTICAL|wxALIGN_CENTER_HORIZONTAL|wxEXPAND, 5 );
- fgSizer3->Add( 0, 0, 1, wxEXPAND, 5 );
+ bSizer166->Add( sbSizer8, 0, wxALIGN_CENTER_HORIZONTAL|wxALIGN_CENTER_VERTICAL|wxEXPAND, 5 );
- m_staticText15 = new wxStaticText( this, wxID_ANY, _("Include"), wxDefaultPosition, wxDefaultSize, 0 );
- m_staticText15->Wrap( -1 );
- m_staticText15->SetFont( wxFont( 10, 70, 90, 92, false, wxEmptyString ) );
+ wxStaticBoxSizer* sbSizer26;
+ sbSizer26 = new wxStaticBoxSizer( new wxStaticBox( this, wxID_ANY, _("Exclude") ), wxHORIZONTAL );
- fgSizer3->Add( m_staticText15, 0, wxTOP|wxRIGHT|wxLEFT, 5 );
+ m_bitmapExclude = new wxStaticBitmap( this, wxID_ANY, wxNullBitmap, wxDefaultPosition, wxSize( 30,30 ), 0 );
+ sbSizer26->Add( m_bitmapExclude, 0, wxALIGN_CENTER_HORIZONTAL|wxALIGN_CENTER_VERTICAL|wxRIGHT, 5 );
- m_bitmap8 = new wxStaticBitmap( this, wxID_ANY, wxNullBitmap, wxDefaultPosition, wxSize( 30,30 ), 0 );
- fgSizer3->Add( m_bitmap8, 0, wxTOP|wxBOTTOM|wxLEFT|wxALIGN_CENTER_VERTICAL|wxALIGN_CENTER_HORIZONTAL, 5 );
+ m_textCtrlExclude = new wxTextCtrl( this, wxID_ANY, wxEmptyString, wxDefaultPosition, wxSize( -1,-1 ), wxTE_MULTILINE );
+ sbSizer26->Add( m_textCtrlExclude, 1, wxALIGN_CENTER_VERTICAL|wxEXPAND|wxALIGN_CENTER_HORIZONTAL, 5 );
- m_textCtrlInclude = new wxTextCtrl( this, wxID_ANY, wxEmptyString, wxDefaultPosition, wxSize( -1,-1 ), wxTE_MULTILINE );
- fgSizer3->Add( m_textCtrlInclude, 1, wxALL|wxALIGN_CENTER_VERTICAL|wxEXPAND, 5 );
+ bSizer166->Add( sbSizer26, 1, wxALIGN_CENTER_HORIZONTAL|wxEXPAND, 5 );
- sbSizer8->Add( fgSizer3, 1, wxEXPAND, 5 );
+ bSizer159->Add( bSizer166, 1, wxALIGN_CENTER_VERTICAL|wxEXPAND, 5 );
- wxFlexGridSizer* fgSizer4;
- fgSizer4 = new wxFlexGridSizer( 2, 2, 0, 0 );
- fgSizer4->AddGrowableCol( 1 );
- fgSizer4->AddGrowableRow( 1 );
- fgSizer4->SetFlexibleDirection( wxBOTH );
- fgSizer4->SetNonFlexibleGrowMode( wxFLEX_GROWMODE_SPECIFIED );
+ bSizer159->Add( 5, 0, 0, 0, 5 );
- fgSizer4->Add( 0, 0, 1, wxEXPAND, 5 );
+ wxBoxSizer* bSizer160;
+ bSizer160 = new wxBoxSizer( wxVERTICAL );
- m_staticText16 = new wxStaticText( this, wxID_ANY, _("Exclude"), wxDefaultPosition, wxDefaultSize, 0 );
- m_staticText16->Wrap( -1 );
- m_staticText16->SetFont( wxFont( 10, 70, 90, 92, false, wxEmptyString ) );
+ wxStaticBoxSizer* sbSizer25;
+ sbSizer25 = new wxStaticBoxSizer( new wxStaticBox( this, wxID_ANY, _("Date") ), wxHORIZONTAL );
- fgSizer4->Add( m_staticText16, 0, wxTOP|wxRIGHT|wxLEFT, 5 );
+ wxBoxSizer* bSizer169;
+ bSizer169 = new wxBoxSizer( wxHORIZONTAL );
- m_bitmap9 = new wxStaticBitmap( this, wxID_ANY, wxNullBitmap, wxDefaultPosition, wxSize( 30,30 ), 0 );
- fgSizer4->Add( m_bitmap9, 0, wxTOP|wxBOTTOM|wxLEFT|wxALIGN_CENTER_HORIZONTAL|wxALIGN_CENTER_VERTICAL, 5 );
+ m_bitmapFilterDate = new wxStaticBitmap( this, wxID_ANY, wxNullBitmap, wxDefaultPosition, wxSize( 34,34 ), 0 );
+ bSizer169->Add( m_bitmapFilterDate, 0, wxALIGN_CENTER_HORIZONTAL|wxALIGN_CENTER_VERTICAL|wxRIGHT, 5 );
- m_textCtrlExclude = new wxTextCtrl( this, wxID_ANY, wxEmptyString, wxDefaultPosition, wxSize( -1,-1 ), wxTE_MULTILINE );
- fgSizer4->Add( m_textCtrlExclude, 1, wxALL|wxALIGN_CENTER_VERTICAL|wxEXPAND, 5 );
+ wxBoxSizer* bSizer165;
+ bSizer165 = new wxBoxSizer( wxVERTICAL );
- sbSizer8->Add( fgSizer4, 1, wxEXPAND, 5 );
+ m_staticText103 = new wxStaticText( this, wxID_ANY, _("Select time span:"), wxDefaultPosition, wxDefaultSize, 0 );
+ m_staticText103->Wrap( -1 );
+ bSizer165->Add( m_staticText103, 0, 0, 5 );
- bSizer21->Add( sbSizer8, 1, wxALIGN_CENTER_HORIZONTAL|wxRIGHT|wxLEFT|wxEXPAND, 5 );
+ wxBoxSizer* bSizer164;
+ bSizer164 = new wxBoxSizer( wxVERTICAL );
+ m_spinCtrlTimespan = new wxSpinCtrl( this, wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, wxSP_ARROW_KEYS, 0, 2000000000, 0 );
+ bSizer164->Add( m_spinCtrlTimespan, 0, wxALIGN_CENTER_VERTICAL, 5 );
- bSizer21->Add( 0, 0, 0, 0, 5 );
+ wxArrayString m_choiceUnitTimespanChoices;
+ m_choiceUnitTimespan = new wxChoice( this, wxID_ANY, wxDefaultPosition, wxDefaultSize, m_choiceUnitTimespanChoices, 0 );
+ m_choiceUnitTimespan->SetSelection( 0 );
+ bSizer164->Add( m_choiceUnitTimespan, 0, wxALIGN_CENTER_VERTICAL, 5 );
+
+ bSizer165->Add( bSizer164, 0, wxALIGN_CENTER_HORIZONTAL|wxALIGN_CENTER_VERTICAL|wxTOP, 5 );
+
+ bSizer169->Add( bSizer165, 0, wxALIGN_CENTER_VERTICAL, 5 );
+
+ sbSizer25->Add( bSizer169, 0, 0, 5 );
+
+ bSizer160->Add( sbSizer25, 0, wxALIGN_CENTER_HORIZONTAL, 5 );
+
+ wxStaticBoxSizer* sbSizer81;
+ sbSizer81 = new wxStaticBoxSizer( new wxStaticBox( this, wxID_ANY, _("Size") ), wxHORIZONTAL );
+
+ wxBoxSizer* bSizer170;
+ bSizer170 = new wxBoxSizer( wxHORIZONTAL );
+
+ m_bitmapFilterSize = new wxStaticBitmap( this, wxID_ANY, wxNullBitmap, wxDefaultPosition, wxSize( 32,32 ), 0 );
+ bSizer170->Add( m_bitmapFilterSize, 0, wxALIGN_CENTER_VERTICAL|wxALIGN_CENTER_HORIZONTAL|wxRIGHT, 5 );
+
+ wxBoxSizer* bSizer158;
+ bSizer158 = new wxBoxSizer( wxVERTICAL );
+
+ m_staticText101 = new wxStaticText( this, wxID_ANY, _("Minimum file size:"), wxDefaultPosition, wxDefaultSize, 0 );
+ m_staticText101->Wrap( -1 );
+ bSizer158->Add( m_staticText101, 0, 0, 5 );
+
+ wxBoxSizer* bSizer162;
+ bSizer162 = new wxBoxSizer( wxVERTICAL );
+
+ m_spinCtrlMinSize = new wxSpinCtrl( this, wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, wxSP_ARROW_KEYS, 0, 2000000000, 0 );
+ bSizer162->Add( m_spinCtrlMinSize, 0, wxALIGN_CENTER_VERTICAL, 5 );
+
+ wxArrayString m_choiceUnitMinSizeChoices;
+ m_choiceUnitMinSize = new wxChoice( this, wxID_ANY, wxDefaultPosition, wxDefaultSize, m_choiceUnitMinSizeChoices, 0 );
+ m_choiceUnitMinSize->SetSelection( 0 );
+ bSizer162->Add( m_choiceUnitMinSize, 0, wxALIGN_CENTER_VERTICAL, 5 );
+
+ bSizer158->Add( bSizer162, 0, wxBOTTOM, 5 );
+
+ m_staticText102 = new wxStaticText( this, wxID_ANY, _("Maximum file size:"), wxDefaultPosition, wxDefaultSize, 0 );
+ m_staticText102->Wrap( -1 );
+ bSizer158->Add( m_staticText102, 0, 0, 5 );
+
+ wxBoxSizer* bSizer163;
+ bSizer163 = new wxBoxSizer( wxVERTICAL );
+
+ m_spinCtrlMaxSize = new wxSpinCtrl( this, wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, wxSP_ARROW_KEYS, 0, 2000000000, 0 );
+ bSizer163->Add( m_spinCtrlMaxSize, 0, wxALIGN_CENTER_VERTICAL, 5 );
+
+ wxArrayString m_choiceUnitMaxSizeChoices;
+ m_choiceUnitMaxSize = new wxChoice( this, wxID_ANY, wxDefaultPosition, wxDefaultSize, m_choiceUnitMaxSizeChoices, 0 );
+ m_choiceUnitMaxSize->SetSelection( 0 );
+ bSizer163->Add( m_choiceUnitMaxSize, 0, wxALIGN_CENTER_VERTICAL, 5 );
+
+ bSizer158->Add( bSizer163, 0, wxTOP, 5 );
+
+ bSizer170->Add( bSizer158, 0, wxALIGN_CENTER_HORIZONTAL|wxALIGN_CENTER_VERTICAL, 5 );
+
+ sbSizer81->Add( bSizer170, 0, 0, 5 );
+
+ bSizer160->Add( sbSizer81, 1, wxALIGN_CENTER_HORIZONTAL, 5 );
+
+ bSizer159->Add( bSizer160, 0, wxEXPAND, 5 );
+
+ bSizer21->Add( bSizer159, 1, wxALIGN_CENTER_HORIZONTAL|wxEXPAND|wxRIGHT|wxLEFT, 5 );
wxBoxSizer* bSizer22;
bSizer22 = new wxBoxSizer( wxHORIZONTAL );
@@ -3193,6 +3334,11 @@ FilterDlgGenerated::FilterDlgGenerated( wxWindow* parent, wxWindowID id, const w
// Connect Events
this->Connect( wxEVT_CLOSE_WINDOW, wxCloseEventHandler( FilterDlgGenerated::OnClose ) );
m_bpButtonHelp->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( FilterDlgGenerated::OnHelp ), NULL, this );
+ m_textCtrlInclude->Connect( wxEVT_COMMAND_TEXT_UPDATED, wxCommandEventHandler( FilterDlgGenerated::OnUpdateNameFilter ), NULL, this );
+ m_textCtrlExclude->Connect( wxEVT_COMMAND_TEXT_UPDATED, wxCommandEventHandler( FilterDlgGenerated::OnUpdateNameFilter ), NULL, this );
+ m_choiceUnitTimespan->Connect( wxEVT_COMMAND_CHOICE_SELECTED, wxCommandEventHandler( FilterDlgGenerated::OnUpdateChoice ), NULL, this );
+ m_choiceUnitMinSize->Connect( wxEVT_COMMAND_CHOICE_SELECTED, wxCommandEventHandler( FilterDlgGenerated::OnUpdateChoice ), NULL, this );
+ m_choiceUnitMaxSize->Connect( wxEVT_COMMAND_CHOICE_SELECTED, wxCommandEventHandler( FilterDlgGenerated::OnUpdateChoice ), NULL, this );
m_button9->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( FilterDlgGenerated::OnDefault ), NULL, this );
m_button10->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( FilterDlgGenerated::OnApply ), NULL, this );
m_button17->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( FilterDlgGenerated::OnCancel ), NULL, this );
@@ -3203,6 +3349,11 @@ FilterDlgGenerated::~FilterDlgGenerated()
// Disconnect Events
this->Disconnect( wxEVT_CLOSE_WINDOW, wxCloseEventHandler( FilterDlgGenerated::OnClose ) );
m_bpButtonHelp->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( FilterDlgGenerated::OnHelp ), NULL, this );
+ m_textCtrlInclude->Disconnect( wxEVT_COMMAND_TEXT_UPDATED, wxCommandEventHandler( FilterDlgGenerated::OnUpdateNameFilter ), NULL, this );
+ m_textCtrlExclude->Disconnect( wxEVT_COMMAND_TEXT_UPDATED, wxCommandEventHandler( FilterDlgGenerated::OnUpdateNameFilter ), NULL, this );
+ m_choiceUnitTimespan->Disconnect( wxEVT_COMMAND_CHOICE_SELECTED, wxCommandEventHandler( FilterDlgGenerated::OnUpdateChoice ), NULL, this );
+ m_choiceUnitMinSize->Disconnect( wxEVT_COMMAND_CHOICE_SELECTED, wxCommandEventHandler( FilterDlgGenerated::OnUpdateChoice ), NULL, this );
+ m_choiceUnitMaxSize->Disconnect( wxEVT_COMMAND_CHOICE_SELECTED, wxCommandEventHandler( FilterDlgGenerated::OnUpdateChoice ), NULL, this );
m_button9->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( FilterDlgGenerated::OnDefault ), NULL, this );
m_button10->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( FilterDlgGenerated::OnApply ), NULL, this );
m_button17->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( FilterDlgGenerated::OnCancel ), NULL, this );
diff --git a/ui/gui_generated.h b/ui/gui_generated.h
index 621ad1fe..ef0462bc 100644
--- a/ui/gui_generated.h
+++ b/ui/gui_generated.h
@@ -445,9 +445,7 @@ protected:
wxButton* m_buttonUpdate;
wxStaticText* m_staticText101;
wxRadioButton* m_radioBtnCustom;
-
- wxStaticText* m_staticText23;
-
+ wxButton* m_buttonUpdate1;
wxStaticText* m_staticText9;
wxBoxSizer* bSizer201;
@@ -489,7 +487,7 @@ protected:
// Virtual event handlers, overide them in your derived class
virtual void OnClose( wxCloseEvent& event ) { event.Skip(); }
virtual void OnSyncAutomatic( wxCommandEvent& event ) { event.Skip(); }
- virtual void OnSyncLeftToRight( wxCommandEvent& event ) { event.Skip(); }
+ virtual void OnSyncMirror( wxCommandEvent& event ) { event.Skip(); }
virtual void OnSyncUpdate( wxCommandEvent& event ) { event.Skip(); }
virtual void OnSyncCustom( wxCommandEvent& event ) { event.Skip(); }
virtual void OnChangeErrorHandling( wxCommandEvent& event ) { event.Skip(); }
@@ -704,10 +702,21 @@ protected:
wxStaticBitmap* m_bitmap11;
wxStaticText* m_build;
- wxScrolledWindow* m_scrolledWindowCodeInfo;
+ wxPanel* m_panel33;
wxBoxSizer* bSizerCodeInfo;
wxStaticText* m_staticText72;
- wxStaticText* m_staticText73;
+ wxHyperlinkCtrl* m_hyperlink9;
+ wxHyperlinkCtrl* m_hyperlink10;
+ wxHyperlinkCtrl* m_hyperlink7;
+ wxHyperlinkCtrl* m_hyperlink13;
+ wxHyperlinkCtrl* m_hyperlink14;
+ wxHyperlinkCtrl* m_hyperlink16;
+ wxHyperlinkCtrl* m_hyperlink8;
+ wxHyperlinkCtrl* m_hyperlink15;
+ wxHyperlinkCtrl* m_hyperlink11;
+ wxHyperlinkCtrl* m_hyperlink12;
+ wxHyperlinkCtrl* m_hyperlink17;
+ wxHyperlinkCtrl* m_hyperlink18;
wxHyperlinkCtrl* m_hyperlink21;
wxScrolledWindow* m_scrolledWindowTranslators;
wxBoxSizer* bSizerTranslators;
@@ -901,14 +910,22 @@ protected:
wxStaticText* m_staticText181;
wxStaticText* m_staticText1811;
- wxStaticText* m_staticText15;
- wxStaticBitmap* m_bitmap8;
+ wxStaticBitmap* m_bitmapInclude;
wxTextCtrl* m_textCtrlInclude;
-
- wxStaticText* m_staticText16;
- wxStaticBitmap* m_bitmap9;
+ wxStaticBitmap* m_bitmapExclude;
wxTextCtrl* m_textCtrlExclude;
+ wxStaticBitmap* m_bitmapFilterDate;
+ wxStaticText* m_staticText103;
+ wxSpinCtrl* m_spinCtrlTimespan;
+ wxChoice* m_choiceUnitTimespan;
+ wxStaticBitmap* m_bitmapFilterSize;
+ wxStaticText* m_staticText101;
+ wxSpinCtrl* m_spinCtrlMinSize;
+ wxChoice* m_choiceUnitMinSize;
+ wxStaticText* m_staticText102;
+ wxSpinCtrl* m_spinCtrlMaxSize;
+ wxChoice* m_choiceUnitMaxSize;
wxButton* m_button9;
wxButton* m_button10;
@@ -917,6 +934,8 @@ protected:
// Virtual event handlers, overide them in your derived class
virtual void OnClose( wxCloseEvent& event ) { event.Skip(); }
virtual void OnHelp( wxCommandEvent& event ) { event.Skip(); }
+ virtual void OnUpdateNameFilter( wxCommandEvent& event ) { event.Skip(); }
+ virtual void OnUpdateChoice( wxCommandEvent& event ) { event.Skip(); }
virtual void OnDefault( wxCommandEvent& event ) { event.Skip(); }
virtual void OnApply( wxCommandEvent& event ) { event.Skip(); }
virtual void OnCancel( wxCommandEvent& event ) { event.Skip(); }
diff --git a/ui/gui_status_handler.cpp b/ui/gui_status_handler.cpp
index 0543922c..09c59b92 100644
--- a/ui/gui_status_handler.cpp
+++ b/ui/gui_status_handler.cpp
@@ -14,28 +14,29 @@
#include "../shared/string_conv.h"
#include "../shared/util.h"
-using namespace ffs3;
+using namespace zen;
+using namespace xmlAccess;
-CompareStatusHandler::CompareStatusHandler(MainDialog* dlg) :
- mainDialog(dlg),
+CompareStatusHandler::CompareStatusHandler(MainDialog& dlg) :
+ mainDlg(dlg),
ignoreErrors(false),
currentProcess(StatusHandler::PROCESS_NONE)
{
- wxWindowUpdateLocker dummy(mainDialog); //avoid display distortion
+ wxWindowUpdateLocker dummy(&mainDlg); //avoid display distortion
//prevent user input during "compare", do not disable maindialog since abort-button would also be disabled
- mainDialog->disableAllElements();
- mainDialog->compareStatus->init(); //clear old values
+ mainDlg.disableAllElements(true);
+ mainDlg.compareStatus->init(); //clear old values
//display status panel during compare
- mainDialog->auiMgr.GetPane(mainDialog->compareStatus->getAsWindow()).Show();
- mainDialog->auiMgr.Update();
+ mainDlg.auiMgr.GetPane(mainDlg.compareStatus->getAsWindow()).Show();
+ mainDlg.auiMgr.Update();
//register abort button
- mainDialog->m_buttonAbort->Connect(wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler(CompareStatusHandler::OnAbortCompare), NULL, this);
+ mainDlg.m_buttonAbort->Connect(wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler(CompareStatusHandler::OnAbortCompare), NULL, this);
//register key event
- mainDialog->Connect(wxEVT_CHAR_HOOK, wxKeyEventHandler(CompareStatusHandler::OnKeyPressed), NULL, this);
+ mainDlg.Connect(wxEVT_CHAR_HOOK, wxKeyEventHandler(CompareStatusHandler::OnKeyPressed), NULL, this);
}
@@ -44,18 +45,18 @@ CompareStatusHandler::~CompareStatusHandler()
updateUiNow(); //ui update before enabling buttons again: prevent strange behaviour of delayed button clicks
//reenable complete main dialog
- mainDialog->enableAllElements();
- mainDialog->compareStatus->finalize();
+ mainDlg.enableAllElements();
+ mainDlg.compareStatus->finalize();
- mainDialog->auiMgr.GetPane(mainDialog->compareStatus->getAsWindow()).Hide();
- mainDialog->auiMgr.Update();
+ mainDlg.auiMgr.GetPane(mainDlg.compareStatus->getAsWindow()).Hide();
+ mainDlg.auiMgr.Update();
if (abortIsRequested())
- mainDialog->pushStatusInformation(_("Operation aborted!"));
+ mainDlg.pushStatusInformation(_("Operation aborted!"));
//de-register keys
- mainDialog->Disconnect(wxEVT_CHAR_HOOK, wxKeyEventHandler(CompareStatusHandler::OnKeyPressed), NULL, this);
- mainDialog->m_buttonAbort->Disconnect(wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler(CompareStatusHandler::OnAbortCompare), NULL, this);
+ mainDlg.Disconnect(wxEVT_CHAR_HOOK, wxKeyEventHandler(CompareStatusHandler::OnKeyPressed), NULL, this);
+ mainDlg.m_buttonAbort->Disconnect(wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler(CompareStatusHandler::OnAbortCompare), NULL, this);
}
@@ -74,11 +75,11 @@ void CompareStatusHandler::OnKeyPressed(wxKeyEvent& event)
void CompareStatusHandler::reportInfo(const Zstring& text)
{
- mainDialog->compareStatus->setStatusText_NoUpdate(text);
+ mainDlg.compareStatus->setStatusText_NoUpdate(text);
}
-void CompareStatusHandler::initNewProcess(int objectsTotal, wxLongLong dataTotal, Process processID)
+void CompareStatusHandler::initNewProcess(int objectsTotal, zen::Int64 dataTotal, Process processID)
{
currentProcess = processID;
@@ -88,10 +89,10 @@ void CompareStatusHandler::initNewProcess(int objectsTotal, wxLongLong dataTotal
break;
case StatusHandler::PROCESS_COMPARING_CONTENT:
{
- wxWindowUpdateLocker dummy(mainDialog);
- mainDialog->compareStatus->switchToCompareBytewise(objectsTotal, dataTotal);
- mainDialog->Layout(); //show progress bar...
- mainDialog->Refresh(); //remove distortion...
+ wxWindowUpdateLocker dummy(&mainDlg);
+ mainDlg.compareStatus->switchToCompareBytewise(objectsTotal, dataTotal);
+ mainDlg.Layout(); //show progress bar...
+ mainDlg.Refresh(); //remove distortion...
}
break;
case StatusHandler::PROCESS_SYNCHRONIZING:
@@ -103,15 +104,15 @@ void CompareStatusHandler::initNewProcess(int objectsTotal, wxLongLong dataTotal
inline
-void CompareStatusHandler::updateProcessedData(int objectsProcessed, wxLongLong dataProcessed)
+void CompareStatusHandler::updateProcessedData(int objectsProcessed, zen::Int64 dataProcessed)
{
switch (currentProcess)
{
case StatusHandler::PROCESS_SCANNING:
- mainDialog->compareStatus->incScannedObjects_NoUpdate(objectsProcessed);
+ mainDlg.compareStatus->incScannedObjects_NoUpdate(objectsProcessed);
break;
case StatusHandler::PROCESS_COMPARING_CONTENT:
- mainDialog->compareStatus->incProcessedCmpData_NoUpdate(objectsProcessed, dataProcessed);
+ mainDlg.compareStatus->incProcessedCmpData_NoUpdate(objectsProcessed, dataProcessed);
break;
case StatusHandler::PROCESS_SYNCHRONIZING:
case StatusHandler::PROCESS_NONE:
@@ -126,23 +127,20 @@ ErrorHandler::Response CompareStatusHandler::reportError(const wxString& message
if (ignoreErrors)
return ErrorHandler::IGNORE_ERROR;
- mainDialog->compareStatus->updateStatusPanelNow();
+ mainDlg.compareStatus->updateStatusPanelNow();
bool ignoreNextErrors = false;
- ErrorDlg errorDlg(NULL,
- ErrorDlg::BUTTON_IGNORE | ErrorDlg::BUTTON_RETRY | ErrorDlg::BUTTON_ABORT,
- message, ignoreNextErrors);
- errorDlg.Raise();
- switch (static_cast<ErrorDlg::ReturnCodes>(errorDlg.ShowModal()))
+ switch (showErrorDlg(ReturnErrorDlg::BUTTON_IGNORE | ReturnErrorDlg::BUTTON_RETRY | ReturnErrorDlg::BUTTON_ABORT,
+ message, ignoreNextErrors))
{
- case ErrorDlg::BUTTON_IGNORE:
+ case ReturnErrorDlg::BUTTON_IGNORE:
ignoreErrors = ignoreNextErrors;
return ErrorHandler::IGNORE_ERROR;
- case ErrorDlg::BUTTON_RETRY:
+ case ReturnErrorDlg::BUTTON_RETRY:
return ErrorHandler::RETRY;
- case ErrorDlg::BUTTON_ABORT:
+ case ReturnErrorDlg::BUTTON_ABORT:
abortThisProcess();
}
@@ -153,15 +151,13 @@ ErrorHandler::Response CompareStatusHandler::reportError(const wxString& message
void CompareStatusHandler::reportFatalError(const wxString& errorMessage)
{
- mainDialog->compareStatus->updateStatusPanelNow();
+ mainDlg.compareStatus->updateStatusPanelNow();
//show message and abort: currently there are no fatal errors during comparison that can be ignored
bool dummy = false;
- ErrorDlg errorDlg(NULL,
- ErrorDlg::BUTTON_ABORT,
- errorMessage, dummy);
- errorDlg.Raise();
- errorDlg.ShowModal();
+ showErrorDlg(ReturnErrorDlg::BUTTON_ABORT,
+ errorMessage, dummy);
+
abortThisProcess();
}
@@ -171,24 +167,21 @@ void CompareStatusHandler::reportWarning(const wxString& warningMessage, bool& w
if (!warningActive || ignoreErrors) //if errors are ignored, then warnings should also
return;
- mainDialog->compareStatus->updateStatusPanelNow();
+ mainDlg.compareStatus->updateStatusPanelNow();
//show popup and ask user how to handle warning
bool dontWarnAgain = false;
- WarningDlg warningDlg(NULL,
- WarningDlg::BUTTON_IGNORE | WarningDlg::BUTTON_ABORT,
- warningMessage,
- dontWarnAgain);
- warningDlg.Raise();
- switch (static_cast<WarningDlg::Response>(warningDlg.ShowModal()))
+ switch (showWarningDlg(ReturnWarningDlg::BUTTON_IGNORE | ReturnWarningDlg::BUTTON_ABORT,
+ warningMessage,
+ dontWarnAgain))
{
- case WarningDlg::BUTTON_IGNORE:
+ case ReturnWarningDlg::BUTTON_IGNORE:
warningActive = !dontWarnAgain;
break;
- case WarningDlg::BUTTON_SWITCH:
+ case ReturnWarningDlg::BUTTON_SWITCH:
assert(false);
- case WarningDlg::BUTTON_ABORT:
+ case ReturnWarningDlg::BUTTON_ABORT:
abortThisProcess();
break;
}
@@ -198,7 +191,7 @@ void CompareStatusHandler::reportWarning(const wxString& warningMessage, bool& w
inline
void CompareStatusHandler::forceUiRefresh()
{
- mainDialog->compareStatus->updateStatusPanelNow();
+ mainDlg.compareStatus->updateStatusPanelNow();
}
@@ -211,15 +204,15 @@ void CompareStatusHandler::OnAbortCompare(wxCommandEvent& event)
void CompareStatusHandler::abortThisProcess()
{
requestAbortion();
- throw ffs3::AbortThisProcess();
+ throw zen::AbortThisProcess();
}
//########################################################################################################
-SyncStatusHandler::SyncStatusHandler(MainDialog* parentDlg, bool ignoreAllErrors, const wxString& jobName) :
- mainDialog(parentDlg),
+SyncStatusHandler::SyncStatusHandler(MainDialog* parentDlg, OnGuiError handleError, const wxString& jobName) :
+ parentDlg_(parentDlg),
syncStatusFrame(*this, parentDlg, false, jobName),
- ignoreErrors(ignoreAllErrors)
+ handleError_(handleError)
{
}
@@ -256,7 +249,7 @@ void SyncStatusHandler::reportInfo(const Zstring& text)
}
-void SyncStatusHandler::initNewProcess(int objectsTotal, wxLongLong dataTotal, Process processID)
+void SyncStatusHandler::initNewProcess(int objectsTotal, zen::Int64 dataTotal, Process processID)
{
switch (processID)
{
@@ -274,7 +267,7 @@ void SyncStatusHandler::initNewProcess(int objectsTotal, wxLongLong dataTotal, P
inline
-void SyncStatusHandler::updateProcessedData(int objectsProcessed, wxLongLong dataProcessed)
+void SyncStatusHandler::updateProcessedData(int objectsProcessed, zen::Int64 dataProcessed)
{
syncStatusFrame.incProgressIndicator_NoUpdate(objectsProcessed, dataProcessed);
}
@@ -282,32 +275,31 @@ void SyncStatusHandler::updateProcessedData(int objectsProcessed, wxLongLong dat
ErrorHandler::Response SyncStatusHandler::reportError(const wxString& errorMessage)
{
- if (ignoreErrors)
+ switch (handleError_)
{
- errorLog.logMsg(errorMessage, TYPE_ERROR);
- return ErrorHandler::IGNORE_ERROR;
+ case ON_GUIERROR_POPUP:
+ break;
+ case ON_GUIERROR_IGNORE:
+ errorLog.logMsg(errorMessage, TYPE_ERROR);
+ return ErrorHandler::IGNORE_ERROR;
}
syncStatusFrame.updateStatusDialogNow();
bool ignoreNextErrors = false;
- ErrorDlg errorDlg(NULL,
- ErrorDlg::BUTTON_IGNORE | ErrorDlg::BUTTON_RETRY | ErrorDlg::BUTTON_ABORT,
- errorMessage,
- ignoreNextErrors);
- errorDlg.Raise();
- const ErrorDlg::ReturnCodes rv = static_cast<ErrorDlg::ReturnCodes>(errorDlg.ShowModal());
- switch (rv)
+ switch (showErrorDlg(ReturnErrorDlg::BUTTON_IGNORE | ReturnErrorDlg::BUTTON_RETRY | ReturnErrorDlg::BUTTON_ABORT,
+ errorMessage,
+ ignoreNextErrors))
{
- case ErrorDlg::BUTTON_IGNORE:
- ignoreErrors = ignoreNextErrors;
+ case ReturnErrorDlg::BUTTON_IGNORE:
+ handleError_ = ignoreNextErrors ? ON_GUIERROR_IGNORE : ON_GUIERROR_POPUP;
errorLog.logMsg(errorMessage, TYPE_ERROR);
return ErrorHandler::IGNORE_ERROR;
- case ErrorDlg::BUTTON_RETRY:
+ case ReturnErrorDlg::BUTTON_RETRY:
return ErrorHandler::RETRY;
- case ErrorDlg::BUTTON_ABORT:
+ case ReturnErrorDlg::BUTTON_ABORT:
errorLog.logMsg(errorMessage, TYPE_ERROR);
abortThisProcess();
}
@@ -328,35 +320,35 @@ void SyncStatusHandler::reportWarning(const wxString& warningMessage, bool& warn
{
errorLog.logMsg(warningMessage, TYPE_WARNING);
- if (ignoreErrors || !warningActive) //if errors are ignored, then warnings should also
- return;
- else
+ switch (handleError_)
{
- syncStatusFrame.updateStatusDialogNow();
-
- //show popup and ask user how to handle warning
- bool dontWarnAgain = false;
- WarningDlg warningDlg(NULL,
- WarningDlg::BUTTON_IGNORE | WarningDlg::BUTTON_ABORT,
- warningMessage,
- dontWarnAgain);
- warningDlg.Raise();
- const WarningDlg::Response rv = static_cast<WarningDlg::Response>(warningDlg.ShowModal());
- switch (rv)
- {
- case WarningDlg::BUTTON_IGNORE: //no unhandled error situation!
- warningActive = !dontWarnAgain;
- return;
-
- case WarningDlg::BUTTON_SWITCH:
- assert(false);
- case WarningDlg::BUTTON_ABORT:
- abortThisProcess();
- return;
- }
+ case ON_GUIERROR_POPUP:
+ break;
+ case ON_GUIERROR_IGNORE:
+ return; //if errors are ignored, then warnings should also
+ }
+ if (!warningActive) return;
+
+ syncStatusFrame.updateStatusDialogNow();
+
+ //show popup and ask user how to handle warning
+ bool dontWarnAgain = false;
+ switch (showWarningDlg(ReturnWarningDlg::BUTTON_IGNORE | ReturnWarningDlg::BUTTON_ABORT,
+ warningMessage,
+ dontWarnAgain))
+ {
+ case ReturnWarningDlg::BUTTON_IGNORE: //no unhandled error situation!
+ warningActive = !dontWarnAgain;
+ return;
- assert(false);
+ case ReturnWarningDlg::BUTTON_SWITCH:
+ assert(false);
+ case ReturnWarningDlg::BUTTON_ABORT:
+ abortThisProcess();
+ return;
}
+
+ assert(false);
}
@@ -369,5 +361,5 @@ void SyncStatusHandler::forceUiRefresh()
void SyncStatusHandler::abortThisProcess()
{
requestAbortion();
- throw ffs3::AbortThisProcess(); //abort can be triggered by syncStatusFrame
+ throw zen::AbortThisProcess(); //abort can be triggered by syncStatusFrame
}
diff --git a/ui/gui_status_handler.h b/ui/gui_status_handler.h
index c0e75a8d..bd5b061a 100644
--- a/ui/gui_status_handler.h
+++ b/ui/gui_status_handler.h
@@ -11,10 +11,10 @@
#include <wx/event.h>
#include "../library/error_log.h"
#include "progress_indicator.h"
+#include "../library/process_xml.h"
+#include "main_dlg.h"
class SyncStatus;
-class MainDialog;
-class wxWindow;
class wxCommandEvent;
@@ -22,11 +22,11 @@ class wxCommandEvent;
class CompareStatusHandler : private wxEvtHandler, public StatusHandler
{
public:
- CompareStatusHandler(MainDialog* dlg);
+ CompareStatusHandler(MainDialog& dlg);
~CompareStatusHandler();
- virtual void initNewProcess(int objectsTotal, wxLongLong dataTotal, Process processID);
- virtual void updateProcessedData(int objectsProcessed, wxLongLong dataProcessed);
+ virtual void initNewProcess(int objectsTotal, zen::Int64 dataTotal, Process processID);
+ virtual void updateProcessedData(int objectsProcessed, zen::Int64 dataProcessed);
virtual void reportInfo(const Zstring& text);
virtual void forceUiRefresh();
@@ -39,7 +39,7 @@ private:
void OnAbortCompare(wxCommandEvent& event); //handle abort button click
virtual void abortThisProcess();
- MainDialog* mainDialog;
+ MainDialog& mainDlg;
bool ignoreErrors;
Process currentProcess;
};
@@ -48,11 +48,11 @@ private:
class SyncStatusHandler : public StatusHandler
{
public:
- SyncStatusHandler(MainDialog* parentDlg, bool ignoreAllErrors, const wxString& jobName);
+ SyncStatusHandler(MainDialog* parentDlg, xmlAccess::OnGuiError handleError, const wxString& jobName);
~SyncStatusHandler();
- virtual void initNewProcess(int objectsTotal, wxLongLong dataTotal, Process processID);
- virtual void updateProcessedData(int objectsProcessed, wxLongLong dataProcessed);
+ virtual void initNewProcess(int objectsTotal, zen::Int64 dataTotal, Process processID);
+ virtual void updateProcessedData(int objectsProcessed, zen::Int64 dataProcessed);
virtual void reportInfo(const Zstring& text);
virtual void forceUiRefresh();
@@ -63,10 +63,10 @@ public:
private:
virtual void abortThisProcess();
- MainDialog* mainDialog; //optional
+ MainDialog* parentDlg_;
SyncStatus syncStatusFrame; //the window managed by SyncStatus has longer lifetime than this handler!
- bool ignoreErrors;
- ffs3::ErrorLogging errorLog;
+ xmlAccess::OnGuiError handleError_;
+ zen::ErrorLogging errorLog;
};
diff --git a/ui/is_null_filter.h b/ui/is_null_filter.h
deleted file mode 100644
index 21981a03..00000000
--- a/ui/is_null_filter.h
+++ /dev/null
@@ -1,24 +0,0 @@
-// **************************************************************************
-// * This file is part of the FreeFileSync project. It is distributed under *
-// * GNU General Public License: http://www.gnu.org/licenses/gpl.html *
-// * Copyright (C) 2008-2011 ZenJu (zhnmju123 AT gmx.de) *
-// **************************************************************************
-//
-#ifndef ISNULLFILTER_H_INCLUDED
-#define ISNULLFILTER_H_INCLUDED
-
-#include "../structures.h"
-#include "../library/filter.h"
-
-namespace ffs3
-{
-
-inline
-bool isNullFilter(const FilterConfig& filterCfg)
-{
- return NameFilter(filterCfg.includeFilter, filterCfg.excludeFilter).isNull();
-}
-
-}
-
-#endif // ISNULLFILTER_H_INCLUDED
diff --git a/ui/main_dlg.cpp b/ui/main_dlg.cpp
index 8eae6fb1..6e6c17f7 100644
--- a/ui/main_dlg.cpp
+++ b/ui/main_dlg.cpp
@@ -37,7 +37,6 @@
#include "progress_indicator.h"
#include "msg_popup.h"
#include "../shared/dir_name.h"
-#include "../library/filter.h"
#include "../structures.h"
#include "grid_view.h"
#include "../library/resources.h"
@@ -51,13 +50,12 @@
#include "../shared/global_func.h"
#include "search.h"
#include "../shared/help_provider.h"
-#include "is_null_filter.h"
#include "batch_config.h"
#include "../shared/check_exist.h"
+#include "../library/lock_holder.h"
+#include "../shared/shell_execute.h"
-using namespace ffs3;
-using ffs3::CustomLocale;
-
+using namespace zen;
namespace
{
@@ -92,8 +90,7 @@ public:
case xmlAccess::MERGE_BATCH:
if (droppedFiles.size() == 1)
{
- BatchDialog batchDlg(&mainDlg_, droppedFiles[0]);
- if (batchDlg.ShowModal() == BatchDialog::BATCH_FILE_SAVED)
+ if (showSyncBatchDlg(droppedFiles[0]) == ReturnBatchConfig::BATCH_FILE_SAVED)
mainDlg_.pushStatusInformation(_("Batch file created successfully!"));
return false;
}
@@ -221,20 +218,14 @@ public:
dirNameLeft (*m_panelLeft, *m_dirPickerLeft, *m_directoryLeft),
dirNameRight(*m_panelRight, *m_dirPickerRight, *m_directoryRight) {}
- void setValues(const Zstring& leftDir, const Zstring& rightDir, AltSyncCfgPtr syncCfg, const FilterConfig& filter)
+ void setValues(const wxString& leftDir, const wxString& rightDir, AltSyncCfgPtr syncCfg, const FilterConfig& filter)
{
setConfig(syncCfg, filter);
dirNameLeft.setName(leftDir);
dirNameRight.setName(rightDir);
}
- Zstring getLeftDir() const
- {
- return dirNameLeft.getName();
- }
- Zstring getRightDir() const
- {
- return dirNameRight.getName();
- }
+ wxString getLeftDir () const { return dirNameLeft .getName(); }
+ wxString getRightDir() const { return dirNameRight.getName(); }
private:
//support for drag and drop
@@ -263,20 +254,14 @@ public:
*mainDialog.m_directoryRight,
*mainDialog.sbSizerDirRight) {}
- void setValues(const Zstring& leftDir, const Zstring& rightDir, AltSyncCfgPtr syncCfg, const FilterConfig& filter)
+ void setValues(const wxString& leftDir, const wxString& rightDir, AltSyncCfgPtr syncCfg, const FilterConfig& filter)
{
setConfig(syncCfg, filter);
dirNameLeft.setName(leftDir);
dirNameRight.setName(rightDir);
}
- Zstring getLeftDir() const
- {
- return dirNameLeft.getName();
- }
- Zstring getRightDir() const
- {
- return dirNameRight.getName();
- }
+ wxString getLeftDir () const { return dirNameLeft .getName(); }
+ wxString getRightDir() const { return dirNameRight.getName(); }
private:
//support for drag and drop
@@ -329,8 +314,8 @@ struct DirNotFound
{
bool operator()(const FolderPairEnh& fp) const
{
- const Zstring dirFmtLeft = ffs3::getFormattedDirectoryName(fp.leftDirectory);
- const Zstring dirFmtRight = ffs3::getFormattedDirectoryName(fp.rightDirectory);
+ const Zstring dirFmtLeft = zen::getFormattedDirectoryName(fp.leftDirectory);
+ const Zstring dirFmtRight = zen::getFormattedDirectoryName(fp.rightDirectory);
if (dirFmtLeft.empty() && dirFmtRight.empty())
return false;
@@ -345,14 +330,7 @@ class PanelMoveWindow : public MouseMoveWindow
{
public:
PanelMoveWindow(MainDialog& mainDlg) :
- MouseMoveWindow(mainDlg,
- mainDlg.m_panelTopButtons,
- //mainDlg.m_panelDirectoryPairs,
- mainDlg.m_panelConfig,
- mainDlg.m_panelFilter,
- mainDlg.m_panelViewFilter,
- mainDlg.m_panelStatistics,
- mainDlg.m_panelStatusBar),
+ MouseMoveWindow(mainDlg, false), //don't include main dialog itself, thereby prevent various mouse capture lost issues
mainDlg_(mainDlg) {}
virtual bool allowMove(const wxMouseEvent& event)
@@ -490,6 +468,7 @@ void MainDialog::init(const xmlAccess::XmlGuiConfig guiCfg,
wxAuiPaneInfo().Name(wxT("Panel8")).Bottom().Row(0).CaptionVisible(false).PaneBorder(false).DockFixed());
auiMgr.Update();
+
defaultPerspective = auiMgr.SavePerspective();
//----------------------------------------------------------------------------------
//register view layout context menu
@@ -502,7 +481,7 @@ void MainDialog::init(const xmlAccess::XmlGuiConfig guiCfg,
//----------------------------------------------------------------------------------
globalSettings = &settings;
- gridDataView.reset(new ffs3::GridView);
+ gridDataView.reset(new zen::GridView);
contextMenu.reset(new wxMenu); //initialize right-click context menu; will be dynamically re-created on each R-mouse-click
cleanedUp = false;
@@ -523,7 +502,7 @@ void MainDialog::init(const xmlAccess::XmlGuiConfig guiCfg,
SetIcon(*GlobalResources::instance().programIcon); //set application icon
//notify about (logical) application main window => program won't quit, but stay on this dialog
- ffs3::AppMainWindow::setMainWindow(this);
+ zen::AppMainWindow::setMainWindow(this);
//init handling of first folder pair
firstFolderPair.reset(new DirectoryPairFirst(*this));
@@ -566,12 +545,12 @@ void MainDialog::init(const xmlAccess::XmlGuiConfig guiCfg,
updateMenuHelp.addForUpdate(m_menuItemAbout, GlobalResources::instance().getImage(wxT("aboutSmall")));
#ifdef FFS_LINUX
- if (!ffs3::isPortableVersion()) //disable update check for Linux installer-based version -> handled by .deb
+ if (!zen::isPortableVersion()) //disable update check for Linux installer-based version -> handled by .deb
m_menuItemCheckVer->Enable(false);
#endif
//create language selection menu
- for (std::vector<LocInfoLine>::const_iterator i = LocalizationInfo::get().begin(); i != LocalizationInfo::get().end(); ++i)
+ for (std::vector<ExistingTranslations::Entry>::const_iterator i = ExistingTranslations::get().begin(); i != ExistingTranslations::get().end(); ++i)
{
wxMenuItem* newItem = new wxMenuItem(m_menuLanguages, wxID_ANY, i->languageName, wxEmptyString, wxITEM_NORMAL );
newItem->SetBitmap(GlobalResources::instance().getImage(i->languageFlag));
@@ -605,11 +584,13 @@ void MainDialog::init(const xmlAccess::XmlGuiConfig guiCfg,
m_panelTopLeft->Connect(wxEVT_SIZE, wxEventHandler(MainDialog::OnResizeFolderPairs), NULL, this);
//dynamically change sizer direction depending on size
+ //m_panelTopButtons->Connect(wxEVT_SIZE, wxEventHandler(MainDialog::OnResizeTopButtons), NULL, this);
m_panelConfig ->Connect(wxEVT_SIZE, wxEventHandler(MainDialog::OnResizeConfigPanel), NULL, this);
m_panelViewFilter->Connect(wxEVT_SIZE, wxEventHandler(MainDialog::OnResizeViewPanel), NULL, this);
m_panelStatistics->Connect(wxEVT_SIZE, wxEventHandler(MainDialog::OnResizeStatisticsPanel), NULL, this);
wxSizeEvent dummy3;
- OnResizeConfigPanel (dummy3); //call once on window creation
+ //OnResizeTopButtons (dummy3); //call once on window creation
+ OnResizeConfigPanel (dummy3); //
OnResizeViewPanel (dummy3); //
OnResizeStatisticsPanel(dummy3); //
@@ -638,7 +619,7 @@ void MainDialog::init(const xmlAccess::XmlGuiConfig guiCfg,
//some convenience: if FFS is started with a *.ffs_gui file as commandline parameter AND all directories contained exist, comparison shall be started right off
if (startComparison)
{
- const ffs3::MainConfiguration currMainCfg = getCurrentConfiguration().mainCfg;
+ const zen::MainConfiguration currMainCfg = getCurrentConfiguration().mainCfg;
const bool allFoldersExist = !DirNotFound()(currMainCfg.firstPair) &&
std::find_if(currMainCfg.additionalPairs.begin(), currMainCfg.additionalPairs.end(),
DirNotFound()) == currMainCfg.additionalPairs.end();
@@ -776,7 +757,7 @@ void MainDialog::writeGlobalSettings()
}
-void MainDialog::setSyncDirManually(const std::set<size_t>& rowsToSetOnUiTable, const ffs3::SyncDirection dir)
+void MainDialog::setSyncDirManually(const std::set<size_t>& rowsToSetOnUiTable, const zen::SyncDirection dir)
{
if (rowsToSetOnUiTable.size() > 0)
{
@@ -786,7 +767,7 @@ void MainDialog::setSyncDirManually(const std::set<size_t>& rowsToSetOnUiTable,
if (fsObj)
{
setSyncDirectionRec(dir, *fsObj); //set new direction (recursively)
- ffs3::setActiveStatus(true, *fsObj); //works recursively for directories
+ zen::setActiveStatus(true, *fsObj); //works recursively for directories
}
}
@@ -815,7 +796,7 @@ void MainDialog::filterRangeManually(const std::set<size_t>& rowsToFilterOnUiTab
gridDataView->getAllFileRef(rowsToFilterOnUiTable, compRef); //everything in compRef is bound
for (std::vector<FileSystemObject*>::iterator i = compRef.begin(); i != compRef.end(); ++i)
- ffs3::setActiveStatus(newSelection, **i); //works recursively for directories
+ zen::setActiveStatus(newSelection, **i); //works recursively for directories
refreshGridAfterFilterChange(400); //call this instead of updateGuiGrid() to add some delay if hideFiltered == true and to handle some graphical artifacts
}
@@ -827,7 +808,7 @@ void MainDialog::OnIdleEvent(wxEvent& event)
//small routine to restore status information after some time
if (stackObjects.size() > 0 ) //check if there is some work to do
{
- wxLongLong currentTime = wxGetLocalTimeMillis();
+ wxMilliClock_t currentTime = wxGetLocalTimeMillis();
if (currentTime - lastStatusChange > 2500) //restore stackObject after two seconds
{
lastStatusChange = currentTime;
@@ -909,7 +890,7 @@ public:
ignoreErrors(false),
deletionCount(0)
{
- mainDlg->disableAllElements(); //disable everything except abort button
+ mainDlg->disableAllElements(true); //disable everything except abort button
mainDlg->clearStatusBar();
//register abort button
@@ -929,25 +910,22 @@ public:
virtual Response reportError(const wxString& errorMessage)
{
if (abortRequested)
- throw ffs3::AbortThisProcess();
+ throw zen::AbortThisProcess();
if (ignoreErrors)
return DeleteFilesHandler::IGNORE_ERROR;
bool ignoreNextErrors = false;
- ErrorDlg errorDlg(NULL,
- ErrorDlg::BUTTON_IGNORE | ErrorDlg::BUTTON_RETRY | ErrorDlg::BUTTON_ABORT,
- errorMessage, ignoreNextErrors);
- const int rv = errorDlg.ShowModal();
- switch (static_cast<ErrorDlg::ReturnCodes>(rv))
+ switch (showErrorDlg(ReturnErrorDlg::BUTTON_IGNORE | ReturnErrorDlg::BUTTON_RETRY | ReturnErrorDlg::BUTTON_ABORT,
+ errorMessage, ignoreNextErrors))
{
- case ErrorDlg::BUTTON_IGNORE:
+ case ReturnErrorDlg::BUTTON_IGNORE:
ignoreErrors = ignoreNextErrors;
return DeleteFilesHandler::IGNORE_ERROR;
- case ErrorDlg::BUTTON_RETRY:
+ case ReturnErrorDlg::BUTTON_RETRY:
return DeleteFilesHandler::RETRY;
- case ErrorDlg::BUTTON_ABORT:
- throw ffs3::AbortThisProcess();
+ case ReturnErrorDlg::BUTTON_ABORT:
+ throw zen::AbortThisProcess();
}
assert (false);
@@ -960,8 +938,8 @@ public:
if (updateUiIsAllowed()) //test if specific time span between ui updates is over
{
- wxString statusMessage = _("%x objects deleted successfully");
- statusMessage.Replace(wxT("%x"), ffs3::numberToStringSep(deletionCount), false);
+ wxString statusMessage = _P("Object deleted successfully!", "%x objects deleted successfully!", deletionCount);
+ statusMessage.Replace(wxT("%x"), zen::toStringSep(deletionCount), false);
if (mainDlg->m_staticTextStatusMiddle->GetLabel() != statusMessage)
{
@@ -972,20 +950,20 @@ public:
}
if (abortRequested) //test after (implicit) call to wxApp::Yield()
- throw ffs3::AbortThisProcess();
+ throw zen::AbortThisProcess();
}
private:
void OnAbortCompare(wxCommandEvent& event) //handle abort button click
{
- abortRequested = true; //don't throw exceptions in a GUI-Callback!!! (throw ffs3::AbortThisProcess())
+ abortRequested = true; //don't throw exceptions in a GUI-Callback!!! (throw zen::AbortThisProcess())
}
void OnKeyPressed(wxKeyEvent& event)
{
const int keyCode = event.GetKeyCode();
if (keyCode == WXK_ESCAPE)
- abortRequested = true; //don't throw exceptions in a GUI-Callback!!! (throw ffs3::AbortThisProcess())
+ abortRequested = true; //don't throw exceptions in a GUI-Callback!!! (throw zen::AbortThisProcess())
event.Skip();
}
@@ -999,12 +977,8 @@ private:
};
-void MainDialog::deleteSelectedFiles()
+void MainDialog::deleteSelectedFiles(const std::set<size_t>& viewSelectionLeft, const std::set<size_t>& viewSelectionRight)
{
- //get set of selected rows on view
- const std::set<size_t> viewSelectionLeft = getSelectedRows(m_gridLeft);
- const std::set<size_t> viewSelectionRight = getSelectedRows(m_gridRight);
-
if (viewSelectionLeft.size() + viewSelectionRight.size())
{
//map lines from GUI view to grid line references
@@ -1017,12 +991,12 @@ void MainDialog::deleteSelectedFiles()
wxWindow* oldFocus = wxWindow::FindFocus();
- if (ffs3::showDeleteDialog(compRefLeft,
- compRefRight,
- globalSettings->gui.deleteOnBothSides,
- globalSettings->gui.useRecyclerForManualDeletion) == DefaultReturnCode::BUTTON_OKAY)
+ if (zen::showDeleteDialog(compRefLeft,
+ compRefRight,
+ globalSettings->gui.deleteOnBothSides,
+ globalSettings->gui.useRecyclerForManualDeletion) == ReturnSmallDlg::BUTTON_OKAY)
{
- if (globalSettings->gui.useRecyclerForManualDeletion && !ffs3::recycleBinExists())
+ if (globalSettings->gui.useRecyclerForManualDeletion && !zen::recycleBinExists())
{
wxMessageBox(_("Recycle Bin not yet supported for this system!"));
return;
@@ -1033,14 +1007,14 @@ void MainDialog::deleteSelectedFiles()
//handle errors when deleting files/folders
ManualDeletionHandler statusHandler(this);
- ffs3::deleteFromGridAndHD(gridDataView->getDataTentative(),
- compRefLeft,
- compRefRight,
- globalSettings->gui.deleteOnBothSides,
- globalSettings->gui.useRecyclerForManualDeletion,
- statusHandler);
+ zen::deleteFromGridAndHD(gridDataView->getDataTentative(),
+ compRefLeft,
+ compRefRight,
+ globalSettings->gui.deleteOnBothSides,
+ globalSettings->gui.useRecyclerForManualDeletion,
+ statusHandler);
}
- catch (ffs3::AbortThisProcess&) {}
+ catch (zen::AbortThisProcess&) {}
//remove rows that are empty: just a beautification, invalid rows shouldn't cause issues
gridDataView->removeInvalidRows();
@@ -1140,9 +1114,9 @@ void MainDialog::openExternalApplication(size_t rowNumber, bool leftSide, const
if (name.empty())
{
if (leftSide)
- wxExecute(wxString(wxT("explorer ")) + zToWx(fsObj->getBaseDirPf<LEFT_SIDE>()));
+ zen::shellExecute(wxString(wxT("explorer ")) + L"\"" + zToWx(fsObj->getBaseDirPf<LEFT_SIDE>()) + L"\"");
else
- wxExecute(wxString(wxT("explorer ")) + zToWx(fsObj->getBaseDirPf<RIGHT_SIDE>()));
+ zen::shellExecute(wxString(wxT("explorer ")) + L"\"" + zToWx(fsObj->getBaseDirPf<RIGHT_SIDE>()) + L"\"");
return;
}
#endif
@@ -1150,14 +1124,14 @@ void MainDialog::openExternalApplication(size_t rowNumber, bool leftSide, const
else
{
//fallback
- dir = zToWx(ffs3::getFormattedDirectoryName(firstFolderPair->getLeftDir()));
- dirCo = zToWx(ffs3::getFormattedDirectoryName(firstFolderPair->getRightDir()));
+ dir = zToWx(zen::getFormattedDirectoryName(wxToZ(firstFolderPair->getLeftDir())));
+ dirCo = zToWx(zen::getFormattedDirectoryName(wxToZ(firstFolderPair->getRightDir())));
if (!leftSide)
std::swap(dir, dirCo);
#ifdef FFS_WIN
- wxExecute(wxString(wxT("explorer ")) + dir); //default
+ zen::shellExecute(wxString(wxT("explorer ")) + L"\"" + dir + L"\""); //default
return;
#endif
}
@@ -1167,7 +1141,7 @@ void MainDialog::openExternalApplication(size_t rowNumber, bool leftSide, const
command.Replace(wxT("%name"), name, true);
command.Replace(wxT("%dir"), dir, true);
- wxExecute(command);
+ zen::shellExecute(command);
}
@@ -1193,9 +1167,9 @@ void MainDialog::clearStatusBar()
}
-void MainDialog::disableAllElements()
+void MainDialog::disableAllElements(bool enableAbort)
{
- //disenables all elements (except abort button) that might receive user input during long-running processes: comparison, deletion
+ //disables all elements (except abort button) that might receive user input during long-running processes: comparison, deletion
m_panelViewFilter ->Disable();
m_bpButtonCmpConfig ->Disable();
m_panelFilter ->Disable();
@@ -1208,17 +1182,22 @@ void MainDialog::disableAllElements()
m_menubar1->EnableTop(1, false);
m_menubar1->EnableTop(2, false);
- //show abort button
- m_buttonAbort->Enable();
- m_buttonAbort->Show();
- m_buttonAbort->SetFocus();
- m_buttonCompare->Disable();
- m_buttonCompare->Hide();
- m_bpButtonCmpConfig ->Disable();
- m_bpButtonSyncConfig->Disable();
- m_buttonStartSync ->Disable();
+ if (enableAbort)
+ {
- m_panelTopButtons->Layout();
+ //show abort button
+ m_buttonAbort->Enable();
+ m_buttonAbort->Show();
+ m_buttonAbort->SetFocus();
+ m_buttonCompare->Disable();
+ m_buttonCompare->Hide();
+ m_bpButtonCmpConfig ->Disable();
+ m_bpButtonSyncConfig->Disable();
+ m_buttonStartSync ->Disable();
+ m_panelTopButtons->Layout();
+ }
+ else
+ m_panelTopButtons->Disable();
}
@@ -1246,6 +1225,7 @@ void MainDialog::enableAllElements()
m_buttonStartSync ->Enable();
m_panelTopButtons->Layout();
+ m_panelTopButtons->Enable();
}
@@ -1302,20 +1282,24 @@ void updateSizerOrientation(wxBoxSizer& sizer, wxWindow& window)
}
+/*void MainDialog::OnResizeTopButtons(wxEvent& event)
+{
+ updateSizerOrientation(*bSizerTopButtons, *m_panelTopButtons);
+ event.Skip();
+}*/
+
void MainDialog::OnResizeConfigPanel(wxEvent& event)
{
updateSizerOrientation(*bSizerConfig, *m_panelConfig);
event.Skip();
}
-
void MainDialog::OnResizeViewPanel(wxEvent& event)
{
updateSizerOrientation(*bSizerViewFilter, *m_panelViewFilter);
event.Skip();
}
-
void MainDialog::OnResizeStatisticsPanel(wxEvent& event)
{
updateSizerOrientation(*bSizerStatistics, *m_panelStatistics);
@@ -1386,8 +1370,12 @@ void MainDialog::onGridLeftButtonEvent(wxKeyEvent& event)
{
case WXK_DELETE:
case WXK_NUMPAD_DELETE:
- deleteSelectedFiles();
- return;
+ {
+ const std::set<size_t> viewSelectionLeft = getSelectedRows(m_gridLeft);
+ const std::set<size_t> viewSelectionRight = getSelectedRows(m_gridRight);
+ deleteSelectedFiles(viewSelectionLeft, viewSelectionRight);
+ }
+ return;
case WXK_SPACE:
case WXK_NUMPAD_SPACE:
@@ -1421,6 +1409,57 @@ void MainDialog::onGridMiddleButtonEvent(wxKeyEvent& event)
case WXK_INSERT: //CTRL + C || CTRL + INS
copySelectionToClipboard(*m_gridMiddle);
return;
+
+ case 'A': //CTRL + A
+ m_gridMiddle->SelectAll();
+ return;
+ }
+
+ else if (event.AltDown())
+ switch (keyCode)
+ {
+ case WXK_LEFT: //ALT + <-
+ {
+ std::set<size_t> selection = getSelectedRows(m_gridMiddle);
+ setSyncDirManually(selection, zen::SYNC_DIR_LEFT);
+ }
+ return;
+
+ case WXK_RIGHT: //ALT + ->
+ {
+ std::set<size_t> selection = getSelectedRows(m_gridMiddle);
+ setSyncDirManually(selection, zen::SYNC_DIR_RIGHT);
+ }
+ return;
+
+ case WXK_UP: /* ALT + /|\ */
+ case WXK_DOWN: /* ALT + \|/ */
+ {
+ std::set<size_t> selection = getSelectedRows(m_gridMiddle);
+ setSyncDirManually(selection, zen::SYNC_DIR_NONE);
+ }
+ return;
+ }
+
+ else
+ switch (keyCode)
+ {
+ case WXK_DELETE:
+ case WXK_NUMPAD_DELETE:
+ {
+ std::set<size_t> selection = getSelectedRows(m_gridMiddle);
+ deleteSelectedFiles(selection, selection);
+ }
+
+ return;
+
+ case WXK_SPACE:
+ case WXK_NUMPAD_SPACE:
+ {
+ std::set<size_t> selection = getSelectedRows(m_gridMiddle);
+ filterRangeManually(selection, static_cast<int>(*selection.begin()));
+ }
+ return;
}
event.Skip(); //unknown keypress: propagate
@@ -1479,8 +1518,13 @@ void MainDialog::onGridRightButtonEvent(wxKeyEvent& event)
{
case WXK_DELETE:
case WXK_NUMPAD_DELETE:
- deleteSelectedFiles();
- return;
+ {
+ const std::set<size_t> viewSelectionLeft = getSelectedRows(m_gridLeft);
+ const std::set<size_t> viewSelectionRight = getSelectedRows(m_gridRight);
+ deleteSelectedFiles(viewSelectionLeft, viewSelectionRight);
+ }
+
+ return;
case WXK_SPACE:
case WXK_NUMPAD_SPACE:
@@ -1542,7 +1586,7 @@ void MainDialog::OnGlobalKeyEvent(wxKeyEvent& event) //process key events withou
switch (keyCode)
{
case 'F': //CTRL + F
- ffs3::startFind(*this, *m_gridLeft, *m_gridRight, globalSettings->gui.textSearchRespectCase);
+ zen::startFind(*this, *m_gridLeft, *m_gridRight, globalSettings->gui.textSearchRespectCase);
return; //-> swallow event!
}
@@ -1550,7 +1594,7 @@ void MainDialog::OnGlobalKeyEvent(wxKeyEvent& event) //process key events withou
{
case WXK_F3: //F3
case WXK_NUMPAD_F3: //
- ffs3::findNext(*this, *m_gridLeft, *m_gridRight, globalSettings->gui.textSearchRespectCase);
+ zen::findNext(*this, *m_gridLeft, *m_gridRight, globalSettings->gui.textSearchRespectCase);
return; //-> swallow event!
//redirect certain (unhandled) keys directly to grid!
@@ -1656,7 +1700,10 @@ void MainDialog::OnContextRim(wxGridEvent& event)
const FileSystemObject* fsObj = gridDataView->getObject(selectionBegin);
- int contextItemID = 2000;
+#ifndef _MSC_VER
+#warning context menu buttons komplett lokalisieren: ALT+LEFT, SPACE D-Click, ENTER..
+#warning statt "Set direction: *-" besser "Set direction: ->"
+#endif
//#######################################################
//re-create context menu
@@ -1668,57 +1715,56 @@ void MainDialog::OnContextRim(wxGridEvent& event)
if (selection.size() > 0)
{
//CONTEXT_SYNC_DIR_LEFT
- wxMenuItem* menuItemSyncDirLeft = new wxMenuItem(contextMenu.get(), ++contextItemID, wxString(_("Set direction:")) +
+ wxMenuItem* menuItemSyncDirLeft = new wxMenuItem(contextMenu.get(), wxID_ANY, wxString(_("Set direction:")) +
wxT(" ") + getSymbol(fsObj->testSyncOperation(true, SYNC_DIR_LEFT)) +
- wxT("\tALT + LEFT")); //Linux needs a direction, "<-", because it has no context menu icons!
+ wxT("\tAlt + Left")); //Linux needs a direction, "<-", because it has no context menu icons!
menuItemSyncDirLeft->SetBitmap(getSyncOpImage(fsObj->testSyncOperation(true, SYNC_DIR_LEFT)));
contextMenu->Append(menuItemSyncDirLeft);
- contextMenu->Connect(contextItemID, wxEVT_COMMAND_MENU_SELECTED, wxCommandEventHandler(MainDialog::OnContextSyncDirLeft), NULL, this);
+ contextMenu->Connect(menuItemSyncDirLeft->GetId(), wxEVT_COMMAND_MENU_SELECTED, wxCommandEventHandler(MainDialog::OnContextSyncDirLeft), NULL, this);
//CONTEXT_SYNC_DIR_NONE
- wxMenuItem* menuItemSyncDirNone = new wxMenuItem(contextMenu.get(), ++contextItemID, wxString(_("Set direction:")) +
+ wxMenuItem* menuItemSyncDirNone = new wxMenuItem(contextMenu.get(), wxID_ANY, wxString(_("Set direction:")) +
wxT(" ") + getSymbol(fsObj->testSyncOperation(true, SYNC_DIR_NONE)) +
- wxT("\tALT + UP"));
+ wxT("\tAlt + Up"));
menuItemSyncDirNone->SetBitmap(getSyncOpImage(fsObj->testSyncOperation(true, SYNC_DIR_NONE)));
contextMenu->Append(menuItemSyncDirNone);
- contextMenu->Connect(contextItemID, wxEVT_COMMAND_MENU_SELECTED, wxCommandEventHandler(MainDialog::OnContextSyncDirNone), NULL, this);
+ contextMenu->Connect(menuItemSyncDirNone->GetId(), wxEVT_COMMAND_MENU_SELECTED, wxCommandEventHandler(MainDialog::OnContextSyncDirNone), NULL, this);
//CONTEXT_SYNC_DIR_RIGHT
- wxMenuItem* menuItemSyncDirRight = new wxMenuItem(contextMenu.get(), ++contextItemID, wxString(_("Set direction:")) +
+ wxMenuItem* menuItemSyncDirRight = new wxMenuItem(contextMenu.get(), wxID_ANY, wxString(_("Set direction:")) +
wxT(" ") + getSymbol(fsObj->testSyncOperation(true, SYNC_DIR_RIGHT)) +
- wxT("\tALT + RIGHT"));
+ wxT("\tAlt + Right"));
menuItemSyncDirRight->SetBitmap(getSyncOpImage(fsObj->testSyncOperation(true, SYNC_DIR_RIGHT)));
contextMenu->Append(menuItemSyncDirRight);
- contextMenu->Connect(contextItemID, wxEVT_COMMAND_MENU_SELECTED, wxCommandEventHandler(MainDialog::OnContextSyncDirRight), NULL, this);
+ contextMenu->Connect(menuItemSyncDirRight->GetId(), wxEVT_COMMAND_MENU_SELECTED, wxCommandEventHandler(MainDialog::OnContextSyncDirRight), NULL, this);
contextMenu->AppendSeparator();
}
}
-
//CONTEXT_FILTER_TEMP
if (fsObj && (selection.size() > 0))
{
+ wxMenuItem* menuItemInExcl = NULL;
if (fsObj->isActive())
{
- wxMenuItem* menuItemExclTemp = new wxMenuItem(contextMenu.get(), ++contextItemID, wxString(_("Exclude temporarily")) + wxT("\tSPACE"));
- menuItemExclTemp->SetBitmap(GlobalResources::instance().getImage(wxT("checkboxFalse")));
- contextMenu->Append(menuItemExclTemp);
+ menuItemInExcl = new wxMenuItem(contextMenu.get(), wxID_ANY, wxString(_("Exclude temporarily")) + wxT("\tSpace"));
+ menuItemInExcl->SetBitmap(GlobalResources::instance().getImage(wxT("checkboxFalse")));
}
else
{
- wxMenuItem* menuItemInclTemp = new wxMenuItem(contextMenu.get(), ++contextItemID, wxString(_("Include temporarily")) + wxT("\tSPACE"));
- menuItemInclTemp->SetBitmap(GlobalResources::instance().getImage(wxT("checkboxTrue")));
- contextMenu->Append(menuItemInclTemp);
+ menuItemInExcl = new wxMenuItem(contextMenu.get(), wxID_ANY, wxString(_("Include temporarily")) + wxT("\tSpace"));
+ menuItemInExcl->SetBitmap(GlobalResources::instance().getImage(wxT("checkboxTrue")));
}
+
+ contextMenu->Append(menuItemInExcl);
+ contextMenu->Connect(menuItemInExcl->GetId(), wxEVT_COMMAND_MENU_SELECTED, wxCommandEventHandler(MainDialog::OnContextFilterTemp), NULL, this);
}
else
{
- contextMenu->Append(contextItemID, wxString(_("Exclude temporarily")) + wxT("\tSPACE")); //this element should always be visible
- contextMenu->Enable(contextItemID, false);
+ wxMenuItem* menuItemExcl = contextMenu->Append(wxID_ANY, wxString(_("Exclude temporarily")) + wxT("\tSpace")); //this element should always be visible
+ contextMenu->Enable(menuItemExcl->GetId(), false);
}
- contextMenu->Connect(contextItemID, wxEVT_COMMAND_MENU_SELECTED, wxCommandEventHandler(MainDialog::OnContextFilterTemp), NULL, this);
-
//###############################################################################################
//get list of relative file/dir-names for filtering
@@ -1766,12 +1812,12 @@ void MainDialog::OnContextRim(wxGridEvent& event)
const Zstring extension = filename.AfterLast(Zchar('.'));
//add context menu item
- wxMenuItem* menuItemExclExt = new wxMenuItem(contextMenu.get(), ++contextItemID, wxString(_("Exclude via filter:")) + wxT(" ") + wxT("*.") + zToWx(extension));
+ wxMenuItem* menuItemExclExt = new wxMenuItem(contextMenu.get(), wxID_ANY, wxString(_("Exclude via filter:")) + wxT(" ") + wxT("*.") + zToWx(extension));
menuItemExclExt->SetBitmap(GlobalResources::instance().getImage(wxT("filterSmall")));
contextMenu->Append(menuItemExclExt);
//connect event
- contextMenu->Connect(contextItemID,
+ contextMenu->Connect(menuItemExclExt->GetId(),
wxEVT_COMMAND_MENU_SELECTED,
wxCommandEventHandler(MainDialog::OnContextExcludeExtension),
new SelectedExtension(extension), //ownership passed!
@@ -1781,12 +1827,11 @@ void MainDialog::OnContextRim(wxGridEvent& event)
//CONTEXT_EXCLUDE_OBJ
- ++contextItemID;
wxMenuItem* menuItemExclObj = NULL;
if (exFilterCandidateObj.size() == 1)
- menuItemExclObj = new wxMenuItem(contextMenu.get(), contextItemID, wxString(_("Exclude via filter:")) + wxT(" ") + zToWx(exFilterCandidateObj.begin()->first.AfterLast(common::FILE_NAME_SEPARATOR)));
+ menuItemExclObj = new wxMenuItem(contextMenu.get(), wxID_ANY, wxString(_("Exclude via filter:")) + wxT(" ") + zToWx(exFilterCandidateObj.begin()->first.AfterLast(common::FILE_NAME_SEPARATOR)));
else if (exFilterCandidateObj.size() > 1)
- menuItemExclObj = new wxMenuItem(contextMenu.get(), contextItemID, wxString(_("Exclude via filter:")) + wxT(" ") + _("<multiple selection>"));
+ menuItemExclObj = new wxMenuItem(contextMenu.get(), wxID_ANY, wxString(_("Exclude via filter:")) + wxT(" ") + _("<multiple selection>"));
if (menuItemExclObj != NULL)
{
@@ -1794,7 +1839,7 @@ void MainDialog::OnContextRim(wxGridEvent& event)
contextMenu->Append(menuItemExclObj);
//connect event
- contextMenu->Connect(contextItemID,
+ contextMenu->Connect(menuItemExclObj->GetId(),
wxEVT_COMMAND_MENU_SELECTED,
wxCommandEventHandler(MainDialog::OnContextExcludeObject),
new FilterObjContainer(exFilterCandidateObj), //ownership passed!
@@ -1815,18 +1860,19 @@ void MainDialog::OnContextRim(wxGridEvent& event)
++i)
{
//some trick to translate default external apps on the fly: 1. "open in explorer" 2. "start directly"
- wxString description = wxGetTranslation(i->first);
+ //wxString description = wxGetTranslation(i->first);
+ wxString description = zen::translate(i->first);
if (description.empty())
description = wxT(" "); //wxWidgets doesn't like empty items
- ++contextItemID;
+ wxMenuItem* itemExtApp = NULL;
if (i == globalSettings->gui.externelApplications.begin())
- contextMenu->Append(contextItemID, description + wxT("\t") + wxString(_("D-Click")) + wxT("; ENTER"));
+ itemExtApp = contextMenu->Append(wxID_ANY, description + wxT("\t") + wxString(_("D-Click")) + wxT("; Enter"));
else
- contextMenu->Append(contextItemID, description);
- contextMenu->Enable(contextItemID, externalAppEnabled);
+ itemExtApp = contextMenu->Append(wxID_ANY, description);
+ contextMenu->Enable(itemExtApp->GetId(), externalAppEnabled);
- contextMenu->Connect(contextItemID,
+ contextMenu->Connect(itemExtApp->GetId(),
wxEVT_COMMAND_MENU_SELECTED,
wxCommandEventHandler(MainDialog::OnContextOpenWith),
new CtxtSelectionString(i->second), //ownership passed!
@@ -1837,24 +1883,14 @@ void MainDialog::OnContextRim(wxGridEvent& event)
contextMenu->AppendSeparator();
- //CONTEXT_CLIPBOARD
- contextMenu->Append(++contextItemID, _("Copy to clipboard\tCTRL+C"));
-
- if (!selection.empty() &&
- (m_gridLeft->isLeadGrid() || m_gridRight->isLeadGrid()))
- contextMenu->Enable(contextItemID, true);
- else
- contextMenu->Enable(contextItemID, false);
- contextMenu->Connect(contextItemID, wxEVT_COMMAND_MENU_SELECTED, wxCommandEventHandler(MainDialog::OnContextCopyClipboard), NULL, this);
-
+#ifndef _MSC_VER
+#warning context menu buttons: nicht mehr all caps
+#endif
//CONTEXT_DELETE_FILES
- contextMenu->Append(++contextItemID, _("Delete files\tDEL"));
-
- if (selection.size() == 0)
- contextMenu->Enable(contextItemID, false);
-
- contextMenu->Connect(contextItemID, wxEVT_COMMAND_MENU_SELECTED, wxCommandEventHandler(MainDialog::OnContextDeleteFiles), NULL, this);
+ wxMenuItem* menuItemDelFiles = contextMenu->Append(wxID_ANY, _("Delete files\tDEL"));
+ contextMenu->Enable(menuItemDelFiles->GetId(), selection.size() > 0);
+ contextMenu->Connect(menuItemDelFiles->GetId(), wxEVT_COMMAND_MENU_SELECTED, wxCommandEventHandler(MainDialog::OnContextDeleteFiles), NULL, this);
//show context menu
PopupMenu(contextMenu.get());
@@ -1886,7 +1922,7 @@ void MainDialog::OnContextExcludeExtension(wxCommandEvent& event)
updateFilterButtons();
//do not fully apply filter, just exclude new items
- addExcludeFiltering(newExclude, gridDataView->getDataTentative());
+ addExcludeFiltering(gridDataView->getDataTentative(), newExclude);
//applyFiltering(getCurrentConfiguration().mainCfg, gridDataView->getDataTentative());
updateGuiGrid();
@@ -1927,7 +1963,7 @@ void MainDialog::OnContextExcludeObject(wxCommandEvent& event)
updateFilterButtons();
//do not fully apply filter, just exclude new items
- addExcludeFiltering(newExclude, gridDataView->getDataTentative());
+ addExcludeFiltering(gridDataView->getDataTentative(), newExclude);
//applyFiltering(getCurrentConfiguration().mainCfg, gridDataView->getDataTentative());
updateGuiGrid();
@@ -1942,14 +1978,6 @@ void MainDialog::OnContextExcludeObject(wxCommandEvent& event)
}
-void MainDialog::OnContextCopyClipboard(wxCommandEvent& event)
-{
- if (m_gridLeft->isLeadGrid())
- copySelectionToClipboard(*m_gridLeft);
- else if (m_gridRight->isLeadGrid())
- copySelectionToClipboard(*m_gridRight);
-}
-
void MainDialog::OnContextOpenWith(wxCommandEvent& event)
{
@@ -1962,7 +1990,9 @@ void MainDialog::OnContextOpenWith(wxCommandEvent& event)
void MainDialog::OnContextDeleteFiles(wxCommandEvent& event)
{
- deleteSelectedFiles();
+ const std::set<size_t> viewSelectionLeft = getSelectedRows(m_gridLeft);
+ const std::set<size_t> viewSelectionRight = getSelectedRows(m_gridRight);
+ deleteSelectedFiles(viewSelectionLeft, viewSelectionRight);
}
@@ -1970,7 +2000,7 @@ void MainDialog::OnContextSyncDirLeft(wxCommandEvent& event)
{
//merge selections from left and right grid
const std::set<size_t> selection = getSelectedRows();
- setSyncDirManually(selection, ffs3::SYNC_DIR_LEFT);
+ setSyncDirManually(selection, zen::SYNC_DIR_LEFT);
}
@@ -1978,7 +2008,7 @@ void MainDialog::OnContextSyncDirNone(wxCommandEvent& event)
{
//merge selections from left and right grid
const std::set<size_t> selection = getSelectedRows();
- setSyncDirManually(selection, ffs3::SYNC_DIR_NONE);
+ setSyncDirManually(selection, zen::SYNC_DIR_NONE);
}
@@ -1986,7 +2016,7 @@ void MainDialog::OnContextSyncDirRight(wxCommandEvent& event)
{
//merge selections from left and right grid
const std::set<size_t> selection = getSelectedRows();
- setSyncDirManually(selection, ffs3::SYNC_DIR_RIGHT);
+ setSyncDirManually(selection, zen::SYNC_DIR_RIGHT);
}
@@ -2033,7 +2063,7 @@ void MainDialog::OnContextCustColumnLeft(wxCommandEvent& event)
{
xmlAccess::ColumnAttributes colAttr = m_gridLeft->getColumnAttributes();
- if (ffs3::showCustomizeColsDlg(colAttr) == DefaultReturnCode::BUTTON_OKAY)
+ if (zen::showCustomizeColsDlg(colAttr) == ReturnSmallDlg::BUTTON_OKAY)
{
m_gridLeft->setColumnAttributes(colAttr);
@@ -2048,7 +2078,7 @@ void MainDialog::OnContextCustColumnRight(wxCommandEvent& event)
{
xmlAccess::ColumnAttributes colAttr = m_gridRight->getColumnAttributes();
- if (ffs3::showCustomizeColsDlg(colAttr) == DefaultReturnCode::BUTTON_OKAY)
+ if (zen::showCustomizeColsDlg(colAttr) == ReturnSmallDlg::BUTTON_OKAY)
{
m_gridRight->setColumnAttributes(colAttr);
@@ -2176,14 +2206,14 @@ void MainDialog::OnContextSetLayoutShowPanel(wxCommandEvent& event)
void MainDialog::OnContextIncludeAll(wxCommandEvent& event)
{
- ffs3::setActiveStatus(true, gridDataView->getDataTentative());
+ zen::setActiveStatus(true, gridDataView->getDataTentative());
refreshGridAfterFilterChange(0); //call this instead of updateGuiGrid() to add some delay if hideFiltered == true and to handle some graphical artifacts break;
}
void MainDialog::OnContextExcludeAll(wxCommandEvent& event)
{
- ffs3::setActiveStatus(false, gridDataView->getDataTentative());
+ zen::setActiveStatus(false, gridDataView->getDataTentative());
refreshGridAfterFilterChange(400); //call this instead of updateGuiGrid() to add some delay if hideFiltered == true and to handle some graphical artifacts
}
@@ -2224,8 +2254,12 @@ wxString getFormattedHistoryElement(const wxString& filename)
}
-void MainDialog::addFileToCfgHistory(const wxString& filename)
+void MainDialog::addFileToCfgHistory(const wxString& cfgFile)
{
+ wxString filename = cfgFile;
+ if (filename.empty())
+ filename = lastRunConfigName();
+
//only (still) existing files should be included in the list
if (util::fileExists(wxToZ(filename), 200) == util::EXISTING_FALSE) //potentially slow network access: wait 200ms
return;
@@ -2270,13 +2304,13 @@ void MainDialog::addFileToCfgHistory(const wxString& filename)
void MainDialog::addLeftFolderToHistory(const wxString& leftFolder)
{
- m_directoryLeft->addPairToFolderHistory(leftFolder, globalSettings->gui.folderHistLeftMax);
+ m_directoryLeft->addPairToFolderHistory(leftFolder, globalSettings->gui.folderHistMax);
}
void MainDialog::addRightFolderToHistory(const wxString& rightFolder)
{
- m_directoryRight->addPairToFolderHistory(rightFolder, globalSettings->gui.folderHistRightMax);
+ m_directoryRight->addPairToFolderHistory(rightFolder, globalSettings->gui.folderHistMax);
}
@@ -2299,13 +2333,10 @@ bool MainDialog::trySaveConfig() //return true if saved successfully
{
const wxString newFileName = filePicker.GetPath();
- if (ffs3::fileExists(wxToZ(newFileName)))
+ if (zen::fileExists(wxToZ(newFileName)))
{
- QuestionDlg messageDlg(this,
- QuestionDlg::BUTTON_YES | QuestionDlg::BUTTON_CANCEL,
- wxString(_("File already exists. Overwrite?")) + wxT(" \"") + newFileName + wxT("\""));
-
- if (messageDlg.ShowModal() != QuestionDlg::BUTTON_YES)
+ if (showQuestionDlg(ReturnQuestionDlg::BUTTON_YES | ReturnQuestionDlg::BUTTON_CANCEL,
+ wxString(_("File already exists. Overwrite?")) + wxT(" \"") + newFileName + wxT("\"")) != ReturnQuestionDlg::BUTTON_YES)
return trySaveConfig(); //retry
}
@@ -2366,21 +2397,18 @@ bool MainDialog::saveOldConfig() //return false on user abort
{
bool dontShowAgain = !globalSettings->optDialogs.popupOnConfigChange;
- QuestionDlg notifyChangeDlg(this,
- QuestionDlg::BUTTON_YES | QuestionDlg::BUTTON_NO | QuestionDlg::BUTTON_CANCEL,
- _("Save changes to current configuration?"),
- &dontShowAgain);
-
- switch (notifyChangeDlg.ShowModal())
+ switch (showQuestionDlg(ReturnQuestionDlg::BUTTON_YES | ReturnQuestionDlg::BUTTON_NO | ReturnQuestionDlg::BUTTON_CANCEL,
+ _("Save changes to current configuration?"),
+ &dontShowAgain))
{
- case QuestionDlg::BUTTON_YES:
+ case ReturnQuestionDlg::BUTTON_YES:
if (!trySaveConfig())
return false;
break;
- case QuestionDlg::BUTTON_NO:
+ case ReturnQuestionDlg::BUTTON_NO:
globalSettings->optDialogs.popupOnConfigChange = !dontShowAgain;
break;
- case QuestionDlg::BUTTON_CANCEL:
+ case ReturnQuestionDlg::BUTTON_CANCEL:
return false;
}
}
@@ -2490,7 +2518,7 @@ void MainDialog::OnSetSyncDirection(FFSSyncDirectionEvent& event)
if (fsObj)
{
setSyncDirectionRec(event.direction, *fsObj); //set new direction (recursively)
- ffs3::setActiveStatus(true, *fsObj); //works recursively for directories
+ zen::setActiveStatus(true, *fsObj); //works recursively for directories
}
}
@@ -2538,7 +2566,7 @@ void MainDialog::setLastUsedConfig(const wxString& filename, const xmlAccess::Xm
addFileToCfgHistory(filename); //put filename on list of last used config files
//set title
- if (filename == lastRunConfigName())
+ if (filename.empty() || filename == lastRunConfigName())
{
SetTitle(wxString(wxT("FreeFileSync - ")) + _("Folder Comparison and Synchronization"));
currentConfigFileName.clear();
@@ -2591,8 +2619,8 @@ void MainDialog::setCurrentConfiguration(const xmlAccess::XmlGuiConfig& newGuiCf
updateFilterButtons();
//set first folder pair
- firstFolderPair->setValues(currentCfg.mainCfg.firstPair.leftDirectory,
- currentCfg.mainCfg.firstPair.rightDirectory,
+ firstFolderPair->setValues(zToWx(currentCfg.mainCfg.firstPair.leftDirectory),
+ zToWx(currentCfg.mainCfg.firstPair.rightDirectory),
currentCfg.mainCfg.firstPair.altSyncConfig,
currentCfg.mainCfg.firstPair.localFilter);
@@ -2622,10 +2650,10 @@ void MainDialog::setCurrentConfiguration(const xmlAccess::XmlGuiConfig& newGuiCf
inline
-FolderPairEnh getEnahncedPair(const DirectoryPair* panel)
+FolderPairEnh getEnhancedPair(const DirectoryPair* panel)
{
- return FolderPairEnh(panel->getLeftDir(),
- panel->getRightDir(),
+ return FolderPairEnh(wxToZ(panel->getLeftDir()),
+ wxToZ(panel->getRightDir()),
panel->getAltSyncConfig(),
panel->getAltFilterConfig());
}
@@ -2638,15 +2666,15 @@ xmlAccess::XmlGuiConfig MainDialog::getCurrentConfiguration() const
//load settings whose ownership lies not in currentCfg:
//first folder pair
- guiCfg.mainCfg.firstPair = FolderPairEnh(firstFolderPair->getLeftDir(),
- firstFolderPair->getRightDir(),
+ guiCfg.mainCfg.firstPair = FolderPairEnh(wxToZ(firstFolderPair->getLeftDir()),
+ wxToZ(firstFolderPair->getRightDir()),
firstFolderPair->getAltSyncConfig(),
firstFolderPair->getAltFilterConfig());
//add additional pairs
guiCfg.mainCfg.additionalPairs.clear();
std::transform(additionalFolderPairs.begin(), additionalFolderPairs.end(),
- std::back_inserter(guiCfg.mainCfg.additionalPairs), getEnahncedPair);
+ std::back_inserter(guiCfg.mainCfg.additionalPairs), getEnhancedPair);
//sync preview
guiCfg.syncPreviewEnabled = syncPreview->previewIsEnabled();
@@ -2657,7 +2685,7 @@ xmlAccess::XmlGuiConfig MainDialog::getCurrentConfiguration() const
const wxString& MainDialog::lastRunConfigName()
{
- static wxString instance = ffs3::getConfigDir() + wxT("LastRun.ffs_gui");
+ static wxString instance = zen::getConfigDir() + wxT("LastRun.ffs_gui");
return instance;
}
@@ -2703,8 +2731,7 @@ void MainDialog::OnHideFilteredButton(wxCommandEvent& event)
void MainDialog::OnConfigureFilter(wxCommandEvent& event)
{
if (showFilterDialog(true, //is main filter dialog
- currentCfg.mainCfg.globalFilter.includeFilter,
- currentCfg.mainCfg.globalFilter.excludeFilter) == DefaultReturnCode::BUTTON_OKAY)
+ currentCfg.mainCfg.globalFilter) == ReturnSmallDlg::BUTTON_OKAY)
{
updateFilterButtons(); //refresh global filter icon
updateFilterConfig(); //re-apply filter
@@ -2966,75 +2993,76 @@ void MainDialog::OnCompare(wxCommandEvent& event)
gridDataView->clearAllRows();
//updateGuiGrid(); -> don't resize grid to keep scroll position!
- bool aborted = false;
try
{
//class handling status display and error messages
- CompareStatusHandler statusHandler(this);
+ CompareStatusHandler statusHandler(*this);
+
+ const std::vector<zen::FolderPairCfg> cmpConfig = zen::extractCompareCfg(getCurrentConfiguration().mainCfg);
+
+ //GUI mode: place directory locks on directories isolated(!) during both comparison and synchronization
+ LockHolder dummy2;
+ for (std::vector<FolderPairCfg>::const_iterator i = cmpConfig.begin(); i != cmpConfig.end(); ++i)
+ {
+ dummy2.addDir(i->leftDirectoryFmt, statusHandler);
+ dummy2.addDir(i->rightDirectoryFmt, statusHandler);
+ }
//begin comparison
- ffs3::CompareProcess comparison(currentCfg.mainCfg.handleSymlinks,
- globalSettings->fileTimeTolerance,
- globalSettings->optDialogs,
- &statusHandler);
+ zen::CompareProcess comparison(currentCfg.mainCfg.handleSymlinks,
+ globalSettings->fileTimeTolerance,
+ globalSettings->optDialogs,
+ statusHandler);
//technical representation of comparison data
- ffs3::FolderComparison newCompareData;
-
- comparison.startCompareProcess(
- ffs3::extractCompareCfg(getCurrentConfiguration().mainCfg), //call getCurrentCfg() to get current values for directory pairs!
- currentCfg.mainCfg.compareVar,
- newCompareData);
+ zen::FolderComparison newCompareData;
+ comparison.startCompareProcess(cmpConfig, //call getCurrentCfg() to get current values for directory pairs!
+ currentCfg.mainCfg.compareVar,
+ newCompareData);
gridDataView->setData(newCompareData); //newCompareData is invalidated after this call
//play (optional) sound notification after sync has completed (GUI and batch mode)
- const wxString soundFile = ffs3::getResourceDir() + wxT("Compare_Complete.wav");
+ const wxString soundFile = zen::getResourceDir() + wxT("Compare_Complete.wav");
if (fileExists(wxToZ(soundFile)))
wxSound::Play(soundFile, wxSOUND_ASYNC);
}
catch (AbortThisProcess&)
{
- aborted = true;
- }
-
- if (aborted)
- {
//disable the sync button
syncPreview->enableSynchronization(false);
m_buttonCompare->SetFocus();
updateGuiGrid(); //refresh grid in ANY case! (also on abort)
+ return;
}
- else
- {
- //once compare is finished enable the sync button
- syncPreview->enableSynchronization(true);
- m_buttonStartSync->SetFocus();
- //hide sort direction indicator on GUI grids
- m_gridLeft ->setSortMarker(CustomGrid::SortMarker(-1, CustomGrid::ASCENDING));
- m_gridMiddle->setSortMarker(CustomGrid::SortMarker(-1, CustomGrid::ASCENDING));
- m_gridRight ->setSortMarker(CustomGrid::SortMarker(-1, CustomGrid::ASCENDING));
+ //once compare is finished enable the sync button
+ syncPreview->enableSynchronization(true);
+ m_buttonStartSync->SetFocus();
- //reset last sort selection: used for determining sort direction
- lastSortColumn = -1;
- lastSortGrid = NULL;
+ //hide sort direction indicator on GUI grids
+ m_gridLeft ->setSortMarker(CustomGrid::SortMarker(-1, CustomGrid::ASCENDING));
+ m_gridMiddle->setSortMarker(CustomGrid::SortMarker(-1, CustomGrid::ASCENDING));
+ m_gridRight ->setSortMarker(CustomGrid::SortMarker(-1, CustomGrid::ASCENDING));
- m_gridLeft-> ClearSelection();
- m_gridMiddle->ClearSelection();
- m_gridRight-> ClearSelection();
+ //reset last sort selection: used for determining sort direction
+ lastSortColumn = -1;
+ lastSortGrid = NULL;
- //add to folder history after successful comparison only
- addLeftFolderToHistory( m_directoryLeft->GetValue());
- addRightFolderToHistory(m_directoryRight->GetValue());
+ m_gridLeft-> ClearSelection();
+ m_gridMiddle->ClearSelection();
+ m_gridRight-> ClearSelection();
- //refresh grid in ANY case! (also on abort)
- updateGuiGrid();
+ //add to folder history after successful comparison only
+ addLeftFolderToHistory( m_directoryLeft->GetValue());
+ addRightFolderToHistory(m_directoryRight->GetValue());
- //prepare status information
- if (allElementsEqual(gridDataView->getDataTentative()))
- pushStatusInformation(_("All directories in sync!"));
- }
+ //refresh grid in ANY case! (also on abort)
+ updateGuiGrid();
+
+ //prepare status information
+ if (allElementsEqual(gridDataView->getDataTentative()))
+ pushStatusInformation(_("All directories in sync!"));
}
@@ -3085,10 +3113,10 @@ void MainDialog::updateStatistics()
{
//update preview of bytes to be transferred:
const SyncStatistics st(gridDataView->getDataTentative());
- const wxString toCreate = ffs3::numberToStringSep(st.getCreate());
- const wxString toUpdate = ffs3::numberToStringSep(st.getOverwrite());
- const wxString toDelete = ffs3::numberToStringSep(st.getDelete());
- const wxString data = ffs3::formatFilesizeToShortString(st.getDataToProcess());
+ const wxString toCreate = zen::toStringSep(st.getCreate());
+ const wxString toUpdate = zen::toStringSep(st.getOverwrite());
+ const wxString toDelete = zen::toStringSep(st.getDelete());
+ const wxString data = zen::formatFilesizeToShortString(st.getDataToProcess());
m_textCtrlCreate->SetValue(toCreate);
m_textCtrlUpdate->SetValue(toUpdate);
@@ -3106,14 +3134,14 @@ void MainDialog::OnSwitchView(wxCommandEvent& event)
void MainDialog::OnSyncSettings(wxCommandEvent& event)
{
- SyncCfgDialog syncDlg(this,
- currentCfg.mainCfg.compareVar,
+ if (showSyncConfigDlg(currentCfg.mainCfg.compareVar,
currentCfg.mainCfg.syncConfiguration,
currentCfg.mainCfg.handleDeletion,
currentCfg.mainCfg.customDeletionDirectory,
- &currentCfg.ignoreErrors);
- if (syncDlg.ShowModal() == SyncCfgDialog::BUTTON_APPLY)
+ &currentCfg.handleError) == ReturnSyncConfig::BUTTON_OKAY) //optional input parameter
+ {
applySyncConfig();
+ }
}
@@ -3126,9 +3154,9 @@ void MainDialog::OnCmpSettings(wxCommandEvent& event)
const CompareVariant compareVarOld = currentCfg.mainCfg.compareVar;
const SymLinkHandling handleSymlinksOld = currentCfg.mainCfg.handleSymlinks;
- if (ffs3::showCompareCfgDialog(windowPos,
- currentCfg.mainCfg.compareVar,
- currentCfg.mainCfg.handleSymlinks) == DefaultReturnCode::BUTTON_OKAY &&
+ if (zen::showCompareCfgDialog(windowPos,
+ currentCfg.mainCfg.compareVar,
+ currentCfg.mainCfg.handleSymlinks) == ReturnSmallDlg::BUTTON_OKAY &&
//check if settings were changed at all
(compareVarOld != currentCfg.mainCfg.compareVar ||
handleSymlinksOld != currentCfg.mainCfg.handleSymlinks))
@@ -3164,8 +3192,14 @@ void MainDialog::OnStartSync(wxCommandEvent& event)
{
if (!syncPreview->synchronizationIsEnabled())
{
- pushStatusInformation(_("Please run a Compare first before synchronizing!"));
- return;
+ //quick sync: simulate button click on "compare"
+ wxCommandEvent dummy2(wxEVT_COMMAND_BUTTON_CLICKED);
+ m_buttonCompare->GetEventHandler()->ProcessEvent(dummy2); //synchronous call
+
+ if (!syncPreview->synchronizationIsEnabled()) //check if user aborted or error occured, ect...
+ return;
+ //pushStatusInformation(_("Please run a Compare first before synchronizing!"));
+ //return;
}
//show sync preview screen
@@ -3173,10 +3207,10 @@ void MainDialog::OnStartSync(wxCommandEvent& event)
{
bool dontShowAgain = false;
- if (ffs3::showSyncPreviewDlg(
+ if (zen::showSyncPreviewDlg(
getCurrentConfiguration().mainCfg.getSyncVariantName(),
- ffs3::SyncStatistics(gridDataView->getDataTentative()),
- dontShowAgain) != DefaultReturnCode::BUTTON_OKAY)
+ zen::SyncStatistics(gridDataView->getDataTentative()),
+ dontShowAgain) != ReturnSmallDlg::BUTTON_OKAY)
return;
globalSettings->optDialogs.showSummaryBeforeSync = !dontShowAgain;
@@ -3190,18 +3224,27 @@ void MainDialog::OnStartSync(wxCommandEvent& event)
//PERF_START;
//class handling status updates and error messages
- SyncStatusHandler statusHandler(this, currentCfg.ignoreErrors, ffs3::extractJobName(currentConfigFileName));
+ SyncStatusHandler statusHandler(this, currentCfg.handleError, zen::extractJobName(currentConfigFileName));
+
+ FolderComparison& dataToSync = gridDataView->getDataTentative();
+
+ //GUI mode: place directory locks on directories isolated(!) during both comparison and synchronization
+ LockHolder dummy2;
+ for (FolderComparison::const_iterator i = dataToSync.begin(); i != dataToSync.end(); ++i)
+ {
+ dummy2.addDir(i->getBaseDir<LEFT_SIDE >(), statusHandler);
+ dummy2.addDir(i->getBaseDir<RIGHT_SIDE>(), statusHandler);
+ }
//start synchronization and mark all elements processed
- ffs3::SyncProcess synchronization(
+ zen::SyncProcess synchronization(
globalSettings->optDialogs,
globalSettings->verifyFileCopy,
globalSettings->copyLockedFiles,
globalSettings->copyFilePermissions,
statusHandler);
- const std::vector<ffs3::FolderPairSyncCfg> syncProcessCfg = ffs3::extractSyncCfg(getCurrentConfiguration().mainCfg);
- FolderComparison& dataToSync = gridDataView->getDataTentative();
+ const std::vector<zen::FolderPairSyncCfg> syncProcessCfg = zen::extractSyncCfg(getCurrentConfiguration().mainCfg);
//make sure syncProcessCfg and dataToSync have same size and correspond!
if (syncProcessCfg.size() != dataToSync.size())
@@ -3210,7 +3253,7 @@ void MainDialog::OnStartSync(wxCommandEvent& event)
synchronization.startSynchronizationProcess(syncProcessCfg, dataToSync);
//play (optional) sound notification after sync has completed (GUI and batch mode)
- const wxString soundFile = ffs3::getResourceDir() + wxT("Sync_Complete.wav");
+ const wxString soundFile = zen::getResourceDir() + wxT("Sync_Complete.wav");
if (fileExists(wxToZ(soundFile)))
wxSound::Play(soundFile, wxSOUND_ASYNC);
}
@@ -3434,7 +3477,7 @@ void MainDialog::OnSwapSides(wxCommandEvent& event)
m_bpButtonSyncDirOverwRight->setActive(tmp);
//swap grid information
- ffs3::swapGrids(getCurrentConfiguration().mainCfg, gridDataView->getDataTentative());
+ zen::swapGrids(getCurrentConfiguration().mainCfg, gridDataView->getDataTentative());
updateGuiGrid();
}
@@ -3445,8 +3488,8 @@ void MainDialog::updateGridViewData()
size_t foldersOnLeftView = 0;
size_t filesOnRightView = 0;
size_t foldersOnRightView = 0;
- wxULongLong filesizeLeftView;
- wxULongLong filesizeRightView;
+ zen::UInt64 filesizeLeftView;
+ zen::UInt64 filesizeRightView;
//disable all buttons per default
m_bpButtonLeftOnly-> Show(false);
@@ -3570,16 +3613,9 @@ void MainDialog::updateGridViewData()
//show status information on "root" level.
if (foldersOnLeftView)
{
- if (foldersOnLeftView == 1)
- statusLeftNew += _("1 directory");
- else
- {
- wxString folderCount = ffs3::numberToStringSep(foldersOnLeftView);
-
- wxString outputString = _("%x directories");
- outputString.Replace(wxT("%x"), folderCount, false);
- statusLeftNew += outputString;
- }
+ wxString tmp = _P("1 directory", "%x directories", foldersOnLeftView);
+ tmp.Replace(wxT("%x"), zen::toStringSep(foldersOnLeftView), false);
+ statusLeftNew += tmp;
if (filesOnLeftView)
statusLeftNew += wxT(" - ");
@@ -3587,49 +3623,26 @@ void MainDialog::updateGridViewData()
if (filesOnLeftView)
{
- if (filesOnLeftView == 1)
- statusLeftNew += _("1 file");
- else
- {
- wxString fileCount = ffs3::numberToStringSep(filesOnLeftView);
+ wxString tmp = _P("1 file", "%x files", filesOnLeftView);
+ tmp.Replace(wxT("%x"), zen::toStringSep(filesOnLeftView), false);
+ statusLeftNew += tmp;
- wxString outputString = _("%x files");
- outputString.Replace(wxT("%x"), fileCount, false);
- statusLeftNew += outputString;
- }
statusLeftNew += wxT(" - ");
- statusLeftNew += ffs3::formatFilesizeToShortString(filesizeLeftView);
+ statusLeftNew += zen::formatFilesizeToShortString(filesizeLeftView);
}
- const wxString objectsView = ffs3::numberToStringSep(gridDataView->rowsOnView());
- if (gridDataView->rowsTotal() == 1)
{
- wxString outputString = _("%x of 1 row in view");
- outputString.Replace(wxT("%x"), objectsView, false);
- statusMiddleNew = outputString;
- }
- else
- {
- const wxString objectsTotal = ffs3::numberToStringSep(gridDataView->rowsTotal());
-
- wxString outputString = _("%x of %y rows in view");
- outputString.Replace(wxT("%x"), objectsView, false);
- outputString.Replace(wxT("%y"), objectsTotal, false);
- statusMiddleNew = outputString;
+ wxString tmp = _P("%x of 1 row in view", "%x of %y rows in view", gridDataView->rowsTotal());
+ tmp.Replace(wxT("%x"), toStringSep(gridDataView->rowsOnView()), false);
+ tmp.Replace(wxT("%y"), toStringSep(gridDataView->rowsTotal()), false);
+ statusMiddleNew = tmp;
}
if (foldersOnRightView)
{
- if (foldersOnRightView == 1)
- statusRightNew += _("1 directory");
- else
- {
- wxString folderCount = ffs3::numberToStringSep(foldersOnRightView);
-
- wxString outputString = _("%x directories");
- outputString.Replace(wxT("%x"), folderCount, false);
- statusRightNew += outputString;
- }
+ wxString tmp = _P("1 directory", "%x directories", foldersOnRightView);
+ tmp.Replace(wxT("%x"), zen::toStringSep(foldersOnRightView), false);
+ statusRightNew += tmp;
if (filesOnRightView)
statusRightNew += wxT(" - ");
@@ -3637,19 +3650,12 @@ void MainDialog::updateGridViewData()
if (filesOnRightView)
{
- if (filesOnRightView == 1)
- statusRightNew += _("1 file");
- else
- {
- wxString fileCount = ffs3::numberToStringSep(filesOnRightView);
-
- wxString outputString = _("%x files");
- outputString.Replace(wxT("%x"), fileCount, false);
- statusRightNew += outputString;
- }
+ wxString tmp = _P("1 file", "%x files", filesOnRightView);
+ tmp.Replace(wxT("%x"), zen::toStringSep(filesOnRightView), false);
+ statusRightNew += tmp;
statusRightNew += wxT(" - ");
- statusRightNew += ffs3::formatFilesizeToShortString(filesizeRightView);
+ statusRightNew += zen::formatFilesizeToShortString(filesizeRightView);
}
@@ -3676,8 +3682,8 @@ void MainDialog::OnAddFolderPair(wxCommandEvent& event)
//clear first pair
const FolderPairEnh cfgEmpty;
- firstFolderPair->setValues(cfgEmpty.leftDirectory,
- cfgEmpty.rightDirectory,
+ firstFolderPair->setValues(zToWx(cfgEmpty.leftDirectory),
+ zToWx(cfgEmpty.rightDirectory),
cfgEmpty.altSyncConfig,
cfgEmpty.localFilter);
@@ -3692,7 +3698,7 @@ void MainDialog::OnAddFolderPair(wxCommandEvent& event)
void MainDialog::updateFilterConfig()
{
- applyFiltering(getCurrentConfiguration().mainCfg, gridDataView->getDataTentative());
+ applyFiltering(gridDataView->getDataTentative(), getCurrentConfiguration().mainCfg);
refreshGridAfterFilterChange(400);
}
@@ -3716,11 +3722,9 @@ void MainDialog::applySyncConfig()
if (warningSyncDatabase_)
{
bool dontWarnAgain = false;
- WarningDlg warningDlg(parent_, //show popup and ask user how to handle warning
- WarningDlg::BUTTON_IGNORE,
- text,
- dontWarnAgain);
- if (warningDlg.ShowModal() == WarningDlg::BUTTON_IGNORE)
+ if (showWarningDlg(ReturnWarningDlg::BUTTON_IGNORE,
+ text,
+ dontWarnAgain) == ReturnWarningDlg::BUTTON_IGNORE)
warningSyncDatabase_ = !dontWarnAgain;
}
}
@@ -3729,7 +3733,7 @@ void MainDialog::applySyncConfig()
wxWindow* parent_;
} redetCallback(globalSettings->optDialogs.warningSyncDatabase, this);
- ffs3::redetermineSyncDirection(getCurrentConfiguration().mainCfg, gridDataView->getDataTentative(), &redetCallback);
+ zen::redetermineSyncDirection(getCurrentConfiguration().mainCfg, gridDataView->getDataTentative(), &redetCallback);
updateGuiGrid();
}
@@ -3741,11 +3745,11 @@ void MainDialog::OnRemoveTopFolderPair(wxCommandEvent& event)
wxWindowUpdateLocker dummy(this); //avoid display distortion
//get settings from second folder pair
- const FolderPairEnh cfgSecond = getEnahncedPair(additionalFolderPairs[0]);
+ const FolderPairEnh cfgSecond = getEnhancedPair(additionalFolderPairs[0]);
//reset first pair
- firstFolderPair->setValues(cfgSecond.leftDirectory,
- cfgSecond.rightDirectory,
+ firstFolderPair->setValues(zToWx(cfgSecond.leftDirectory),
+ zToWx(cfgSecond.rightDirectory),
cfgSecond.altSyncConfig,
cfgSecond.localFilter);
@@ -3796,8 +3800,7 @@ void MainDialog::updateGuiForFolderPair()
//adapt local filter and sync cfg for first folder pair
if (additionalFolderPairs.size() == 0 &&
firstFolderPair->getAltSyncConfig().get() == NULL &&
- NameFilter(firstFolderPair->getAltFilterConfig().includeFilter,
- firstFolderPair->getAltFilterConfig().excludeFilter).isNull())
+ isNullFilter(firstFolderPair->getAltFilterConfig()))
{
m_bpButtonLocalFilter->Hide();
m_bpButtonAltSyncCfg->Hide();
@@ -3827,6 +3830,12 @@ void MainDialog::updateGuiForFolderPair()
//m_scrolledWindowFolderPairs->Layout(); //adjust stuff inside scrolled window
m_panelDirectoryPairs->Layout();
+
+ /*
+ #warning test
+ auiMgr.GetPane(m_panelDirectoryPairs).MaxSize(20, 20);
+ auiMgr.Update();
+ */
}
@@ -3861,8 +3870,8 @@ void MainDialog::addFolderPair(const std::vector<FolderPairEnh>& newPairs, bool
newPair->m_bpButtonRemovePair->Connect(wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler(MainDialog::OnRemoveFolderPair), NULL, this);
//set alternate configuration
- newPair->setValues(i->leftDirectory,
- i->rightDirectory,
+ newPair->setValues(zToWx(i->leftDirectory),
+ zToWx(i->rightDirectory),
i->altSyncConfig,
i->localFilter);
}
@@ -3926,11 +3935,23 @@ void MainDialog::clearAddFolderPairs()
//menu events
void MainDialog::OnMenuGlobalSettings(wxCommandEvent& event)
{
- ffs3::showGlobalSettingsDlg(*globalSettings);
+ zen::showGlobalSettingsDlg(*globalSettings);
//event.Skip();
}
+namespace
+{
+inline
+void addCellValue(zxString& exportString, const wxString& cellVal)
+{
+ if (cellVal.find(wxT(';')) != wxString::npos)
+ exportString += wxT('\"') + wxToZx(cellVal) + wxT('\"');
+ else
+ exportString += wxToZx(cellVal);
+}
+}
+
void MainDialog::OnMenuExportFileList(wxCommandEvent& event)
{
@@ -3941,13 +3962,10 @@ void MainDialog::OnMenuExportFileList(wxCommandEvent& event)
if (filePicker.ShowModal() == wxID_OK)
{
const wxString newFileName = filePicker.GetPath();
- if (ffs3::fileExists(wxToZ(newFileName)))
+ if (zen::fileExists(wxToZ(newFileName)))
{
- QuestionDlg messageDlg(this,
- QuestionDlg::BUTTON_YES | QuestionDlg::BUTTON_CANCEL,
- wxString(_("File already exists. Overwrite?")) + wxT(" \"") + newFileName + wxT("\""));
-
- if (messageDlg.ShowModal() != QuestionDlg::BUTTON_YES)
+ if (showQuestionDlg(ReturnQuestionDlg::BUTTON_YES | ReturnQuestionDlg::BUTTON_CANCEL,
+ wxString(_("File already exists. Overwrite?")) + wxT(" \"") + newFileName + wxT("\"")) != ReturnQuestionDlg::BUTTON_YES)
{
OnMenuExportFileList(event); //retry
return;
@@ -3986,21 +4004,21 @@ void MainDialog::OnMenuExportFileList(wxCommandEvent& event)
const int colsLeft = m_gridLeft->GetNumberCols();
for (int k = 0; k < colsLeft; ++k)
{
- exportString += wxToZx(m_gridLeft->GetColLabelValue(k));
+ addCellValue(exportString, m_gridLeft->GetColLabelValue(k));
exportString += wxT(';');
}
const int colsMiddle = m_gridMiddle->GetNumberCols();
for (int k = 0; k < colsMiddle; ++k)
{
- exportString += wxToZx(m_gridMiddle->GetColLabelValue(k));
+ addCellValue(exportString, m_gridMiddle->GetColLabelValue(k));
exportString += wxT(';');
}
const int colsRight = m_gridRight->GetNumberCols();
for (int k = 0; k < colsRight; ++k)
{
- exportString += wxToZx(m_gridRight->GetColLabelValue(k));
+ addCellValue(exportString, m_gridRight->GetColLabelValue(k));
if (k != m_gridRight->GetNumberCols() - 1)
exportString += wxT(';');
}
@@ -4012,19 +4030,19 @@ void MainDialog::OnMenuExportFileList(wxCommandEvent& event)
{
for (int k = 0; k < colsLeft; ++k)
{
- exportString += wxToZx(m_gridLeft->GetCellValue(i, k));
+ addCellValue(exportString, m_gridLeft->GetCellValue(i, k));
exportString += wxT(';');
}
for (int k = 0; k < colsMiddle; ++k)
{
- exportString += wxToZx(m_gridMiddle->GetCellValue(i, k));
+ addCellValue(exportString, m_gridMiddle->GetCellValue(i, k));
exportString += wxT(';');
}
for (int k = 0; k < colsRight; ++k)
{
- exportString += wxToZx(m_gridRight->GetCellValue(i, k));
+ addCellValue(exportString, m_gridRight->GetCellValue(i, k));
if (k != colsRight - 1)
exportString += wxT(';');
}
@@ -4035,8 +4053,12 @@ void MainDialog::OnMenuExportFileList(wxCommandEvent& event)
wxFFile output(newFileName.c_str(), wxT("w")); //don't write in binary mode
if (output.IsOpened())
{
+ //generate UTF8 representation
+ size_t bufferSize = 0;
+ const wxCharBuffer utf8buffer = wxConvUTF8.cWC2MB(exportString.c_str(), exportString.size(), &bufferSize);
+
output.Write(common::BYTE_ORDER_MARK_UTF8, sizeof(common::BYTE_ORDER_MARK_UTF8) - 1);
- output.Write(exportString.c_str(), exportString.size() * sizeof(zxString::value_type));
+ output.Write(utf8buffer, bufferSize);
pushStatusInformation(_("File list exported!"));
}
else
@@ -4054,15 +4076,14 @@ void MainDialog::OnMenuBatchJob(wxCommandEvent& event)
const xmlAccess::XmlBatchConfig batchCfg = convertGuiToBatch(currCfg);
- BatchDialog batchDlg(this, batchCfg);
- if (batchDlg.ShowModal() == BatchDialog::BATCH_FILE_SAVED)
+ if (showSyncBatchDlg(batchCfg) == ReturnBatchConfig::BATCH_FILE_SAVED)
pushStatusInformation(_("Batch file created successfully!"));
}
void MainDialog::OnMenuCheckVersion(wxCommandEvent& event)
{
- ffs3::checkForUpdateNow();
+ zen::checkForUpdateNow();
}
@@ -4071,7 +4092,7 @@ void MainDialog::OnRegularUpdateCheck(wxIdleEvent& event)
//execute just once per startup!
Disconnect(wxEVT_IDLE, wxIdleEventHandler(MainDialog::OnRegularUpdateCheck), NULL, this);
- ffs3::checkForUpdatePeriodically(globalSettings->gui.lastUpdateCheck);
+ zen::checkForUpdatePeriodically(globalSettings->gui.lastUpdateCheck);
}
@@ -4094,13 +4115,13 @@ void MainDialog::OnLayoutWindowAsync(wxIdleEvent& event)
void MainDialog::OnMenuAbout(wxCommandEvent& event)
{
- ffs3::showAboutDialog();
+ zen::showAboutDialog();
}
void MainDialog::OnShowHelp(wxCommandEvent& event)
{
- ffs3::displayHelpEntry();
+ zen::displayHelpEntry();
}
@@ -4115,7 +4136,7 @@ void MainDialog::OnMenuQuit(wxCommandEvent& event)
void MainDialog::switchProgramLanguage(const int langID)
{
//create new dialog with respect to new language
- ffs3::setLanguage(langID); //language is a global attribute
+ zen::setLanguage(langID); //language is a global attribute
const xmlAccess::XmlGuiConfig currentGuiCfg = getCurrentConfiguration();
diff --git a/ui/main_dlg.h b/ui/main_dlg.h
index 9b8d491b..9f12e284 100644
--- a/ui/main_dlg.h
+++ b/ui/main_dlg.h
@@ -14,7 +14,7 @@
#include <map>
#include <set>
#include <wx/aui/aui.h>
-
+#include "../shared/int64.h"
class CustomGrid;
class FFSCheckRowsEvent;
@@ -27,7 +27,7 @@ class SyncStatusHandler;
class PanelMoveWindow;
-namespace ffs3
+namespace zen
{
class CustomLocale;
class GridView;
@@ -46,6 +46,9 @@ public:
~MainDialog();
+ void disableAllElements(bool enableAbort); //dis-/enables all elements (except abort button) that might receive user input during long-running processes: comparison, deletion
+ void enableAllElements(); //
+
private:
friend class CompareStatusHandler;
friend class SyncStatusHandler;
@@ -88,7 +91,7 @@ private:
void addLeftFolderToHistory(const wxString& leftFolder);
void addRightFolderToHistory(const wxString& rightFolder);
- void addFolderPair(const std::vector<ffs3::FolderPairEnh>& newPairs, bool addFront = false);
+ void addFolderPair(const std::vector<zen::FolderPairEnh>& newPairs, bool addFront = false);
void removeAddFolderPair(size_t pos);
void clearAddFolderPairs();
@@ -101,10 +104,10 @@ private:
//context menu functions
std::set<size_t> getSelectedRows(const CustomGrid* grid) const;
std::set<size_t> getSelectedRows() const;
- void setSyncDirManually(const std::set<size_t>& rowsToSetOnUiTable, const ffs3::SyncDirection dir);
+ void setSyncDirManually(const std::set<size_t>& rowsToSetOnUiTable, const zen::SyncDirection dir);
void filterRangeManually(const std::set<size_t>& rowsToFilterOnUiTable, int leadingRow);
void copySelectionToClipboard(CustomGrid& selectedGrid);
- void deleteSelectedFiles();
+ void deleteSelectedFiles(const std::set<size_t>& viewSelectionLeft, const std::set<size_t>& viewSelectionRight);
void openExternalApplication(const wxString& commandline);
void openExternalApplication(size_t rowNumber, bool leftSide, const wxString& commandline);
@@ -116,9 +119,6 @@ private:
void pushStatusInformation(const wxString& text);
void clearStatusBar();
- void disableAllElements(); //dis-/enables all elements (except abort button) that might receive user input during long-running processes: comparison, deletion
- void enableAllElements(); //
-
//events
void onGridLeftButtonEvent( wxKeyEvent& event);
void onGridRightButtonEvent( wxKeyEvent& event);
@@ -135,7 +135,6 @@ private:
void OnContextFilterTemp (wxCommandEvent& event);
void OnContextExcludeExtension (wxCommandEvent& event);
void OnContextExcludeObject (wxCommandEvent& event);
- void OnContextCopyClipboard (wxCommandEvent& event);
void OnContextOpenWith (wxCommandEvent& event);
void OnContextDeleteFiles (wxCommandEvent& event);
void OnContextSyncDirLeft (wxCommandEvent& event);
@@ -194,6 +193,7 @@ private:
void refreshGridAfterFilterChange(const int delay);
void OnResize( wxSizeEvent& event);
+ //void OnResizeTopButtons( wxEvent& event);
void OnResizeFolderPairs( wxEvent& event);
void OnResizeConfigPanel( wxEvent& event);
void OnResizeViewPanel( wxEvent& event);
@@ -243,7 +243,7 @@ private:
xmlAccess::XmlGlobalSettings* globalSettings; //always bound
//UI view of FolderComparison structure
- std::auto_ptr<ffs3::GridView> gridDataView;
+ std::auto_ptr<zen::GridView> gridDataView;
//-------------------------------------
//functional configuration
diff --git a/ui/msg_popup.cpp b/ui/msg_popup.cpp
index 3dff49d2..7e35e19b 100644
--- a/ui/msg_popup.cpp
+++ b/ui/msg_popup.cpp
@@ -7,141 +7,200 @@
#include "msg_popup.h"
#include "../library/resources.h"
#include "../shared/mouse_move_dlg.h"
+#include "gui_generated.h"
-ErrorDlg::ErrorDlg(wxWindow* parentWindow, const int activeButtons, const wxString messageText, bool& ignoreNextErrors) :
+using namespace zen;
+
+
+class ErrorDlg : public ErrorDlgGenerated
+{
+public:
+ ErrorDlg(wxWindow* parentWindow, const int activeButtons, const wxString& messageText, bool& ignoreNextErrors);
+
+private:
+ void OnClose(wxCloseEvent& event);
+ void OnIgnore(wxCommandEvent& event);
+ void OnRetry(wxCommandEvent& event);
+ void OnAbort(wxCommandEvent& event);
+
+ bool& ignoreErrors;
+};
+
+
+ErrorDlg::ErrorDlg(wxWindow* parentWindow, const int activeButtons, const wxString& messageText, bool& ignoreNextErrors) :
ErrorDlgGenerated(parentWindow),
ignoreErrors(ignoreNextErrors)
{
#ifdef FFS_WIN
- new ffs3::MouseMoveWindow(*this, //allow moving main dialog by clicking (nearly) anywhere...
- this, m_bitmap10); //ownership passed to "this"
+ new zen::MouseMoveWindow(*this); //allow moving main dialog by clicking (nearly) anywhere...; ownership passed to "this"
#endif
m_bitmap10->SetBitmap(GlobalResources::instance().getImage(wxT("error")));
m_textCtrl8->SetValue(messageText);
m_checkBoxIgnoreErrors->SetValue(ignoreNextErrors);
- if (~activeButtons & BUTTON_IGNORE)
+ if (~activeButtons & ReturnErrorDlg::BUTTON_IGNORE)
{
m_buttonIgnore->Hide();
m_checkBoxIgnoreErrors->Hide();
}
- if (~activeButtons & BUTTON_RETRY)
+ if (~activeButtons & ReturnErrorDlg::BUTTON_RETRY)
m_buttonRetry->Hide();
- if (~activeButtons & BUTTON_ABORT)
+ if (~activeButtons & ReturnErrorDlg::BUTTON_ABORT)
m_buttonAbort->Hide();
//set button focus precedence
- if (activeButtons & BUTTON_RETRY)
+ if (activeButtons & ReturnErrorDlg::BUTTON_RETRY)
m_buttonRetry->SetFocus();
- else if (activeButtons & BUTTON_IGNORE)
+ else if (activeButtons & ReturnErrorDlg::BUTTON_IGNORE)
m_buttonIgnore->SetFocus();
- else if (activeButtons & BUTTON_ABORT)
+ else if (activeButtons & ReturnErrorDlg::BUTTON_ABORT)
m_buttonAbort->SetFocus();
}
void ErrorDlg::OnClose(wxCloseEvent& event)
{
- ignoreErrors = m_checkBoxIgnoreErrors->GetValue();
- EndModal(BUTTON_ABORT);
+ EndModal(ReturnErrorDlg::BUTTON_ABORT);
}
void ErrorDlg::OnIgnore(wxCommandEvent& event)
{
ignoreErrors = m_checkBoxIgnoreErrors->GetValue();
- EndModal(BUTTON_IGNORE);
+ EndModal(ReturnErrorDlg::BUTTON_IGNORE);
}
void ErrorDlg::OnRetry(wxCommandEvent& event)
{
ignoreErrors = m_checkBoxIgnoreErrors->GetValue();
- EndModal(BUTTON_RETRY);
+ EndModal(ReturnErrorDlg::BUTTON_RETRY);
}
void ErrorDlg::OnAbort(wxCommandEvent& event)
{
ignoreErrors = m_checkBoxIgnoreErrors->GetValue();
- EndModal(BUTTON_ABORT);
+ EndModal(ReturnErrorDlg::BUTTON_ABORT);
+}
+
+
+ReturnErrorDlg::ButtonPressed zen::showErrorDlg(int activeButtons, const wxString& messageText, bool& ignoreNextErrors)
+{
+ ErrorDlg errorDlg(NULL, activeButtons, messageText, ignoreNextErrors);
+ errorDlg.Raise();
+ return static_cast<ReturnErrorDlg::ButtonPressed>(errorDlg.ShowModal());
}
//########################################################################################
-WarningDlg::WarningDlg(wxWindow* parentWindow, int activeButtons, const wxString messageText, bool& dontShowDlgAgain) :
+class WarningDlg : public WarningDlgGenerated
+{
+public:
+ WarningDlg(wxWindow* parentWindow, int activeButtons, const wxString& messageText, bool& dontShowAgain);
+
+private:
+ void OnClose(wxCloseEvent& event);
+ void OnIgnore(wxCommandEvent& event);
+ void OnSwitch(wxCommandEvent& event);
+ void OnAbort(wxCommandEvent& event);
+ bool& dontShowAgain;
+};
+
+
+WarningDlg::WarningDlg(wxWindow* parentWindow, int activeButtons, const wxString& messageText, bool& dontShowDlgAgain) :
WarningDlgGenerated(parentWindow),
dontShowAgain(dontShowDlgAgain)
{
#ifdef FFS_WIN
- new ffs3::MouseMoveWindow(*this, //allow moving main dialog by clicking (nearly) anywhere...
- this, m_bitmap10); //ownership passed to "this"
+ new zen::MouseMoveWindow(*this); //allow moving main dialog by clicking (nearly) anywhere...; ownership passed to "this"
#endif
m_bitmap10->SetBitmap(GlobalResources::instance().getImage(wxT("warning")));
m_textCtrl8->SetValue(messageText);
m_checkBoxDontShowAgain->SetValue(dontShowAgain);
- if (~activeButtons & BUTTON_IGNORE)
+ if (~activeButtons & ReturnWarningDlg::BUTTON_IGNORE)
{
m_buttonIgnore->Hide();
m_checkBoxDontShowAgain->Hide();
}
- if (~activeButtons & BUTTON_SWITCH)
+ if (~activeButtons & ReturnWarningDlg::BUTTON_SWITCH)
m_buttonSwitch->Hide();
- if (~activeButtons & BUTTON_ABORT)
+ if (~activeButtons & ReturnWarningDlg::BUTTON_ABORT)
m_buttonAbort->Hide();
//set button focus precedence
- if (activeButtons & BUTTON_IGNORE)
+ if (activeButtons & ReturnWarningDlg::BUTTON_IGNORE)
m_buttonIgnore->SetFocus();
- else if (activeButtons & BUTTON_ABORT)
+ else if (activeButtons & ReturnWarningDlg::BUTTON_ABORT)
m_buttonAbort->SetFocus();
}
void WarningDlg::OnClose(wxCloseEvent& event)
{
- dontShowAgain = m_checkBoxDontShowAgain->GetValue();
- EndModal(BUTTON_ABORT);
+ EndModal(ReturnWarningDlg::BUTTON_ABORT);
}
void WarningDlg::OnIgnore(wxCommandEvent& event)
{
dontShowAgain = m_checkBoxDontShowAgain->GetValue();
- EndModal(BUTTON_IGNORE);
+ EndModal(ReturnWarningDlg::BUTTON_IGNORE);
}
void WarningDlg::OnSwitch(wxCommandEvent& event)
{
dontShowAgain = m_checkBoxDontShowAgain->GetValue();
- EndModal(BUTTON_SWITCH);
+ EndModal(ReturnWarningDlg::BUTTON_SWITCH);
}
void WarningDlg::OnAbort(wxCommandEvent& event)
{
dontShowAgain = m_checkBoxDontShowAgain->GetValue();
- EndModal(BUTTON_ABORT);
+ EndModal(ReturnWarningDlg::BUTTON_ABORT);
+}
+
+
+ReturnWarningDlg::ButtonPressed zen::showWarningDlg(int activeButtons, const wxString& messageText, bool& dontShowAgain)
+{
+ WarningDlg warningDlg(NULL, activeButtons, messageText, dontShowAgain);
+ warningDlg.Raise();
+ return static_cast<ReturnWarningDlg::ButtonPressed>(warningDlg.ShowModal());
}
//########################################################################################
-QuestionDlg::QuestionDlg(wxWindow* parentWindow, int activeButtons, const wxString messageText, bool* dontShowDlgAgain) :
+class QuestionDlg : public QuestionDlgGenerated
+{
+public:
+ QuestionDlg(wxWindow* parentWindow, int activeButtons, const wxString& messageText, bool* dontShowAgain = NULL);
+
+private:
+ void OnClose(wxCloseEvent& event);
+ void OnCancel(wxCommandEvent& event);
+ void OnYes(wxCommandEvent& event);
+ void OnNo(wxCommandEvent& event);
+
+ bool* dontShowAgain; //optional
+};
+
+
+QuestionDlg::QuestionDlg(wxWindow* parentWindow, int activeButtons, const wxString& messageText, bool* dontShowDlgAgain) :
QuestionDlgGenerated(parentWindow),
dontShowAgain(dontShowDlgAgain)
{
#ifdef FFS_WIN
- new ffs3::MouseMoveWindow(*this, //allow moving main dialog by clicking (nearly) anywhere...
- this, m_bitmap10); //ownership passed to "this"
+ new zen::MouseMoveWindow(*this); //allow moving main dialog by clicking (nearly) anywhere...; ownership passed to "this"
#endif
m_bitmap10->SetBitmap(GlobalResources::instance().getImage(wxT("question")));
@@ -151,41 +210,37 @@ QuestionDlg::QuestionDlg(wxWindow* parentWindow, int activeButtons, const wxStri
else
m_checkBoxDontAskAgain->Hide();
- if (~activeButtons & BUTTON_YES)
+ if (~activeButtons & ReturnQuestionDlg::BUTTON_YES)
m_buttonYes->Hide();
- if (~activeButtons & BUTTON_NO)
+ if (~activeButtons & ReturnQuestionDlg::BUTTON_NO)
{
m_buttonNo->Hide();
m_checkBoxDontAskAgain->Hide();
}
- if (~activeButtons & BUTTON_CANCEL)
+ if (~activeButtons & ReturnQuestionDlg::BUTTON_CANCEL)
m_buttonCancel->Hide();
//set button focus precedence
- if (activeButtons & BUTTON_YES)
+ if (activeButtons & ReturnQuestionDlg::BUTTON_YES)
m_buttonYes->SetFocus();
- else if (activeButtons & BUTTON_CANCEL)
+ else if (activeButtons & ReturnQuestionDlg::BUTTON_CANCEL)
m_buttonCancel->SetFocus();
- else if (activeButtons & BUTTON_NO)
+ else if (activeButtons & ReturnQuestionDlg::BUTTON_NO)
m_buttonNo->SetFocus();
}
void QuestionDlg::OnClose(wxCloseEvent& event)
{
- if (dontShowAgain)
- *dontShowAgain = m_checkBoxDontAskAgain->GetValue();
- EndModal(BUTTON_CANCEL);
+ EndModal(ReturnQuestionDlg::BUTTON_CANCEL);
}
void QuestionDlg::OnCancel(wxCommandEvent& event)
{
- if (dontShowAgain)
- *dontShowAgain = m_checkBoxDontAskAgain->GetValue();
- EndModal(BUTTON_CANCEL);
+ EndModal(ReturnQuestionDlg::BUTTON_CANCEL);
}
@@ -193,12 +248,20 @@ void QuestionDlg::OnYes(wxCommandEvent& event)
{
if (dontShowAgain)
*dontShowAgain = m_checkBoxDontAskAgain->GetValue();
- EndModal(BUTTON_YES);
+ EndModal(ReturnQuestionDlg::BUTTON_YES);
}
void QuestionDlg::OnNo(wxCommandEvent& event)
{
if (dontShowAgain)
*dontShowAgain = m_checkBoxDontAskAgain->GetValue();
- EndModal(BUTTON_NO);
+ EndModal(ReturnQuestionDlg::BUTTON_NO);
+}
+
+
+ReturnQuestionDlg::ButtonPressed zen::showQuestionDlg(int activeButtons, const wxString& messageText, bool* dontShowAgain)
+{
+ QuestionDlg qtnDlg(NULL, activeButtons, messageText, dontShowAgain);
+ qtnDlg.Raise();
+ return static_cast<ReturnQuestionDlg::ButtonPressed>(qtnDlg.ShowModal());
}
diff --git a/ui/msg_popup.h b/ui/msg_popup.h
index 44743c1b..f6c2e5d2 100644
--- a/ui/msg_popup.h
+++ b/ui/msg_popup.h
@@ -7,72 +7,46 @@
#ifndef MESSAGEPOPUP_H_INCLUDED
#define MESSAGEPOPUP_H_INCLUDED
-#include "gui_generated.h"
+#include <wx/string.h>
-class ErrorDlg : public ErrorDlgGenerated
+namespace zen
{
-public:
- ErrorDlg(wxWindow* parentWindow, const int activeButtons, const wxString messageText, bool& ignoreNextErrors);
-
- enum ReturnCodes
+struct ReturnErrorDlg
+{
+ enum ButtonPressed
{
BUTTON_IGNORE = 1,
BUTTON_RETRY = 2,
BUTTON_ABORT = 4
};
-
-private:
- void OnClose(wxCloseEvent& event);
- void OnIgnore(wxCommandEvent& event);
- void OnRetry(wxCommandEvent& event);
- void OnAbort(wxCommandEvent& event);
-
- bool& ignoreErrors;
};
+ReturnErrorDlg::ButtonPressed showErrorDlg(int activeButtons, const wxString& messageText, bool& ignoreNextErrors);
-class WarningDlg : public WarningDlgGenerated
+struct ReturnWarningDlg
{
-public:
- WarningDlg(wxWindow* parentWindow, int activeButtons, const wxString messageText, bool& dontShowAgain);
-
- enum Response
+ enum ButtonPressed
{
BUTTON_IGNORE = 1,
BUTTON_SWITCH = 2,
BUTTON_ABORT = 4
};
-
-private:
- void OnClose(wxCloseEvent& event);
- void OnIgnore(wxCommandEvent& event);
- void OnSwitch(wxCommandEvent& event);
- void OnAbort(wxCommandEvent& event);
- bool& dontShowAgain;
};
+ReturnWarningDlg::ButtonPressed showWarningDlg(int activeButtons, const wxString& messageText, bool& dontShowAgain);
-class QuestionDlg : public QuestionDlgGenerated
+struct ReturnQuestionDlg
{
-public:
- QuestionDlg(wxWindow* parentWindow, int activeButtons, const wxString messageText, bool* dontShowAgain = NULL);
-
- enum
+ enum ButtonPressed
{
BUTTON_YES = 1,
BUTTON_NO = 2,
BUTTON_CANCEL = 4
};
-
-private:
- void OnClose(wxCloseEvent& event);
- void OnCancel(wxCommandEvent& event);
- void OnYes(wxCommandEvent& event);
- void OnNo(wxCommandEvent& event);
-
- bool* dontShowAgain; //optional
};
+ReturnQuestionDlg::ButtonPressed showQuestionDlg(int activeButtons, const wxString& messageText, bool* dontShowAgain = NULL);
+}
#endif // MESSAGEPOPUP_H_INCLUDED
diff --git a/ui/progress_indicator.cpp b/ui/progress_indicator.cpp
index aa25d07a..f71abab4 100644
--- a/ui/progress_indicator.cpp
+++ b/ui/progress_indicator.cpp
@@ -24,11 +24,13 @@
#include "../shared/taskbar.h"
#endif
-using namespace ffs3;
+using namespace zen;
namespace
{
+const int GAUGE_FULL_RANGE = 50000;
+
//window size used for statistics in milliseconds
const int windowSizeRemainingTime = 60000; //some usecases have dropouts of 40 seconds -> 60 sec. window size handles them well
const int windowSizeBytesPerSec = 5000; //
@@ -62,9 +64,9 @@ public:
void init(); //make visible, initialize all status values
void finalize(); //hide again
- void switchToCompareBytewise(int totalObjectsToProcess, wxLongLong totalDataToProcess);
+ void switchToCompareBytewise(int totalObjectsToProcess, zen::Int64 totalDataToProcess);
void incScannedObjects_NoUpdate(int number);
- void incProcessedCmpData_NoUpdate(int objectsProcessed, wxLongLong dataProcessed);
+ void incProcessedCmpData_NoUpdate(int objectsProcessed, zen::Int64 dataProcessed);
void setStatusText_NoUpdate(const Zstring& text);
void updateStatusPanelNow();
@@ -79,11 +81,11 @@ private:
wxStopWatch timeElapsed;
//gauge variables
- int totalObjects;
- wxLongLong totalData; //each data element represents one byte for proper progress indicator scaling
- int currentObjects; //each object represents a file or directory processed
- wxLongLong currentData;
- double scalingFactor; //nr of elements has to be normalized to smaller nr. because of range of int limitation
+ int totalObjects;
+ zen::Int64 totalData; //each data element represents one byte for proper progress indicator scaling
+ int currentObjects; //each object represents a file or directory processed
+ zen::Int64 currentData;
+ double scalingFactor; //nr of elements has to be normalized to smaller nr. because of range of int limitation
void showProgressExternally(const wxString& progressText, float percent = 0);
@@ -129,7 +131,7 @@ void CompareStatus::finalize()
pimpl->finalize();
}
-void CompareStatus::switchToCompareBytewise(int totalObjectsToProcess, wxLongLong totalDataToProcess)
+void CompareStatus::switchToCompareBytewise(int totalObjectsToProcess, zen::Int64 totalDataToProcess)
{
pimpl->switchToCompareBytewise(totalObjectsToProcess, totalDataToProcess);
}
@@ -139,7 +141,7 @@ void CompareStatus::incScannedObjects_NoUpdate(int number)
pimpl->incScannedObjects_NoUpdate(number);
}
-void CompareStatus::incProcessedCmpData_NoUpdate(int objectsProcessed, wxLongLong dataProcessed)
+void CompareStatus::incProcessedCmpData_NoUpdate(int objectsProcessed, zen::Int64 dataProcessed)
{
pimpl->incProcessedCmpData_NoUpdate(objectsProcessed, dataProcessed);
}
@@ -188,7 +190,7 @@ void CompareStatus::CompareStatusImpl::init()
status = SCANNING;
//initialize gauge
- m_gauge2->SetRange(50000);
+ m_gauge2->SetRange(GAUGE_FULL_RANGE);
m_gauge2->SetValue(0);
//initially hide status that's relevant for comparing bytewise only
@@ -229,7 +231,7 @@ void CompareStatus::CompareStatusImpl::finalize() //hide again
}
-void CompareStatus::CompareStatusImpl::switchToCompareBytewise(int totalObjectsToProcess, wxLongLong totalDataToProcess)
+void CompareStatus::CompareStatusImpl::switchToCompareBytewise(int totalObjectsToProcess, zen::Int64 totalDataToProcess)
{
status = COMPARING_CONTENT;
@@ -240,12 +242,12 @@ void CompareStatus::CompareStatusImpl::switchToCompareBytewise(int totalObjectsT
totalObjects = totalObjectsToProcess;
if (totalData != 0)
- scalingFactor = 50000 / totalData.ToDouble(); //let's normalize to 50000
+ scalingFactor = GAUGE_FULL_RANGE / to<double>(totalData); //let's normalize to 50000
else
scalingFactor = 0;
//set new statistics handler: 10 seconds "window" for remaining time, 5 seconds for speed
- statistics.reset(new Statistics(totalObjectsToProcess, totalDataToProcess.ToDouble(), windowSizeRemainingTime, windowSizeBytesPerSec));
+ statistics.reset(new Statistics(totalObjectsToProcess, to<double>(totalDataToProcess), windowSizeRemainingTime, windowSizeBytesPerSec));
lastStatCallSpeed = -1000000; //some big number
lastStatCallRemTime = -1000000;
@@ -267,7 +269,7 @@ void CompareStatus::CompareStatusImpl::incScannedObjects_NoUpdate(int number)
}
-void CompareStatus::CompareStatusImpl::incProcessedCmpData_NoUpdate(int objectsProcessed, wxLongLong dataProcessed)
+void CompareStatus::CompareStatusImpl::incProcessedCmpData_NoUpdate(int objectsProcessed, zen::Int64 dataProcessed)
{
currentData += dataProcessed;
currentObjects += objectsProcessed;
@@ -315,13 +317,13 @@ void CompareStatus::CompareStatusImpl::updateStatusPanelNow()
{
//wxWindowUpdateLocker dummy(this) -> not needed
- const float percent = totalData == 0 ? 0 : currentData.ToDouble() * 100 / totalData.ToDouble();
+ const float percent = totalData == 0 ? 0 : to<double>(currentData) * 100.0 / to<double>(totalData);
//write status information to taskbar, parent title ect.
switch (status)
{
case SCANNING:
- showProgressExternally(numberToStringSep(scannedObjects) + wxT(" - ") + _("Scanning..."));
+ showProgressExternally(toStringSep(scannedObjects) + wxT(" - ") + _("Scanning..."));
break;
case COMPARING_CONTENT:
showProgressExternally(formatPercentage(currentData, totalData) + wxT(" - ") + _("Comparing content..."), percent);
@@ -342,17 +344,17 @@ void CompareStatus::CompareStatusImpl::updateStatusPanelNow()
m_textCtrlStatus->ChangeValue(formattedStatusText);
//nr of scanned objects
- setNewText(numberToStringSep(scannedObjects), *m_staticTextScanned, updateLayout);
+ setNewText(toStringSep(scannedObjects), *m_staticTextScanned, updateLayout);
//progress indicator for "compare file content"
- m_gauge2->SetValue(int(currentData.ToDouble() * scalingFactor));
+ m_gauge2->SetValue(to<double>(currentData) * scalingFactor);
//remaining files left for file comparison
- const wxString filesToCompareTmp = numberToStringSep(totalObjects - currentObjects);
+ const wxString filesToCompareTmp = toStringSep(totalObjects - currentObjects);
setNewText(filesToCompareTmp, *m_staticTextFilesRemaining, updateLayout);
//remaining bytes left for file comparison
- const wxString remainingBytesTmp = ffs3::formatFilesizeToShortString(totalData - currentData);
+ const wxString remainingBytesTmp = zen::formatFilesizeToShortString(to<zen::UInt64>(totalData - currentData));
setNewText(remainingBytesTmp, *m_staticTextDataRemaining, updateLayout);
if (statistics.get())
@@ -361,7 +363,7 @@ void CompareStatus::CompareStatusImpl::updateStatusPanelNow()
{
lastStatCallSpeed = timeElapsed.Time();
- statistics->addMeasurement(currentObjects, currentData.ToDouble());
+ statistics->addMeasurement(currentObjects, to<double>(currentData));
//current speed
setNewText(statistics->getBytesPerSecond(), *m_staticTextSpeed, updateLayout);
@@ -480,11 +482,11 @@ private:
class SyncStatus::SyncStatusImpl : public SyncStatusDlgGenerated
{
public:
- SyncStatusImpl(StatusHandler& updater, wxTopLevelWindow* parentWindow, const wxString& jobName);
+ SyncStatusImpl(AbortCallback& abortCb, MainDialog* parentWindow, const wxString& jobName);
~SyncStatusImpl();
- void resetGauge(int totalObjectsToProcess, wxLongLong totalDataToProcess);
- void incProgressIndicator_NoUpdate(int objectsProcessed, wxLongLong dataProcessed);
+ void resetGauge(int totalObjectsToProcess, zen::Int64 totalDataToProcess);
+ void incProgressIndicator_NoUpdate(int objectsProcessed, zen::Int64 dataProcessed);
void incScannedObjects_NoUpdate(int number);
void setStatusText_NoUpdate(const Zstring& text);
void updateStatusDialogNow();
@@ -509,14 +511,14 @@ private:
const wxString jobName_;
wxStopWatch timeElapsed;
- StatusHandler* processStatusHandler;
- wxTopLevelWindow* mainDialog;
+ AbortCallback* abortCb_; //temporarily bound
+ MainDialog* mainDialog; //optional
//gauge variables
int totalObjects;
- wxLongLong totalData;
+ zen::Int64 totalData;
int currentObjects; //each object represents a file or directory processed
- wxLongLong currentData; //each data element represents one byte for proper progress indicator scaling
+ zen::Int64 currentData; //each data element represents one byte for proper progress indicator scaling
double scalingFactor; //nr of elements has to be normalized to smaller nr. because of range of int limitation
//status variables
@@ -546,8 +548,8 @@ private:
//redirect to implementation
-SyncStatus::SyncStatus(StatusHandler& updater, wxTopLevelWindow* parentWindow, bool startSilent, const wxString& jobName) :
- pimpl(new SyncStatusImpl(updater, parentWindow, jobName))
+SyncStatus::SyncStatus(AbortCallback& abortCb, MainDialog* parentWindow, bool startSilent, const wxString& jobName) :
+ pimpl(new SyncStatusImpl(abortCb, parentWindow, jobName))
{
if (startSilent)
pimpl->minimizeToTray();
@@ -573,7 +575,7 @@ void SyncStatus::closeWindowDirectly() //don't wait for user (silent mode)
pimpl->Destroy();
}
-void SyncStatus::resetGauge(int totalObjectsToProcess, wxLongLong totalDataToProcess)
+void SyncStatus::resetGauge(int totalObjectsToProcess, zen::Int64 totalDataToProcess)
{
pimpl->resetGauge(totalObjectsToProcess, totalDataToProcess);
}
@@ -583,7 +585,7 @@ void SyncStatus::incScannedObjects_NoUpdate(int number)
pimpl->incScannedObjects_NoUpdate(number);
}
-void SyncStatus::incProgressIndicator_NoUpdate(int objectsProcessed, wxLongLong dataProcessed)
+void SyncStatus::incProgressIndicator_NoUpdate(int objectsProcessed, zen::Int64 dataProcessed)
{
pimpl->incProgressIndicator_NoUpdate(objectsProcessed, dataProcessed);
}
@@ -610,7 +612,7 @@ void SyncStatus::processHasFinished(SyncStatusID id, const ErrorLogging& log)
//########################################################################################
-SyncStatus::SyncStatusImpl::SyncStatusImpl(StatusHandler& updater, wxTopLevelWindow* parentWindow, const wxString& jobName) :
+SyncStatus::SyncStatusImpl::SyncStatusImpl(AbortCallback& abortCb, MainDialog* parentWindow, const wxString& jobName) :
SyncStatusDlgGenerated(parentWindow,
wxID_ANY,
parentWindow ? wxString(wxEmptyString) : (wxString(wxT("FreeFileSync - ")) + _("Folder Comparison and Synchronization")),
@@ -619,7 +621,7 @@ SyncStatus::SyncStatusImpl::SyncStatusImpl(StatusHandler& updater, wxTopLevelWin
wxDEFAULT_FRAME_STYLE | wxTAB_TRAVERSAL | wxFRAME_NO_TASKBAR | wxFRAME_FLOAT_ON_PARENT : //wxTAB_TRAVERSAL is needed for standard button handling: wxID_OK/wxID_CANCEL
wxDEFAULT_FRAME_STYLE | wxTAB_TRAVERSAL),
jobName_(jobName),
- processStatusHandler(&updater),
+ abortCb_(&abortCb),
mainDialog(parentWindow),
totalObjects(0),
totalData(0),
@@ -634,8 +636,7 @@ SyncStatus::SyncStatusImpl::SyncStatusImpl(StatusHandler& updater, wxTopLevelWin
progressPercentLast(0)
{
#ifdef FFS_WIN
- new ffs3::MouseMoveWindow(*this, //allow moving main dialog by clicking (nearly) anywhere...
- this, m_bitmapStatus, m_staticTextStatus); //ownership passed to "this"
+ new zen::MouseMoveWindow(*this); //allow moving main dialog by clicking (nearly) anywhere...; ownership passed to "this"
#endif
if (mainDialog) //save old title (will be used as progress indicator)
@@ -648,21 +649,24 @@ SyncStatus::SyncStatusImpl::SyncStatusImpl(StatusHandler& updater, wxTopLevelWin
m_staticTextTimeRemaining->SetLabel(wxT("-"));
//initialize gauge
- m_gauge1->SetRange(50000);
+ m_gauge1->SetRange(GAUGE_FULL_RANGE);
m_gauge1->SetValue(0);
if (IsShown()) //don't steal focus when starting in sys-tray!
m_buttonAbort->SetFocus();
if (mainDialog)
- mainDialog->Disable();
+ {
+ mainDialog->EnableCloseButton(false);
+ mainDialog->disableAllElements(false); //disable all child elements
+ }
timeElapsed.Start(); //measure total time
#ifdef FFS_WIN
try //try to get access to Windows 7 Taskbar
{
- taskbar_.reset(new util::TaskbarProgress(mainDialog != NULL ? *mainDialog : *this));
+ taskbar_.reset(new util::TaskbarProgress(mainDialog != NULL ? *static_cast<wxTopLevelWindow*>(mainDialog) : *this));
}
catch (const util::TaskbarNotAvailable&) {}
#endif
@@ -682,10 +686,12 @@ SyncStatus::SyncStatusImpl::~SyncStatusImpl()
{
if (mainDialog)
{
+ mainDialog->EnableCloseButton(true);
+ mainDialog->enableAllElements();
+
//restore title text
mainDialog->SetTitle(titelTextBackup);
- mainDialog->Enable();
mainDialog->Raise();
mainDialog->SetFocus();
}
@@ -705,7 +711,7 @@ void SyncStatus::SyncStatusImpl::OnKeyPressed(wxKeyEvent& event)
}
-void SyncStatus::SyncStatusImpl::resetGauge(int totalObjectsToProcess, wxLongLong totalDataToProcess)
+void SyncStatus::SyncStatusImpl::resetGauge(int totalObjectsToProcess, zen::Int64 totalDataToProcess)
{
currentData = 0;
totalData = totalDataToProcess;
@@ -714,19 +720,21 @@ void SyncStatus::SyncStatusImpl::resetGauge(int totalObjectsToProcess, wxLongLon
totalObjects = totalObjectsToProcess;
if (totalData != 0)
- scalingFactor = 50000 / totalData.ToDouble(); //let's normalize to 50000
+ scalingFactor = GAUGE_FULL_RANGE / to<double>(totalData); //let's normalize to 50000
else
scalingFactor = 0;
//set new statistics handler: 10 seconds "window" for remaining time, 5 seconds for speed
- statistics.reset(new Statistics(totalObjectsToProcess, totalDataToProcess.ToDouble(), windowSizeRemainingTime, windowSizeBytesPerSec));
+ statistics.reset(new Statistics(totalObjectsToProcess, to<double>(totalDataToProcess), windowSizeRemainingTime, windowSizeBytesPerSec));
lastStatCallSpeed = -1000000; //some big number
lastStatCallRemTime = -1000000;
+
+ m_gauge1->SetValue(totalDataToProcess == 0 ? GAUGE_FULL_RANGE : 0); //explicitly reset and end "pending" state (if not data will be synced)
}
-void SyncStatus::SyncStatusImpl::incProgressIndicator_NoUpdate(int objectsProcessed, wxLongLong dataProcessed)
+void SyncStatus::SyncStatusImpl::incProgressIndicator_NoUpdate(int objectsProcessed, zen::Int64 dataProcessed)
{
//assert(dataProcessed >= 0);
@@ -812,7 +820,7 @@ void SyncStatus::SyncStatusImpl::updateStatusDialogNow()
//static RetrieveStatistics statistic;
//statistic.writeEntry(currentData.ToDouble(), currentObjects);
- const float percent = totalData == 0 ? 0 : currentData.ToDouble() * 100 / totalData.ToDouble();
+ const float percent = totalData == 0 ? 0 : to<double>(currentData) * 100.0 / to<double>(totalData);
//write status information to systray, taskbar, parent title ect.
@@ -820,7 +828,7 @@ void SyncStatus::SyncStatusImpl::updateStatusDialogNow()
switch (currentStatus)
{
case SyncStatus::SCANNING:
- showProgressExternally(numberToStringSep(scannedObjects) + wxT(" - ") + _("Scanning...") + postFix);
+ showProgressExternally(toStringSep(scannedObjects) + wxT(" - ") + _("Scanning...") + postFix);
break;
case SyncStatus::COMPARING_CONTENT:
showProgressExternally(formatPercentage(currentData, totalData) + wxT(" - ") + _("Comparing content...") + postFix, percent);
@@ -850,7 +858,7 @@ void SyncStatus::SyncStatusImpl::updateStatusDialogNow()
if (currentStatus == SyncStatus::SCANNING)
m_gauge1->Pulse();
else
- m_gauge1->SetValue(common::round(currentData.ToDouble() * scalingFactor));
+ m_gauge1->SetValue(common::round(to<double>(currentData) * scalingFactor));
//status text
const wxString statusTxt = zToWx(currentStatusText);
@@ -858,11 +866,11 @@ void SyncStatus::SyncStatusImpl::updateStatusDialogNow()
m_textCtrlInfo->ChangeValue(statusTxt);
//remaining objects
- const wxString remainingObjTmp = numberToStringSep(totalObjects - currentObjects);
+ const wxString remainingObjTmp = toStringSep(totalObjects - currentObjects);
setNewText(remainingObjTmp, *m_staticTextRemainingObj, updateLayout);
//remaining bytes left for copy
- const wxString remainingBytesTmp = ffs3::formatFilesizeToShortString(totalData - currentData);
+ const wxString remainingBytesTmp = zen::formatFilesizeToShortString(to<zen::UInt64>(totalData - currentData));
setNewText(remainingBytesTmp, *m_staticTextDataRemaining, updateLayout);
if (statistics.get())
@@ -871,7 +879,7 @@ void SyncStatus::SyncStatusImpl::updateStatusDialogNow()
{
lastStatCallSpeed = timeElapsed.Time();
- statistics->addMeasurement(currentObjects, currentData.ToDouble());
+ statistics->addMeasurement(currentObjects, to<double>(currentData));
//current speed
setNewText(statistics->getBytesPerSecond(), *m_staticTextSpeed, updateLayout);
@@ -923,7 +931,7 @@ void SyncStatus::SyncStatusImpl::updateStatusDialogNow()
bool SyncStatus::SyncStatusImpl::currentProcessIsRunning()
{
- return processStatusHandler != NULL;
+ return abortCb_ != NULL;
}
@@ -977,7 +985,7 @@ void SyncStatus::SyncStatusImpl::processHasFinished(SyncStatus::SyncStatusID id,
//at the LATEST(!) to prevent access to currentStatusHandler
//enable okay and close events; may be set in this method ONLY
- processStatusHandler = NULL; //avoid callback to (maybe) deleted parent process
+ abortCb_ = NULL; //avoid callback to (maybe) deleted parent process
setCurrentStatus(id);
@@ -1008,8 +1016,8 @@ void SyncStatus::SyncStatusImpl::processHasFinished(SyncStatus::SyncStatusID id,
bSizerObjectsProcessed->Show(true);
- m_staticTextProcessedObj->SetLabel(numberToStringSep(currentObjects));
- m_staticTextDataProcessed->SetLabel(ffs3::formatFilesizeToShortString(currentData));
+ m_staticTextProcessedObj->SetLabel(toStringSep(currentObjects));
+ m_staticTextDataProcessed->SetLabel(zen::formatFilesizeToShortString(to<zen::UInt64>(currentData)));
}
updateStatusDialogNow(); //keep this sequence to avoid display distortion, if e.g. only 1 item is sync'ed
@@ -1044,7 +1052,7 @@ void SyncStatus::SyncStatusImpl::OnAbort(wxCommandEvent& event)
setStatusText_NoUpdate(wxToZ(_("Abort requested: Waiting for current operation to finish...")));
//no Layout() or UI-update here to avoid cascaded Yield()-call
- processStatusHandler->requestAbortion();
+ abortCb_->requestAbortion();
}
}
diff --git a/ui/progress_indicator.h b/ui/progress_indicator.h
index 4bf0c048..34e2c1a5 100644
--- a/ui/progress_indicator.h
+++ b/ui/progress_indicator.h
@@ -10,8 +10,9 @@
#include "../shared/zstring.h"
#include <wx/toplevel.h>
#include "../library/status_handler.h"
+#include "main_dlg.h"
-namespace ffs3
+namespace zen
{
class ErrorLogging;
}
@@ -28,9 +29,9 @@ public:
void init(); //make visible, initialize all status values
void finalize(); //hide again
- void switchToCompareBytewise(int totalObjectsToProcess, wxLongLong totalDataToProcess);
+ void switchToCompareBytewise(int totalObjectsToProcess, zen::Int64 totalDataToProcess);
void incScannedObjects_NoUpdate(int number);
- void incProcessedCmpData_NoUpdate(int objectsProcessed, wxLongLong dataProcessed);
+ void incProcessedCmpData_NoUpdate(int objectsProcessed, zen::Int64 dataProcessed);
void setStatusText_NoUpdate(const Zstring& text);
void updateStatusPanelNow();
@@ -43,8 +44,8 @@ private:
class SyncStatus
{
public:
- SyncStatus(StatusHandler& updater,
- wxTopLevelWindow* parentWindow, //may be NULL
+ SyncStatus(AbortCallback& abortCb,
+ MainDialog* parentWindow, //may be NULL
bool startSilent,
const wxString& jobName);
~SyncStatus();
@@ -62,9 +63,9 @@ public:
SYNCHRONIZING
};
- void resetGauge(int totalObjectsToProcess, wxLongLong totalDataToProcess);
+ void resetGauge(int totalObjectsToProcess, zen::Int64 totalDataToProcess);
void incScannedObjects_NoUpdate(int number);
- void incProgressIndicator_NoUpdate(int objectsProcessed, wxLongLong dataProcessed);
+ void incProgressIndicator_NoUpdate(int objectsProcessed, zen::Int64 dataProcessed);
void setStatusText_NoUpdate(const Zstring& text);
void updateStatusDialogNow();
@@ -72,7 +73,7 @@ public:
//essential to call one of these two methods in StatusUpdater derived class destructor at the LATEST(!)
//to prevent access to callback to updater (e.g. request abort)
- void processHasFinished(SyncStatusID id, const ffs3::ErrorLogging& log);
+ void processHasFinished(SyncStatusID id, const zen::ErrorLogging& log);
void closeWindowDirectly(); //don't wait for user
private:
diff --git a/ui/search.cpp b/ui/search.cpp
index e6fa4255..7fdaec03 100644
--- a/ui/search.cpp
+++ b/ui/search.cpp
@@ -39,8 +39,7 @@ SearchDlg::SearchDlg(wxWindow& parentWindow, wxString& searchText, bool& respect
respectCase_(respectCase)
{
#ifdef FFS_WIN
- new ffs3::MouseMoveWindow(*this, //allow moving main dialog by clicking (nearly) anywhere...
- this); //ownership passed to "this"
+ new zen::MouseMoveWindow(*this); //allow moving main dialog by clicking (nearly) anywhere...; ownership passed to "this"
#endif
m_checkBoxMatchCase->SetValue(respectCase_);
@@ -265,13 +264,13 @@ void executeSearch(bool forceShowDialog,
//###########################################################################################
-void ffs3::startFind(wxWindow& parentWindow, wxGrid& leftGrid, wxGrid& rightGrid, bool& respectCase) //Strg + F
+void zen::startFind(wxWindow& parentWindow, wxGrid& leftGrid, wxGrid& rightGrid, bool& respectCase) //Strg + F
{
executeSearch(true, respectCase, parentWindow, leftGrid, rightGrid);
}
-void ffs3::findNext(wxWindow& parentWindow, wxGrid& leftGrid, wxGrid& rightGrid, bool& respectCase) //F3
+void zen::findNext(wxWindow& parentWindow, wxGrid& leftGrid, wxGrid& rightGrid, bool& respectCase) //F3
{
executeSearch(false, respectCase, parentWindow, leftGrid, rightGrid);
}
diff --git a/ui/search.h b/ui/search.h
index 4b1c0a81..ce7e479a 100644
--- a/ui/search.h
+++ b/ui/search.h
@@ -11,7 +11,7 @@ class wxGrid;
class wxWindow;
-namespace ffs3
+namespace zen
{
void startFind(wxWindow& parentWindow, wxGrid& leftGrid, wxGrid& rightGrid, bool& respectCase); //Strg + F
void findNext( wxWindow& parentWindow, wxGrid& leftGrid, wxGrid& rightGrid, bool& respectCase); //F3
diff --git a/ui/small_dlgs.cpp b/ui/small_dlgs.cpp
index 58eac33f..cb81431b 100644
--- a/ui/small_dlgs.cpp
+++ b/ui/small_dlgs.cpp
@@ -21,13 +21,13 @@
#include <wx/msgdlg.h>
#include "../shared/mouse_move_dlg.h"
-using namespace ffs3;
+using namespace zen;
class AboutDlg : public AboutDlgGenerated
{
public:
- AboutDlg(wxWindow* window);
+ AboutDlg(wxWindow* parent);
private:
void OnClose(wxCloseEvent& event);
@@ -35,14 +35,8 @@ private:
};
-AboutDlg::AboutDlg(wxWindow* window) : AboutDlgGenerated(window)
+AboutDlg::AboutDlg(wxWindow* parent) : AboutDlgGenerated(parent)
{
-#ifdef FFS_WIN
- new MouseMoveWindow(*this, //allow moving main dialog by clicking (nearly) anywhere...
- this,
- m_bitmap11); //ownership passed to "this"
-#endif
-
m_bitmap9->SetBitmap(GlobalResources::instance().getImage(wxT("website")));
m_bitmap10->SetBitmap(GlobalResources::instance().getImage(wxT("email")));
m_bitmap11->SetBitmap(GlobalResources::instance().getImage(wxT("logo")));
@@ -50,7 +44,7 @@ AboutDlg::AboutDlg(wxWindow* window) : AboutDlgGenerated(window)
m_bitmapTransl->SetBitmap(GlobalResources::instance().getImage(wxT("translation")));
//create language credits
- for (std::vector<LocInfoLine>::const_iterator i = LocalizationInfo::get().begin(); i != LocalizationInfo::get().end(); ++i)
+ for (std::vector<ExistingTranslations::Entry>::const_iterator i = ExistingTranslations::get().begin(); i != ExistingTranslations::get().end(); ++i)
{
//flag
wxStaticBitmap* staticBitmapFlag = new wxStaticBitmap(m_scrolledWindowTranslators, wxID_ANY, GlobalResources::instance().getImage(i->languageFlag), wxDefaultPosition, wxSize(-1,11), 0 );
@@ -95,6 +89,10 @@ AboutDlg::AboutDlg(wxWindow* window) : AboutDlgGenerated(window)
m_buttonOkay->SetFocus();
Fit();
+
+#ifdef FFS_WIN
+ new zen::MouseMoveWindow(*this); //allow moving main dialog by clicking (nearly) anywhere...; ownership passed to "this"
+#endif
}
@@ -110,7 +108,7 @@ void AboutDlg::OnOK(wxCommandEvent& event)
}
-void ffs3::showAboutDialog()
+void zen::showAboutDialog()
{
AboutDlg aboutDlg(NULL);
aboutDlg.ShowModal();
@@ -121,7 +119,7 @@ void ffs3::showAboutDialog()
class HelpDlg : public HelpDlgGenerated
{
public:
- HelpDlg(wxWindow* window);
+ HelpDlg(wxWindow* parent);
private:
void OnClose(wxCloseEvent& event);
@@ -129,11 +127,10 @@ private:
};
-HelpDlg::HelpDlg(wxWindow* window) : HelpDlgGenerated(window)
+HelpDlg::HelpDlg(wxWindow* parent) : HelpDlgGenerated(parent)
{
#ifdef FFS_WIN
- new MouseMoveWindow(*this, //allow moving main dialog by clicking (nearly) anywhere...
- this, m_bitmap25, m_staticText56, m_scrolledWindow1, m_scrolledWindow5); //ownership passed to "this"
+ new zen::MouseMoveWindow(*this); //allow moving main dialog by clicking (nearly) anywhere...; ownership passed to "this"
#endif
m_notebook1->SetFocus();
@@ -145,15 +142,17 @@ HelpDlg::HelpDlg(wxWindow* window) : HelpDlgGenerated(window)
wxTreeItemId treeBothSides = m_treeCtrl1->AppendItem(treeRoot, _("file exists on both sides"));
wxTreeItemId treeOneSide = m_treeCtrl1->AppendItem(treeRoot, _("on one side only"));
- m_treeCtrl1->AppendItem(treeOneSide, _("- left"));
- m_treeCtrl1->AppendItem(treeOneSide, _("- right"));
+ m_treeCtrl1->AppendItem(treeOneSide, _("- exists left only"));
+ m_treeCtrl1->AppendItem(treeOneSide, _("- exists right only"));
+
+ wxTreeItemId treeSameDate = m_treeCtrl1->AppendItem(treeBothSides, _("same date"));
+ m_treeCtrl1->AppendItem(treeSameDate, _("- equal"));
+ m_treeCtrl1->AppendItem(treeSameDate, _("- conflict (same date, different size)"));
- m_treeCtrl1->AppendItem(treeBothSides, _("- equal"));
- wxTreeItemId treeDifferent = m_treeCtrl1->AppendItem(treeBothSides, _("different"));
- m_treeCtrl1->AppendItem(treeDifferent, _("- left newer"));
- m_treeCtrl1->AppendItem(treeDifferent, _("- right newer"));
- m_treeCtrl1->AppendItem(treeDifferent, _("- conflict (same date, different size)"));
+ wxTreeItemId treeDifferentDate = m_treeCtrl1->AppendItem(treeBothSides, _("different date"));
+ m_treeCtrl1->AppendItem(treeDifferentDate, _("- left newer"));
+ m_treeCtrl1->AppendItem(treeDifferentDate, _("- right newer"));
m_treeCtrl1->ExpandAll();
@@ -162,8 +161,8 @@ HelpDlg::HelpDlg(wxWindow* window) : HelpDlgGenerated(window)
wxTreeItemId tree2BothSides = m_treeCtrl2->AppendItem(tree2Root, _("file exists on both sides"));
wxTreeItemId tree2OneSide = m_treeCtrl2->AppendItem(tree2Root, _("on one side only"));
- m_treeCtrl2->AppendItem(tree2OneSide, _("- left"));
- m_treeCtrl2->AppendItem(tree2OneSide, _("- right"));
+ m_treeCtrl2->AppendItem(tree2OneSide, _("- exists left only"));
+ m_treeCtrl2->AppendItem(tree2OneSide, _("- exists right only"));
m_treeCtrl2->AppendItem(tree2BothSides, _("- equal"));
m_treeCtrl2->AppendItem(tree2BothSides, _("- different"));
@@ -184,7 +183,7 @@ void HelpDlg::OnOK(wxCommandEvent& event)
}
-void ffs3::showHelpDialog()
+void zen::showHelpDialog()
{
HelpDlg helpDlg(NULL);
helpDlg.ShowModal();
@@ -195,51 +194,60 @@ void ffs3::showHelpDialog()
class FilterDlg : public FilterDlgGenerated
{
public:
- FilterDlg(wxWindow* window,
+ FilterDlg(wxWindow* parent,
bool isGlobalFilter,
- Zstring& filterIncl,
- Zstring& filterExcl);
+ FilterConfig& filter);
~FilterDlg() {}
- enum
- {
- BUTTON_APPLY = 1
- };
-
private:
- void OnHelp(wxCommandEvent& event);
- void OnDefault(wxCommandEvent& event);
- void OnApply(wxCommandEvent& event);
- void OnCancel(wxCommandEvent& event);
- void OnClose(wxCloseEvent& event);
+ void OnClose (wxCloseEvent& event);
+ void OnHelp (wxCommandEvent& event);
+ void OnDefault (wxCommandEvent& event);
+ void OnApply (wxCommandEvent& event);
+ void OnCancel (wxCommandEvent& event);
+ void OnUpdateChoice(wxCommandEvent& event) { updateGui(); }
+ void OnUpdateNameFilter(wxCommandEvent& event) { updateGui(); }
+
+ void updateGui();
+ void setFilter(const FilterConfig& filter);
+ FilterConfig getFilter() const;
const bool isGlobalFilter_;
- Zstring& includeFilter;
- Zstring& excludeFilter;
+ FilterConfig& outputRef;
+
+ EnumDescrList<UnitTime> enumTimeDescr;
+ EnumDescrList<UnitSize> enumSizeDescr;
};
-FilterDlg::FilterDlg(wxWindow* window,
+FilterDlg::FilterDlg(wxWindow* parent,
bool isGlobalFilter, //global or local filter dialog?
- Zstring& filterIncl,
- Zstring& filterExcl) :
- FilterDlgGenerated(window),
+ FilterConfig& filter) :
+ FilterDlgGenerated(parent),
isGlobalFilter_(isGlobalFilter),
- includeFilter(filterIncl),
- excludeFilter(filterExcl)
+ outputRef(filter) //just hold reference
{
#ifdef FFS_WIN
- new MouseMoveWindow(*this, //allow moving main dialog by clicking (nearly) anywhere...
- this, m_bitmap26, m_staticTexHeader, m_bitmap8, m_bitmap9); //ownership passed to "this"
+ new zen::MouseMoveWindow(*this); //allow moving main dialog by clicking (nearly) anywhere...; ownership passed to "this"
#endif
- m_bitmap8->SetBitmap(GlobalResources::instance().getImage(wxT("include")));
- m_bitmap9->SetBitmap(GlobalResources::instance().getImage(wxT("exclude")));
+ enumTimeDescr.
+ add(UTIME_NONE, _("Inactive")).
+ add(UTIME_SEC, _("Second")).
+ add(UTIME_MIN, _("Minute")).
+ add(UTIME_HOUR, _("Hour")).
+ add(UTIME_DAY, _("Day"));
+
+ enumSizeDescr.
+ add(USIZE_NONE, _("Inactive")).
+ add(USIZE_BYTE, _("Byte")).
+ add(USIZE_KB, _("KB")).
+ add(USIZE_MB, _("MB"));
+
m_bitmap26->SetBitmap(GlobalResources::instance().getImage(wxT("filterOn")));
m_bpButtonHelp->SetBitmapLabel(GlobalResources::instance().getImage(wxT("help")));
- m_textCtrlInclude->SetValue(zToWx(includeFilter));
- m_textCtrlExclude->SetValue(zToWx(excludeFilter));
+ setFilter(filter);
m_panel13->Hide();
m_button10->SetFocus();
@@ -254,6 +262,67 @@ FilterDlg::FilterDlg(wxWindow* window,
}
+void FilterDlg::updateGui()
+{
+ FilterConfig activeCfg = getFilter();
+
+ if (!NameFilter(activeCfg.includeFilter, FilterConfig().excludeFilter).isNull())
+ m_bitmapInclude->SetBitmap(GlobalResources::instance().getImage(wxT("include")));
+ else
+ m_bitmapInclude->SetBitmap(GlobalResources::instance().getImage(wxT("include_grey")));
+
+ if (!NameFilter(FilterConfig().includeFilter, activeCfg.excludeFilter).isNull())
+ m_bitmapExclude->SetBitmap(GlobalResources::instance().getImage(wxT("exclude")));
+ else
+ m_bitmapExclude->SetBitmap(GlobalResources::instance().getImage(wxT("exclude_grey")));
+
+ if (activeCfg.unitTimeSpan != UTIME_NONE)
+ m_bitmapFilterDate->SetBitmap(GlobalResources::instance().getImage(wxT("clock")));
+ else
+ m_bitmapFilterDate->SetBitmap(GlobalResources::instance().getImage(wxT("clock_grey")));
+
+ if (activeCfg.unitSizeMin != USIZE_NONE ||
+ activeCfg.unitSizeMax != USIZE_NONE)
+ m_bitmapFilterSize->SetBitmap(GlobalResources::instance().getImage(wxT("size")));
+ else
+ m_bitmapFilterSize->SetBitmap(GlobalResources::instance().getImage(wxT("size_grey")));
+
+ m_spinCtrlTimespan->Enable(activeCfg.unitTimeSpan != UTIME_NONE);
+ m_spinCtrlMinSize ->Enable(activeCfg.unitSizeMin != USIZE_NONE);
+ m_spinCtrlMaxSize ->Enable(activeCfg.unitSizeMax != USIZE_NONE);
+}
+
+
+void FilterDlg::setFilter(const FilterConfig& filter)
+{
+ m_textCtrlInclude->ChangeValue(zToWx(filter.includeFilter));
+ m_textCtrlExclude->ChangeValue(zToWx(filter.excludeFilter));
+
+ setEnumVal(enumTimeDescr, *m_choiceUnitTimespan, filter.unitTimeSpan);
+ setEnumVal(enumSizeDescr, *m_choiceUnitMinSize, filter.unitSizeMin);
+ setEnumVal(enumSizeDescr, *m_choiceUnitMaxSize, filter.unitSizeMax);
+
+ m_spinCtrlTimespan->SetValue(static_cast<int>(filter.timeSpan));
+ m_spinCtrlMinSize ->SetValue(static_cast<int>(filter.sizeMin));
+ m_spinCtrlMaxSize ->SetValue(static_cast<int>(filter.sizeMax));
+
+ updateGui();
+}
+
+
+FilterConfig FilterDlg::getFilter() const
+{
+ return FilterConfig(wxToZ(m_textCtrlInclude->GetValue()),
+ wxToZ(m_textCtrlExclude->GetValue()),
+ m_spinCtrlTimespan->GetValue(),
+ getEnumVal(enumTimeDescr, *m_choiceUnitTimespan),
+ m_spinCtrlMinSize->GetValue(),
+ getEnumVal(enumSizeDescr, *m_choiceUnitMinSize),
+ m_spinCtrlMaxSize->GetValue(),
+ getEnumVal(enumSizeDescr, *m_choiceUnitMaxSize));
+}
+
+
void FilterDlg::OnHelp(wxCommandEvent& event)
{
m_bpButtonHelp->Hide();
@@ -267,19 +336,10 @@ void FilterDlg::OnHelp(wxCommandEvent& event)
void FilterDlg::OnDefault(wxCommandEvent& event)
{
- const FilterConfig nullFilter;
-
if (isGlobalFilter_)
- {
- m_textCtrlInclude->SetValue(zToWx(nullFilter.includeFilter));
- //exclude various recycle bin directories with global filter
- m_textCtrlExclude->SetValue(zToWx(standardExcludeFilter()));
- }
+ setFilter(MainConfiguration().globalFilter);
else
- {
- m_textCtrlInclude->SetValue(zToWx(nullFilter.includeFilter));
- m_textCtrlExclude->SetValue(zToWx(nullFilter.excludeFilter));
- }
+ setFilter(FilterConfig());
//changes to mainDialog are only committed when the OK button is pressed
Fit();
@@ -289,11 +349,10 @@ void FilterDlg::OnDefault(wxCommandEvent& event)
void FilterDlg::OnApply(wxCommandEvent& event)
{
//only if user presses ApplyFilter, he wants the changes to be committed
- includeFilter = wxToZ(m_textCtrlInclude->GetValue());
- excludeFilter = wxToZ(m_textCtrlExclude->GetValue());
+ outputRef = getFilter();
//when leaving dialog: filter and redraw grid, if filter is active
- EndModal(BUTTON_APPLY);
+ EndModal(ReturnSmallDlg::BUTTON_OKAY);
}
@@ -310,19 +369,12 @@ void FilterDlg::OnClose(wxCloseEvent& event)
-DefaultReturnCode::Response ffs3::showFilterDialog(bool isGlobalFilter,
- Zstring& filterIncl,
- Zstring& filterExcl)
+ReturnSmallDlg::ButtonPressed zen::showFilterDialog(bool isGlobalFilter, FilterConfig& filter)
{
- DefaultReturnCode::Response rv = DefaultReturnCode::BUTTON_CANCEL;
FilterDlg filterDlg(NULL,
isGlobalFilter, //is main filter dialog
- filterIncl,
- filterExcl);
- if (filterDlg.ShowModal() == FilterDlg::BUTTON_APPLY)
- rv = DefaultReturnCode::BUTTON_OKAY;
-
- return rv;
+ filter);
+ return static_cast<ReturnSmallDlg::ButtonPressed>(filterDlg.ShowModal());
}
//########################################################################################
@@ -330,18 +382,12 @@ DefaultReturnCode::Response ffs3::showFilterDialog(bool isGlobalFilter,
class DeleteDialog : public DeleteDlgGenerated
{
public:
- DeleteDialog(wxWindow* main,
- const std::vector<ffs3::FileSystemObject*>& rowsOnLeft,
- const std::vector<ffs3::FileSystemObject*>& rowsOnRight,
+ DeleteDialog(wxWindow* parent,
+ const std::vector<zen::FileSystemObject*>& rowsOnLeft,
+ const std::vector<zen::FileSystemObject*>& rowsOnRight,
bool& deleteOnBothSides,
bool& useRecycleBin);
- enum
- {
- BUTTON_OKAY = 1,
- BUTTON_CANCEL
- };
-
private:
void OnOK(wxCommandEvent& event);
void OnCancel(wxCommandEvent& event);
@@ -349,64 +395,69 @@ private:
void OnDelOnBothSides(wxCommandEvent& event);
void OnUseRecycler(wxCommandEvent& event);
- void updateTexts();
+ void updateGui();
- const std::vector<ffs3::FileSystemObject*>& rowsToDeleteOnLeft;
- const std::vector<ffs3::FileSystemObject*>& rowsToDeleteOnRight;
- bool& m_deleteOnBothSides;
- bool& m_useRecycleBin;
+ const std::vector<zen::FileSystemObject*>& rowsToDeleteOnLeft;
+ const std::vector<zen::FileSystemObject*>& rowsToDeleteOnRight;
+ bool& outRefdeleteOnBothSides;
+ bool& outRefuseRecycleBin;
};
-DeleteDialog::DeleteDialog(wxWindow* main,
+DeleteDialog::DeleteDialog(wxWindow* parent,
const std::vector<FileSystemObject*>& rowsOnLeft,
const std::vector<FileSystemObject*>& rowsOnRight,
bool& deleteOnBothSides,
bool& useRecycleBin) :
- DeleteDlgGenerated(main),
+ DeleteDlgGenerated(parent),
rowsToDeleteOnLeft(rowsOnLeft),
rowsToDeleteOnRight(rowsOnRight),
- m_deleteOnBothSides(deleteOnBothSides),
- m_useRecycleBin(useRecycleBin)
+ outRefdeleteOnBothSides(deleteOnBothSides),
+ outRefuseRecycleBin(useRecycleBin)
{
#ifdef FFS_WIN
- new MouseMoveWindow(*this, //allow moving main dialog by clicking (nearly) anywhere...
- this, m_bitmap12, m_staticTextHeader); //ownership passed to "this"
+ new zen::MouseMoveWindow(*this); //allow moving main dialog by clicking (nearly) anywhere...; ownership passed to "this"
#endif
m_checkBoxDeleteBothSides->SetValue(deleteOnBothSides);
m_checkBoxUseRecycler->SetValue(useRecycleBin);
- updateTexts();
+
+ //if both sides contain same rows this checkbox is superfluous
+ if (rowsToDeleteOnLeft == rowsToDeleteOnRight)
+ {
+ m_checkBoxDeleteBothSides->Show(false);
+ m_checkBoxDeleteBothSides->SetValue(true);
+ }
+
+ updateGui();
m_buttonOK->SetFocus();
}
-void DeleteDialog::updateTexts()
+void DeleteDialog::updateGui()
{
+ const std::pair<wxString, int> delInfo = zen::deleteFromGridAndHDPreview(
+ rowsToDeleteOnLeft,
+ rowsToDeleteOnRight,
+ m_checkBoxDeleteBothSides->GetValue());
+ wxString header;
if (m_checkBoxUseRecycler->GetValue())
{
- m_staticTextHeader->SetLabel(_("Do you really want to move the following object(s) to the Recycle Bin?"));
+ header = _P("Do you really want to move the following object to the Recycle Bin?",
+ "Do you really want to move the following %x objects to the Recycle Bin?", delInfo.second);
m_bitmap12->SetBitmap(GlobalResources::instance().getImage(wxT("recycler")));
}
else
{
- m_staticTextHeader->SetLabel(_("Do you really want to delete the following object(s)?"));
+ header = _P("Do you really want to delete the following object?",
+ "Do you really want to delete the following %x objects?", delInfo.second);
m_bitmap12->SetBitmap(GlobalResources::instance().getImage(wxT("deleteFile")));
}
-
- const std::pair<wxString, int> delInfo = ffs3::deleteFromGridAndHDPreview(
- rowsToDeleteOnLeft,
- rowsToDeleteOnRight,
- m_checkBoxDeleteBothSides->GetValue());
+ header.Replace(wxT("%x"), toStringSep(delInfo.second));
+ m_staticTextHeader->SetLabel(header);
const wxString filesToDelete = delInfo.first;
-
- #ifndef _MSC_VER
- #warning do something with this number: ("Do you really want to delete the following %x object(s)?"));
- //totalDelCount = delInfo.second;
- #endif
-
m_textCtrlMessage->SetValue(filesToDelete);
Layout();
@@ -415,47 +466,45 @@ void DeleteDialog::updateTexts()
void DeleteDialog::OnOK(wxCommandEvent& event)
{
- EndModal(BUTTON_OKAY);
+ outRefuseRecycleBin = m_checkBoxUseRecycler->GetValue();
+ if (rowsToDeleteOnLeft != rowsToDeleteOnRight)
+ outRefdeleteOnBothSides = m_checkBoxDeleteBothSides->GetValue();
+
+ EndModal(ReturnSmallDlg::BUTTON_OKAY);
}
void DeleteDialog::OnCancel(wxCommandEvent& event)
{
- EndModal(BUTTON_CANCEL);
+ EndModal(ReturnSmallDlg::BUTTON_CANCEL);
}
void DeleteDialog::OnClose(wxCloseEvent& event)
{
- EndModal(BUTTON_CANCEL);
+ EndModal(ReturnSmallDlg::BUTTON_CANCEL);
}
void DeleteDialog::OnDelOnBothSides(wxCommandEvent& event)
{
- m_deleteOnBothSides = m_checkBoxDeleteBothSides->GetValue();
- updateTexts();
+ updateGui();
}
void DeleteDialog::OnUseRecycler(wxCommandEvent& event)
{
- m_useRecycleBin = m_checkBoxUseRecycler->GetValue();
- updateTexts();
+ updateGui();
}
-DefaultReturnCode::Response ffs3::showDeleteDialog(const std::vector<ffs3::FileSystemObject*>& rowsOnLeft,
- const std::vector<ffs3::FileSystemObject*>& rowsOnRight,
- bool& deleteOnBothSides,
- bool& useRecycleBin)
+ReturnSmallDlg::ButtonPressed zen::showDeleteDialog(const std::vector<zen::FileSystemObject*>& rowsOnLeft,
+ const std::vector<zen::FileSystemObject*>& rowsOnRight,
+ bool& deleteOnBothSides,
+ bool& useRecycleBin)
{
- DefaultReturnCode::Response rv = DefaultReturnCode::BUTTON_CANCEL;
-
DeleteDialog confirmDeletion(NULL,
rowsOnLeft,
rowsOnRight,
deleteOnBothSides,
useRecycleBin);
- if (confirmDeletion.ShowModal() == DeleteDialog::BUTTON_OKAY)
- rv = DefaultReturnCode::BUTTON_OKAY;
- return rv;
+ return static_cast<ReturnSmallDlg::ButtonPressed>(confirmDeletion.ShowModal());
}
//########################################################################################
@@ -463,12 +512,7 @@ DefaultReturnCode::Response ffs3::showDeleteDialog(const std::vector<ffs3::FileS
class CustomizeColsDlg : public CustomizeColsDlgGenerated
{
public:
- CustomizeColsDlg(wxWindow* window, xmlAccess::ColumnAttributes& attr);
-
- enum
- {
- BUTTON_OKAY = 10
- };
+ CustomizeColsDlg(wxWindow* parent, xmlAccess::ColumnAttributes& attr);
private:
void OnOkay(wxCommandEvent& event);
@@ -483,13 +527,12 @@ private:
};
-CustomizeColsDlg::CustomizeColsDlg(wxWindow* window, xmlAccess::ColumnAttributes& attr) :
- CustomizeColsDlgGenerated(window),
+CustomizeColsDlg::CustomizeColsDlg(wxWindow* parent, xmlAccess::ColumnAttributes& attr) :
+ CustomizeColsDlgGenerated(parent),
output(attr)
{
#ifdef FFS_WIN
- new MouseMoveWindow(*this, //allow moving main dialog by clicking (nearly) anywhere...
- this); //ownership passed to "this"
+ new zen::MouseMoveWindow(*this); //allow moving main dialog by clicking (nearly) anywhere...; ownership passed to "this"
#endif
m_bpButton29->SetBitmapLabel(GlobalResources::instance().getImage(wxT("moveUp")));
@@ -526,7 +569,7 @@ void CustomizeColsDlg::OnOkay(wxCommandEvent& event)
}
}
- EndModal(BUTTON_OKAY);
+ EndModal(ReturnSmallDlg::BUTTON_OKAY);
}
@@ -589,15 +632,10 @@ void CustomizeColsDlg::OnMoveDown(wxCommandEvent& event)
}
-DefaultReturnCode::Response ffs3::showCustomizeColsDlg(xmlAccess::ColumnAttributes& attr)
+ReturnSmallDlg::ButtonPressed zen::showCustomizeColsDlg(xmlAccess::ColumnAttributes& attr)
{
- DefaultReturnCode::Response rv = DefaultReturnCode::BUTTON_CANCEL;
-
CustomizeColsDlg customizeDlg(NULL, attr);
- if (customizeDlg.ShowModal() == CustomizeColsDlg::BUTTON_OKAY)
- rv = DefaultReturnCode::BUTTON_OKAY;
-
- return rv;
+ return static_cast<ReturnSmallDlg::ButtonPressed>(customizeDlg.ShowModal());
}
//########################################################################################
@@ -605,16 +643,10 @@ DefaultReturnCode::Response ffs3::showCustomizeColsDlg(xmlAccess::ColumnAttribut
class SyncPreviewDlg : public SyncPreviewDlgGenerated
{
public:
- SyncPreviewDlg(wxWindow* parentWindow,
+ SyncPreviewDlg(wxWindow* parent,
const wxString& variantName,
- const ffs3::SyncStatistics& statistics,
+ const zen::SyncStatistics& statistics,
bool& dontShowAgain);
- enum
- {
- BUTTON_START = 1,
- BUTTON_CANCEL = 2
- };
-
private:
void OnClose(wxCloseEvent& event);
void OnCancel(wxCommandEvent& event);
@@ -625,19 +657,18 @@ private:
-SyncPreviewDlg::SyncPreviewDlg(wxWindow* parentWindow,
+SyncPreviewDlg::SyncPreviewDlg(wxWindow* parent,
const wxString& variantName,
- const ffs3::SyncStatistics& statistics,
+ const zen::SyncStatistics& statistics,
bool& dontShowAgain) :
- SyncPreviewDlgGenerated(parentWindow),
+ SyncPreviewDlgGenerated(parent),
m_dontShowAgain(dontShowAgain)
{
#ifdef FFS_WIN
- new ffs3::MouseMoveWindow(*this, //allow moving main dialog by clicking (nearly) anywhere...
- this, m_staticTextVariant); //ownership passed to "this"
+ new zen::MouseMoveWindow(*this); //allow moving main dialog by clicking (nearly) anywhere...; ownership passed to "this"
#endif
- using ffs3::numberToStringSep;
+ using zen::toStringSep;
m_buttonStartSync->setBitmapFront(GlobalResources::instance().getImage(wxT("startSync")));
m_bitmapCreate->SetBitmap(GlobalResources::instance().getImage(wxT("create")));
@@ -646,15 +677,15 @@ SyncPreviewDlg::SyncPreviewDlg(wxWindow* parentWindow,
m_bitmapData->SetBitmap(GlobalResources::instance().getImage(wxT("data")));
m_staticTextVariant->SetLabel(variantName);
- m_textCtrlData->SetValue(ffs3::formatFilesizeToShortString(statistics.getDataToProcess()));
+ m_textCtrlData->SetValue(zen::formatFilesizeToShortString(statistics.getDataToProcess()));
- m_textCtrlCreateL->SetValue(numberToStringSep(statistics.getCreate <LEFT_SIDE>()));
- m_textCtrlUpdateL->SetValue(numberToStringSep(statistics.getOverwrite<LEFT_SIDE>()));
- m_textCtrlDeleteL->SetValue(numberToStringSep(statistics.getDelete <LEFT_SIDE>()));
+ m_textCtrlCreateL->SetValue(toStringSep(statistics.getCreate <LEFT_SIDE>()));
+ m_textCtrlUpdateL->SetValue(toStringSep(statistics.getOverwrite<LEFT_SIDE>()));
+ m_textCtrlDeleteL->SetValue(toStringSep(statistics.getDelete <LEFT_SIDE>()));
- m_textCtrlCreateR->SetValue(numberToStringSep(statistics.getCreate <RIGHT_SIDE>()));
- m_textCtrlUpdateR->SetValue(numberToStringSep(statistics.getOverwrite<RIGHT_SIDE>()));
- m_textCtrlDeleteR->SetValue(numberToStringSep(statistics.getDelete <RIGHT_SIDE>()));
+ m_textCtrlCreateR->SetValue(toStringSep(statistics.getCreate <RIGHT_SIDE>()));
+ m_textCtrlUpdateR->SetValue(toStringSep(statistics.getOverwrite<RIGHT_SIDE>()));
+ m_textCtrlDeleteR->SetValue(toStringSep(statistics.getDelete <RIGHT_SIDE>()));
m_checkBoxDontShowAgain->SetValue(dontShowAgain);
@@ -665,39 +696,34 @@ SyncPreviewDlg::SyncPreviewDlg(wxWindow* parentWindow,
void SyncPreviewDlg::OnClose(wxCloseEvent& event)
{
- EndModal(BUTTON_CANCEL);
+ EndModal(ReturnSmallDlg::BUTTON_CANCEL);
}
void SyncPreviewDlg::OnCancel(wxCommandEvent& event)
{
- EndModal(BUTTON_CANCEL);
+ EndModal(ReturnSmallDlg::BUTTON_CANCEL);
}
void SyncPreviewDlg::OnStartSync(wxCommandEvent& event)
{
m_dontShowAgain = m_checkBoxDontShowAgain->GetValue();
- EndModal(BUTTON_START);
+ EndModal(ReturnSmallDlg::BUTTON_OKAY);
}
-DefaultReturnCode::Response ffs3::showSyncPreviewDlg(
+ReturnSmallDlg::ButtonPressed zen::showSyncPreviewDlg(
const wxString& variantName,
- const ffs3::SyncStatistics& statistics,
+ const zen::SyncStatistics& statistics,
bool& dontShowAgain)
{
- DefaultReturnCode::Response rv = DefaultReturnCode::BUTTON_CANCEL;
-
SyncPreviewDlg preview(NULL,
variantName,
statistics,
dontShowAgain);
- if (preview.ShowModal() == SyncPreviewDlg::BUTTON_START)
- rv = DefaultReturnCode::BUTTON_OKAY;
-
- return rv;
+ return static_cast<ReturnSmallDlg::ButtonPressed>(preview.ShowModal());
}
//########################################################################################
@@ -705,16 +731,11 @@ DefaultReturnCode::Response ffs3::showSyncPreviewDlg(
class CompareCfgDialog : public CmpCfgDlgGenerated
{
public:
- CompareCfgDialog(wxWindow* parentWindow,
+ CompareCfgDialog(wxWindow* parent,
const wxPoint& position,
- ffs3::CompareVariant& cmpVar,
+ zen::CompareVariant& cmpVar,
SymLinkHandling& handleSymlinks);
- enum
- {
- BUTTON_OKAY = 10
- };
-
private:
void OnOkay(wxCommandEvent& event);
void OnClose(wxCloseEvent& event);
@@ -725,14 +746,14 @@ private:
void updateView();
- ffs3::CompareVariant& cmpVarOut;
+ zen::CompareVariant& cmpVarOut;
SymLinkHandling& handleSymlinksOut;
};
namespace
{
-void setValue(wxChoice& choiceCtrl, ffs3::SymLinkHandling value)
+void setValue(wxChoice& choiceCtrl, zen::SymLinkHandling value)
{
choiceCtrl.Clear();
choiceCtrl.Append(_("Ignore"));
@@ -744,55 +765,54 @@ void setValue(wxChoice& choiceCtrl, ffs3::SymLinkHandling value)
switch (value)
{
- case ffs3::SYMLINK_IGNORE:
+ case zen::SYMLINK_IGNORE:
choiceCtrl.SetSelection(0);
break;
- case ffs3::SYMLINK_USE_DIRECTLY:
+ case zen::SYMLINK_USE_DIRECTLY:
choiceCtrl.SetSelection(1);
break;
- case ffs3::SYMLINK_FOLLOW_LINK:
+ case zen::SYMLINK_FOLLOW_LINK:
choiceCtrl.SetSelection(2);
break;
}
}
-ffs3::SymLinkHandling getValue(const wxChoice& choiceCtrl)
+zen::SymLinkHandling getValue(const wxChoice& choiceCtrl)
{
switch (choiceCtrl.GetSelection())
{
case 0:
- return ffs3::SYMLINK_IGNORE;
+ return zen::SYMLINK_IGNORE;
case 1:
- return ffs3::SYMLINK_USE_DIRECTLY;
+ return zen::SYMLINK_USE_DIRECTLY;
case 2:
- return ffs3::SYMLINK_FOLLOW_LINK;
+ return zen::SYMLINK_FOLLOW_LINK;
default:
assert(false);
- return ffs3::SYMLINK_IGNORE;
+ return zen::SYMLINK_IGNORE;
}
}
}
-CompareCfgDialog::CompareCfgDialog(wxWindow* parentWindow,
+CompareCfgDialog::CompareCfgDialog(wxWindow* parent,
const wxPoint& position,
CompareVariant& cmpVar,
SymLinkHandling& handleSymlinks) :
- CmpCfgDlgGenerated(parentWindow),
+ CmpCfgDlgGenerated(parent),
cmpVarOut(cmpVar),
handleSymlinksOut(handleSymlinks)
{
#ifdef FFS_WIN
- new MouseMoveWindow(*this, //allow moving main dialog by clicking (nearly) anywhere...
- this); //ownership passed to "this"
+ new zen::MouseMoveWindow(*this); //allow moving main dialog by clicking (nearly) anywhere...; ownership passed to "this"
#endif
//move dialog up so that compare-config button and first config-variant are on same level
Move(wxPoint(position.x, std::max(0, position.y - (m_buttonTimeSize->GetScreenPosition() - GetScreenPosition()).y)));
- m_bpButtonHelp->SetBitmapLabel(GlobalResources::instance().getImage(wxT("help")));
- m_bitmapByTime->SetBitmap(GlobalResources::instance().getImage(wxT("cmpByTime")));
- m_bitmapByContent->SetBitmap(GlobalResources::instance().getImage(wxT("cmpByContent")));
+ m_bpButtonHelp ->SetBitmapLabel(GlobalResources::instance().getImage(wxT("help")));
+ m_bitmapByTime ->SetBitmap (GlobalResources::instance().getImage(wxT("clock")));
+ m_bitmapByContent->SetBitmap (GlobalResources::instance().getImage(wxT("cmpByContent")));
switch (cmpVar)
{
@@ -826,7 +846,7 @@ void CompareCfgDialog::OnOkay(wxCommandEvent& event)
handleSymlinksOut = getValue(*m_choiceHandleSymlinks);;
- EndModal(BUTTON_OKAY);
+ EndModal(ReturnSmallDlg::BUTTON_OKAY);
}
@@ -863,16 +883,14 @@ void CompareCfgDialog::OnShowHelp(wxCommandEvent& event)
}
-DefaultReturnCode::Response ffs3::showCompareCfgDialog(
+ReturnSmallDlg::ButtonPressed zen::showCompareCfgDialog(
const wxPoint& position,
CompareVariant& cmpVar,
SymLinkHandling& handleSymlinks)
{
CompareCfgDialog syncDlg(NULL, position, cmpVar, handleSymlinks);
- return syncDlg.ShowModal() == CompareCfgDialog::BUTTON_OKAY ?
- DefaultReturnCode::BUTTON_OKAY :
- DefaultReturnCode::BUTTON_CANCEL;
+ return static_cast<ReturnSmallDlg::ButtonPressed>(syncDlg.ShowModal());
}
//########################################################################################
@@ -880,12 +898,7 @@ DefaultReturnCode::Response ffs3::showCompareCfgDialog(
class GlobalSettingsDlg : public GlobalSettingsDlgGenerated
{
public:
- GlobalSettingsDlg(wxWindow* window, xmlAccess::XmlGlobalSettings& globalSettings);
-
- enum
- {
- BUTTON_OKAY = 10
- };
+ GlobalSettingsDlg(wxWindow* parent, xmlAccess::XmlGlobalSettings& globalSettings);
private:
void OnOkay(wxCommandEvent& event);
@@ -903,13 +916,12 @@ private:
};
-GlobalSettingsDlg::GlobalSettingsDlg(wxWindow* window, xmlAccess::XmlGlobalSettings& globalSettings) :
- GlobalSettingsDlgGenerated(window),
+GlobalSettingsDlg::GlobalSettingsDlg(wxWindow* parent, xmlAccess::XmlGlobalSettings& globalSettings) :
+ GlobalSettingsDlgGenerated(parent),
settings(globalSettings)
{
#ifdef FFS_WIN
- new MouseMoveWindow(*this, //allow moving main dialog by clicking (nearly) anywhere...
- this, m_bitmapSettings, m_staticText56); //ownership passed to "this"
+ new zen::MouseMoveWindow(*this); //allow moving main dialog by clicking (nearly) anywhere...; ownership passed to "this"
#endif
m_bitmapSettings->SetBitmap(GlobalResources::instance().getImage(wxT("settings")));
@@ -948,17 +960,14 @@ void GlobalSettingsDlg::OnOkay(wxCommandEvent& event)
settings.copyFilePermissions = m_checkBoxCopyPermissions->GetValue();
settings.gui.externelApplications = getExtApp();
- EndModal(BUTTON_OKAY);
+ EndModal(ReturnSmallDlg::BUTTON_OKAY);
}
void GlobalSettingsDlg::OnResetDialogs(wxCommandEvent& event)
{
- QuestionDlg messageDlg(this,
- QuestionDlg::BUTTON_YES | QuestionDlg::BUTTON_CANCEL,
- _("Restore all hidden dialogs?"));
-
- if (messageDlg.ShowModal() == QuestionDlg::BUTTON_YES)
+ if (showQuestionDlg(ReturnQuestionDlg::BUTTON_YES | ReturnQuestionDlg::BUTTON_CANCEL,
+ _("Restore all hidden dialogs?")) == ReturnQuestionDlg::BUTTON_YES)
settings.optDialogs.resetDialogs();
}
@@ -1044,13 +1053,8 @@ void GlobalSettingsDlg::OnRemoveRow(wxCommandEvent& event)
}
-DefaultReturnCode::Response ffs3::showGlobalSettingsDlg(xmlAccess::XmlGlobalSettings& globalSettings)
+ReturnSmallDlg::ButtonPressed zen::showGlobalSettingsDlg(xmlAccess::XmlGlobalSettings& globalSettings)
{
- DefaultReturnCode::Response rv = DefaultReturnCode::BUTTON_CANCEL;
-
GlobalSettingsDlg settingsDlg(NULL, globalSettings);
- if (settingsDlg.ShowModal() == GlobalSettingsDlg::BUTTON_OKAY)
- rv = DefaultReturnCode::BUTTON_OKAY;
-
- return rv;
+ return static_cast<ReturnSmallDlg::ButtonPressed>(settingsDlg.ShowModal());
}
diff --git a/ui/small_dlgs.h b/ui/small_dlgs.h
index d4fce824..06fb9964 100644
--- a/ui/small_dlgs.h
+++ b/ui/small_dlgs.h
@@ -9,48 +9,45 @@
#include "../file_hierarchy.h"
#include "../library/process_xml.h"
+#include "../synchronization.h"
-namespace ffs3
+namespace zen
{
-class SyncStatistics;
-
-
-struct DefaultReturnCode
+struct ReturnSmallDlg
{
- enum Response
+ enum ButtonPressed
{
- BUTTON_OKAY,
- BUTTON_CANCEL
+ BUTTON_CANCEL,
+ BUTTON_OKAY = 1
};
};
+
void showAboutDialog();
void showHelpDialog();
-DefaultReturnCode::Response showFilterDialog(bool isGlobalFilter,
- Zstring& filterIncl,
- Zstring& filterExcl);
+ReturnSmallDlg::ButtonPressed showFilterDialog(bool isGlobalFilter, FilterConfig& filter);
-DefaultReturnCode::Response showDeleteDialog(
+ReturnSmallDlg::ButtonPressed showDeleteDialog(
const std::vector<FileSystemObject*>& rowsOnLeft,
const std::vector<FileSystemObject*>& rowsOnRight,
bool& deleteOnBothSides,
bool& useRecycleBin);
-DefaultReturnCode::Response showCustomizeColsDlg(xmlAccess::ColumnAttributes& attr);
+ReturnSmallDlg::ButtonPressed showCustomizeColsDlg(xmlAccess::ColumnAttributes& attr);
-DefaultReturnCode::Response showSyncPreviewDlg(
+ReturnSmallDlg::ButtonPressed showSyncPreviewDlg(
const wxString& variantName,
const SyncStatistics& statistics,
bool& dontShowAgain);
-DefaultReturnCode::Response showCompareCfgDialog(
+ReturnSmallDlg::ButtonPressed showCompareCfgDialog(
const wxPoint& position,
CompareVariant& cmpVar,
SymLinkHandling& handleSymlinks);
-DefaultReturnCode::Response showGlobalSettingsDlg(xmlAccess::XmlGlobalSettings& globalSettings);
+ReturnSmallDlg::ButtonPressed showGlobalSettingsDlg(xmlAccess::XmlGlobalSettings& globalSettings);
}
#endif // SMALLDIALOGS_H_INCLUDED
diff --git a/ui/sorting.h b/ui/sorting.h
index ce3e4648..52921f84 100644
--- a/ui/sorting.h
+++ b/ui/sorting.h
@@ -13,7 +13,7 @@
#include "../shared/assert_static.h"
-namespace ffs3
+namespace zen
{
namespace
{
@@ -68,7 +68,7 @@ bool sortByFileName(const FileSystemObject& a, const FileSystemObject& b)
if (isDirectoryMapping(a)) //sort directories by relative name
{
if (isDirectoryMapping(b))
- return cmpFileName(a.getRelativeName<side>(), b.getRelativeName<side>()) < 0;
+ return LessFilename()(a.getRelativeName<side>(), b.getRelativeName<side>());
else
return false;
}
@@ -113,7 +113,7 @@ bool sortByRelativeName(const FileSystemObject& a, const FileSystemObject& b)
else if (isDirectoryA)
return true;
- return cmpFileName(a.getShortName<side>(), b.getShortName<side>()) < 0;
+ return LessFilename()(a.getShortName<side>(), b.getShortName<side>());
}
}
@@ -172,8 +172,8 @@ bool sortByDate(const FileSystemObject& a, const FileSystemObject& b)
else if (!fileObjB && !linkObjB)
return true; //directories last
- const wxLongLong& dateA = fileObjA ? fileObjA->getLastWriteTime<side>() : linkObjA->getLastWriteTime<side>();
- const wxLongLong& dateB = fileObjB ? fileObjB->getLastWriteTime<side>() : linkObjB->getLastWriteTime<side>();
+ zen::Int64 dateA = fileObjA ? fileObjA->getLastWriteTime<side>() : linkObjA->getLastWriteTime<side>();
+ zen::Int64 dateB = fileObjB ? fileObjB->getLastWriteTime<side>() : linkObjB->getLastWriteTime<side>();
//return list beginning with newest files first
return Compare<ascending>().isSmallerThan(dateA, dateB);
diff --git a/ui/switch_to_gui.cpp b/ui/switch_to_gui.cpp
index 87827c54..4bfdfd1f 100644
--- a/ui/switch_to_gui.cpp
+++ b/ui/switch_to_gui.cpp
@@ -7,7 +7,7 @@
#include "switch_to_gui.h"
#include "main_dlg.h"
-using ffs3::SwitchToGui;
+using zen::SwitchToGui;
SwitchToGui::SwitchToGui(const xmlAccess::XmlBatchConfig& batchCfg,
diff --git a/ui/switch_to_gui.h b/ui/switch_to_gui.h
index a938c7d8..03e18324 100644
--- a/ui/switch_to_gui.h
+++ b/ui/switch_to_gui.h
@@ -10,7 +10,7 @@
#include "../library/process_xml.h"
-namespace ffs3
+namespace zen
{
//switch from FreeFileSync Batch to GUI modus: opens a new FreeFileSync GUI session asynchronously
diff --git a/ui/sync_cfg.cpp b/ui/sync_cfg.cpp
index 406ca5c6..3a7283e1 100644
--- a/ui/sync_cfg.cpp
+++ b/ui/sync_cfg.cpp
@@ -5,43 +5,268 @@
// **************************************************************************
//
#include "sync_cfg.h"
-
#include "../library/resources.h"
#include "../shared/dir_name.h"
#include <wx/wupdlock.h>
#include "../shared/mouse_move_dlg.h"
#include "../shared/string_conv.h"
#include "../shared/dir_picker_i18n.h"
+#include "gui_generated.h"
+#include <memory>
+#include "../shared/util.h"
+#include "../shared/dir_name.h"
+
+using namespace zen;
+using namespace xmlAccess;
+
+
+
+
+class SyncCfgDialog : public SyncCfgDlgGenerated
+{
+public:
+ SyncCfgDialog(wxWindow* window,
+ zen::CompareVariant compareVar,
+ zen::SyncConfig& syncConfiguration,
+ zen::DeletionPolicy& handleDeletion,
+ wxString& customDeletionDirectory,
+ xmlAccess::OnGuiError* handleError); //optional input parameter
+
+ ~SyncCfgDialog();
+
+private:
+ virtual void OnSyncAutomatic( wxCommandEvent& event);
+ virtual void OnSyncMirror( wxCommandEvent& event);
+ virtual void OnSyncUpdate( wxCommandEvent& event);
+ virtual void OnSyncCustom( wxCommandEvent& event);
+
+ virtual void OnExLeftSideOnly( wxCommandEvent& event);
+ virtual void OnExRightSideOnly( wxCommandEvent& event);
+ virtual void OnLeftNewer( wxCommandEvent& event);
+ virtual void OnRightNewer( wxCommandEvent& event);
+ virtual void OnDifferent( wxCommandEvent& event);
+ virtual void OnConflict( wxCommandEvent& event);
+
+ virtual void OnClose( wxCloseEvent& event);
+ virtual void OnCancel( wxCommandEvent& event);
+ virtual void OnApply( wxCommandEvent& event);
+
+ void updateGui();
+
+ void OnChangeErrorHandling(wxCommandEvent& event);
+ void OnChangeDeletionHandling(wxCommandEvent& event);
+
+ const zen::CompareVariant cmpVariant;
+
+ //temporal copy of maindialog.cfg.syncConfiguration -> ownership NOT within GUI controls!
+ zen::SyncConfig currentSyncConfig;
+
+ //changing data
+ zen::SyncConfig& refSyncConfiguration;
+ zen::DeletionPolicy& refHandleDeletion;
+ wxString& refCustomDeletionDirectory;
+ xmlAccess::OnGuiError* refHandleError;
+
+ zen::DirectoryName customDelFolder;
+
+ zen::EnumDescrList<zen::DeletionPolicy> enumDelhandDescr;
+ zen::EnumDescrList<xmlAccess::OnGuiError> enumErrhandDescr;
+};
+
+
+
+void updateConfigIcons(const CompareVariant compareVar,
+ const SyncConfig& syncConfig,
+ wxBitmapButton* buttonLeftOnly,
+ wxBitmapButton* buttonRightOnly,
+ wxBitmapButton* buttonLeftNewer,
+ wxBitmapButton* buttonRightNewer,
+ wxBitmapButton* buttonDifferent,
+ wxBitmapButton* buttonConflict,
+ wxStaticBitmap* bitmapLeftOnly,
+ wxStaticBitmap* bitmapRightOnly,
+ wxStaticBitmap* bitmapLeftNewer,
+ wxStaticBitmap* bitmapRightNewer,
+ wxStaticBitmap* bitmapDifferent,
+ wxStaticBitmap* bitmapConflict,
+ wxSizer* syncDirections) //sizer containing all sync-directions
+{
+ //display only relevant sync options
+ syncDirections->Show(true);
+
+ buttonLeftOnly ->Show(); //
+ buttonRightOnly ->Show(); //
+ buttonLeftNewer ->Show(); //
+ buttonRightNewer->Show(); // enable everything by default
+ buttonDifferent ->Show(); //
+ buttonConflict ->Show(); //
+
+ bitmapLeftOnly ->Show(); //
+ bitmapRightOnly ->Show(); //
+ bitmapLeftNewer ->Show(); //
+ bitmapRightNewer->Show(); //
+ bitmapDifferent ->Show(); //
+ bitmapConflict ->Show(); //
+
+ switch (compareVar)
+ {
+ case CMP_BY_TIME_SIZE:
+ buttonDifferent ->Hide();
+
+ bitmapDifferent ->Hide();
+ break;
+
+ case CMP_BY_CONTENT:
+ buttonLeftNewer ->Hide();
+ buttonRightNewer->Hide();
+
+ bitmapLeftNewer ->Hide();
+ bitmapRightNewer->Hide();
+ break;
+ }
-using namespace ffs3;
+ if (syncConfig.var == SyncConfig::AUTOMATIC) //automatic mode needs no sync-directions
+ syncDirections->Show(false);
+ else
+ {
+ const DirectionSet dirCfg = extractDirections(syncConfig);
+
+ switch (dirCfg.exLeftSideOnly)
+ {
+ case SYNC_DIR_RIGHT:
+ buttonLeftOnly->SetBitmapLabel(GlobalResources::instance().getImage(wxT("arrowRightCr")));
+ buttonLeftOnly->SetToolTip(getDescription(SO_CREATE_NEW_RIGHT));
+ break;
+ case SYNC_DIR_LEFT:
+ buttonLeftOnly->SetBitmapLabel(GlobalResources::instance().getImage(wxT("deleteLeft")));
+ buttonLeftOnly->SetToolTip(getDescription(SO_DELETE_LEFT));
+ break;
+ case SYNC_DIR_NONE:
+ buttonLeftOnly->SetBitmapLabel(GlobalResources::instance().getImage(wxT("arrowNone")));
+ buttonLeftOnly->SetToolTip(getDescription(SO_DO_NOTHING));
+ break;
+ }
+
+ switch (dirCfg.exRightSideOnly)
+ {
+ case SYNC_DIR_RIGHT:
+ buttonRightOnly->SetBitmapLabel(GlobalResources::instance().getImage(wxT("deleteRight")));
+ buttonRightOnly->SetToolTip(getDescription(SO_DELETE_RIGHT));
+ break;
+ case SYNC_DIR_LEFT:
+ buttonRightOnly->SetBitmapLabel(GlobalResources::instance().getImage(wxT("arrowLeftCr")));
+ buttonRightOnly->SetToolTip(getDescription(SO_CREATE_NEW_LEFT));
+ break;
+ case SYNC_DIR_NONE:
+ buttonRightOnly->SetBitmapLabel(GlobalResources::instance().getImage(wxT("arrowNone")));
+ buttonRightOnly->SetToolTip(getDescription(SO_DO_NOTHING));
+ break;
+ }
+
+ switch (dirCfg.leftNewer)
+ {
+ case SYNC_DIR_RIGHT:
+ buttonLeftNewer->SetBitmapLabel(GlobalResources::instance().getImage(wxT("arrowRight")));
+ buttonLeftNewer->SetToolTip(getDescription(SO_OVERWRITE_RIGHT));
+ break;
+ case SYNC_DIR_LEFT:
+ buttonLeftNewer->SetBitmapLabel(GlobalResources::instance().getImage(wxT("arrowLeft")));
+ buttonLeftNewer->SetToolTip(getDescription(SO_OVERWRITE_LEFT));
+ break;
+ case SYNC_DIR_NONE:
+ buttonLeftNewer->SetBitmapLabel(GlobalResources::instance().getImage(wxT("arrowNone")));
+ buttonLeftNewer->SetToolTip(getDescription(SO_DO_NOTHING));
+ break;
+ }
+
+ switch (dirCfg.rightNewer)
+ {
+ case SYNC_DIR_RIGHT:
+ buttonRightNewer->SetBitmapLabel(GlobalResources::instance().getImage(wxT("arrowRight")));
+ buttonRightNewer->SetToolTip(getDescription(SO_OVERWRITE_RIGHT));
+ break;
+ case SYNC_DIR_LEFT:
+ buttonRightNewer->SetBitmapLabel(GlobalResources::instance().getImage(wxT("arrowLeft")));
+ buttonRightNewer->SetToolTip(getDescription(SO_OVERWRITE_LEFT));
+ break;
+ case SYNC_DIR_NONE:
+ buttonRightNewer->SetBitmapLabel(GlobalResources::instance().getImage(wxT("arrowNone")));
+ buttonRightNewer->SetToolTip(getDescription(SO_DO_NOTHING));
+ break;
+ }
+
+ switch (dirCfg.different)
+ {
+ case SYNC_DIR_RIGHT:
+ buttonDifferent->SetBitmapLabel(GlobalResources::instance().getImage(wxT("arrowRight")));
+ buttonDifferent->SetToolTip(getDescription(SO_OVERWRITE_RIGHT));
+ break;
+ case SYNC_DIR_LEFT:
+ buttonDifferent->SetBitmapLabel(GlobalResources::instance().getImage(wxT("arrowLeft")));
+ buttonDifferent->SetToolTip(getDescription(SO_OVERWRITE_LEFT));
+ break;
+ case SYNC_DIR_NONE:
+ buttonDifferent->SetBitmapLabel(GlobalResources::instance().getImage(wxT("arrowNone")));
+ buttonDifferent->SetToolTip(getDescription(SO_DO_NOTHING));
+ break;
+ }
+
+ switch (dirCfg.conflict)
+ {
+ case SYNC_DIR_RIGHT:
+ buttonConflict->SetBitmapLabel(GlobalResources::instance().getImage(wxT("arrowRight")));
+ buttonConflict->SetToolTip(getDescription(SO_OVERWRITE_RIGHT));
+ break;
+ case SYNC_DIR_LEFT:
+ buttonConflict->SetBitmapLabel(GlobalResources::instance().getImage(wxT("arrowLeft")));
+ buttonConflict->SetToolTip(getDescription(SO_OVERWRITE_LEFT));
+ break;
+ case SYNC_DIR_NONE:
+ buttonConflict->SetBitmapLabel(GlobalResources::instance().getImage(wxT("conflict")));
+ buttonConflict->SetToolTip(_("Leave as unresolved conflict"));
+ break;
+ }
+ }
+}
SyncCfgDialog::SyncCfgDialog(wxWindow* window,
- const CompareVariant compareVar,
- SyncConfiguration& syncConfiguration,
- DeletionPolicy& handleDeletion,
- wxString& customDeletionDirectory,
- bool* ignoreErrors) :
+ CompareVariant compareVar,
+ SyncConfig& syncConfiguration,
+ DeletionPolicy& handleDeletion,
+ wxString& customDeletionDirectory,
+ OnGuiError* handleError) :
SyncCfgDlgGenerated(window),
cmpVariant(compareVar),
currentSyncConfig(syncConfiguration), //make working copy of syncConfiguration
refSyncConfiguration(syncConfiguration),
refHandleDeletion(handleDeletion),
refCustomDeletionDirectory(customDeletionDirectory),
- refIgnoreErrors(ignoreErrors),
- customDelFolder(new DirectoryName(*m_panelCustomDeletionDir, *m_dirPickerCustomDelFolder, *m_textCtrlCustomDelFolder))
+ refHandleError(handleError),
+ customDelFolder(*m_panelCustomDeletionDir, *m_dirPickerCustomDelFolder, *m_textCtrlCustomDelFolder)
{
#ifdef FFS_WIN
- new MouseMoveWindow(*this, //allow moving main dialog by clicking (nearly) anywhere...
- this, m_staticText81, m_staticText8, m_staticText101, m_staticText9); //ownership passed to "this"
+ new zen::MouseMoveWindow(*this); //allow moving main dialog by clicking (nearly) anywhere...; ownership passed to "this"
#endif
- setDeletionHandling(handleDeletion);
- customDelFolder->setName(wxToZ(customDeletionDirectory));
+ enumDelhandDescr.
+ add(DELETE_PERMANENTLY, _("Delete permanently"), _("Delete or overwrite files permanently")).
+ add(MOVE_TO_RECYCLE_BIN, _("Use Recycle Bin"), _("Use Recycle Bin when deleting or overwriting files")).
+ add(MOVE_TO_CUSTOM_DIRECTORY, _("Versioning"), _("Move files into a time-stamped subdirectory"));
+
+ enumErrhandDescr.
+ add(ON_GUIERROR_POPUP, _("Show popup"), _("Show popup on errors or warnings")).
+ add(ON_GUIERROR_IGNORE, _("Ignore errors"), _("Hide all error and warning messages"));
+
+
+ //a proper set-method may be in order some time...
+ setEnumVal(enumDelhandDescr, *m_choiceHandleDeletion, handleDeletion);
+ customDelFolder.setName(customDeletionDirectory);
+ updateGui();
//error handling
- if (ignoreErrors)
- setErrorHandling(*ignoreErrors);
+ if (handleError)
+ setEnumVal(enumErrhandDescr, *m_choiceHandleError, *handleError);
else
{
sbSizerErrorHandling->Show(false);
@@ -49,15 +274,15 @@ SyncCfgDialog::SyncCfgDialog(wxWindow* window,
}
//set sync config icons
- updateConfigIcons(cmpVariant, currentSyncConfig);
+ updateGui();
//set icons for this dialog
- m_bitmapLeftOnly->SetBitmap(GlobalResources::instance().getImage(wxT("leftOnly")));
- m_bitmapRightOnly->SetBitmap(GlobalResources::instance().getImage(wxT("rightOnly")));
- m_bitmapLeftNewer->SetBitmap(GlobalResources::instance().getImage(wxT("leftNewer")));
+ m_bitmapLeftOnly ->SetBitmap(GlobalResources::instance().getImage(wxT("leftOnly")));
+ m_bitmapRightOnly ->SetBitmap(GlobalResources::instance().getImage(wxT("rightOnly")));
+ m_bitmapLeftNewer ->SetBitmap(GlobalResources::instance().getImage(wxT("leftNewer")));
m_bitmapRightNewer->SetBitmap(GlobalResources::instance().getImage(wxT("rightNewer")));
- m_bitmapDifferent->SetBitmap(GlobalResources::instance().getImage(wxT("different")));
- m_bitmapConflict->SetBitmap(GlobalResources::instance().getImage(wxT("conflictGrey")));
+ m_bitmapDifferent ->SetBitmap(GlobalResources::instance().getImage(wxT("different")));
+ m_bitmapConflict ->SetBitmap(GlobalResources::instance().getImage(wxT("conflictGrey")));
bSizer201->Layout(); //wxButtonWithImage size might have changed
@@ -71,7 +296,7 @@ SyncCfgDialog::SyncCfgDialog(wxWindow* window,
SyncCfgDialog::~SyncCfgDialog() {} //non-inline destructor for std::auto_ptr to work with forward declaration
-void SyncCfgDialog::updateConfigIcons(const ffs3::CompareVariant cmpVar, const ffs3::SyncConfiguration& syncConfig)
+void SyncCfgDialog::updateGui()
{
//wxWindowUpdateLocker dummy(this); //avoid display distortion
wxWindowUpdateLocker dummy2(m_panelCustomDeletionDir); //avoid display distortion
@@ -82,9 +307,8 @@ void SyncCfgDialog::updateConfigIcons(const ffs3::CompareVariant cmpVar, const f
wxWindowUpdateLocker dummy7(m_bpButtonDifferent);
wxWindowUpdateLocker dummy8(m_bpButtonConflict);
-
- updateConfigIcons(cmpVar,
- syncConfig,
+ updateConfigIcons(cmpVariant,
+ currentSyncConfig,
m_bpButtonLeftOnly,
m_bpButtonRightOnly,
m_bpButtonLeftNewer,
@@ -100,174 +324,25 @@ void SyncCfgDialog::updateConfigIcons(const ffs3::CompareVariant cmpVar, const f
sbSizerSyncDirections);
//set radiobuttons -> have no parameter-ownership at all!
- switch (ffs3::getVariant(currentSyncConfig))
+ switch (currentSyncConfig.var)
{
- case SyncConfiguration::AUTOMATIC:
+ case SyncConfig::AUTOMATIC:
m_radioBtnAutomatic->SetValue(true); //automatic mode
break;
- case SyncConfiguration::MIRROR:
+ case SyncConfig::MIRROR:
m_radioBtnMirror->SetValue(true); //one way ->
break;
- case SyncConfiguration::UPDATE:
+ case SyncConfig::UPDATE:
m_radioBtnUpdate->SetValue(true); //Update ->
break;
- case SyncConfiguration::CUSTOM:
+ case SyncConfig::CUSTOM:
m_radioBtnCustom->SetValue(true); //custom
break;
}
GetSizer()->SetSizeHints(this); //this works like a charm for GTK2 with window resizing problems!!! (includes call to Fit())
-}
-
-
-void SyncCfgDialog::updateConfigIcons(const CompareVariant compareVar,
- const SyncConfiguration& syncConfig,
- wxBitmapButton* buttonLeftOnly,
- wxBitmapButton* buttonRightOnly,
- wxBitmapButton* buttonLeftNewer,
- wxBitmapButton* buttonRightNewer,
- wxBitmapButton* buttonDifferent,
- wxBitmapButton* buttonConflict,
- wxStaticBitmap* bitmapLeftOnly,
- wxStaticBitmap* bitmapRightOnly,
- wxStaticBitmap* bitmapLeftNewer,
- wxStaticBitmap* bitmapRightNewer,
- wxStaticBitmap* bitmapDifferent,
- wxStaticBitmap* bitmapConflict,
- wxSizer* syncDirections) //sizer containing all sync-directions
-{
- //display only relevant sync options
- syncDirections->Show(true);
-
- buttonLeftOnly ->Show(); //
- buttonRightOnly ->Show(); //
- buttonLeftNewer ->Show(); //
- buttonRightNewer->Show(); // enable everything by default
- buttonDifferent ->Show(); //
- buttonConflict ->Show(); //
-
- bitmapLeftOnly ->Show(); //
- bitmapRightOnly ->Show(); //
- bitmapLeftNewer ->Show(); //
- bitmapRightNewer->Show(); //
- bitmapDifferent ->Show(); //
- bitmapConflict ->Show(); //
-
- switch (compareVar)
- {
- case CMP_BY_TIME_SIZE:
- buttonDifferent ->Hide();
-
- bitmapDifferent ->Hide();
- break;
-
- case CMP_BY_CONTENT:
- buttonLeftNewer ->Hide();
- buttonRightNewer->Hide();
-
- bitmapLeftNewer ->Hide();
- bitmapRightNewer->Hide();
- break;
- }
-
- if (syncConfig.automatic) //automatic mode needs no sync-directions
- syncDirections->Show(false);
-
- switch (syncConfig.exLeftSideOnly)
- {
- case SYNC_DIR_RIGHT:
- buttonLeftOnly->SetBitmapLabel(GlobalResources::instance().getImage(wxT("arrowRightCr")));
- buttonLeftOnly->SetToolTip(getDescription(SO_CREATE_NEW_RIGHT));
- break;
- case SYNC_DIR_LEFT:
- buttonLeftOnly->SetBitmapLabel(GlobalResources::instance().getImage(wxT("deleteLeft")));
- buttonLeftOnly->SetToolTip(getDescription(SO_DELETE_LEFT));
- break;
- case SYNC_DIR_NONE:
- buttonLeftOnly->SetBitmapLabel(GlobalResources::instance().getImage(wxT("arrowNone")));
- buttonLeftOnly->SetToolTip(getDescription(SO_DO_NOTHING));
- break;
- }
-
- switch (syncConfig.exRightSideOnly)
- {
- case SYNC_DIR_RIGHT:
- buttonRightOnly->SetBitmapLabel(GlobalResources::instance().getImage(wxT("deleteRight")));
- buttonRightOnly->SetToolTip(getDescription(SO_DELETE_RIGHT));
- break;
- case SYNC_DIR_LEFT:
- buttonRightOnly->SetBitmapLabel(GlobalResources::instance().getImage(wxT("arrowLeftCr")));
- buttonRightOnly->SetToolTip(getDescription(SO_CREATE_NEW_LEFT));
- break;
- case SYNC_DIR_NONE:
- buttonRightOnly->SetBitmapLabel(GlobalResources::instance().getImage(wxT("arrowNone")));
- buttonRightOnly->SetToolTip(getDescription(SO_DO_NOTHING));
- break;
- }
-
- switch (syncConfig.leftNewer)
- {
- case SYNC_DIR_RIGHT:
- buttonLeftNewer->SetBitmapLabel(GlobalResources::instance().getImage(wxT("arrowRight")));
- buttonLeftNewer->SetToolTip(getDescription(SO_OVERWRITE_RIGHT));
- break;
- case SYNC_DIR_LEFT:
- buttonLeftNewer->SetBitmapLabel(GlobalResources::instance().getImage(wxT("arrowLeft")));
- buttonLeftNewer->SetToolTip(getDescription(SO_OVERWRITE_LEFT));
- break;
- case SYNC_DIR_NONE:
- buttonLeftNewer->SetBitmapLabel(GlobalResources::instance().getImage(wxT("arrowNone")));
- buttonLeftNewer->SetToolTip(getDescription(SO_DO_NOTHING));
- break;
- }
-
- switch (syncConfig.rightNewer)
- {
- case SYNC_DIR_RIGHT:
- buttonRightNewer->SetBitmapLabel(GlobalResources::instance().getImage(wxT("arrowRight")));
- buttonRightNewer->SetToolTip(getDescription(SO_OVERWRITE_RIGHT));
- break;
- case SYNC_DIR_LEFT:
- buttonRightNewer->SetBitmapLabel(GlobalResources::instance().getImage(wxT("arrowLeft")));
- buttonRightNewer->SetToolTip(getDescription(SO_OVERWRITE_LEFT));
- break;
- case SYNC_DIR_NONE:
- buttonRightNewer->SetBitmapLabel(GlobalResources::instance().getImage(wxT("arrowNone")));
- buttonRightNewer->SetToolTip(getDescription(SO_DO_NOTHING));
- break;
- }
-
- switch (syncConfig.different)
- {
- case SYNC_DIR_RIGHT:
- buttonDifferent->SetBitmapLabel(GlobalResources::instance().getImage(wxT("arrowRight")));
- buttonDifferent->SetToolTip(getDescription(SO_OVERWRITE_RIGHT));
- break;
- case SYNC_DIR_LEFT:
- buttonDifferent->SetBitmapLabel(GlobalResources::instance().getImage(wxT("arrowLeft")));
- buttonDifferent->SetToolTip(getDescription(SO_OVERWRITE_LEFT));
- break;
- case SYNC_DIR_NONE:
- buttonDifferent->SetBitmapLabel(GlobalResources::instance().getImage(wxT("arrowNone")));
- buttonDifferent->SetToolTip(getDescription(SO_DO_NOTHING));
- break;
- }
- switch (syncConfig.conflict)
- {
- case SYNC_DIR_RIGHT:
- buttonConflict->SetBitmapLabel(GlobalResources::instance().getImage(wxT("arrowRight")));
- buttonConflict->SetToolTip(getDescription(SO_OVERWRITE_RIGHT));
- break;
- case SYNC_DIR_LEFT:
- buttonConflict->SetBitmapLabel(GlobalResources::instance().getImage(wxT("arrowLeft")));
- buttonConflict->SetToolTip(getDescription(SO_OVERWRITE_LEFT));
- break;
- case SYNC_DIR_NONE:
- buttonConflict->SetBitmapLabel(GlobalResources::instance().getImage(wxT("conflict")));
- buttonConflict->SetToolTip(_("Leave as unresolved conflict"));
- break;
- }
+ m_panelCustomDeletionDir->Enable(getEnumVal(enumDelhandDescr, *m_choiceHandleDeletion) == zen::MOVE_TO_CUSTOM_DIRECTORY);
}
@@ -287,142 +362,54 @@ void SyncCfgDialog::OnApply(wxCommandEvent& event)
{
//write configuration to main dialog
refSyncConfiguration = currentSyncConfig;
- refHandleDeletion = getDeletionHandling();
- refCustomDeletionDirectory = zToWx(customDelFolder->getName());
- if (refIgnoreErrors)
- *refIgnoreErrors = getErrorHandling();
-
- EndModal(BUTTON_APPLY);
-}
-
-
-void SyncCfgDialog::updateToolTipErrorHandling(bool ignoreErrors)
-{
- if (ignoreErrors)
- m_choiceHandleError->SetToolTip(_("Hide all error and warning messages"));
- else
- m_choiceHandleError->SetToolTip(_("Show popup on errors or warnings"));
-}
-
-
-bool SyncCfgDialog::getErrorHandling()
-{
- if (m_choiceHandleError->GetSelection() == 1) //Ignore errors
- return true;
- else
- return false; // Show popup
-}
-
+ refHandleDeletion = getEnumVal(enumDelhandDescr, *m_choiceHandleDeletion);
-void SyncCfgDialog::setErrorHandling(bool ignoreErrors)
-{
- m_choiceHandleError->Clear();
- m_choiceHandleError->Append(_("Show popup"));
- m_choiceHandleError->Append(_("Ignore errors"));
-
- if (ignoreErrors)
- m_choiceHandleError->SetSelection(1);
- else
- m_choiceHandleError->SetSelection(0);
+ refCustomDeletionDirectory = customDelFolder.getName();
+ if (refHandleError)
+ *refHandleError = getEnumVal(enumErrhandDescr, *m_choiceHandleError);
- updateToolTipErrorHandling(ignoreErrors);
+ EndModal(ReturnSyncConfig::BUTTON_OKAY);
}
void SyncCfgDialog::OnChangeErrorHandling(wxCommandEvent& event)
{
- updateToolTipErrorHandling(getErrorHandling());
-}
-
-//-------------------
-
-void updateToolTipDeletionHandling(wxChoice* choiceHandleError, wxPanel* customDir, const ffs3::DeletionPolicy value)
-{
- customDir->Disable();
-
- switch (value)
- {
- case ffs3::DELETE_PERMANENTLY:
- choiceHandleError->SetToolTip(_("Delete or overwrite files permanently"));
- break;
-
- case ffs3::MOVE_TO_RECYCLE_BIN:
- choiceHandleError->SetToolTip(_("Use Recycle Bin when deleting or overwriting files"));
- break;
-
- case ffs3::MOVE_TO_CUSTOM_DIRECTORY:
- choiceHandleError->SetToolTip(_("Move files into a time-stamped subdirectory"));
- customDir->Enable();
- break;
- }
-}
-
-
-ffs3::DeletionPolicy SyncCfgDialog::getDeletionHandling()
-{
- switch (m_choiceHandleDeletion->GetSelection())
- {
- case 0:
- return ffs3::DELETE_PERMANENTLY;
- case 1:
- return ffs3::MOVE_TO_RECYCLE_BIN;
- case 2:
- return ffs3::MOVE_TO_CUSTOM_DIRECTORY;
- default:
- assert(false);
- return ffs3::MOVE_TO_RECYCLE_BIN;
- }
+ updateTooltipEnumVal(enumErrhandDescr, *m_choiceHandleError);
}
-void SyncCfgDialog::setDeletionHandling(ffs3::DeletionPolicy newValue)
+void SyncCfgDialog::OnChangeDeletionHandling(wxCommandEvent& event)
{
- m_choiceHandleDeletion->Clear();
- m_choiceHandleDeletion->Append(_("Delete permanently"));
- m_choiceHandleDeletion->Append(_("Use Recycle Bin"));
- m_choiceHandleDeletion->Append(_("Versioning"));
-
- switch (newValue)
- {
- case ffs3::DELETE_PERMANENTLY:
- m_choiceHandleDeletion->SetSelection(0);
- break;
- case ffs3::MOVE_TO_RECYCLE_BIN:
- m_choiceHandleDeletion->SetSelection(1);
- break;
- case ffs3::MOVE_TO_CUSTOM_DIRECTORY:
- m_choiceHandleDeletion->SetSelection(2);
- break;
- }
-
- updateToolTipDeletionHandling(m_choiceHandleDeletion, m_panelCustomDeletionDir, newValue);
+ updateTooltipEnumVal(enumDelhandDescr, *m_choiceHandleDeletion);
+ updateGui();
}
-void SyncCfgDialog::OnChangeDeletionHandling(wxCommandEvent& event)
+void SyncCfgDialog::OnSyncAutomatic(wxCommandEvent& event)
{
- updateToolTipDeletionHandling(m_choiceHandleDeletion, m_panelCustomDeletionDir, getDeletionHandling());
+ currentSyncConfig.var = SyncConfig::AUTOMATIC;
+ updateGui();
}
-void SyncCfgDialog::OnSyncAutomatic(wxCommandEvent& event)
+void SyncCfgDialog::OnSyncMirror(wxCommandEvent& event)
{
- ffs3::setVariant(currentSyncConfig, SyncConfiguration::AUTOMATIC);
- updateConfigIcons(cmpVariant, currentSyncConfig);
+ currentSyncConfig.var = SyncConfig::MIRROR;
+ updateGui();
}
-void SyncCfgDialog::OnSyncLeftToRight(wxCommandEvent& event)
+void SyncCfgDialog::OnSyncUpdate(wxCommandEvent& event)
{
- ffs3::setVariant(currentSyncConfig, SyncConfiguration::MIRROR);
- updateConfigIcons(cmpVariant, currentSyncConfig);
+ currentSyncConfig.var = SyncConfig::UPDATE;
+ updateGui();
}
-void SyncCfgDialog::OnSyncUpdate(wxCommandEvent& event)
+void SyncCfgDialog::OnSyncCustom(wxCommandEvent& event)
{
- ffs3::setVariant(currentSyncConfig, SyncConfiguration::UPDATE);
- updateConfigIcons(cmpVariant, currentSyncConfig);
+ currentSyncConfig.var = SyncConfig::CUSTOM;
+ updateGui();
}
@@ -443,43 +430,104 @@ void toggleSyncDirection(SyncDirection& current)
}
+void pressCustomDir(SyncConfig& syncCfg, SyncDirection& syncdir)
+{
+ switch (syncCfg.var)
+ {
+ case SyncConfig::AUTOMATIC:
+ assert(false);
+ break;
+ case SyncConfig::MIRROR:
+ case SyncConfig::UPDATE:
+ syncCfg.custom = extractDirections(syncCfg);
+ syncCfg.var = SyncConfig::CUSTOM;
+ toggleSyncDirection(syncdir);
+ break;
+ case SyncConfig::CUSTOM:
+ toggleSyncDirection(syncdir);
+
+ //some config optimization: if custom settings happen to match "mirror" or "update", just switch variant
+ DirectionSet currentSet = extractDirections(syncCfg);
+ DirectionSet setMirror;
+ DirectionSet setUpdate;
+ {
+ SyncConfig mirrorCfg;
+ mirrorCfg.var = SyncConfig::MIRROR;
+ setMirror = extractDirections(mirrorCfg);
+ }
+ {
+ SyncConfig updateCfg;
+ updateCfg.var = SyncConfig::UPDATE;
+ setUpdate = extractDirections(updateCfg);
+ }
+
+ if (currentSet == setMirror)
+ syncCfg.var = SyncConfig::MIRROR;
+ else if (currentSet == setUpdate)
+ syncCfg.var = SyncConfig::UPDATE;
+ break;
+ }
+}
+
+
void SyncCfgDialog::OnExLeftSideOnly(wxCommandEvent& event )
{
- toggleSyncDirection(currentSyncConfig.exLeftSideOnly);
- updateConfigIcons(cmpVariant, currentSyncConfig);
+ pressCustomDir(currentSyncConfig, currentSyncConfig.custom.exLeftSideOnly);
+ updateGui();
}
void SyncCfgDialog::OnExRightSideOnly(wxCommandEvent& event )
{
- toggleSyncDirection(currentSyncConfig.exRightSideOnly);
- updateConfigIcons(cmpVariant, currentSyncConfig);
+ pressCustomDir(currentSyncConfig, currentSyncConfig.custom.exRightSideOnly);
+ updateGui();
}
void SyncCfgDialog::OnLeftNewer(wxCommandEvent& event )
{
- toggleSyncDirection(currentSyncConfig.leftNewer);
- updateConfigIcons(cmpVariant, currentSyncConfig);
+ pressCustomDir(currentSyncConfig, currentSyncConfig.custom.leftNewer);
+ updateGui();
}
void SyncCfgDialog::OnRightNewer(wxCommandEvent& event )
{
- toggleSyncDirection(currentSyncConfig.rightNewer);
- updateConfigIcons(cmpVariant, currentSyncConfig);
+ pressCustomDir(currentSyncConfig, currentSyncConfig.custom.rightNewer);
+ updateGui();
}
void SyncCfgDialog::OnDifferent(wxCommandEvent& event )
{
- toggleSyncDirection(currentSyncConfig.different);
- updateConfigIcons(cmpVariant, currentSyncConfig);
+ pressCustomDir(currentSyncConfig, currentSyncConfig.custom.different);
+ updateGui();
}
void SyncCfgDialog::OnConflict(wxCommandEvent& event)
{
- toggleSyncDirection(currentSyncConfig.conflict);
- updateConfigIcons(cmpVariant, currentSyncConfig);
+ pressCustomDir(currentSyncConfig, currentSyncConfig.custom.conflict);
+ updateGui();
}
+
+
+
+
+
+ReturnSyncConfig::ButtonPressed zen::showSyncConfigDlg(zen::CompareVariant compareVar,
+ zen::SyncConfig& syncConfiguration,
+ zen::DeletionPolicy& handleDeletion,
+ wxString& customDeletionDirectory,
+ xmlAccess::OnGuiError* handleError) //optional input parameter
+{
+ SyncCfgDialog syncDlg(NULL,
+ compareVar,
+ syncConfiguration,
+ handleDeletion,
+ customDeletionDirectory,
+ handleError);
+
+ return static_cast<ReturnSyncConfig::ButtonPressed>(syncDlg.ShowModal());
+}
+
diff --git a/ui/sync_cfg.h b/ui/sync_cfg.h
index fb00136a..bd52984b 100644
--- a/ui/sync_cfg.h
+++ b/ui/sync_cfg.h
@@ -7,93 +7,24 @@
#ifndef SYNCCONFIG_H_INCLUDED
#define SYNCCONFIG_H_INCLUDED
-#include <memory>
-#include "gui_generated.h"
-#include "../structures.h"
+#include "../library/process_xml.h"
-
-namespace ffs3
+namespace zen
{
-class DirectoryName;
-}
-
-
-class SyncCfgDialog : public SyncCfgDlgGenerated
+struct ReturnSyncConfig
{
-public:
- SyncCfgDialog(wxWindow* window,
- const ffs3::CompareVariant compareVar,
- ffs3::SyncConfiguration& syncConfiguration,
- ffs3::DeletionPolicy& handleDeletion,
- wxString& customDeletionDirectory,
- bool* ignoreErrors); //optional input parameter
-
- ~SyncCfgDialog();
-
- enum
+ enum ButtonPressed
{
- BUTTON_APPLY = 10
+ BUTTON_CANCEL,
+ BUTTON_OKAY = 1
};
-
- static void updateConfigIcons(const ffs3::CompareVariant compareVar,
- const ffs3::SyncConfiguration& syncConfig,
- wxBitmapButton* buttonLeftOnly,
- wxBitmapButton* buttonRightOnly,
- wxBitmapButton* buttonLeftNewer,
- wxBitmapButton* buttonRightNewer,
- wxBitmapButton* buttonDifferent,
- wxBitmapButton* buttonConflict,
- wxStaticBitmap* bitmapLeftOnly,
- wxStaticBitmap* bitmapRightOnly,
- wxStaticBitmap* bitmapLeftNewer,
- wxStaticBitmap* bitmapRightNewer,
- wxStaticBitmap* bitmapDifferent,
- wxStaticBitmap* bitmapConflict,
- wxSizer* syncDirections);
- //some syntax relaxation
- void updateConfigIcons(const ffs3::CompareVariant cmpVar, const ffs3::SyncConfiguration& syncConfig);
-
-private:
- virtual void OnSyncAutomatic( wxCommandEvent& event);
- virtual void OnSyncLeftToRight( wxCommandEvent& event);
- virtual void OnSyncUpdate( wxCommandEvent& event);
-
- virtual void OnExLeftSideOnly( wxCommandEvent& event);
- virtual void OnExRightSideOnly( wxCommandEvent& event);
- virtual void OnLeftNewer( wxCommandEvent& event);
- virtual void OnRightNewer( wxCommandEvent& event);
- virtual void OnDifferent( wxCommandEvent& event);
- virtual void OnConflict( wxCommandEvent& event);
-
- virtual void OnClose( wxCloseEvent& event);
- virtual void OnCancel( wxCommandEvent& event);
- virtual void OnApply( wxCommandEvent& event);
-
- //set tooltip
- void updateToolTipErrorHandling(bool ignoreErrors);
-
- //error handling
- bool getErrorHandling();
- void setErrorHandling(bool ignoreErrors);
- void OnChangeErrorHandling(wxCommandEvent& event);
-
- //deletion handling
- ffs3::DeletionPolicy getDeletionHandling();
- void setDeletionHandling(ffs3::DeletionPolicy newValue);
- void OnChangeDeletionHandling(wxCommandEvent& event);
-
- const ffs3::CompareVariant cmpVariant;
-
- //temporal copy of maindialog.cfg.syncConfiguration
- ffs3::SyncConfiguration currentSyncConfig;
-
- //changing data
- ffs3::SyncConfiguration& refSyncConfiguration;
- ffs3::DeletionPolicy& refHandleDeletion;
- wxString& refCustomDeletionDirectory;
- bool* refIgnoreErrors;
-
- std::auto_ptr<ffs3::DirectoryName> customDelFolder;
};
+ReturnSyncConfig::ButtonPressed showSyncConfigDlg(zen::CompareVariant compareVar,
+ zen::SyncConfig& syncConfiguration,
+ zen::DeletionPolicy& handleDeletion,
+ wxString& customDeletionDirectory,
+ xmlAccess::OnGuiError* handleError); //optional input parameter
+}
+
#endif // SYNCCONFIG_H_INCLUDED
diff --git a/ui/tray_icon.cpp b/ui/tray_icon.cpp
index d82d5733..278f1888 100644
--- a/ui/tray_icon.cpp
+++ b/ui/tray_icon.cpp
@@ -23,74 +23,118 @@ int roundNum(double d) //little rounding function
}
-wxIcon generateIcon(size_t percent) //generate icon with progress indicator
+void fillRange(wxImage& img, int pixelFirst, int pixelLast, const wxColor& col)
{
- percent = std::min(percent, static_cast<size_t>(100)); //handle invalid input
+ const int pixelCount = img.GetWidth() >= 0 ? img.GetWidth() * img.GetHeight() : -1;
+ if (0 <= pixelFirst && pixelFirst < pixelLast && pixelLast <= pixelCount)
+ {
+ unsigned char* const bytesBegin = img.GetData() + pixelFirst * 3;
+ unsigned char* const bytesEnd = img.GetData() + pixelLast * 3;
+
+ for (unsigned char* bytePos = bytesBegin; bytePos < bytesEnd; bytePos += 3)
+ {
+ bytePos[0] = col.Red ();
+ bytePos[1] = col.Green();
+ bytePos[2] = col.Blue ();
+ }
+
+ if (img.HasAlpha()) //make progress indicator fully opaque:
+ std::fill(img.GetAlpha() + pixelFirst, img.GetAlpha() + pixelLast, wxIMAGE_ALPHA_OPAQUE);
+ }
+}
+
+wxIcon generateIcon(double percent) //generate icon with progress indicator
+{
#ifdef FFS_WIN
static const wxBitmap trayIcon = GlobalResources::instance().getImage(wxT("FFS_tray_win.png"));
#elif defined FFS_LINUX
static const wxBitmap trayIcon = GlobalResources::instance().getImage(wxT("FFS_tray_linux.png"));
#endif
- const int indicatorHeight = roundNum((trayIcon.GetHeight() * percent) / 100.0);
+ const int pixelCount = trayIcon.GetWidth() * trayIcon.GetHeight();
+ const int startFillPixel = std::min(roundNum(percent / 100.0 * pixelCount), pixelCount);
//minor optimization
static std::pair<int, wxIcon> buffer = std::make_pair(-1, wxNullIcon);
- if (buffer.first == indicatorHeight)
+ if (buffer.first == startFillPixel)
return buffer.second;
- wxImage genImage(trayIcon.ConvertToImage());
+ wxIcon genIcon;
+ wxImage genImage(trayIcon.ConvertToImage());
if (genImage.GetWidth() > 0 &&
genImage.GetHeight() > 0)
{
- const int indicatorWidth = genImage.GetWidth() * .4;
- const int indicatorXBegin = std::ceil((genImage.GetWidth() - indicatorWidth) / 2.0);
- const int indicatorYBegin = genImage.GetHeight() - indicatorHeight;
-
- //draw progress indicator: do NOT use wxDC::DrawRectangle! Doesn't respect alpha in Windows, but does in Linux!
- //We need a simple, working solution:
- unsigned char* const data = genImage.GetData();
-
- for (int row = indicatorYBegin; row < genImage.GetHeight(); ++row)
+ //fill black border row
+ if (startFillPixel <= pixelCount - genImage.GetWidth())
{
- for (int col = indicatorXBegin; col < indicatorXBegin + indicatorWidth; ++col)
- {
- unsigned char* const pixelBegin = data + (row * genImage.GetWidth() + col) * 3;
- pixelBegin[0] = 240; //red
- pixelBegin[1] = 200; //green
- pixelBegin[2] = 0; //blue
- }
+ /*
+ --------
+ ---bbbbb
+ bbbbSyyy S : start yellow remainder
+ yyyyyyyy
+ */
+ int bStart = startFillPixel - genImage.GetWidth();
+ if (bStart % genImage.GetWidth() != 0) //add one more black pixel, see ascii-art
+ --bStart;
+ fillRange(genImage, std::max(bStart, 0), startFillPixel, *wxBLACK);
}
-
- if (genImage.HasAlpha())
+ else if (startFillPixel != pixelCount)
{
- unsigned char* const alpha = genImage.GetAlpha();
- //make progress indicator fully opaque:
- for (int row = indicatorYBegin; row < genImage.GetHeight(); ++row)
- ::memset(alpha + row * genImage.GetWidth() + indicatorXBegin, wxIMAGE_ALPHA_OPAQUE, indicatorWidth);
+ //special handling for last row
+ /*
+ --------
+ --------
+ ---bbbbb
+ ---bSyyy S : start yellow remainder
+ */
+ int bStart = startFillPixel - genImage.GetWidth() - 1;
+ int bEnd = (bStart / genImage.GetWidth() + 1) * (genImage.GetWidth());
+
+ fillRange(genImage, std::max(bStart, 0), bEnd, *wxBLACK);
+ fillRange(genImage, startFillPixel - 1, startFillPixel, *wxBLACK);
}
- wxIcon genIcon;
+ //fill yellow remainder
+ fillRange(genImage, startFillPixel, pixelCount, wxColour(240, 200, 0));
+
+ /*
+ const int indicatorWidth = genImage.GetWidth() * .4;
+ const int indicatorXBegin = std::ceil((genImage.GetWidth() - indicatorWidth) / 2.0);
+ const int indicatorYBegin = genImage.GetHeight() - indicatorHeight;
+
+ //draw progress indicator: do NOT use wxDC::DrawRectangle! Doesn't respect alpha in Windows, but does in Linux!
+ //We need a simple, working solution:
+
+ for (int row = indicatorYBegin; row < genImage.GetHeight(); ++row)
+ {
+ for (int col = indicatorXBegin; col < indicatorXBegin + indicatorWidth; ++col)
+ {
+ unsigned char* const pixelBegin = data + (row * genImage.GetWidth() + col) * 3;
+ pixelBegin[0] = 240; //red
+ pixelBegin[1] = 200; //green
+ pixelBegin[2] = 0; //blue
+ }
+ }
+
+ if (genImage.HasAlpha())
+ {
+ unsigned char* const alpha = genImage.GetAlpha();
+ //make progress indicator fully opaque:
+ for (int row = indicatorYBegin; row < genImage.GetHeight(); ++row)
+ ::memset(alpha + row * genImage.GetWidth() + indicatorXBegin, wxIMAGE_ALPHA_OPAQUE, indicatorWidth);
+ }
+ */
genIcon.CopyFromBitmap(wxBitmap(genImage));
-
- //fill buffer
- buffer.first = indicatorHeight;
- buffer.second = genIcon;
-
- return genIcon;
}
-
- //fallback
- wxIcon defaultIcon;
- defaultIcon.CopyFromBitmap(trayIcon);
+ else //fallback
+ genIcon.CopyFromBitmap(trayIcon);
//fill buffer
- buffer.first = indicatorHeight;
- buffer.second = defaultIcon;
-
- return defaultIcon;
+ buffer.first = startFillPixel;
+ buffer.second = genIcon;
+ return genIcon;
}
}
@@ -183,7 +227,7 @@ void MinimizeToTray::resumeFromTray() //remove trayIcon and restore windows: Mi
}
-void MinimizeToTray::setToolTip(const wxString& toolTipText, size_t percent)
+void MinimizeToTray::setToolTip(const wxString& toolTipText, double percent)
{
if (trayIcon)
trayIcon->SetIcon(generateIcon(percent), toolTipText);
@@ -203,7 +247,7 @@ void MinimizeToTray::OnContextMenuSelection(wxCommandEvent& event)
switch (eventId)
{
case CONTEXT_ABOUT:
- ffs3::showAboutDialog();
+ zen::showAboutDialog();
break;
case CONTEXT_RESTORE:
resumeFromTray();
diff --git a/ui/tray_icon.h b/ui/tray_icon.h
index af9200d1..8b5b5851 100644
--- a/ui/tray_icon.h
+++ b/ui/tray_icon.h
@@ -17,7 +17,7 @@ public:
MinimizeToTray(wxTopLevelWindow* callerWnd, wxTopLevelWindow* secondWnd = NULL); //ensure both windows have longer lifetime than this instance!
~MinimizeToTray(); //show windows again
- void setToolTip(const wxString& toolTipText, size_t percent = 0); //percent (optional), number between [0, 100], for small progress indicator
+ void setToolTip(const wxString& toolTipText, double percent = 0); //percent (optional), number between [0, 100], for small progress indicator
void keepHidden(); //do not show windows again: avoid window flashing shortly before it is destroyed
private:
bgstack15