diff options
Diffstat (limited to 'ui')
-rw-r--r-- | ui/batch_status_handler.cpp | 16 | ||||
-rw-r--r-- | ui/check_version.cpp | 7 | ||||
-rw-r--r-- | ui/custom_grid.cpp | 2 | ||||
-rw-r--r-- | ui/grid_view.cpp | 2 | ||||
-rw-r--r-- | ui/gui_generated.cpp | 255 | ||||
-rw-r--r-- | ui/gui_generated.h | 65 | ||||
-rw-r--r-- | ui/gui_status_handler.cpp | 6 | ||||
-rw-r--r-- | ui/main_dlg.cpp | 1088 | ||||
-rw-r--r-- | ui/main_dlg.h | 43 | ||||
-rw-r--r-- | ui/progress_indicator.cpp | 95 | ||||
-rw-r--r-- | ui/progress_indicator.h | 4 | ||||
-rw-r--r-- | ui/sync_cfg.cpp | 4 | ||||
-rw-r--r-- | ui/tree_view.cpp | 8 | ||||
-rw-r--r-- | ui/triple_splitter.cpp | 8 |
14 files changed, 801 insertions, 802 deletions
diff --git a/ui/batch_status_handler.cpp b/ui/batch_status_handler.cpp index ebfa84a0..9e8b1489 100644 --- a/ui/batch_status_handler.cpp +++ b/ui/batch_status_handler.cpp @@ -225,7 +225,7 @@ BatchStatusHandler::~BatchStatusHandler() showFinalResults = false; //take precedence over current visibility status else if (!finalCommand.empty()) { - auto cmdexp = utfCvrtTo<wxString>(expandMacros(utfCvrtTo<Zstring>(finalCommand))); + auto cmdexp = expandMacros(utfCvrtTo<Zstring>(finalCommand)); shellExecute(cmdexp); } } @@ -262,17 +262,7 @@ void BatchStatusHandler::updateProcessedData(int objectsDelta, Int64 dataDelta) { StatusHandler::updateProcessedData(objectsDelta, dataDelta); - switch (currentPhase()) - { - case ProcessCallback::PHASE_NONE: - assert(false); - case ProcessCallback::PHASE_SCANNING: - break; - case ProcessCallback::PHASE_COMPARING_CONTENT: - case ProcessCallback::PHASE_SYNCHRONIZING: - syncStatusFrame.reportCurrentBytes(getDataCurrent(currentPhase())); - break; - } + syncStatusFrame.notifyProgressChange(); //noexcept //note: this method should NOT throw in order to properly allow undoing setting of statistics! } @@ -415,7 +405,7 @@ void BatchStatusHandler::reportFatalError(const std::wstring& errorMessage) void BatchStatusHandler::forceUiRefresh() { - syncStatusFrame.updateProgress(); + syncStatusFrame.updateGui(); } diff --git a/ui/check_version.cpp b/ui/check_version.cpp index c9d2049d..922708c7 100644 --- a/ui/check_version.cpp +++ b/ui/check_version.cpp @@ -68,7 +68,7 @@ public: if (statusCode != HTTP_STATUS_OK) throw InternetConnectionError(); //e.g. 404 - HTTP_STATUS_NOT_FOUND - guardRequest.dismiss(); + guardRequest .dismiss(); guardInternet.dismiss(); } @@ -113,10 +113,7 @@ bool canAccessUrl(const wchar_t* url) //throw () (void)WinInetAccess(url); //throw InternetConnectionError return true; } - catch (const InternetConnectionError&) - { - return false; - } + catch (const InternetConnectionError&) { return false; } } diff --git a/ui/custom_grid.cpp b/ui/custom_grid.cpp index ffa0a9bc..e1e2b5a2 100644 --- a/ui/custom_grid.cpp +++ b/ui/custom_grid.cpp @@ -1171,7 +1171,7 @@ private: toolTip.hide(); //if invalid row... } - virtual wxString getToolTip(ColumnType colType) const { return showSyncAction_ ? _("Action") : _("Category"); } + virtual wxString getToolTip(ColumnType colType) const { return showSyncAction_ ? _("Action") + L" (F8)" : _("Category") + L" (F8)"; } bool showSyncAction_; std::unique_ptr<std::pair<size_t, BlockPosition>> highlight; //(row, block) current mouse highlight diff --git a/ui/grid_view.cpp b/ui/grid_view.cpp index dbaff5cd..9a5143c1 100644 --- a/ui/grid_view.cpp +++ b/ui/grid_view.cpp @@ -75,7 +75,7 @@ void GridView::updateView(Predicate pred) //"this->" required by two-pass lookup as enforced by GCC 4.7 //save row position to identify first child *on sorted subview* of DirMapping or BaseDirMapping in case latter are filtered out - const HierarchyObject* parent = &(fsObj->parent()); + const HierarchyObject* parent = &fsObj->parent(); for (;;) //map all yet unassociated parents to this row { const auto rv = this->rowPositionsFirstChild.insert(std::make_pair(parent, viewRef.size())); diff --git a/ui/gui_generated.cpp b/ui/gui_generated.cpp index 43a14ae3..84d86ceb 100644 --- a/ui/gui_generated.cpp +++ b/ui/gui_generated.cpp @@ -133,7 +133,7 @@ MainDialogGenerated::MainDialogGenerated( wxWindow* parent, wxWindowID id, const m_buttonCompare = new zen::BitmapButton( m_panelTopButtons, wxID_OK, _("Compare"), wxDefaultPosition, wxSize( 180,46 ), 0 ); m_buttonCompare->SetDefault(); m_buttonCompare->SetFont( wxFont( 14, 74, 90, 92, false, wxEmptyString ) ); - m_buttonCompare->SetToolTip( _("Compare both sides") ); + m_buttonCompare->SetToolTip( _("dummy") ); bSizer30->Add( m_buttonCompare, 0, wxALIGN_CENTER_HORIZONTAL|wxALIGN_CENTER_VERTICAL, 5 ); @@ -184,11 +184,11 @@ MainDialogGenerated::MainDialogGenerated( wxWindow* parent, wxWindowID id, const fgSizer12->Add( m_bpButtonSyncConfig, 0, wxALIGN_CENTER_VERTICAL|wxRIGHT, 3 ); - m_buttonStartSync = new zen::BitmapButton( m_panelTopButtons, wxID_ANY, _("Synchronize"), wxDefaultPosition, wxSize( 180,46 ), 0 ); - m_buttonStartSync->SetFont( wxFont( 14, 74, 90, 92, false, wxEmptyString ) ); - m_buttonStartSync->SetToolTip( _("Start synchronization") ); + m_buttonSync = new zen::BitmapButton( m_panelTopButtons, wxID_ANY, _("Synchronize"), wxDefaultPosition, wxSize( 180,46 ), 0 ); + m_buttonSync->SetFont( wxFont( 14, 74, 90, 92, false, wxEmptyString ) ); + m_buttonSync->SetToolTip( _("dummy") ); - fgSizer12->Add( m_buttonStartSync, 0, wxALIGN_CENTER_VERTICAL, 5 ); + fgSizer12->Add( m_buttonSync, 0, wxALIGN_CENTER_VERTICAL, 5 ); bSizer1551->Add( fgSizer12, 0, wxALIGN_CENTER_VERTICAL|wxBOTTOM, 5 ); @@ -386,6 +386,10 @@ MainDialogGenerated::MainDialogGenerated( wxWindow* parent, wxWindowID id, const bSizer451 = new wxBoxSizer( wxHORIZONTAL ); bSizer451->SetMinSize( wxSize( -1,22 ) ); + bSizerFileStatus = new wxBoxSizer( wxHORIZONTAL ); + + bSizerStatusLeft = new wxBoxSizer( wxHORIZONTAL ); + wxBoxSizer* bSizer53; bSizer53 = new wxBoxSizer( wxHORIZONTAL ); @@ -436,25 +440,30 @@ MainDialogGenerated::MainDialogGenerated( wxWindow* parent, wxWindowID id, const bSizer53->Add( 0, 0, 1, wxALIGN_CENTER_VERTICAL, 5 ); - bSizer451->Add( bSizer53, 1, wxALIGN_BOTTOM|wxEXPAND, 5 ); + bSizerStatusLeft->Add( bSizer53, 1, wxEXPAND|wxALIGN_CENTER_VERTICAL, 5 ); m_staticline9 = new wxStaticLine( m_panelStatusBar, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxLI_VERTICAL ); - bSizer451->Add( m_staticline9, 0, wxALIGN_CENTER_VERTICAL|wxTOP|wxEXPAND, 2 ); + bSizerStatusLeft->Add( m_staticline9, 0, wxALIGN_CENTER_VERTICAL|wxEXPAND|wxTOP, 2 ); - bSizer451->Add( 26, 0, 0, wxALIGN_CENTER_VERTICAL, 5 ); + bSizerFileStatus->Add( bSizerStatusLeft, 1, wxEXPAND|wxALIGN_CENTER_VERTICAL, 5 ); + + + bSizerFileStatus->Add( 26, 0, 0, wxALIGN_CENTER_VERTICAL, 5 ); m_staticTextStatusMiddle = new wxStaticText( m_panelStatusBar, wxID_ANY, _("dummy"), wxDefaultPosition, wxDefaultSize, 0 ); m_staticTextStatusMiddle->Wrap( -1 ); m_staticTextStatusMiddle->SetFont( wxFont( 8, 70, 90, 92, false, wxEmptyString ) ); - bSizer451->Add( m_staticTextStatusMiddle, 0, wxALIGN_CENTER_HORIZONTAL|wxALIGN_CENTER_VERTICAL, 5 ); + bSizerFileStatus->Add( m_staticTextStatusMiddle, 0, wxALIGN_CENTER_HORIZONTAL|wxALIGN_CENTER_VERTICAL, 5 ); + + bSizerFileStatus->Add( 26, 0, 0, wxALIGN_CENTER_VERTICAL, 5 ); - bSizer451->Add( 26, 0, 0, wxALIGN_CENTER_VERTICAL, 5 ); + bSizerStatusRight = new wxBoxSizer( wxHORIZONTAL ); m_staticline10 = new wxStaticLine( m_panelStatusBar, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxLI_VERTICAL ); - bSizer451->Add( m_staticline10, 0, wxEXPAND|wxALIGN_CENTER_VERTICAL|wxTOP, 2 ); + bSizerStatusRight->Add( m_staticline10, 0, wxEXPAND|wxALIGN_CENTER_VERTICAL|wxTOP, 2 ); wxBoxSizer* bSizer52; bSizer52 = new wxBoxSizer( wxHORIZONTAL ); @@ -506,7 +515,19 @@ MainDialogGenerated::MainDialogGenerated( wxWindow* parent, wxWindowID id, const bSizer52->Add( 0, 0, 1, wxALIGN_CENTER_VERTICAL, 5 ); - bSizer451->Add( bSizer52, 1, wxALIGN_BOTTOM|wxEXPAND, 5 ); + bSizerStatusRight->Add( bSizer52, 1, wxEXPAND|wxALIGN_CENTER_VERTICAL, 5 ); + + + bSizerFileStatus->Add( bSizerStatusRight, 1, wxEXPAND|wxALIGN_CENTER_VERTICAL, 5 ); + + + bSizer451->Add( bSizerFileStatus, 1, wxALIGN_CENTER_VERTICAL|wxEXPAND, 5 ); + + m_staticTextFullStatus = new wxStaticText( m_panelStatusBar, wxID_ANY, _("dummy"), wxDefaultPosition, wxDefaultSize, 0 ); + m_staticTextFullStatus->Wrap( -1 ); + m_staticTextFullStatus->SetFont( wxFont( wxNORMAL_FONT->GetPointSize(), 70, 90, 92, false, wxEmptyString ) ); + + bSizer451->Add( m_staticTextFullStatus, 0, wxALIGN_CENTER_VERTICAL|wxALL, 5 ); m_panelStatusBar->SetSizer( bSizer451 ); @@ -526,13 +547,13 @@ MainDialogGenerated::MainDialogGenerated( wxWindow* parent, wxWindowID id, const wxBoxSizer* bSizer151; bSizer151 = new wxBoxSizer( wxHORIZONTAL ); - m_bpButtonLoad = new wxBitmapButton( m_panelConfig, wxID_ANY, wxNullBitmap, wxDefaultPosition, wxSize( 42,42 ), wxBU_AUTODRAW ); - m_bpButtonLoad->SetToolTip( _("Open") ); + m_bpButtonOpen = new wxBitmapButton( m_panelConfig, wxID_ANY, wxNullBitmap, wxDefaultPosition, wxSize( 42,42 ), wxBU_AUTODRAW ); + m_bpButtonOpen->SetToolTip( _("dummy") ); - bSizer151->Add( m_bpButtonLoad, 0, wxALIGN_CENTER_VERTICAL, 5 ); + bSizer151->Add( m_bpButtonOpen, 0, wxALIGN_CENTER_VERTICAL, 5 ); m_bpButtonSave = new wxBitmapButton( m_panelConfig, wxID_ANY, wxNullBitmap, wxDefaultPosition, wxSize( 42,42 ), wxBU_AUTODRAW ); - m_bpButtonSave->SetToolTip( _("Save") ); + m_bpButtonSave->SetToolTip( _("dummy") ); bSizer151->Add( m_bpButtonSave, 0, wxALIGN_CENTER_VERTICAL, 5 ); @@ -545,7 +566,6 @@ MainDialogGenerated::MainDialogGenerated( wxWindow* parent, wxWindowID id, const bSizerConfig->Add( bSizer151, 0, wxALIGN_CENTER_HORIZONTAL|wxALIGN_CENTER_VERTICAL, 5 ); m_listBoxHistory = new wxListBox( m_panelConfig, wxID_ANY, wxDefaultPosition, wxDefaultSize, 0, NULL, wxLB_EXTENDED|wxLB_NEEDED_SB|wxLB_SORT ); - m_listBoxHistory->SetToolTip( _("Last used configurations (press DEL to remove from list)") ); m_listBoxHistory->SetMinSize( wxSize( -1,40 ) ); bSizerConfig->Add( m_listBoxHistory, 1, wxEXPAND|wxALIGN_CENTER_VERTICAL, 5 ); @@ -778,47 +798,47 @@ MainDialogGenerated::MainDialogGenerated( wxWindow* parent, wxWindowID id, const bSizerViewFilter->Add( 0, 0, 1, wxEXPAND, 5 ); - m_bpButtonSyncCreateLeft = new ToggleButton( m_panelViewFilter, wxID_ANY, wxNullBitmap, wxDefaultPosition, wxSize( 42,42 ), wxBU_AUTODRAW ); - bSizerViewFilter->Add( m_bpButtonSyncCreateLeft, 0, wxALIGN_CENTER_VERTICAL|wxALIGN_CENTER_HORIZONTAL, 5 ); + m_bpButtonShowCreateLeft = new ToggleButton( m_panelViewFilter, wxID_ANY, wxNullBitmap, wxDefaultPosition, wxSize( 42,42 ), wxBU_AUTODRAW ); + bSizerViewFilter->Add( m_bpButtonShowCreateLeft, 0, wxALIGN_CENTER_VERTICAL|wxALIGN_CENTER_HORIZONTAL, 5 ); - m_bpButtonSyncDirOverwLeft = new ToggleButton( m_panelViewFilter, wxID_ANY, wxNullBitmap, wxDefaultPosition, wxSize( 42,42 ), wxBU_AUTODRAW ); - bSizerViewFilter->Add( m_bpButtonSyncDirOverwLeft, 0, wxALIGN_CENTER_VERTICAL|wxALIGN_CENTER_HORIZONTAL, 5 ); + m_bpButtonShowUpdateLeft = new ToggleButton( m_panelViewFilter, wxID_ANY, wxNullBitmap, wxDefaultPosition, wxSize( 42,42 ), wxBU_AUTODRAW ); + bSizerViewFilter->Add( m_bpButtonShowUpdateLeft, 0, wxALIGN_CENTER_VERTICAL|wxALIGN_CENTER_HORIZONTAL, 5 ); - m_bpButtonSyncDeleteLeft = new ToggleButton( m_panelViewFilter, wxID_ANY, wxNullBitmap, wxDefaultPosition, wxSize( 42,42 ), wxBU_AUTODRAW ); - bSizerViewFilter->Add( m_bpButtonSyncDeleteLeft, 0, wxALIGN_CENTER_VERTICAL|wxALIGN_CENTER_HORIZONTAL, 5 ); + m_bpButtonShowDeleteLeft = new ToggleButton( m_panelViewFilter, wxID_ANY, wxNullBitmap, wxDefaultPosition, wxSize( 42,42 ), wxBU_AUTODRAW ); + bSizerViewFilter->Add( m_bpButtonShowDeleteLeft, 0, wxALIGN_CENTER_VERTICAL|wxALIGN_CENTER_HORIZONTAL, 5 ); - m_bpButtonLeftOnly = new ToggleButton( m_panelViewFilter, wxID_ANY, wxNullBitmap, wxDefaultPosition, wxSize( 42,42 ), wxBU_AUTODRAW ); - bSizerViewFilter->Add( m_bpButtonLeftOnly, 0, wxALIGN_CENTER_VERTICAL|wxALIGN_CENTER_HORIZONTAL, 5 ); + m_bpButtonShowLeftOnly = new ToggleButton( m_panelViewFilter, wxID_ANY, wxNullBitmap, wxDefaultPosition, wxSize( 42,42 ), wxBU_AUTODRAW ); + bSizerViewFilter->Add( m_bpButtonShowLeftOnly, 0, wxALIGN_CENTER_VERTICAL|wxALIGN_CENTER_HORIZONTAL, 5 ); - m_bpButtonLeftNewer = new ToggleButton( m_panelViewFilter, wxID_ANY, wxNullBitmap, wxDefaultPosition, wxSize( 42,42 ), wxBU_AUTODRAW ); - bSizerViewFilter->Add( m_bpButtonLeftNewer, 0, wxALIGN_CENTER_VERTICAL|wxALIGN_CENTER_HORIZONTAL, 5 ); + m_bpButtonShowLeftNewer = new ToggleButton( m_panelViewFilter, wxID_ANY, wxNullBitmap, wxDefaultPosition, wxSize( 42,42 ), wxBU_AUTODRAW ); + bSizerViewFilter->Add( m_bpButtonShowLeftNewer, 0, wxALIGN_CENTER_VERTICAL|wxALIGN_CENTER_HORIZONTAL, 5 ); - m_bpButtonEqual = new ToggleButton( m_panelViewFilter, wxID_ANY, wxNullBitmap, wxDefaultPosition, wxSize( 42,42 ), wxBU_AUTODRAW ); - bSizerViewFilter->Add( m_bpButtonEqual, 0, wxALIGN_CENTER_VERTICAL|wxALIGN_CENTER_HORIZONTAL, 5 ); + m_bpButtonShowEqual = new ToggleButton( m_panelViewFilter, wxID_ANY, wxNullBitmap, wxDefaultPosition, wxSize( 42,42 ), wxBU_AUTODRAW ); + bSizerViewFilter->Add( m_bpButtonShowEqual, 0, wxALIGN_CENTER_VERTICAL|wxALIGN_CENTER_HORIZONTAL, 5 ); - m_bpButtonDifferent = new ToggleButton( m_panelViewFilter, wxID_ANY, wxNullBitmap, wxDefaultPosition, wxSize( 42,42 ), wxBU_AUTODRAW ); - bSizerViewFilter->Add( m_bpButtonDifferent, 0, wxALIGN_CENTER_VERTICAL|wxALIGN_CENTER_HORIZONTAL, 5 ); + m_bpButtonShowDifferent = new ToggleButton( m_panelViewFilter, wxID_ANY, wxNullBitmap, wxDefaultPosition, wxSize( 42,42 ), wxBU_AUTODRAW ); + bSizerViewFilter->Add( m_bpButtonShowDifferent, 0, wxALIGN_CENTER_VERTICAL|wxALIGN_CENTER_HORIZONTAL, 5 ); - m_bpButtonSyncDirNone = new ToggleButton( m_panelViewFilter, wxID_ANY, wxNullBitmap, wxDefaultPosition, wxSize( 42,42 ), wxBU_AUTODRAW ); - bSizerViewFilter->Add( m_bpButtonSyncDirNone, 0, wxALIGN_CENTER_VERTICAL|wxALIGN_CENTER_HORIZONTAL, 5 ); + m_bpButtonShowDoNothing = new ToggleButton( m_panelViewFilter, wxID_ANY, wxNullBitmap, wxDefaultPosition, wxSize( 42,42 ), wxBU_AUTODRAW ); + bSizerViewFilter->Add( m_bpButtonShowDoNothing, 0, wxALIGN_CENTER_VERTICAL|wxALIGN_CENTER_HORIZONTAL, 5 ); - m_bpButtonRightNewer = new ToggleButton( m_panelViewFilter, wxID_ANY, wxNullBitmap, wxDefaultPosition, wxSize( 42,42 ), wxBU_AUTODRAW ); - bSizerViewFilter->Add( m_bpButtonRightNewer, 0, wxALIGN_CENTER_VERTICAL|wxALIGN_CENTER_HORIZONTAL, 5 ); + m_bpButtonShowRightNewer = new ToggleButton( m_panelViewFilter, wxID_ANY, wxNullBitmap, wxDefaultPosition, wxSize( 42,42 ), wxBU_AUTODRAW ); + bSizerViewFilter->Add( m_bpButtonShowRightNewer, 0, wxALIGN_CENTER_VERTICAL|wxALIGN_CENTER_HORIZONTAL, 5 ); - m_bpButtonRightOnly = new ToggleButton( m_panelViewFilter, wxID_ANY, wxNullBitmap, wxDefaultPosition, wxSize( 42,42 ), wxBU_AUTODRAW ); - bSizerViewFilter->Add( m_bpButtonRightOnly, 0, wxALIGN_CENTER_VERTICAL|wxALIGN_CENTER_HORIZONTAL, 5 ); + m_bpButtonShowRightOnly = new ToggleButton( m_panelViewFilter, wxID_ANY, wxNullBitmap, wxDefaultPosition, wxSize( 42,42 ), wxBU_AUTODRAW ); + bSizerViewFilter->Add( m_bpButtonShowRightOnly, 0, wxALIGN_CENTER_VERTICAL|wxALIGN_CENTER_HORIZONTAL, 5 ); - m_bpButtonSyncDeleteRight = new ToggleButton( m_panelViewFilter, wxID_ANY, wxNullBitmap, wxDefaultPosition, wxSize( 42,42 ), wxBU_AUTODRAW ); - bSizerViewFilter->Add( m_bpButtonSyncDeleteRight, 0, wxALIGN_CENTER_VERTICAL|wxALIGN_CENTER_HORIZONTAL, 5 ); + m_bpButtonShowDeleteRight = new ToggleButton( m_panelViewFilter, wxID_ANY, wxNullBitmap, wxDefaultPosition, wxSize( 42,42 ), wxBU_AUTODRAW ); + bSizerViewFilter->Add( m_bpButtonShowDeleteRight, 0, wxALIGN_CENTER_VERTICAL|wxALIGN_CENTER_HORIZONTAL, 5 ); - m_bpButtonSyncDirOverwRight = new ToggleButton( m_panelViewFilter, wxID_ANY, wxNullBitmap, wxDefaultPosition, wxSize( 42,42 ), wxBU_AUTODRAW ); - bSizerViewFilter->Add( m_bpButtonSyncDirOverwRight, 0, wxALIGN_CENTER_VERTICAL|wxALIGN_CENTER_HORIZONTAL, 5 ); + m_bpButtonShowUpdateRight = new ToggleButton( m_panelViewFilter, wxID_ANY, wxNullBitmap, wxDefaultPosition, wxSize( 42,42 ), wxBU_AUTODRAW ); + bSizerViewFilter->Add( m_bpButtonShowUpdateRight, 0, wxALIGN_CENTER_VERTICAL|wxALIGN_CENTER_HORIZONTAL, 5 ); - m_bpButtonSyncCreateRight = new ToggleButton( m_panelViewFilter, wxID_ANY, wxNullBitmap, wxDefaultPosition, wxSize( 42,42 ), wxBU_AUTODRAW ); - bSizerViewFilter->Add( m_bpButtonSyncCreateRight, 0, wxALIGN_CENTER_VERTICAL|wxALIGN_CENTER_HORIZONTAL, 5 ); + m_bpButtonShowCreateRight = new ToggleButton( m_panelViewFilter, wxID_ANY, wxNullBitmap, wxDefaultPosition, wxSize( 42,42 ), wxBU_AUTODRAW ); + bSizerViewFilter->Add( m_bpButtonShowCreateRight, 0, wxALIGN_CENTER_VERTICAL|wxALIGN_CENTER_HORIZONTAL, 5 ); - m_bpButtonConflict = new ToggleButton( m_panelViewFilter, wxID_ANY, wxNullBitmap, wxDefaultPosition, wxSize( 42,42 ), wxBU_AUTODRAW ); - bSizerViewFilter->Add( m_bpButtonConflict, 0, wxALIGN_CENTER_VERTICAL|wxALIGN_CENTER_HORIZONTAL, 5 ); + m_bpButtonShowConflict = new ToggleButton( m_panelViewFilter, wxID_ANY, wxNullBitmap, wxDefaultPosition, wxSize( 42,42 ), wxBU_AUTODRAW ); + bSizerViewFilter->Add( m_bpButtonShowConflict, 0, wxALIGN_CENTER_VERTICAL|wxALIGN_CENTER_HORIZONTAL, 5 ); bSizerViewFilter->Add( 0, 0, 1, wxEXPAND, 5 ); @@ -850,33 +870,51 @@ MainDialogGenerated::MainDialogGenerated( wxWindow* parent, wxWindowID id, const this->Connect( m_menuItemAbout->GetId(), wxEVT_COMMAND_MENU_SELECTED, wxCommandEventHandler( MainDialogGenerated::OnMenuAbout ) ); m_buttonCompare->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( MainDialogGenerated::OnCompare ), NULL, this ); m_bpButtonCmpConfig->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( MainDialogGenerated::OnCmpSettings ), NULL, this ); + m_bpButtonCmpConfig->Connect( wxEVT_RIGHT_DOWN, wxMouseEventHandler( MainDialogGenerated::OnCompSettingsContext ), NULL, this ); m_bpButtonSyncConfig->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( MainDialogGenerated::OnSyncSettings ), NULL, this ); - m_buttonStartSync->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( MainDialogGenerated::OnStartSync ), NULL, this ); + m_bpButtonSyncConfig->Connect( wxEVT_RIGHT_DOWN, wxMouseEventHandler( MainDialogGenerated::OnSyncSettingsContext ), NULL, this ); + m_buttonSync->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( MainDialogGenerated::OnStartSync ), NULL, this ); m_bpButtonAddPair->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( MainDialogGenerated::OnAddFolderPair ), NULL, this ); m_bpButtonRemovePair->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( MainDialogGenerated::OnRemoveTopFolderPair ), NULL, this ); m_bpButtonSwapSides->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( MainDialogGenerated::OnSwapSides ), NULL, this ); - m_bpButtonLoad->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( MainDialogGenerated::OnConfigLoad ), NULL, this ); + m_bpButtonOpen->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( MainDialogGenerated::OnConfigLoad ), NULL, this ); m_bpButtonSave->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( MainDialogGenerated::OnConfigSave ), NULL, this ); m_bpButtonBatchJob->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( MainDialogGenerated::OnSaveAsBatchJob ), NULL, this ); m_listBoxHistory->Connect( wxEVT_CHAR, wxKeyEventHandler( MainDialogGenerated::OnCfgHistoryKeyEvent ), NULL, this ); m_listBoxHistory->Connect( wxEVT_COMMAND_LISTBOX_SELECTED, wxCommandEventHandler( MainDialogGenerated::OnLoadFromHistory ), NULL, this ); m_listBoxHistory->Connect( wxEVT_COMMAND_LISTBOX_DOUBLECLICKED, wxCommandEventHandler( MainDialogGenerated::OnLoadFromHistoryDoubleClick ), NULL, this ); + m_listBoxHistory->Connect( wxEVT_RIGHT_DOWN, wxMouseEventHandler( MainDialogGenerated::OnCfgHistoryRightClick ), NULL, this ); m_bpButtonFilter->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( MainDialogGenerated::OnConfigureFilter ), NULL, this ); + m_bpButtonFilter->Connect( wxEVT_RIGHT_DOWN, wxMouseEventHandler( MainDialogGenerated::OnGlobalFilterContext ), NULL, this ); m_checkBoxHideExcluded->Connect( wxEVT_COMMAND_CHECKBOX_CLICKED, wxCommandEventHandler( MainDialogGenerated::OnShowExcluded ), NULL, this ); - m_bpButtonSyncCreateLeft->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( MainDialogGenerated::OnSyncCreateLeft ), NULL, this ); - m_bpButtonSyncDirOverwLeft->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( MainDialogGenerated::OnSyncDirLeft ), NULL, this ); - m_bpButtonSyncDeleteLeft->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( MainDialogGenerated::OnSyncDeleteLeft ), NULL, this ); - m_bpButtonLeftOnly->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( MainDialogGenerated::OnLeftOnlyFiles ), NULL, this ); - m_bpButtonLeftNewer->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( MainDialogGenerated::OnLeftNewerFiles ), NULL, this ); - m_bpButtonEqual->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( MainDialogGenerated::OnEqualFiles ), NULL, this ); - m_bpButtonDifferent->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( MainDialogGenerated::OnDifferentFiles ), NULL, this ); - m_bpButtonSyncDirNone->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( MainDialogGenerated::OnSyncDirNone ), NULL, this ); - m_bpButtonRightNewer->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( MainDialogGenerated::OnRightNewerFiles ), NULL, this ); - m_bpButtonRightOnly->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( MainDialogGenerated::OnRightOnlyFiles ), NULL, this ); - m_bpButtonSyncDeleteRight->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( MainDialogGenerated::OnSyncDeleteRight ), NULL, this ); - m_bpButtonSyncDirOverwRight->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( MainDialogGenerated::OnSyncDirRight ), NULL, this ); - m_bpButtonSyncCreateRight->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( MainDialogGenerated::OnSyncCreateRight ), NULL, this ); - m_bpButtonConflict->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( MainDialogGenerated::OnConflictFiles ), NULL, this ); + m_bpButtonShowCreateLeft->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( MainDialogGenerated::OnToggleViewButton ), NULL, this ); + m_bpButtonShowCreateLeft->Connect( wxEVT_RIGHT_DOWN, wxMouseEventHandler( MainDialogGenerated::OnViewButtonRightClick ), NULL, this ); + m_bpButtonShowUpdateLeft->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( MainDialogGenerated::OnToggleViewButton ), NULL, this ); + m_bpButtonShowUpdateLeft->Connect( wxEVT_RIGHT_DOWN, wxMouseEventHandler( MainDialogGenerated::OnViewButtonRightClick ), NULL, this ); + m_bpButtonShowDeleteLeft->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( MainDialogGenerated::OnToggleViewButton ), NULL, this ); + m_bpButtonShowDeleteLeft->Connect( wxEVT_RIGHT_DOWN, wxMouseEventHandler( MainDialogGenerated::OnViewButtonRightClick ), NULL, this ); + m_bpButtonShowLeftOnly->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( MainDialogGenerated::OnToggleViewButton ), NULL, this ); + m_bpButtonShowLeftOnly->Connect( wxEVT_RIGHT_DOWN, wxMouseEventHandler( MainDialogGenerated::OnViewButtonRightClick ), NULL, this ); + m_bpButtonShowLeftNewer->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( MainDialogGenerated::OnToggleViewButton ), NULL, this ); + m_bpButtonShowLeftNewer->Connect( wxEVT_RIGHT_DOWN, wxMouseEventHandler( MainDialogGenerated::OnViewButtonRightClick ), NULL, this ); + m_bpButtonShowEqual->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( MainDialogGenerated::OnToggleViewButton ), NULL, this ); + m_bpButtonShowEqual->Connect( wxEVT_RIGHT_DOWN, wxMouseEventHandler( MainDialogGenerated::OnViewButtonRightClick ), NULL, this ); + m_bpButtonShowDifferent->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( MainDialogGenerated::OnToggleViewButton ), NULL, this ); + m_bpButtonShowDifferent->Connect( wxEVT_RIGHT_DOWN, wxMouseEventHandler( MainDialogGenerated::OnViewButtonRightClick ), NULL, this ); + m_bpButtonShowDoNothing->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( MainDialogGenerated::OnToggleViewButton ), NULL, this ); + m_bpButtonShowDoNothing->Connect( wxEVT_RIGHT_DOWN, wxMouseEventHandler( MainDialogGenerated::OnViewButtonRightClick ), NULL, this ); + m_bpButtonShowRightNewer->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( MainDialogGenerated::OnToggleViewButton ), NULL, this ); + m_bpButtonShowRightNewer->Connect( wxEVT_RIGHT_DOWN, wxMouseEventHandler( MainDialogGenerated::OnViewButtonRightClick ), NULL, this ); + m_bpButtonShowRightOnly->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( MainDialogGenerated::OnToggleViewButton ), NULL, this ); + m_bpButtonShowRightOnly->Connect( wxEVT_RIGHT_DOWN, wxMouseEventHandler( MainDialogGenerated::OnViewButtonRightClick ), NULL, this ); + m_bpButtonShowDeleteRight->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( MainDialogGenerated::OnToggleViewButton ), NULL, this ); + m_bpButtonShowDeleteRight->Connect( wxEVT_RIGHT_DOWN, wxMouseEventHandler( MainDialogGenerated::OnViewButtonRightClick ), NULL, this ); + m_bpButtonShowUpdateRight->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( MainDialogGenerated::OnToggleViewButton ), NULL, this ); + m_bpButtonShowUpdateRight->Connect( wxEVT_RIGHT_DOWN, wxMouseEventHandler( MainDialogGenerated::OnViewButtonRightClick ), NULL, this ); + m_bpButtonShowCreateRight->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( MainDialogGenerated::OnToggleViewButton ), NULL, this ); + m_bpButtonShowCreateRight->Connect( wxEVT_RIGHT_DOWN, wxMouseEventHandler( MainDialogGenerated::OnViewButtonRightClick ), NULL, this ); + m_bpButtonShowConflict->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( MainDialogGenerated::OnToggleViewButton ), NULL, this ); + m_bpButtonShowConflict->Connect( wxEVT_RIGHT_DOWN, wxMouseEventHandler( MainDialogGenerated::OnViewButtonRightClick ), NULL, this ); } MainDialogGenerated::~MainDialogGenerated() @@ -898,33 +936,51 @@ MainDialogGenerated::~MainDialogGenerated() this->Disconnect( wxID_ABOUT, wxEVT_COMMAND_MENU_SELECTED, wxCommandEventHandler( MainDialogGenerated::OnMenuAbout ) ); m_buttonCompare->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( MainDialogGenerated::OnCompare ), NULL, this ); m_bpButtonCmpConfig->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( MainDialogGenerated::OnCmpSettings ), NULL, this ); + m_bpButtonCmpConfig->Disconnect( wxEVT_RIGHT_DOWN, wxMouseEventHandler( MainDialogGenerated::OnCompSettingsContext ), NULL, this ); m_bpButtonSyncConfig->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( MainDialogGenerated::OnSyncSettings ), NULL, this ); - m_buttonStartSync->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( MainDialogGenerated::OnStartSync ), NULL, this ); + m_bpButtonSyncConfig->Disconnect( wxEVT_RIGHT_DOWN, wxMouseEventHandler( MainDialogGenerated::OnSyncSettingsContext ), NULL, this ); + m_buttonSync->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( MainDialogGenerated::OnStartSync ), NULL, this ); m_bpButtonAddPair->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( MainDialogGenerated::OnAddFolderPair ), NULL, this ); m_bpButtonRemovePair->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( MainDialogGenerated::OnRemoveTopFolderPair ), NULL, this ); m_bpButtonSwapSides->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( MainDialogGenerated::OnSwapSides ), NULL, this ); - m_bpButtonLoad->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( MainDialogGenerated::OnConfigLoad ), NULL, this ); + m_bpButtonOpen->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( MainDialogGenerated::OnConfigLoad ), NULL, this ); m_bpButtonSave->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( MainDialogGenerated::OnConfigSave ), NULL, this ); m_bpButtonBatchJob->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( MainDialogGenerated::OnSaveAsBatchJob ), NULL, this ); m_listBoxHistory->Disconnect( wxEVT_CHAR, wxKeyEventHandler( MainDialogGenerated::OnCfgHistoryKeyEvent ), NULL, this ); m_listBoxHistory->Disconnect( wxEVT_COMMAND_LISTBOX_SELECTED, wxCommandEventHandler( MainDialogGenerated::OnLoadFromHistory ), NULL, this ); m_listBoxHistory->Disconnect( wxEVT_COMMAND_LISTBOX_DOUBLECLICKED, wxCommandEventHandler( MainDialogGenerated::OnLoadFromHistoryDoubleClick ), NULL, this ); + m_listBoxHistory->Disconnect( wxEVT_RIGHT_DOWN, wxMouseEventHandler( MainDialogGenerated::OnCfgHistoryRightClick ), NULL, this ); m_bpButtonFilter->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( MainDialogGenerated::OnConfigureFilter ), NULL, this ); + m_bpButtonFilter->Disconnect( wxEVT_RIGHT_DOWN, wxMouseEventHandler( MainDialogGenerated::OnGlobalFilterContext ), NULL, this ); m_checkBoxHideExcluded->Disconnect( wxEVT_COMMAND_CHECKBOX_CLICKED, wxCommandEventHandler( MainDialogGenerated::OnShowExcluded ), NULL, this ); - m_bpButtonSyncCreateLeft->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( MainDialogGenerated::OnSyncCreateLeft ), NULL, this ); - m_bpButtonSyncDirOverwLeft->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( MainDialogGenerated::OnSyncDirLeft ), NULL, this ); - m_bpButtonSyncDeleteLeft->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( MainDialogGenerated::OnSyncDeleteLeft ), NULL, this ); - m_bpButtonLeftOnly->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( MainDialogGenerated::OnLeftOnlyFiles ), NULL, this ); - m_bpButtonLeftNewer->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( MainDialogGenerated::OnLeftNewerFiles ), NULL, this ); - m_bpButtonEqual->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( MainDialogGenerated::OnEqualFiles ), NULL, this ); - m_bpButtonDifferent->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( MainDialogGenerated::OnDifferentFiles ), NULL, this ); - m_bpButtonSyncDirNone->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( MainDialogGenerated::OnSyncDirNone ), NULL, this ); - m_bpButtonRightNewer->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( MainDialogGenerated::OnRightNewerFiles ), NULL, this ); - m_bpButtonRightOnly->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( MainDialogGenerated::OnRightOnlyFiles ), NULL, this ); - m_bpButtonSyncDeleteRight->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( MainDialogGenerated::OnSyncDeleteRight ), NULL, this ); - m_bpButtonSyncDirOverwRight->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( MainDialogGenerated::OnSyncDirRight ), NULL, this ); - m_bpButtonSyncCreateRight->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( MainDialogGenerated::OnSyncCreateRight ), NULL, this ); - m_bpButtonConflict->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( MainDialogGenerated::OnConflictFiles ), NULL, this ); + m_bpButtonShowCreateLeft->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( MainDialogGenerated::OnToggleViewButton ), NULL, this ); + m_bpButtonShowCreateLeft->Disconnect( wxEVT_RIGHT_DOWN, wxMouseEventHandler( MainDialogGenerated::OnViewButtonRightClick ), NULL, this ); + m_bpButtonShowUpdateLeft->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( MainDialogGenerated::OnToggleViewButton ), NULL, this ); + m_bpButtonShowUpdateLeft->Disconnect( wxEVT_RIGHT_DOWN, wxMouseEventHandler( MainDialogGenerated::OnViewButtonRightClick ), NULL, this ); + m_bpButtonShowDeleteLeft->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( MainDialogGenerated::OnToggleViewButton ), NULL, this ); + m_bpButtonShowDeleteLeft->Disconnect( wxEVT_RIGHT_DOWN, wxMouseEventHandler( MainDialogGenerated::OnViewButtonRightClick ), NULL, this ); + m_bpButtonShowLeftOnly->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( MainDialogGenerated::OnToggleViewButton ), NULL, this ); + m_bpButtonShowLeftOnly->Disconnect( wxEVT_RIGHT_DOWN, wxMouseEventHandler( MainDialogGenerated::OnViewButtonRightClick ), NULL, this ); + m_bpButtonShowLeftNewer->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( MainDialogGenerated::OnToggleViewButton ), NULL, this ); + m_bpButtonShowLeftNewer->Disconnect( wxEVT_RIGHT_DOWN, wxMouseEventHandler( MainDialogGenerated::OnViewButtonRightClick ), NULL, this ); + m_bpButtonShowEqual->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( MainDialogGenerated::OnToggleViewButton ), NULL, this ); + m_bpButtonShowEqual->Disconnect( wxEVT_RIGHT_DOWN, wxMouseEventHandler( MainDialogGenerated::OnViewButtonRightClick ), NULL, this ); + m_bpButtonShowDifferent->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( MainDialogGenerated::OnToggleViewButton ), NULL, this ); + m_bpButtonShowDifferent->Disconnect( wxEVT_RIGHT_DOWN, wxMouseEventHandler( MainDialogGenerated::OnViewButtonRightClick ), NULL, this ); + m_bpButtonShowDoNothing->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( MainDialogGenerated::OnToggleViewButton ), NULL, this ); + m_bpButtonShowDoNothing->Disconnect( wxEVT_RIGHT_DOWN, wxMouseEventHandler( MainDialogGenerated::OnViewButtonRightClick ), NULL, this ); + m_bpButtonShowRightNewer->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( MainDialogGenerated::OnToggleViewButton ), NULL, this ); + m_bpButtonShowRightNewer->Disconnect( wxEVT_RIGHT_DOWN, wxMouseEventHandler( MainDialogGenerated::OnViewButtonRightClick ), NULL, this ); + m_bpButtonShowRightOnly->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( MainDialogGenerated::OnToggleViewButton ), NULL, this ); + m_bpButtonShowRightOnly->Disconnect( wxEVT_RIGHT_DOWN, wxMouseEventHandler( MainDialogGenerated::OnViewButtonRightClick ), NULL, this ); + m_bpButtonShowDeleteRight->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( MainDialogGenerated::OnToggleViewButton ), NULL, this ); + m_bpButtonShowDeleteRight->Disconnect( wxEVT_RIGHT_DOWN, wxMouseEventHandler( MainDialogGenerated::OnViewButtonRightClick ), NULL, this ); + m_bpButtonShowUpdateRight->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( MainDialogGenerated::OnToggleViewButton ), NULL, this ); + m_bpButtonShowUpdateRight->Disconnect( wxEVT_RIGHT_DOWN, wxMouseEventHandler( MainDialogGenerated::OnViewButtonRightClick ), NULL, this ); + m_bpButtonShowCreateRight->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( MainDialogGenerated::OnToggleViewButton ), NULL, this ); + m_bpButtonShowCreateRight->Disconnect( wxEVT_RIGHT_DOWN, wxMouseEventHandler( MainDialogGenerated::OnViewButtonRightClick ), NULL, this ); + m_bpButtonShowConflict->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( MainDialogGenerated::OnToggleViewButton ), NULL, this ); + m_bpButtonShowConflict->Disconnect( wxEVT_RIGHT_DOWN, wxMouseEventHandler( MainDialogGenerated::OnViewButtonRightClick ), NULL, this ); } @@ -2322,7 +2378,7 @@ AboutDlgGenerated::AboutDlgGenerated( wxWindow* parent, wxWindowID id, const wxS bSizerCodeInfo = new wxBoxSizer( wxVERTICAL ); - m_staticText72 = new wxStaticText( m_panel33, wxID_ANY, _("Source code written in C++ utilizing:"), wxDefaultPosition, wxDefaultSize, 0 ); + m_staticText72 = new wxStaticText( m_panel33, wxID_ANY, _("Source code written in C++ using:"), wxDefaultPosition, wxDefaultSize, 0 ); m_staticText72->Wrap( -1 ); m_staticText72->SetFont( wxFont( wxNORMAL_FONT->GetPointSize(), 70, 90, 92, false, wxEmptyString ) ); @@ -2334,35 +2390,30 @@ AboutDlgGenerated::AboutDlgGenerated( wxWindow* parent, wxWindowID id, const wxS wxBoxSizer* bSizer171; bSizer171 = new wxBoxSizer( wxHORIZONTAL ); - m_hyperlink9 = new wxHyperlinkCtrl( m_panel33, wxID_ANY, _("MinGW"), wxT("http://www.mingw.org"), wxDefaultPosition, wxDefaultSize, wxHL_DEFAULT_STYLE ); - m_hyperlink9->SetBackgroundColour( wxSystemSettings::GetColour( wxSYS_COLOUR_WINDOW ) ); - - bSizer171->Add( m_hyperlink9, 0, wxALIGN_CENTER_VERTICAL|wxRIGHT, 5 ); - m_hyperlink11 = new wxHyperlinkCtrl( m_panel33, wxID_ANY, _("MS Visual C++"), wxT("http://msdn.microsoft.com/library/60k1461a.aspx"), wxDefaultPosition, wxDefaultSize, wxHL_DEFAULT_STYLE ); m_hyperlink11->SetBackgroundColour( wxSystemSettings::GetColour( wxSYS_COLOUR_WINDOW ) ); bSizer171->Add( m_hyperlink11, 0, wxALIGN_CENTER_VERTICAL|wxRIGHT, 5 ); + m_hyperlink9 = new wxHyperlinkCtrl( m_panel33, wxID_ANY, _("MinGW"), wxT("http://www.mingw.org"), wxDefaultPosition, wxDefaultSize, wxHL_DEFAULT_STYLE ); + m_hyperlink9->SetBackgroundColour( wxSystemSettings::GetColour( wxSYS_COLOUR_WINDOW ) ); + + bSizer171->Add( m_hyperlink9, 0, wxALIGN_CENTER_VERTICAL|wxRIGHT, 5 ); + m_hyperlink10 = new wxHyperlinkCtrl( m_panel33, wxID_ANY, _("Code::Blocks"), wxT("http://www.codeblocks.org"), wxDefaultPosition, wxDefaultSize, wxHL_DEFAULT_STYLE ); m_hyperlink10->SetBackgroundColour( wxSystemSettings::GetColour( wxSYS_COLOUR_WINDOW ) ); bSizer171->Add( m_hyperlink10, 0, wxALIGN_CENTER_VERTICAL|wxRIGHT, 5 ); - m_hyperlink13 = new wxHyperlinkCtrl( m_panel33, wxID_ANY, _("Boost"), wxT("http://www.boost.org"), wxDefaultPosition, wxDefaultSize, wxHL_DEFAULT_STYLE ); - m_hyperlink13->SetBackgroundColour( wxSystemSettings::GetColour( wxSYS_COLOUR_WINDOW ) ); - - bSizer171->Add( m_hyperlink13, 0, wxALIGN_CENTER_VERTICAL|wxRIGHT, 5 ); - m_hyperlink7 = new wxHyperlinkCtrl( m_panel33, wxID_ANY, _("wxWidgets"), wxT("http://www.wxwidgets.org"), wxDefaultPosition, wxDefaultSize, wxHL_DEFAULT_STYLE ); m_hyperlink7->SetBackgroundColour( wxSystemSettings::GetColour( wxSYS_COLOUR_WINDOW ) ); bSizer171->Add( m_hyperlink7, 0, wxALIGN_CENTER_VERTICAL|wxRIGHT, 5 ); - m_hyperlink16 = new wxHyperlinkCtrl( m_panel33, wxID_ANY, _("Artistic Style"), wxT("http://astyle.sourceforge.net"), wxDefaultPosition, wxDefaultSize, wxHL_DEFAULT_STYLE ); - m_hyperlink16->SetBackgroundColour( wxSystemSettings::GetColour( wxSYS_COLOUR_WINDOW ) ); + m_hyperlink14 = new wxHyperlinkCtrl( m_panel33, wxID_ANY, _("wxFormBuilder"), wxT("http://wxformbuilder.org"), wxDefaultPosition, wxDefaultSize, wxHL_DEFAULT_STYLE ); + m_hyperlink14->SetBackgroundColour( wxSystemSettings::GetColour( wxSYS_COLOUR_WINDOW ) ); - bSizer171->Add( m_hyperlink16, 0, wxALIGN_CENTER_VERTICAL, 5 ); + bSizer171->Add( m_hyperlink14, 0, wxALIGN_CENTER_VERTICAL, 5 ); bSizer167->Add( bSizer171, 0, wxALIGN_CENTER_HORIZONTAL|wxBOTTOM, 5 ); @@ -2370,16 +2421,21 @@ AboutDlgGenerated::AboutDlgGenerated( wxWindow* parent, wxWindowID id, const wxS wxBoxSizer* bSizer172; bSizer172 = new wxBoxSizer( wxHORIZONTAL ); - m_hyperlink8 = new wxHyperlinkCtrl( m_panel33, wxID_ANY, _("Loki"), wxT("http://loki-lib.sourceforge.net/"), wxDefaultPosition, wxDefaultSize, wxHL_DEFAULT_STYLE ); - m_hyperlink8->SetBackgroundColour( wxSystemSettings::GetColour( wxSYS_COLOUR_WINDOW ) ); - - bSizer172->Add( m_hyperlink8, 0, wxALIGN_CENTER_VERTICAL|wxRIGHT, 5 ); - m_hyperlink15 = new wxHyperlinkCtrl( m_panel33, wxID_ANY, _("zenXML"), wxT("http://zenxml.sourceforge.net/"), wxDefaultPosition, wxDefaultSize, wxHL_DEFAULT_STYLE ); m_hyperlink15->SetBackgroundColour( wxSystemSettings::GetColour( wxSYS_COLOUR_WINDOW ) ); bSizer172->Add( m_hyperlink15, 0, wxALIGN_CENTER_VERTICAL|wxRIGHT, 5 ); + m_hyperlink13 = new wxHyperlinkCtrl( m_panel33, wxID_ANY, _("Boost"), wxT("http://www.boost.org"), wxDefaultPosition, wxDefaultSize, wxHL_DEFAULT_STYLE ); + m_hyperlink13->SetBackgroundColour( wxSystemSettings::GetColour( wxSYS_COLOUR_WINDOW ) ); + + bSizer172->Add( m_hyperlink13, 0, wxALIGN_CENTER_VERTICAL|wxRIGHT, 5 ); + + m_hyperlink16 = new wxHyperlinkCtrl( m_panel33, wxID_ANY, _("Artistic Style"), wxT("http://astyle.sourceforge.net"), wxDefaultPosition, wxDefaultSize, wxHL_DEFAULT_STYLE ); + m_hyperlink16->SetBackgroundColour( wxSystemSettings::GetColour( wxSYS_COLOUR_WINDOW ) ); + + bSizer172->Add( m_hyperlink16, 0, wxALIGN_CENTER_VERTICAL|wxRIGHT, 5 ); + m_hyperlink12 = new wxHyperlinkCtrl( m_panel33, wxID_ANY, _("Google Test"), wxT("http://code.google.com/p/googletest"), wxDefaultPosition, wxDefaultSize, wxHL_DEFAULT_STYLE ); m_hyperlink12->SetBackgroundColour( wxSystemSettings::GetColour( wxSYS_COLOUR_WINDOW ) ); @@ -2388,12 +2444,7 @@ AboutDlgGenerated::AboutDlgGenerated( wxWindow* parent, wxWindowID id, const wxS m_hyperlink18 = new wxHyperlinkCtrl( m_panel33, wxID_ANY, _("Unicode NSIS"), wxT("http://www.scratchpaper.com"), wxDefaultPosition, wxDefaultSize, wxHL_DEFAULT_STYLE ); m_hyperlink18->SetBackgroundColour( wxSystemSettings::GetColour( wxSYS_COLOUR_WINDOW ) ); - bSizer172->Add( m_hyperlink18, 0, wxALIGN_CENTER_VERTICAL|wxRIGHT, 5 ); - - m_hyperlink14 = new wxHyperlinkCtrl( m_panel33, wxID_ANY, _("wxFormBuilder"), wxT("http://wxformbuilder.org"), wxDefaultPosition, wxDefaultSize, wxHL_DEFAULT_STYLE ); - m_hyperlink14->SetBackgroundColour( wxSystemSettings::GetColour( wxSYS_COLOUR_WINDOW ) ); - - bSizer172->Add( m_hyperlink14, 0, wxALIGN_CENTER_VERTICAL, 5 ); + bSizer172->Add( m_hyperlink18, 0, wxALIGN_CENTER_VERTICAL, 5 ); bSizer167->Add( bSizer172, 0, wxALIGN_CENTER_HORIZONTAL, 5 ); diff --git a/ui/gui_generated.h b/ui/gui_generated.h index bf93658b..f772f567 100644 --- a/ui/gui_generated.h +++ b/ui/gui_generated.h @@ -93,7 +93,7 @@ protected: wxBitmapButton* m_bpButtonCmpConfig; wxStaticText* m_staticTextSyncVariant; wxBitmapButton* m_bpButtonSyncConfig; - zen::BitmapButton* m_buttonStartSync; + zen::BitmapButton* m_buttonSync; wxPanel* m_panelDirectoryPairs; wxStaticText* m_staticTextResolvedPathL; wxBitmapButton* m_bpButtonAddPair; @@ -111,6 +111,8 @@ protected: zen::Grid* m_gridMainC; zen::Grid* m_gridMainR; wxPanel* m_panelStatusBar; + wxBoxSizer* bSizerFileStatus; + wxBoxSizer* bSizerStatusLeft; wxBoxSizer* bSizerStatusLeftDirectories; wxStaticBitmap* m_bitmapSmallDirectoryLeft; wxStaticText* m_staticTextStatusLeftDirs; @@ -120,6 +122,7 @@ protected: wxStaticText* m_staticTextStatusLeftBytes; wxStaticLine* m_staticline9; wxStaticText* m_staticTextStatusMiddle; + wxBoxSizer* bSizerStatusRight; wxStaticLine* m_staticline10; wxBoxSizer* bSizerStatusRightDirectories; wxStaticBitmap* m_bitmapSmallDirectoryRight; @@ -128,9 +131,10 @@ protected: wxStaticBitmap* m_bitmapSmallFileRight; wxStaticText* m_staticTextStatusRightFiles; wxStaticText* m_staticTextStatusRightBytes; + wxStaticText* m_staticTextFullStatus; wxPanel* m_panelConfig; wxBoxSizer* bSizerConfig; - wxBitmapButton* m_bpButtonLoad; + wxBitmapButton* m_bpButtonOpen; wxBitmapButton* m_bpButtonSave; wxBitmapButton* m_bpButtonBatchJob; wxListBox* m_listBoxHistory; @@ -155,20 +159,20 @@ protected: wxStaticText* m_staticTextCreateRight; wxPanel* m_panelViewFilter; wxBoxSizer* bSizerViewFilter; - ToggleButton* m_bpButtonSyncCreateLeft; - ToggleButton* m_bpButtonSyncDirOverwLeft; - ToggleButton* m_bpButtonSyncDeleteLeft; - ToggleButton* m_bpButtonLeftOnly; - ToggleButton* m_bpButtonLeftNewer; - ToggleButton* m_bpButtonEqual; - ToggleButton* m_bpButtonDifferent; - ToggleButton* m_bpButtonSyncDirNone; - ToggleButton* m_bpButtonRightNewer; - ToggleButton* m_bpButtonRightOnly; - ToggleButton* m_bpButtonSyncDeleteRight; - ToggleButton* m_bpButtonSyncDirOverwRight; - ToggleButton* m_bpButtonSyncCreateRight; - ToggleButton* m_bpButtonConflict; + ToggleButton* m_bpButtonShowCreateLeft; + ToggleButton* m_bpButtonShowUpdateLeft; + ToggleButton* m_bpButtonShowDeleteLeft; + ToggleButton* m_bpButtonShowLeftOnly; + ToggleButton* m_bpButtonShowLeftNewer; + ToggleButton* m_bpButtonShowEqual; + ToggleButton* m_bpButtonShowDifferent; + ToggleButton* m_bpButtonShowDoNothing; + ToggleButton* m_bpButtonShowRightNewer; + ToggleButton* m_bpButtonShowRightOnly; + ToggleButton* m_bpButtonShowDeleteRight; + ToggleButton* m_bpButtonShowUpdateRight; + ToggleButton* m_bpButtonShowCreateRight; + ToggleButton* m_bpButtonShowConflict; // Virtual event handlers, overide them in your derived class virtual void OnClose( wxCloseEvent& event ) { event.Skip(); } @@ -186,29 +190,21 @@ protected: virtual void OnMenuCheckVersion( wxCommandEvent& event ) { event.Skip(); } virtual void OnMenuAbout( wxCommandEvent& event ) { event.Skip(); } virtual void OnCmpSettings( wxCommandEvent& event ) { event.Skip(); } + virtual void OnCompSettingsContext( wxMouseEvent& event ) { event.Skip(); } virtual void OnSyncSettings( wxCommandEvent& event ) { event.Skip(); } + virtual void OnSyncSettingsContext( wxMouseEvent& event ) { event.Skip(); } virtual void OnAddFolderPair( wxCommandEvent& event ) { event.Skip(); } virtual void OnRemoveTopFolderPair( wxCommandEvent& event ) { event.Skip(); } virtual void OnSwapSides( wxCommandEvent& event ) { event.Skip(); } virtual void OnCfgHistoryKeyEvent( wxKeyEvent& event ) { event.Skip(); } virtual void OnLoadFromHistory( wxCommandEvent& event ) { event.Skip(); } virtual void OnLoadFromHistoryDoubleClick( wxCommandEvent& event ) { event.Skip(); } + virtual void OnCfgHistoryRightClick( wxMouseEvent& event ) { event.Skip(); } virtual void OnConfigureFilter( wxCommandEvent& event ) { event.Skip(); } + virtual void OnGlobalFilterContext( wxMouseEvent& event ) { event.Skip(); } virtual void OnShowExcluded( wxCommandEvent& event ) { event.Skip(); } - virtual void OnSyncCreateLeft( wxCommandEvent& event ) { event.Skip(); } - virtual void OnSyncDirLeft( wxCommandEvent& event ) { event.Skip(); } - virtual void OnSyncDeleteLeft( 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 OnSyncDirNone( wxCommandEvent& event ) { event.Skip(); } - virtual void OnRightNewerFiles( wxCommandEvent& event ) { event.Skip(); } - virtual void OnRightOnlyFiles( wxCommandEvent& event ) { event.Skip(); } - virtual void OnSyncDeleteRight( wxCommandEvent& event ) { event.Skip(); } - virtual void OnSyncDirRight( wxCommandEvent& event ) { event.Skip(); } - virtual void OnSyncCreateRight( wxCommandEvent& event ) { event.Skip(); } - virtual void OnConflictFiles( wxCommandEvent& event ) { event.Skip(); } + virtual void OnToggleViewButton( wxCommandEvent& event ) { event.Skip(); } + virtual void OnViewButtonRightClick( wxMouseEvent& event ) { event.Skip(); } public: @@ -594,17 +590,16 @@ protected: wxPanel* m_panel33; wxBoxSizer* bSizerCodeInfo; wxStaticText* m_staticText72; - wxHyperlinkCtrl* m_hyperlink9; wxHyperlinkCtrl* m_hyperlink11; + wxHyperlinkCtrl* m_hyperlink9; wxHyperlinkCtrl* m_hyperlink10; - wxHyperlinkCtrl* m_hyperlink13; wxHyperlinkCtrl* m_hyperlink7; - wxHyperlinkCtrl* m_hyperlink16; - wxHyperlinkCtrl* m_hyperlink8; + wxHyperlinkCtrl* m_hyperlink14; wxHyperlinkCtrl* m_hyperlink15; + wxHyperlinkCtrl* m_hyperlink13; + wxHyperlinkCtrl* m_hyperlink16; wxHyperlinkCtrl* m_hyperlink12; wxHyperlinkCtrl* m_hyperlink18; - wxHyperlinkCtrl* m_hyperlink14; wxHyperlinkCtrl* m_hyperlink21; wxPanel* m_panel40; wxPanel* m_panel39; diff --git a/ui/gui_status_handler.cpp b/ui/gui_status_handler.cpp index 0f915ed9..5d3a1f36 100644 --- a/ui/gui_status_handler.cpp +++ b/ui/gui_status_handler.cpp @@ -250,7 +250,7 @@ SyncStatusHandler::~SyncStatusHandler() showFinalResults = false; //take precedence over current visibility status else if (!finalCommand.empty()) { - auto cmdexp = utfCvrtTo<wxString>(expandMacros(utfCvrtTo<Zstring>(finalCommand))); + auto cmdexp = expandMacros(utfCvrtTo<Zstring>(finalCommand)); shellExecute(cmdexp); } } @@ -283,7 +283,7 @@ void SyncStatusHandler::initNewPhase(int objectsTotal, Int64 dataTotal, Phase ph void SyncStatusHandler::updateProcessedData(int objectsDelta, Int64 dataDelta) { StatusHandler::updateProcessedData(objectsDelta, dataDelta); - syncStatusFrame.reportCurrentBytes(getDataCurrent(currentPhase())); //throw () + syncStatusFrame.notifyProgressChange(); //noexcept //note: this method should NOT throw in order to properly allow undoing setting of statistics! } @@ -410,7 +410,7 @@ void SyncStatusHandler::reportWarning(const std::wstring& warningMessage, bool& void SyncStatusHandler::forceUiRefresh() { - syncStatusFrame.updateProgress(); + syncStatusFrame.updateGui(); } diff --git a/ui/main_dlg.cpp b/ui/main_dlg.cpp index c3f33db5..cae45cd1 100644 --- a/ui/main_dlg.cpp +++ b/ui/main_dlg.cpp @@ -5,57 +5,44 @@ // ************************************************************************** #include "main_dlg.h" -#include <iterator> -#include <stdexcept> #include <wx/clipbrd.h> -#include <wx/dataobj.h> -#include <wx/imaglist.h> #include <wx/wupdlock.h> #include <wx/msgdlg.h> #include <wx/sound.h> -#include <wx/display.h> -#include <wx/app.h> -#include <wx/dcmemory.h> #include <wx/filedlg.h> #include <zen/format_unit.h> +#include <zen/file_handling.h> +#include <zen/serialize.h> +#include <zen/file_id.h> +#include <zen/thread.h> #include <wx+/context_menu.h> -#include "folder_history_box.h" #include <wx+/button.h> -#include "../comparison.h" -#include "../synchronization.h" -#include "../algorithm.h" +#include <wx+/shell_execute.h> #include <wx+/app_main.h> +#include <wx+/toggle_button.h> +#include <wx+/mouse_move_dlg.h> +#include <wx+/no_flicker.h> +#include <wx+/rtl.h> #include "check_version.h" #include "gui_status_handler.h" #include "sync_cfg.h" #include "small_dlgs.h" -#include <wx+/mouse_move_dlg.h> #include "progress_indicator.h" #include "msg_popup.h" -#include "../structures.h" -#include "grid_view.h" +#include "folder_pair.h" +#include "search.h" +#include "batch_config.h" +#include "triple_splitter.h" +#include "../comparison.h" +#include "../synchronization.h" +#include "../algorithm.h" #include "../lib/resources.h" -#include <zen/file_handling.h> -#include <zen/serialize.h> -#include <zen/file_id.h> -#include <zen/recycler.h> #include "../lib/resolve_path.h" #include "../lib/ffs_paths.h" -#include <wx+/toggle_button.h> -#include "folder_pair.h" -#include <wx+/rtl.h> -#include "search.h" #include "../lib/help_provider.h" -#include "batch_config.h" -#include <zen/thread.h> #include "../lib/lock_holder.h" -#include <wx+/shell_execute.h> #include "../lib/localization.h" -#include <wx+/image_tools.h> -#include <wx+/no_flicker.h> -#include <wx+/grid.h> -#include "../lib/error_log.h" -#include "triple_splitter.h" +#include <zen/perf.h> using namespace zen; using namespace std::rel_ops; @@ -281,12 +268,13 @@ public: virtual bool allowMove(const wxMouseEvent& event) { - wxPanel* panel = dynamic_cast<wxPanel*>(event.GetEventObject()); - - const wxAuiPaneInfo& paneInfo = mainDlg_.auiMgr.GetPane(panel); - if (paneInfo.IsOk() && - paneInfo.IsFloating()) - return false; //prevent main dialog move + if (wxPanel* panel = dynamic_cast<wxPanel*>(event.GetEventObject())) + { + const wxAuiPaneInfo& paneInfo = mainDlg_.auiMgr.GetPane(panel); + if (paneInfo.IsOk() && + paneInfo.IsFloating()) + return false; //prevent main dialog move + } return true; //allow dialog move } @@ -507,7 +495,7 @@ MainDialog::MainDialog(const xmlAccess::XmlGuiConfig& guiCfg, wxAuiPaneInfo().Name(wxT("Panel5")).Layer(4).Bottom().Row(1).Position(1).Caption(_("Filter files")).MinSize(m_bpButtonFilter->GetSize().GetWidth(), m_panelFilter->GetSize().GetHeight())); auiMgr.AddPane(m_panelViewFilter, - wxAuiPaneInfo().Name(wxT("Panel6")).Layer(4).Bottom().Row(1).Position(2).Caption(_("Select view")).MinSize(m_bpButtonSyncDirNone->GetSize().GetWidth(), m_panelViewFilter->GetSize().GetHeight())); + wxAuiPaneInfo().Name(wxT("Panel6")).Layer(4).Bottom().Row(1).Position(2).Caption(_("Select view")).MinSize(m_bpButtonShowDoNothing->GetSize().GetWidth(), m_panelViewFilter->GetSize().GetHeight())); auiMgr.AddPane(m_panelStatistics, wxAuiPaneInfo().Name(wxT("Panel7")).Layer(4).Bottom().Row(1).Position(3).Caption(_("Statistics")).MinSize(m_bitmapData->GetSize().GetWidth() + m_staticTextData->GetSize().GetWidth(), m_panelStatistics->GetSize().GetHeight())); @@ -536,19 +524,14 @@ MainDialog::MainDialog(const xmlAccess::XmlGuiConfig& guiCfg, m_panelStatusBar ->Connect(wxEVT_RIGHT_DOWN, wxMouseEventHandler(MainDialog::OnContextSetLayout), nullptr, this); //---------------------------------------------------------------------------------- - //register context: quick variant selection - m_bpButtonCmpConfig ->Connect(wxEVT_RIGHT_DOWN, wxMouseEventHandler (MainDialog::OnCompSettingsContext), nullptr, this); - m_bpButtonSyncConfig->Connect(wxEVT_RIGHT_DOWN, wxMouseEventHandler (MainDialog::OnSyncSettingsContext), nullptr, this); - m_bpButtonFilter ->Connect(wxEVT_RIGHT_DOWN, wxCommandEventHandler(MainDialog::OnGlobalFilterContext), nullptr, this); - //sort grids - m_gridMainL->Connect(EVENT_GRID_COL_LABEL_MOUSE_LEFT, GridClickEventHandler(MainDialog::onGridLabelLeftClickL ), nullptr, this ); - m_gridMainC->Connect(EVENT_GRID_COL_LABEL_MOUSE_LEFT, GridClickEventHandler(MainDialog::onGridLabelLeftClickC ), nullptr, this ); - m_gridMainR->Connect(EVENT_GRID_COL_LABEL_MOUSE_LEFT, GridClickEventHandler(MainDialog::onGridLabelLeftClickR ), nullptr, this ); + m_gridMainL->Connect(EVENT_GRID_COL_LABEL_MOUSE_LEFT, GridClickEventHandler(MainDialog::onGridLabelLeftClickL ), nullptr, this); + m_gridMainC->Connect(EVENT_GRID_COL_LABEL_MOUSE_LEFT, GridClickEventHandler(MainDialog::onGridLabelLeftClickC ), nullptr, this); + m_gridMainR->Connect(EVENT_GRID_COL_LABEL_MOUSE_LEFT, GridClickEventHandler(MainDialog::onGridLabelLeftClickR ), nullptr, this); - m_gridMainL->Connect(EVENT_GRID_COL_LABEL_MOUSE_RIGHT, GridClickEventHandler(MainDialog::onGridLabelContextL ), nullptr, this ); - m_gridMainC->Connect(EVENT_GRID_COL_LABEL_MOUSE_RIGHT, GridClickEventHandler(MainDialog::onGridLabelContextC ), nullptr, this ); - m_gridMainR->Connect(EVENT_GRID_COL_LABEL_MOUSE_RIGHT, GridClickEventHandler(MainDialog::onGridLabelContextR ), nullptr, this ); + m_gridMainL->Connect(EVENT_GRID_COL_LABEL_MOUSE_RIGHT, GridClickEventHandler(MainDialog::onGridLabelContextL ), nullptr, this); + m_gridMainC->Connect(EVENT_GRID_COL_LABEL_MOUSE_RIGHT, GridClickEventHandler(MainDialog::onGridLabelContextC ), nullptr, this); + m_gridMainR->Connect(EVENT_GRID_COL_LABEL_MOUSE_RIGHT, GridClickEventHandler(MainDialog::onGridLabelContextR ), nullptr, this); //grid context menu m_gridMainL->Connect(EVENT_GRID_MOUSE_RIGHT_UP, GridClickEventHandler(MainDialog::onMainGridContextL), nullptr, this); @@ -561,8 +544,14 @@ MainDialog::MainDialog(const xmlAccess::XmlGuiConfig& guiCfg, m_gridNavi->Connect(EVENT_GRID_SELECT_RANGE, GridRangeSelectEventHandler(MainDialog::onNaviSelection), nullptr, this); - gridDataView.reset(new zen::GridView); - treeDataView.reset(new zen::TreeView); + //set tool tips with (non-translated!) short cut hint + m_bpButtonOpen ->SetToolTip(_("Open...") + L" (Ctrl+O)"); + m_bpButtonSave ->SetToolTip(_("Save") + L" (Ctrl+S)"); + m_buttonCompare->SetToolTip(_("Compare both sides") + L" (F5)"); + m_buttonSync ->SetToolTip(_("Start synchronization") + L" (F6)"); + + gridDataView = std::make_shared<GridView>(); + treeDataView = std::make_shared<TreeView>(); cleanedUp = false; processingGlobalKeyEvent = false; @@ -579,7 +568,7 @@ MainDialog::MainDialog(const xmlAccess::XmlGuiConfig& guiCfg, //init handling of first folder pair firstFolderPair.reset(new DirectoryPairFirst(*this)); - //initViewFilterButtons(); + initViewFilterButtons(); //init grid settings gridview::init(*m_gridMainL, *m_gridMainC, *m_gridMainR, gridDataView); @@ -593,7 +582,7 @@ MainDialog::MainDialog(const xmlAccess::XmlGuiConfig& guiCfg, m_buttonCompare ->setBitmapFront(GlobalResources::getImage(L"compare"), 5); m_bpButtonSyncConfig->SetBitmapLabel(GlobalResources::getImage(L"syncConfig")); m_bpButtonCmpConfig ->SetBitmapLabel(GlobalResources::getImage(L"cmpConfig")); - m_bpButtonLoad ->SetBitmapLabel(GlobalResources::getImage(L"load")); + m_bpButtonOpen ->SetBitmapLabel(GlobalResources::getImage(L"load")); m_bpButtonBatchJob ->SetBitmapLabel(GlobalResources::getImage(L"batch")); m_bpButtonAddPair ->SetBitmapLabel(GlobalResources::getImage(L"item_add")); @@ -1060,29 +1049,28 @@ std::vector<FileSystemObject*> MainDialog::getTreeSelection() const //Exception class used to abort the "compare" and "sync" process class AbortDeleteProcess {}; -class ManualDeletionHandler : private wxEvtHandler, public DeleteFilesHandler +class ManualDeletionHandler : private wxEvtHandler, public DeleteFilesHandler //throw AbortDeleteProcess { public: - ManualDeletionHandler(MainDialog* main) : + ManualDeletionHandler(MainDialog& main) : mainDlg(main), abortRequested(false), - ignoreErrors(false), - deletionCount(0) + ignoreErrors(false) { - mainDlg->disableAllElements(true); //disable everything except abort button + mainDlg.disableAllElements(true); //disable everything except abort button //register abort button - mainDlg->m_buttonAbort->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( ManualDeletionHandler::OnAbortDeletion), nullptr, this ); - mainDlg->Connect(wxEVT_CHAR_HOOK, wxKeyEventHandler(ManualDeletionHandler::OnKeyPressed), nullptr, this); + mainDlg.m_buttonAbort->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( ManualDeletionHandler::OnAbortDeletion), nullptr, this ); + mainDlg.Connect(wxEVT_CHAR_HOOK, wxKeyEventHandler(ManualDeletionHandler::OnKeyPressed), nullptr, this); } ~ManualDeletionHandler() { //de-register abort button - mainDlg->Disconnect(wxEVT_CHAR_HOOK, wxKeyEventHandler(ManualDeletionHandler::OnKeyPressed), nullptr, this); - mainDlg->m_buttonAbort->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( ManualDeletionHandler::OnAbortDeletion ), nullptr, this ); + mainDlg.Disconnect(wxEVT_CHAR_HOOK, wxKeyEventHandler(ManualDeletionHandler::OnKeyPressed), nullptr, this); + mainDlg.m_buttonAbort->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( ManualDeletionHandler::OnAbortDeletion ), nullptr, this ); - mainDlg->enableAllElements(); + mainDlg.enableAllElements(); } virtual Response reportError(const std::wstring& msg) @@ -1090,9 +1078,9 @@ public: if (ignoreErrors) return DeleteFilesHandler::IGNORE_ERROR; - updateGUI(); + forceUiRefresh(); bool ignoreNextErrors = false; - switch (showErrorDlg(mainDlg, + switch (showErrorDlg(&mainDlg, ReturnErrorDlg::BUTTON_IGNORE | ReturnErrorDlg::BUTTON_RETRY | ReturnErrorDlg::BUTTON_CANCEL, msg, &ignoreNextErrors)) { @@ -1114,9 +1102,9 @@ public: if (!warningActive || ignoreErrors) return; - updateGUI(); + forceUiRefresh(); bool dontWarnAgain = false; - switch (showWarningDlg(mainDlg, ReturnWarningDlg::BUTTON_IGNORE | ReturnWarningDlg::BUTTON_CANCEL, msg, dontWarnAgain)) + switch (showWarningDlg(&mainDlg, ReturnWarningDlg::BUTTON_IGNORE | ReturnWarningDlg::BUTTON_CANCEL, msg, dontWarnAgain)) { case ReturnWarningDlg::BUTTON_SWITCH: assert(false); @@ -1129,26 +1117,29 @@ public: } } - virtual void notifyDeletion(const Zstring& currentObject) //called for each file/folder that has been deleted + virtual void reportStatus (const std::wstring& msg) { - ++deletionCount; - updateGUI(); + statusMsg = msg; + requestUiRefresh(); } private: - void updateGUI() + virtual void requestUiRefresh() { if (updateUiIsAllowed()) //test if specific time span between ui updates is over - { - mainDlg->setStatusInformation(replaceCpy(_P("Object deleted successfully!", "%x objects deleted successfully!", deletionCount), - L"%x", zen::toGuiString(deletionCount), false)); - updateUiNow(); - } + forceUiRefresh(); if (abortRequested) //test after (implicit) call to wxApp::Yield() throw AbortDeleteProcess(); } + void forceUiRefresh() + { + //std::wstring msg = toGuiString(deletionCount) + + mainDlg.setStatusBarFullText(statusMsg); + updateUiNow(); + } + //context: C callstack message loop => throw()! void OnAbortDeletion(wxCommandEvent& event) //handle abort button click { @@ -1167,11 +1158,12 @@ private: event.Skip(); } - MainDialog* const mainDlg; + MainDialog& mainDlg; bool abortRequested; bool ignoreErrors; - size_t deletionCount; + //size_t deletionCount; // + std::wstring statusMsg; //status reporting }; @@ -1180,184 +1172,223 @@ void MainDialog::deleteSelectedFiles(const std::vector<FileSystemObject*>& selec { if (!selectionLeft.empty() || !selectionRight.empty()) { + wxBusyCursor dummy; //show hourglass cursor + wxWindow* oldFocus = wxWindow::FindFocus(); ZEN_ON_SCOPE_EXIT(if (oldFocus) oldFocus->SetFocus();) - if (zen::showDeleteDialog(this, - selectionLeft, - selectionRight, - globalCfg.gui.deleteOnBothSides, - globalCfg.gui.useRecyclerForManualDeletion) == ReturnSmallDlg::BUTTON_OKAY) + bool deleteOnBothSides = false; //let's keep this disabled by default -> don't save + + if (zen::showDeleteDialog(this, + selectionLeft, + selectionRight, + deleteOnBothSides, + globalCfg.gui.useRecyclerForManualDeletion) == ReturnSmallDlg::BUTTON_OKAY) + { + try { - try - { - //handle errors when deleting files/folders - ManualDeletionHandler statusHandler(this); - - zen::deleteFromGridAndHD(selectionLeft, - selectionRight, - folderCmp, - extractDirectionCfg(getConfig().mainCfg), - globalCfg.gui.deleteOnBothSides, - globalCfg.gui.useRecyclerForManualDeletion, - statusHandler, - globalCfg.optDialogs.warningRecyclerMissing); - - gridview::clearSelection(*m_gridMainL, *m_gridMainC, *m_gridMainR); //do not clear, if aborted! - } - catch (AbortDeleteProcess&) {} + //handle errors when deleting files/folders + ManualDeletionHandler statusHandler(*this); + + zen::deleteFromGridAndHD(selectionLeft, + selectionRight, + folderCmp, + extractDirectionCfg(getConfig().mainCfg), + deleteOnBothSides, + globalCfg.gui.useRecyclerForManualDeletion, + statusHandler, + globalCfg.optDialogs.warningRecyclerMissing); + + gridview::clearSelection(*m_gridMainL, *m_gridMainC, *m_gridMainR); //do not clear, if aborted! + } + catch (AbortDeleteProcess&) {} - //remove rows that are empty: just a beautification, invalid rows shouldn't cause issues - gridDataView->removeInvalidRows(); + //remove rows that are empty: just a beautification, invalid rows shouldn't cause issues + gridDataView->removeInvalidRows(); - //redraw grid neccessary to update new dimensions and for UI-Backend data linkage - updateGui(); //call immediately after deleteFromGridAndHD!!! - } + //redraw grid neccessary to update new dimensions and for UI-Backend data linkage + updateGui(); //call immediately after deleteFromGridAndHD!!! + } } } - +namespace +{ template <SelectedSide side> -wxString extractLastValidDir(const FileSystemObject& fsObj) +Zstring getExistingParentFolder(const FileSystemObject& fsObj) { - Zstring fullname = fsObj.getBaseDirPf<side>() + fsObj.getObjRelativeName(); //full name even if FileSystemObject::isEmpty<side>() == true + const DirMapping* dirObj = dynamic_cast<const DirMapping*>(&fsObj); + if (!dirObj) + dirObj = dynamic_cast<const DirMapping*>(&fsObj.parent()); - while (!fullname.empty() && !dirExists(fullname)) //bad algorithm: this one should better retrieve the status from fsObj - fullname = beforeLast(fullname, FILE_NAME_SEPARATOR); + while (dirObj) + { + if (!dirObj->isEmpty<side>()) + return dirObj->getFullName<side>(); - return toWx(fullname); + dirObj = dynamic_cast<const DirMapping*>(&dirObj->parent()); + } + return fsObj.getBaseDirPf<side>(); +} } - -void MainDialog::openExternalApplication(const wxString& commandline, const zen::FileSystemObject* fsObj, bool leftSide) //fsObj may be nullptr +void MainDialog::openExternalApplication(const wxString& commandline, const std::vector<FileSystemObject*>& selection, bool leftSide) { if (commandline.empty()) return; - wxString name; - wxString nameCo; - wxString dir; - wxString dirCo; + auto selectionTmp = selection; - if (fsObj) + const bool openFileBrowserRequested = [&]() -> bool { - name = toWx(fsObj->getFullName<LEFT_SIDE>()); //empty if obj not existing - dir = toWx(beforeLast(fsObj->getFullName<LEFT_SIDE>(), FILE_NAME_SEPARATOR)); //small issue: if obj does not exist but parent exists, this one erronously returns empty + xmlAccess::XmlGlobalSettings::Gui dummy; + return !dummy.externelApplications.empty() && dummy.externelApplications[0].second == commandline; + }(); - nameCo = toWx(fsObj->getFullName<RIGHT_SIDE>()); - dirCo = toWx(beforeLast(fsObj->getFullName<RIGHT_SIDE>(), FILE_NAME_SEPARATOR)); + //support fallback instead of an error in this special case + if (openFileBrowserRequested) + { + if (selectionTmp.size() > 1) //do not open more than one explorer instance! + selectionTmp.resize(1); // + + if (selectionTmp.empty() || + (leftSide && selectionTmp[0]->isEmpty<LEFT_SIDE >()) || + (!leftSide && selectionTmp[0]->isEmpty<RIGHT_SIDE>())) + { + Zstring fallbackDir; + if (selectionTmp.empty()) + fallbackDir = leftSide ? + getFormattedDirectoryName(toZ(firstFolderPair->getLeftDir())) : + getFormattedDirectoryName(toZ(firstFolderPair->getRightDir())); + + else + fallbackDir = leftSide ? + getExistingParentFolder<LEFT_SIDE >(*selectionTmp[0]) : + getExistingParentFolder<RIGHT_SIDE>(*selectionTmp[0]); +#ifdef FFS_WIN + zen::shellExecute(L"\"" + fallbackDir + L"\""); +#elif defined FFS_LINUX + zen::shellExecute("xdg-open \"" + fallbackDir + "\""); +#endif + return; + } } - if (!leftSide) + //regular command evaluation + for (auto it = selectionTmp.begin(); it != selectionTmp.end(); ++it) //context menu calls this function only if selection is not empty! { - std::swap(name, nameCo); - std::swap(dir, dirCo); - } + const FileSystemObject* fsObj = *it; - wxString command = commandline; + Zstring path1 = fsObj->getBaseDirPf<LEFT_SIDE>() + fsObj->getObjRelativeName(); //full path, even if item is not existing! + Zstring dir1 = beforeLast(path1, FILE_NAME_SEPARATOR); //Win: wrong for root paths like "C:\file.txt" - auto tryReplace = [&](wxString phrase, const wxString& replacement) -> bool - { - wxString cmdTmp = command.Upper(); //case insensitive search - phrase.MakeUpper(); // + Zstring path2 = fsObj->getBaseDirPf<RIGHT_SIDE>() + fsObj->getObjRelativeName(); + Zstring dir2 = beforeLast(path2, FILE_NAME_SEPARATOR); - size_t pos = cmdTmp.find(phrase); - if (pos != wxString::npos) + if (!leftSide) { - command.replace(pos, phrase.size(), replacement); - if (replacement.empty()) - return false; + std::swap(path1, path2); + std::swap(dir1, dir2); } - return true; - }; - bool expandSuccess = - /**/ tryReplace(L"%item_path%" , name ); //prevent short-cut behavior! - expandSuccess = tryReplace(L"%item_folder%" , dir ) && expandSuccess; // - expandSuccess = tryReplace(L"%item2_path%" , nameCo) && expandSuccess; // - expandSuccess = tryReplace(L"%item2_folder%", dirCo ) && expandSuccess; // + Zstring command = utfCvrtTo<Zstring>(commandline); + replace(command, Zstr("%item_path%"), path1); + replace(command, Zstr("%item2_path%"), path2); + replace(command, Zstr("%item_folder%"), dir1 ); + replace(command, Zstr("%item2_folder%"), dir2 ); - const bool openFileBrowser = [&]() -> bool - { - xmlAccess::XmlGlobalSettings::Gui dummy; - return !dummy.externelApplications.empty() && dummy.externelApplications[0].second == commandline; - }(); + auto cmdExp = expandMacros(command); + zen::shellExecute(cmdExp); //shows error message if command is malformed + } +} - if (!openFileBrowser || expandSuccess) + +void MainDialog::setStatusBarFileStatistics(size_t filesOnLeftView, + size_t foldersOnLeftView, + size_t filesOnRightView, + size_t foldersOnRightView, + UInt64 filesizeLeftView, + UInt64 filesizeRightView) +{ + wxWindowUpdateLocker dummy(m_panelStatusBar); //avoid display distortion + + //select state + bSizerFileStatus->Show(true); + m_staticTextFullStatus->Hide(); + + //fill statistics + //update status information + bSizerStatusLeftDirectories->Show(foldersOnLeftView > 0); + bSizerStatusLeftFiles ->Show(filesOnLeftView > 0); + + setText(*m_staticTextStatusLeftDirs, replaceCpy(_P("1 directory", "%x directories", foldersOnLeftView), L"%x", toGuiString(foldersOnLeftView), false)); + setText(*m_staticTextStatusLeftFiles, replaceCpy(_P("1 file", "%x files", filesOnLeftView), L"%x", toGuiString(filesOnLeftView), false)); + setText(*m_staticTextStatusLeftBytes, filesizeToShortString(to<Int64>(filesizeLeftView))); + + wxString statusMiddleNew; + if (gridDataView->rowsTotal() > 0) { - auto cmdExp = utfCvrtTo<wxString>(expandMacros(utfCvrtTo<Zstring>(command))); - zen::shellExecute(cmdExp); //just execute, show error message if command is malformed + statusMiddleNew = _P("%x of 1 row in view", "%x of %y rows in view", gridDataView->rowsTotal()); + replace(statusMiddleNew, L"%x", toGuiString(gridDataView->rowsOnView()), false); + replace(statusMiddleNew, L"%y", toGuiString(gridDataView->rowsTotal ()), false); } - else //failed to expand file browser command: support built-in fallback instead of an error! - { - wxString fallbackDir; - if (fsObj) - fallbackDir = leftSide ? - extractLastValidDir<LEFT_SIDE >(*fsObj) : - extractLastValidDir<RIGHT_SIDE>(*fsObj); - if (fallbackDir.empty()) - fallbackDir = leftSide ? - toWx(zen::getFormattedDirectoryName(toZ(firstFolderPair->getLeftDir()))) : - toWx(zen::getFormattedDirectoryName(toZ(firstFolderPair->getRightDir()))); + bSizerStatusRightDirectories->Show(foldersOnRightView > 0); + bSizerStatusRightFiles ->Show(filesOnRightView > 0); -#ifdef FFS_WIN - zen::shellExecute(wxString(L"\"") + fallbackDir + L"\""); -#elif defined FFS_LINUX - zen::shellExecute(wxString(L"xdg-open \"") + fallbackDir + L"\""); -#endif - } + setText(*m_staticTextStatusRightDirs, replaceCpy(_P("1 directory", "%x directories", foldersOnRightView), L"%x", toGuiString(foldersOnRightView), false)); + setText(*m_staticTextStatusRightFiles, replaceCpy(_P("1 file", "%x files", filesOnRightView), L"%x", toGuiString(filesOnRightView), false)); + setText(*m_staticTextStatusRightBytes, filesizeToShortString(to<Int64>(filesizeRightView))); + + + //fill middle text (considering flashStatusInformation()) + if (!oldStatusMsg) + setText(*m_staticTextStatusMiddle, statusMiddleNew); + else + *oldStatusMsg = statusMiddleNew; + + m_panelStatusBar->Layout(); } -void MainDialog::setStatusInformation(const wxString& msg) +void MainDialog::setStatusBarFullText(const wxString& msg) { - if (statusMsgStack.empty()) - { - if (m_staticTextStatusMiddle->GetLabel() != msg) - { - m_staticTextStatusMiddle->SetLabel(msg); - m_panelStatusBar->Layout(); - } - } - else - statusMsgStack[0] = msg; //statusMsgStack, index 0 is main status, while 1, 2, ... are temporary status texts in reverse order of screen appearance + //select state + bSizerFileStatus->Show(false); + m_staticTextFullStatus->Show(); + + //update status information + setText(*m_staticTextFullStatus, msg); + m_panelStatusBar->Layout(); } void MainDialog::flashStatusInformation(const wxString& text) { - if (statusMsgStack.empty()) - { - statusMsgStack.push_back(m_staticTextStatusMiddle->GetLabel()); + if (!oldStatusMsg) + oldStatusMsg = make_unique<wxString>(m_staticTextStatusMiddle->GetLabel()); - lastStatusChange = wxGetLocalTimeMillis(); - m_staticTextStatusMiddle->SetLabel(text); - m_staticTextStatusMiddle->SetForegroundColour(wxColour(31, 57, 226)); //highlight color: blue - m_panelStatusBar->Layout(); - } - else - statusMsgStack.insert(statusMsgStack.begin() + 1, text); + lastStatusChange = wxGetLocalTimeMillis(); + m_staticTextStatusMiddle->SetLabel(text); + m_staticTextStatusMiddle->SetForegroundColour(wxColour(31, 57, 226)); //highlight color: blue + m_panelStatusBar->Layout(); } void MainDialog::OnIdleEvent(wxEvent& event) { //small routine to restore status information after some time - if (!statusMsgStack.empty()) //check if there is some work to do + if (oldStatusMsg) //check if there is some work to do { wxMilliClock_t currentTime = wxGetLocalTimeMillis(); - if (currentTime - lastStatusChange > 2500) //restore stackObject after two seconds + if (numeric::dist(currentTime, lastStatusChange) > 2500) //restore stackObject after two seconds { lastStatusChange = currentTime; - m_staticTextStatusMiddle->SetLabel(statusMsgStack.back()); - statusMsgStack.pop_back(); - - if (statusMsgStack.empty()) - m_staticTextStatusMiddle->SetForegroundColour(wxSystemSettings::GetColour(wxSYS_COLOUR_WINDOWTEXT)); //reset color - + m_staticTextStatusMiddle->SetLabel(*oldStatusMsg); + m_staticTextStatusMiddle->SetForegroundColour(wxSystemSettings::GetColour(wxSYS_COLOUR_WINDOWTEXT)); //reset color m_panelStatusBar->Layout(); + oldStatusMsg.reset(); } } @@ -1367,7 +1398,7 @@ void MainDialog::OnIdleEvent(wxEvent& event) void MainDialog::disableAllElements(bool enableAbort) { - //when changing consider: comparison, synchronization, manual deletion + //when changing consider: comparison, synchronization, manual deletion EnableCloseButton(false); //not allowed for synchronization! progress indicator is top window! @@ -1377,13 +1408,14 @@ void MainDialog::disableAllElements(bool enableAbort) m_panelFilter ->Disable(); m_panelConfig ->Disable(); m_bpButtonSyncConfig ->Disable(); - m_buttonStartSync ->Disable(); + m_buttonSync ->Disable(); m_gridMainL ->Disable(); m_gridMainC ->Disable(); m_gridMainR ->Disable(); m_panelStatistics ->Disable(); m_gridNavi ->Disable(); m_panelDirectoryPairs->Disable(); + m_splitterMain ->Disable(); m_menubar1->EnableTop(0, false); m_menubar1->EnableTop(1, false); m_menubar1->EnableTop(2, false); @@ -1415,13 +1447,14 @@ void MainDialog::enableAllElements() m_panelFilter ->Enable(); m_panelConfig ->Enable(); m_bpButtonSyncConfig ->Enable(); - m_buttonStartSync ->Enable(); + m_buttonSync ->Enable(); m_gridMainL ->Enable(); m_gridMainC ->Enable(); m_gridMainR ->Enable(); m_panelStatistics ->Enable(); m_gridNavi ->Enable(); m_panelDirectoryPairs->Enable(); + m_splitterMain ->Enable(); m_menubar1->EnableTop(0, true); m_menubar1->EnableTop(1, true); m_menubar1->EnableTop(2, true); @@ -1643,12 +1676,8 @@ void MainDialog::onGridButtonEvent(wxKeyEvent& event, Grid& grid, bool leftSide) case WXK_RETURN: case WXK_NUMPAD_ENTER: if (!globalCfg.gui.externelApplications.empty()) - { - const wxString commandline = globalCfg.gui.externelApplications[0].second; //open with first external application - auto cursorPos = grid.getGridCursor(); - const size_t row = cursorPos.first; - openExternalApplication(commandline, gridDataView->getObject(row), leftSide); - } + openExternalApplication(globalCfg.gui.externelApplications[0].second, //open with first external application + getGridSelection(), leftSide); return; } @@ -1832,7 +1861,7 @@ void MainDialog::onNaviGridContext(GridClickEvent& event) std::swap(shortCutLeft, shortCutRight); menu.addItem(_("Set direction:") + L" ->" + shortCutRight, [this, &selection] { setSyncDirManually(selection, SYNC_DIR_RIGHT); }, &opRight); - menu.addItem(_("Set direction:") + L" -" L"\tAlt+Up", [this, &selection] { setSyncDirManually(selection, SYNC_DIR_NONE); }, &opNone); + menu.addItem(_("Set direction:") + L" -" L"\tAlt+Down", [this, &selection] { setSyncDirManually(selection, SYNC_DIR_NONE); }, &opNone); menu.addItem(_("Set direction:") + L" <-" + shortCutLeft, [this, &selection] { setSyncDirManually(selection, SYNC_DIR_LEFT); }, &opLeft); //Gtk needs a direction, "<-", because it has no context menu icons! //Gtk requires "no spaces" for shortcut identifiers! @@ -1867,7 +1896,7 @@ void MainDialog::onNaviGridContext(GridClickEvent& event) //---------------------------------------------------------------------------------------------------- //CONTEXT_DELETE_FILES menu.addSeparator(); - menu.addItem(_("Delete") + L"\tDel", [&] { deleteSelectedFiles(selection, selection); }, nullptr, !selection.empty()); + menu.addItem(_("Delete") + L"\tDelete", [&] { deleteSelectedFiles(selection, selection); }, nullptr, !selection.empty()); menu.popup(*this); } @@ -1924,7 +1953,7 @@ void MainDialog::onMainGridContextRim(bool leftSide) std::swap(shortCutLeft, shortCutRight); menu.addItem(_("Set direction:") + L" ->" + shortCutRight, [this, &selection] { setSyncDirManually(selection, SYNC_DIR_RIGHT); }, &opRight); - menu.addItem(_("Set direction:") + L" -" L"\tAlt+Up", [this, &selection] { setSyncDirManually(selection, SYNC_DIR_NONE); }, &opNone); + menu.addItem(_("Set direction:") + L" -" L"\tAlt+Down", [this, &selection] { setSyncDirManually(selection, SYNC_DIR_NONE); }, &opNone); menu.addItem(_("Set direction:") + L" <-" + shortCutLeft, [this, &selection] { setSyncDirManually(selection, SYNC_DIR_LEFT); }, &opLeft); //Gtk needs a direction, "<-", because it has no context menu icons! //Gtk requires "no spaces" for shortcut identifiers! @@ -1987,26 +2016,26 @@ void MainDialog::onMainGridContextRim(bool leftSide) it != globalCfg.gui.externelApplications.end(); ++it) { - //some trick to translate default external apps on the fly: 1. "open in explorer" 2. "start directly" + //translate default external apps on the fly: 1. "open in explorer" 2. "start directly" wxString description = zen::implementation::translate(it->first); if (description.empty()) description = L" "; //wxWidgets doesn't like empty items - const wxString command = it->second; + const wxString command = it->second; //COPY into lambda - auto openApp = [this, &selection, leftSide, command] { openExternalApplication(command, selection.empty() ? nullptr : selection[0], leftSide); }; + auto openApp = [this, &selection, leftSide, command] { openExternalApplication(command, selection, leftSide); }; if (it == globalCfg.gui.externelApplications.begin()) - menu.addItem(description + L"\tEnter", openApp); - else - menu.addItem(description, openApp, nullptr, !selection.empty()); + description += L"\tEnter"; + + menu.addItem(description, openApp, nullptr, !selection.empty()); } } //---------------------------------------------------------------------------------------------------- //CONTEXT_DELETE_FILES menu.addSeparator(); - menu.addItem(_("Delete") + L"\tDel", [this] + menu.addItem(_("Delete") + L"\tDelete", [this] { deleteSelectedFiles( getGridSelection(true, false), @@ -2724,38 +2753,48 @@ bool MainDialog::loadConfiguration(const std::vector<wxString>& filenames) } } - -void MainDialog::OnCfgHistoryKeyEvent(wxKeyEvent& event) +void MainDialog::deleteSelectedCfgHistoryItems() { - const int keyCode = event.GetKeyCode(); - if (keyCode == WXK_DELETE || keyCode == WXK_NUMPAD_DELETE) + wxArrayInt tmp; + m_listBoxHistory->GetSelections(tmp); + + std::set<int> selections(tmp.begin(), tmp.end()); //sort ascending! + + int shift = 0; + std::for_each(selections.begin(), selections.end(), + [&](int pos) + { + m_listBoxHistory->Delete(pos + shift); + --shift; + }); + + //set active selection on next element to allow "batch-deletion" by holding down DEL key + if (!selections.empty() && m_listBoxHistory->GetCount() > 0) { - //delete currently selected config history items - wxArrayInt tmp; - m_listBoxHistory->GetSelections(tmp); + int newSelection = *selections.begin(); + if (newSelection >= static_cast<int>(m_listBoxHistory->GetCount())) + newSelection = m_listBoxHistory->GetCount() - 1; + m_listBoxHistory->SetSelection(newSelection); + } +} - std::set<int> selections(tmp.begin(), tmp.end()); //sort ascending! - int shift = 0; - std::for_each(selections.begin(), selections.end(), - [&](int pos) - { - m_listBoxHistory->Delete(pos + shift); - --shift; - }); +void MainDialog::OnCfgHistoryRightClick(wxMouseEvent& event) +{ + ContextMenu menu; + menu.addItem(_("Delete"), [this] { deleteSelectedCfgHistoryItems(); }); + menu.popup(*this); +} - //set active selection on next element to allow "batch-deletion" by holding down DEL key - if (!selections.empty() && m_listBoxHistory->GetCount() > 0) - { - int newSelection = *selections.begin(); - if (newSelection >= static_cast<int>(m_listBoxHistory->GetCount())) - newSelection = m_listBoxHistory->GetCount() - 1; - m_listBoxHistory->SetSelection(newSelection); - } +void MainDialog::OnCfgHistoryKeyEvent(wxKeyEvent& event) +{ + const int keyCode = event.GetKeyCode(); + if (keyCode == WXK_DELETE || keyCode == WXK_NUMPAD_DELETE) + { + deleteSelectedCfgHistoryItems(); return; //"swallow" event } - event.Skip(); } @@ -2840,7 +2879,7 @@ void MainDialog::setConfig(const xmlAccess::XmlGuiConfig& newGuiCfg, const std:: //evaluate new settings... //(re-)set view filter buttons - initViewFilterButtons(newGuiCfg.mainCfg); + setViewFilterDefault(); updateFilterButtons(); @@ -2966,7 +3005,7 @@ void MainDialog::OnConfigureFilter(wxCommandEvent& event) } -void MainDialog::OnGlobalFilterContext(wxCommandEvent& event) +void MainDialog::OnGlobalFilterContext(wxMouseEvent& event) { ContextMenu menu; @@ -2983,101 +3022,15 @@ void MainDialog::OnGlobalFilterContext(wxCommandEvent& event) } -void MainDialog::OnLeftOnlyFiles(wxCommandEvent& event) -{ - m_bpButtonLeftOnly->toggle(); - updateGui(); -} - - -void MainDialog::OnLeftNewerFiles(wxCommandEvent& event) -{ - m_bpButtonLeftNewer->toggle(); - updateGui(); -} - - -void MainDialog::OnDifferentFiles(wxCommandEvent& event) -{ - m_bpButtonDifferent->toggle(); - updateGui(); -} - - -void MainDialog::OnRightNewerFiles(wxCommandEvent& event) -{ - m_bpButtonRightNewer->toggle(); - updateGui(); -} - - -void MainDialog::OnRightOnlyFiles(wxCommandEvent& event) -{ - m_bpButtonRightOnly->toggle(); - updateGui(); -} - - -void MainDialog::OnEqualFiles(wxCommandEvent& event) -{ - m_bpButtonEqual->toggle(); - updateGui(); -} - - -void MainDialog::OnConflictFiles(wxCommandEvent& event) +void MainDialog::OnToggleViewButton(wxCommandEvent& event) { - m_bpButtonConflict->toggle(); - updateGui(); -} - - -void MainDialog::OnSyncCreateLeft(wxCommandEvent& event) -{ - m_bpButtonSyncCreateLeft->toggle(); - updateGui(); -} - - -void MainDialog::OnSyncCreateRight(wxCommandEvent& event) -{ - m_bpButtonSyncCreateRight->toggle(); - updateGui(); -} - - -void MainDialog::OnSyncDeleteLeft(wxCommandEvent& event) -{ - m_bpButtonSyncDeleteLeft->toggle(); - updateGui(); -} - - -void MainDialog::OnSyncDeleteRight(wxCommandEvent& event) -{ - m_bpButtonSyncDeleteRight->toggle(); - updateGui(); -} - - -void MainDialog::OnSyncDirLeft(wxCommandEvent& event) -{ - m_bpButtonSyncDirOverwLeft->toggle(); - updateGui(); -} - - -void MainDialog::OnSyncDirRight(wxCommandEvent& event) -{ - m_bpButtonSyncDirOverwRight->toggle(); - updateGui(); -} - - -void MainDialog::OnSyncDirNone(wxCommandEvent& event) -{ - m_bpButtonSyncDirNone->toggle(); - updateGui(); + if (auto button = dynamic_cast<ToggleButton*>(event.GetEventObject())) + { + button->toggle(); + updateGui(); + } + else + assert(false); } @@ -3102,135 +3055,136 @@ wxBitmap buttonReleased(const std::string& name) } -void MainDialog::initViewFilterButtons(const MainConfiguration& mainCfg) +void MainDialog::initViewFilterButtons() { //compare result buttons - m_bpButtonLeftOnly->init(buttonPressed("leftOnly"), - buttonReleased("leftOnly"), - _("Hide files that exist on left side only"), - _("Show files that exist on left side only")); - - m_bpButtonRightOnly->init(buttonPressed("rightOnly"), - buttonReleased("rightOnly"), - _("Hide files that exist on right side only"), - _("Show files that exist on right side only")); - - m_bpButtonLeftNewer->init(buttonPressed("leftNewer"), - buttonReleased("leftNewer"), - _("Hide files that are newer on left"), - _("Show files that are newer on left")); - - m_bpButtonRightNewer->init(buttonPressed("rightNewer"), - buttonReleased("rightNewer"), - _("Hide files that are newer on right"), - _("Show files that are newer on right")); - - m_bpButtonEqual->init(buttonPressed("equal"), - buttonReleased("equal"), - _("Hide files that are equal"), - _("Show files that are equal")); - - m_bpButtonDifferent->init(buttonPressed("different"), - buttonReleased("different"), - _("Hide files that are different"), - _("Show files that are different")); - - m_bpButtonConflict->init(buttonPressed("conflict"), - buttonReleased("conflict"), - _("Hide conflicts"), - _("Show conflicts")); + m_bpButtonShowLeftOnly->init(buttonPressed("leftOnly"), + buttonReleased("leftOnly"), + _("Hide files that exist on left side only"), + _("Show files that exist on left side only")); + + m_bpButtonShowRightOnly->init(buttonPressed("rightOnly"), + buttonReleased("rightOnly"), + _("Hide files that exist on right side only"), + _("Show files that exist on right side only")); + + m_bpButtonShowLeftNewer->init(buttonPressed("leftNewer"), + buttonReleased("leftNewer"), + _("Hide files that are newer on left"), + _("Show files that are newer on left")); + + m_bpButtonShowRightNewer->init(buttonPressed("rightNewer"), + buttonReleased("rightNewer"), + _("Hide files that are newer on right"), + _("Show files that are newer on right")); + + m_bpButtonShowEqual->init(buttonPressed("equal"), + buttonReleased("equal"), + _("Hide files that are equal"), + _("Show files that are equal")); + + m_bpButtonShowDifferent->init(buttonPressed("different"), + buttonReleased("different"), + _("Hide files that are different"), + _("Show files that are different")); + + m_bpButtonShowConflict->init(buttonPressed("conflict"), + buttonReleased("conflict"), + _("Hide conflicts"), + _("Show conflicts")); //sync preview buttons - m_bpButtonSyncCreateLeft->init(buttonPressed("createLeft"), + m_bpButtonShowCreateLeft->init(buttonPressed("createLeft"), buttonReleased("createLeft"), _("Hide files that will be created on the left side"), _("Show files that will be created on the left side")); - m_bpButtonSyncCreateRight->init(buttonPressed("createRight"), + m_bpButtonShowCreateRight->init(buttonPressed("createRight"), buttonReleased("createRight"), _("Hide files that will be created on the right side"), _("Show files that will be created on the right side")); - m_bpButtonSyncDeleteLeft->init(buttonPressed("deleteLeft"), + m_bpButtonShowDeleteLeft->init(buttonPressed("deleteLeft"), buttonReleased("deleteLeft"), _("Hide files that will be deleted on the left side"), _("Show files that will be deleted on the left side")); - m_bpButtonSyncDeleteRight->init(buttonPressed("deleteRight"), + m_bpButtonShowDeleteRight->init(buttonPressed("deleteRight"), buttonReleased("deleteRight"), _("Hide files that will be deleted on the right side"), _("Show files that will be deleted on the right side")); - m_bpButtonSyncDirOverwLeft->init(buttonPressed("updateLeft"), - buttonReleased("updateLeft"), - _("Hide files that will be overwritten on left side"), - _("Show files that will be overwritten on left side")); + m_bpButtonShowUpdateLeft->init(buttonPressed("updateLeft"), + buttonReleased("updateLeft"), + _("Hide files that will be overwritten on left side"), + _("Show files that will be overwritten on left side")); - m_bpButtonSyncDirOverwRight->init(buttonPressed("updateRight"), - buttonReleased("updateRight"), - _("Hide files that will be overwritten on right side"), - _("Show files that will be overwritten on right side")); + m_bpButtonShowUpdateRight->init(buttonPressed("updateRight"), + buttonReleased("updateRight"), + _("Hide files that will be overwritten on right side"), + _("Show files that will be overwritten on right side")); - m_bpButtonSyncDirNone->init(buttonPressed("none"), - buttonReleased("none"), - _("Hide files that won't be copied"), - _("Show files that won't be copied")); + m_bpButtonShowDoNothing->init(buttonPressed("none"), + buttonReleased("none"), + _("Hide files that won't be copied"), + _("Show files that won't be copied")); +} - //compare result buttons - m_bpButtonLeftOnly-> setActive(true); - m_bpButtonRightOnly-> setActive(true); - m_bpButtonLeftNewer-> setActive(true); - m_bpButtonRightNewer->setActive(true); - m_bpButtonDifferent-> setActive(true); - m_bpButtonConflict-> setActive(true); - //sync preview buttons - m_bpButtonSyncCreateLeft-> setActive(true); - m_bpButtonSyncCreateRight-> setActive(true); - m_bpButtonSyncDeleteLeft-> setActive(true); - m_bpButtonSyncDeleteRight-> setActive(true); - m_bpButtonSyncDirOverwLeft-> setActive(true); - m_bpButtonSyncDirOverwRight->setActive(true); +void MainDialog::setViewFilterDefault() +{ + auto setButton = [](ToggleButton* tb, bool value) { tb->setActive(value); }; - m_bpButtonEqual->setActive(false); + const auto& def = globalCfg.gui.viewFilterDefault; + setButton(m_bpButtonShowLeftOnly, def.leftOnly); + setButton(m_bpButtonShowRightOnly, def.rightOnly); + setButton(m_bpButtonShowLeftNewer, def.leftNewer); + setButton(m_bpButtonShowRightNewer, def.rightNewer); + setButton(m_bpButtonShowEqual, def.equal); + setButton(m_bpButtonShowDifferent, def.different); + setButton(m_bpButtonShowConflict, def.conflict); - //special case "m_bpButtonSyncDirNone": set always active, unless sync direction "none" is part of the rule set: - //e.g. for a "custom" config or "update" variant. Otherwise rows with sync direction "none" can only occur on grid if the user manually - //sets them, in which case these rows should not be hidden immediately, so m_bpButtonSyncDirNone must be active - const std::vector<FolderPairCfg>& cmpCfg = extractCompareCfg(mainCfg); - const bool syncDirNonePartOfConfig = std::any_of(cmpCfg.begin(), cmpCfg.end(), - [&](const FolderPairCfg& fpCfg) -> bool - { - //attention: following is quite an amount of implicit/redundant knowledge here... let's hope our model is fundamental enough to not change any time soon! - - if (fpCfg.directionCfg.var == DirectionConfig::AUTOMATIC) - return false; + setButton(m_bpButtonShowCreateLeft, def.createLeft); + setButton(m_bpButtonShowCreateRight,def.createRight); + setButton(m_bpButtonShowUpdateLeft, def.updateLeft); + setButton(m_bpButtonShowUpdateRight,def.updateRight); + setButton(m_bpButtonShowDeleteLeft, def.deleteLeft); + setButton(m_bpButtonShowDeleteRight,def.deleteRight); + setButton(m_bpButtonShowDoNothing, def.doNothing); +} - const DirectionSet dirSet = extractDirections(fpCfg.directionCfg); - switch (fpCfg.compareVar) - { - case CMP_BY_TIME_SIZE: - return dirSet.exLeftSideOnly == SYNC_DIR_NONE || - dirSet.exRightSideOnly == SYNC_DIR_NONE || - dirSet.leftNewer == SYNC_DIR_NONE || - dirSet.rightNewer == SYNC_DIR_NONE; - //dirSet.different == SYNC_DIR_NONE || - //dirSet.conflict == SYNC_DIR_NONE; +void MainDialog::OnViewButtonRightClick(wxMouseEvent& event) +{ + auto setButtonDefault = [](const ToggleButton* tb, bool& defaultValue) + { + if (tb->IsShown()) + defaultValue = tb->isActive(); + }; - case CMP_BY_CONTENT: - return dirSet.exLeftSideOnly == SYNC_DIR_NONE || - dirSet.exRightSideOnly == SYNC_DIR_NONE || - //dirSet.leftNewer == SYNC_DIR_NONE || - //dirSet.rightNewer == SYNC_DIR_NONE || - dirSet.different == SYNC_DIR_NONE; - //dirSet.conflict == SYNC_DIR_NONE; - } - assert(false); - return false; - }); + auto setDefault = [&] + { + auto& def = globalCfg.gui.viewFilterDefault; + setButtonDefault(m_bpButtonShowLeftOnly, def.leftOnly); + setButtonDefault(m_bpButtonShowRightOnly, def.rightOnly); + setButtonDefault(m_bpButtonShowLeftNewer, def.leftNewer); + setButtonDefault(m_bpButtonShowRightNewer, def.rightNewer); + setButtonDefault(m_bpButtonShowEqual, def.equal); + setButtonDefault(m_bpButtonShowDifferent, def.different); + setButtonDefault(m_bpButtonShowConflict, def.conflict); + + setButtonDefault(m_bpButtonShowCreateLeft, def.createLeft); + setButtonDefault(m_bpButtonShowCreateRight, def.createRight); + setButtonDefault(m_bpButtonShowUpdateLeft, def.updateLeft); + setButtonDefault(m_bpButtonShowUpdateRight, def.updateRight); + setButtonDefault(m_bpButtonShowDeleteLeft, def.deleteLeft); + setButtonDefault(m_bpButtonShowDeleteRight, def.deleteRight); + setButtonDefault(m_bpButtonShowDoNothing, def.doNothing); + }; - m_bpButtonSyncDirNone->setActive(!syncDirNonePartOfConfig); + ContextMenu menu; + menu.addItem( _("Set as default"), setDefault); + menu.popup(*this); } @@ -3316,7 +3270,7 @@ void MainDialog::OnCompare(wxCommandEvent& event) treeDataView->setData(folderCmp); // updateGui(); - // if (m_buttonStartSync->IsShownOnScreen()) m_buttonStartSync->SetFocus(); + // if (m_buttonSync->IsShownOnScreen()) m_buttonSync->SetFocus(); gridview::clearSelection(*m_gridMainL, *m_gridMainC, *m_gridMainR); m_gridNavi->clearSelection(); @@ -3353,13 +3307,13 @@ void MainDialog::updateGui() //update sync button enabled/disabled status if (!folderCmp.empty()) { - m_buttonStartSync->SetForegroundColour(wxSystemSettings::GetColour(wxSYS_COLOUR_BTNTEXT)); - m_buttonStartSync->setBitmapFront(GlobalResources::getImage(L"sync"), 5); + m_buttonSync->SetForegroundColour(wxSystemSettings::GetColour(wxSYS_COLOUR_BTNTEXT)); + m_buttonSync->setBitmapFront(GlobalResources::getImage(L"sync"), 5); } else { - m_buttonStartSync->SetForegroundColour(wxColor(128, 128, 128)); //Some colors seem to have problems with 16-bit desktop color, well this one hasn't! - m_buttonStartSync->setBitmapFront(greyScale(GlobalResources::getImage(L"sync")), 5); + m_buttonSync->SetForegroundColour(wxColor(128, 128, 128)); //Some colors seem to have problems with 16-bit desktop color, well this one hasn't! + m_buttonSync->setBitmapFront(greyScale(GlobalResources::getImage(L"sync")), 5); } auiMgr.Update(); //fix small display distortion, if view filter panel is empty @@ -3562,9 +3516,13 @@ void MainDialog::onGridDoubleClickR(GridClickEvent& event) void MainDialog::onGridDoubleClickRim(size_t row, bool leftSide) { if (!globalCfg.gui.externelApplications.empty()) - openExternalApplication(globalCfg.gui.externelApplications[0].second, - gridDataView->getObject(row), //optional - leftSide); + { + std::vector<FileSystemObject*> selection; + if (FileSystemObject* fsObj = gridDataView->getObject(row)) //selection must be a list of BOUND pointers! + selection.push_back(fsObj); + + openExternalApplication(globalCfg.gui.externelApplications[0].second, selection, leftSide); + } } @@ -3620,26 +3578,26 @@ void MainDialog::OnSwapSides(wxCommandEvent& event) } //swap view filter - bool tmp = m_bpButtonLeftOnly->isActive(); - m_bpButtonLeftOnly->setActive(m_bpButtonRightOnly->isActive()); - m_bpButtonRightOnly->setActive(tmp); + bool tmp = m_bpButtonShowLeftOnly->isActive(); + m_bpButtonShowLeftOnly->setActive(m_bpButtonShowRightOnly->isActive()); + m_bpButtonShowRightOnly->setActive(tmp); - tmp = m_bpButtonLeftNewer->isActive(); - m_bpButtonLeftNewer->setActive(m_bpButtonRightNewer->isActive()); - m_bpButtonRightNewer->setActive(tmp); + tmp = m_bpButtonShowLeftNewer->isActive(); + m_bpButtonShowLeftNewer->setActive(m_bpButtonShowRightNewer->isActive()); + m_bpButtonShowRightNewer->setActive(tmp); /* for sync preview and "mirror" variant swapping may create strange effect: - tmp = m_bpButtonSyncCreateLeft->isActive(); - m_bpButtonSyncCreateLeft->setActive(m_bpButtonSyncCreateRight->isActive()); - m_bpButtonSyncCreateRight->setActive(tmp); + tmp = m_bpButtonShowCreateLeft->isActive(); + m_bpButtonShowCreateLeft->setActive(m_bpButtonShowCreateRight->isActive()); + m_bpButtonShowCreateRight->setActive(tmp); - tmp = m_bpButtonSyncDeleteLeft->isActive(); - m_bpButtonSyncDeleteLeft->setActive(m_bpButtonSyncDeleteRight->isActive()); - m_bpButtonSyncDeleteRight->setActive(tmp); + tmp = m_bpButtonShowDeleteLeft->isActive(); + m_bpButtonShowDeleteLeft->setActive(m_bpButtonShowDeleteRight->isActive()); + m_bpButtonShowDeleteRight->setActive(tmp); - tmp = m_bpButtonSyncDirOverwLeft->isActive(); - m_bpButtonSyncDirOverwLeft->setActive(m_bpButtonSyncDirOverwRight->isActive()); - m_bpButtonSyncDirOverwRight->setActive(tmp); + tmp = m_bpButtonShowUpdateLeft->isActive(); + m_bpButtonShowUpdateLeft->setActive(m_bpButtonShowUpdateRight->isActive()); + m_bpButtonShowUpdateRight->setActive(tmp); */ //swap grid information @@ -3659,34 +3617,34 @@ void MainDialog::updateGridViewData() zen::UInt64 filesizeRightView; //disable all buttons per default - m_bpButtonLeftOnly-> Show(false); - m_bpButtonRightOnly-> Show(false); - m_bpButtonLeftNewer-> Show(false); - m_bpButtonRightNewer->Show(false); - m_bpButtonDifferent-> Show(false); - m_bpButtonEqual-> Show(false); - m_bpButtonConflict-> Show(false); - - m_bpButtonSyncCreateLeft-> Show(false); - m_bpButtonSyncCreateRight-> Show(false); - m_bpButtonSyncDeleteLeft-> Show(false); - m_bpButtonSyncDeleteRight-> Show(false); - m_bpButtonSyncDirOverwLeft-> Show(false); - m_bpButtonSyncDirOverwRight->Show(false); - m_bpButtonSyncDirNone-> Show(false); + m_bpButtonShowLeftOnly ->Show(false); + m_bpButtonShowRightOnly ->Show(false); + m_bpButtonShowLeftNewer ->Show(false); + m_bpButtonShowRightNewer->Show(false); + m_bpButtonShowDifferent ->Show(false); + m_bpButtonShowEqual ->Show(false); + m_bpButtonShowConflict ->Show(false); + + m_bpButtonShowCreateLeft ->Show(false); + m_bpButtonShowCreateRight->Show(false); + m_bpButtonShowDeleteLeft ->Show(false); + m_bpButtonShowDeleteRight->Show(false); + m_bpButtonShowUpdateLeft ->Show(false); + m_bpButtonShowUpdateRight->Show(false); + m_bpButtonShowDoNothing ->Show(false); if (showSyncAction_) { const GridView::StatusSyncPreview result = gridDataView->updateSyncPreview(currentCfg.hideExcludedItems, - m_bpButtonSyncCreateLeft-> isActive(), - m_bpButtonSyncCreateRight-> isActive(), - m_bpButtonSyncDeleteLeft-> isActive(), - m_bpButtonSyncDeleteRight-> isActive(), - m_bpButtonSyncDirOverwLeft-> isActive(), - m_bpButtonSyncDirOverwRight->isActive(), - m_bpButtonSyncDirNone-> isActive(), - m_bpButtonEqual-> isActive(), - m_bpButtonConflict-> isActive()); + m_bpButtonShowCreateLeft ->isActive(), + m_bpButtonShowCreateRight->isActive(), + m_bpButtonShowDeleteLeft ->isActive(), + m_bpButtonShowDeleteRight->isActive(), + m_bpButtonShowUpdateLeft ->isActive(), + m_bpButtonShowUpdateRight->isActive(), + m_bpButtonShowDoNothing ->isActive(), + m_bpButtonShowEqual ->isActive(), + m_bpButtonShowConflict ->isActive()); filesOnLeftView = result.filesOnLeftView; foldersOnLeftView = result.foldersOnLeftView; filesOnRightView = result.filesOnRightView; @@ -3696,25 +3654,25 @@ void MainDialog::updateGridViewData() //sync preview buttons - m_bpButtonSyncCreateLeft-> Show(result.existsSyncCreateLeft); - m_bpButtonSyncCreateRight-> Show(result.existsSyncCreateRight); - m_bpButtonSyncDeleteLeft-> Show(result.existsSyncDeleteLeft); - m_bpButtonSyncDeleteRight-> Show(result.existsSyncDeleteRight); - m_bpButtonSyncDirOverwLeft-> Show(result.existsSyncDirLeft); - m_bpButtonSyncDirOverwRight->Show(result.existsSyncDirRight); - m_bpButtonSyncDirNone-> Show(result.existsSyncDirNone); - m_bpButtonEqual-> Show(result.existsSyncEqual); - m_bpButtonConflict-> Show(result.existsConflict); - - if (m_bpButtonSyncCreateLeft-> IsShown() || - m_bpButtonSyncCreateRight-> IsShown() || - m_bpButtonSyncDeleteLeft-> IsShown() || - m_bpButtonSyncDeleteRight-> IsShown() || - m_bpButtonSyncDirOverwLeft-> IsShown() || - m_bpButtonSyncDirOverwRight->IsShown() || - m_bpButtonSyncDirNone-> IsShown() || - m_bpButtonEqual-> IsShown() || - m_bpButtonConflict-> IsShown()) + m_bpButtonShowCreateLeft ->Show(result.existsSyncCreateLeft); + m_bpButtonShowCreateRight ->Show(result.existsSyncCreateRight); + m_bpButtonShowDeleteLeft ->Show(result.existsSyncDeleteLeft); + m_bpButtonShowDeleteRight ->Show(result.existsSyncDeleteRight); + m_bpButtonShowUpdateLeft ->Show(result.existsSyncDirLeft); + m_bpButtonShowUpdateRight ->Show(result.existsSyncDirRight); + m_bpButtonShowDoNothing ->Show(result.existsSyncDirNone); + m_bpButtonShowEqual ->Show(result.existsSyncEqual); + m_bpButtonShowConflict ->Show(result.existsConflict); + + if (m_bpButtonShowCreateLeft ->IsShown() || + m_bpButtonShowCreateRight->IsShown() || + m_bpButtonShowDeleteLeft ->IsShown() || + m_bpButtonShowDeleteRight->IsShown() || + m_bpButtonShowUpdateLeft ->IsShown() || + m_bpButtonShowUpdateRight->IsShown() || + m_bpButtonShowDoNothing ->IsShown() || + m_bpButtonShowEqual ->IsShown() || + m_bpButtonShowConflict ->IsShown()) { m_panelViewFilter->Show(); m_panelViewFilter->Layout(); @@ -3726,13 +3684,13 @@ void MainDialog::updateGridViewData() else { const GridView::StatusCmpResult result = gridDataView->updateCmpResult(currentCfg.hideExcludedItems, - m_bpButtonLeftOnly-> isActive(), - m_bpButtonRightOnly-> isActive(), - m_bpButtonLeftNewer-> isActive(), - m_bpButtonRightNewer->isActive(), - m_bpButtonDifferent-> isActive(), - m_bpButtonEqual-> isActive(), - m_bpButtonConflict-> isActive()); + m_bpButtonShowLeftOnly ->isActive(), + m_bpButtonShowRightOnly ->isActive(), + m_bpButtonShowLeftNewer ->isActive(), + m_bpButtonShowRightNewer->isActive(), + m_bpButtonShowDifferent ->isActive(), + m_bpButtonShowEqual ->isActive(), + m_bpButtonShowConflict ->isActive()); filesOnLeftView = result.filesOnLeftView; foldersOnLeftView = result.foldersOnLeftView; filesOnRightView = result.filesOnRightView; @@ -3741,21 +3699,21 @@ void MainDialog::updateGridViewData() filesizeRightView = result.filesizeRightView; //comparison result view buttons - m_bpButtonLeftOnly-> Show(result.existsLeftOnly); - m_bpButtonRightOnly-> Show(result.existsRightOnly); - m_bpButtonLeftNewer-> Show(result.existsLeftNewer); - m_bpButtonRightNewer->Show(result.existsRightNewer); - m_bpButtonDifferent-> Show(result.existsDifferent); - m_bpButtonEqual-> Show(result.existsEqual); - m_bpButtonConflict-> Show(result.existsConflict); - - if (m_bpButtonLeftOnly-> IsShown() || - m_bpButtonRightOnly-> IsShown() || - m_bpButtonLeftNewer-> IsShown() || - m_bpButtonRightNewer->IsShown() || - m_bpButtonDifferent-> IsShown() || - m_bpButtonEqual-> IsShown() || - m_bpButtonConflict-> IsShown()) + m_bpButtonShowLeftOnly ->Show(result.existsLeftOnly); + m_bpButtonShowRightOnly ->Show(result.existsRightOnly); + m_bpButtonShowLeftNewer ->Show(result.existsLeftNewer); + m_bpButtonShowRightNewer->Show(result.existsRightNewer); + m_bpButtonShowDifferent ->Show(result.existsDifferent); + m_bpButtonShowEqual ->Show(result.existsEqual); + m_bpButtonShowConflict ->Show(result.existsConflict); + + if (m_bpButtonShowLeftOnly ->IsShown() || + m_bpButtonShowRightOnly ->IsShown() || + m_bpButtonShowLeftNewer ->IsShown() || + m_bpButtonShowRightNewer->IsShown() || + m_bpButtonShowDifferent ->IsShown() || + m_bpButtonShowEqual ->IsShown() || + m_bpButtonShowConflict ->IsShown()) { m_panelViewFilter->Show(); m_panelViewFilter->Layout(); @@ -3769,58 +3727,33 @@ void MainDialog::updateGridViewData() //navigation tree if (showSyncAction_) treeDataView->updateSyncPreview(currentCfg.hideExcludedItems, - m_bpButtonSyncCreateLeft-> isActive(), - m_bpButtonSyncCreateRight-> isActive(), - m_bpButtonSyncDeleteLeft-> isActive(), - m_bpButtonSyncDeleteRight-> isActive(), - m_bpButtonSyncDirOverwLeft-> isActive(), - m_bpButtonSyncDirOverwRight->isActive(), - m_bpButtonSyncDirNone-> isActive(), - m_bpButtonEqual-> isActive(), - m_bpButtonConflict-> isActive()); + m_bpButtonShowCreateLeft ->isActive(), + m_bpButtonShowCreateRight->isActive(), + m_bpButtonShowDeleteLeft ->isActive(), + m_bpButtonShowDeleteRight->isActive(), + m_bpButtonShowUpdateLeft ->isActive(), + m_bpButtonShowUpdateRight->isActive(), + m_bpButtonShowDoNothing ->isActive(), + m_bpButtonShowEqual ->isActive(), + m_bpButtonShowConflict ->isActive()); else treeDataView->updateCmpResult(currentCfg.hideExcludedItems, - m_bpButtonLeftOnly-> isActive(), - m_bpButtonRightOnly-> isActive(), - m_bpButtonLeftNewer-> isActive(), - m_bpButtonRightNewer->isActive(), - m_bpButtonDifferent-> isActive(), - m_bpButtonEqual-> isActive(), - m_bpButtonConflict-> isActive()); + m_bpButtonShowLeftOnly ->isActive(), + m_bpButtonShowRightOnly ->isActive(), + m_bpButtonShowLeftNewer ->isActive(), + m_bpButtonShowRightNewer->isActive(), + m_bpButtonShowDifferent ->isActive(), + m_bpButtonShowEqual ->isActive(), + m_bpButtonShowConflict ->isActive()); m_gridNavi->Refresh(); - - //status bar - wxWindowUpdateLocker dummy(m_panelStatusBar); //avoid display distortion - - //################################################# - //update status information - bSizerStatusLeftDirectories->Show(foldersOnLeftView > 0); - bSizerStatusLeftFiles ->Show(filesOnLeftView > 0); - - setText(*m_staticTextStatusLeftDirs, replaceCpy(_P("1 directory", "%x directories", foldersOnLeftView), L"%x", toGuiString(foldersOnLeftView), false)); - setText(*m_staticTextStatusLeftFiles, replaceCpy(_P("1 file", "%x files", filesOnLeftView), L"%x", toGuiString(filesOnLeftView), false)); - setText(*m_staticTextStatusLeftBytes, filesizeToShortString(to<Int64>(filesizeLeftView))); - - { - wxString statusMiddleNew; - if (gridDataView->rowsTotal() > 0) - { - statusMiddleNew = _P("%x of 1 row in view", "%x of %y rows in view", gridDataView->rowsTotal()); - replace(statusMiddleNew, L"%x", toGuiString(gridDataView->rowsOnView()), false); - replace(statusMiddleNew, L"%y", toGuiString(gridDataView->rowsTotal ()), false); - } - setStatusInformation(statusMiddleNew); - } - - bSizerStatusRightDirectories->Show(foldersOnRightView > 0); - bSizerStatusRightFiles ->Show(filesOnRightView > 0); - - setText(*m_staticTextStatusRightDirs, replaceCpy(_P("1 directory", "%x directories", foldersOnRightView), L"%x", toGuiString(foldersOnRightView), false)); - setText(*m_staticTextStatusRightFiles, replaceCpy(_P("1 file", "%x files", filesOnRightView), L"%x", toGuiString(filesOnRightView), false)); - setText(*m_staticTextStatusRightBytes, filesizeToShortString(to<Int64>(filesizeRightView))); - - m_panelStatusBar->Layout(); + //update status bar information + setStatusBarFileStatistics(filesOnLeftView, + foldersOnLeftView, + filesOnRightView, + foldersOnRightView, + filesizeLeftView, + filesizeRightView); } @@ -3898,10 +3831,10 @@ void MainDialog::OnRemoveFolderPair(wxCommandEvent& event) wxWindowUpdateLocker dummy(this); //avoid display distortion const wxObject* const eventObj = event.GetEventObject(); //find folder pair originating the event - for (std::vector<DirectoryPair*>::const_iterator i = additionalFolderPairs.begin(); i != additionalFolderPairs.end(); ++i) - if (eventObj == (*i)->m_bpButtonRemovePair) + for (std::vector<DirectoryPair*>::const_iterator it = additionalFolderPairs.begin(); it != additionalFolderPairs.end(); ++it) + if (eventObj == (*it)->m_bpButtonRemovePair) { - removeAddFolderPair(i - additionalFolderPairs.begin()); + removeAddFolderPair(it - additionalFolderPairs.begin()); return; } } @@ -4007,10 +3940,10 @@ void MainDialog::addFolderPair(const std::vector<FolderPairEnh>& newPairs, bool for (auto it = newPairs.begin(); it != newPairs.end(); ++it)//set alternate configuration newEntries[it - newPairs.begin()]->setValues(toWx(it->leftDirectory), - toWx(it->rightDirectory), - it->altCmpConfig, - it->altSyncConfig, - it->localFilter); + toWx(it->rightDirectory), + it->altCmpConfig, + it->altSyncConfig, + it->localFilter); clearGrid(); //+ GUI update } @@ -4302,7 +4235,6 @@ void MainDialog::switchProgramLanguage(int langID) void MainDialog::OnMenuLanguageSwitch(wxCommandEvent& event) { std::map<MenuItemID, LanguageID>::const_iterator it = languageMenuItemMap.find(event.GetId()); - if (it != languageMenuItemMap.end()) switchProgramLanguage(it->second); } diff --git a/ui/main_dlg.h b/ui/main_dlg.h index 4f7a6bbd..b5492101 100644 --- a/ui/main_dlg.h +++ b/ui/main_dlg.h @@ -90,8 +90,10 @@ private: //used when saving configuration std::vector<wxString> activeConfigFiles; //name of currently loaded config file (may be more than 1) - void initViewFilterButtons(const zen::MainConfiguration& mainCfg); - void updateFilterButtons(); + void updateFilterButtons(); //file exclusion + + void initViewFilterButtons(); + void setViewFilterDefault(); void addFileToCfgHistory(const std::vector<wxString>& filenames); //= update/insert + apply selection @@ -119,14 +121,15 @@ private: void deleteSelectedFiles(const std::vector<zen::FileSystemObject*>& selectionLeft, const std::vector<zen::FileSystemObject*>& selectionRight); - void openExternalApplication(const wxString& commandline, const zen::FileSystemObject* fsObj, bool leftSide); //fsObj may be nullptr + void openExternalApplication(const wxString& commandline, const std::vector<zen::FileSystemObject*>& selection, bool leftSide); //selection may be empty //work to be done in idle time void OnIdleEvent(wxEvent& event); - //delayed status information restore - void setStatusInformation(const wxString& msg); //set main status - void flashStatusInformation(const wxString& msg); //temporarily show different status + //status bar supports one of the following two states at a time: + void setStatusBarFullText(const wxString& msg); + void setStatusBarFileStatistics(size_t filesOnLeftView, size_t foldersOnLeftView, size_t filesOnRightView, size_t foldersOnRightView, zen::UInt64 filesizeLeftView, zen::UInt64 filesizeRightView); + void flashStatusInformation(const wxString& msg); //temporarily show different status (only valid for setStatusBarFullText) //events void onGridButtonEventL(wxKeyEvent& event); @@ -138,9 +141,10 @@ private: void OnContextSetLayout(wxMouseEvent& event); void OnGlobalKeyEvent (wxKeyEvent& event); - void OnCompSettingsContext(wxMouseEvent& event); - void OnSyncSettingsContext(wxMouseEvent& event); - void OnGlobalFilterContext(wxCommandEvent& event); + virtual void OnCompSettingsContext(wxMouseEvent& event); + virtual void OnSyncSettingsContext(wxMouseEvent& event); + virtual void OnGlobalFilterContext(wxMouseEvent& event); + virtual void OnViewButtonRightClick(wxMouseEvent& event); void applyCompareConfig(bool switchMiddleGrid = false); @@ -176,21 +180,7 @@ private: void onGridLabelContextR(zen::GridClickEvent& event); void onGridLabelContext(zen::Grid& grid, zen::ColumnTypeRim type, const std::vector<zen::ColumnAttributeRim>& defaultColumnAttributes); - void OnLeftOnlyFiles (wxCommandEvent& event); - void OnRightOnlyFiles (wxCommandEvent& event); - void OnLeftNewerFiles (wxCommandEvent& event); - void OnRightNewerFiles(wxCommandEvent& event); - void OnEqualFiles (wxCommandEvent& event); - void OnDifferentFiles (wxCommandEvent& event); - void OnConflictFiles (wxCommandEvent& event); - - void OnSyncCreateLeft (wxCommandEvent& event); - void OnSyncCreateRight(wxCommandEvent& event); - void OnSyncDeleteLeft (wxCommandEvent& event); - void OnSyncDeleteRight(wxCommandEvent& event); - void OnSyncDirLeft (wxCommandEvent& event); - void OnSyncDirRight (wxCommandEvent& event); - void OnSyncDirNone (wxCommandEvent& event); + void OnToggleViewButton(wxCommandEvent& event); void OnConfigNew (wxCommandEvent& event); void OnConfigSave (wxCommandEvent& event); @@ -200,7 +190,10 @@ private: void OnLoadFromHistory(wxCommandEvent& event); void OnLoadFromHistoryDoubleClick(wxCommandEvent& event); + void deleteSelectedCfgHistoryItems(); + void OnCfgHistoryKeyEvent(wxKeyEvent& event); + void OnCfgHistoryRightClick(wxMouseEvent& event); void OnRegularUpdateCheck(wxIdleEvent& event); void OnLayoutWindowAsync (wxIdleEvent& event); @@ -270,7 +263,7 @@ private: //*********************************************** //status information wxLongLong lastStatusChange; - std::vector<wxString> statusMsgStack; + std::unique_ptr<wxString> oldStatusMsg; //compare status panel (hidden on start, shown when comparing) std::unique_ptr<CompareStatus> compareStatus; //always bound diff --git a/ui/progress_indicator.cpp b/ui/progress_indicator.cpp index 7fb04f93..13751541 100644 --- a/ui/progress_indicator.cpp +++ b/ui/progress_indicator.cpp @@ -123,7 +123,7 @@ void CompareStatus::CompareStatusImpl::finalize() void CompareStatus::CompareStatusImpl::switchToCompareBytewise() { //start to measure perf - perf.reset(new PerfCheck(WINDOW_REMAINING_TIME, WINDOW_BYTES_PER_SEC)); + perf = make_unique<PerfCheck>(WINDOW_REMAINING_TIME, WINDOW_BYTES_PER_SEC); lastStatCallSpeed = -1000000; //some big number lastStatCallRemTime = -1000000; @@ -720,9 +720,9 @@ namespace class GraphDataBytes : public GraphData { public: - void addRecord(double dataCurrent, long timeMs) + void addRecord(double currentBytes, long timeMs) { - data.insert(data.end(), std::make_pair(timeMs, dataCurrent)); + data.insert(data.end(), std::make_pair(timeMs, currentBytes)); //documentation differs about whether "hint" should be before or after the to be inserted element! //however "std::map<>::end()" is interpreted correctly by GCC and VS2010 @@ -868,8 +868,8 @@ public: ~SyncStatusImpl(); void initNewPhase(); - void reportCurrentBytes(Int64 currentData); - void updateProgress(bool allowYield = true); + void notifyProgressChange(); + void updateGui(bool allowYield = true); //call this in StatusUpdater derived class destructor at the LATEST(!) to prevent access to currentStatusUpdater void processHasFinished(SyncResult resultId, const ErrorLog& log); @@ -922,6 +922,8 @@ private: std::unique_ptr<PerfCheck> perf; long lastStatCallSpeed; //used for calculating intervals between collecting perf samples long lastStatCallRemTime; // + //help calculate total speed + long phaseStartMs; //begin of current phase in [ms] std::shared_ptr<GraphDataBytes> graphDataBytes; std::shared_ptr<GraphDataConstLine> graphDataBytesTotal; @@ -953,7 +955,8 @@ SyncStatus::SyncStatusImpl::SyncStatusImpl(AbortCallback& abortCb, finalResult(RESULT_ABORTED), //dummy value isZombie(false), lastStatCallSpeed (-1000000), //some big number - lastStatCallRemTime(-1000000) + lastStatCallRemTime(-1000000), + phaseStartMs(0) { #ifdef FFS_WIN new MouseMoveWindow(*this); //allow moving main dialog by clicking (nearly) anywhere...; ownership passed to "this" @@ -1002,13 +1005,13 @@ SyncStatus::SyncStatusImpl::SyncStatusImpl(AbortCallback& abortCb, graphDataBytesTotal = std::make_shared<GraphDataConstLine>(); m_panelGraph->setAttributes(Graph2D::MainAttributes(). - setLabelX(Graph2D::X_LABEL_BOTTOM, 20, std::make_shared<LabelFormatterTimeElapsed>()). - setLabelY(Graph2D::Y_LABEL_RIGHT, 70, std::make_shared<LabelFormatterBytes>())); + setLabelX(Graph2D::X_LABEL_BOTTOM, 20, std::make_shared<LabelFormatterTimeElapsed>()). + setLabelY(Graph2D::Y_LABEL_RIGHT, 70, std::make_shared<LabelFormatterBytes>())); m_panelGraph->setData(graphDataBytes, - Graph2D::CurveAttributes().setLineWidth(2) - .setColor (wxColor( 0, 192, 0)) //medium green - .fillCurveArea(wxColor(192, 255, 192))); //faint green + Graph2D::CurveAttributes().setLineWidth(2) + .setColor (wxColor( 0, 192, 0)) //medium green + .fillCurveArea(wxColor(192, 255, 192))); //faint green m_panelGraph->addData(graphDataBytesTotal, Graph2D::CurveAttributes().setLineWidth(2).setColor(wxColor(0, 64, 0))); //dark green @@ -1066,25 +1069,44 @@ void SyncStatus::SyncStatusImpl::initNewPhase() //reset graph (e.g. after binary comparison) graphDataBytes->clear(); - reportCurrentBytes(0); + notifyProgressChange(); //start new measurement - perf.reset(new PerfCheck(WINDOW_REMAINING_TIME, WINDOW_BYTES_PER_SEC)); + perf = make_unique<PerfCheck>(WINDOW_REMAINING_TIME, WINDOW_BYTES_PER_SEC); lastStatCallSpeed = -1000000; //some big number lastStatCallRemTime = -1000000; + phaseStartMs = timeElapsed.Time(); + //set to 0 even if totalDataToProcess is 0: due to a bug in wxGauge::SetValue, it doesn't change to determinate mode when setting the old value again - //so give updateProgress() a chance to set a different value + //so give updateGui() a chance to set a different value m_gauge1->SetValue(0); - updateProgress(false); + updateGui(false); } -void SyncStatus::SyncStatusImpl::reportCurrentBytes(Int64 currentData) +void SyncStatus::SyncStatusImpl::notifyProgressChange() //noexcept! { - //add sample for perf measurements + calc. of remaining time - graphDataBytes->addRecord(to<double>(currentData), timeElapsed.Time()); + if (syncStat_) + { + switch (syncStat_->currentPhase()) + { + case ProcessCallback::PHASE_NONE: + assert(false); + case ProcessCallback::PHASE_SCANNING: + break; + case ProcessCallback::PHASE_COMPARING_CONTENT: + case ProcessCallback::PHASE_SYNCHRONIZING: + { + const double currentData = to<double>(syncStat_->getDataCurrent(syncStat_->currentPhase())); + + //add sample for perf measurements + calc. of remaining time + graphDataBytes->addRecord(currentData, timeElapsed.Time()); + } + break; + } + } } @@ -1180,7 +1202,7 @@ void SyncStatus::SyncStatusImpl::setExternalStatus(const wxString& status, const } -void SyncStatus::SyncStatusImpl::updateProgress(bool allowYield) +void SyncStatus::SyncStatusImpl::updateGui(bool allowYield) { assert(syncStat_); if (!syncStat_) //no sync running!! @@ -1318,7 +1340,7 @@ void SyncStatus::SyncStatusImpl::updateProgress(bool allowYield) while (paused_) { wxMilliSleep(UI_UPDATE_INTERVAL); - updateUiNow(); //receive UI message that ends pause + updateUiNow(); //receive UI message that end pause } } /* @@ -1454,7 +1476,7 @@ void SyncStatus::SyncStatusImpl::closeWindowDirectly() //this should really be c //------- change class state ------- abortCb_ = nullptr; //avoid callback to (maybe) deleted parent process - syncStat_ = nullptr; //set *after* last call to "updateProgress" + syncStat_ = nullptr; //set *after* last call to "updateGui" //---------------------------------- Close(); @@ -1471,7 +1493,8 @@ void SyncStatus::SyncStatusImpl::processHasFinished(SyncResult resultId, const E paused_ = false; //you never know? //update numbers one last time (as if sync were still running) - updateProgress(false); + notifyProgressChange(); //make one last graph entry at the *current* time + updateGui(false); switch (syncStat_->currentPhase()) //no matter if paused or not { @@ -1491,9 +1514,15 @@ void SyncStatus::SyncStatusImpl::processHasFinished(SyncResult resultId, const E assert(dataCurrent <= dataTotal); //set overall speed (instead of current speed) - assert(perf); - if (perf) - m_staticTextSpeed->SetLabel(perf->getOverallBytesPerSecond()); //note: we can't simply divide "sync total bytes" by "timeElapsed" + auto getOverallBytesPerSecond = [&]() -> wxString + { + const long timeDelta = timeElapsed.Time() - phaseStartMs; //we need to consider "time within current phase" not total "timeElapsed"! + if (timeDelta != 0) + return filesizeToShortString(dataCurrent * 1000 / timeDelta) + _("/sec"); + return L"-"; //fallback + }; + + m_staticTextSpeed->SetLabel(getOverallBytesPerSecond()); //show new element "items processed" m_staticTextLabelItemsProc->Show(true); @@ -1514,7 +1543,7 @@ void SyncStatus::SyncStatusImpl::processHasFinished(SyncResult resultId, const E //------- change class state ------- abortCb_ = nullptr; //avoid callback to (maybe) deleted parent process - syncStat_ = nullptr; //set *after* last call to "updateProgress" + syncStat_ = nullptr; //set *after* last call to "updateGui" finalResult = resultId; //---------------------------------- @@ -1665,7 +1694,7 @@ void SyncStatus::SyncStatusImpl::minimizeToTray() } if (syncStat_) - updateProgress(false); //set tray tooltip + progress: e.g. no updates while paused + updateGui(false); //set tray tooltip + progress: e.g. no updates while paused Hide(); if (mainDialog) @@ -1693,7 +1722,7 @@ void SyncStatus::SyncStatusImpl::resumeFromSystray() updateDialogStatus(); //restore Windows 7 task bar status (e.g. required in pause mode) if (syncStat_) - updateProgress(false); //restore Windows 7 task bar progress (e.g. required in pause mode) + updateGui(false); //restore Windows 7 task bar progress (e.g. required in pause mode) } @@ -1713,7 +1742,7 @@ SyncStatus::SyncStatus(AbortCallback& abortCb, if (showProgress) { pimpl->Show(); - pimpl->updateProgress(false); //clear gui flicker, remove dummy texts: window must be visible to make this work! + pimpl->updateGui(false); //clear gui flicker, remove dummy texts: window must be visible to make this work! } else pimpl->minimizeToTray(); @@ -1734,14 +1763,14 @@ void SyncStatus::initNewPhase() pimpl->initNewPhase(); } -void SyncStatus::reportCurrentBytes(Int64 currentData) +void SyncStatus::notifyProgressChange() { - pimpl->reportCurrentBytes(currentData); + pimpl->notifyProgressChange(); } -void SyncStatus::updateProgress() +void SyncStatus::updateGui() { - pimpl->updateProgress(); + pimpl->updateGui(); } std::wstring SyncStatus::getExecWhenFinishedCommand() const diff --git a/ui/progress_indicator.h b/ui/progress_indicator.h index b3d7ff2f..e4995824 100644 --- a/ui/progress_indicator.h +++ b/ui/progress_indicator.h @@ -49,8 +49,8 @@ public: void initNewPhase(); //call after "StatusHandler::initNewPhase" - void reportCurrentBytes(zen::Int64 currentData); //throw (), required by graph! - void updateProgress(); + void notifyProgressChange(); //throw (), required by graph! + void updateGui(); std::wstring getExecWhenFinishedCommand() const; //final value (after possible user modification) diff --git a/ui/sync_cfg.cpp b/ui/sync_cfg.cpp index dc82ffbb..3894eb24 100644 --- a/ui/sync_cfg.cpp +++ b/ui/sync_cfg.cpp @@ -229,8 +229,8 @@ SyncCfgDialog::SyncCfgDialog(wxWindow* parent, m_bitmapDatabase ->SetBitmap(GlobalResources::getImage(L"database")); enumVersioningStyle. - add(VER_STYLE_REPLACE, _("Replace"), _("Move files and replace if existing")). - add(VER_STYLE_ADD_TIMESTAMP, _("Versioning"), _("Append a timestamp to each file name")); + add(VER_STYLE_ADD_TIMESTAMP, _("Versioning"), _("Append a timestamp to each file name")). + add(VER_STYLE_REPLACE, _("Replace"), _("Move files and replace if existing")); //hide controls for optional parameters if (!handleError && !execWhenFinished) //currently either both or neither are bound! diff --git a/ui/tree_view.cpp b/ui/tree_view.cpp index 5a63e579..3025dbac 100644 --- a/ui/tree_view.cpp +++ b/ui/tree_view.cpp @@ -395,6 +395,12 @@ TreeView::NodeStatus TreeView::getStatus(size_t row) const void TreeView::expandNode(size_t row) { + if (getStatus(row) != TreeView::STATUS_REDUCED) + { + assert(false); + return; + } + if (row < flatTree.size()) { std::vector<TreeLine> newLines; @@ -1005,6 +1011,7 @@ private: { case WXK_LEFT: case WXK_NUMPAD_LEFT: + case WXK_NUMPAD_SUBTRACT: //http://msdn.microsoft.com/en-us/library/ms971323.aspx#atg_keyboardshortcuts_windows_shortcut_keys if (treeDataView_) switch (treeDataView_->getStatus(row)) { @@ -1022,6 +1029,7 @@ private: case WXK_RIGHT: case WXK_NUMPAD_RIGHT: + case WXK_NUMPAD_ADD: if (treeDataView_) switch (treeDataView_->getStatus(row)) { diff --git a/ui/triple_splitter.cpp b/ui/triple_splitter.cpp index 8132fd13..f6ef006d 100644 --- a/ui/triple_splitter.cpp +++ b/ui/triple_splitter.cpp @@ -198,8 +198,12 @@ void TripleSplitter::onMouseMovement(wxMouseEvent& event) } else { - //we receive those only while above the sash, not the managed windows! - SetCursor(wxCURSOR_SIZEWE); //set window-local only! + //we receive those only while above the sash, not the managed windows (except when the managed windows are disabled!) + const int posX = event.GetPosition().x; + if (hitOnSashLine(posX)) + SetCursor(wxCURSOR_SIZEWE); //set window-local only! + else + SetCursor(*wxSTANDARD_CURSOR); } event.Skip(); } |