From e7ceb20f1d6497f28054dc111260be8ba8d8b5aa Mon Sep 17 00:00:00 2001 From: Daniel Wilhelm Date: Fri, 18 Apr 2014 16:48:05 +0200 Subject: 1.5 --- ui/MainDialog.cpp | 491 ++++++++++++++++++++++++++++++---------------------- ui/MainDialog.h | 27 ++- ui/Resources.cpp | 23 ++- ui/Resources.h | 10 ++ ui/SmallDialogs.cpp | 229 ++++++++++++++++++++---- ui/SmallDialogs.h | 69 ++++++-- ui/SyncDialog.cpp | 2 + ui/guiGenerated.cpp | 153 +++++++++++----- ui/guiGenerated.h | 32 ++-- 9 files changed, 719 insertions(+), 317 deletions(-) (limited to 'ui') diff --git a/ui/MainDialog.cpp b/ui/MainDialog.cpp index 1528f0c8..ec83f302 100644 --- a/ui/MainDialog.cpp +++ b/ui/MainDialog.cpp @@ -9,13 +9,10 @@ #include "mainDialog.h" #include -#include //for std::runtime_error #include "../library/globalFunctions.h" #include #include #include "../library/customGrid.h" -#include -#include using namespace globalFunctions; @@ -25,13 +22,14 @@ MainDialog::MainDialog(wxFrame* frame, const wxString& cfgFileName) : GuiGenerated(frame), parent(frame), stackObjects(0), - selectedRange3Begin(0), - selectedRange3End(0), - selectionLead(0), filteringInitialized(false), filteringPending(false), cmpStatusUpdaterTmp(0) { + m_bpButtonCompare->SetLabel(_("&Compare")); + m_bpButtonSync->SetLabel(_("&Synchronize")); + m_bpButtonFilter->SetLabel(_("&Filter")); + //initialize sync configuration readConfigurationFromHD(cfgFileName, true); @@ -57,6 +55,18 @@ MainDialog::MainDialog(wxFrame* frame, const wxString& cfgFileName) : m_panel1->SetDropTarget(new FileDropEvent(this, 1)); m_panel2->SetDropTarget(new FileDropEvent(this, 2)); + //create a right-click context menu + contextMenu = new wxMenu; + contextMenu->Append(contextManualFilter, _("Filter manually")); + contextMenu->Append(contextCopyClipboard, _("Copy to clipboard\tCTRL+C")); +#ifdef FFS_WIN + contextMenu->Append(contextOpenExplorer, _("Open with Explorer\tD-Click")); +#endif + contextMenu->AppendSeparator(); + contextMenu->Append(contextDeleteFiles, _("Delete files\tDEL")); + + contextMenu->Connect(wxEVT_COMMAND_MENU_SELECTED, wxCommandEventHandler(MainDialog::onContextMenuSelection), NULL, this); + //support for CTRL + C and DEL m_grid1->Connect(wxEVT_KEY_DOWN, wxKeyEventHandler(MainDialog::onGrid1ButtonEvent), NULL, this); m_grid2->Connect(wxEVT_KEY_DOWN, wxKeyEventHandler(MainDialog::onGrid2ButtonEvent), NULL, this); @@ -92,7 +102,7 @@ MainDialog::MainDialog(wxFrame* frame, const wxString& cfgFileName) : m_grid3->Connect(wxEVT_SCROLLWIN_LINEDOWN, wxEventHandler(MainDialog::onGrid3access), NULL, this); m_grid3->GetGridWindow()->Connect(wxEVT_LEFT_DOWN, wxEventHandler(MainDialog::onGrid3access), NULL, this); - m_grid3->GetGridWindow()->Connect(wxEVT_IDLE, wxEventHandler(MainDialog::OnIdleEvent), NULL, this); + Connect(wxEVT_IDLE, wxEventHandler(MainDialog::OnIdleEvent), NULL, this); m_grid3->GetGridWindow()->Connect(wxEVT_LEFT_UP, wxEventHandler(MainDialog::OnGrid3LeftMouseUp), NULL, this); m_grid3->GetGridWindow()->Connect(wxEVT_LEFT_DOWN, wxEventHandler(MainDialog::OnGrid3LeftMouseDown), NULL, this); @@ -149,6 +159,17 @@ MainDialog::MainDialog(wxFrame* frame, const wxString& cfgFileName) : addCfgFileToHistory(value); } m_choiceLoad->SetSelection(0); + + //select rows only + m_grid1->SetSelectionMode(wxGrid::wxGridSelectRows); + m_grid2->SetSelectionMode(wxGrid::wxGridSelectRows); + m_grid3->SetSelectionMode(wxGrid::wxGridSelectRows); + + //set color of selections + wxColour darkBlue(40, 35, 140); + m_grid1->SetSelectionBackground(darkBlue); + m_grid2->SetSelectionBackground(darkBlue); + m_grid3->SetSelectionBackground(darkBlue); } @@ -194,13 +215,17 @@ MainDialog::~MainDialog() m_grid3->Disconnect(wxEVT_SCROLLWIN_LINEDOWN, wxEventHandler(MainDialog::onGrid3access), NULL, this); m_grid3->GetGridWindow()->Disconnect(wxEVT_LEFT_DOWN, wxEventHandler(MainDialog::onGrid3access), NULL, this); - m_grid3->GetGridWindow()->Disconnect(wxEVT_IDLE, wxEventHandler(MainDialog::OnIdleEvent), NULL, this); + Disconnect(wxEVT_IDLE, wxEventHandler(MainDialog::OnIdleEvent), NULL, this); m_grid3->GetGridWindow()->Disconnect(wxEVT_LEFT_UP, wxEventHandler(MainDialog::OnGrid3LeftMouseUp), NULL, this); m_grid3->GetGridWindow()->Disconnect(wxEVT_LEFT_DOWN, wxEventHandler(MainDialog::OnGrid3LeftMouseDown), NULL, this); Disconnect(wxEVT_SIZE, wxEventHandler(MainDialog::onResizeMainWindow), NULL, this); Disconnect(wxEVT_MOVE, wxEventHandler(MainDialog::onResizeMainWindow), NULL, this); + contextMenu->Disconnect(wxEVT_COMMAND_MENU_SELECTED, wxCommandEventHandler(MainDialog::onContextMenuSelection), NULL, this); + + delete contextMenu; + //write list of last used configuration files int vectorSize = cfgFileNames.size(); for (int i = 0; i < CfgHistroyLength; ++i) @@ -259,7 +284,7 @@ void MainDialog::onGrid3access(wxEvent& event) } -void MainDialog::filterRangeManual(const set& rowsToFilterOnUI_View, int leadingRow) +void MainDialog::filterRangeManual(const set& rowsToFilterOnUI_View) { if (rowsToFilterOnUI_View.size() > 0) { @@ -267,7 +292,8 @@ void MainDialog::filterRangeManual(const set& rowsToFilterOnUI_View, int le bool newSelection = false; //default: deselect range - //leadingRow should be set in OnGridSelectCell() + //leadingRow determines de-/selection of all other rows + int leadingRow = *rowsToFilterOnUI_View.begin(); if (0 <= leadingRow && leadingRow < currentUI_Size) newSelection = !currentGridData[currentUI_View[leadingRow].linkToCurrentGridData].selectedForSynchronization; @@ -290,7 +316,6 @@ void MainDialog::filterRangeManual(const set& rowsToFilterOnUI_View, int le } } - //toggle selection of filtered rows for (set::iterator i = rowsToFilterOnGridData.begin(); i != rowsToFilterOnGridData.end(); ++i) currentGridData[*i].selectedForSynchronization = newSelection; @@ -309,7 +334,6 @@ void MainDialog::filterRangeManual(const set& rowsToFilterOnUI_View, int le filteredOutRowsOnUI.insert(i - currentUI_View.begin()); } - //signal UI that grids need to be refreshed on next Update() m_grid1->ForceRefresh(); m_grid2->ForceRefresh(); @@ -329,37 +353,33 @@ void MainDialog::filterRangeManual(const set& rowsToFilterOnUI_View, int le updateStatusInformation(currentUI_View); //status information has to be recalculated! } } - //clear selection on grid + //clear selection on grids + if (hideFiltered) + { + m_grid1->ClearSelection(); + m_grid2->ClearSelection(); + } //exception for grid 3 m_grid3->ClearSelection(); } /*grid event choreography: 1. UI-Mouse-Down => OnGridSelectCell -2. UI-Mouse-Up => OnGrid3SelectRange (if at least two rows are marked) +2. UI-Mouse-Up => SelectRangeEvent (if at least two rows are marked) -=> the decision if a range or a single cell is selected can be made only after Mouse-UP. But OnGrid3SelectRange unfortunately is not always +=> the decision if a range or a single cell is selected can be made only after Mouse-UP. But SelectRangeEvent unfortunately is not always executed (e.g. if single cell selected) => new choreography: - -1. UI-Mouse-Down => OnGridSelectCell -> set leading row +1. UI-Mouse-Down => OnGrid3LeftMouseDown (notify that filtering was initialized: this is needed since under some circumstances it might happen that the program + receives a mouse-up without a preceding mouse-down (double-clicks) 2. UI-Mouse-Up => OnGrid3LeftMouseUp (notify that filtering shall be started on next idle event -3. UI-Mouse-Up => OnGrid3SelectRange, possibly +3. UI-Mouse-Up => SelectRangeEvent, possibly 4. Idle event => OnIdleEvent - - It's !crazy! but it works! */ -void MainDialog::OnGridSelectCell(wxGridEvent& event) -{ - selectionLead = selectedRange3Begin = selectedRange3End = event.GetRow(); - event.Skip(); -} - void MainDialog::OnGrid3LeftMouseDown(wxEvent& event) { - filteringInitialized = true; event.Skip(); } @@ -372,17 +392,6 @@ void MainDialog::OnGrid3LeftMouseUp(wxEvent& event) } -void MainDialog::OnGrid3SelectRange(wxGridRangeSelectEvent& event) -{ - if (event.Selecting()) //this range event should only be processed on release left mouse button - { - selectedRange3Begin = event.GetTopRow(); - selectedRange3End = event.GetBottomRow(); - } - event.Skip(); -} - - void MainDialog::OnIdleEvent(wxEvent& event) { //process manually filtered rows @@ -394,11 +403,7 @@ void MainDialog::OnIdleEvent(wxEvent& event) { //a mouse up event, but no mouse down! (e.g. when window is maximized and cursor is on grid3) filteringInitialized = false; - set filteredRows; - for (int i = selectedRange3Begin; i <= selectedRange3End; ++i) - filteredRows.insert(i); - - filterRangeManual(filteredRows, selectionLead); + filterRangeManual(getSelectedRows()); } } @@ -421,90 +426,85 @@ void MainDialog::OnIdleEvent(wxEvent& event) } -void copySelectionToClipboard(wxGrid* grid) +void MainDialog::copySelectionToClipboard(const set& selectedRows, int selectedGrid) { - int rowTop, rowBottom, colLeft, colRight; //coords of selection - wxString clipboardString; + if (selectedRows.size() > 0) + { + wxGrid* grid = 0; + switch (selectedGrid) + { + case 1: + grid = m_grid1; + break; + case 2: + grid = m_grid2; + break; + case 3: + grid = m_grid3; + break; + default: + return; + } - wxArrayInt selectedRows, selectedColumns; - selectedRows = grid->GetSelectedRows(); - selectedColumns = grid->GetSelectedCols(); + wxString clipboardString; - if (!selectedRows.IsEmpty()) - { - for (unsigned int i = 0; i < selectedRows.GetCount(); ++i) + for (set::iterator i = selectedRows.begin(); i != selectedRows.end(); ++i) { for (int k = 0; k < grid->GetNumberCols(); ++k) { - clipboardString+= grid->GetCellValue(selectedRows[i], k); + clipboardString+= grid->GetCellValue(*i, k); if (k != grid->GetNumberCols() - 1) clipboardString+= '\t'; } clipboardString+= '\n'; } - } - else if (!selectedColumns.IsEmpty()) - { - for (int k = 0; k < grid->GetNumberRows(); ++k) - { - for (unsigned int i = 0; i < selectedColumns.GetCount(); ++i) - { - clipboardString+= grid->GetCellValue(k, selectedColumns[i]); - if (i != selectedColumns.GetCount() - 1) - clipboardString+= '\t'; - } - clipboardString+= '\n'; - } - } - else - { - wxGridCellCoordsArray tmpArray; - - tmpArray = grid->GetSelectionBlockTopLeft(); - if (!tmpArray.IsEmpty()) - { - wxGridCellCoords topLeft = tmpArray[0]; - - rowTop = topLeft.GetRow(); - colLeft = topLeft.GetCol(); - tmpArray = grid->GetSelectionBlockBottomRight(); - if (!tmpArray.IsEmpty()) + if (!clipboardString.IsEmpty()) + // Write text to the clipboard + if (wxTheClipboard->Open()) { - wxGridCellCoords bottomRight = tmpArray[0]; - - rowBottom = bottomRight.GetRow(); - colRight = bottomRight.GetCol(); - - //save selection in one big string - for (int j = rowTop; j <= rowBottom; ++j) - { - for (int i = colLeft; i <= colRight; ++i) - { - clipboardString+= grid->GetCellValue(j, i); - if (i != colRight) - clipboardString+= '\t'; - } - clipboardString+= '\n'; - } + // these data objects are held by the clipboard, + // so do not delete them in the app. + wxTheClipboard->SetData( new wxTextDataObject(clipboardString) ); + wxTheClipboard->Close(); } - } } +} + - if (!clipboardString.IsEmpty()) - // Write some text to the clipboard - if (wxTheClipboard->Open()) +void removeInvalidRows(set& rows, const int currentUI_Size) +{ + set validRows; //temporal table IS needed here + for (set::iterator i = rows.begin(); i != rows.end(); ++i) + if (0 <= *i) { - // This data objects are held by the clipboard, - // so do not delete them in the app. - wxTheClipboard->SetData( new wxTextDataObject(clipboardString) ); - wxTheClipboard->Close(); + if (*i >= currentUI_Size) //set is sorted, so no need to continue here + break; + validRows.insert(*i); } + rows = validRows; } -set getSelectedRows(wxGrid* grid) +set MainDialog::getSelectedRows() { + wxGrid* grid = 0; + + switch (leadingPanel) + { + case 1: + grid = m_grid1; + break; + case 2: + grid = m_grid2; + break; + case 3: + grid = m_grid3; + break; + default: + return set(); + } + set output; int rowTop, rowBottom; //coords of selection @@ -548,21 +548,9 @@ set getSelectedRows(wxGrid* grid) } } - return output; -} - + removeInvalidRows(output, currentUI_View.size()); -void removeInvalidRows(set& rows, const int currentUI_Size) -{ - set validRows; //temporal table IS needed here - for (set::iterator i = rows.begin(); i != rows.end(); ++i) - if (0 <= *i) - { - if (*i >= currentUI_Size) //set is sorted, so no need to continue here - break; - validRows.insert(*i); - } - rows = validRows; + return output; } @@ -608,7 +596,7 @@ public: void updateStatusText(const wxString& text) {} void initNewProcess(int objectsTotal, double dataTotal, int processID) {} void updateProcessedData(int objectsProcessed, double dataProcessed) {} - + void triggerUI_Refresh() {} private: bool suppressUI_Errormessages; @@ -616,16 +604,8 @@ private: }; -void MainDialog::deleteFilesOnGrid(wxGrid* grid) +void MainDialog::deleteFilesOnGrid(const set& rowsToDeleteOnUI) { - set rowsToDeleteOnUI = getSelectedRows(grid); - - if (0 <= selectionLead && unsigned(selectionLead) < currentUI_View.size()) - rowsToDeleteOnUI.insert(selectionLead); //add row of the currently selected cell - - removeInvalidRows(rowsToDeleteOnUI, currentUI_View.size()); - - if (rowsToDeleteOnUI.size()) { //map grid lines from UI to grid lines in backend @@ -680,7 +660,9 @@ void MainDialog::deleteFilesOnGrid(wxGrid* grid) //redraw grid neccessary to update new dimensions and for UI-Backend data linkage writeGrid(currentGridData); //do NOT use UI buffer here - grid->ClearSelection(); //clear selection on grid + m_grid1->ClearSelection(); //clear selection on grid + m_grid2->ClearSelection(); //clear selection on grid + m_grid3->ClearSelection(); //clear selection on grid } break; @@ -693,10 +675,43 @@ void MainDialog::deleteFilesOnGrid(wxGrid* grid) } +void MainDialog::openWithFileBrowser(int rowNumber, int gridNr) +{ +#ifdef FFS_WIN + if (gridNr == 1) + { + wxString command = "explorer " + FreeFileSync::getFormattedDirectoryName(m_directoryPanel1->GetValue()); //default + + if (0 <= rowNumber && rowNumber < int(currentUI_View.size())) + { + wxString filename = currentGridData[currentUI_View[rowNumber].linkToCurrentGridData].fileDescrLeft.filename; + + if (!filename.IsEmpty()) + command = "explorer /select," + filename; + } + wxExecute(command); + } + else if (gridNr == 2) + { + wxString command = "explorer " + FreeFileSync::getFormattedDirectoryName(m_directoryPanel2->GetValue()); //default + + if (0 <= rowNumber && rowNumber < int(currentUI_View.size())) + { + wxString filename = currentGridData[currentUI_View[rowNumber].linkToCurrentGridData].fileDescrRight.filename; + + if (!filename.IsEmpty()) + command = "explorer /select," + filename; + } + wxExecute(command); + } +#endif // FFS_WIN +} + + void MainDialog::pushStatusInformation(const wxString& text) { lastStatusChange = wxGetLocalTimeMillis(); - stackObjects++; + ++stackObjects; m_statusBar1->PushStatusText(text, 1); } @@ -712,8 +727,25 @@ void MainDialog::onResizeMainWindow(wxEvent& event) { if (!IsMaximized()) { - GetSize(&widthNotMaximized, &heightNotMaximized); - GetPosition(&posXNotMaximized, &posYNotMaximized); + int width = 0; + int height = 0; + int x = 0; + int y = 0; + + GetSize(&width, &height); + GetPosition(&x, &y); + + if (width > 0 && height > 0) + { + widthNotMaximized = width; + heightNotMaximized = height; + } + + if (x >= 0 && y >= 0) //might be < 0 under some strange circumstances + { + posXNotMaximized = x; + posYNotMaximized = y; + } } event.Skip(); } @@ -724,22 +756,24 @@ void MainDialog::onGrid1ButtonEvent(wxKeyEvent& event) //CTRL + C || CTRL + INS if (event.ControlDown() && event.GetKeyCode() == 67 || event.ControlDown() && event.GetKeyCode() == WXK_INSERT) - copySelectionToClipboard(m_grid1); + copySelectionToClipboard(getSelectedRows(), 1); else if (event.GetKeyCode() == WXK_DELETE) - deleteFilesOnGrid(m_grid1); + deleteFilesOnGrid(getSelectedRows()); event.Skip(); } + void MainDialog::onGrid2ButtonEvent(wxKeyEvent& event) { //CTRL + C || CTRL + INS if (event.ControlDown() && event.GetKeyCode() == 67 || event.ControlDown() && event.GetKeyCode() == WXK_INSERT) - copySelectionToClipboard(m_grid2); + copySelectionToClipboard(getSelectedRows(), 2); + else if (event.GetKeyCode() == WXK_DELETE) - deleteFilesOnGrid(m_grid2); + deleteFilesOnGrid(getSelectedRows()); event.Skip(); } @@ -750,9 +784,76 @@ void MainDialog::onGrid3ButtonEvent(wxKeyEvent& event) //CTRL + C || CTRL + INS if (event.ControlDown() && event.GetKeyCode() == 67 || event.ControlDown() && event.GetKeyCode() == WXK_INSERT) - copySelectionToClipboard(m_grid3); + copySelectionToClipboard(getSelectedRows(), 3); + else if (event.GetKeyCode() == WXK_DELETE) - deleteFilesOnGrid(m_grid3); + deleteFilesOnGrid(getSelectedRows()); + + event.Skip(); +} + + +void MainDialog::OnOpenContextMenu( wxGridEvent& event ) +{ + set selection = getSelectedRows(); + + //enable/disable context menu entries + if (selection.size() > 0) + { + contextMenu->Enable(contextManualFilter, true); + contextMenu->Enable(contextCopyClipboard, true); + contextMenu->Enable(contextDeleteFiles, true); + } + else + { + contextMenu->Enable(contextManualFilter, false); + contextMenu->Enable(contextCopyClipboard, false); + contextMenu->Enable(contextDeleteFiles, false); + } + +#ifdef FFS_WIN + if ((leadingPanel == 1 || leadingPanel == 2) && selection.size() <= 1) + contextMenu->Enable(contextOpenExplorer, true); + else + contextMenu->Enable(contextOpenExplorer, false); +#endif + + //show context menu + PopupMenu(contextMenu); + event.Skip(); +} + + +void MainDialog::onContextMenuSelection(wxCommandEvent& event) +{ + set selection; + + switch (event.GetId()) + { + case contextManualFilter: + filterRangeManual(getSelectedRows()); + break; + + case contextCopyClipboard: + copySelectionToClipboard(getSelectedRows(), leadingPanel); + break; + + case contextOpenExplorer: + selection = getSelectedRows(); + + if (leadingPanel == 1 || leadingPanel == 2) + { + if (selection.size() == 1) + openWithFileBrowser(*selection.begin(), leadingPanel); + else if (selection.size() == 0) + openWithFileBrowser(-1, leadingPanel); + } + break; + + case contextDeleteFiles: + deleteFilesOnGrid(getSelectedRows()); + break; + } event.Skip(); } @@ -953,7 +1054,7 @@ void MainDialog::OnSaveConfig(wxCommandEvent& event) clearStatusBar(); - wxFileDialog* filePicker = new wxFileDialog(this, "", "", defaultFileName, "*.*", wxFD_SAVE); + wxFileDialog* filePicker = new wxFileDialog(this, "", "", defaultFileName, wxString(_("FreeFileSync configuration")) + " (*.FFS)|*.FFS", wxFD_SAVE); if (filePicker->ShowModal() == wxID_OK) { @@ -988,7 +1089,7 @@ void MainDialog::OnLoadConfiguration(wxCommandEvent& event) switch (selectedItem) { case 0: //load config from file - wxFileDialog* filePicker = new wxFileDialog(this, "", "", "", "*.*", wxFD_OPEN); + wxFileDialog* filePicker = new wxFileDialog(this, "", "", "", wxString(_("FreeFileSync configuration")) + " (*.FFS)|*.FFS", wxFD_OPEN); if (filePicker->ShowModal() == wxID_OK) newCfgFile = filePicker->GetFilename(); @@ -1136,7 +1237,7 @@ void MainDialog::readConfigurationFromHD(const wxString& filename, bool programS case compareByTimeAndSize: m_radioBtnSizeDate->SetValue(true); break; - case compareByMD5: + case compareByContent: m_radioBtnContent->SetValue(true); break; default: @@ -1241,7 +1342,7 @@ void MainDialog::writeConfigurationToHD(const wxString& filename) if (m_radioBtnSizeDate->GetValue()) config<GetValue()) - config<ShowModal() == FilterDlg::okayButtonPressed) { wxString afterImage = includeFilter + wxChar(0) + excludeFilter; @@ -1463,7 +1564,7 @@ void MainDialog::OnCompare(wxCommandEvent &event) if (m_radioBtnSizeDate->GetValue()) cmpVar = compareByTimeAndSize; else if (m_radioBtnContent->GetValue()) - cmpVar = compareByMD5; + cmpVar = compareByContent; else assert (false); try @@ -1639,34 +1740,20 @@ void MainDialog::OnSync( wxCommandEvent& event ) void MainDialog::OnLeftGridDoubleClick(wxGridEvent& event) -{ //default - wxString command = "explorer " + FreeFileSync::getFormattedDirectoryName(m_directoryPanel1->GetValue()); - - if (event.GetRow() < int(currentUI_View.size())) - { - wxString filename = currentGridData[currentUI_View[event.GetRow()].linkToCurrentGridData].fileDescrLeft.filename; - - if (!filename.IsEmpty()) - command = "explorer /select," + filename; - } - wxExecute(command); +{ + openWithFileBrowser(event.GetRow(), 1); + event.Skip(); } -void MainDialog::OnRightGridDoubleClick(wxGridEvent& event) -{ //default - wxString command = "explorer " + FreeFileSync::getFormattedDirectoryName(m_directoryPanel2->GetValue()); - if (event.GetRow() < int(currentUI_View.size())) - { - wxString filename = currentGridData[currentUI_View[event.GetRow()].linkToCurrentGridData].fileDescrRight.filename; - - if (!filename.IsEmpty()) - command = "explorer /select," + filename; - } - wxExecute(command); +void MainDialog::OnRightGridDoubleClick(wxGridEvent& event) +{ + openWithFileBrowser(event.GetRow(), 2); + event.Skip(); } -//these two global variables are ONLY used for the sorting in the following methods + +//these three global variables are ONLY used for the sorting in the following methods unsigned int currentSortColumn = 0; bool sortAscending = true; FileCompareResult* currentGridDataPtr = 0; @@ -1872,31 +1959,24 @@ void MainDialog::updateStatusInformation(const UI_Grid& visibleGrid) unsigned int objectsOnLeftView = 0; unsigned int objectsOnRightView = 0; - mpz_t filesizeLeftView, filesizeRightView, tmpInt; - mpz_init(filesizeLeftView); - mpz_init(filesizeRightView); - mpz_init(tmpInt); + wxULongLong filesizeLeftView; + wxULongLong filesizeRightView; - for (UI_Grid::const_iterator i = visibleGrid.begin(); i != visibleGrid.end(); i++) + for (UI_Grid::const_iterator i = visibleGrid.begin(); i != visibleGrid.end(); ++i) { const FileCompareLine& refLine = currentGridData[i->linkToCurrentGridData]; //calculate total number of bytes for each sied if (refLine.fileDescrLeft.objType != isNothing) { - FreeFileSync::wxULongLongToMpz(tmpInt, refLine.fileDescrLeft.fileSize); - mpz_add(filesizeLeftView, filesizeLeftView, tmpInt); - - objectsOnLeftView++; + filesizeLeftView+= refLine.fileDescrLeft.fileSize; + ++objectsOnLeftView; } if (refLine.fileDescrRight.objType != isNothing) { - - FreeFileSync::wxULongLongToMpz(tmpInt, refLine.fileDescrRight.fileSize); - mpz_add(filesizeRightView, filesizeRightView, tmpInt); - - objectsOnRightView++; + filesizeRightView+= refLine.fileDescrRight.fileSize; + ++objectsOnRightView; } } @@ -1904,10 +1984,9 @@ void MainDialog::updateStatusInformation(const UI_Grid& visibleGrid) wxString objectsViewLeft = numberToWxString(objectsOnLeftView); globalFunctions::includeNumberSeparator(objectsViewLeft); if (objectsOnLeftView == 1) - m_statusBar1->SetStatusText(wxString(_("1 item on left, ")) + FreeFileSync::formatFilesizeToShortString(mpz_class(filesizeLeftView)), 0); + m_statusBar1->SetStatusText(wxString(_("1 item on left, ")) + FreeFileSync::formatFilesizeToShortString(filesizeLeftView), 0); else - m_statusBar1->SetStatusText(objectsViewLeft + _(" items on left, ") + FreeFileSync::formatFilesizeToShortString(mpz_class(filesizeLeftView)), 0); - + m_statusBar1->SetStatusText(objectsViewLeft + _(" items on left, ") + FreeFileSync::formatFilesizeToShortString(filesizeLeftView), 0); wxString objectsTotal = numberToWxString(currentGridData.size()); globalFunctions::includeNumberSeparator(objectsTotal); @@ -1922,14 +2001,9 @@ void MainDialog::updateStatusInformation(const UI_Grid& visibleGrid) wxString objectsViewRight = numberToWxString(objectsOnRightView); globalFunctions::includeNumberSeparator(objectsViewRight); if (objectsOnRightView == 1) - m_statusBar1->SetStatusText(wxString(_("1 item on right, ")) + FreeFileSync::formatFilesizeToShortString(mpz_class(filesizeRightView)), 2); + m_statusBar1->SetStatusText(wxString(_("1 item on right, ")) + FreeFileSync::formatFilesizeToShortString(filesizeRightView), 2); else - m_statusBar1->SetStatusText(objectsViewRight + _(" items on right, ") + FreeFileSync::formatFilesizeToShortString(mpz_class(filesizeRightView)), 2); - - //----------------------------------------------------- - mpz_clear(filesizeLeftView); - mpz_clear(filesizeRightView); - mpz_clear(tmpInt); + m_statusBar1->SetStatusText(objectsViewRight + _(" items on right, ") + FreeFileSync::formatFilesizeToShortString(filesizeRightView), 2); } @@ -1940,7 +2014,7 @@ void MainDialog::mapFileModelToUI(UI_Grid& output, const FileCompareResult& file UI_GridLine gridline; unsigned int currentRow = 0; wxString fileSize; //tmp string - for (FileCompareResult::const_iterator i = fileCmpResult.begin(); i != fileCmpResult.end(); i++, currentRow++) + for (FileCompareResult::const_iterator i = fileCmpResult.begin(); i != fileCmpResult.end(); ++i, ++currentRow) { //process UI filter settings switch (i->cmpResult) @@ -2072,6 +2146,7 @@ CompareStatusUpdater::CompareStatusUpdater(MainDialog* dlg) : mainDialog->m_bpButton201->Disable(); mainDialog->m_choiceLoad->Disable(); mainDialog->m_bpButton10->Disable(); + mainDialog->m_bpButton14->Disable(); //show abort button mainDialog->m_buttonAbort->Show(); @@ -2110,6 +2185,7 @@ CompareStatusUpdater::~CompareStatusUpdater() mainDialog->m_bpButton201->Enable(); mainDialog->m_choiceLoad->Enable(); mainDialog->m_bpButton10->Enable(); + mainDialog->m_bpButton14->Enable(); if (abortionRequested) mainDialog->pushStatusInformation(_("Operation aborted!")); @@ -2138,8 +2214,8 @@ void CompareStatusUpdater::initNewProcess(int objectsTotal, double dataTotal, in if (currentProcess == FreeFileSync::scanningFilesProcess) ; - else if (currentProcess == FreeFileSync::calcMD5Process) - statusPanel->resetMD5Gauge(objectsTotal, dataTotal); + else if (currentProcess == FreeFileSync::compareFileContentProcess) + statusPanel->resetCmpGauge(objectsTotal, dataTotal); else assert(false); } @@ -2149,8 +2225,8 @@ void CompareStatusUpdater::updateProcessedData(int objectsProcessed, double data { if (currentProcess == FreeFileSync::scanningFilesProcess) statusPanel->incScannedFiles_NoUpdate(objectsProcessed); - else if (currentProcess == FreeFileSync::calcMD5Process) - statusPanel->incProcessedMD5Data_NoUpdate(objectsProcessed, dataProcessed); + else if (currentProcess == FreeFileSync::compareFileContentProcess) + statusPanel->incProcessedCmpData_NoUpdate(objectsProcessed, dataProcessed); else assert(false); } @@ -2160,6 +2236,8 @@ int CompareStatusUpdater::reportError(const wxString& text) if (suppressUI_Errormessages) return StatusUpdater::continueNext; + statusPanel->updateStatusPanelNow(); + wxString errorMessage = text + _("\n\nContinue with next object, retry or abort comparison?"); ErrorDlg* errorDlg = new ErrorDlg(errorMessage, suppressUI_Errormessages); @@ -2208,11 +2286,6 @@ SyncStatusUpdater::SyncStatusUpdater(wxWindow* dlg, bool hideErrorMessages) : SyncStatusUpdater::~SyncStatusUpdater() { - if (abortionRequested) - syncStatusFrame->processHasFinished(_("Aborted!")); //enable okay and close events - else - syncStatusFrame->processHasFinished(_("Completed")); - //print the results list unsigned int failedItems = unhandledErrors.GetCount(); wxString result; @@ -2230,7 +2303,14 @@ SyncStatusUpdater::~SyncStatusUpdater() result+= _("Synchronization aborted: You may try to synchronize remaining items again (WITHOUT having to re-compare)!"); syncStatusFrame->setStatusText_NoUpdate(result); - syncStatusFrame->updateStatusDialogNow(); + + //notify to syncStatusFrame that current process has ended + if (abortionRequested) + syncStatusFrame->processHasFinished(statusAborted); //enable okay and close events + else if (failedItems) + syncStatusFrame->processHasFinished(statusCompletedWithErrors); + else + syncStatusFrame->processHasFinished(statusCompletedWithSuccess); } @@ -2246,6 +2326,7 @@ void SyncStatusUpdater::initNewProcess(int objectsTotal, double dataTotal, int p assert (processID == FreeFileSync::synchronizeFilesProcess); syncStatusFrame->resetGauge(objectsTotal, dataTotal); + syncStatusFrame->setCurrentStatus(statusSynchronizing); } @@ -2264,6 +2345,8 @@ int SyncStatusUpdater::reportError(const wxString& text) return StatusUpdater::continueNext; } + syncStatusFrame->updateStatusDialogNow(); + wxString errorMessage = text + _("\n\nContinue with next object, retry or abort synchronization?"); ErrorDlg* errorDlg = new ErrorDlg(errorMessage, suppressUI_Errormessages); @@ -2301,5 +2384,3 @@ void SyncStatusUpdater::triggerUI_Refresh() syncStatusFrame->updateStatusDialogNow(); } - - diff --git a/ui/MainDialog.h b/ui/MainDialog.h index 1f014502..3ac612fc 100644 --- a/ui/MainDialog.h +++ b/ui/MainDialog.h @@ -45,6 +45,15 @@ typedef vector UI_Grid; bool updateUI_IsAllowed(); //test if a specific amount of time is over void updateUI_Now(); //do the updating +//IDs for context menu items +enum ContextItem +{ + contextManualFilter = 10, + contextCopyClipboard, + contextOpenExplorer, + contextDeleteFiles +}; + extern int leadingPanel; class CompareStatusUpdater; @@ -79,9 +88,12 @@ private: void mapFileModelToUI(UI_Grid& output, const FileCompareResult& fileCmpResult); void updateStatusInformation(const UI_Grid& output); - void filterRangeManual(const set& rowsToFilterOnUI_View, int leadingRow); - - void deleteFilesOnGrid(wxGrid* grid); + //context menu functions + set getSelectedRows(); + void filterRangeManual(const set& rowsToFilterOnUI_View); + void copySelectionToClipboard(const set& selectedRows, int selectedGrid); + void openWithFileBrowser(int rowNumber, int gridNr); + void deleteFilesOnGrid(const set& rowsToDeleteOnUI); //work to be done in idle time void OnIdleEvent(wxEvent& event); @@ -99,6 +111,7 @@ private: void onGrid1ButtonEvent(wxKeyEvent& event); void onGrid2ButtonEvent(wxKeyEvent& event); void onGrid3ButtonEvent(wxKeyEvent& event); + void OnOpenContextMenu(wxGridEvent& event); void OnEnterLeftDir(wxCommandEvent& event); void OnEnterRightDir(wxCommandEvent& event); @@ -107,10 +120,11 @@ private: //manual filtering of rows: void OnGridSelectCell(wxGridEvent& event); - void OnGrid3SelectRange(wxGridRangeSelectEvent& event); void OnGrid3LeftMouseUp(wxEvent& event); void OnGrid3LeftMouseDown(wxEvent& event); + void onContextMenuSelection(wxCommandEvent& event); + void OnLeftGridDoubleClick( wxGridEvent& event); void OnRightGridDoubleClick(wxGridEvent& event); void OnSortLeftGrid( wxGridEvent& event); @@ -181,6 +195,8 @@ private: wxFrame* parent; + wxMenu* contextMenu; + //status information wxLongLong lastStatusChange; int stackObjects; @@ -191,9 +207,6 @@ private: static const int CfgHistroyLength = 10; //variables for manual filtering of m_grid3 - int selectedRange3Begin; //only used for grid 3 - int selectedRange3End; //only used for grid 3 - int selectionLead; //used on all three grids bool filteringInitialized; bool filteringPending; diff --git a/ui/Resources.cpp b/ui/Resources.cpp index 3bbd1523..207ff7c1 100644 --- a/ui/Resources.cpp +++ b/ui/Resources.cpp @@ -53,6 +53,16 @@ wxBitmap* GlobalResources::bitmapSmallDown = 0; wxBitmap* GlobalResources::bitmapSave = 0; wxBitmap* GlobalResources::bitmapFFS = 0; wxBitmap* GlobalResources::bitmapDeleteFile = 0; +wxBitmap* GlobalResources::bitmapGPL = 0; +wxBitmap* GlobalResources::bitmapStatusPause = 0; +wxBitmap* GlobalResources::bitmapStatusError = 0; +wxBitmap* GlobalResources::bitmapStatusSuccess = 0; +wxBitmap* GlobalResources::bitmapStatusWarning = 0; +wxBitmap* GlobalResources::bitmapStatusScanning = 0; +wxBitmap* GlobalResources::bitmapStatusComparing = 0; +wxBitmap* GlobalResources::bitmapStatusSyncing = 0; +wxBitmap* GlobalResources::bitmapLogo = 0; +wxBitmap* GlobalResources::bitmapFinished = 0; wxAnimation* GlobalResources::animationMoney = 0; wxAnimation* GlobalResources::animationSync = 0; @@ -60,7 +70,6 @@ wxAnimation* GlobalResources::animationSync = 0; void GlobalResources::loadResourceFiles() { - floatingPointSeparator = _("."); numberSeparator = _(","); @@ -95,12 +104,22 @@ void GlobalResources::loadResourceFiles() bitmapResource["exclude.png"] = (bitmapExclude = new wxBitmap(wxNullBitmap)); bitmapResource["filter active.png"] = (bitmapFilterOn = new wxBitmap(wxNullBitmap)); bitmapResource["filter not active.png"] = (bitmapFilterOff = new wxBitmap(wxNullBitmap)); - bitmapResource["Warning.png"] = (bitmapWarning = new wxBitmap(wxNullBitmap)); + bitmapResource["warning.png"] = (bitmapWarning = new wxBitmap(wxNullBitmap)); bitmapResource["small arrow up.png"] = (bitmapSmallUp = new wxBitmap(wxNullBitmap)); bitmapResource["small arrow down.png"] = (bitmapSmallDown = new wxBitmap(wxNullBitmap)); bitmapResource["save.png"] = (bitmapSave = new wxBitmap(wxNullBitmap)); bitmapResource["FFS.png"] = (bitmapFFS = new wxBitmap(wxNullBitmap)); bitmapResource["deleteFile.png"] = (bitmapDeleteFile = new wxBitmap(wxNullBitmap)); + bitmapResource["gpl.png"] = (bitmapGPL = new wxBitmap(wxNullBitmap)); + bitmapResource["statusPause.png"] = (bitmapStatusPause = new wxBitmap(wxNullBitmap)); + bitmapResource["statusError.png"] = (bitmapStatusError = new wxBitmap(wxNullBitmap)); + bitmapResource["statusSuccess.png"] = (bitmapStatusSuccess = new wxBitmap(wxNullBitmap)); + bitmapResource["statusWarning.png"] = (bitmapStatusWarning = new wxBitmap(wxNullBitmap)); + bitmapResource["statusScanning.png"] = (bitmapStatusScanning = new wxBitmap(wxNullBitmap)); + bitmapResource["statusComparing.png"] = (bitmapStatusComparing = new wxBitmap(wxNullBitmap)); + bitmapResource["statusSyncing.png"] = (bitmapStatusSyncing = new wxBitmap(wxNullBitmap)); + bitmapResource["logo.png"] = (bitmapLogo = new wxBitmap(wxNullBitmap)); + bitmapResource["finished.png"] = (bitmapFinished = new wxBitmap(wxNullBitmap)); animationMoney = new wxAnimation(wxNullAnimation); animationSync = new wxAnimation(wxNullAnimation); diff --git a/ui/Resources.h b/ui/Resources.h index e2ae1303..bfd2a8bc 100644 --- a/ui/Resources.h +++ b/ui/Resources.h @@ -55,6 +55,16 @@ public: static wxBitmap* bitmapSave; static wxBitmap* bitmapFFS; static wxBitmap* bitmapDeleteFile; + static wxBitmap* bitmapGPL; + static wxBitmap* bitmapStatusPause; + static wxBitmap* bitmapStatusError; + static wxBitmap* bitmapStatusSuccess; + static wxBitmap* bitmapStatusWarning; + static wxBitmap* bitmapStatusScanning; + static wxBitmap* bitmapStatusComparing; + static wxBitmap* bitmapStatusSyncing; + static wxBitmap* bitmapLogo; + static wxBitmap* bitmapFinished; static wxAnimation* animationMoney; static wxAnimation* animationSync; diff --git a/ui/SmallDialogs.cpp b/ui/SmallDialogs.cpp index 77fc8a59..4e1cc148 100644 --- a/ui/SmallDialogs.cpp +++ b/ui/SmallDialogs.cpp @@ -1,13 +1,15 @@ #include "smallDialogs.h" #include "../library/globalFunctions.h" +#include using namespace globalFunctions; -AboutDlg::AboutDlg(MainDialog* window) : AboutDlgGenerated(window) +AboutDlg::AboutDlg(wxWindow* window) : AboutDlgGenerated(window) { m_bitmap9->SetBitmap(*GlobalResources::bitmapWebsite); m_bitmap10->SetBitmap(*GlobalResources::bitmapEmail); - m_bitmap11->SetBitmap(*GlobalResources::bitmapFFS); + m_bitmap11->SetBitmap(*GlobalResources::bitmapLogo); + m_bitmap13->SetBitmap(*GlobalResources::bitmapGPL); m_animationControl1->SetAnimation(*GlobalResources::animationMoney); m_animationControl1->Play(); @@ -33,7 +35,7 @@ void AboutDlg::OnOK(wxCommandEvent& event) //######################################################################################## -HelpDlg::HelpDlg(MainDialog* window) : HelpDlgGenerated(window) +HelpDlg::HelpDlg(wxWindow* window) : HelpDlgGenerated(window) { m_button8->SetFocus(); } @@ -54,16 +56,17 @@ void HelpDlg::OnOK(wxCommandEvent& event) //######################################################################################## -FilterDlg::FilterDlg(MainDialog* window) : +FilterDlg::FilterDlg(wxWindow* window, wxString& filterIncl, wxString& filterExcl) : FilterDlgGenerated(window), - mainDialog(window) + includeFilter(filterIncl), + excludeFilter(filterExcl) { m_bitmap8->SetBitmap(*GlobalResources::bitmapInclude); m_bitmap9->SetBitmap(*GlobalResources::bitmapExclude); - m_textCtrlInclude->SetValue(mainDialog->includeFilter); - m_textCtrlExclude->SetValue(mainDialog->excludeFilter); + m_textCtrlInclude->SetValue(includeFilter); + m_textCtrlExclude->SetValue(excludeFilter); } FilterDlg::~FilterDlg() {} @@ -78,8 +81,8 @@ void FilterDlg::OnClose(wxCloseEvent& event) void FilterDlg::OnOK(wxCommandEvent& event) { //only if user presses ApplyFilter, he wants the changes to be committed - mainDialog->includeFilter = m_textCtrlInclude->GetValue(); - mainDialog->excludeFilter = m_textCtrlExclude->GetValue(); + includeFilter = m_textCtrlInclude->GetValue(); + excludeFilter = m_textCtrlExclude->GetValue(); //when leaving dialog: filter and redraw grid, if filter is active EndModal(okayButtonPressed); @@ -173,6 +176,98 @@ void ErrorDlg::OnAbort(wxCommandEvent& event) } //######################################################################################## +/* +class for calculation of remaining time: +---------------------------------------- +"filesize |-> time" is an affine linear function f(x) = z_1 + z_2 x + +For given n measurements, sizes x_0, ..., x_n and times f_0, ..., f_n, the function f (as a polynom of degree 1) can be lineary approximated by + +z_1 = (r - s * q / p) / ((n + 1) - s * s / p) +z_2 = (q - s * z_1) / p = (r - (n + 1) z_1) / s + +with +p := x_0^2 + ... + x_n^2 +q := f_0 x_0 + ... + f_n x_n +r := f_0 + ... + f_n +s := x_0 + ... + x_n + +=> the time to process N files with amount of data D is: N * z_1 + D * z_2 + +Problem: +-------- +Times f_0, ..., f_n can be very small so that precision of the PC clock is poor. +=> Times have to be accumulated to enhance precision: +Copying of m files with sizes x_i and times f_i (i = 1, ..., m) takes sum_i f(x_i) := m * z_1 + z_2 * sum x_i = sum f_i +With X defined as the accumulated sizes and F the accumulated times this gives: (in theory...) +m * z_1 + z_2 * X = F <=> +z_1 + z_2 * X / m = F / m + +=> we optain a new (artificial) measurement with size X / m and time F / m to be used in the linear approximation above + + +RemainingTime::RemainingTime() : n(0), m(0), X(0), F(0), p(0), q(0), r(0), s(0), z_1(0), z_2(0), lastExec(0) {} + +RemainingTime::~RemainingTime() +{ + ofstream output("test.txt"); + for (unsigned i = 0; i < x.size(); ++i) + { + output< 1000) //add new measurement only if F is accumulated to a certain degree + { + lastExec = newExec; + ++n; + + double x_i = X / m; + double f_i = F / m; + X = 0; + F = 0; + m = 0; + + x.push_back(x_i); + f.push_back(f_i); + + p+= x_i * x_i; + q+= f_i * x_i; + r+= f_i; + s+= x_i; + + if (p != 0) + { + double tmp = (n - s * s / p); + if (tmp != 0 && s != 0) + { //recalculate coefficients for affine-linear function + z_1 = (r - s * q / p) / tmp; + z_2 = (r - n * z_1) / s; //not (n + 1) here, since n already is the number of measurements + } + } + } + + return int(remainingFiles * z_1 + remainingData * z_2); + } + //else + lastExec = newExec; + return 0; +}*/ + +//######################################################################################## SyncStatus::SyncStatus(StatusUpdater* updater, wxWindow* parentWindow) : SyncStatusGenerated(parentWindow), @@ -186,6 +281,7 @@ SyncStatus::SyncStatus(StatusUpdater* updater, wxWindow* parentWindow) : totalObjects(0) { m_animationControl1->SetAnimation(*GlobalResources::animationSync); + m_animationControl1->SetInactiveBitmap(*GlobalResources::bitmapFinished); m_animationControl1->Play(); //initialize gauge @@ -205,6 +301,7 @@ SyncStatus::~SyncStatus() { windowToDis->Enable(); windowToDis->Raise(); + windowToDis->SetFocus(); } } @@ -248,8 +345,9 @@ void SyncStatus::updateStatusDialogNow() //remaining objects m_staticTextRemainingObj->SetLabel(numberToWxString(totalObjects - currentObjects)); + //remaining bytes left for copy - const wxString remainingBytes = FreeFileSync::formatFilesizeToShortString(mpz_class(totalData - currentData)); + const wxString remainingBytes = FreeFileSync::formatFilesizeToShortString(totalData - currentData); m_staticTextDataRemaining->SetLabel(remainingBytes); //do the ui update @@ -257,11 +355,54 @@ void SyncStatus::updateStatusDialogNow() } -void SyncStatus::processHasFinished(const wxString& finalStatusText) //essential to call this in StatusUpdater derived class destructor -{ //at the LATEST(!) to prevent access to currentStatusUpdater +void SyncStatus::setCurrentStatus(SyncStatusID id) +{ + switch (id) + { + case statusAborted: + m_bitmapStatus->SetBitmap(*GlobalResources::bitmapStatusError); + m_staticTextStatus->SetLabel(_("Aborted")); + break; + + case statusCompletedWithSuccess: + m_bitmapStatus->SetBitmap(*GlobalResources::bitmapStatusSuccess); + m_staticTextStatus->SetLabel(_("Completed")); + break; + + case statusCompletedWithErrors: + m_bitmapStatus->SetBitmap(*GlobalResources::bitmapStatusWarning); + m_staticTextStatus->SetLabel(_("Completed")); + break; + + case statusPause: + m_bitmapStatus->SetBitmap(*GlobalResources::bitmapStatusPause); + m_staticTextStatus->SetLabel(_("Pause")); + break; + + case statusScanning: + m_bitmapStatus->SetBitmap(*GlobalResources::bitmapStatusComparing); + m_staticTextStatus->SetLabel(_("Scanning...")); + break; + + case statusComparing: + m_bitmapStatus->SetBitmap(*GlobalResources::bitmapStatusComparing); + m_staticTextStatus->SetLabel(_("Comparing...")); + break; + + case statusSynchronizing: + m_bitmapStatus->SetBitmap(*GlobalResources::bitmapStatusSyncing); + m_staticTextStatus->SetLabel(_("Synchronizing...")); + break; + } +} + + +void SyncStatus::processHasFinished(SyncStatusID id) //essential to call this in StatusUpdater derived class destructor +{ //at the LATEST(!) to prevent access to currentStatusUpdater currentProcessIsRunning = false; //enable okay and close events - m_staticTextStatus->SetLabel(finalStatusText); + setCurrentStatus(id); + m_buttonAbort->Hide(); m_buttonOK->Show(); m_buttonOK->SetFocus(); @@ -297,13 +438,15 @@ void SyncStatus::OnClose(wxCloseEvent& event) CompareStatus::CompareStatus(wxWindow* parentWindow) : CompareStatusGenerated(parentWindow), scannedFiles(0), - totalMD5Data(0), - currentMD5Data(0), - scalingFactorMD5(0), - currentMD5Objects(0), - totalMD5Objects(0) -{ - //initialize gauge + totalCmpData(0), + processedCmpData(0), + scalingFactorCmp(0), + processedCmpObjects(0), + totalCmpObjects(0) + /*timeRemaining(0), + timeRemainingTimeStamp(0)*/ + +{ //initialize gauge m_gauge2->SetRange(50000); m_gauge2->SetValue(0); } @@ -312,18 +455,18 @@ CompareStatus::CompareStatus(wxWindow* parentWindow) : CompareStatus::~CompareStatus() {} -void CompareStatus::resetMD5Gauge(int totalMD5ObjectsToProcess, double totalMD5DataToProcess) +void CompareStatus::resetCmpGauge(int totalCmpObjectsToProcess, double totalCmpDataToProcess) { - currentMD5Data = 0; - totalMD5Data = totalMD5DataToProcess; + processedCmpData = 0; + totalCmpData = totalCmpDataToProcess; - currentMD5Objects = 0; - totalMD5Objects = totalMD5ObjectsToProcess; + processedCmpObjects = 0; + totalCmpObjects = totalCmpObjectsToProcess; - if (totalMD5Data != 0) - scalingFactorMD5 = 50000 / totalMD5Data; //let's normalize to 50000 + if (totalCmpData != 0) + scalingFactorCmp = 50000 / totalCmpData; //let's normalize to 50000 else - scalingFactorMD5 = 0; + scalingFactorCmp = 0; } @@ -333,10 +476,13 @@ void CompareStatus::incScannedFiles_NoUpdate(int number) } -void CompareStatus::incProcessedMD5Data_NoUpdate(int objectsProcessed, double dataProcessed) +void CompareStatus::incProcessedCmpData_NoUpdate(int objectsProcessed, double dataProcessed) { - currentMD5Data+= dataProcessed; - currentMD5Objects+= objectsProcessed; + processedCmpData+= dataProcessed; + processedCmpObjects+= objectsProcessed; + +/* timeRemaining = calcTimeLeft.getRemainingTime(dataProcessed, totalCmpObjects - processedCmpObjects, totalCmpData - processedCmpData); + timeRemainingTimeStamp = wxGetLocalTimeMillis();*/ } @@ -353,16 +499,23 @@ void CompareStatus::updateStatusPanelNow() m_staticTextScanned->SetLabel(numberToWxString(scannedFiles)); - //progress indicator for MD5 - m_gauge2->SetValue(int(currentMD5Data * scalingFactorMD5)); + //progress indicator for "compare file content" + m_gauge2->SetValue(int(processedCmpData * scalingFactorCmp)); - //remaining MD5 objects - m_staticTextFilesToCompare->SetLabel(numberToWxString(totalMD5Objects - currentMD5Objects)); + //remaining file to compare + m_staticTextFilesToCompare->SetLabel(numberToWxString(totalCmpObjects - processedCmpObjects)); - //remaining bytes left for MD5 calculation - const wxString remainingBytes = FreeFileSync::formatFilesizeToShortString(mpz_class(totalMD5Data - currentMD5Data)); + //remaining bytes left for file comparison + const wxString remainingBytes = FreeFileSync::formatFilesizeToShortString(totalCmpData - processedCmpData); m_staticTextDataToCompare->SetLabel(remainingBytes); - +/* + //remaining time in seconds + if (timeRemaining != 0) + { + int time = ((timeRemaining - (wxGetLocalTimeMillis() - timeRemainingTimeStamp)) / 1000).GetLo(); + m_staticTextRemainingTime->SetLabel(numberToWxString(time) + " s"); + } +*/ //do the ui update updateUI_Now(); } diff --git a/ui/SmallDialogs.h b/ui/SmallDialogs.h index 9ae3ae88..0eb22395 100644 --- a/ui/SmallDialogs.h +++ b/ui/SmallDialogs.h @@ -8,7 +8,7 @@ class MainDialog; class AboutDlg : public AboutDlgGenerated { public: - AboutDlg(MainDialog* window); + AboutDlg(wxWindow* window); ~AboutDlg(); private: @@ -20,7 +20,7 @@ private: class HelpDlg : public HelpDlgGenerated { public: - HelpDlg(MainDialog* window); + HelpDlg(wxWindow* window); ~HelpDlg(); private: @@ -32,7 +32,7 @@ private: class FilterDlg : public FilterDlgGenerated { public: - FilterDlg(MainDialog* window); + FilterDlg(wxWindow* window, wxString& filterIncl, wxString& filterExcl); ~FilterDlg(); static const int okayButtonPressed = 25; @@ -43,7 +43,8 @@ private: void OnCancel(wxCommandEvent& event); void OnClose(wxCloseEvent& event); - MainDialog* mainDialog; + wxString& includeFilter; + wxString& excludeFilter; }; @@ -83,6 +84,18 @@ private: }; +enum SyncStatusID +{ + statusAborted, + statusCompletedWithSuccess, + statusCompletedWithErrors, + statusPause, + statusScanning, + statusComparing, + statusSynchronizing +}; + + class SyncStatus : public SyncStatusGenerated { public: @@ -94,7 +107,8 @@ public: void setStatusText_NoUpdate(const wxString& text); void updateStatusDialogNow(); - void processHasFinished(const wxString& finalStatusText); //essential to call this in StatusUpdater derived class destructor at the LATEST(!) to prevent access to currentStatusUpdater + void setCurrentStatus(SyncStatusID id); + void processHasFinished(SyncStatusID id); //essential to call this in StatusUpdater derived class destructor at the LATEST(!) to prevent access to currentStatusUpdater private: void OnOkay(wxCommandEvent& event); @@ -115,6 +129,31 @@ private: wxString currentStatusText; }; +/* +class RemainingTime +{ +public: + RemainingTime(); + ~RemainingTime(); + wxLongLong getRemainingTime(double processedDataSinceLastCall, int remainingFiles, double remainingData); //returns the remaining time in milliseconds + +private: + double n; + double m; + double X; + double F; + double p; + double q; + double r; + double s; + double z_1; + double z_2; + wxLongLong lastExec; + + vector x; //dummy: DELETE asap! + vector f; +}; +*/ class CompareStatus : public CompareStatusGenerated { @@ -122,9 +161,9 @@ public: CompareStatus(wxWindow* parentWindow); ~CompareStatus(); - void resetMD5Gauge(int totalMD5ObjectsToProcess, double totalMD5DataToProcess); + void resetCmpGauge(int totalCmpObjectsToProcess, double totalCmpDataToProcess); void incScannedFiles_NoUpdate(int number); - void incProcessedMD5Data_NoUpdate(int objectsProcessed, double dataProcessed); + void incProcessedCmpData_NoUpdate(int objectsProcessed, double dataProcessed); void setStatusText_NoUpdate(const wxString& text); void updateStatusPanelNow(); @@ -134,11 +173,17 @@ private: wxString currentStatusText; //gauge variables - double totalMD5Data; //each data element represents one byte for proper progress indicator scaling - double currentMD5Data; - double scalingFactorMD5; //nr of elements has to be normalized to smaller nr. because of range of int limitation - int currentMD5Objects; //each object represents a file or directory processed - int totalMD5Objects; + double totalCmpData; //each data element represents one byte for proper progress indicator scaling + double processedCmpData; + double scalingFactorCmp; //nr of elements has to be normalized to smaller nr. because of range of int limitation + int processedCmpObjects; //each object represents a file or directory processed + int totalCmpObjects; +/* + //remaining time + RemainingTime calcTimeLeft; + wxLongLong timeRemaining; //time in milliseconds + wxLongLong timeRemainingTimeStamp; //time in milliseconds +*/ }; diff --git a/ui/SyncDialog.cpp b/ui/SyncDialog.cpp index a40da108..b97badf8 100644 --- a/ui/SyncDialog.cpp +++ b/ui/SyncDialog.cpp @@ -38,6 +38,8 @@ SyncDialog::SyncDialog(MainDialog* window) else m_radioBtn3->SetValue(true); //other + + m_bpButton18->SetLabel(_("&Start")); } //################################################################################################################# diff --git a/ui/guiGenerated.cpp b/ui/guiGenerated.cpp index 1d51a28f..a6ad9e6c 100644 --- a/ui/guiGenerated.cpp +++ b/ui/guiGenerated.cpp @@ -34,7 +34,7 @@ GuiGenerated::GuiGenerated( wxWindow* parent, wxWindowID id, const wxString& tit bSizer6->Add( 40, 0, 0, wxEXPAND, 5 ); wxBoxSizer* bSizer30; - bSizer30 = new wxBoxSizer( wxHORIZONTAL ); + bSizer30 = new wxBoxSizer( wxVERTICAL ); m_bpButtonCompare = new wxBitmapButton( this, wxID_OK, wxNullBitmap, wxDefaultPosition, wxSize( 190,37 ), wxBU_AUTODRAW|wxFULL_REPAINT_ON_RESIZE ); m_bpButtonCompare->SetDefault(); @@ -44,7 +44,7 @@ GuiGenerated::GuiGenerated( wxWindow* parent, wxWindowID id, const wxString& tit bSizer30->Add( m_bpButtonCompare, 0, wxALIGN_CENTER_VERTICAL|wxALIGN_CENTER_HORIZONTAL|wxRIGHT|wxLEFT, 5 ); - m_buttonAbort = new wxButton( this, wxID_ANY, _("Abort"), wxDefaultPosition, wxSize( 186,33 ), 0 ); + m_buttonAbort = new wxButton( this, wxID_CANCEL, _("Abort"), wxDefaultPosition, wxSize( 186,33 ), 0 ); m_buttonAbort->SetFont( wxFont( 14, 74, 90, 92, false, wxT("Tahoma") ) ); m_buttonAbort->Hide(); @@ -168,7 +168,7 @@ GuiGenerated::GuiGenerated( wxWindow* parent, wxWindowID id, const wxString& tit m_panel1->SetSizer( bSizer7 ); m_panel1->Layout(); bSizer7->Fit( m_panel1 ); - bSizer2->Add( m_panel1, 1, wxEXPAND|wxLEFT, 5 ); + bSizer2->Add( m_panel1, 1, wxEXPAND, 5 ); m_panel3 = new wxPanel( this, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxTAB_TRAVERSAL ); wxBoxSizer* bSizer18; @@ -267,7 +267,7 @@ GuiGenerated::GuiGenerated( wxWindow* parent, wxWindowID id, const wxString& tit m_panel2->SetSizer( bSizer10 ); m_panel2->Layout(); bSizer10->Fit( m_panel2 ); - bSizer2->Add( m_panel2, 1, wxEXPAND|wxRIGHT, 5 ); + bSizer2->Add( m_panel2, 1, wxEXPAND, 5 ); bSizer1->Add( bSizer2, 1, wxEXPAND, 5 ); @@ -369,7 +369,7 @@ GuiGenerated::GuiGenerated( wxWindow* parent, wxWindowID id, const wxString& tit m_panel4->SetSizer( bSizer3 ); m_panel4->Layout(); bSizer3->Fit( m_panel4 ); - bSizer1->Add( m_panel4, 0, wxALIGN_CENTER_HORIZONTAL|wxEXPAND|wxRIGHT|wxLEFT, 5 ); + bSizer1->Add( m_panel4, 0, wxALIGN_CENTER_HORIZONTAL|wxEXPAND, 5 ); this->SetSizer( bSizer1 ); this->Layout(); @@ -389,16 +389,15 @@ GuiGenerated::GuiGenerated( wxWindow* parent, wxWindowID id, const wxString& tit m_directoryPanel1->Connect( wxEVT_COMMAND_TEXT_UPDATED, wxCommandEventHandler( GuiGenerated::OnEnterLeftDir ), NULL, this ); m_dirPicker1->Connect( wxEVT_COMMAND_DIRPICKER_CHANGED, wxFileDirPickerEventHandler( GuiGenerated::OnDirChangedPanel1 ), NULL, this ); m_grid1->Connect( wxEVT_GRID_CELL_LEFT_DCLICK, wxGridEventHandler( GuiGenerated::OnLeftGridDoubleClick ), NULL, this ); + m_grid1->Connect( wxEVT_GRID_CELL_RIGHT_CLICK, wxGridEventHandler( GuiGenerated::OnOpenContextMenu ), NULL, this ); m_grid1->Connect( wxEVT_GRID_LABEL_LEFT_CLICK, wxGridEventHandler( GuiGenerated::OnSortLeftGrid ), NULL, this ); - m_grid1->Connect( wxEVT_GRID_SELECT_CELL, wxGridEventHandler( GuiGenerated::OnGridSelectCell ), NULL, this ); m_bpButtonSwap->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( GuiGenerated::OnSwapDirs ), NULL, this ); - m_grid3->Connect( wxEVT_GRID_RANGE_SELECT, wxGridRangeSelectEventHandler( GuiGenerated::OnGrid3SelectRange ), NULL, this ); - m_grid3->Connect( wxEVT_GRID_SELECT_CELL, wxGridEventHandler( GuiGenerated::OnGridSelectCell ), NULL, this ); + m_grid3->Connect( wxEVT_GRID_CELL_RIGHT_CLICK, wxGridEventHandler( GuiGenerated::OnOpenContextMenu ), NULL, this ); m_directoryPanel2->Connect( wxEVT_COMMAND_TEXT_UPDATED, wxCommandEventHandler( GuiGenerated::OnEnterRightDir ), NULL, this ); m_dirPicker2->Connect( wxEVT_COMMAND_DIRPICKER_CHANGED, wxFileDirPickerEventHandler( GuiGenerated::OnDirChangedPanel2 ), NULL, this ); m_grid2->Connect( wxEVT_GRID_CELL_LEFT_DCLICK, wxGridEventHandler( GuiGenerated::OnRightGridDoubleClick ), NULL, this ); + m_grid2->Connect( wxEVT_GRID_CELL_RIGHT_CLICK, wxGridEventHandler( GuiGenerated::OnOpenContextMenu ), NULL, this ); m_grid2->Connect( wxEVT_GRID_LABEL_LEFT_CLICK, wxGridEventHandler( GuiGenerated::OnSortRightGrid ), NULL, this ); - m_grid2->Connect( wxEVT_GRID_SELECT_CELL, wxGridEventHandler( GuiGenerated::OnGridSelectCell ), NULL, this ); m_bpButton11->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( GuiGenerated::OnAbout ), NULL, this ); m_bpButton201->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( GuiGenerated::OnSaveConfig ), NULL, this ); m_choiceLoad->Connect( wxEVT_CHAR, wxKeyEventHandler( GuiGenerated::OnChoiceKeyEvent ), NULL, this ); @@ -428,16 +427,15 @@ GuiGenerated::~GuiGenerated() m_directoryPanel1->Disconnect( wxEVT_COMMAND_TEXT_UPDATED, wxCommandEventHandler( GuiGenerated::OnEnterLeftDir ), NULL, this ); m_dirPicker1->Disconnect( wxEVT_COMMAND_DIRPICKER_CHANGED, wxFileDirPickerEventHandler( GuiGenerated::OnDirChangedPanel1 ), NULL, this ); m_grid1->Disconnect( wxEVT_GRID_CELL_LEFT_DCLICK, wxGridEventHandler( GuiGenerated::OnLeftGridDoubleClick ), NULL, this ); + m_grid1->Disconnect( wxEVT_GRID_CELL_RIGHT_CLICK, wxGridEventHandler( GuiGenerated::OnOpenContextMenu ), NULL, this ); m_grid1->Disconnect( wxEVT_GRID_LABEL_LEFT_CLICK, wxGridEventHandler( GuiGenerated::OnSortLeftGrid ), NULL, this ); - m_grid1->Disconnect( wxEVT_GRID_SELECT_CELL, wxGridEventHandler( GuiGenerated::OnGridSelectCell ), NULL, this ); m_bpButtonSwap->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( GuiGenerated::OnSwapDirs ), NULL, this ); - m_grid3->Disconnect( wxEVT_GRID_RANGE_SELECT, wxGridRangeSelectEventHandler( GuiGenerated::OnGrid3SelectRange ), NULL, this ); - m_grid3->Disconnect( wxEVT_GRID_SELECT_CELL, wxGridEventHandler( GuiGenerated::OnGridSelectCell ), NULL, this ); + m_grid3->Disconnect( wxEVT_GRID_CELL_RIGHT_CLICK, wxGridEventHandler( GuiGenerated::OnOpenContextMenu ), NULL, this ); m_directoryPanel2->Disconnect( wxEVT_COMMAND_TEXT_UPDATED, wxCommandEventHandler( GuiGenerated::OnEnterRightDir ), NULL, this ); m_dirPicker2->Disconnect( wxEVT_COMMAND_DIRPICKER_CHANGED, wxFileDirPickerEventHandler( GuiGenerated::OnDirChangedPanel2 ), NULL, this ); m_grid2->Disconnect( wxEVT_GRID_CELL_LEFT_DCLICK, wxGridEventHandler( GuiGenerated::OnRightGridDoubleClick ), NULL, this ); + m_grid2->Disconnect( wxEVT_GRID_CELL_RIGHT_CLICK, wxGridEventHandler( GuiGenerated::OnOpenContextMenu ), NULL, this ); m_grid2->Disconnect( wxEVT_GRID_LABEL_LEFT_CLICK, wxGridEventHandler( GuiGenerated::OnSortRightGrid ), NULL, this ); - m_grid2->Disconnect( wxEVT_GRID_SELECT_CELL, wxGridEventHandler( GuiGenerated::OnGridSelectCell ), NULL, this ); m_bpButton11->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( GuiGenerated::OnAbout ), NULL, this ); m_bpButton201->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( GuiGenerated::OnSaveConfig ), NULL, this ); m_choiceLoad->Disconnect( wxEVT_CHAR, wxKeyEventHandler( GuiGenerated::OnChoiceKeyEvent ), NULL, this ); @@ -516,6 +514,28 @@ CompareStatusGenerated::CompareStatusGenerated( wxWindow* parent, wxWindowID id, bSizer42->Add( sbSizer11, 0, wxEXPAND|wxALIGN_CENTER_VERTICAL, 5 ); + + bSizer42->Add( 0, 0, 1, wxEXPAND, 5 ); + + wxStaticBoxSizer* sbSizer131; + sbSizer131 = new wxStaticBoxSizer( new wxStaticBox( this, wxID_ANY, wxEmptyString ), wxHORIZONTAL ); + + m_staticText37 = new wxStaticText( this, wxID_ANY, _("Remaining time:"), wxDefaultPosition, wxDefaultSize, 0 ); + m_staticText37->Wrap( -1 ); + m_staticText37->SetFont( wxFont( 10, 74, 90, 90, false, wxT("Tahoma") ) ); + m_staticText37->Hide(); + + sbSizer131->Add( m_staticText37, 0, wxALIGN_CENTER_VERTICAL|wxRIGHT, 5 ); + + m_staticTextRemainingTime = new wxStaticText( this, wxID_ANY, _("--.--"), wxDefaultPosition, wxDefaultSize, 0 ); + m_staticTextRemainingTime->Wrap( -1 ); + m_staticTextRemainingTime->SetFont( wxFont( 10, 74, 90, 92, false, wxT("Tahoma") ) ); + m_staticTextRemainingTime->Hide(); + + sbSizer131->Add( m_staticTextRemainingTime, 0, wxALIGN_CENTER_VERTICAL, 5 ); + + bSizer42->Add( sbSizer131, 0, wxEXPAND|wxALIGN_CENTER_VERTICAL, 5 ); + bSizer40->Add( bSizer42, 0, wxALIGN_CENTER_HORIZONTAL|wxEXPAND|wxALL, 5 ); wxBoxSizer* bSizer48; @@ -585,10 +605,11 @@ SyncDialogGenerated::SyncDialogGenerated( wxWindow* parent, wxWindowID id, const m_staticText37 = new wxStaticText( this, wxID_ANY, _("Objects to process:"), wxDefaultPosition, wxDefaultSize, 0 ); m_staticText37->Wrap( -1 ); m_staticText37->SetFont( wxFont( 10, 74, 93, 90, false, wxT("Tahoma") ) ); + m_staticText37->SetToolTip( _("Number of files and directories that will be copied or deleted") ); gSizer1->Add( m_staticText37, 0, wxALL|wxALIGN_CENTER_VERTICAL, 5 ); - m_textCtrl12 = new wxTextCtrl( this, wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0 ); + m_textCtrl12 = new wxTextCtrl( this, wxID_ANY, wxEmptyString, wxDefaultPosition, wxSize( 85,-1 ), wxTE_READONLY ); m_textCtrl12->SetFont( wxFont( wxNORMAL_FONT->GetPointSize(), 70, 90, 90, false, wxEmptyString ) ); m_textCtrl12->SetBackgroundColour( wxSystemSettings::GetColour( wxSYS_COLOUR_ACTIVEBORDER ) ); @@ -597,6 +618,7 @@ SyncDialogGenerated::SyncDialogGenerated( wxWindow* parent, wxWindowID id, const m_staticText14 = new wxStaticText( this, wxID_ANY, _("Data to transfer:"), wxDefaultPosition, wxDefaultSize, 0 ); m_staticText14->Wrap( -1 ); m_staticText14->SetFont( wxFont( 10, 74, 93, 90, false, wxT("Tahoma") ) ); + m_staticText14->SetToolTip( _("Total amount of data that will be copied") ); gSizer1->Add( m_staticText14, 0, wxALIGN_CENTER_VERTICAL|wxBOTTOM|wxRIGHT|wxLEFT, 5 ); @@ -691,7 +713,7 @@ SyncDialogGenerated::SyncDialogGenerated( wxWindow* parent, wxWindowID id, const m_button6 = new wxButton( this, wxID_ANY, _("&Back"), wxDefaultPosition, wxSize( 100,32 ), 0 ); m_button6->SetFont( wxFont( 10, 74, 90, 90, false, wxT("Tahoma") ) ); - bSizer291->Add( m_button6, 0, wxALIGN_CENTER_VERTICAL|wxBOTTOM|wxLEFT, 5 ); + bSizer291->Add( m_button6, 0, wxALIGN_CENTER_VERTICAL|wxLEFT, 5 ); m_button16 = new wxButton( this, wxID_CANCEL, _("dummy"), wxDefaultPosition, wxSize( 0,-1 ), 0 ); bSizer291->Add( m_button16, 0, wxALL|wxALIGN_CENTER_VERTICAL, 5 ); @@ -714,7 +736,7 @@ SyncDialogGenerated::SyncDialogGenerated( wxWindow* parent, wxWindowID id, const bSizer38->Add( m_checkBoxHideErrors, 0, wxALL, 5 ); - bSizer291->Add( bSizer38, 0, wxALIGN_BOTTOM, 5 ); + bSizer291->Add( bSizer38, 0, wxALIGN_BOTTOM|wxBOTTOM, 5 ); bSizer29->Add( bSizer291, 0, wxALIGN_CENTER_HORIZONTAL|wxEXPAND, 5 ); @@ -899,7 +921,7 @@ HelpDlgGenerated::HelpDlgGenerated( wxWindow* parent, wxWindowID id, const wxStr bSizer20->Add( m_textCtrl8, 1, wxALL|wxALIGN_CENTER_HORIZONTAL|wxEXPAND, 5 ); - m_button8 = new wxButton( this, wxID_OK, _("OK"), wxDefaultPosition, wxSize( 100,32 ), 0 ); + m_button8 = new wxButton( this, wxID_OK, _("&OK"), wxDefaultPosition, wxSize( 100,32 ), 0 ); m_button8->SetDefault(); m_button8->SetFont( wxFont( 10, 74, 90, 90, false, wxT("Tahoma") ) ); @@ -930,54 +952,65 @@ AboutDlgGenerated::AboutDlgGenerated( wxWindow* parent, wxWindowID id, const wxS bSizer31->Add( 0, 10, 0, wxEXPAND, 5 ); + m_panel5 = new wxPanel( this, wxID_ANY, wxDefaultPosition, wxSize( -1,-1 ), wxSIMPLE_BORDER|wxTAB_TRAVERSAL ); + m_panel5->SetBackgroundColour( wxColour( 255, 255, 255 ) ); + wxBoxSizer* bSizer36; bSizer36 = new wxBoxSizer( wxHORIZONTAL ); - m_bitmap11 = new wxStaticBitmap( this, wxID_ANY, wxNullBitmap, wxDefaultPosition, wxSize( 40,40 ), 0 ); + m_bitmap11 = new wxStaticBitmap( m_panel5, wxID_ANY, wxNullBitmap, wxDefaultPosition, wxSize( 277,55 ), 0 ); bSizer36->Add( m_bitmap11, 0, wxALIGN_CENTER_VERTICAL, 5 ); - m_staticText14 = new wxStaticText( this, wxID_ANY, _("FreeFileSync v1.4"), wxDefaultPosition, wxDefaultSize, 0 ); - m_staticText14->Wrap( -1 ); - m_staticText14->SetFont( wxFont( 16, 74, 90, 92, false, wxT("Tahoma") ) ); - bSizer36->Add( m_staticText14, 0, wxALIGN_CENTER_HORIZONTAL|wxALIGN_CENTER_VERTICAL|wxRIGHT|wxLEFT, 5 ); + bSizer36->Add( 0, 0, 1, wxEXPAND, 5 ); + + m_staticText39 = new wxStaticText( m_panel5, wxID_ANY, _("FreeFileSync v1.5"), wxDefaultPosition, wxDefaultSize, 0 ); + m_staticText39->Wrap( -1 ); + m_staticText39->SetFont( wxFont( 18, 74, 90, 92, false, wxT("Tahoma") ) ); + bSizer36->Add( m_staticText39, 0, wxALL|wxALIGN_CENTER_VERTICAL, 5 ); - bSizer36->Add( 40, 0, 0, wxALIGN_CENTER_VERTICAL, 5 ); - bSizer31->Add( bSizer36, 0, wxALIGN_CENTER_HORIZONTAL, 5 ); + bSizer36->Add( 50, 0, 0, wxEXPAND, 5 ); + + m_panel5->SetSizer( bSizer36 ); + m_panel5->Layout(); + bSizer36->Fit( m_panel5 ); + bSizer31->Add( m_panel5, 0, wxALL|wxEXPAND, 5 ); m_staticText15 = new wxStaticText( this, wxID_ANY, _("-Open-Source file synchronization-"), wxDefaultPosition, wxDefaultSize, 0 ); m_staticText15->Wrap( -1 ); - m_staticText15->SetFont( wxFont( 8, 74, 93, 90, false, wxT("Tahoma") ) ); + m_staticText15->SetFont( wxFont( 8, 74, 90, 92, false, wxT("Tahoma") ) ); bSizer31->Add( m_staticText15, 0, wxALIGN_CENTER_HORIZONTAL|wxBOTTOM|wxRIGHT|wxLEFT, 5 ); m_build = new wxStaticText( this, wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0 ); m_build->Wrap( -1 ); + m_build->SetFont( wxFont( 8, 74, 90, 90, false, wxT("Tahoma") ) ); + bSizer31->Add( m_build, 0, wxALIGN_CENTER_HORIZONTAL|wxALIGN_CENTER_VERTICAL|wxBOTTOM|wxRIGHT|wxLEFT, 5 ); bSizer31->Add( 0, 10, 0, wxEXPAND, 5 ); - m_textCtrl3 = new wxTextCtrl( this, wxID_ANY, _("Source code written completely in C++ utilizing:\n\nMinGW \t\t- Windows port of GNU Compiler Collection\nwxWidgets \t- Open-Source GUI framework\nwxFormBuilder\t- wxWidgets GUI-builder\nGMP \t\t- arithmetic calculations\nCodeBlocks \t- Open-Source IDE\n\n by ZenJu"), wxDefaultPosition, wxSize( 350,140 ), wxTE_MULTILINE|wxTE_NO_VSCROLL|wxTE_READONLY|wxDOUBLE_BORDER ); + m_textCtrl3 = new wxTextCtrl( this, wxID_ANY, _("Source code written completely in C++ utilizing:\n\n MinGW \t\t- Windows port of GNU Compiler Collection\n wxWidgets \t- Open-Source GUI framework\n wxFormBuilder\t- wxWidgets GUI-builder\n CodeBlocks \t- Open-Source IDE\n\n by ZenJu"), wxDefaultPosition, wxSize( 350,-1 ), wxTE_MULTILINE|wxTE_NO_VSCROLL|wxTE_READONLY|wxDOUBLE_BORDER ); m_textCtrl3->SetBackgroundColour( wxSystemSettings::GetColour( wxSYS_COLOUR_ACTIVEBORDER ) ); bSizer31->Add( m_textCtrl3, 0, wxALL|wxALIGN_CENTER_HORIZONTAL, 0 ); - - bSizer31->Add( 0, 0, 1, wxEXPAND, 5 ); - wxStaticBoxSizer* sbSizer7; sbSizer7 = new wxStaticBoxSizer( new wxStaticBox( this, wxID_ANY, wxEmptyString ), wxVERTICAL ); m_staticText131 = new wxStaticText( this, wxID_ANY, _("Feedback and suggestions are welcome at:"), wxDefaultPosition, wxDefaultSize, 0 ); m_staticText131->Wrap( -1 ); - m_staticText131->SetFont( wxFont( 11, 74, 90, 90, false, wxT("Tahoma") ) ); + m_staticText131->SetFont( wxFont( 11, 74, 93, 92, false, wxT("Tahoma") ) ); sbSizer7->Add( m_staticText131, 0, wxALIGN_CENTER_HORIZONTAL, 5 ); - bSizer31->Add( sbSizer7, 0, wxALIGN_CENTER_HORIZONTAL, 5 ); + bSizer31->Add( sbSizer7, 0, wxALIGN_CENTER_HORIZONTAL|wxTOP|wxBOTTOM, 5 ); + + m_staticline3 = new wxStaticLine( this, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxLI_HORIZONTAL ); + bSizer31->Add( m_staticline3, 0, wxALL|wxEXPAND, 5 ); wxFlexGridSizer* fgSizer2; fgSizer2 = new wxFlexGridSizer( 3, 3, 0, 0 ); @@ -1022,13 +1055,33 @@ AboutDlgGenerated::AboutDlgGenerated( wxWindow* parent, wxWindowID id, const wxS m_hyperlink3 = new wxHyperlinkCtrl( this, wxID_ANY, _("Donate with Paypal"), wxT("https://www.paypal.com/cgi-bin/webscr?cmd=_donations&business=florian%2db%40gmx%2enet&no_shipping=0&no_note=1&tax=0¤cy_code=EUR&lc=DE&bn=PP%2dDonationsBF&charset=UTF%2d8"), wxDefaultPosition, wxDefaultSize, wxHL_DEFAULT_STYLE ); fgSizer2->Add( m_hyperlink3, 0, wxALL|wxALIGN_CENTER_VERTICAL, 5 ); - bSizer31->Add( fgSizer2, 0, wxEXPAND|wxLEFT, 10 ); + bSizer31->Add( fgSizer2, 0, wxLEFT|wxEXPAND, 10 ); - m_button8 = new wxButton( this, wxID_OK, _("OK"), wxDefaultPosition, wxSize( 100,32 ), 0 ); + m_staticline2 = new wxStaticLine( this, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxLI_HORIZONTAL ); + bSizer31->Add( m_staticline2, 0, wxEXPAND | wxALL, 5 ); + + wxStaticBoxSizer* sbSizer14; + sbSizer14 = new wxStaticBoxSizer( new wxStaticBox( this, wxID_ANY, _("Published under the GNU General Public License:") ), wxHORIZONTAL ); + + + sbSizer14->Add( 0, 0, 1, wxEXPAND, 5 ); + + m_bitmap13 = new wxStaticBitmap( this, wxID_ANY, wxNullBitmap, wxDefaultPosition, wxSize( 88,31 ), 0 ); + sbSizer14->Add( m_bitmap13, 0, wxALL|wxALIGN_CENTER_VERTICAL, 5 ); + + m_hyperlink5 = new wxHyperlinkCtrl( this, wxID_ANY, _("http://www.gnu.org/licenses/gpl.html"), wxT("http://www.gnu.org/licenses/gpl.html"), wxDefaultPosition, wxDefaultSize, wxHL_DEFAULT_STYLE ); + sbSizer14->Add( m_hyperlink5, 0, wxALL|wxALIGN_CENTER_HORIZONTAL|wxALIGN_CENTER_VERTICAL, 5 ); + + + sbSizer14->Add( 0, 0, 1, wxEXPAND, 5 ); + + bSizer31->Add( sbSizer14, 0, wxRIGHT|wxLEFT|wxALIGN_CENTER_HORIZONTAL|wxEXPAND, 5 ); + + m_button8 = new wxButton( this, wxID_OK, _("&OK"), wxDefaultPosition, wxSize( 100,32 ), 0 ); m_button8->SetDefault(); m_button8->SetFont( wxFont( 10, 74, 90, 90, false, wxT("Tahoma") ) ); - bSizer31->Add( m_button8, 0, wxALIGN_CENTER_HORIZONTAL|wxBOTTOM|wxRIGHT|wxLEFT, 5 ); + bSizer31->Add( m_button8, 0, wxALIGN_CENTER_HORIZONTAL|wxALL, 5 ); this->SetSizer( bSizer31 ); this->Layout(); @@ -1087,7 +1140,7 @@ ErrorDlgGenerated::ErrorDlgGenerated( wxWindow* parent, wxWindowID id, const wxS bSizer25->Add( m_buttonContinue, 0, wxTOP|wxBOTTOM|wxLEFT, 5 ); - m_buttonRetry = new wxButton( this, wxID_ANY, _("&Retry"), wxDefaultPosition, wxSize( 80,30 ), 0 ); + m_buttonRetry = new wxButton( this, wxID_RETRY, _("&Retry"), wxDefaultPosition, wxSize( 80,30 ), 0 ); m_buttonRetry->SetFont( wxFont( 10, 74, 90, 90, false, wxT("Tahoma") ) ); bSizer25->Add( m_buttonRetry, 0, wxTOP|wxBOTTOM|wxLEFT, 5 ); @@ -1156,13 +1209,13 @@ DeleteDialogGenerated::DeleteDialogGenerated( wxWindow* parent, wxWindowID id, c wxBoxSizer* bSizer25; bSizer25 = new wxBoxSizer( wxHORIZONTAL ); - m_buttonOK = new wxButton( this, wxID_OK, _("OK"), wxDefaultPosition, wxSize( 80,30 ), 0 ); + m_buttonOK = new wxButton( this, wxID_OK, _("&OK"), wxDefaultPosition, wxSize( 80,30 ), 0 ); m_buttonOK->SetDefault(); m_buttonOK->SetFont( wxFont( 10, 74, 90, 90, false, wxT("Tahoma") ) ); bSizer25->Add( m_buttonOK, 0, wxTOP|wxBOTTOM|wxLEFT, 5 ); - m_buttonCancel = new wxButton( this, wxID_CANCEL, _("Cancel"), wxDefaultPosition, wxSize( 80,30 ), 0 ); + m_buttonCancel = new wxButton( this, wxID_CANCEL, _("&Cancel"), wxDefaultPosition, wxSize( 80,30 ), 0 ); m_buttonCancel->SetFont( wxFont( 10, 74, 90, 90, false, wxT("Tahoma") ) ); bSizer25->Add( m_buttonCancel, 0, wxALL, 5 ); @@ -1253,7 +1306,7 @@ FilterDlgGenerated::FilterDlgGenerated( wxWindow* parent, wxWindowID id, const w sbSizer8->Add( fgSizer4, 0, 0, 5 ); - bSizer21->Add( sbSizer8, 0, wxRIGHT|wxLEFT, 5 ); + bSizer21->Add( sbSizer8, 0, wxRIGHT|wxLEFT|wxALIGN_CENTER_HORIZONTAL, 5 ); bSizer21->Add( 0, 0, 1, wxEXPAND, 5 ); @@ -1261,7 +1314,7 @@ FilterDlgGenerated::FilterDlgGenerated( wxWindow* parent, wxWindowID id, const w wxBoxSizer* bSizer22; bSizer22 = new wxBoxSizer( wxHORIZONTAL ); - m_button9 = new wxButton( this, wxID_ANY, _("&Default"), wxDefaultPosition, wxSize( 80,30 ), 0 ); + m_button9 = new wxButton( this, wxID_DEFAULT, _("&Default"), wxDefaultPosition, wxSize( 80,30 ), 0 ); m_button9->SetFont( wxFont( 10, 74, 90, 90, false, wxT("Tahoma") ) ); bSizer22->Add( m_button9, 0, wxALL, 5 ); @@ -1272,7 +1325,7 @@ FilterDlgGenerated::FilterDlgGenerated( wxWindow* parent, wxWindowID id, const w m_button17 = new wxButton( this, wxID_CANCEL, _("dummy"), wxDefaultPosition, wxSize( 0,-1 ), 0 ); bSizer22->Add( m_button17, 0, wxALL, 5 ); - m_button10 = new wxButton( this, wxID_OK, _("OK"), wxDefaultPosition, wxSize( 80,30 ), 0 ); + m_button10 = new wxButton( this, wxID_OK, _("&OK"), wxDefaultPosition, wxSize( 80,30 ), 0 ); m_button10->SetDefault(); m_button10->SetFont( wxFont( 10, 74, 90, 90, false, wxT("Tahoma") ) ); @@ -1323,11 +1376,25 @@ SyncStatusGenerated::SyncStatusGenerated( wxWindow* parent, wxWindowID id, const bSizer27->Add( bSizer37, 0, wxALIGN_CENTER_HORIZONTAL, 5 ); + wxBoxSizer* bSizer42; + bSizer42 = new wxBoxSizer( wxHORIZONTAL ); + + + bSizer42->Add( 0, 0, 1, wxEXPAND, 5 ); + + m_bitmapStatus = new wxStaticBitmap( this, wxID_ANY, wxNullBitmap, wxDefaultPosition, wxSize( 28,28 ), 0 ); + bSizer42->Add( m_bitmapStatus, 0, wxALL|wxALIGN_CENTER_VERTICAL, 5 ); + m_staticTextStatus = new wxStaticText( this, wxID_ANY, _("Synchronizing..."), wxDefaultPosition, wxDefaultSize, 0 ); m_staticTextStatus->Wrap( -1 ); m_staticTextStatus->SetFont( wxFont( 14, 74, 93, 90, false, wxT("Tahoma") ) ); - bSizer27->Add( m_staticTextStatus, 0, wxALIGN_CENTER_HORIZONTAL|wxTOP|wxRIGHT|wxLEFT, 5 ); + bSizer42->Add( m_staticTextStatus, 0, wxALIGN_CENTER_HORIZONTAL|wxTOP|wxRIGHT|wxLEFT|wxALIGN_CENTER_VERTICAL, 5 ); + + + bSizer42->Add( 0, 0, 1, wxEXPAND, 5 ); + + bSizer27->Add( bSizer42, 0, wxEXPAND, 5 ); wxBoxSizer* bSizer31; bSizer31 = new wxBoxSizer( wxHORIZONTAL ); @@ -1374,13 +1441,13 @@ SyncStatusGenerated::SyncStatusGenerated( wxWindow* parent, wxWindowID id, const bSizer28->Add( 0, 0, 1, wxEXPAND, 5 ); - m_buttonOK = new wxButton( this, wxID_OK, _("OK"), wxDefaultPosition, wxSize( 100,32 ), 0 ); + m_buttonOK = new wxButton( this, wxID_OK, _("&OK"), wxDefaultPosition, wxSize( 100,32 ), 0 ); m_buttonOK->SetFont( wxFont( 10, 74, 90, 90, false, wxT("Tahoma") ) ); m_buttonOK->Hide(); bSizer28->Add( m_buttonOK, 0, wxALL|wxALIGN_CENTER_VERTICAL, 5 ); - m_buttonAbort = new wxButton( this, wxID_CANCEL, _("Abort"), wxDefaultPosition, wxSize( 100,32 ), 0 ); + m_buttonAbort = new wxButton( this, wxID_CANCEL, _("&Abort"), wxDefaultPosition, wxSize( 100,32 ), 0 ); m_buttonAbort->SetDefault(); m_buttonAbort->SetFont( wxFont( 10, 74, 90, 90, false, wxT("Tahoma") ) ); diff --git a/ui/guiGenerated.h b/ui/guiGenerated.h index 2b6f5b6d..30376834 100644 --- a/ui/guiGenerated.h +++ b/ui/guiGenerated.h @@ -107,10 +107,9 @@ class GuiGenerated : public wxFrame virtual void OnEnterLeftDir( wxCommandEvent& event ){ event.Skip(); } virtual void OnDirChangedPanel1( wxFileDirPickerEvent& event ){ event.Skip(); } virtual void OnLeftGridDoubleClick( wxGridEvent& event ){ event.Skip(); } + virtual void OnOpenContextMenu( wxGridEvent& event ){ event.Skip(); } virtual void OnSortLeftGrid( wxGridEvent& event ){ event.Skip(); } - virtual void OnGridSelectCell( wxGridEvent& event ){ event.Skip(); } virtual void OnSwapDirs( wxCommandEvent& event ){ event.Skip(); } - virtual void OnGrid3SelectRange( wxGridRangeSelectEvent& event ){ event.Skip(); } virtual void OnEnterRightDir( wxCommandEvent& event ){ event.Skip(); } virtual void OnDirChangedPanel2( wxFileDirPickerEvent& event ){ event.Skip(); } virtual void OnRightGridDoubleClick( wxGridEvent& event ){ event.Skip(); } @@ -129,7 +128,7 @@ class GuiGenerated : public wxFrame public: - GuiGenerated( wxWindow* parent, wxWindowID id = wxID_ANY, const wxString& title = _("FreeFileSync - Folder Synchronization"), const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxSize( 933,612 ), long style = wxDEFAULT_FRAME_STYLE|wxTAB_TRAVERSAL ); + GuiGenerated( wxWindow* parent, wxWindowID id = wxID_ANY, const wxString& title = _("FreeFileSync - Folder Comparison and Synchronization"), const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxSize( 933,612 ), long style = wxDEFAULT_FRAME_STYLE|wxTAB_TRAVERSAL ); ~GuiGenerated(); }; @@ -150,6 +149,9 @@ class CompareStatusGenerated : public wxPanel wxStaticText* m_staticText32; wxStaticText* m_staticTextDataToCompare; + + wxStaticText* m_staticText37; + wxStaticText* m_staticTextRemainingTime; wxStaticText* m_staticText30; wxTextCtrl* m_textCtrlFilename; wxGauge* m_gauge2; @@ -234,7 +236,7 @@ class SyncDialogGenerated : public wxDialog public: - SyncDialogGenerated( wxWindow* parent, wxWindowID id = wxID_ANY, const wxString& title = _("Synchronization settings"), const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxSize( 525,356 ), long style = wxDEFAULT_DIALOG_STYLE ); + SyncDialogGenerated( wxWindow* parent, wxWindowID id = wxID_ANY, const wxString& title = _("Synchronization settings"), const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxSize( 523,356 ), long style = wxDEFAULT_DIALOG_STYLE ); ~SyncDialogGenerated(); }; @@ -273,15 +275,17 @@ class AboutDlgGenerated : public wxDialog protected: + wxPanel* m_panel5; wxStaticBitmap* m_bitmap11; - wxStaticText* m_staticText14; + + wxStaticText* m_staticText39; wxStaticText* m_staticText15; wxStaticText* m_build; wxTextCtrl* m_textCtrl3; - wxStaticText* m_staticText131; + wxStaticLine* m_staticline3; wxStaticBitmap* m_bitmap9; wxStaticText* m_staticText11; wxHyperlinkCtrl* m_hyperlink1; @@ -291,6 +295,11 @@ class AboutDlgGenerated : public wxDialog wxAnimationCtrl* m_animationControl1; wxStaticText* m_staticText151; wxHyperlinkCtrl* m_hyperlink3; + wxStaticLine* m_staticline2; + + wxStaticBitmap* m_bitmap13; + wxHyperlinkCtrl* m_hyperlink5; + wxButton* m_button8; // Virtual event handlers, overide them in your derived class @@ -299,7 +308,7 @@ class AboutDlgGenerated : public wxDialog public: - AboutDlgGenerated( wxWindow* parent, wxWindowID id = wxID_ANY, const wxString& title = _("About"), const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxSize( 439,510 ), long style = wxDEFAULT_DIALOG_STYLE ); + AboutDlgGenerated( wxWindow* parent, wxWindowID id = wxID_ANY, const wxString& title = _("About"), const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxSize( 422,603 ), long style = wxDEFAULT_DIALOG_STYLE ); ~AboutDlgGenerated(); }; @@ -397,7 +406,7 @@ class FilterDlgGenerated : public wxDialog public: - FilterDlgGenerated( wxWindow* parent, wxWindowID id = wxID_ANY, const wxString& title = _("Configure filter settings"), const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxSize( 484,350 ), long style = wxDEFAULT_DIALOG_STYLE ); + FilterDlgGenerated( wxWindow* parent, wxWindowID id = wxID_ANY, const wxString& title = _("Configure filter settings"), const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxSize( 472,367 ), long style = wxDEFAULT_DIALOG_STYLE ); ~FilterDlgGenerated(); }; @@ -413,8 +422,13 @@ class SyncStatusGenerated : public wxDialog wxAnimationCtrl* m_animationControl1; wxStaticText* m_staticText20; + + wxStaticBitmap* m_bitmapStatus; + wxStaticText* m_staticTextStatus; + wxStaticText* m_staticText21; + wxTextCtrl* m_textCtrlInfo; wxStaticText* m_staticText26; wxStaticText* m_staticTextDataRemaining; @@ -430,8 +444,6 @@ class SyncStatusGenerated : public wxDialog public: - wxStaticText* m_staticTextStatus; - wxTextCtrl* m_textCtrlInfo; wxGauge* m_gauge1; wxButton* m_buttonOK; wxButton* m_buttonAbort; -- cgit