Version: 11.3 Date: 2020-11-01 Author: bgstack15@gmail.com Message: restore a traditional view to FreeFileSync diff -x '*.orig' -x '*.rej' -aur 11.3-0/FreeFileSync/Source/ui/file_grid.cpp 11.3-1/FreeFileSync/Source/ui/file_grid.cpp --- 11.3-0/FreeFileSync/Source/ui/file_grid.cpp 2020-11-01 17:14:27.531500950 -0500 +++ 11.3-1/FreeFileSync/Source/ui/file_grid.cpp 2020-11-01 22:52:14.590746142 -0500 @@ -493,8 +493,10 @@ case ItemPathFormat::name: return utfTo(fsObj->getItemName()); case ItemPathFormat::relative: + case ItemPathFormat::tradrel: return utfTo(fsObj->getRelativePath()); case ItemPathFormat::full: + case ItemPathFormat::traditional: return AFS::getDisplayPath(fsObj->getAbstractPath()); } assert(false); @@ -654,6 +656,27 @@ else //=> BaseFolderPair groupParentFolder = AFS::getDisplayPath(pdi.fsObj->base().getAbstractPath()); break; + + case ItemPathFormat::traditional: + if (auto groupFolder = dynamic_cast(pdi.folderGroupObj)) + { + groupName = utfTo(groupFolder->template getItemName()); + groupParentFolder = AFS::getDisplayPath(groupFolder->parent().template getAbstractPath()) + \ + FILE_NAME_SEPARATOR + utfTo(groupFolder->template getItemName()); + } + else //=> BaseFolderPair + groupParentFolder = AFS::getDisplayPath(pdi.fsObj->base().getAbstractPath()); + break; + + case ItemPathFormat::tradrel: + if (pdi.folderGroupObj) + { + groupName = utfTo(pdi.folderGroupObj ->template getItemName ()); + groupParentFolder = utfTo(pdi.folderGroupObj->parent().template getRelativePath()) + \ + utfTo(pdi.folderGroupObj ->template getItemName()); + } + break; + } //path components should follow the app layout direction and are NOT a single piece of text! @@ -684,6 +707,31 @@ int groupItemsWidth = groupSepWidth + (drawFileIcons ? gapSize_ + iconSize : 0) + gapSize_ + groupItemNamesWidth; const int groupItemsMinWidth = groupSepWidth + (drawFileIcons ? gapSize_ + iconSize : 0) + gapSize_ + ellipsisWidth; + // start trad patch + + // rearrange this one section + //add slashes for better readability + a wide gap for disambiguation + assert(!contains(groupParentFolder, L'/') || !contains(groupParentFolder, L'\\')); + const wchar_t groupParentSep = contains(groupParentFolder, L'/') ? L'/' : (contains(groupParentFolder, L'\\') ? L'\\' : FILE_NAME_SEPARATOR); + + switch (itemPathFormat_) + { + case ItemPathFormat::traditional: + case ItemPathFormat::tradrel: + groupParentWidth -= groupNameWidth - getTextExtentBuffered(dc, utfTo(FILE_NAME_SEPARATOR)).x; + if (!endsWith(groupParentFolder, L'/' ) && //e.g. ftp://server/ + !endsWith(groupParentFolder, L'\\') && /*e.g. C:\ */ + groupParentFolder.size() > 0 ) + groupParentFolder += groupParentSep; + break; + case ItemPathFormat::name: + case ItemPathFormat::relative: + case ItemPathFormat::full: + default: + // the insane logic of the new views + // but preserve the original tabbing, to make the patch easier. + // but with the "add slashes" paragraph 1 moved to above this switch statement! + //not enough space? => collapse if (int excessWidth = groupParentWidth + groupNameWidth + groupItemsWidth - maxWidth; excessWidth > 0) @@ -693,10 +741,6 @@ //1. render group components on two rows stackedGroupRender = true; - //add slashes for better readability + a wide gap for disambiguation - assert(!contains(groupParentFolder, L'/') || !contains(groupParentFolder, L'\\')); - const wchar_t groupParentSep = contains(groupParentFolder, L'/') ? L'/' : (contains(groupParentFolder, L'\\') ? L'\\' : FILE_NAME_SEPARATOR); - if (!endsWith(groupParentFolder, L'/' ) && //e.g. ftp://server/ !endsWith(groupParentFolder, L'\\')) /*e.g. C:\ */ groupParentFolder += groupParentSep; @@ -755,6 +799,11 @@ } } } + + // end of original section, and back to the trad patch! + break; + } + // and end the addition for trad patch return { @@ -873,6 +922,9 @@ rectGroup = rectGroupParent = rectGroupName = rectTmp; rectGroupParent.width = groupParentWidth; + // re-add back the width of groupname so that the directory name is clickable + if (itemPathFormat_ == ItemPathFormat::traditional || itemPathFormat_ == ItemPathFormat::tradrel) + rectGroupParent.width += groupNameWidth; rectGroupName .width = groupNameWidth; if (stackedGroupRender) @@ -922,6 +974,7 @@ rectNav.width = fastFromDIP(20); if (row == pdi.groupLastRow - 1 /*last group item*/) //preserve the group separation line! + if (itemPathFormat_ != ItemPathFormat::traditional && itemPathFormat_ != ItemPathFormat::tradrel) rectNav.height -= fastFromDIP(1); wxColor backCol = *wxWHITE; @@ -930,7 +983,7 @@ dc.GradientFillLinear(rectNav, getColorSelectionGradientFrom(), backCol, wxEAST); } - if (!groupName.empty() && row == groupFirstRow) + if (!(itemPathFormat_ == ItemPathFormat::traditional || itemPathFormat_ == ItemPathFormat::tradrel) && !groupName.empty() && row == groupFirstRow) { wxRect rectGroupNameBack = rectGroupName; rectGroupNameBack.width += 2 * gapSize_; //include gap left of vline @@ -972,10 +1025,10 @@ drawCellText(dc, rectGroupName, groupName, wxALIGN_LEFT | wxALIGN_CENTER_VERTICAL, &getTextExtentBuffered(dc, groupName)); } - if (!groupParentFolder.empty() && + if (itemPathFormat_ == ItemPathFormat::traditional || itemPathFormat_ == ItemPathFormat::tradrel || (!groupParentFolder.empty() && (( stackedGroupRender && row == groupFirstRow + 1) || (!stackedGroupRender && row == groupFirstRow)) && - (groupName.empty() || !pdi.folderGroupObj->isEmpty())) + (groupName.empty() || !pdi.folderGroupObj->isEmpty()))) { wxRect rectGroupParentText = rectGroupParent; rectGroupParentText.x += gapSize_; @@ -1166,6 +1219,10 @@ return _("Relative path"); case ItemPathFormat::full: return _("Full path"); + case ItemPathFormat::traditional: + return _("Traditional"); + case ItemPathFormat::tradrel: + return _("Trad. relative"); } assert(false); break; diff -x '.git*' -x '*.orig' -x '*.rej' -aur 11.2-1/FreeFileSync/Source/ui/file_grid_attr.h 11.2-1-trad3/FreeFileSync/Source/ui/file_grid_attr.h --- 11.2-1/FreeFileSync/Source/ui/file_grid_attr.h 2020-10-02 14:39:05.313463564 -0400 +++ 11.2-1-trad3/FreeFileSync/Source/ui/file_grid_attr.h 2020-10-02 20:21:48.863111642 -0400 @@ -79,6 +79,8 @@ name, relative, full, + traditional, + tradrel, }; const ItemPathFormat defaultItemPathFormatLeftGrid = ItemPathFormat::relative; diff -x '.git*' -x '*.orig' -x '*.rej' -aur 11.2-1/FreeFileSync/Source/ui/main_dlg.cpp 11.2-1-trad3/FreeFileSync/Source/ui/main_dlg.cpp --- 11.2-1/FreeFileSync/Source/ui/main_dlg.cpp 2020-10-02 20:49:11.487782099 -0400 +++ 11.2-1-trad3/FreeFileSync/Source/ui/main_dlg.cpp 2020-10-02 20:22:02.191278722 -0400 @@ -2710,6 +2710,8 @@ addFormatEntry(_("Item name" ), ItemPathFormat::name); addFormatEntry(_("Relative path"), ItemPathFormat::relative); addFormatEntry(_("Full path" ), ItemPathFormat::full); + addFormatEntry(_("Traditional" ), ItemPathFormat::traditional); + addFormatEntry(_("Trad. relative"),ItemPathFormat::tradrel); //---------------------------------------------------------------------------------------------- menu.addSeparator(); diff -x '.git*' -x '*.orig' -x '*.rej' -aur 11.2-1/FreeFileSync/Source/config.cpp 11.2-1-trad3/FreeFileSync/Source/config.cpp --- 11.2-1/FreeFileSync/Source/config.cpp 2020-10-02 14:39:05.233462578 -0400 +++ 11.2-1-trad3/FreeFileSync/Source/config.cpp 2020-10-02 20:22:24.275555557 -0400 @@ -528,6 +528,12 @@ case ItemPathFormat::full: output = "Full"; break; + case ItemPathFormat::traditional: + output = "Traditional"; + break; + case ItemPathFormat::tradrel: + output = "Trad. relative"; + break; } } @@ -541,6 +547,10 @@ value = ItemPathFormat::relative; else if (tmp == "Full") value = ItemPathFormat::full; + else if (tmp == "Traditional") + value = ItemPathFormat::traditional; + else if (tmp == "Trad. relative") + value = ItemPathFormat::tradrel; else return false; return true; diff -x '.git*' -x '*.orig' -x '*.rej' -aur 11.2-1/FreeFileSync/Source/ui/file_view.cpp 11.2-1-trad3/FreeFileSync/Source/ui/file_view.cpp --- 11.2-1/FreeFileSync/Source/ui/file_view.cpp 2020-10-02 14:39:05.305463465 -0400 +++ 11.2-1-trad3/FreeFileSync/Source/ui/file_view.cpp 2020-10-02 20:22:38.439733112 -0400 @@ -798,11 +798,13 @@ break; case ItemPathFormat::relative: + case ItemPathFormat::tradrel: if ( ascending) std::sort(sortedRef_.begin(), sortedRef_.end(), LessRelativeFolder(folderPairs_)); else if (!ascending) std::sort(sortedRef_.begin(), sortedRef_.end(), LessRelativeFolder(folderPairs_)); break; case ItemPathFormat::full: + case ItemPathFormat::traditional: if ( ascending && onLeft) std::sort(sortedRef_.begin(), sortedRef_.end(), LessFullPath(folderPairs_)); else if ( ascending && !onLeft) std::sort(sortedRef_.begin(), sortedRef_.end(), LessFullPath(folderPairs_)); else if (!ascending && onLeft) std::sort(sortedRef_.begin(), sortedRef_.end(), LessFullPath(folderPairs_));