diff options
author | Daniel Wilhelm <daniel@wili.li> | 2014-04-18 16:44:25 +0200 |
---|---|---|
committer | Daniel Wilhelm <daniel@wili.li> | 2014-04-18 16:44:25 +0200 |
commit | c63d9b438572f06f555e2232a15bd3c46bd10546 (patch) | |
tree | 92f2eca00f2a915078ee979acf26906670d75e5f /ui | |
download | FreeFileSync-c63d9b438572f06f555e2232a15bd3c46bd10546.tar.gz FreeFileSync-c63d9b438572f06f555e2232a15bd3c46bd10546.tar.bz2 FreeFileSync-c63d9b438572f06f555e2232a15bd3c46bd10546.zip |
1.2
Diffstat (limited to 'ui')
-rw-r--r-- | ui/GUI_Generated.cpp | 1189 | ||||
-rw-r--r-- | ui/GUI_Generated.h | 371 | ||||
-rw-r--r-- | ui/MainDialog.cpp | 1719 | ||||
-rw-r--r-- | ui/MainDialog.h | 220 | ||||
-rw-r--r-- | ui/Resources.cpp | 111 | ||||
-rw-r--r-- | ui/Resources.h | 59 | ||||
-rw-r--r-- | ui/SmallDialogs.cpp | 229 | ||||
-rw-r--r-- | ui/SmallDialogs.h | 99 | ||||
-rw-r--r-- | ui/SyncDialog.cpp | 250 | ||||
-rw-r--r-- | ui/SyncDialog.h | 40 |
10 files changed, 4287 insertions, 0 deletions
diff --git a/ui/GUI_Generated.cpp b/ui/GUI_Generated.cpp new file mode 100644 index 00000000..fc88dd7d --- /dev/null +++ b/ui/GUI_Generated.cpp @@ -0,0 +1,1189 @@ +/////////////////////////////////////////////////////////////////////////// +// C++ code generated with wxFormBuilder (version Apr 16 2008) +// http://www.wxformbuilder.org/ +// +// PLEASE DO "NOT" EDIT THIS FILE! +/////////////////////////////////////////////////////////////////////////// + +#include "wx/wxprec.h" + +#ifdef __BORLANDC__ +#pragma hdrstop +#endif //__BORLANDC__ + +#ifndef WX_PRECOMP +#include <wx/wx.h> +#endif //WX_PRECOMP + +#include "..\library\CustomGrid.h" + +#include "GUI_Generated.h" + +/////////////////////////////////////////////////////////////////////////// + +GUI_Generated::GUI_Generated( wxWindow* parent, wxWindowID id, const wxString& title, const wxPoint& pos, const wxSize& size, long style ) : wxFrame( parent, id, title, pos, size, style ) +{ + this->SetSizeHints( wxDefaultSize, wxDefaultSize ); + + bSizer1 = new wxBoxSizer( wxVERTICAL ); + + wxBoxSizer* bSizer6; + bSizer6 = new wxBoxSizer( wxHORIZONTAL ); + + + bSizer6->Add( 40, 0, 0, wxEXPAND, 5 ); + + wxBoxSizer* bSizer30; + bSizer30 = new wxBoxSizer( wxHORIZONTAL ); + + m_bpButtonCompare = new wxBitmapButton( this, wxID_ANY, wxNullBitmap, wxDefaultPosition, wxSize( 190,37 ), wxBU_AUTODRAW|wxFULL_REPAINT_ON_RESIZE ); + m_bpButtonCompare->SetToolTip( _("Compare both sides") ); + + m_bpButtonCompare->SetToolTip( _("Compare both sides") ); + + bSizer30->Add( m_bpButtonCompare, 0, wxALIGN_CENTER_VERTICAL|wxALIGN_CENTER_HORIZONTAL|wxRIGHT|wxLEFT, 5 ); + + m_buttonAbort = new wxButton( this, wxID_ANY, _("Abort"), wxDefaultPosition, wxSize( 186,33 ), 0 ); + m_buttonAbort->SetFont( wxFont( 14, 74, 90, 92, false, wxT("Tahoma") ) ); + m_buttonAbort->Hide(); + + bSizer30->Add( m_buttonAbort, 0, wxALIGN_CENTER_VERTICAL|wxALIGN_CENTER_HORIZONTAL|wxRIGHT|wxLEFT, 5 ); + + bSizer6->Add( bSizer30, 0, wxALIGN_CENTER_VERTICAL, 5 ); + + wxStaticBoxSizer* sbSizer6; + sbSizer6 = new wxStaticBoxSizer( new wxStaticBox( this, wxID_ANY, _("Compare by") ), wxVERTICAL ); + + m_radioBtnSizeDate = new wxRadioButton( this, wxID_ANY, _("File size and date"), wxDefaultPosition, wxDefaultSize, 0 ); + m_radioBtnSizeDate->SetValue( true ); + m_radioBtnSizeDate->SetToolTip( _("Files are found equal if\n - filesize\n - last write time (UTC) and date\nare the same.") ); + + sbSizer6->Add( m_radioBtnSizeDate, 0, wxRIGHT|wxLEFT, 5 ); + + m_radioBtnContent = new wxRadioButton( this, wxID_ANY, _("File content"), wxDefaultPosition, wxDefaultSize, 0 ); + m_radioBtnContent->SetToolTip( _("Files are found equal if\n - file content\nis the same.") ); + + sbSizer6->Add( m_radioBtnContent, 0, wxTOP|wxRIGHT|wxLEFT, 5 ); + + bSizer6->Add( sbSizer6, 0, wxALIGN_CENTER_VERTICAL|wxBOTTOM, 2 ); + + m_bpButton14 = new wxBitmapButton( this, wxID_ANY, wxNullBitmap, wxDefaultPosition, wxSize( 40,40 ), wxBU_AUTODRAW ); + bSizer6->Add( m_bpButton14, 0, wxALIGN_CENTER_VERTICAL|wxALL, 5 ); + + + bSizer6->Add( 0, 0, 1, wxEXPAND, 5 ); + + wxStaticBoxSizer* sbSizer9; + sbSizer9 = new wxStaticBoxSizer( new wxStaticBox( this, wxID_ANY, _("Filter files") ), wxHORIZONTAL ); + + m_bpButtonFilter = new wxBitmapButton( this, wxID_ANY, wxNullBitmap, wxDefaultPosition, wxSize( 40,40 ), wxBU_AUTODRAW|wxFULL_REPAINT_ON_RESIZE ); + sbSizer9->Add( m_bpButtonFilter, 0, wxALIGN_CENTER_VERTICAL|wxRIGHT|wxLEFT, 5 ); + + wxBoxSizer* bSizer23; + bSizer23 = new wxBoxSizer( wxVERTICAL ); + + m_hyperlinkCfgFilter = new wxHyperlinkCtrl( this, wxID_ANY, _("Configure Filter..."), wxEmptyString, wxDefaultPosition, wxDefaultSize, wxHL_DEFAULT_STYLE ); + + m_hyperlinkCfgFilter->SetNormalColour( wxColour( 0, 0, 255 ) ); + m_hyperlinkCfgFilter->SetVisitedColour( wxColour( 0, 0, 255 ) ); + m_hyperlinkCfgFilter->SetBackgroundColour( wxSystemSettings::GetColour( wxSYS_COLOUR_APPWORKSPACE ) ); + + bSizer23->Add( m_hyperlinkCfgFilter, 0, wxALL, 5 ); + + m_checkBoxHideFilt = new wxCheckBox( this, wxID_ANY, _("Hide filtered items"), wxDefaultPosition, wxDefaultSize, 0 ); + + m_checkBoxHideFilt->SetToolTip( _("Choose to hide filtered files/directories from list") ); + + bSizer23->Add( m_checkBoxHideFilt, 0, 0, 5 ); + + sbSizer9->Add( bSizer23, 1, wxEXPAND, 5 ); + + bSizer6->Add( sbSizer9, 0, wxALIGN_CENTER_VERTICAL, 5 ); + + m_bpButtonSync = new wxBitmapButton( this, wxID_ANY, wxNullBitmap, wxDefaultPosition, wxSize( 190,37 ), wxBU_AUTODRAW|wxFULL_REPAINT_ON_RESIZE ); + m_bpButtonSync->SetToolTip( _("Open synchronization dialog") ); + + m_bpButtonSync->SetToolTip( _("Open synchronization dialog") ); + + bSizer6->Add( m_bpButtonSync, 0, wxALIGN_CENTER_VERTICAL|wxRIGHT|wxLEFT, 5 ); + + + bSizer6->Add( 40, 0, 0, wxEXPAND, 5 ); + + bSizer1->Add( bSizer6, 0, wxEXPAND|wxALIGN_CENTER_HORIZONTAL, 5 ); + + wxBoxSizer* bSizer2; + bSizer2 = new wxBoxSizer( wxHORIZONTAL ); + + m_panel1 = new wxPanel( this, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxTAB_TRAVERSAL ); + wxBoxSizer* bSizer7; + bSizer7 = new wxBoxSizer( wxVERTICAL ); + + wxStaticBoxSizer* sbSizer2; + sbSizer2 = new wxStaticBoxSizer( new wxStaticBox( m_panel1, wxID_ANY, _("Drag && drop") ), wxHORIZONTAL ); + + m_directoryPanel1 = new wxTextCtrl( m_panel1, wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0 ); + sbSizer2->Add( m_directoryPanel1, 1, wxALIGN_BOTTOM, 5 ); + + m_dirPicker1 = new wxDirPickerCtrl( m_panel1, wxID_ANY, wxEmptyString, _("Select a folder"), wxDefaultPosition, wxDefaultSize, wxDIRP_DIR_MUST_EXIST ); + sbSizer2->Add( m_dirPicker1, 0, wxALIGN_BOTTOM, 5 ); + + bSizer7->Add( sbSizer2, 0, wxEXPAND, 5 ); + + m_grid1 = new CustomGrid( m_panel1, wxID_ANY, wxDefaultPosition, wxDefaultSize, 0 ); + + // Grid + m_grid1->CreateGrid( 15, 4 ); + m_grid1->EnableEditing( false ); + m_grid1->EnableGridLines( true ); + m_grid1->EnableDragGridSize( true ); + m_grid1->SetMargins( 0, 0 ); + + // Columns + m_grid1->SetColSize( 0, 138 ); + m_grid1->SetColSize( 1, 118 ); + m_grid1->SetColSize( 2, 67 ); + m_grid1->SetColSize( 3, 113 ); + m_grid1->EnableDragColMove( false ); + m_grid1->EnableDragColSize( true ); + m_grid1->SetColLabelSize( 20 ); + m_grid1->SetColLabelValue( 0, _("Filename") ); + m_grid1->SetColLabelValue( 1, _("Relative path") ); + m_grid1->SetColLabelValue( 2, _("Size") ); + m_grid1->SetColLabelValue( 3, _("Date") ); + m_grid1->SetColLabelAlignment( wxALIGN_LEFT, wxALIGN_CENTRE ); + + // Rows + m_grid1->EnableDragRowSize( false ); + m_grid1->SetRowLabelSize( 38 ); + m_grid1->SetRowLabelAlignment( wxALIGN_CENTRE, wxALIGN_CENTRE ); + + // Label Appearance + + // Cell Defaults + m_grid1->SetDefaultCellAlignment( wxALIGN_LEFT, wxALIGN_CENTRE ); + bSizer7->Add( m_grid1, 1, wxALIGN_CENTER_VERTICAL|wxEXPAND|wxALL, 5 ); + + m_panel1->SetSizer( bSizer7 ); + m_panel1->Layout(); + bSizer7->Fit( m_panel1 ); + bSizer2->Add( m_panel1, 1, wxEXPAND|wxLEFT, 5 ); + + m_panel3 = new wxPanel( this, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxTAB_TRAVERSAL ); + wxBoxSizer* bSizer18; + bSizer18 = new wxBoxSizer( wxVERTICAL ); + + m_bpButtonSwap = new wxBitmapButton( m_panel3, wxID_ANY, wxNullBitmap, wxDefaultPosition, wxSize( 42,42 ), wxBU_AUTODRAW ); + m_bpButtonSwap->SetToolTip( _("Swap sides") ); + + m_bpButtonSwap->SetToolTip( _("Swap sides") ); + + bSizer18->Add( m_bpButtonSwap, 0, wxTOP|wxALIGN_CENTER_HORIZONTAL, 3 ); + + m_grid3 = new CustomGrid( m_panel3, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxSUNKEN_BORDER ); + + // Grid + m_grid3->CreateGrid( 15, 1 ); + m_grid3->EnableEditing( false ); + m_grid3->EnableGridLines( true ); + m_grid3->EnableDragGridSize( false ); + m_grid3->SetMargins( 0, 50 ); + + // Columns + m_grid3->SetColSize( 0, 45 ); + m_grid3->EnableDragColMove( false ); + m_grid3->EnableDragColSize( false ); + m_grid3->SetColLabelSize( 20 ); + m_grid3->SetColLabelValue( 0, _("Filter") ); + m_grid3->SetColLabelAlignment( wxALIGN_CENTRE, wxALIGN_CENTRE ); + + // Rows + m_grid3->EnableDragRowSize( false ); + m_grid3->SetRowLabelSize( 0 ); + m_grid3->SetRowLabelAlignment( wxALIGN_CENTRE, wxALIGN_CENTRE ); + + // Label Appearance + + // Cell Defaults + m_grid3->SetDefaultCellFont( wxFont( 12, 74, 90, 92, false, wxT("Arial") ) ); + m_grid3->SetDefaultCellAlignment( wxALIGN_CENTRE, wxALIGN_CENTRE ); + bSizer18->Add( m_grid3, 1, wxBOTTOM|wxTOP|wxALIGN_CENTER_HORIZONTAL, 3 ); + + m_panel3->SetSizer( bSizer18 ); + m_panel3->Layout(); + bSizer18->Fit( m_panel3 ); + bSizer2->Add( m_panel3, 0, wxEXPAND|wxRIGHT|wxLEFT, 5 ); + + m_panel2 = new wxPanel( this, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxTAB_TRAVERSAL ); + wxBoxSizer* bSizer10; + bSizer10 = new wxBoxSizer( wxVERTICAL ); + + wxStaticBoxSizer* sbSizer3; + sbSizer3 = new wxStaticBoxSizer( new wxStaticBox( m_panel2, wxID_ANY, _("Drag && drop") ), wxHORIZONTAL ); + + m_directoryPanel2 = new wxTextCtrl( m_panel2, wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0 ); + sbSizer3->Add( m_directoryPanel2, 1, wxALIGN_BOTTOM, 5 ); + + m_dirPicker2 = new wxDirPickerCtrl( m_panel2, wxID_ANY, wxEmptyString, _("Select a folder"), wxDefaultPosition, wxDefaultSize, wxDIRP_DIR_MUST_EXIST ); + sbSizer3->Add( m_dirPicker2, 0, wxALIGN_BOTTOM, 5 ); + + bSizer10->Add( sbSizer3, 0, wxEXPAND, 5 ); + + m_grid2 = new CustomGrid( m_panel2, wxID_ANY, wxDefaultPosition, wxDefaultSize, 0 ); + + // Grid + m_grid2->CreateGrid( 15, 4 ); + m_grid2->EnableEditing( false ); + m_grid2->EnableGridLines( true ); + m_grid2->EnableDragGridSize( true ); + m_grid2->SetMargins( 0, 0 ); + + // Columns + m_grid2->SetColSize( 0, 138 ); + m_grid2->SetColSize( 1, 118 ); + m_grid2->SetColSize( 2, 67 ); + m_grid2->SetColSize( 3, 113 ); + m_grid2->EnableDragColMove( false ); + m_grid2->EnableDragColSize( true ); + m_grid2->SetColLabelSize( 20 ); + m_grid2->SetColLabelValue( 0, _("Filename") ); + m_grid2->SetColLabelValue( 1, _("Relative path") ); + m_grid2->SetColLabelValue( 2, _("Size") ); + m_grid2->SetColLabelValue( 3, _("Date") ); + m_grid2->SetColLabelAlignment( wxALIGN_LEFT, wxALIGN_CENTRE ); + + // Rows + m_grid2->EnableDragRowSize( false ); + m_grid2->SetRowLabelSize( 38 ); + m_grid2->SetRowLabelAlignment( wxALIGN_CENTRE, wxALIGN_CENTRE ); + + // Label Appearance + + // Cell Defaults + m_grid2->SetDefaultCellAlignment( wxALIGN_LEFT, wxALIGN_CENTRE ); + bSizer10->Add( m_grid2, 1, wxALL|wxALIGN_CENTER_VERTICAL|wxEXPAND, 5 ); + + m_panel2->SetSizer( bSizer10 ); + m_panel2->Layout(); + bSizer10->Fit( m_panel2 ); + bSizer2->Add( m_panel2, 1, wxEXPAND|wxRIGHT, 5 ); + + bSizer1->Add( bSizer2, 1, wxEXPAND, 5 ); + + m_panel4 = new wxPanel( this, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxTAB_TRAVERSAL ); + wxBoxSizer* bSizer3; + bSizer3 = new wxBoxSizer( wxHORIZONTAL ); + + m_bpButton11 = new wxBitmapButton( m_panel4, wxID_ANY, wxNullBitmap, wxDefaultPosition, wxSize( 50,50 ), wxBU_AUTODRAW ); + m_bpButton11->SetToolTip( _("About") ); + + m_bpButton11->SetToolTip( _("About") ); + + bSizer3->Add( m_bpButton11, 0, wxALIGN_CENTER_VERTICAL|wxALL, 5 ); + + + bSizer3->Add( 0, 0, 1, wxEXPAND, 5 ); + + wxStaticBoxSizer* sbSizer31; + sbSizer31 = new wxStaticBoxSizer( new wxStaticBox( m_panel4, wxID_ANY, _("Filter view") ), wxHORIZONTAL ); + + m_bpButton20 = new wxBitmapButton( m_panel4, wxID_ANY, wxNullBitmap, wxDefaultPosition, wxSize( 40,40 ), wxBU_AUTODRAW ); + m_bpButton20->SetToolTip( _("Files that exist on left view only") ); + + m_bpButton20->SetToolTip( _("Files that exist on left view only") ); + + sbSizer31->Add( m_bpButton20, 0, wxALIGN_CENTER_VERTICAL, 5 ); + + m_bpButton21 = new wxBitmapButton( m_panel4, wxID_ANY, wxNullBitmap, wxDefaultPosition, wxSize( 40,40 ), wxBU_AUTODRAW ); + m_bpButton21->SetToolTip( _("Files that are newer on left") ); + + m_bpButton21->SetToolTip( _("Files that are newer on left") ); + + sbSizer31->Add( m_bpButton21, 0, wxALIGN_CENTER_VERTICAL, 5 ); + + m_bpButton25 = new wxBitmapButton( m_panel4, wxID_ANY, wxNullBitmap, wxDefaultPosition, wxSize( 40,40 ), wxBU_AUTODRAW ); + m_bpButton25->SetToolTip( _("Files that are equal") ); + + m_bpButton25->SetToolTip( _("Files that are equal") ); + + sbSizer31->Add( m_bpButton25, 0, wxALIGN_CENTER_VERTICAL, 5 ); + + m_bpButton22 = new wxBitmapButton( m_panel4, wxID_ANY, wxNullBitmap, wxDefaultPosition, wxSize( 40,40 ), wxBU_AUTODRAW ); + m_bpButton22->SetToolTip( _("Files that are different") ); + + m_bpButton22->SetToolTip( _("Files that are different") ); + + sbSizer31->Add( m_bpButton22, 0, wxALIGN_CENTER_VERTICAL, 5 ); + + m_bpButton23 = new wxBitmapButton( m_panel4, wxID_ANY, wxNullBitmap, wxDefaultPosition, wxSize( 40,40 ), wxBU_AUTODRAW ); + m_bpButton23->SetToolTip( _("Files that are newer on right") ); + + m_bpButton23->SetToolTip( _("Files that are newer on right") ); + + sbSizer31->Add( m_bpButton23, 0, wxALIGN_CENTER_VERTICAL, 5 ); + + m_bpButton24 = new wxBitmapButton( m_panel4, wxID_ANY, wxNullBitmap, wxDefaultPosition, wxSize( 40,40 ), wxBU_AUTODRAW ); + m_bpButton24->SetToolTip( _("Files that exist on right view only") ); + + m_bpButton24->SetToolTip( _("Files that exist on right view only") ); + + sbSizer31->Add( m_bpButton24, 0, wxALIGN_CENTER_VERTICAL, 5 ); + + bSizer3->Add( sbSizer31, 0, wxALIGN_CENTER_VERTICAL, 5 ); + + + bSizer3->Add( 0, 0, 1, wxEXPAND, 5 ); + + m_bpButton10 = new wxBitmapButton( m_panel4, wxID_ANY, wxNullBitmap, wxDefaultPosition, wxSize( 50,50 ), wxBU_AUTODRAW ); + m_bpButton10->SetToolTip( _("Quit") ); + + m_bpButton10->SetToolTip( _("Quit") ); + + bSizer3->Add( m_bpButton10, 0, wxALIGN_CENTER_VERTICAL|wxALL, 5 ); + + m_panel4->SetSizer( bSizer3 ); + m_panel4->Layout(); + bSizer3->Fit( m_panel4 ); + bSizer1->Add( m_panel4, 0, wxALIGN_CENTER_HORIZONTAL|wxEXPAND|wxRIGHT|wxLEFT, 5 ); + + this->SetSizer( bSizer1 ); + this->Layout(); + m_statusBar1 = this->CreateStatusBar( 5, wxST_SIZEGRIP, wxID_ANY ); + + // Connect Events + this->Connect( wxEVT_CLOSE_WINDOW, wxCloseEventHandler( GUI_Generated::OnClose ) ); + m_bpButtonCompare->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( GUI_Generated::OnCompare ), NULL, this ); + m_buttonAbort->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( GUI_Generated::OnAbortCompare ), NULL, this ); + m_radioBtnSizeDate->Connect( wxEVT_COMMAND_RADIOBUTTON_SELECTED, wxCommandEventHandler( GUI_Generated::OnChangeCompareVariant ), NULL, this ); + m_radioBtnContent->Connect( wxEVT_COMMAND_RADIOBUTTON_SELECTED, wxCommandEventHandler( GUI_Generated::OnChangeCompareVariant ), NULL, this ); + m_bpButton14->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( GUI_Generated::OnShowHelpDialog ), NULL, this ); + m_bpButtonFilter->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( GUI_Generated::OnFilterButton ), NULL, this ); + m_hyperlinkCfgFilter->Connect( wxEVT_COMMAND_HYPERLINK, wxHyperlinkEventHandler( GUI_Generated::OnConfigureFilter ), NULL, this ); + m_checkBoxHideFilt->Connect( wxEVT_COMMAND_CHECKBOX_CLICKED, wxCommandEventHandler( GUI_Generated::OnHideFilteredButton ), NULL, this ); + m_bpButtonSync->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( GUI_Generated::OnSync ), NULL, this ); + m_directoryPanel1->Connect( wxEVT_COMMAND_TEXT_UPDATED, wxCommandEventHandler( GUI_Generated::OnEnterLeftDir ), NULL, this ); + m_dirPicker1->Connect( wxEVT_COMMAND_DIRPICKER_CHANGED, wxFileDirPickerEventHandler( GUI_Generated::OnDirChangedPanel1 ), NULL, this ); + m_grid1->Connect( wxEVT_GRID_CELL_LEFT_DCLICK, wxGridEventHandler( GUI_Generated::OnLeftGridDoubleClick ), NULL, this ); + m_grid1->Connect( wxEVT_GRID_LABEL_LEFT_CLICK, wxGridEventHandler( GUI_Generated::OnSortLeftGrid ), NULL, this ); + m_bpButtonSwap->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( GUI_Generated::OnSwapDirs ), NULL, this ); + m_grid3->Connect( wxEVT_GRID_RANGE_SELECT, wxGridRangeSelectEventHandler( GUI_Generated::OnGrid3SelectRange ), NULL, this ); + m_grid3->Connect( wxEVT_GRID_SELECT_CELL, wxGridEventHandler( GUI_Generated::OnGrid3SelectCell ), NULL, this ); + m_directoryPanel2->Connect( wxEVT_COMMAND_TEXT_UPDATED, wxCommandEventHandler( GUI_Generated::OnEnterRightDir ), NULL, this ); + m_dirPicker2->Connect( wxEVT_COMMAND_DIRPICKER_CHANGED, wxFileDirPickerEventHandler( GUI_Generated::OnDirChangedPanel2 ), NULL, this ); + m_grid2->Connect( wxEVT_GRID_CELL_LEFT_DCLICK, wxGridEventHandler( GUI_Generated::OnRightGridDoubleClick ), NULL, this ); + m_grid2->Connect( wxEVT_GRID_LABEL_LEFT_CLICK, wxGridEventHandler( GUI_Generated::OnSortRightGrid ), NULL, this ); + m_bpButton11->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( GUI_Generated::OnAbout ), NULL, this ); + m_bpButton20->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( GUI_Generated::OnLeftOnlyFiles ), NULL, this ); + m_bpButton21->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( GUI_Generated::OnLeftNewerFiles ), NULL, this ); + m_bpButton25->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( GUI_Generated::OnEqualFiles ), NULL, this ); + m_bpButton22->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( GUI_Generated::OnDifferentFiles ), NULL, this ); + m_bpButton23->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( GUI_Generated::OnRightNewerFiles ), NULL, this ); + m_bpButton24->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( GUI_Generated::OnRightOnlyFiles ), NULL, this ); + m_bpButton10->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( GUI_Generated::OnQuit ), NULL, this ); +} + +GUI_Generated::~GUI_Generated() +{ + // Disconnect Events + this->Disconnect( wxEVT_CLOSE_WINDOW, wxCloseEventHandler( GUI_Generated::OnClose ) ); + m_bpButtonCompare->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( GUI_Generated::OnCompare ), NULL, this ); + m_buttonAbort->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( GUI_Generated::OnAbortCompare ), NULL, this ); + m_radioBtnSizeDate->Disconnect( wxEVT_COMMAND_RADIOBUTTON_SELECTED, wxCommandEventHandler( GUI_Generated::OnChangeCompareVariant ), NULL, this ); + m_radioBtnContent->Disconnect( wxEVT_COMMAND_RADIOBUTTON_SELECTED, wxCommandEventHandler( GUI_Generated::OnChangeCompareVariant ), NULL, this ); + m_bpButton14->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( GUI_Generated::OnShowHelpDialog ), NULL, this ); + m_bpButtonFilter->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( GUI_Generated::OnFilterButton ), NULL, this ); + m_hyperlinkCfgFilter->Disconnect( wxEVT_COMMAND_HYPERLINK, wxHyperlinkEventHandler( GUI_Generated::OnConfigureFilter ), NULL, this ); + m_checkBoxHideFilt->Disconnect( wxEVT_COMMAND_CHECKBOX_CLICKED, wxCommandEventHandler( GUI_Generated::OnHideFilteredButton ), NULL, this ); + m_bpButtonSync->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( GUI_Generated::OnSync ), NULL, this ); + m_directoryPanel1->Disconnect( wxEVT_COMMAND_TEXT_UPDATED, wxCommandEventHandler( GUI_Generated::OnEnterLeftDir ), NULL, this ); + m_dirPicker1->Disconnect( wxEVT_COMMAND_DIRPICKER_CHANGED, wxFileDirPickerEventHandler( GUI_Generated::OnDirChangedPanel1 ), NULL, this ); + m_grid1->Disconnect( wxEVT_GRID_CELL_LEFT_DCLICK, wxGridEventHandler( GUI_Generated::OnLeftGridDoubleClick ), NULL, this ); + m_grid1->Disconnect( wxEVT_GRID_LABEL_LEFT_CLICK, wxGridEventHandler( GUI_Generated::OnSortLeftGrid ), NULL, this ); + m_bpButtonSwap->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( GUI_Generated::OnSwapDirs ), NULL, this ); + m_grid3->Disconnect( wxEVT_GRID_RANGE_SELECT, wxGridRangeSelectEventHandler( GUI_Generated::OnGrid3SelectRange ), NULL, this ); + m_grid3->Disconnect( wxEVT_GRID_SELECT_CELL, wxGridEventHandler( GUI_Generated::OnGrid3SelectCell ), NULL, this ); + m_directoryPanel2->Disconnect( wxEVT_COMMAND_TEXT_UPDATED, wxCommandEventHandler( GUI_Generated::OnEnterRightDir ), NULL, this ); + m_dirPicker2->Disconnect( wxEVT_COMMAND_DIRPICKER_CHANGED, wxFileDirPickerEventHandler( GUI_Generated::OnDirChangedPanel2 ), NULL, this ); + m_grid2->Disconnect( wxEVT_GRID_CELL_LEFT_DCLICK, wxGridEventHandler( GUI_Generated::OnRightGridDoubleClick ), NULL, this ); + m_grid2->Disconnect( wxEVT_GRID_LABEL_LEFT_CLICK, wxGridEventHandler( GUI_Generated::OnSortRightGrid ), NULL, this ); + m_bpButton11->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( GUI_Generated::OnAbout ), NULL, this ); + m_bpButton20->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( GUI_Generated::OnLeftOnlyFiles ), NULL, this ); + m_bpButton21->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( GUI_Generated::OnLeftNewerFiles ), NULL, this ); + m_bpButton25->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( GUI_Generated::OnEqualFiles ), NULL, this ); + m_bpButton22->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( GUI_Generated::OnDifferentFiles ), NULL, this ); + m_bpButton23->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( GUI_Generated::OnRightNewerFiles ), NULL, this ); + m_bpButton24->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( GUI_Generated::OnRightOnlyFiles ), NULL, this ); + m_bpButton10->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( GUI_Generated::OnQuit ), NULL, this ); +} + +SyncDialogGenerated::SyncDialogGenerated( wxWindow* parent, wxWindowID id, const wxString& title, const wxPoint& pos, const wxSize& size, long style ) : wxDialog( parent, id, title, pos, size, style ) +{ + this->SetSizeHints( wxDefaultSize, wxDefaultSize ); + + wxBoxSizer* bSizer7; + bSizer7 = new wxBoxSizer( wxVERTICAL ); + + wxBoxSizer* bSizer181; + bSizer181 = new wxBoxSizer( wxHORIZONTAL ); + + + bSizer181->Add( 5, 0, 0, wxEXPAND, 5 ); + + wxBoxSizer* bSizer29; + bSizer29 = new wxBoxSizer( wxVERTICAL ); + + + bSizer29->Add( 0, 5, 0, wxEXPAND, 5 ); + + wxBoxSizer* bSizer201; + bSizer201 = new wxBoxSizer( wxHORIZONTAL ); + + m_bpButton18 = new wxBitmapButton( this, wxID_ANY, wxNullBitmap, wxDefaultPosition, wxSize( 140,58 ), wxBU_AUTODRAW ); + m_bpButton18->SetToolTip( _("Start synchronizing files") ); + + m_bpButton18->SetToolTip( _("Start synchronizing files") ); + + bSizer201->Add( m_bpButton18, 0, wxRIGHT, 5 ); + + wxBoxSizer* bSizer211; + bSizer211 = new wxBoxSizer( wxHORIZONTAL ); + + m_staticText14 = new wxStaticText( this, wxID_ANY, _("Data to be transferred:"), wxDefaultPosition, wxDefaultSize, 0 ); + m_staticText14->Wrap( -1 ); + m_staticText14->SetFont( wxFont( 10, 74, 93, 90, false, wxT("Tahoma") ) ); + + bSizer211->Add( m_staticText14, 0, wxALIGN_CENTER_HORIZONTAL|wxALL|wxALIGN_CENTER_VERTICAL, 5 ); + + m_textCtrl5 = new wxTextCtrl( this, wxID_ANY, wxEmptyString, wxDefaultPosition, wxSize( 55,-1 ), wxTE_READONLY ); + m_textCtrl5->SetBackgroundColour( wxSystemSettings::GetColour( wxSYS_COLOUR_ACTIVEBORDER ) ); + + bSizer211->Add( m_textCtrl5, 0, wxALL|wxALIGN_CENTER_HORIZONTAL|wxALIGN_CENTER_VERTICAL, 5 ); + + bSizer201->Add( bSizer211, 0, wxALIGN_CENTER_VERTICAL|wxLEFT, 5 ); + + bSizer29->Add( bSizer201, 0, wxEXPAND, 5 ); + + + bSizer29->Add( 0, 3, 0, wxEXPAND, 5 ); + + wxBoxSizer* bSizer23; + bSizer23 = new wxBoxSizer( wxHORIZONTAL ); + + wxStaticBoxSizer* sbSizer7; + sbSizer7 = new wxStaticBoxSizer( new wxStaticBox( this, wxID_ANY, wxEmptyString ), wxVERTICAL ); + + m_staticText1 = new wxStaticText( this, wxID_ANY, _("Select variant:"), wxDefaultPosition, wxDefaultSize, 0 ); + m_staticText1->Wrap( -1 ); + m_staticText1->SetFont( wxFont( 10, 74, 90, 92, false, wxT("Tahoma") ) ); + + sbSizer7->Add( m_staticText1, 0, wxALL, 5 ); + + wxFlexGridSizer* fgSizer1; + fgSizer1 = new wxFlexGridSizer( 3, 3, 0, 0 ); + fgSizer1->SetFlexibleDirection( wxBOTH ); + fgSizer1->SetNonFlexibleGrowMode( wxFLEX_GROWMODE_SPECIFIED ); + + m_radioBtn1 = new wxRadioButton( this, wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0 ); + m_radioBtn1->SetValue( true ); + m_radioBtn1->SetFont( wxFont( 11, 74, 90, 92, false, wxT("Tahoma") ) ); + + fgSizer1->Add( m_radioBtn1, 0, wxALL|wxALIGN_CENTER_VERTICAL, 5 ); + + m_buttonOneWay = new wxButton( this, wxID_ANY, _("One way ->"), wxDefaultPosition, wxSize( 130,-1 ), 0 ); + m_buttonOneWay->SetFont( wxFont( 11, 74, 90, 92, false, wxT("Tahoma") ) ); + + fgSizer1->Add( m_buttonOneWay, 0, wxALIGN_CENTER_VERTICAL|wxTOP|wxBOTTOM|wxRIGHT, 5 ); + + m_staticText8 = new wxStaticText( this, wxID_ANY, _("Mirror backup of left folder: Right folder will be overwritten and exactly match left folder after synchronization."), wxDefaultPosition, wxDefaultSize, 0 ); + m_staticText8->Wrap( 200 ); + fgSizer1->Add( m_staticText8, 0, wxALL|wxALIGN_CENTER_VERTICAL, 5 ); + + m_radioBtn2 = new wxRadioButton( this, wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0 ); + m_radioBtn2->SetFont( wxFont( 11, 74, 90, 92, false, wxT("Tahoma") ) ); + + fgSizer1->Add( m_radioBtn2, 0, wxALL|wxALIGN_CENTER_VERTICAL, 5 ); + + m_buttonTwoWay = new wxButton( this, wxID_ANY, _("Two way <->"), wxDefaultPosition, wxSize( 130,-1 ), 0 ); + m_buttonTwoWay->SetFont( wxFont( 11, 74, 90, 92, false, wxT("Tahoma") ) ); + + fgSizer1->Add( m_buttonTwoWay, 0, wxALIGN_CENTER_VERTICAL|wxTOP|wxBOTTOM|wxRIGHT, 5 ); + + m_staticText10 = new wxStaticText( this, wxID_ANY, _("Synchronize both sides simultaneously: Copy new or updated files in both directions."), wxDefaultPosition, wxDefaultSize, 0 ); + m_staticText10->Wrap( 200 ); + fgSizer1->Add( m_staticText10, 0, wxALL|wxALIGN_CENTER_VERTICAL, 5 ); + + m_radioBtn3 = new wxRadioButton( this, wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0 ); + m_radioBtn3->SetFont( wxFont( 11, 74, 90, 92, false, wxT("Tahoma") ) ); + + fgSizer1->Add( m_radioBtn3, 0, wxALL|wxALIGN_CENTER_VERTICAL, 5 ); + + m_staticText23 = new wxStaticText( this, wxID_ANY, _("Custom"), wxDefaultPosition, wxSize( 130,-1 ), wxALIGN_CENTRE|wxSTATIC_BORDER ); + m_staticText23->Wrap( -1 ); + m_staticText23->SetFont( wxFont( 11, 74, 90, 92, false, wxT("Tahoma") ) ); + + fgSizer1->Add( m_staticText23, 0, wxALIGN_CENTER_HORIZONTAL|wxALIGN_CENTER_VERTICAL|wxTOP|wxBOTTOM|wxRIGHT, 5 ); + + m_staticText9 = new wxStaticText( this, wxID_ANY, _("Configure your own synchronization rules."), wxDefaultPosition, wxDefaultSize, 0 ); + m_staticText9->Wrap( 200 ); + fgSizer1->Add( m_staticText9, 0, wxALL|wxALIGN_CENTER_VERTICAL, 5 ); + + sbSizer7->Add( fgSizer1, 1, wxEXPAND, 5 ); + + bSizer23->Add( sbSizer7, 0, wxEXPAND, 5 ); + + + bSizer23->Add( 0, 0, 1, wxEXPAND, 5 ); + + bSizer29->Add( bSizer23, 0, wxEXPAND, 5 ); + + + bSizer29->Add( 0, 0, 1, wxEXPAND, 5 ); + + wxBoxSizer* bSizer291; + bSizer291 = new wxBoxSizer( wxHORIZONTAL ); + + m_button6 = new wxButton( this, wxID_ANY, _("Back"), wxDefaultPosition, wxSize( 100,32 ), 0 ); + m_button6->SetFont( wxFont( 10, 74, 90, 90, false, wxT("Tahoma") ) ); + + bSizer291->Add( m_button6, 0, wxBOTTOM|wxLEFT|wxALIGN_CENTER_VERTICAL, 5 ); + + + bSizer291->Add( 82, 0, 0, wxEXPAND|wxALIGN_CENTER_VERTICAL, 5 ); + + m_checkBoxUseRecycler = new wxCheckBox( this, wxID_ANY, _("Use Recycle Bin"), wxDefaultPosition, wxDefaultSize, 0 ); + + m_checkBoxUseRecycler->SetToolTip( _("Use Recycle Bin when deleting or overwriting files during synchronization") ); + + bSizer291->Add( m_checkBoxUseRecycler, 0, wxALL|wxALIGN_CENTER_VERTICAL, 5 ); + + bSizer29->Add( bSizer291, 1, wxEXPAND|wxALIGN_CENTER_HORIZONTAL, 5 ); + + bSizer181->Add( bSizer29, 1, wxEXPAND, 5 ); + + wxBoxSizer* bSizer30; + bSizer30 = new wxBoxSizer( wxVERTICAL ); + + + bSizer30->Add( 0, 0, 1, wxEXPAND, 5 ); + + wxStaticBoxSizer* sbSizer6; + sbSizer6 = new wxStaticBoxSizer( new wxStaticBox( this, wxID_ANY, _("Configuration") ), wxVERTICAL ); + + wxBoxSizer* bSizer21; + bSizer21 = new wxBoxSizer( wxHORIZONTAL ); + + m_staticText2 = new wxStaticText( this, wxID_ANY, _("Result"), wxDefaultPosition, wxDefaultSize, 0 ); + m_staticText2->Wrap( -1 ); + m_staticText2->SetFont( wxFont( 8, 74, 90, 92, false, wxT("Tahoma") ) ); + + bSizer21->Add( m_staticText2, 1, wxALIGN_CENTER_HORIZONTAL|wxALIGN_CENTER_VERTICAL, 5 ); + + + bSizer21->Add( 15, 0, 0, wxEXPAND|wxALIGN_CENTER_VERTICAL, 5 ); + + m_staticText3 = new wxStaticText( this, wxID_ANY, _("Action"), wxDefaultPosition, wxDefaultSize, 0 ); + m_staticText3->Wrap( -1 ); + m_staticText3->SetFont( wxFont( 8, 74, 90, 92, false, wxT("Tahoma") ) ); + + bSizer21->Add( m_staticText3, 0, wxALIGN_CENTER_HORIZONTAL|wxALIGN_CENTER_VERTICAL, 5 ); + + sbSizer6->Add( bSizer21, 0, wxALIGN_CENTER_HORIZONTAL, 5 ); + + m_staticline3 = new wxStaticLine( this, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxLI_HORIZONTAL ); + sbSizer6->Add( m_staticline3, 0, wxALL|wxALIGN_CENTER_HORIZONTAL|wxEXPAND, 5 ); + + wxBoxSizer* bSizer9; + bSizer9 = new wxBoxSizer( wxHORIZONTAL ); + + wxBoxSizer* bSizer20; + bSizer20 = new wxBoxSizer( wxVERTICAL ); + + m_bitmap13 = new wxStaticBitmap( this, wxID_ANY, wxNullBitmap, wxDefaultPosition, wxSize( 48,48 ), 0 ); + m_bitmap13->SetToolTip( _("Folders/files that exist on left side only") ); + + bSizer20->Add( m_bitmap13, 0, wxALIGN_CENTER_HORIZONTAL, 5 ); + + m_bitmap14 = new wxStaticBitmap( this, wxID_ANY, wxNullBitmap, wxDefaultPosition, wxSize( 48,48 ), 0 ); + m_bitmap14->SetToolTip( _("Folders/files that exist on right side only") ); + + bSizer20->Add( m_bitmap14, 0, wxALIGN_CENTER_HORIZONTAL, 5 ); + + m_bitmap15 = new wxStaticBitmap( this, wxID_ANY, wxNullBitmap, wxDefaultPosition, wxSize( 48,48 ), 0 ); + m_bitmap15->SetToolTip( _("Files that exist on both sides, left one is newer") ); + + bSizer20->Add( m_bitmap15, 0, wxALIGN_CENTER_HORIZONTAL, 5 ); + + m_bitmap16 = new wxStaticBitmap( this, wxID_ANY, wxNullBitmap, wxDefaultPosition, wxSize( 48,48 ), 0 ); + m_bitmap16->SetToolTip( _("Files that exist on both sides, right one is newer") ); + + bSizer20->Add( m_bitmap16, 0, wxALIGN_CENTER_HORIZONTAL, 5 ); + + m_bitmap17 = new wxStaticBitmap( this, wxID_ANY, wxNullBitmap, wxDefaultPosition, wxSize( 48,48 ), 0 ); + m_bitmap17->SetToolTip( _("Files that exist on both sides and are different") ); + + bSizer20->Add( m_bitmap17, 0, wxALIGN_CENTER_HORIZONTAL, 5 ); + + bSizer9->Add( bSizer20, 0, wxALIGN_CENTER_VERTICAL, 5 ); + + + bSizer9->Add( 5, 0, 0, wxEXPAND, 5 ); + + wxBoxSizer* bSizer19; + bSizer19 = new wxBoxSizer( wxVERTICAL ); + + m_bpButton5 = new wxBitmapButton( this, wxID_ANY, wxNullBitmap, wxDefaultPosition, wxSize( 42,42 ), wxBU_AUTODRAW ); + bSizer19->Add( m_bpButton5, 0, wxALIGN_CENTER_HORIZONTAL|wxRIGHT|wxLEFT, 5 ); + + + bSizer19->Add( 0, 5, 0, wxEXPAND, 5 ); + + m_bpButton6 = new wxBitmapButton( this, wxID_ANY, wxNullBitmap, wxDefaultPosition, wxSize( 42,42 ), wxBU_AUTODRAW ); + bSizer19->Add( m_bpButton6, 0, wxRIGHT|wxLEFT|wxALIGN_CENTER_HORIZONTAL, 5 ); + + + bSizer19->Add( 0, 5, 1, wxEXPAND, 5 ); + + m_bpButton7 = new wxBitmapButton( this, wxID_ANY, wxNullBitmap, wxDefaultPosition, wxSize( 42,42 ), wxBU_AUTODRAW ); + bSizer19->Add( m_bpButton7, 0, wxALIGN_CENTER_HORIZONTAL|wxRIGHT|wxLEFT, 5 ); + + + bSizer19->Add( 0, 5, 1, wxEXPAND, 5 ); + + m_bpButton8 = new wxBitmapButton( this, wxID_ANY, wxNullBitmap, wxDefaultPosition, wxSize( 42,42 ), wxBU_AUTODRAW ); + bSizer19->Add( m_bpButton8, 0, wxRIGHT|wxLEFT|wxALIGN_CENTER_HORIZONTAL, 5 ); + + + bSizer19->Add( 0, 5, 1, wxEXPAND, 5 ); + + m_bpButton9 = new wxBitmapButton( this, wxID_ANY, wxNullBitmap, wxDefaultPosition, wxSize( 42,42 ), wxBU_AUTODRAW ); + bSizer19->Add( m_bpButton9, 0, wxRIGHT|wxLEFT|wxALIGN_CENTER_HORIZONTAL, 5 ); + + bSizer9->Add( bSizer19, 0, wxALIGN_CENTER_VERTICAL, 5 ); + + + bSizer9->Add( 5, 0, 0, wxEXPAND, 5 ); + + sbSizer6->Add( bSizer9, 0, wxALIGN_CENTER_HORIZONTAL, 5 ); + + bSizer30->Add( sbSizer6, 0, wxALIGN_RIGHT|wxBOTTOM, 5 ); + + bSizer181->Add( bSizer30, 0, wxEXPAND|wxALIGN_BOTTOM, 5 ); + + + bSizer181->Add( 5, 0, 0, wxEXPAND, 5 ); + + bSizer7->Add( bSizer181, 1, wxEXPAND, 5 ); + + this->SetSizer( bSizer7 ); + this->Layout(); + + // Connect Events + this->Connect( wxEVT_CLOSE_WINDOW, wxCloseEventHandler( SyncDialogGenerated::OnClose ) ); + m_bpButton18->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( SyncDialogGenerated::OnStartSync ), NULL, this ); + m_radioBtn1->Connect( wxEVT_COMMAND_RADIOBUTTON_SELECTED, wxCommandEventHandler( SyncDialogGenerated::OnSyncLeftToRight ), NULL, this ); + m_buttonOneWay->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( SyncDialogGenerated::OnSyncLeftToRight ), NULL, this ); + m_radioBtn2->Connect( wxEVT_COMMAND_RADIOBUTTON_SELECTED, wxCommandEventHandler( SyncDialogGenerated::OnSyncBothSides ), NULL, this ); + m_buttonTwoWay->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( SyncDialogGenerated::OnSyncBothSides ), NULL, this ); + m_radioBtn3->Connect( wxEVT_COMMAND_RADIOBUTTON_SELECTED, wxCommandEventHandler( SyncDialogGenerated::OnSyncCostum ), NULL, this ); + m_button6->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( SyncDialogGenerated::OnBack ), NULL, this ); + m_checkBoxUseRecycler->Connect( wxEVT_COMMAND_CHECKBOX_CLICKED, wxCommandEventHandler( SyncDialogGenerated::OnSelectRecycleBin ), NULL, this ); + m_bpButton5->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( SyncDialogGenerated::OnExLeftSideOnly ), NULL, this ); + m_bpButton6->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( SyncDialogGenerated::OnExRightSideOnly ), NULL, this ); + m_bpButton7->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( SyncDialogGenerated::OnLeftNewer ), NULL, this ); + m_bpButton8->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( SyncDialogGenerated::OnRightNewer ), NULL, this ); + m_bpButton9->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( SyncDialogGenerated::OnDifferent ), NULL, this ); +} + +SyncDialogGenerated::~SyncDialogGenerated() +{ + // Disconnect Events + this->Disconnect( wxEVT_CLOSE_WINDOW, wxCloseEventHandler( SyncDialogGenerated::OnClose ) ); + m_bpButton18->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( SyncDialogGenerated::OnStartSync ), NULL, this ); + m_radioBtn1->Disconnect( wxEVT_COMMAND_RADIOBUTTON_SELECTED, wxCommandEventHandler( SyncDialogGenerated::OnSyncLeftToRight ), NULL, this ); + m_buttonOneWay->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( SyncDialogGenerated::OnSyncLeftToRight ), NULL, this ); + m_radioBtn2->Disconnect( wxEVT_COMMAND_RADIOBUTTON_SELECTED, wxCommandEventHandler( SyncDialogGenerated::OnSyncBothSides ), NULL, this ); + m_buttonTwoWay->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( SyncDialogGenerated::OnSyncBothSides ), NULL, this ); + m_radioBtn3->Disconnect( wxEVT_COMMAND_RADIOBUTTON_SELECTED, wxCommandEventHandler( SyncDialogGenerated::OnSyncCostum ), NULL, this ); + m_button6->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( SyncDialogGenerated::OnBack ), NULL, this ); + m_checkBoxUseRecycler->Disconnect( wxEVT_COMMAND_CHECKBOX_CLICKED, wxCommandEventHandler( SyncDialogGenerated::OnSelectRecycleBin ), NULL, this ); + m_bpButton5->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( SyncDialogGenerated::OnExLeftSideOnly ), NULL, this ); + m_bpButton6->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( SyncDialogGenerated::OnExRightSideOnly ), NULL, this ); + m_bpButton7->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( SyncDialogGenerated::OnLeftNewer ), NULL, this ); + m_bpButton8->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( SyncDialogGenerated::OnRightNewer ), NULL, this ); + m_bpButton9->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( SyncDialogGenerated::OnDifferent ), NULL, this ); +} + +HelpDlgGenerated::HelpDlgGenerated( wxWindow* parent, wxWindowID id, const wxString& title, const wxPoint& pos, const wxSize& size, long style ) : wxDialog( parent, id, title, pos, size, style ) +{ + this->SetSizeHints( wxDefaultSize, wxDefaultSize ); + + wxBoxSizer* bSizer20; + bSizer20 = new wxBoxSizer( wxVERTICAL ); + + + bSizer20->Add( 0, 10, 0, wxEXPAND, 5 ); + + m_staticText12 = new wxStaticText( this, wxID_ANY, _("Help"), wxDefaultPosition, wxDefaultSize, 0 ); + m_staticText12->Wrap( -1 ); + m_staticText12->SetFont( wxFont( 16, 74, 90, 92, false, wxT("Tahoma") ) ); + + bSizer20->Add( m_staticText12, 0, wxALIGN_CENTER_HORIZONTAL|wxRIGHT|wxLEFT, 5 ); + + + bSizer20->Add( 0, 5, 0, wxEXPAND, 5 ); + + m_textCtrl8 = new wxTextCtrl( this, wxID_ANY, _("Compare by \"File size and date\"\n----------------------------------------\nThis compare variant evaluates two equally named files as being equal when they have the same file size AND the same last write date and time. For the latter the system's UTC time (coordinated word time) is used internally, although the local file time is displayed on the result list. So there are no problems concerning different time zones or daylight saving time.\n\nWhen \"Compare\" is triggered with this option set the following decision tree is processed:\n\n -----------------\n |Decision tree|\n -----------------\n ________|___________\n | |\n file exists on both sides on one side only\n _____|______ __|___\n | | | |\nequal different left right\n _________|_____________\n | | |\n left newer right newer different (but same date)\n\nAs a result 6 different status can be returned to categorize all files:\n\n- exists left only\n- exists right only\n- left newer\n- right newer\n- different (but same date)\n- equal\n\n\nCompare by \"File content\"\n----------------------------------------\nAs the name suggests, two files which share the same name are marked as equal if and only if they have the same content. This option is useful for consistency checks rather than backup operations. Therefore the file times are not taken into account at all.\n\nWith this option enabled the decision tree is smaller:\n\n -----------------\n |Decision tree|\n -----------------\n ________|___________\n | |\n file exists on both sides on one side only\n _____|______ __|___\n | | | |\nequal different left right\n\nAs a result the files are separated into the following categories:\n\n- exists left only\n- exists right only\n- different\n- equal"), wxDefaultPosition, wxDefaultSize, wxTE_MULTILINE|wxTE_READONLY ); + m_textCtrl8->SetBackgroundColour( wxSystemSettings::GetColour( wxSYS_COLOUR_ACTIVEBORDER ) ); + + bSizer20->Add( m_textCtrl8, 1, wxALL|wxALIGN_CENTER_HORIZONTAL|wxEXPAND, 5 ); + + m_button8 = new wxButton( this, wxID_ANY, _("OK"), wxDefaultPosition, wxSize( 100,32 ), 0 ); + m_button8->SetFont( wxFont( 10, 74, 90, 90, false, wxT("Tahoma") ) ); + + bSizer20->Add( m_button8, 0, wxALL|wxALIGN_CENTER_HORIZONTAL, 5 ); + + this->SetSizer( bSizer20 ); + this->Layout(); + + // Connect Events + this->Connect( wxEVT_CLOSE_WINDOW, wxCloseEventHandler( HelpDlgGenerated::OnClose ) ); + m_button8->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( HelpDlgGenerated::OnOK ), NULL, this ); +} + +HelpDlgGenerated::~HelpDlgGenerated() +{ + // Disconnect Events + this->Disconnect( wxEVT_CLOSE_WINDOW, wxCloseEventHandler( HelpDlgGenerated::OnClose ) ); + m_button8->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( HelpDlgGenerated::OnOK ), NULL, this ); +} + +AboutDlgGenerated::AboutDlgGenerated( wxWindow* parent, wxWindowID id, const wxString& title, const wxPoint& pos, const wxSize& size, long style ) : wxDialog( parent, id, title, pos, size, style ) +{ + this->SetSizeHints( wxDefaultSize, wxDefaultSize ); + + wxBoxSizer* bSizer31; + bSizer31 = new wxBoxSizer( wxVERTICAL ); + + + bSizer31->Add( 0, 10, 0, wxEXPAND, 5 ); + + m_staticText14 = new wxStaticText( this, wxID_ANY, _("FreeFileSync v1.2"), wxDefaultPosition, wxDefaultSize, 0 ); + m_staticText14->Wrap( -1 ); + m_staticText14->SetFont( wxFont( 16, 74, 90, 92, false, wxT("Tahoma") ) ); + + bSizer31->Add( m_staticText14, 0, wxALL|wxALIGN_CENTER_HORIZONTAL, 5 ); + + m_staticText15 = new wxStaticText( this, wxID_ANY, _("-Open-Source file synchronization-"), wxDefaultPosition, wxDefaultSize, 0 ); + m_staticText15->Wrap( -1 ); + m_staticText15->SetFont( wxFont( 8, 74, 93, 90, false, wxT("Tahoma") ) ); + + bSizer31->Add( m_staticText15, 0, wxALIGN_CENTER_HORIZONTAL|wxBOTTOM|wxRIGHT|wxLEFT, 5 ); + + m_build = new wxStaticText( this, wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0 ); + m_build->Wrap( -1 ); + bSizer31->Add( m_build, 0, wxALIGN_CENTER_HORIZONTAL|wxALIGN_CENTER_VERTICAL|wxBOTTOM|wxRIGHT|wxLEFT, 5 ); + + + bSizer31->Add( 0, 10, 0, wxEXPAND, 5 ); + + m_textCtrl3 = new wxTextCtrl( this, wxID_ANY, _("Source code written completely in C++ utilizing:\n\nMinGW \t\t- Windows port of GNU Compiler Collection\nwxWidgets \t- Open-Source GUI framework\nwxFormBuilder\t- wxWidgets GUI-builder\nGMP \t\t- arithmetic calculations\nCodeBlocks \t- Open-Source IDE\n\n by ZenJu"), wxDefaultPosition, wxSize( 350,140 ), wxTE_MULTILINE|wxTE_NO_VSCROLL|wxTE_READONLY|wxDOUBLE_BORDER ); + m_textCtrl3->SetBackgroundColour( wxSystemSettings::GetColour( wxSYS_COLOUR_ACTIVEBORDER ) ); + + bSizer31->Add( m_textCtrl3, 0, wxALL|wxALIGN_CENTER_HORIZONTAL, 0 ); + + + bSizer31->Add( 0, 0, 1, wxEXPAND, 5 ); + + wxStaticBoxSizer* sbSizer7; + sbSizer7 = new wxStaticBoxSizer( new wxStaticBox( this, wxID_ANY, wxEmptyString ), wxVERTICAL ); + + m_staticText131 = new wxStaticText( this, wxID_ANY, _("Feedback and suggestions are welcome at:"), wxDefaultPosition, wxDefaultSize, 0 ); + m_staticText131->Wrap( -1 ); + m_staticText131->SetFont( wxFont( 11, 74, 90, 90, false, wxT("Tahoma") ) ); + + sbSizer7->Add( m_staticText131, 0, wxALIGN_CENTER_HORIZONTAL, 5 ); + + bSizer31->Add( sbSizer7, 0, wxALIGN_CENTER_HORIZONTAL, 5 ); + + wxFlexGridSizer* fgSizer2; + fgSizer2 = new wxFlexGridSizer( 3, 3, 0, 0 ); + fgSizer2->SetFlexibleDirection( wxBOTH ); + fgSizer2->SetNonFlexibleGrowMode( wxFLEX_GROWMODE_SPECIFIED ); + + m_bitmap9 = new wxStaticBitmap( this, wxID_ANY, wxNullBitmap, wxDefaultPosition, wxSize( 48,48 ), 0 ); + fgSizer2->Add( m_bitmap9, 0, wxALIGN_CENTER_VERTICAL|wxALL, 5 ); + + m_staticText11 = new wxStaticText( this, wxID_ANY, _("Homepage:"), wxDefaultPosition, wxDefaultSize, 0 ); + m_staticText11->Wrap( -1 ); + m_staticText11->SetFont( wxFont( 10, 74, 90, 92, false, wxT("Tahoma") ) ); + + fgSizer2->Add( m_staticText11, 0, wxALL|wxALIGN_CENTER_VERTICAL, 5 ); + + m_hyperlink1 = new wxHyperlinkCtrl( this, wxID_ANY, _("FreeFileSync at Sourceforge"), wxT("http://sourceforge.net/projects/freefilesync/"), wxDefaultPosition, wxDefaultSize, wxHL_DEFAULT_STYLE ); + m_hyperlink1->SetToolTip( _("http://sourceforge.net/projects/freefilesync/") ); + + fgSizer2->Add( m_hyperlink1, 0, wxALL|wxALIGN_CENTER_VERTICAL, 5 ); + + m_bitmap10 = new wxStaticBitmap( this, wxID_ANY, wxNullBitmap, wxDefaultPosition, wxSize( 48,48 ), 0 ); + fgSizer2->Add( m_bitmap10, 0, wxALIGN_CENTER_VERTICAL|wxRIGHT|wxLEFT, 5 ); + + m_staticText13 = new wxStaticText( this, wxID_ANY, _("Email:"), wxDefaultPosition, wxDefaultSize, 0 ); + m_staticText13->Wrap( -1 ); + m_staticText13->SetFont( wxFont( 10, 74, 90, 92, false, wxT("Tahoma") ) ); + + fgSizer2->Add( m_staticText13, 0, wxALIGN_CENTER_VERTICAL|wxALL, 5 ); + + m_hyperlink2 = new wxHyperlinkCtrl( this, wxID_ANY, _("zhnmju123@gmx.de"), wxT("mailto:zhnmju123@gmx.de"), wxDefaultPosition, wxDefaultSize, wxHL_DEFAULT_STYLE ); + fgSizer2->Add( m_hyperlink2, 0, wxALL|wxALIGN_CENTER_VERTICAL, 5 ); + + m_animationControl1 = new wxAnimationCtrl(this, wxID_ANY, wxNullAnimation, wxDefaultPosition, wxSize( 48,48 )); + fgSizer2->Add( m_animationControl1, 0, wxALIGN_CENTER_VERTICAL|wxALL, 5 ); + + m_staticText151 = new wxStaticText( this, wxID_ANY, _("If you like FFS:"), wxDefaultPosition, wxDefaultSize, 0 ); + m_staticText151->Wrap( -1 ); + m_staticText151->SetFont( wxFont( 10, 74, 90, 92, false, wxT("Tahoma") ) ); + + fgSizer2->Add( m_staticText151, 0, wxALL|wxALIGN_CENTER_VERTICAL, 5 ); + + m_hyperlink3 = new wxHyperlinkCtrl( this, wxID_ANY, _("Donate with Paypal"), wxT("https://www.paypal.com/cgi-bin/webscr?cmd=_donations&business=florian%2db%40gmx%2enet&no_shipping=0&no_note=1&tax=0¤cy_code=EUR&lc=DE&bn=PP%2dDonationsBF&charset=UTF%2d8"), wxDefaultPosition, wxDefaultSize, wxHL_DEFAULT_STYLE ); + fgSizer2->Add( m_hyperlink3, 0, wxALL|wxALIGN_CENTER_VERTICAL, 5 ); + + bSizer31->Add( fgSizer2, 0, wxEXPAND|wxLEFT, 10 ); + + m_button8 = new wxButton( this, wxID_ANY, _("OK"), wxDefaultPosition, wxSize( 100,32 ), 0 ); + m_button8->SetFont( wxFont( 10, 74, 90, 90, false, wxT("Tahoma") ) ); + + bSizer31->Add( m_button8, 0, wxALIGN_CENTER_HORIZONTAL|wxBOTTOM|wxRIGHT|wxLEFT, 5 ); + + this->SetSizer( bSizer31 ); + this->Layout(); + + // Connect Events + this->Connect( wxEVT_CLOSE_WINDOW, wxCloseEventHandler( AboutDlgGenerated::OnClose ) ); + m_button8->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( AboutDlgGenerated::OnOK ), NULL, this ); +} + +AboutDlgGenerated::~AboutDlgGenerated() +{ + // Disconnect Events + this->Disconnect( wxEVT_CLOSE_WINDOW, wxCloseEventHandler( AboutDlgGenerated::OnClose ) ); + m_button8->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( AboutDlgGenerated::OnOK ), NULL, this ); +} + +FilterDlgGenerated::FilterDlgGenerated( wxWindow* parent, wxWindowID id, const wxString& title, const wxPoint& pos, const wxSize& size, long style ) : wxDialog( parent, id, title, pos, size, style ) +{ + this->SetSizeHints( wxDefaultSize, wxDefaultSize ); + + wxBoxSizer* bSizer21; + bSizer21 = new wxBoxSizer( wxVERTICAL ); + + m_staticText17 = new wxStaticText( this, wxID_ANY, _("Set filter for synchronization"), wxDefaultPosition, wxDefaultSize, 0 ); + m_staticText17->Wrap( -1 ); + m_staticText17->SetFont( wxFont( 14, 74, 90, 92, false, wxT("Arial Black") ) ); + + bSizer21->Add( m_staticText17, 0, wxALL|wxALIGN_CENTER_HORIZONTAL, 10 ); + + + bSizer21->Add( 0, 0, 1, wxEXPAND, 5 ); + + m_staticText18 = new wxStaticText( this, wxID_ANY, _("Only files/directories that pass filtering will be relevant for synchronization.\n\n1. Enter full file or directory names separated by ';'.\n2. Wildcard characters '*' and '?' are supported.\n3. Case sensitive expressions!\n\nExample: *.tmp;C:\\data\\dummy.log;*filename*;*directory*"), wxDefaultPosition, wxDefaultSize, 0 ); + m_staticText18->Wrap( -1 ); + bSizer21->Add( m_staticText18, 0, wxALL|wxALIGN_CENTER_HORIZONTAL, 5 ); + + wxStaticBoxSizer* sbSizer8; + sbSizer8 = new wxStaticBoxSizer( new wxStaticBox( this, wxID_ANY, wxEmptyString ), wxVERTICAL ); + + wxFlexGridSizer* fgSizer3; + fgSizer3 = new wxFlexGridSizer( 2, 2, 0, 0 ); + fgSizer3->SetFlexibleDirection( wxBOTH ); + fgSizer3->SetNonFlexibleGrowMode( wxFLEX_GROWMODE_SPECIFIED ); + + + fgSizer3->Add( 0, 0, 1, wxEXPAND, 5 ); + + m_staticText15 = new wxStaticText( this, wxID_ANY, _("Include"), wxDefaultPosition, wxDefaultSize, 0 ); + m_staticText15->Wrap( -1 ); + m_staticText15->SetFont( wxFont( 10, 74, 90, 92, false, wxT("Tahoma") ) ); + + fgSizer3->Add( m_staticText15, 0, wxTOP|wxRIGHT|wxLEFT, 5 ); + + m_bitmap8 = new wxStaticBitmap( this, wxID_ANY, wxNullBitmap, wxDefaultPosition, wxSize( 30,30 ), 0 ); + fgSizer3->Add( m_bitmap8, 0, wxTOP|wxBOTTOM|wxLEFT, 5 ); + + m_textCtrlInclude = new wxTextCtrl( this, wxID_ANY, wxEmptyString, wxDefaultPosition, wxSize( 400,-1 ), 0 ); + fgSizer3->Add( m_textCtrlInclude, 0, wxALL|wxALIGN_CENTER_VERTICAL, 5 ); + + sbSizer8->Add( fgSizer3, 0, 0, 5 ); + + wxFlexGridSizer* fgSizer4; + fgSizer4 = new wxFlexGridSizer( 2, 2, 0, 0 ); + fgSizer4->SetFlexibleDirection( wxBOTH ); + fgSizer4->SetNonFlexibleGrowMode( wxFLEX_GROWMODE_SPECIFIED ); + + + fgSizer4->Add( 0, 0, 1, wxEXPAND, 5 ); + + m_staticText16 = new wxStaticText( this, wxID_ANY, _("Exclude"), wxDefaultPosition, wxDefaultSize, 0 ); + m_staticText16->Wrap( -1 ); + m_staticText16->SetFont( wxFont( 10, 74, 90, 92, false, wxT("Tahoma") ) ); + + fgSizer4->Add( m_staticText16, 0, wxTOP|wxRIGHT|wxLEFT, 5 ); + + m_bitmap9 = new wxStaticBitmap( this, wxID_ANY, wxNullBitmap, wxDefaultPosition, wxSize( 30,30 ), 0 ); + fgSizer4->Add( m_bitmap9, 0, wxTOP|wxBOTTOM|wxLEFT, 5 ); + + m_textCtrlExclude = new wxTextCtrl( this, wxID_ANY, wxEmptyString, wxDefaultPosition, wxSize( 400,-1 ), 0 ); + fgSizer4->Add( m_textCtrlExclude, 0, wxALL|wxALIGN_CENTER_VERTICAL, 5 ); + + sbSizer8->Add( fgSizer4, 0, 0, 5 ); + + bSizer21->Add( sbSizer8, 0, wxRIGHT|wxLEFT, 5 ); + + + bSizer21->Add( 0, 0, 1, wxEXPAND, 5 ); + + wxBoxSizer* bSizer22; + bSizer22 = new wxBoxSizer( wxHORIZONTAL ); + + m_button9 = new wxButton( this, wxID_ANY, _("Default"), wxDefaultPosition, wxSize( 80,30 ), 0 ); + m_button9->SetFont( wxFont( 10, 74, 90, 90, false, wxT("Tahoma") ) ); + + bSizer22->Add( m_button9, 0, wxALL, 5 ); + + + bSizer22->Add( 0, 0, 1, wxEXPAND, 5 ); + + m_button10 = new wxButton( this, wxID_ANY, _("OK"), wxDefaultPosition, wxSize( 80,30 ), 0 ); + m_button10->SetDefault(); + m_button10->SetFont( wxFont( 10, 74, 90, 90, false, wxT("Tahoma") ) ); + + bSizer22->Add( m_button10, 0, wxALL, 5 ); + + bSizer21->Add( bSizer22, 0, wxEXPAND|wxTOP, 5 ); + + this->SetSizer( bSizer21 ); + this->Layout(); + + // Connect Events + this->Connect( wxEVT_CLOSE_WINDOW, wxCloseEventHandler( FilterDlgGenerated::OnClose ) ); + m_button9->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( FilterDlgGenerated::OnDefault ), NULL, this ); + m_button10->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( FilterDlgGenerated::OnOK ), NULL, this ); +} + +FilterDlgGenerated::~FilterDlgGenerated() +{ + // Disconnect Events + this->Disconnect( wxEVT_CLOSE_WINDOW, wxCloseEventHandler( FilterDlgGenerated::OnClose ) ); + m_button9->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( FilterDlgGenerated::OnDefault ), NULL, this ); + m_button10->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( FilterDlgGenerated::OnOK ), NULL, this ); +} + +ErrorDlgGenerated::ErrorDlgGenerated( wxWindow* parent, wxWindowID id, const wxString& title, const wxPoint& pos, const wxSize& size, long style ) : wxDialog( parent, id, title, pos, size, style ) +{ + this->SetSizeHints( wxDefaultSize, wxDefaultSize ); + + wxBoxSizer* bSizer24; + bSizer24 = new wxBoxSizer( wxVERTICAL ); + + + bSizer24->Add( 0, 0, 1, wxEXPAND, 5 ); + + wxBoxSizer* bSizer26; + bSizer26 = new wxBoxSizer( wxHORIZONTAL ); + + m_bitmap10 = new wxStaticBitmap( this, wxID_ANY, wxNullBitmap, wxDefaultPosition, wxSize( 48,48 ), 0 ); + bSizer26->Add( m_bitmap10, 0, wxALL|wxALIGN_CENTER_VERTICAL, 5 ); + + m_textCtrl8 = new wxTextCtrl( this, wxID_ANY, wxEmptyString, wxDefaultPosition, wxSize( 320,140 ), wxTE_MULTILINE|wxTE_READONLY ); + m_textCtrl8->SetBackgroundColour( wxSystemSettings::GetColour( wxSYS_COLOUR_ACTIVEBORDER ) ); + + bSizer26->Add( m_textCtrl8, 1, wxALL|wxALIGN_CENTER_VERTICAL|wxEXPAND, 5 ); + + bSizer24->Add( bSizer26, 0, wxALIGN_CENTER_HORIZONTAL, 5 ); + + + bSizer24->Add( 0, 0, 1, wxEXPAND, 5 ); + + m_checkBoxSuppress = new wxCheckBox( this, wxID_ANY, _("Hide further messages during current process"), wxDefaultPosition, wxDefaultSize, 0 ); + + bSizer24->Add( m_checkBoxSuppress, 0, wxALL|wxALIGN_CENTER_HORIZONTAL, 5 ); + + + bSizer24->Add( 0, 10, 0, wxEXPAND, 5 ); + + wxBoxSizer* bSizer25; + bSizer25 = new wxBoxSizer( wxHORIZONTAL ); + + m_buttonContinue = new wxButton( this, wxID_ANY, _("Continue"), wxDefaultPosition, wxSize( 80,30 ), 0 ); + m_buttonContinue->SetFont( wxFont( 10, 74, 90, 90, false, wxT("Tahoma") ) ); + + bSizer25->Add( m_buttonContinue, 0, wxTOP|wxBOTTOM|wxLEFT, 5 ); + + m_buttonRetry = new wxButton( this, wxID_ANY, _("Retry"), wxDefaultPosition, wxSize( 80,30 ), 0 ); + m_buttonRetry->SetFont( wxFont( 10, 74, 90, 90, false, wxT("Tahoma") ) ); + + bSizer25->Add( m_buttonRetry, 0, wxTOP|wxBOTTOM|wxLEFT, 5 ); + + m_buttonAbort = new wxButton( this, wxID_ANY, _("Abort"), wxDefaultPosition, wxSize( 80,30 ), 0 ); + m_buttonAbort->SetFont( wxFont( 10, 74, 90, 90, false, wxT("Tahoma") ) ); + + bSizer25->Add( m_buttonAbort, 0, wxALL, 5 ); + + bSizer24->Add( bSizer25, 0, wxALIGN_CENTER_HORIZONTAL, 5 ); + + this->SetSizer( bSizer24 ); + this->Layout(); + + // Connect Events + this->Connect( wxEVT_CLOSE_WINDOW, wxCloseEventHandler( ErrorDlgGenerated::OnClose ) ); + m_buttonContinue->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( ErrorDlgGenerated::OnContinue ), NULL, this ); + m_buttonRetry->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( ErrorDlgGenerated::OnRetry ), NULL, this ); + m_buttonAbort->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( ErrorDlgGenerated::OnAbort ), NULL, this ); +} + +ErrorDlgGenerated::~ErrorDlgGenerated() +{ + // Disconnect Events + this->Disconnect( wxEVT_CLOSE_WINDOW, wxCloseEventHandler( ErrorDlgGenerated::OnClose ) ); + m_buttonContinue->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( ErrorDlgGenerated::OnContinue ), NULL, this ); + m_buttonRetry->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( ErrorDlgGenerated::OnRetry ), NULL, this ); + m_buttonAbort->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( ErrorDlgGenerated::OnAbort ), NULL, this ); +} + +SyncStatusGenerated::SyncStatusGenerated( wxWindow* parent, wxWindowID id, const wxString& title, const wxPoint& pos, const wxSize& size, long style ) : wxDialog( parent, id, title, pos, size, style ) +{ + this->SetSizeHints( wxDefaultSize, wxDefaultSize ); + + wxBoxSizer* bSizer27; + bSizer27 = new wxBoxSizer( wxVERTICAL ); + + + bSizer27->Add( 0, 15, 0, wxEXPAND, 5 ); + + m_staticText20 = new wxStaticText( this, wxID_ANY, _("Synchronization status"), wxDefaultPosition, wxDefaultSize, 0 ); + m_staticText20->Wrap( -1 ); + m_staticText20->SetFont( wxFont( 16, 74, 90, 92, false, wxT("Tahoma") ) ); + + bSizer27->Add( m_staticText20, 0, wxALL|wxALIGN_CENTER_HORIZONTAL, 5 ); + + m_staticTextStatus = new wxStaticText( this, wxID_ANY, _("Running..."), wxDefaultPosition, wxDefaultSize, 0 ); + m_staticTextStatus->Wrap( -1 ); + m_staticTextStatus->SetFont( wxFont( 14, 74, 93, 90, false, wxT("Tahoma") ) ); + + bSizer27->Add( m_staticTextStatus, 0, wxALIGN_CENTER_HORIZONTAL|wxTOP|wxRIGHT|wxLEFT, 5 ); + + wxBoxSizer* bSizer31; + bSizer31 = new wxBoxSizer( wxHORIZONTAL ); + + m_staticText21 = new wxStaticText( this, wxID_ANY, _("Current operation:"), wxDefaultPosition, wxDefaultSize, 0 ); + m_staticText21->Wrap( -1 ); + m_staticText21->SetFont( wxFont( 10, 74, 90, 90, false, wxT("Tahoma") ) ); + + bSizer31->Add( m_staticText21, 0, wxALL|wxALIGN_CENTER_VERTICAL, 5 ); + + + bSizer31->Add( 0, 0, 1, wxEXPAND, 5 ); + + m_staticText25 = new wxStaticText( this, wxID_ANY, _("Items completed:"), wxDefaultPosition, wxDefaultSize, 0 ); + m_staticText25->Wrap( -1 ); + m_staticText25->SetFont( wxFont( 10, 74, 93, 90, false, wxT("Tahoma") ) ); + + bSizer31->Add( m_staticText25, 0, wxTOP|wxBOTTOM|wxLEFT|wxALIGN_CENTER_VERTICAL, 5 ); + + m_staticTextProcessedObj = new wxStaticText( this, wxID_ANY, _("1000000"), wxDefaultPosition, wxSize( -1,-1 ), 0 ); + m_staticTextProcessedObj->Wrap( -1 ); + m_staticTextProcessedObj->SetFont( wxFont( 10, 74, 90, 92, false, wxT("Tahoma") ) ); + + bSizer31->Add( m_staticTextProcessedObj, 0, wxALL|wxALIGN_CENTER_VERTICAL, 5 ); + + bSizer27->Add( bSizer31, 0, wxEXPAND, 5 ); + + m_textCtrlInfo = new wxTextCtrl( this, wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, wxTE_MULTILINE|wxTE_READONLY ); + m_textCtrlInfo->SetBackgroundColour( wxSystemSettings::GetColour( wxSYS_COLOUR_ACTIVEBORDER ) ); + + bSizer27->Add( m_textCtrlInfo, 3, wxALL|wxEXPAND, 5 ); + + m_gauge1 = new wxGauge( this, wxID_ANY, 100, wxDefaultPosition, wxSize( -1,20 ), wxGA_HORIZONTAL ); + bSizer27->Add( m_gauge1, 0, wxALL|wxEXPAND, 5 ); + + wxBoxSizer* bSizer28; + bSizer28 = new wxBoxSizer( wxHORIZONTAL ); + + wxBoxSizer* bSizer32; + bSizer32 = new wxBoxSizer( wxHORIZONTAL ); + + m_staticText26 = new wxStaticText( this, wxID_ANY, _("Data copied:"), wxDefaultPosition, wxDefaultSize, 0 ); + m_staticText26->Wrap( -1 ); + m_staticText26->SetFont( wxFont( 10, 74, 93, 90, false, wxT("Tahoma") ) ); + + bSizer32->Add( m_staticText26, 0, wxALIGN_CENTER_VERTICAL|wxTOP|wxBOTTOM|wxLEFT, 5 ); + + m_staticTextBytesCurrent = new wxStaticText( this, wxID_ANY, _("10,0 MB"), wxDefaultPosition, wxDefaultSize, 0 ); + m_staticTextBytesCurrent->Wrap( -1 ); + m_staticTextBytesCurrent->SetFont( wxFont( 10, 74, 90, 92, false, wxT("Tahoma") ) ); + + bSizer32->Add( m_staticTextBytesCurrent, 0, wxALIGN_CENTER_VERTICAL|wxTOP|wxBOTTOM|wxLEFT, 5 ); + + m_staticText30 = new wxStaticText( this, wxID_ANY, _("/"), wxDefaultPosition, wxDefaultSize, 0 ); + m_staticText30->Wrap( -1 ); + m_staticText30->SetFont( wxFont( 10, 74, 90, 90, false, wxT("Tahoma") ) ); + + bSizer32->Add( m_staticText30, 0, wxALIGN_CENTER_VERTICAL, 5 ); + + m_staticTextBytesTotal = new wxStaticText( this, wxID_ANY, _("10,0 MB"), wxDefaultPosition, wxDefaultSize, 0 ); + m_staticTextBytesTotal->Wrap( -1 ); + m_staticTextBytesTotal->SetFont( wxFont( 10, 74, 90, 92, false, wxT("Tahoma") ) ); + + bSizer32->Add( m_staticTextBytesTotal, 0, wxALIGN_CENTER_VERTICAL|wxTOP|wxBOTTOM|wxRIGHT, 5 ); + + bSizer28->Add( bSizer32, 1, wxALIGN_CENTER_VERTICAL, 5 ); + + + bSizer28->Add( 0, 0, 1, wxEXPAND, 5 ); + + m_buttonOK = new wxButton( this, wxID_ANY, _("OK"), wxDefaultPosition, wxSize( 100,32 ), 0 ); + m_buttonOK->SetFont( wxFont( 10, 74, 90, 90, false, wxT("Tahoma") ) ); + m_buttonOK->Hide(); + + bSizer28->Add( m_buttonOK, 0, wxALL|wxALIGN_CENTER_VERTICAL, 5 ); + + m_buttonAbort = new wxButton( this, wxID_ANY, _("Abort"), wxDefaultPosition, wxSize( 100,32 ), 0 ); + m_buttonAbort->SetFont( wxFont( 10, 74, 90, 90, false, wxT("Tahoma") ) ); + + bSizer28->Add( m_buttonAbort, 0, wxALL|wxALIGN_CENTER_VERTICAL, 5 ); + + + bSizer28->Add( 0, 0, 1, wxEXPAND, 5 ); + + wxBoxSizer* bSizer33; + bSizer33 = new wxBoxSizer( wxVERTICAL ); + + m_staticText32 = new wxStaticText( this, wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0 ); + m_staticText32->Wrap( -1 ); + m_staticText32->SetFont( wxFont( 10, 74, 90, 90, false, wxT("Tahoma") ) ); + + bSizer33->Add( m_staticText32, 0, wxALL, 5 ); + + bSizer28->Add( bSizer33, 1, wxEXPAND, 5 ); + + bSizer27->Add( bSizer28, 0, wxALIGN_CENTER_HORIZONTAL|wxEXPAND, 5 ); + + + bSizer27->Add( 0, 5, 0, wxEXPAND, 5 ); + + this->SetSizer( bSizer27 ); + this->Layout(); + + // Connect Events + this->Connect( wxEVT_CLOSE_WINDOW, wxCloseEventHandler( SyncStatusGenerated::OnClose ) ); + m_buttonOK->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( SyncStatusGenerated::OnOkay ), NULL, this ); + m_buttonAbort->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( SyncStatusGenerated::OnAbort ), NULL, this ); +} + +SyncStatusGenerated::~SyncStatusGenerated() +{ + // Disconnect Events + this->Disconnect( wxEVT_CLOSE_WINDOW, wxCloseEventHandler( SyncStatusGenerated::OnClose ) ); + m_buttonOK->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( SyncStatusGenerated::OnOkay ), NULL, this ); + m_buttonAbort->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( SyncStatusGenerated::OnAbort ), NULL, this ); +} diff --git a/ui/GUI_Generated.h b/ui/GUI_Generated.h new file mode 100644 index 00000000..f7ef37a7 --- /dev/null +++ b/ui/GUI_Generated.h @@ -0,0 +1,371 @@ +/////////////////////////////////////////////////////////////////////////// +// C++ code generated with wxFormBuilder (version Apr 16 2008) +// http://www.wxformbuilder.org/ +// +// PLEASE DO "NOT" EDIT THIS FILE! +/////////////////////////////////////////////////////////////////////////// + +#ifndef __GUI_Generated__ +#define __GUI_Generated__ + +#include <wx/intl.h> + +class CustomGrid; + +#include <wx/bitmap.h> +#include <wx/image.h> +#include <wx/icon.h> +#include <wx/bmpbuttn.h> +#include <wx/gdicmn.h> +#include <wx/font.h> +#include <wx/colour.h> +#include <wx/settings.h> +#include <wx/string.h> +#include <wx/button.h> +#include <wx/sizer.h> +#include <wx/radiobut.h> +#include <wx/statbox.h> +#include <wx/hyperlink.h> +#include <wx/checkbox.h> +#include <wx/textctrl.h> +#include <wx/filepicker.h> +#include <wx/grid.h> +#include <wx/panel.h> +#include <wx/statusbr.h> +#include <wx/frame.h> +#include <wx/stattext.h> +#include <wx/statline.h> +#include <wx/statbmp.h> +#include <wx/dialog.h> +#include <wx/animate.h> +#include <wx/gauge.h> + +/////////////////////////////////////////////////////////////////////////// + + +/////////////////////////////////////////////////////////////////////////////// +/// Class GUI_Generated +/////////////////////////////////////////////////////////////////////////////// +class GUI_Generated : public wxFrame +{ + private: + + protected: + wxBoxSizer* bSizer1; + + wxBitmapButton* m_bpButtonCompare; + wxButton* m_buttonAbort; + wxRadioButton* m_radioBtnSizeDate; + wxRadioButton* m_radioBtnContent; + wxBitmapButton* m_bpButton14; + + wxBitmapButton* m_bpButtonFilter; + wxHyperlinkCtrl* m_hyperlinkCfgFilter; + wxCheckBox* m_checkBoxHideFilt; + wxBitmapButton* m_bpButtonSync; + + wxPanel* m_panel1; + wxTextCtrl* m_directoryPanel1; + wxDirPickerCtrl* m_dirPicker1; + CustomGrid* m_grid1; + wxPanel* m_panel3; + wxBitmapButton* m_bpButtonSwap; + CustomGrid* m_grid3; + wxPanel* m_panel2; + wxTextCtrl* m_directoryPanel2; + wxDirPickerCtrl* m_dirPicker2; + CustomGrid* m_grid2; + wxPanel* m_panel4; + wxBitmapButton* m_bpButton11; + + wxBitmapButton* m_bpButton20; + wxBitmapButton* m_bpButton21; + wxBitmapButton* m_bpButton25; + wxBitmapButton* m_bpButton22; + wxBitmapButton* m_bpButton23; + wxBitmapButton* m_bpButton24; + + wxBitmapButton* m_bpButton10; + wxStatusBar* m_statusBar1; + + // Virtual event handlers, overide them in your derived class + virtual void OnClose( wxCloseEvent& event ){ event.Skip(); } + virtual void OnCompare( wxCommandEvent& event ){ event.Skip(); } + virtual void OnAbortCompare( wxCommandEvent& event ){ event.Skip(); } + virtual void OnChangeCompareVariant( wxCommandEvent& event ){ event.Skip(); } + virtual void OnShowHelpDialog( wxCommandEvent& event ){ event.Skip(); } + virtual void OnFilterButton( wxCommandEvent& event ){ event.Skip(); } + virtual void OnConfigureFilter( wxHyperlinkEvent& event ){ event.Skip(); } + virtual void OnHideFilteredButton( wxCommandEvent& event ){ event.Skip(); } + virtual void OnSync( wxCommandEvent& event ){ event.Skip(); } + virtual void OnEnterLeftDir( wxCommandEvent& event ){ event.Skip(); } + virtual void OnDirChangedPanel1( wxFileDirPickerEvent& event ){ event.Skip(); } + virtual void OnLeftGridDoubleClick( wxGridEvent& event ){ event.Skip(); } + virtual void OnSortLeftGrid( wxGridEvent& event ){ event.Skip(); } + virtual void OnSwapDirs( wxCommandEvent& event ){ event.Skip(); } + virtual void OnGrid3SelectRange( wxGridRangeSelectEvent& event ){ event.Skip(); } + virtual void OnGrid3SelectCell( wxGridEvent& event ){ event.Skip(); } + virtual void OnEnterRightDir( wxCommandEvent& event ){ event.Skip(); } + virtual void OnDirChangedPanel2( wxFileDirPickerEvent& event ){ event.Skip(); } + virtual void OnRightGridDoubleClick( wxGridEvent& event ){ event.Skip(); } + virtual void OnSortRightGrid( wxGridEvent& event ){ event.Skip(); } + virtual void OnAbout( wxCommandEvent& event ){ event.Skip(); } + virtual void OnLeftOnlyFiles( wxCommandEvent& event ){ event.Skip(); } + virtual void OnLeftNewerFiles( wxCommandEvent& event ){ event.Skip(); } + virtual void OnEqualFiles( wxCommandEvent& event ){ event.Skip(); } + virtual void OnDifferentFiles( wxCommandEvent& event ){ event.Skip(); } + virtual void OnRightNewerFiles( wxCommandEvent& event ){ event.Skip(); } + virtual void OnRightOnlyFiles( wxCommandEvent& event ){ event.Skip(); } + virtual void OnQuit( wxCommandEvent& event ){ event.Skip(); } + + + public: + GUI_Generated( wxWindow* parent, wxWindowID id = wxID_ANY, const wxString& title = _("FreeFileSync - Folder Synchronization"), const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxSize( 930,603 ), long style = wxDEFAULT_FRAME_STYLE|wxTAB_TRAVERSAL ); + ~GUI_Generated(); + +}; + +/////////////////////////////////////////////////////////////////////////////// +/// Class SyncDialogGenerated +/////////////////////////////////////////////////////////////////////////////// +class SyncDialogGenerated : public wxDialog +{ + private: + + protected: + + + wxBitmapButton* m_bpButton18; + wxStaticText* m_staticText14; + wxTextCtrl* m_textCtrl5; + + wxStaticText* m_staticText1; + wxRadioButton* m_radioBtn1; + wxButton* m_buttonOneWay; + wxStaticText* m_staticText8; + wxRadioButton* m_radioBtn2; + wxButton* m_buttonTwoWay; + wxStaticText* m_staticText10; + wxRadioButton* m_radioBtn3; + wxStaticText* m_staticText23; + wxStaticText* m_staticText9; + + + wxButton* m_button6; + + wxCheckBox* m_checkBoxUseRecycler; + + wxStaticText* m_staticText2; + + wxStaticText* m_staticText3; + wxStaticLine* m_staticline3; + wxStaticBitmap* m_bitmap13; + wxStaticBitmap* m_bitmap14; + wxStaticBitmap* m_bitmap15; + wxStaticBitmap* m_bitmap16; + wxStaticBitmap* m_bitmap17; + + wxBitmapButton* m_bpButton5; + + wxBitmapButton* m_bpButton6; + + wxBitmapButton* m_bpButton7; + + wxBitmapButton* m_bpButton8; + + wxBitmapButton* m_bpButton9; + + + + // Virtual event handlers, overide them in your derived class + virtual void OnClose( wxCloseEvent& event ){ event.Skip(); } + virtual void OnStartSync( wxCommandEvent& event ){ event.Skip(); } + virtual void OnSyncLeftToRight( wxCommandEvent& event ){ event.Skip(); } + virtual void OnSyncBothSides( wxCommandEvent& event ){ event.Skip(); } + virtual void OnSyncCostum( wxCommandEvent& event ){ event.Skip(); } + virtual void OnBack( wxCommandEvent& event ){ event.Skip(); } + virtual void OnSelectRecycleBin( wxCommandEvent& event ){ event.Skip(); } + virtual void OnExLeftSideOnly( wxCommandEvent& event ){ event.Skip(); } + virtual void OnExRightSideOnly( wxCommandEvent& event ){ event.Skip(); } + virtual void OnLeftNewer( wxCommandEvent& event ){ event.Skip(); } + virtual void OnRightNewer( wxCommandEvent& event ){ event.Skip(); } + virtual void OnDifferent( wxCommandEvent& event ){ event.Skip(); } + + + public: + SyncDialogGenerated( wxWindow* parent, wxWindowID id = wxID_ANY, const wxString& title = _("Synchronization settings"), const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxSize( 533,349 ), long style = wxDEFAULT_DIALOG_STYLE ); + ~SyncDialogGenerated(); + +}; + +/////////////////////////////////////////////////////////////////////////////// +/// Class HelpDlgGenerated +/////////////////////////////////////////////////////////////////////////////// +class HelpDlgGenerated : public wxDialog +{ + private: + + protected: + + wxStaticText* m_staticText12; + + wxTextCtrl* m_textCtrl8; + wxButton* m_button8; + + // Virtual event handlers, overide them in your derived class + virtual void OnClose( wxCloseEvent& event ){ event.Skip(); } + virtual void OnOK( wxCommandEvent& event ){ event.Skip(); } + + + public: + HelpDlgGenerated( wxWindow* parent, wxWindowID id = wxID_ANY, const wxString& title = wxEmptyString, const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxSize( 557,385 ), long style = wxDEFAULT_DIALOG_STYLE|wxRESIZE_BORDER ); + ~HelpDlgGenerated(); + +}; + +/////////////////////////////////////////////////////////////////////////////// +/// Class AboutDlgGenerated +/////////////////////////////////////////////////////////////////////////////// +class AboutDlgGenerated : public wxDialog +{ + private: + + protected: + + wxStaticText* m_staticText14; + wxStaticText* m_staticText15; + wxStaticText* m_build; + + wxTextCtrl* m_textCtrl3; + + wxStaticText* m_staticText131; + wxStaticBitmap* m_bitmap9; + wxStaticText* m_staticText11; + wxHyperlinkCtrl* m_hyperlink1; + wxStaticBitmap* m_bitmap10; + wxStaticText* m_staticText13; + wxHyperlinkCtrl* m_hyperlink2; + wxAnimationCtrl* m_animationControl1; + wxStaticText* m_staticText151; + wxHyperlinkCtrl* m_hyperlink3; + wxButton* m_button8; + + // Virtual event handlers, overide them in your derived class + virtual void OnClose( wxCloseEvent& event ){ event.Skip(); } + virtual void OnOK( wxCommandEvent& event ){ event.Skip(); } + + + public: + AboutDlgGenerated( wxWindow* parent, wxWindowID id = wxID_ANY, const wxString& title = _("About"), const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxSize( 438,495 ), long style = wxDEFAULT_DIALOG_STYLE ); + ~AboutDlgGenerated(); + +}; + +/////////////////////////////////////////////////////////////////////////////// +/// Class FilterDlgGenerated +/////////////////////////////////////////////////////////////////////////////// +class FilterDlgGenerated : public wxDialog +{ + private: + + protected: + wxStaticText* m_staticText17; + + wxStaticText* m_staticText18; + + wxStaticText* m_staticText15; + wxStaticBitmap* m_bitmap8; + wxTextCtrl* m_textCtrlInclude; + + wxStaticText* m_staticText16; + wxStaticBitmap* m_bitmap9; + wxTextCtrl* m_textCtrlExclude; + + wxButton* m_button9; + + wxButton* m_button10; + + // Virtual event handlers, overide them in your derived class + virtual void OnClose( wxCloseEvent& event ){ event.Skip(); } + virtual void OnDefault( wxCommandEvent& event ){ event.Skip(); } + virtual void OnOK( wxCommandEvent& event ){ event.Skip(); } + + + public: + FilterDlgGenerated( wxWindow* parent, wxWindowID id = wxID_ANY, const wxString& title = _("Configure filter settings"), const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxSize( 484,350 ), long style = wxDEFAULT_DIALOG_STYLE ); + ~FilterDlgGenerated(); + +}; + +/////////////////////////////////////////////////////////////////////////////// +/// Class ErrorDlgGenerated +/////////////////////////////////////////////////////////////////////////////// +class ErrorDlgGenerated : public wxDialog +{ + private: + + protected: + + wxStaticBitmap* m_bitmap10; + wxTextCtrl* m_textCtrl8; + + wxCheckBox* m_checkBoxSuppress; + + wxButton* m_buttonContinue; + wxButton* m_buttonRetry; + wxButton* m_buttonAbort; + + // Virtual event handlers, overide them in your derived class + virtual void OnClose( wxCloseEvent& event ){ event.Skip(); } + virtual void OnContinue( wxCommandEvent& event ){ event.Skip(); } + virtual void OnRetry( wxCommandEvent& event ){ event.Skip(); } + virtual void OnAbort( wxCommandEvent& event ){ event.Skip(); } + + + public: + ErrorDlgGenerated( wxWindow* parent, wxWindowID id = wxID_ANY, const wxString& title = _("An error occured"), const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxSize( 411,266 ), long style = wxDEFAULT_DIALOG_STYLE ); + ~ErrorDlgGenerated(); + +}; + +/////////////////////////////////////////////////////////////////////////////// +/// Class SyncStatusGenerated +/////////////////////////////////////////////////////////////////////////////// +class SyncStatusGenerated : public wxDialog +{ + private: + + protected: + + wxStaticText* m_staticText20; + wxStaticText* m_staticText21; + + wxStaticText* m_staticText25; + wxStaticText* m_staticTextProcessedObj; + wxStaticText* m_staticText26; + wxStaticText* m_staticTextBytesCurrent; + wxStaticText* m_staticText30; + wxStaticText* m_staticTextBytesTotal; + + + wxStaticText* m_staticText32; + + + // Virtual event handlers, overide them in your derived class + virtual void OnClose( wxCloseEvent& event ){ event.Skip(); } + virtual void OnOkay( wxCommandEvent& event ){ event.Skip(); } + virtual void OnAbort( wxCommandEvent& event ){ event.Skip(); } + + + public: + wxStaticText* m_staticTextStatus; + wxTextCtrl* m_textCtrlInfo; + wxGauge* m_gauge1; + wxButton* m_buttonOK; + wxButton* m_buttonAbort; + SyncStatusGenerated( wxWindow* parent, wxWindowID id = wxID_ANY, const wxString& title = wxEmptyString, const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxSize( 614,371 ), long style = wxDEFAULT_DIALOG_STYLE ); + ~SyncStatusGenerated(); + +}; + +#endif //__GUI_Generated__ diff --git a/ui/MainDialog.cpp b/ui/MainDialog.cpp new file mode 100644 index 00000000..97288b90 --- /dev/null +++ b/ui/MainDialog.cpp @@ -0,0 +1,1719 @@ +/*************************************************************** + * Name: FreeFileSyncMain.cpp + * Purpose: Code for Application Frame + * Author: ZenJu (zhnmju123@gmx.de) + * Created: 2008-07-16 + * Copyright: ZenJu () + * License: + **************************************************************/ + +#include "MainDialog.h" +#include <wx/filename.h> +#include <stdexcept> //for std::runtime_error +#include "..\library\globalfunctions.h" +#include <fstream> +#include <wx/clipbrd.h> +#include "..\library\CustomGrid.h" +#include <cmath> +#include <wx/msgdlg.h> + +using namespace GlobalFunctions; + +int leadingPanel = 0; + +MainDialog::MainDialog(wxFrame* frame) : + GUI_Generated(frame), + parent(frame), + selectedRangeBegin(0), + selectedRangeEnd(0), + selectionLead(0), + filteringPending(false), + cmpStatusUpdaterTmp(0) +{ + //initialize sync configuration + readConfigurationFromHD("config.dat"); + + //set icons for this dialog + m_bpButton11->SetBitmapLabel(*GlobalResources::bitmapAbout); + m_bpButton10->SetBitmapLabel(*GlobalResources::bitmapExit); + m_bpButtonCompare->SetBitmapLabel(*GlobalResources::bitmapCompare); + m_bpButtonSync->SetBitmapLabel(*GlobalResources::bitmapSync); + m_bpButtonSync->SetBitmapDisabled(*GlobalResources::bitmapSyncDisabled); + m_bpButtonSwap->SetBitmapLabel(*GlobalResources::bitmapSwap); + m_bpButton14->SetBitmapLabel(*GlobalResources::bitmapHelp); + + m_panel1->DragAcceptFiles(true); + m_panel2->DragAcceptFiles(true); + m_panel1->Connect(wxEVT_DROP_FILES, wxDropFilesEventHandler(MainDialog::onFilesDroppedPanel1), NULL, this); + m_panel2->Connect(wxEVT_DROP_FILES, wxDropFilesEventHandler(MainDialog::onFilesDroppedPanel2), NULL, this); + + //support for CTRL + C + m_grid1->Connect(wxEVT_KEY_DOWN, wxKeyEventHandler(MainDialog::onGrid1ButtonEvent), NULL, this); + m_grid2->Connect(wxEVT_KEY_DOWN, wxKeyEventHandler(MainDialog::onGrid2ButtonEvent), NULL, this); + + //identify leading grid by keyboard input or scroll action + m_grid1->Connect(wxEVT_KEY_DOWN, wxEventHandler(MainDialog::onGrid1access), NULL, this); + m_grid1->Connect(wxEVT_SCROLLWIN_TOP, wxEventHandler(MainDialog::onGrid1access), NULL, this); + m_grid1->Connect(wxEVT_SCROLLWIN_BOTTOM, wxEventHandler(MainDialog::onGrid1access), NULL, this); + m_grid1->Connect(wxEVT_SCROLLWIN_LINEUP, wxEventHandler(MainDialog::onGrid1access), NULL, this); + m_grid1->Connect(wxEVT_SCROLLWIN_LINEDOWN, wxEventHandler(MainDialog::onGrid1access), NULL, this); + m_grid1->Connect(wxEVT_SCROLLWIN_PAGEUP, wxEventHandler(MainDialog::onGrid1access), NULL, this); + m_grid1->Connect(wxEVT_SCROLLWIN_PAGEDOWN, wxEventHandler(MainDialog::onGrid1access), NULL, this); + m_grid1->Connect(wxEVT_SCROLLWIN_THUMBTRACK, wxEventHandler(MainDialog::onGrid1access), NULL, this); + m_grid1->Connect(wxEVT_SCROLLWIN_THUMBRELEASE, wxEventHandler(MainDialog::onGrid1access), NULL, this); + m_grid1->Connect(wxEVT_GRID_LABEL_LEFT_CLICK, wxEventHandler(MainDialog::onGrid1access), NULL, this); + m_grid1->GetGridWindow()->Connect(wxEVT_LEFT_DOWN, wxEventHandler(MainDialog::onGrid1access), NULL, this); + + m_grid2->Connect(wxEVT_KEY_DOWN, wxEventHandler(MainDialog::onGrid2access), NULL, this); + m_grid2->Connect(wxEVT_SCROLLWIN_TOP, wxEventHandler(MainDialog::onGrid2access), NULL, this); + m_grid2->Connect(wxEVT_SCROLLWIN_BOTTOM, wxEventHandler(MainDialog::onGrid2access), NULL, this); + m_grid2->Connect(wxEVT_SCROLLWIN_LINEUP, wxEventHandler(MainDialog::onGrid2access), NULL, this); + m_grid2->Connect(wxEVT_SCROLLWIN_LINEDOWN, wxEventHandler(MainDialog::onGrid2access), NULL, this); + m_grid2->Connect(wxEVT_SCROLLWIN_PAGEUP, wxEventHandler(MainDialog::onGrid2access), NULL, this); + m_grid2->Connect(wxEVT_SCROLLWIN_PAGEDOWN, wxEventHandler(MainDialog::onGrid2access), NULL, this); + m_grid2->Connect(wxEVT_SCROLLWIN_THUMBTRACK, wxEventHandler(MainDialog::onGrid2access), NULL, this); + m_grid2->Connect(wxEVT_SCROLLWIN_THUMBRELEASE, wxEventHandler(MainDialog::onGrid2access), NULL, this); + m_grid2->Connect(wxEVT_GRID_LABEL_LEFT_CLICK, wxEventHandler(MainDialog::onGrid2access), NULL, this); + m_grid2->GetGridWindow()->Connect(wxEVT_LEFT_DOWN, wxEventHandler(MainDialog::onGrid2access), NULL, this); + + m_grid3->Connect(wxEVT_KEY_DOWN, wxEventHandler(MainDialog::onGrid3access), NULL, this); + m_grid3->Connect(wxEVT_SCROLLWIN_LINEUP, wxEventHandler(MainDialog::onGrid3access), NULL, this); + m_grid3->Connect(wxEVT_SCROLLWIN_LINEDOWN, wxEventHandler(MainDialog::onGrid3access), NULL, this); + m_grid3->GetGridWindow()->Connect(wxEVT_LEFT_DOWN, wxEventHandler(MainDialog::onGrid3access), NULL, this); + + m_grid3->GetGridWindow()->Connect(wxEVT_IDLE, wxEventHandler(MainDialog::OnIdleToFilterManually), NULL, this); + m_grid3->GetGridWindow()->Connect(wxEVT_LEFT_UP, wxEventHandler(MainDialog::OnGrid3LeftMouseUp), NULL, this); + + wxString toolTip = wxString(_("Legend\n")) + + _("---------\n") + + _("<| file on left side only\n") + + _("|> file on right side only\n") + + _("<< left file is newer\n") + + _(">> right file is newer\n") + + _("!= files are different\n") + + _("== files are equal\n\n") + + _("(-) filtered out from sync-process\n"); + m_grid3->GetGridWindow()->SetToolTip(toolTip); + + //enable parallel scrolling + m_grid1->setScrollFriends(m_grid1, m_grid2, m_grid3); + m_grid2->setScrollFriends(m_grid1, m_grid2, m_grid3); + m_grid3->setScrollFriends(m_grid1, m_grid2, m_grid3); + + //share UI grid data with grids + m_grid1->setGridDataTable(¤tUI_View); + m_grid2->setGridDataTable(¤tUI_View); + m_grid3->setGridDataTable(¤tUI_View); + + updateViewFilterButtons(); + + //disable sync button as long as "compare" hasn't been triggered. + m_bpButtonSync->Enable(false); + + //make filesize right justified on grids + wxGridCellAttr* cellAttributes = m_grid1->GetOrCreateCellAttr(0, 2); + cellAttributes->SetAlignment(wxALIGN_RIGHT,wxALIGN_CENTRE); + m_grid1->SetColAttr(2, cellAttributes); + + cellAttributes = m_grid2->GetOrCreateCellAttr(0, 2); //leave these two rows, might be necessary 'cause wxGridCellAttr is ref-counting + cellAttributes->SetAlignment(wxALIGN_RIGHT,wxALIGN_CENTRE); //and SetColAttr takes ownership (means: it will call DecRef()) + m_grid2->SetColAttr(2, cellAttributes); + + //as the name says: disable them + m_grid3->deactivateScrollbars(); + + //set status of filter button + updateFilterButton(); + //set status of "hide filtered items" checkbox + m_checkBoxHideFilt->SetValue(hideFiltered); + + //mainly to update row label sizes... + writeGrid(currentGridData); +} + + +MainDialog::~MainDialog() +{ + m_grid1->setGridDataTable(0); + m_grid2->setGridDataTable(0); + m_grid3->setGridDataTable(0); + + m_grid1->setSortMarker(-1); + m_grid2->setSortMarker(-1); + + m_grid1->Disconnect(wxEVT_KEY_DOWN, wxKeyEventHandler(MainDialog::onGrid1ButtonEvent), NULL, this); + m_grid2->Disconnect(wxEVT_KEY_DOWN, wxKeyEventHandler(MainDialog::onGrid2ButtonEvent), NULL, this); + + m_panel1->Disconnect(wxEVT_DROP_FILES, wxDropFilesEventHandler(MainDialog::onFilesDroppedPanel1), NULL, this); + m_panel2->Disconnect(wxEVT_DROP_FILES, wxDropFilesEventHandler(MainDialog::onFilesDroppedPanel2), NULL, this); + + m_grid1->Disconnect(wxEVT_KEY_DOWN, wxEventHandler(MainDialog::onGrid1access), NULL, this); + m_grid1->Disconnect(wxEVT_SCROLLWIN_TOP, wxEventHandler(MainDialog::onGrid1access), NULL, this); + m_grid1->Disconnect(wxEVT_SCROLLWIN_BOTTOM, wxEventHandler(MainDialog::onGrid1access), NULL, this); + m_grid1->Disconnect(wxEVT_SCROLLWIN_LINEUP, wxEventHandler(MainDialog::onGrid1access), NULL, this); + m_grid1->Disconnect(wxEVT_SCROLLWIN_LINEDOWN, wxEventHandler(MainDialog::onGrid1access), NULL, this); + m_grid1->Disconnect(wxEVT_SCROLLWIN_PAGEUP, wxEventHandler(MainDialog::onGrid1access), NULL, this); + m_grid1->Disconnect(wxEVT_SCROLLWIN_PAGEDOWN, wxEventHandler(MainDialog::onGrid1access), NULL, this); + m_grid1->Disconnect(wxEVT_SCROLLWIN_THUMBTRACK, wxEventHandler(MainDialog::onGrid1access), NULL, this); + m_grid1->Disconnect(wxEVT_SCROLLWIN_THUMBRELEASE, wxEventHandler(MainDialog::onGrid1access), NULL, this); + m_grid1->Disconnect(wxEVT_GRID_LABEL_LEFT_CLICK, wxEventHandler(MainDialog::onGrid1access), NULL, this); + m_grid1->GetGridWindow()->Disconnect(wxEVT_LEFT_DOWN, wxEventHandler(MainDialog::onGrid1access), NULL, this); + + m_grid2->Disconnect(wxEVT_KEY_DOWN, wxEventHandler(MainDialog::onGrid2access), NULL, this); + m_grid2->Disconnect(wxEVT_SCROLLWIN_TOP, wxEventHandler(MainDialog::onGrid2access), NULL, this); + m_grid2->Disconnect(wxEVT_SCROLLWIN_BOTTOM, wxEventHandler(MainDialog::onGrid2access), NULL, this); + m_grid2->Disconnect(wxEVT_SCROLLWIN_LINEUP, wxEventHandler(MainDialog::onGrid2access), NULL, this); + m_grid2->Disconnect(wxEVT_SCROLLWIN_LINEDOWN, wxEventHandler(MainDialog::onGrid2access), NULL, this); + m_grid2->Disconnect(wxEVT_SCROLLWIN_PAGEUP, wxEventHandler(MainDialog::onGrid2access), NULL, this); + m_grid2->Disconnect(wxEVT_SCROLLWIN_PAGEDOWN, wxEventHandler(MainDialog::onGrid2access), NULL, this); + m_grid2->Disconnect(wxEVT_SCROLLWIN_THUMBTRACK, wxEventHandler(MainDialog::onGrid2access), NULL, this); + m_grid2->Disconnect(wxEVT_SCROLLWIN_THUMBRELEASE, wxEventHandler(MainDialog::onGrid2access), NULL, this); + m_grid2->Disconnect(wxEVT_GRID_LABEL_LEFT_CLICK, wxEventHandler(MainDialog::onGrid2access), NULL, this); + m_grid2->GetGridWindow()->Disconnect(wxEVT_LEFT_DOWN, wxEventHandler(MainDialog::onGrid2access), NULL, this); + + m_grid3->Disconnect(wxEVT_KEY_DOWN, wxEventHandler(MainDialog::onGrid3access), NULL, this); + m_grid3->Disconnect(wxEVT_SCROLLWIN_LINEUP, wxEventHandler(MainDialog::onGrid3access), NULL, this); + m_grid3->Disconnect(wxEVT_SCROLLWIN_LINEDOWN, wxEventHandler(MainDialog::onGrid3access), NULL, this); + m_grid3->GetGridWindow()->Disconnect(wxEVT_LEFT_DOWN, wxEventHandler(MainDialog::onGrid3access), NULL, this); + + m_grid3->GetGridWindow()->Disconnect(wxEVT_IDLE, wxEventHandler(MainDialog::OnIdleToFilterManually), NULL, this); + m_grid3->GetGridWindow()->Disconnect(wxEVT_LEFT_UP, wxEventHandler(MainDialog::OnGrid3LeftMouseUp), NULL, this); + + try + { + writeConfigurationToHD("config.dat"); //don't trow exceptions in destructors + } + catch (std::runtime_error& theException) + { + wxMessageBox(_(theException.what()), _("An exception occured!"), wxOK | wxICON_ERROR); + } +} + + +void MainDialog::onGrid1access(wxEvent& event) +{ + if (leadingPanel != 1) + { + leadingPanel = 1; + m_grid1->SetFocus(); + + m_grid2->ClearSelection(); //clear selection on grid2 + } + event.Skip(); +} + + +void MainDialog::onGrid2access(wxEvent& event) +{ + if (leadingPanel != 2) + { + leadingPanel = 2; + m_grid2->SetFocus(); + + m_grid1->ClearSelection(); //clear selection on grid1 + } + event.Skip(); +} + + +void MainDialog::onGrid3access(wxEvent& event) +{ + if (leadingPanel != 3) + { + leadingPanel = 3; + m_grid1->ClearSelection(); //clear selection on grid1 + m_grid2->ClearSelection(); //clear selection on grid1 + } + event.Skip(); +} + + +void MainDialog::filterRangeManual(int begin, int end, int leadingRow) +{ + int currentUI_Size = currentUI_View.size(); + + int topRow = max(begin, 0); + int bottomRow = min(end, currentUI_Size - 1); + + if (topRow <= bottomRow) // bottomRow might be -1 ? + { + bool newSelection = false; //default: deselect range + + //lastSelected Row should be set in OnDeselectRow() + if (leadingRow < currentUI_Size) + newSelection = !currentGridData[currentUI_View[leadingRow].linkToCurrentGridData].selectedForSynchronization; + + if (hideFiltered) + assert (!newSelection); //if hidefiltered is active, there should be no filtered elements on screen => current element was filtered out + + for (int i = topRow; i <= bottomRow; ++ i) + { + bool& currentSelection = currentGridData[currentUI_View[i].linkToCurrentGridData].selectedForSynchronization; + CompareFilesResult currentCmpResult = currentGridData[currentUI_View[i].linkToCurrentGridData].cmpResult; + + //toggle selection of current row + currentSelection = newSelection; + + //update currentUI_View, in case of sorting without refresh (mapping of griddata to ui model) + currentUI_View[i].cmpResult = evaluateCmpResult(currentCmpResult, currentSelection); + } + + //signal UI that grids need to be refreshed on next Update() + m_grid1->ForceRefresh(); + m_grid2->ForceRefresh(); + m_grid3->ForceRefresh(); + + if (hideFiltered) + { + //some delay to show user the rows he has filtered out before they are removed + Update(); //show changes resulting from ForceRefresh() + wxMilliSleep(400); + + //delete rows, that are filtered out: + currentUI_View.erase(currentUI_View.begin() + topRow, currentUI_View.begin() + bottomRow + 1); + + //redraw grid neccessary to update new dimensions + writeGrid(currentGridData, true); //use UI buffer, no mapping from currentGridData to UI model again, just a re-dimensioning of grids + updateStatusInformation(currentUI_View); //status information has to be recalculated! + } + } + //clear selection on grid + m_grid3->ClearSelection(); +} + +/*grid event choreography: +1. UI-Mouse-Down => OnGrid3SelectCell +2. UI-Mouse-Up => OnGrid3SelectRange (if at least two rows are marked) + +=> the decision if a range or a single cell is selected can be made only after Mouse-UP. But OnGrid3SelectRange unfortunately is not always +executed (e.g. if single cell selected) + +=> new choreography: + +1. UI-Mouse-Down => OnGrid3SelectCell +2. UI-Mouse-Up => OnGrid3LeftMouseUp (notify that filtering shall be started on next idle event +3. UI-Mouse-Up => OnGrid3SelectRange, possibly +4. Idle event => OnIdleToFilterManually + + It's !crazy! but it works! +*/ + +void MainDialog::OnGrid3SelectCell(wxGridEvent& event) +{ + selectionLead = selectedRangeBegin = selectedRangeEnd = event.GetRow(); + event.Skip(); +} + + +void MainDialog::OnGrid3LeftMouseUp(wxEvent& event) +{ + filteringPending = true; + event.Skip(); +} + + +void MainDialog::OnGrid3SelectRange(wxGridRangeSelectEvent& event) +{ + if (event.Selecting()) + { + selectedRangeBegin = event.GetTopRow(); + selectedRangeEnd = event.GetBottomRow(); + } + event.Skip(); +} + + +void MainDialog::OnIdleToFilterManually(wxEvent& event) +{ + if (filteringPending) + { + filteringPending = false; + filterRangeManual(selectedRangeBegin, selectedRangeEnd, selectionLead); + } + event.Skip(); +} + + +void copySelectionToClipboard(wxGrid* grid) +{ + int rowTop, rowBottom, colLeft, colRight; //coords of selection + wxString clipboardString; + + wxArrayInt selectedRows, selectedColumns; + selectedRows = grid->GetSelectedRows(); + selectedColumns = grid->GetSelectedCols(); + + if (!selectedRows.IsEmpty()) + { + for (unsigned int i = 0; i < selectedRows.GetCount(); ++i) + { + for (int k = 0; k < grid->GetNumberCols(); ++k) + { + clipboardString+= grid->GetCellValue(selectedRows[i], k); + if (k != grid->GetNumberCols() - 1) + clipboardString+= '\t'; + } + clipboardString+= '\n'; + } + } + else if (!selectedColumns.IsEmpty()) + { + for (int k = 0; k < grid->GetNumberRows(); ++k) + { + for (unsigned int i = 0; i < selectedColumns.GetCount(); ++i) + { + clipboardString+= grid->GetCellValue(k, selectedColumns[i]); + if (i != selectedColumns.GetCount() - 1) + clipboardString+= '\t'; + } + clipboardString+= '\n'; + } + } + else + { + wxGridCellCoordsArray tmpArray; + + tmpArray = grid->GetSelectionBlockTopLeft(); + if (!tmpArray.IsEmpty()) + { + wxGridCellCoords topLeft = tmpArray[0]; + + rowTop = topLeft.GetRow(); + colLeft = topLeft.GetCol(); + + tmpArray = grid->GetSelectionBlockBottomRight(); + if (!tmpArray.IsEmpty()) + { + wxGridCellCoords bottomRight = tmpArray[0]; + + rowBottom = bottomRight.GetRow(); + colRight = bottomRight.GetCol(); + + //save selection in one big string + for (int j = rowTop; j <= rowBottom; ++j) + { + for (int i = colLeft; i <= colRight; ++i) + { + clipboardString+= grid->GetCellValue(j, i); + if (i != colRight) + clipboardString+= '\t'; + } + clipboardString+= '\n'; + } + } + } + } + + if (!clipboardString.IsEmpty()) + // Write some text to the clipboard + if (wxTheClipboard->Open()) + { + // This data objects are held by the clipboard, + // so do not delete them in the app. + wxTheClipboard->SetData( new wxTextDataObject(clipboardString) ); + wxTheClipboard->Close(); + } +} + + +void MainDialog::onGrid1ButtonEvent(wxKeyEvent& event) +{ + //CTRL + C || CTRL + INS + if (event.ControlDown() && event.GetKeyCode() == 67 || + event.ControlDown() && event.GetKeyCode() == WXK_INSERT) + copySelectionToClipboard(m_grid1); + event.Skip(); +} + +void MainDialog::onGrid2ButtonEvent(wxKeyEvent& event) +{ + //CTRL + C || CTRL + INS + if (event.ControlDown() && event.GetKeyCode() == 67 || + event.ControlDown() && event.GetKeyCode() == WXK_INSERT) + copySelectionToClipboard(m_grid2); + event.Skip(); +} + + +void MainDialog::OnEnterLeftDir( wxCommandEvent& event ) +{ + wxString newDir = m_directoryPanel1->GetValue(); + m_dirPicker1->SetPath(newDir); + + event.Skip(); +} + + +void MainDialog::OnEnterRightDir( wxCommandEvent& event ) +{ + wxString newDir = m_directoryPanel2->GetValue(); + m_dirPicker2->SetPath(newDir); + + event.Skip(); +} + + +void MainDialog::OnDirChangedPanel1(wxFileDirPickerEvent& event) +{ + wxString newPath = m_dirPicker1->GetPath(); + + m_directoryPanel1->SetValue(newPath); + + //disable the sync button + m_bpButtonSync->Enable(false); + + //clear grids + currentGridData.clear(); + writeGrid(currentGridData); + + event.Skip(); +} + +void MainDialog::OnDirChangedPanel2(wxFileDirPickerEvent& event) +{ + wxString newPath = m_dirPicker2->GetPath(); + + m_directoryPanel2->SetValue(newPath); + + //disable the sync button + m_bpButtonSync->Enable(false); + //clear grids + currentGridData.clear(); + writeGrid(currentGridData); + + event.Skip(); +} + +void onFilesDropped(wxString elementName, wxTextCtrl* txtCtrl, wxDirPickerCtrl* dirPicker) +{ + if (wxDirExists(elementName)) + { + txtCtrl->SetValue(elementName); + dirPicker->SetPath(elementName); + } + else + { + elementName = wxFileName(elementName).GetPath(); + if (wxDirExists(elementName)) + { + txtCtrl->SetValue(elementName); + dirPicker->SetPath(elementName); + } + } +} + + +void MainDialog::onFilesDroppedPanel1(wxDropFilesEvent& event) +{ + if (event.m_noFiles >= 1) + { + onFilesDropped(event.GetFiles()[0], m_directoryPanel1, m_dirPicker1); + + //disable the sync button + m_bpButtonSync->Enable(false); + //clear grids + currentGridData.clear(); + writeGrid(currentGridData); + } + event.Skip(); +} + +void MainDialog::onFilesDroppedPanel2(wxDropFilesEvent& event) +{ + if (event.m_noFiles >= 1) + { + onFilesDropped(event.GetFiles()[0], m_directoryPanel2, m_dirPicker2); + + //disable the sync button + m_bpButtonSync->Enable(false); + //clear grids + currentGridData.clear(); + writeGrid(currentGridData); + } + event.Skip(); +} + + +void MainDialog::OnChangeCompareVariant(wxCommandEvent& event) +{ + //disable the sync button + m_bpButtonSync->Enable(false); + //clear grids + currentGridData.clear(); + writeGrid(currentGridData); +} + + +void MainDialog::OnClose(wxCloseEvent &event) +{ + Destroy(); +} + + +void MainDialog::OnQuit(wxCommandEvent &event) +{ + Destroy(); +} + + +void MainDialog::readConfigurationFromHD(const wxString& filename) +{ + //default values + syncConfiguration.exLeftSideOnly = SyncDirRight; + syncConfiguration.exRightSideOnly = SyncDirRight; + syncConfiguration.leftNewer = SyncDirRight; + syncConfiguration.rightNewer = SyncDirRight; + syncConfiguration.different = SyncDirRight; + + leftOnlyFilesActive = true; + leftNewerFilesActive = true; + differentFilesActive = true; + rightNewerFilesActive = true; //do not put these bool values into config.dat! + rightOnlyFilesActive = true; //it's more convenient to have them defaulted for each execution + equalFilesActive = false; + + includeFilter = "*"; //include all files/folders + excludeFilter = ""; //exlude nothing + hideFiltered = false; //show filtered items + filterIsActive = false; //do not filter by default + + useRecycleBin = false; //do not use: in case OS doesn't support this, user will have to activate first and then get the error message +//##################################################### + + ifstream config(filename.c_str()); + if (!config) + return; + + //read sync configuration + syncConfiguration.exLeftSideOnly = SyncDirection(config.get()); + syncConfiguration.exRightSideOnly = SyncDirection(config.get()); + syncConfiguration.leftNewer = SyncDirection(config.get()); + syncConfiguration.rightNewer = SyncDirection(config.get()); + syncConfiguration.different = SyncDirection(config.get()); + + //read find method + switch (int(config.get())) + { + case CompareByTimeAndSize: + m_radioBtnSizeDate->SetValue(true); + break; + case CompareByMD5: + m_radioBtnContent->SetValue(true); + break; + default: + assert (false); + } + + char bigBuffer[10000]; + + //read column sizes + for (int i = 0; i < m_grid1->GetNumberCols(); ++i) + { + config.getline(bigBuffer, 100, char(0)); + m_grid1->SetColSize(i, atoi(bigBuffer)); + } + for (int i = 0; i < m_grid2->GetNumberCols(); ++i) + { + config.getline(bigBuffer, 100, char(0)); + m_grid2->SetColSize(i, atoi(bigBuffer)); + } + + //read application window size and position + Maximize(bool(config.get())); + + config.getline(bigBuffer, 100, char(0)); + int width = atoi(bigBuffer); + config.getline(bigBuffer, 100, char(0)); + int height = atoi(bigBuffer); + config.getline(bigBuffer, 100, char(0)); + int posX = atoi(bigBuffer); + config.getline(bigBuffer, 100, char(0)); + int posY = atoi(bigBuffer); + SetSize(posX, posY, width, height); + + //read last directory selection + config.getline(bigBuffer, 10000, char(0)); + m_directoryPanel1->SetValue(bigBuffer); + if (wxDirExists(bigBuffer)) + m_dirPicker1->SetPath(bigBuffer); + + config.getline(bigBuffer, 10000, char(0)); + m_directoryPanel2->SetValue(bigBuffer); + if (wxDirExists(bigBuffer)) + m_dirPicker2->SetPath(bigBuffer); + + //read filter settings: + hideFiltered = bool(config.get()); + filterIsActive = bool(config.get()); + + //include + config.getline(bigBuffer, 10000, char(0)); + includeFilter = bigBuffer; + + //exclude + config.getline(bigBuffer, 10000, char(0)); + excludeFilter = bigBuffer; + + useRecycleBin = bool(config.get()); + + config.close(); +} + +void MainDialog::writeConfigurationToHD(const wxString& filename) +{ + DWORD dwFileAttributes; + + //make config file visible: needed for ofstream + if (wxFileExists(filename)) + { + dwFileAttributes = FILE_ATTRIBUTE_NORMAL; + if (!SetFileAttributes( + filename.c_str(), // address of filename + dwFileAttributes // address of attributes to set + )) throw runtime_error(string(_("Could not change attributes of ")) + filename.c_str()); + } + + ofstream config(filename.c_str()); + if (!config) + throw runtime_error(string(_("Could not open ")) + filename.c_str()); + + //write sync configuration + config<<char(syncConfiguration.exLeftSideOnly) + <<char(syncConfiguration.exRightSideOnly) + <<char(syncConfiguration.leftNewer) + <<char(syncConfiguration.rightNewer) + <<char(syncConfiguration.different); + + //write find method + if (m_radioBtnSizeDate->GetValue()) + config<<char(CompareByTimeAndSize); + else if (m_radioBtnContent->GetValue()) + config<<char(CompareByMD5); + else assert (false); + + + //write column sizes + for (int i = 0; i < m_grid1->GetNumberCols(); ++i) + config<<m_grid1->GetColSize(i)<<char(0); + for (int i = 0; i < m_grid2->GetNumberCols(); ++i) + config<<m_grid2->GetColSize(i)<<char(0); + + //write application window size + config<<char(IsMaximized()); + //window size + int width = 0; + int height = 0; + GetSize(&width, &height); + config<<width<<char(0); + config<<height<<char(0); + //window position + int posX = 0; + int posY = 0; + GetPosition(&posX, &posY); + config<<posX<<char(0); + config<<posY<<char(0); + + //write last directory selection + config<<m_directoryPanel1->GetValue().c_str()<<char(0) + <<m_directoryPanel2->GetValue().c_str()<<char(0); + + //write filter settings + config<<char(hideFiltered); + config<<char(filterIsActive); + + config<<includeFilter.c_str()<<char(0) + <<excludeFilter.c_str()<<char(0); + + config<<char(useRecycleBin); + + config.close(); + + //hide config file + dwFileAttributes = FILE_ATTRIBUTE_HIDDEN; + if (!SetFileAttributes( + filename.c_str(), // address of filename + dwFileAttributes // address of attributes to set + )) throw runtime_error(string(_("Could not change attributes of ")) + filename.c_str()); +} + +void MainDialog::OnAbout(wxCommandEvent &event) +{ + AboutDlg* aboutDlg = new AboutDlg(this); + aboutDlg->ShowModal(); +} + +void MainDialog::OnShowHelpDialog(wxCommandEvent &event) +{ + HelpDlg* helpDlg = new HelpDlg(this); + helpDlg->ShowModal(); +} + +void MainDialog::OnFilterButton(wxCommandEvent &event) +{ //toggle filter on/off + filterIsActive = !filterIsActive; + + if (filterIsActive) + FreeFileSync::filterCurrentGridData(currentGridData, includeFilter, excludeFilter); + else + FreeFileSync::removeFilterOnCurrentGridData(currentGridData); + + writeGrid(currentGridData); + + //make sure, button-appearance and "filterIsActive" are in sync. + updateFilterButton(); +} + + +void MainDialog::OnHideFilteredButton(wxCommandEvent &event) +{ //toggle showing filtered rows + hideFiltered = !hideFiltered; + + writeGrid(currentGridData); + + //make sure, checkbox and "hideFiltered" are in sync + m_checkBoxHideFilt->SetValue(hideFiltered); +} + + +void MainDialog::OnConfigureFilter(wxHyperlinkEvent &event) +{ + FilterDlg* filterDlg = new FilterDlg(this); + if (filterDlg->ShowModal() == OkayButtonPressed) + { + if (filterIsActive) + { + FreeFileSync::filterCurrentGridData(currentGridData, includeFilter, excludeFilter); + + writeGrid(currentGridData); + } + } + //no event.Skip() here, to not start browser +} + +void MainDialog::OnLeftOnlyFiles(wxCommandEvent& event) +{ + leftOnlyFilesActive = !leftOnlyFilesActive; + updateViewFilterButtons(); + writeGrid(currentGridData); +}; + +void MainDialog::OnLeftNewerFiles(wxCommandEvent& event) +{ + leftNewerFilesActive = !leftNewerFilesActive; + updateViewFilterButtons(); + writeGrid(currentGridData); +}; + +void MainDialog::OnDifferentFiles(wxCommandEvent& event) +{ + differentFilesActive = !differentFilesActive; + updateViewFilterButtons(); + writeGrid(currentGridData); +}; + +void MainDialog::OnRightNewerFiles(wxCommandEvent& event) +{ + rightNewerFilesActive = !rightNewerFilesActive; + updateViewFilterButtons(); + writeGrid(currentGridData); +}; + +void MainDialog::OnRightOnlyFiles(wxCommandEvent& event) +{ + rightOnlyFilesActive = !rightOnlyFilesActive; + updateViewFilterButtons(); + writeGrid(currentGridData); +}; + +void MainDialog::OnEqualFiles(wxCommandEvent& event) +{ + equalFilesActive = !equalFilesActive; + updateViewFilterButtons(); + writeGrid(currentGridData); +}; + +void MainDialog::updateViewFilterButtons() +{ + if (leftOnlyFilesActive) + m_bpButton20->SetBitmapLabel(*GlobalResources::bitmapLeftOnly); + else + m_bpButton20->SetBitmapLabel(*GlobalResources::bitmapLeftOnlyDeact); + + if (leftNewerFilesActive) + m_bpButton21->SetBitmapLabel(*GlobalResources::bitmapLeftNewer); + else + m_bpButton21->SetBitmapLabel(*GlobalResources::bitmapLeftNewerDeact); + + if (differentFilesActive) + m_bpButton22->SetBitmapLabel(*GlobalResources::bitmapDifferent); + else + m_bpButton22->SetBitmapLabel(*GlobalResources::bitmapDifferentDeact); + + if (rightNewerFilesActive) + m_bpButton23->SetBitmapLabel(*GlobalResources::bitmapRightNewer); + else + m_bpButton23->SetBitmapLabel(*GlobalResources::bitmapRightNewerDeact); + + if (rightOnlyFilesActive) + m_bpButton24->SetBitmapLabel(*GlobalResources::bitmapRightOnly); + else + m_bpButton24->SetBitmapLabel(*GlobalResources::bitmapRightOnlyDeact); + + if (equalFilesActive) + m_bpButton25->SetBitmapLabel(*GlobalResources::bitmapEqual); + else + m_bpButton25->SetBitmapLabel(*GlobalResources::bitmapEqualDeact); +} + + +void MainDialog::updateFilterButton() +{ + if (filterIsActive) + { + m_bpButtonFilter->SetBitmapLabel(*GlobalResources::bitmapFilterOn); + m_bpButtonFilter->SetToolTip(_("Filter active: Press again to deactivate")); + } + else + { + m_bpButtonFilter->SetBitmapLabel(*GlobalResources::bitmapFilterOff); + m_bpButtonFilter->SetToolTip(_("Press button to activate filter")); + } +} + + +void MainDialog::OnCompare(wxCommandEvent &event) +{ + if (m_directoryPanel1->GetValue().IsEmpty() || m_directoryPanel2->GetValue().IsEmpty()) + { + wxMessageBox(_("Please select directories for both sides!"), _("Information")); + return; + } + m_statusBar1->SetStatusText(""); + m_statusBar1->SetStatusText("", 1); + m_statusBar1->SetStatusText("", 2); + m_statusBar1->SetStatusText("", 3); + m_statusBar1->SetStatusText("", 4); + + //check if directories exist if loaded by config file + if (!wxDirExists(m_directoryPanel1->GetValue())) + { + wxMessageBox(_("Directory on the left does not exist. Please select a new one!"), _("Warning"), wxICON_WARNING); + return; + } + else if (!wxDirExists(m_directoryPanel2->GetValue())) + { + wxMessageBox(_("Directory on the right does not exist. Please select a new one!"), _("Warning"), wxICON_WARNING); + return; + } + + wxBeginBusyCursor(); + + CompareVariant cmpVar = CompareByTimeAndSize; //assign a value to suppress compiler warning + if (m_radioBtnSizeDate->GetValue()) + cmpVar = CompareByTimeAndSize; + else if (m_radioBtnContent->GetValue()) + cmpVar = CompareByMD5; + else assert (false); + + try + { //class handling status display and error messages + CompareStatusUpdater statusUpdater(this, m_statusBar1); + cmpStatusUpdaterTmp = &statusUpdater; + + //unsigned int startTime3 = GetTickCount(); + FreeFileSync::getModelDiff(currentGridData, + FreeFileSync::getFormattedDirectoryName(m_directoryPanel1->GetValue()), + FreeFileSync::getFormattedDirectoryName(m_directoryPanel2->GetValue()), + cmpVar, + &statusUpdater); + //wxMessageBox(numberToWxString(unsigned(GetTickCount()) - startTime3)); + + + //filter currentGridData if option is set + if (filterIsActive) + FreeFileSync::filterCurrentGridData(currentGridData, includeFilter, excludeFilter); + + writeGrid(currentGridData); + + //once compare is finished enable the sync button + m_bpButtonSync->Enable(true); + + cmpStatusUpdaterTmp = 0; + } + catch (AbortThisProcess& theException) + { + //disable the sync button + m_bpButtonSync->Enable(false); + } + + wxEndBusyCursor(); +} + + +void MainDialog::OnAbortCompare(wxCommandEvent& event) +{ + if (cmpStatusUpdaterTmp) + cmpStatusUpdaterTmp->requestAbortion(); +} + + +inline +wxString MainDialog::evaluateCmpResult(const CompareFilesResult result, const bool selectedForSynchronization) +{ + if (selectedForSynchronization) + switch (result) + { + case FileOnLeftSideOnly: + return "<|"; + break; + case FileOnRightSideOnly: + return "|>"; + break; + case RightFileNewer: + return ">>"; + break; + case LeftFileNewer: + return "<<"; + break; + case FilesDifferent: + return "!="; + break; + case FilesEqual: + return "=="; + break; + default: + assert (false); + } + else return ConstFilteredOut; +} + + +void MainDialog::writeGrid(const FileCompareResult& gridData, bool useUI_GridCache) +{ + //unsigned int startTime = GetTickCount(); + + if (!useUI_GridCache) + { + mapFileModelToUI(currentUI_View, gridData); //update currentUI_View + updateStatusInformation(currentUI_View); //write status information for currentUI_View + } + + m_grid1->BeginBatch(); + m_grid2->BeginBatch(); + m_grid3->BeginBatch(); + + //all three grids retrieve their data directly from currentUI_View via a pointer!!! + //the only thing left to do is notify the grids to update their sizes (nr of rows), since this has to be communicated via messages by the grids + m_grid1->updateGridSizes(); + m_grid2->updateGridSizes(); + m_grid3->updateGridSizes(); + + //enlarge label width to display row numbers correctly + int nrOfRows = m_grid1->GetNumberRows(); + if (nrOfRows >= 1) + { + int nrOfDigits = int(floor(log10(double(nrOfRows)) + 1)); + m_grid1->SetRowLabelSize(nrOfDigits * 8 + 4); + m_grid2->SetRowLabelSize(nrOfDigits * 8 + 4); + } + + //hide sort direction indicator on UI grids + m_grid1->setSortMarker(-1); + m_grid2->setSortMarker(-1); + + + m_grid1->EndBatch(); + m_grid2->EndBatch(); + m_grid3->EndBatch(); + + //wxMessageBox(wxString("Benchmark: ") + numberToWxString(unsigned(GetTickCount()) - startTime) + " ms"); +} + + +void MainDialog::OnSync( wxCommandEvent& event ) +{ + //check if there are files/folders that can be synced + bool nothingToSync = true; + for (FileCompareResult::const_iterator i = currentGridData.begin(); i != currentGridData.end(); ++i) + if (i->cmpResult != FilesEqual) + { + nothingToSync = false; + break; + } + + if (nothingToSync) + { + wxMessageBox(_("Nothing to synchronize. Both directories seem to contain the same data!"), _("Information"), wxICON_WARNING); + return; + } + + SyncDialog* syncDlg = new SyncDialog(this); + if (syncDlg->ShowModal() == SyncDialog::StartSynchronizationProcess) + { + wxBeginBusyCursor(); + + m_statusBar1->SetStatusText(""); + m_statusBar1->SetStatusText("", 1); + m_statusBar1->SetStatusText("", 2); + m_statusBar1->SetStatusText("", 3); + m_statusBar1->SetStatusText("", 4); + + //unsigned int startTime = GetTickCount(); + synchronizeFolders(currentGridData, syncConfiguration); + //wxMessageBox(numberToWxString(unsigned(GetTickCount()) - startTime)); + + wxEndBusyCursor(); + } +} + + +void MainDialog::OnLeftGridDoubleClick(wxGridEvent& event) +{ //default + wxString command = "explorer " + FreeFileSync::getFormattedDirectoryName(m_directoryPanel1->GetValue()); + + if (event.GetRow() < int(currentUI_View.size())) + { + wxString filename = currentGridData[currentUI_View[event.GetRow()].linkToCurrentGridData].fileDescrLeft.filename; + + if (!filename.IsEmpty()) + command = "explorer /select," + filename; + } + wxExecute(command); +} + +void MainDialog::OnRightGridDoubleClick(wxGridEvent& event) +{ //default + wxString command = "explorer " + FreeFileSync::getFormattedDirectoryName(m_directoryPanel2->GetValue()); + + if (event.GetRow() < int(currentUI_View.size())) + { + wxString filename = currentGridData[currentUI_View[event.GetRow()].linkToCurrentGridData].fileDescrRight.filename; + + if (!filename.IsEmpty()) + command = "explorer /select," + filename; + } + wxExecute(command); +} + +//these two global variables are ONLY used for the sorting in the following methods +unsigned int currentSortColumn = 0; +bool sortAscending = true; +FileCompareResult* currentGridDataPtr = 0; + +inline +bool cmpString(const wxString& a, const wxString& b) +{ + if (a.IsEmpty()) + return false; // if a and b are empty: false, if a empty, b not empty: also false, since empty rows should be put below on grid + else if (b.IsEmpty()) + return true; // empty rows after filled rows: return true + + //if a and b not empty: + if (sortAscending) + return (a < b); + else return (a > b); +} + +inline +bool cmpLargeInt(const wxString& a, const wxString& b) +{ + //if a and b not empty: + bool result = true; + wxString tmpString; + mpz_t largeTempIntegerA; + mpz_t largeTempIntegerB; + mpz_init(largeTempIntegerA); + mpz_init(largeTempIntegerB); + mpz_set_str(largeTempIntegerA, a.c_str(), 10); + //return value should be checked: if function fails, largeTempIntegerA is not changed: no issue here + mpz_set_str(largeTempIntegerB, b.c_str(), 10); + //return value should be checked: if function fails, largeTempIntegerA is not changed: no issue here + if (sortAscending) + result = (mpz_cmp(largeTempIntegerA, largeTempIntegerB) < 0); // true if A < B + else + result = (mpz_cmp(largeTempIntegerA, largeTempIntegerB) > 0); // true if A > B + mpz_clear(largeTempIntegerA); + mpz_clear(largeTempIntegerB); + return result; +} + + +bool sortGridLeft(const UI_GridLine& a, const UI_GridLine& b) +{ + switch (currentSortColumn) + { + case 0: + return cmpString(a.leftFilename, b.leftFilename); + break; + case 1: + return cmpString(a.leftRelativePath, b.leftRelativePath); + break; + case 2: + ObjectType typeA = (*currentGridDataPtr)[a.linkToCurrentGridData].fileDescrLeft.objType; + ObjectType typeB = (*currentGridDataPtr)[b.linkToCurrentGridData].fileDescrLeft.objType; + + //presort types: first files, then directories then empty rows + if (typeA == IsNothing) + return false; //empty rows always last + else if (typeB == IsNothing) + return true; //empty rows always last + else if (typeA == IsDirectory) + return false; + else if (typeB == IsDirectory) + return true; + else //use unformatted filesizes and sort by size + return cmpLargeInt((*currentGridDataPtr)[a.linkToCurrentGridData].fileDescrLeft.fileSize, (*currentGridDataPtr)[b.linkToCurrentGridData].fileDescrLeft.fileSize); + + break; + case 3: + return cmpString(a.leftDate, b.leftDate); + break; + default: + assert(false); + } + return true; //dummy command +} + +bool sortGridRight(const UI_GridLine& a, const UI_GridLine& b) +{ + switch (currentSortColumn) + { + case 0: + return cmpString(a.rightFilename, b.rightFilename); + break; + case 1: + return cmpString(a.rightRelativePath, b.rightRelativePath); + break; + case 2: + ObjectType typeA = (*currentGridDataPtr)[a.linkToCurrentGridData].fileDescrRight.objType; + ObjectType typeB = (*currentGridDataPtr)[b.linkToCurrentGridData].fileDescrRight.objType; + + //presort types: first files, then directories then empty rows + if (typeA == IsNothing) + return false; //empty rows always last + else if (typeB == IsNothing) + return true; //empty rows always last + else if (typeA == IsDirectory) + return false; + else if (typeB == IsDirectory) + return true; + else //use unformatted filesizes and sort by size + return cmpLargeInt((*currentGridDataPtr)[a.linkToCurrentGridData].fileDescrRight.fileSize, (*currentGridDataPtr)[b.linkToCurrentGridData].fileDescrRight.fileSize); + + break; + case 3: + return cmpString(a.rightDate, b.rightDate); + break; + default: + assert(false); + } + return true; //dummy command +} + +void MainDialog::OnSortLeftGrid(wxGridEvent& event) +{ + static bool columnSortAscending[4] = {true, true, false, true}; + + currentSortColumn = event.GetCol(); + currentGridDataPtr = ¤tGridData; + if (0 <= currentSortColumn && currentSortColumn <= 3) + { + sortAscending = columnSortAscending[currentSortColumn]; + columnSortAscending[currentSortColumn] = !columnSortAscending[currentSortColumn]; + sort(currentUI_View.begin(), currentUI_View.end(), sortGridLeft); + writeGrid(currentGridData, true); //use UI buffer, no mapping from currentGridData to UI model again + //set sort direction indicator on UI + if (sortAscending) + m_grid1->setSortMarker(currentSortColumn, GlobalResources::bitmapSmallUp); + else + m_grid1->setSortMarker(currentSortColumn, GlobalResources::bitmapSmallDown); + m_grid2->setSortMarker(-1); + } + event.Skip(); +} + +void MainDialog::OnSortRightGrid(wxGridEvent& event) +{ + static bool columnSortAscending[4] = {true, true, false, true}; + + currentSortColumn = event.GetCol(); + currentGridDataPtr = ¤tGridData; + if (0 <= currentSortColumn && currentSortColumn <= 3) + { + sortAscending = columnSortAscending[currentSortColumn]; + columnSortAscending[currentSortColumn] = !columnSortAscending[currentSortColumn]; + sort(currentUI_View.begin(), currentUI_View.end(), sortGridRight); + writeGrid(currentGridData, true); + //set sort direction indicator on UI + m_grid1->setSortMarker(-1); + if (sortAscending) + m_grid2->setSortMarker(currentSortColumn, GlobalResources::bitmapSmallUp); + else + m_grid2->setSortMarker(currentSortColumn, GlobalResources::bitmapSmallDown); + } + event.Skip(); +} + + +void MainDialog::OnSwapDirs( wxCommandEvent& event ) +{ + //swap directory names + wxString tmp = m_directoryPanel1->GetValue(); + m_directoryPanel1->SetValue(m_directoryPanel2->GetValue()); + m_directoryPanel2->SetValue(tmp); + + //swap grid information + FreeFileSync::swapGrids(currentGridData); + writeGrid(currentGridData); +} + + +void MainDialog::synchronizeFolders(FileCompareResult& grid, const SyncConfiguration config) +{ + try + { //class handling status updates and error messages + SyncStatusUpdater statusUpdater(this, FreeFileSync::calcTotalBytesToTransfer(grid, config).get_d()); + + //start synchronization and return elements that were errorneous in "grid" + + //unsigned int startTime3 = GetTickCount(); + FreeFileSync::startSynchronizationProcess(grid, config, &statusUpdater, useRecycleBin); + //wxMessageBox(numberToWxString(unsigned(GetTickCount()) - startTime3)); + + + //display files that couldn't be processed + writeGrid(grid); + } + catch (AbortThisProcess& theException) + { + //disable the sync button + m_bpButtonSync->Enable(false); + } +} + +//this sorting method is currently NOT used +bool cmpGridSmallerThan(const UI_GridLine& a, const UI_GridLine& b) +{ + wxString cmpStringA; + wxString cmpStringB; + + for (int i = 0; i < 4; ++i) + { + switch (i) + { + case 0: + cmpStringA = a.leftRelativePath; + cmpStringB = b.leftRelativePath; + break; + case 1: + cmpStringA = a.leftFilename; + cmpStringB = b.leftFilename; + break; + case 2: + cmpStringA = a.rightRelativePath; + cmpStringB = b.rightRelativePath; + break; + case 3: + cmpStringA = a.rightFilename; + cmpStringB = b.rightFilename; + break; + default: + assert (false); + } + if (cmpStringA.IsEmpty()) + cmpStringA = '\255'; + if (cmpStringB.IsEmpty()) + cmpStringB = '\255'; + + if (cmpStringA != cmpStringB) + return (cmpStringA < cmpStringB); + } + return (false); +} + + +void MainDialog::updateStatusInformation(const UI_Grid& visibleGrid) +{ + unsigned int objectsOnLeftView = 0; + unsigned int objectsOnRightView = 0; + mpz_t filesizeLeftView, filesizeRightView, tmpInt; + mpz_init(filesizeLeftView); + mpz_init(filesizeRightView); + mpz_init(tmpInt); + + int returnValue = 0; + + for (UI_Grid::const_iterator i = visibleGrid.begin(); i != visibleGrid.end(); i++) + { + const FileCompareLine& refLine = currentGridData[i->linkToCurrentGridData]; + + //calculate total number of bytes for each sied + if (refLine.fileDescrLeft.objType != IsNothing) + { + mpz_set_ui(tmpInt, 0); + returnValue = mpz_set_str(tmpInt, refLine.fileDescrLeft.fileSize.c_str(), 10); + mpz_add(filesizeLeftView, filesizeLeftView, tmpInt); + assert (returnValue == 0); + + objectsOnLeftView++; + } + + if (refLine.fileDescrRight.objType != IsNothing) + { + mpz_set_ui(tmpInt, 0); + returnValue = mpz_set_str(tmpInt, refLine.fileDescrRight.fileSize.c_str(), 10); + mpz_add(filesizeRightView, filesizeRightView, tmpInt); + assert (returnValue == 0); + + objectsOnRightView++; + } + } + + //show status information on "root" level. This cannot be accomplished in writeGrid since filesizes are already formatted for display there + wxString objectsViewLeft = numberToWxString(objectsOnLeftView); + GlobalFunctions::includeNumberSeparator(objectsViewLeft); + if (objectsOnLeftView == 1) + m_statusBar1->SetStatusText(wxString(_("1 item on left, ")) + FreeFileSync::formatFilesizeToShortString(mpz_class(filesizeLeftView)), 0); + else + m_statusBar1->SetStatusText(objectsViewLeft + _(" items on left, ") + FreeFileSync::formatFilesizeToShortString(mpz_class(filesizeLeftView)), 0); + + + wxString objectsTotal = numberToWxString(currentGridData.size()); + GlobalFunctions::includeNumberSeparator(objectsTotal); + wxString objectsView = numberToWxString(visibleGrid.size()); + GlobalFunctions::includeNumberSeparator(objectsView); + if (currentGridData.size() == 1) + m_statusBar1->SetStatusText(objectsView + _(" of ") + objectsTotal + _(" row in view"), 2); + else + m_statusBar1->SetStatusText(objectsView + _(" of ") + objectsTotal + _(" rows in view"), 2); + + + wxString objectsViewRight = numberToWxString(objectsOnRightView); + GlobalFunctions::includeNumberSeparator(objectsViewRight); + if (objectsOnRightView == 1) + m_statusBar1->SetStatusText(wxString(_("1 item on right, ")) + FreeFileSync::formatFilesizeToShortString(mpz_class(filesizeRightView)), 4); + else + m_statusBar1->SetStatusText(objectsViewRight + _(" items on right, ") + FreeFileSync::formatFilesizeToShortString(mpz_class(filesizeRightView)), 4); + + //----------------------------------------------------- + mpz_clear(filesizeLeftView); + mpz_clear(filesizeRightView); + mpz_clear(tmpInt); +} + + +void MainDialog::mapFileModelToUI(UI_Grid& output, const FileCompareResult& fileCmpResult) +{ + output.clear(); + + UI_GridLine gridline; + unsigned int currentRow = 0; + wxString fileSize; //tmp string + for (FileCompareResult::const_iterator i = fileCmpResult.begin(); i != fileCmpResult.end(); i++, currentRow++) + { + //process UI filter settings + switch (i->cmpResult) + { + case FileOnLeftSideOnly: + if (!leftOnlyFilesActive) continue; + break; + case FileOnRightSideOnly: + if (!rightOnlyFilesActive) continue; + break; + case RightFileNewer: + if (!rightNewerFilesActive) continue; + break; + case LeftFileNewer: + if (!leftNewerFilesActive) continue; + break; + case FilesDifferent: + if (!differentFilesActive) continue; + break; + case FilesEqual: + if (!equalFilesActive) continue; + break; + default: + assert (false); + } + + //hide filtered row, if corresponding option is set + if (hideFiltered && !i->selectedForSynchronization) + continue; + + if (i->fileDescrLeft.objType == IsDirectory) + { + gridline.leftFilename = wxEmptyString; + gridline.leftRelativePath = i->fileDescrLeft.relFilename; + gridline.leftSize = _("<Directory>"); + } + else + { + gridline.leftFilename = i->fileDescrLeft.relFilename.AfterLast('\\'); + gridline.leftRelativePath = i->fileDescrLeft.relFilename.BeforeLast('\\'); + gridline.leftSize = GlobalFunctions::includeNumberSeparator(fileSize = i->fileDescrLeft.fileSize); + } + gridline.leftDate = i->fileDescrLeft.lastWriteTime; + + gridline.cmpResult = evaluateCmpResult(i->cmpResult, i->selectedForSynchronization); + gridline.linkToCurrentGridData = currentRow; + + if (i->fileDescrRight.objType == IsDirectory) + { + gridline.rightFilename = wxEmptyString; + gridline.rightRelativePath = i->fileDescrRight.relFilename; + gridline.rightSize = _("<Directory>"); + } + else + { + gridline.rightFilename = i->fileDescrRight.relFilename.AfterLast('\\'); + gridline.rightRelativePath = i->fileDescrRight.relFilename.BeforeLast('\\'); + gridline.rightSize = GlobalFunctions::includeNumberSeparator(fileSize = i->fileDescrRight.fileSize); + } + gridline.rightDate = i->fileDescrRight.lastWriteTime; + + output.push_back(gridline); + } + + //sorting is expensive: ca. 50% bigger runtime for large grids; unsorted doesn't look too bad, so it's disabled + // sort(output.begin(), output.end(), cmpGridSmallerThan); +} +//######################################################################################################## + + +void updateUI_Now() +{ + //process UI events and prevent application from "not responding" -> NO performance issue! + while (wxTheApp->Pending()) + wxTheApp->Dispatch(); +} + + +bool updateUI_IsAllowed() +{ + static wxLongLong lastExec = 0; + + wxLongLong newExec = wxGetLocalTimeMillis(); + + if (newExec - lastExec > 100) //perform ui updates not more often than necessary, 100 seems to be a good value with only a minimal performance loss + { + lastExec = newExec; + return true; + } + return false; +} + +//######################################################################################################## + + +CompareStatusUpdater::CompareStatusUpdater(MainDialog* dlg, wxStatusBar* mainWindowBar) : + mainDialog(dlg), + statusBar(mainWindowBar), + suppressUI_Errormessages(false), + numberOfScannedObjects(0) +{ + //prevent user input during "compare", do not disable maindialog since abort-button would also be disabled + //it's not nice, but works - even has the advantage that certain actions are still possible: exit, about.. + mainDialog->m_radioBtnSizeDate->Disable(); + mainDialog->m_radioBtnContent->Disable(); + mainDialog->m_bpButtonFilter->Disable(); + mainDialog->m_hyperlinkCfgFilter->Disable(); + mainDialog->m_checkBoxHideFilt->Disable(); + mainDialog->m_bpButtonSync->Disable(); + mainDialog->m_dirPicker1->Disable(); + mainDialog->m_dirPicker2->Disable(); + mainDialog->m_bpButtonSwap->Disable(); + mainDialog->m_bpButton20->Disable(); + mainDialog->m_bpButton21->Disable(); + mainDialog->m_bpButton22->Disable(); + mainDialog->m_bpButton23->Disable(); + mainDialog->m_bpButton24->Disable(); + mainDialog->m_bpButton25->Disable(); + mainDialog->m_panel1->Disable(); + mainDialog->m_panel2->Disable(); + mainDialog->m_panel3->Disable(); + + //show abort button + mainDialog->m_buttonAbort->Show(true); + mainDialog->m_bpButtonCompare->Show(false); + mainDialog->Layout(); + mainDialog->Refresh(); +} + +CompareStatusUpdater::~CompareStatusUpdater() +{ + //reenable complete main dialog + mainDialog->m_radioBtnSizeDate->Enable(); + mainDialog->m_radioBtnContent->Enable(); + mainDialog->m_bpButtonFilter->Enable(); + mainDialog->m_hyperlinkCfgFilter->Enable(); + mainDialog->m_checkBoxHideFilt->Enable(); + //mainDialog->m_bpButtonSync->Enable(); don't enable this one, this is up to OnCompare to handle its status + mainDialog->m_dirPicker1->Enable(); + mainDialog->m_dirPicker2->Enable(); + mainDialog->m_bpButtonSwap->Enable(); + mainDialog->m_bpButton20->Enable(); + mainDialog->m_bpButton21->Enable(); + mainDialog->m_bpButton22->Enable(); + mainDialog->m_bpButton23->Enable(); + mainDialog->m_bpButton24->Enable(); + mainDialog->m_bpButton25->Enable(); + mainDialog->m_panel1->Enable(); + mainDialog->m_panel2->Enable(); + mainDialog->m_panel3->Enable(); + + if (abortionRequested) + mainDialog->m_statusBar1->SetStatusText(mainDialog->m_statusBar1->GetStatusText(2) + " - " + _("Aborted!"), 2); + + mainDialog->m_buttonAbort->Show(false); + mainDialog->m_bpButtonCompare->Show(true); + mainDialog->Layout(); + mainDialog->Refresh(); +} + +void CompareStatusUpdater::updateStatus(const wxString& text) +{ + //not relevant for "compare"; it's sufficient to display the number of scanned files/folders +} + +inline +void CompareStatusUpdater::updateProgressIndicator(double number) +{ + numberOfScannedObjects+= int(number); //conversion is harmless, since number == 1 in case of "compare" +} + +int CompareStatusUpdater::reportError(const wxString& text) +{ + if (suppressUI_Errormessages) + return StatusUpdater::Continue; + + wxString errorMessage = text + _("\n\nContinue with next object, retry or abort comparison?"); + + ErrorDlg* errorDlg = new ErrorDlg(errorMessage, suppressUI_Errormessages); + + int rv = errorDlg->ShowModal(); + errorDlg->Destroy(); + + switch (rv) + { + case ErrorDlg::ContinueButtonPressed: + return StatusUpdater::Continue; + case ErrorDlg::RetryButtonPressed: + return StatusUpdater::Retry; + case ErrorDlg::AbortButtonPressed: + { + abortionRequested = true; + throw AbortThisProcess(); + } + default: + assert (false); + } + + return StatusUpdater::Continue; //dummy return value +} + + +inline +void CompareStatusUpdater::triggerUI_Refresh() +{ + if (abortionRequested) throw AbortThisProcess(); //abort can be triggered by syncStatusFrame + + if (updateUI_IsAllowed()) //test if specific time span between ui updates is over + { + statusBar->SetStatusText(wxString(_("Scanning files/folders: ")) + numberToWxString(numberOfScannedObjects), 2); + updateUI_Now(); + } +} +//######################################################################################################## + + +SyncStatusUpdater::SyncStatusUpdater(wxWindow* dlg, double gaugeTotalElements) : + suppressUI_Errormessages(false) +{ + syncStatusFrame = new SyncStatus(this, gaugeTotalElements, dlg); + syncStatusFrame->Show(); + updateUI_Now(); +} + +SyncStatusUpdater::~SyncStatusUpdater() +{ + if (abortionRequested) + syncStatusFrame->processHasFinished(_("Aborted!")); //enable okay and close events + else + syncStatusFrame->processHasFinished(_("Completed")); + + //print the results list + unsigned int failedItems = unhandledErrors.GetCount(); + wxString result; + if (failedItems) + { + result = wxString(_("Warning: Synchronization failed for ")) + numberToWxString(failedItems) + _(" item(s):\n\n"); + for (unsigned int j = 0; j < failedItems; ++j) + result+= unhandledErrors[j] + "\n"; + } + syncStatusFrame->setStatusText_NoUpdate(result); + syncStatusFrame->updateStatusDialogNow(); +} + + +inline +void SyncStatusUpdater::updateStatus(const wxString& text) +{ + syncStatusFrame->setStatusText_NoUpdate(text); +} + + +inline +void SyncStatusUpdater::updateProgressIndicator(double number) +{ + syncStatusFrame->incProgressIndicator_NoUpdate(number); +} + + +int SyncStatusUpdater::reportError(const wxString& text) +{ + if (suppressUI_Errormessages) + { + unhandledErrors.Add(text); + return StatusUpdater::Continue; + } + + wxString errorMessage = text + _("\n\nContinue with next object, retry or abort synchronization?"); + + ErrorDlg* errorDlg = new ErrorDlg(errorMessage, suppressUI_Errormessages); + + int rv = errorDlg->ShowModal(); + errorDlg->Destroy(); + + switch (rv) + { + case ErrorDlg::ContinueButtonPressed: + unhandledErrors.Add(text); + return StatusUpdater::Continue; + case ErrorDlg::RetryButtonPressed: + return StatusUpdater::Retry; + case ErrorDlg::AbortButtonPressed: + { + unhandledErrors.Add(text); + abortionRequested = true; + throw AbortThisProcess(); + } + default: + assert (false); + } + + return StatusUpdater::Continue; //dummy return value +} + + +void SyncStatusUpdater::triggerUI_Refresh() +{ + if (abortionRequested) + throw AbortThisProcess(); //abort can be triggered by syncStatusFrame + + if (updateUI_IsAllowed()) //test if specific time span between ui updates is over + { + syncStatusFrame->updateStatusDialogNow(); + } +} + + diff --git a/ui/MainDialog.h b/ui/MainDialog.h new file mode 100644 index 00000000..4c2486b9 --- /dev/null +++ b/ui/MainDialog.h @@ -0,0 +1,220 @@ +/*************************************************************** + * Name: FreeFileSyncMain.h + * Purpose: Defines Application Frame + * Author: ZenJu (zhnmju123@gmx.de) + * Created: 2008-07-16 + * Copyright: ZenJu () + * License: + **************************************************************/ + +#ifndef MAINDIALOG_H +#define MAINDIALOG_H + +#include "..\library\wxWidgets.h" +#include "GUI_Generated.h" +#include "..\FreeFileSync.h" + +#include "SyncDialog.h" +#include "SmallDialogs.h" +#include "Resources.h" + +using namespace std; + +//configure filter dialog +const int OkayButtonPressed = 25; + +const wxString ConstFilteredOut = "(-)"; + +struct UI_GridLine +{ + wxString leftFilename; + wxString leftRelativePath; + wxString leftSize; + wxString leftDate; + + wxString cmpResult; + + wxString rightFilename; + wxString rightRelativePath; + wxString rightSize; + wxString rightDate; + + unsigned int linkToCurrentGridData; //rownumber of corresponding row in currentGridData +}; +typedef vector<UI_GridLine> UI_Grid; + +bool updateUI_IsAllowed(); //test if a specific amount of time is over +void updateUI_Now(); //do the updating + + +extern int leadingPanel; + +class CompareStatusUpdater; + +class MainDialog : public GUI_Generated +{ +public: + MainDialog(wxFrame* frame); + ~MainDialog(); + +private: + friend class SyncDialog; + friend class FilterDlg; + friend class CompareStatusUpdater; + friend class SyncStatusUpdater; + + void readConfigurationFromHD(const wxString& filename); + void writeConfigurationToHD(const wxString& filename); + + void loadResourceFiles(); + void unloadResourceFiles(); + + void updateViewFilterButtons(); + void updateFilterButton(); + + void synchronizeFolders(FileCompareResult& grid, const SyncConfiguration config); + + static wxString evaluateCmpResult(const CompareFilesResult result, const bool selectedForSynchronization); + + //main method for putting gridData on UI: maps data respecting current view settings + void writeGrid(const FileCompareResult& gridData, bool useUI_GridCache = false); + + void mapFileModelToUI(UI_Grid& output, const FileCompareResult& fileCmpResult); + void updateStatusInformation(const UI_Grid& output); + + void filterRangeManual(int begin, int end, int leadingRow); + + //Events + void onGrid1access(wxEvent& event); + void onGrid2access(wxEvent& event); + void onGrid3access(wxEvent& event); + + void onGrid1ButtonEvent(wxKeyEvent& event); + void onGrid2ButtonEvent(wxKeyEvent& event); + + void OnEnterLeftDir(wxCommandEvent& event); + void OnEnterRightDir(wxCommandEvent& event); + void OnDirChangedPanel1(wxFileDirPickerEvent& event); + void OnDirChangedPanel2(wxFileDirPickerEvent& event); + void onFilesDroppedPanel1(wxDropFilesEvent& event); + void onFilesDroppedPanel2(wxDropFilesEvent& event); + + void OnGrid3SelectCell(wxGridEvent& event); + void OnGrid3SelectRange(wxGridRangeSelectEvent& event); + void OnGrid3LeftMouseUp(wxEvent& event); + void OnIdleToFilterManually(wxEvent& event); + + void OnLeftGridDoubleClick( wxGridEvent& event); + void OnRightGridDoubleClick(wxGridEvent& event); + void OnSortLeftGrid( wxGridEvent& event); + void OnSortRightGrid( wxGridEvent& event); + + void OnLeftOnlyFiles( wxCommandEvent& event); + void OnLeftNewerFiles( wxCommandEvent& event); + void OnDifferentFiles( wxCommandEvent& event); + void OnRightNewerFiles( wxCommandEvent& event); + void OnRightOnlyFiles( wxCommandEvent& event); + void OnEqualFiles( wxCommandEvent& event); + + void OnAbortCompare( wxCommandEvent& event); + void OnFilterButton( wxCommandEvent& event); + void OnHideFilteredButton( wxCommandEvent& event); + void OnConfigureFilter( wxHyperlinkEvent& event); + void OnShowHelpDialog( wxCommandEvent& event); + void OnSwapDirs( wxCommandEvent& event); + void OnChangeCompareVariant(wxCommandEvent& event); + void OnCompare( wxCommandEvent& event); + void OnSync( wxCommandEvent& event); + void OnClose( wxCloseEvent& event); + void OnQuit( wxCommandEvent& event); + void OnAbout( wxCommandEvent& event); + +//*********************************************** + //global application variables are stored here: + + //technical representation of grid-data + FileCompareResult currentGridData; + + //UI view of currentGridData + UI_Grid currentUI_View; + + //Synchronisation settings + SyncConfiguration syncConfiguration; + + //Filter setting + wxString includeFilter; + wxString excludeFilter; + bool hideFiltered; + bool filterIsActive; + + //UI View Filter settings + bool leftOnlyFilesActive; + bool leftNewerFilesActive; + bool differentFilesActive; + bool equalFilesActive; + bool rightNewerFilesActive; + bool rightOnlyFilesActive; + + //other options + bool useRecycleBin; //use Recycle bin when deleting or overwriting files while synchronizing + +//*********************************************** + + wxFrame* parent; + + //variables for manual filtering of m_grid3 + int selectedRangeBegin; + int selectedRangeEnd; + int selectionLead; + bool filteringPending; + + CompareStatusUpdater* cmpStatusUpdaterTmp; //used only by the abort button when comparing +}; + +//###################################################################################### + +//classes handling sync and compare error as well as status information + +class CompareStatusUpdater : public StatusUpdater +{ +public: + CompareStatusUpdater(MainDialog* dlg, wxStatusBar* mainWindowBar); + ~CompareStatusUpdater(); + + void updateStatus(const wxString& text); + void updateProgressIndicator(double number); + int reportError(const wxString& text); + + void triggerUI_Refresh(); + +private: + MainDialog* mainDialog; + wxStatusBar* statusBar; + bool suppressUI_Errormessages; + + unsigned int numberOfScannedObjects; +}; + +class SyncStatus; + +class SyncStatusUpdater : public StatusUpdater +{ +public: + SyncStatusUpdater(wxWindow* dlg, double gaugeTotalElements); + ~SyncStatusUpdater(); + + void updateStatus(const wxString& text); + void updateProgressIndicator(double number); + int reportError(const wxString& text); + + void triggerUI_Refresh(); + +private: + SyncStatus* syncStatusFrame; + + bool suppressUI_Errormessages; + wxArrayString unhandledErrors; //list of non-resolved errors +}; + + +#endif // MAINDIALOG_H diff --git a/ui/Resources.cpp b/ui/Resources.cpp new file mode 100644 index 00000000..d4db282c --- /dev/null +++ b/ui/Resources.cpp @@ -0,0 +1,111 @@ +#include "Resources.h" +#include <wx/wfstream.h> +#include <wx/zipstrm.h> +#include <wx/image.h> +#include <stdexcept> //for std::runtime_error + +map<wxString, wxBitmap*> GlobalResources::bitmapResource; + +wxBitmap* GlobalResources::bitmapLeftArrow = 0; +wxBitmap* GlobalResources::bitmapStartSync = 0; +wxBitmap* GlobalResources::bitmapRightArrow = 0; +wxBitmap* GlobalResources::bitmapDelete = 0; +wxBitmap* GlobalResources::bitmapEmail = 0; +wxBitmap* GlobalResources::bitmapAbout = 0; +wxBitmap* GlobalResources::bitmapWebsite = 0; +wxBitmap* GlobalResources::bitmapExit = 0; +wxBitmap* GlobalResources::bitmapSync = 0; +wxBitmap* GlobalResources::bitmapCompare = 0; +wxBitmap* GlobalResources::bitmapSyncDisabled = 0; +wxBitmap* GlobalResources::bitmapSwap = 0; +wxBitmap* GlobalResources::bitmapHelp = 0; +wxBitmap* GlobalResources::bitmapLeftOnly = 0; +wxBitmap* GlobalResources::bitmapLeftNewer = 0; +wxBitmap* GlobalResources::bitmapDifferent = 0; +wxBitmap* GlobalResources::bitmapRightNewer = 0; +wxBitmap* GlobalResources::bitmapRightOnly = 0; +wxBitmap* GlobalResources::bitmapLeftOnlyDeact = 0; +wxBitmap* GlobalResources::bitmapLeftNewerDeact = 0; +wxBitmap* GlobalResources::bitmapDifferentDeact = 0; +wxBitmap* GlobalResources::bitmapRightNewerDeact = 0; +wxBitmap* GlobalResources::bitmapRightOnlyDeact = 0; +wxBitmap* GlobalResources::bitmapEqual = 0; +wxBitmap* GlobalResources::bitmapEqualDeact = 0; +wxBitmap* GlobalResources::bitmapInclude = 0; +wxBitmap* GlobalResources::bitmapExclude = 0; +wxBitmap* GlobalResources::bitmapFilterOn = 0; +wxBitmap* GlobalResources::bitmapFilterOff = 0; +wxBitmap* GlobalResources::bitmapWarning = 0; +wxBitmap* GlobalResources::bitmapSmallUp = 0; +wxBitmap* GlobalResources::bitmapSmallDown = 0; + +wxAnimation* GlobalResources::animationMoney = 0; + + +void GlobalResources::loadResourceFiles() +{ + //map, allocate and initialize pictures + bitmapResource["left arrow.png"] = (bitmapLeftArrow = new wxBitmap(wxNullBitmap)); + bitmapResource["start sync.png"] = (bitmapStartSync = new wxBitmap(wxNullBitmap)); + bitmapResource["right arrow.png"] = (bitmapRightArrow = new wxBitmap(wxNullBitmap)); + bitmapResource["delete.png"] = (bitmapDelete = new wxBitmap(wxNullBitmap)); + bitmapResource["email.png"] = (bitmapEmail = new wxBitmap(wxNullBitmap)); + bitmapResource["about.png"] = (bitmapAbout = new wxBitmap(wxNullBitmap)); + bitmapResource["website.png"] = (bitmapWebsite = new wxBitmap(wxNullBitmap)); + bitmapResource["exit.png"] = (bitmapExit = new wxBitmap(wxNullBitmap)); + bitmapResource["sync.png"] = (bitmapSync = new wxBitmap(wxNullBitmap)); + bitmapResource["compare.png"] = (bitmapCompare = new wxBitmap(wxNullBitmap)); + bitmapResource["sync disabled.png"] = (bitmapSyncDisabled = new wxBitmap(wxNullBitmap)); + bitmapResource["swap.png"] = (bitmapSwap = new wxBitmap(wxNullBitmap)); + bitmapResource["help.png"] = (bitmapHelp = new wxBitmap(wxNullBitmap)); + bitmapResource["leftOnly.png"] = (bitmapLeftOnly = new wxBitmap(wxNullBitmap)); + bitmapResource["leftNewer.png"] = (bitmapLeftNewer = new wxBitmap(wxNullBitmap)); + bitmapResource["different.png"] = (bitmapDifferent = new wxBitmap(wxNullBitmap)); + bitmapResource["rightNewer.png"] = (bitmapRightNewer = new wxBitmap(wxNullBitmap)); + bitmapResource["rightOnly.png"] = (bitmapRightOnly = new wxBitmap(wxNullBitmap)); + bitmapResource["leftOnlyDeact.png"] = (bitmapLeftOnlyDeact = new wxBitmap(wxNullBitmap)); + bitmapResource["leftNewerDeact.png"] = (bitmapLeftNewerDeact = new wxBitmap(wxNullBitmap)); + bitmapResource["differentDeact.png"] = (bitmapDifferentDeact = new wxBitmap(wxNullBitmap)); + bitmapResource["rightNewerDeact.png"] = (bitmapRightNewerDeact = new wxBitmap(wxNullBitmap)); + bitmapResource["rightOnlyDeact.png"] = (bitmapRightOnlyDeact = new wxBitmap(wxNullBitmap)); + bitmapResource["equal.png"] = (bitmapEqual = new wxBitmap(wxNullBitmap)); + bitmapResource["equalDeact.png"] = (bitmapEqualDeact = new wxBitmap(wxNullBitmap)); + bitmapResource["include.png"] = (bitmapInclude = new wxBitmap(wxNullBitmap)); + bitmapResource["exclude.png"] = (bitmapExclude = new wxBitmap(wxNullBitmap)); + bitmapResource["filter active.png"] = (bitmapFilterOn = new wxBitmap(wxNullBitmap)); + bitmapResource["filter not active.png"] = (bitmapFilterOff = new wxBitmap(wxNullBitmap)); + bitmapResource["Warning.png"] = (bitmapWarning = new wxBitmap(wxNullBitmap)); + bitmapResource["small arrow up.png"] = (bitmapSmallUp = new wxBitmap(wxNullBitmap)); + bitmapResource["small arrow down.png"] = (bitmapSmallDown = new wxBitmap(wxNullBitmap)); + + animationMoney = new wxAnimation(wxNullAnimation); + + wxFileInputStream input("Resources.dat"); + if (!input.IsOk()) throw runtime_error(_("Unable to load Resources.dat!")); + + wxZipInputStream resourceFile(input); + + wxZipEntry* entry; + map<wxString, wxBitmap*>::iterator bmp; + while (entry = resourceFile.GetNextEntry()) + { + wxString name = entry->GetName(); + + //just to be sure: search if entry is available in map + if ((bmp = bitmapResource.find(name)) != bitmapResource.end()) + *(bmp->second) = wxBitmap(wxImage(resourceFile, wxBITMAP_TYPE_PNG)); + } + + animationMoney->LoadFile("Resources.a01"); +} + + +void GlobalResources::unloadResourceFiles() +{ + //free bitmap resources + for (map<wxString, wxBitmap*>::iterator i = bitmapResource.begin(); i != bitmapResource.end(); ++i) + delete i->second; + + //free other resources + delete animationMoney; +} diff --git a/ui/Resources.h b/ui/Resources.h new file mode 100644 index 00000000..fba26f03 --- /dev/null +++ b/ui/Resources.h @@ -0,0 +1,59 @@ +#ifndef RESOURCES_H_INCLUDED +#define RESOURCES_H_INCLUDED + +#include <wx/bitmap.h> +#include <wx/animate.h> +#include <wx/string.h> +#include <map> + +using namespace std; + +class GlobalResources +{ +public: + + static void loadResourceFiles(); + static void unloadResourceFiles(); + + static wxBitmap* bitmapLeftArrow; + static wxBitmap* bitmapStartSync; + static wxBitmap* bitmapRightArrow; + static wxBitmap* bitmapDelete; + static wxBitmap* bitmapEmail; + static wxBitmap* bitmapAbout; + static wxBitmap* bitmapWebsite; + static wxBitmap* bitmapExit; + static wxBitmap* bitmapSync; + static wxBitmap* bitmapCompare; + static wxBitmap* bitmapSyncDisabled; + static wxBitmap* bitmapSwap; + static wxBitmap* bitmapHelp; + static wxBitmap* bitmapLeftOnly; + static wxBitmap* bitmapLeftNewer; + static wxBitmap* bitmapDifferent; + static wxBitmap* bitmapRightNewer; + static wxBitmap* bitmapRightOnly; + static wxBitmap* bitmapLeftOnlyDeact; + static wxBitmap* bitmapLeftNewerDeact; + static wxBitmap* bitmapDifferentDeact; + static wxBitmap* bitmapRightNewerDeact; + static wxBitmap* bitmapRightOnlyDeact; + static wxBitmap* bitmapEqual; + static wxBitmap* bitmapEqualDeact; + static wxBitmap* bitmapInclude; + static wxBitmap* bitmapExclude; + static wxBitmap* bitmapFilterOn; + static wxBitmap* bitmapFilterOff; + static wxBitmap* bitmapWarning; + static wxBitmap* bitmapSmallUp; + static wxBitmap* bitmapSmallDown; + + static wxAnimation* animationMoney; + +private: + //resource mapping + static map<wxString, wxBitmap*> bitmapResource; +}; + + +#endif // RESOURCES_H_INCLUDED diff --git a/ui/SmallDialogs.cpp b/ui/SmallDialogs.cpp new file mode 100644 index 00000000..f6d29864 --- /dev/null +++ b/ui/SmallDialogs.cpp @@ -0,0 +1,229 @@ +#include "SmallDialogs.h" +#include "..\library\globalFunctions.h" + +AboutDlg::AboutDlg(MainDialog* window) : AboutDlgGenerated(window) +{ + m_bitmap9->SetBitmap(*GlobalResources::bitmapWebsite); + m_bitmap10->SetBitmap(*GlobalResources::bitmapEmail); + + m_animationControl1->SetAnimation(*GlobalResources::animationMoney); + m_animationControl1->Play(); + + //build + wxString build = wxString(_("(Build: ")) + __TDATE__ + ")"; + m_build->SetLabel(build); +} + +AboutDlg::~AboutDlg() {} + +void AboutDlg::OnClose(wxCloseEvent& event) +{ + Destroy(); +} + +void AboutDlg::OnOK(wxCommandEvent& event) +{ + Destroy(); +} +//######################################################################################## + + +HelpDlg::HelpDlg(MainDialog* window) : HelpDlgGenerated(window) {} + +HelpDlg::~HelpDlg() {} + + +void HelpDlg::OnClose(wxCloseEvent& event) +{ + Destroy(); +} + + +void HelpDlg::OnOK(wxCommandEvent& event) +{ + Destroy(); +} +//######################################################################################## + + +FilterDlg::FilterDlg(MainDialog* window) : FilterDlgGenerated(window), mainDialog(window) +{ + + m_bitmap8->SetBitmap(*GlobalResources::bitmapInclude); + m_bitmap9->SetBitmap(*GlobalResources::bitmapExclude); + + m_textCtrlInclude->SetValue(mainDialog->includeFilter); + m_textCtrlExclude->SetValue(mainDialog->excludeFilter); +} + +FilterDlg::~FilterDlg() {} + +void FilterDlg::OnClose(wxCloseEvent& event) +{ + EndModal(0); +} + +void FilterDlg::OnOK(wxCommandEvent& event) +{ + //only if user presses ApplyFilter, he wants the changes to be committed + mainDialog->includeFilter = m_textCtrlInclude->GetValue(); + mainDialog->excludeFilter = m_textCtrlExclude->GetValue(); + + //when leaving dialog: filter and redraw grid, if filter is active + EndModal(OkayButtonPressed); +} + + +void FilterDlg::OnDefault(wxCommandEvent& event) +{ + m_textCtrlInclude->SetValue("*"); + m_textCtrlExclude->SetValue(""); + + //changes to mainDialog are only committed when the OK button is pressed + event.Skip(); +} +//######################################################################################## + + +ErrorDlg::ErrorDlg(const wxString messageText, bool& suppressErrormessages) : + ErrorDlgGenerated(0), + suppressErrors(suppressErrormessages) +{ + m_bitmap10->SetBitmap(*GlobalResources::bitmapWarning); + m_textCtrl8->SetValue(messageText); +} + +ErrorDlg::~ErrorDlg() {} + +void ErrorDlg::OnClose(wxCloseEvent& event) +{ + //suppressErrors = m_checkBoxSuppress->GetValue(); -> not needed here + EndModal(AbortButtonPressed); +} + +void ErrorDlg::OnContinue(wxCommandEvent& event) +{ + suppressErrors = m_checkBoxSuppress->GetValue(); + EndModal(ContinueButtonPressed); +} + +void ErrorDlg::OnRetry(wxCommandEvent& event) +{ + //suppressErrors = m_checkBoxSuppress->GetValue(); -> not needed here + EndModal(RetryButtonPressed); +} + +void ErrorDlg::OnAbort(wxCommandEvent& event) +{ + //suppressErrors = m_checkBoxSuppress->GetValue(); -> not needed here + EndModal(AbortButtonPressed); +} +//######################################################################################## + + +SyncStatus::SyncStatus(StatusUpdater* updater, double gaugeTotalElements, wxWindow* parentWindow) : + SyncStatusGenerated(parentWindow), + currentStatusUpdater(updater), + windowToDis(parentWindow), + currentProcessIsRunning(true), + numberOfProcessedObjects(0) +{ + //initialize gauge + m_gauge1->SetRange(50000); + m_gauge1->SetValue(0); + + resetGauge(gaugeTotalElements); + + if (windowToDis) //disable (main) window while this status dialog is shown + windowToDis->Enable(false); +} + + +SyncStatus::~SyncStatus() +{ + if (windowToDis) + windowToDis->Enable(true); +} + + +void SyncStatus::resetGauge(double totalNrOfElements) +{ + currentElements = 0; + totalElements = totalNrOfElements; + + if (totalElements != 0) + scalingFactor = 50000 / totalElements; //let's normalize to 50000 + else + scalingFactor = 0; +} + + +void SyncStatus::incProgressIndicator_NoUpdate(double number) +{ + currentElements+= number; + numberOfProcessedObjects++; +} + + +void SyncStatus::setStatusText_NoUpdate(const wxString& text) +{ + currentStatusText = text; +} + + +void SyncStatus::updateStatusDialogNow() +{ + //progress indicator + m_gauge1->SetValue(int(currentElements * scalingFactor)); + + //status text + m_textCtrlInfo->SetValue(currentStatusText); + + //processed objects + m_staticTextProcessedObj->SetLabel(GlobalFunctions::numberToWxString(numberOfProcessedObjects)); + + //remaining bytes left for copy + m_staticTextBytesCurrent->SetLabel(FreeFileSync::formatFilesizeToShortString(mpz_class(currentElements))); + + static double totalElementsLast = -1; + if (totalElementsLast != totalElements) + { + totalElementsLast = totalElements; + m_staticTextBytesTotal->SetLabel(FreeFileSync::formatFilesizeToShortString(mpz_class(totalElements))); + } + + //do the ui update + updateUI_Now(); +} + + +void SyncStatus::processHasFinished(const wxString& finalStatusText) //essential to call this in StatusUpdater derived class destructor +{ //at the LATEST(!) to prevent access to currentStatusUpdater + currentProcessIsRunning = false; //enable okay and close events + + m_staticTextStatus->SetLabel(finalStatusText); + m_buttonAbort->Hide(); + m_buttonOK->Show(); + + updateStatusDialogNow(); //keep this sequence to avoid display distortion, if e.g. only 1 item is sync'ed + Layout(); // +} + + +void SyncStatus::OnOkay(wxCommandEvent& event) +{ + if (!currentProcessIsRunning) Destroy(); +} + + +void SyncStatus::OnAbort(wxCommandEvent& event) +{ + if (currentProcessIsRunning) currentStatusUpdater->requestAbortion(); +} + + +void SyncStatus::OnClose(wxCloseEvent& event) +{ + if (!currentProcessIsRunning) Destroy(); +} + diff --git a/ui/SmallDialogs.h b/ui/SmallDialogs.h new file mode 100644 index 00000000..77da9eac --- /dev/null +++ b/ui/SmallDialogs.h @@ -0,0 +1,99 @@ +#ifndef SMALLDIALOGS_H_INCLUDED +#define SMALLDIALOGS_H_INCLUDED + +#include "MainDialog.h" + +class MainDialog; + +class AboutDlg : public AboutDlgGenerated +{ +public: + AboutDlg(MainDialog* window); + ~AboutDlg(); + +private: + void OnClose(wxCloseEvent& event); + void AboutDlg::OnOK(wxCommandEvent& event); +}; + + +class HelpDlg : public HelpDlgGenerated +{ +public: + HelpDlg(MainDialog* window); + ~HelpDlg(); + +private: + void OnClose(wxCloseEvent& event); + void OnOK(wxCommandEvent& event); +}; + + +class FilterDlg : public FilterDlgGenerated +{ +public: + FilterDlg(MainDialog* window); + ~FilterDlg(); + +private: + void OnDefault(wxCommandEvent& event); + void OnOK(wxCommandEvent& event); + void OnClose(wxCloseEvent& event); + + MainDialog* mainDialog; +}; + + +class ErrorDlg : public ErrorDlgGenerated +{ +public: + ErrorDlg(const wxString messageText, bool& suppressErrormessages); + ~ErrorDlg(); + + static const int ContinueButtonPressed = 35; + static const int RetryButtonPressed = 45; + static const int AbortButtonPressed = 55; + +private: + void OnClose(wxCloseEvent& event); + void OnContinue(wxCommandEvent& event); + void OnRetry(wxCommandEvent& event); + void OnAbort(wxCommandEvent& event); + + bool& suppressErrors; +}; + + +class SyncStatus : public SyncStatusGenerated +{ +public: + SyncStatus(StatusUpdater* updater, double gaugeTotalElements, wxWindow* parentWindow = 0); + ~SyncStatus(); + + void resetGauge(double totalNrOfElements); + void incProgressIndicator_NoUpdate(double number); + void setStatusText_NoUpdate(const wxString& text); + void updateStatusDialogNow(); + + void processHasFinished(const wxString& finalStatusText); //essential to call this in StatusUpdater derived class destructor at the LATEST(!) to prevent access to currentStatusUpdater + +private: + void OnOkay(wxCommandEvent& event); + void OnAbort(wxCommandEvent& event); + void OnClose(wxCloseEvent& event); + + StatusUpdater* currentStatusUpdater; + wxWindow* windowToDis; + bool currentProcessIsRunning; + + //gauge variables + double totalElements; //each element represents one byte for proper progress indicator scaling + double currentElements; + double scalingFactor; //nr of elements has to be normalized to smaller nr. because of range of int limitation + + wxString currentStatusText; + unsigned int numberOfProcessedObjects; +}; + + +#endif // SMALLDIALOGS_H_INCLUDED diff --git a/ui/SyncDialog.cpp b/ui/SyncDialog.cpp new file mode 100644 index 00000000..2353e313 --- /dev/null +++ b/ui/SyncDialog.cpp @@ -0,0 +1,250 @@ +#include "SyncDialog.h" +#include "..\library\globalfunctions.h" + +SyncDialog::SyncDialog(MainDialog* window) + : SyncDialogGenerated(window), mainDialog(window) +{ + //make working copy of mainDialog->syncConfiguration and recycler setting + localSyncConfiguration = mainDialog->syncConfiguration; + + m_checkBoxUseRecycler->SetValue(mainDialog->useRecycleBin); + + //set icons for this dialog + m_bpButton18->SetBitmapLabel(*GlobalResources::bitmapStartSync); + m_bitmap13->SetBitmap(*GlobalResources::bitmapLeftOnlyDeact); + m_bitmap14->SetBitmap(*GlobalResources::bitmapRightOnlyDeact); + m_bitmap15->SetBitmap(*GlobalResources::bitmapLeftNewerDeact); + m_bitmap16->SetBitmap(*GlobalResources::bitmapRightNewerDeact); + m_bitmap17->SetBitmap(*GlobalResources::bitmapDifferentDeact); + + //set sync config icons + updateConfigIcons(); + + //set radiobutton + if (localSyncConfiguration.exLeftSideOnly == SyncDirRight && + localSyncConfiguration.exRightSideOnly == SyncDirRight && + localSyncConfiguration.leftNewer == SyncDirRight && + localSyncConfiguration.rightNewer == SyncDirRight && + localSyncConfiguration.different == SyncDirRight) + m_radioBtn1->SetValue(true); //one way -> + + else if (localSyncConfiguration.exLeftSideOnly == SyncDirRight && + localSyncConfiguration.exRightSideOnly == SyncDirLeft && + localSyncConfiguration.leftNewer == SyncDirRight && + localSyncConfiguration.rightNewer == SyncDirLeft && + localSyncConfiguration.different == SyncDirNone) + m_radioBtn2->SetValue(true); //two way <-> + + else + m_radioBtn3->SetValue(true); //other +} + +//################################################################################################################# + +SyncDialog::~SyncDialog() {} + + +void SyncDialog::updateConfigIcons() +{ + if (localSyncConfiguration.exLeftSideOnly == SyncDirRight) + { + m_bpButton5->SetBitmapLabel(*GlobalResources::bitmapRightArrow); + m_bpButton5->SetToolTip(_("Copy from left to right")); + } + else if (localSyncConfiguration.exLeftSideOnly == SyncDirLeft) + { + m_bpButton5->SetBitmapLabel(*GlobalResources::bitmapDelete); + m_bpButton5->SetToolTip(_("Delete files existing on left side only")); + } + else if (localSyncConfiguration.exLeftSideOnly == SyncDirNone) + { + m_bpButton5->SetBitmapLabel(wxNullBitmap); + m_bpButton5->SetToolTip(_("Do nothing")); + } + + if (localSyncConfiguration.exRightSideOnly == SyncDirRight) + { + m_bpButton6->SetBitmapLabel(*GlobalResources::bitmapDelete); + m_bpButton6->SetToolTip(_("Delete files existing on right side only")); + } + else if (localSyncConfiguration.exRightSideOnly == SyncDirLeft) + { + m_bpButton6->SetBitmapLabel(*GlobalResources::bitmapLeftArrow); + m_bpButton6->SetToolTip(_("Copy from right to left")); + } + else if (localSyncConfiguration.exRightSideOnly == SyncDirNone) + { + m_bpButton6->SetBitmapLabel(wxNullBitmap); + m_bpButton6->SetToolTip(_("Do nothing")); + } + + if (localSyncConfiguration.leftNewer == SyncDirRight) + { + m_bpButton7->SetBitmapLabel(*GlobalResources::bitmapRightArrow); + m_bpButton7->SetToolTip(_("Copy from left to right overwriting")); + } + else if (localSyncConfiguration.leftNewer == SyncDirLeft) + { + m_bpButton7->SetBitmapLabel(*GlobalResources::bitmapLeftArrow); + m_bpButton7->SetToolTip(_("Copy from right to left overwriting")); + } + else if (localSyncConfiguration.leftNewer == SyncDirNone) + { + m_bpButton7->SetBitmapLabel(wxNullBitmap); + m_bpButton7->SetToolTip(_("Do nothing")); + } + + if (localSyncConfiguration.rightNewer == SyncDirRight) + { + m_bpButton8->SetBitmapLabel(*GlobalResources::bitmapRightArrow); + m_bpButton8->SetToolTip(_("Copy from left to right overwriting")); + } + else if (localSyncConfiguration.rightNewer == SyncDirLeft) + { + m_bpButton8->SetBitmapLabel(*GlobalResources::bitmapLeftArrow); + m_bpButton8->SetToolTip(_("Copy from right to left overwriting")); + } + else if (localSyncConfiguration.rightNewer == SyncDirNone) + { + m_bpButton8->SetBitmapLabel(wxNullBitmap); + m_bpButton8->SetToolTip(_("Do nothing")); + } + + if (localSyncConfiguration.different == SyncDirRight) + { + m_bpButton9->SetBitmapLabel(*GlobalResources::bitmapRightArrow); + m_bpButton9->SetToolTip(_("Copy from left to right overwriting")); + } + else if (localSyncConfiguration.different == SyncDirLeft) + { + m_bpButton9->SetBitmapLabel(*GlobalResources::bitmapLeftArrow); + m_bpButton9->SetToolTip(_("Copy from right to left overwriting")); + } + else if (localSyncConfiguration.different == SyncDirNone) + { + m_bpButton9->SetBitmapLabel(wxNullBitmap); + m_bpButton9->SetToolTip(_("Do nothing")); + } + + //update preview of bytes to be transferred: + m_textCtrl5->SetValue(FreeFileSync::formatFilesizeToShortString(FreeFileSync::calcTotalBytesToTransfer(mainDialog->currentGridData, localSyncConfiguration))); +} + + +void SyncDialog::OnClose(wxCloseEvent& event) +{ + EndModal(0); +} + +void SyncDialog::OnBack(wxCommandEvent& event) +{ + //write configuration to main dialog + mainDialog->syncConfiguration = localSyncConfiguration; + mainDialog->useRecycleBin = m_checkBoxUseRecycler->GetValue(); + + EndModal(0); +} + +void SyncDialog::OnStartSync(wxCommandEvent& event) +{ + //write configuration to main dialog + mainDialog->syncConfiguration = localSyncConfiguration; + mainDialog->useRecycleBin = m_checkBoxUseRecycler->GetValue(); + + EndModal(StartSynchronizationProcess); +} + + +void SyncDialog::OnSelectRecycleBin(wxCommandEvent& event) +{ + if (event.IsChecked()) + { + if (!FreeFileSync::recycleBinExists()) + { + wxMessageBox(_("It was not possible to gain access to Recycle Bin!\n\nIt's likely that you are not using Windows XP. (Probably Vista)\nIf you want this feature included, please contact the author. :)"), _("Error") , wxOK | wxICON_ERROR); + m_checkBoxUseRecycler->SetValue(false); + } + } +} + + +void SyncDialog::OnSyncLeftToRight( wxCommandEvent& event ) +{ + localSyncConfiguration.exLeftSideOnly = SyncDirRight; + localSyncConfiguration.exRightSideOnly = SyncDirRight; + localSyncConfiguration.leftNewer = SyncDirRight; + localSyncConfiguration.rightNewer = SyncDirRight; + localSyncConfiguration.different = SyncDirRight; + + updateConfigIcons(); + + //if event is triggered by button + m_radioBtn1->SetValue(true); +} + + +void SyncDialog::OnSyncBothSides( wxCommandEvent& event ) +{ + localSyncConfiguration.exLeftSideOnly = SyncDirRight; + localSyncConfiguration.exRightSideOnly = SyncDirLeft; + localSyncConfiguration.leftNewer = SyncDirRight; + localSyncConfiguration.rightNewer = SyncDirLeft; + localSyncConfiguration.different = SyncDirNone; + + updateConfigIcons(); + //if event is triggered by button + m_radioBtn2->SetValue(true); +} + + +void toggleSyncDirection(SyncDirection& current) +{ + if (current == SyncDirRight) + current = SyncDirLeft; + else if (current == SyncDirLeft) + current = SyncDirNone; + else if (current== SyncDirNone) + current = SyncDirRight; + else + assert (false); +} + +void SyncDialog::OnExLeftSideOnly( wxCommandEvent& event ) +{ + toggleSyncDirection(localSyncConfiguration.exLeftSideOnly); + updateConfigIcons(); + //set custom config button + m_radioBtn3->SetValue(true); +} + +void SyncDialog::OnExRightSideOnly( wxCommandEvent& event ) +{ + toggleSyncDirection(localSyncConfiguration.exRightSideOnly); + updateConfigIcons(); + //set custom config button + m_radioBtn3->SetValue(true); +} + +void SyncDialog::OnLeftNewer( wxCommandEvent& event ) +{ + toggleSyncDirection(localSyncConfiguration.leftNewer); + updateConfigIcons(); + //set custom config button + m_radioBtn3->SetValue(true); +} + +void SyncDialog::OnRightNewer( wxCommandEvent& event ) +{ + toggleSyncDirection(localSyncConfiguration.rightNewer); + updateConfigIcons(); + //set custom config button + m_radioBtn3->SetValue(true); +} + +void SyncDialog::OnDifferent( wxCommandEvent& event ) +{ + toggleSyncDirection(localSyncConfiguration.different); + updateConfigIcons(); + //set custom config button + m_radioBtn3->SetValue(true); +} diff --git a/ui/SyncDialog.h b/ui/SyncDialog.h new file mode 100644 index 00000000..a743279a --- /dev/null +++ b/ui/SyncDialog.h @@ -0,0 +1,40 @@ +#ifndef SYNCDIALOG_H_INCLUDED +#define SYNCDIALOG_H_INCLUDED + +#include "MainDialog.h" + +class MainDialog; + +class SyncDialog: public SyncDialogGenerated +{ +public: + SyncDialog(MainDialog* window); + ~SyncDialog(); + + static const int StartSynchronizationProcess = 15; + +private: + //temporal copy of maindialog->syncConfiguration + SyncConfiguration localSyncConfiguration; + + void updateConfigIcons(); + + void OnSyncLeftToRight( wxCommandEvent& event ); + void OnSyncBothSides( wxCommandEvent& event ); + + void OnExLeftSideOnly( wxCommandEvent& event ); + void OnExRightSideOnly( wxCommandEvent& event ); + void OnLeftNewer( wxCommandEvent& event ); + void OnRightNewer( wxCommandEvent& event ); + void OnDifferent( wxCommandEvent& event ); + + void OnStartSync(wxCommandEvent& event); + void OnClose(wxCloseEvent& event); + void OnBack(wxCommandEvent& event); + + void OnSelectRecycleBin(wxCommandEvent& event); + + MainDialog* mainDialog; +}; + +#endif // SYNCDIALOG_H_INCLUDED |