From a4abd0e068ed631878d269a3c6d4c7295eb1556f Mon Sep 17 00:00:00 2001 From: B Stack Date: Sun, 6 Sep 2020 20:58:49 -0400 Subject: ffs: add traditional view as an option https://freefilesync.org/forum/viewtopic.php?p=26085#p26040 The upstream author updated the main grid view, and this patch returns the old view as an option. --- freefilesync/debian/changelog | 6 + freefilesync/debian/freefilesync+devuan.dsc | 2 +- .../debian/patches/ffs_traditional_view.patch | 242 +++++++++++++++++++++ freefilesync/debian/patches/series | 1 + 4 files changed, 250 insertions(+), 1 deletion(-) create mode 100644 freefilesync/debian/patches/ffs_traditional_view.patch (limited to 'freefilesync') diff --git a/freefilesync/debian/changelog b/freefilesync/debian/changelog index 45bc14c..fbdcbf7 100644 --- a/freefilesync/debian/changelog +++ b/freefilesync/debian/changelog @@ -1,3 +1,9 @@ +freefilesync (11.1-2+devuan) obs; urgency=low + + * add traditional option to main grid view + + -- Ben Stack Sun, 06 Sep 2020 20:59:36 -0400 + freefilesync (11.1-1+devuan) obs; urgency=low * [bgstack15] still has the broken file tree layout diff --git a/freefilesync/debian/freefilesync+devuan.dsc b/freefilesync/debian/freefilesync+devuan.dsc index 6b057d6..e6a707d 100644 --- a/freefilesync/debian/freefilesync+devuan.dsc +++ b/freefilesync/debian/freefilesync+devuan.dsc @@ -2,7 +2,7 @@ Format: 3.0 (quilt) Source: freefilesync Binary: freefilesync Architecture: any -Version: 11.1-1+devuan +Version: 11.1-2+devuan Maintainer: B Stack Homepage: https://freefilesync.org/ Standards-Version: 4.1.4 diff --git a/freefilesync/debian/patches/ffs_traditional_view.patch b/freefilesync/debian/patches/ffs_traditional_view.patch new file mode 100644 index 0000000..9793c6e --- /dev/null +++ b/freefilesync/debian/patches/ffs_traditional_view.patch @@ -0,0 +1,242 @@ +diff --git a/FreeFileSync/Source/ui/file_grid.cpp b/FreeFileSync/Source/ui/file_grid.cpp +index 4ee72b97..d9b9a4c7 100644 +--- a/FreeFileSync/Source/ui/file_grid.cpp ++++ b/FreeFileSync/Source/ui/file_grid.cpp +@@ -437,6 +437,7 @@ private: + case ItemPathFormat::relative: + return utfTo(fsObj->getRelativePath()); + case ItemPathFormat::full: ++ case ItemPathFormat::traditional: + return AFS::getDisplayPath(fsObj->getAbstractPath()); + } + assert(false); +@@ -615,6 +616,16 @@ private: + 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; + } + //add slashes for better readability + assert(!contains(groupParentFolder, L'/') || !contains(groupParentFolder, L'\\')); +@@ -650,72 +661,84 @@ private: + int widthGroupName = groupName .empty() ? 0 : ((iconMgr ? iconSize + gridGap_ : 0) + getTextExtentBuffered(dc, groupName).x + (iconMgr ? gridGap_ : 0)); + int widthGroupItems = (iconMgr ? iconSize + gridGap_ : 0) + groupItemNamesWidth; + +- //not enough space? => collapse +- if (int excessWidth = gridGap_ + widthGroupParent + widthGroupName + widthGroupItems - maxWidth; +- excessWidth > 0) ++ switch (itemPathFormat_) + { +- if (multiItemGroup && !groupParentFolder.empty() && !groupName.empty()) +- { +- //1. render group components on two rows +- stackedGroupRender = true; +- +- if (!endsWith(groupParentFolder, L'/' ) && +- !endsWith(groupParentFolder, L'\\')) +- groupParentFolder += groupParentSep; +- groupParentFolder += ELLIPSIS; +- +- widthGroupParent = getTextExtentBuffered(dc, groupParentFolder).x + gridGap_; +- +- int widthGroupStack = std::max(widthGroupParent, widthGroupName); +- excessWidth = gridGap_ + widthGroupStack + widthGroupItems - maxWidth; +- +- if (excessWidth > 0) +- { +- //2. shrink group stack (group parent only) +- if (widthGroupParent > widthGroupName) +- { +- widthGroupStack = widthGroupParent = std::max(widthGroupParent - excessWidth, widthGroupName); +- excessWidth = gridGap_ + widthGroupStack + widthGroupItems - maxWidth; +- } +- if (excessWidth > 0) +- { +- //3. shrink item rendering +- widthGroupItems = std::max(widthGroupItems - excessWidth, (iconMgr ? iconSize + gridGap_ : 0) + ellipsisWidth); +- excessWidth = gridGap_ + widthGroupStack + widthGroupItems - maxWidth; +- +- if (excessWidth > 0) +- { +- //4. shrink group stack +- widthGroupStack = std::max(widthGroupStack - excessWidth, (iconMgr ? iconSize + gridGap_ : 0) + ellipsisWidth + (iconMgr ? gridGap_ : 0)); +- +- widthGroupParent = std::min(widthGroupParent, widthGroupStack); +- widthGroupName = std::min(widthGroupName, widthGroupStack); +- } +- } +- } +- } +- else //group details on single row +- { +- //1. shrink group parent +- if (!groupParentFolder.empty()) +- { +- widthGroupParent = std::max(widthGroupParent - excessWidth, ellipsisWidth + (iconMgr ? gridGap_ : 0)); +- excessWidth = gridGap_ + widthGroupParent + widthGroupName + widthGroupItems - maxWidth; +- } +- if (excessWidth > 0) +- { +- //2. shrink item rendering +- widthGroupItems = std::max(widthGroupItems - excessWidth, (iconMgr ? iconSize + gridGap_ : 0) + ellipsisWidth); +- excessWidth = gridGap_ + widthGroupParent + widthGroupName + widthGroupItems - maxWidth; +- +- if (excessWidth > 0) +- //3. shrink group name +- if (!groupName.empty()) +- widthGroupName = std::max(widthGroupName - excessWidth, (iconMgr ? iconSize + gridGap_ : 0) + ellipsisWidth + (iconMgr ? gridGap_ : 0)); +- } +- } ++ case ItemPathFormat::traditional: ++ //widthGroupName = 0; ++ widthGroupParent -= widthGroupName ; ++ break; ++ case ItemPathFormat::name: ++ case ItemPathFormat::relative: ++ case ItemPathFormat::full: ++ default: ++ // the insane logic of the new views ++ //not enough space? => collapse ++ if (int excessWidth = gridGap_ + widthGroupParent + widthGroupName + widthGroupItems - maxWidth; ++ excessWidth > 0) ++ { ++ if (multiItemGroup && !groupParentFolder.empty() && !groupName.empty()) ++ { ++ //1. render group components on two rows ++ stackedGroupRender = true; ++ ++ if (!endsWith(groupParentFolder, L'/' ) && ++ !endsWith(groupParentFolder, L'\\')) ++ groupParentFolder += groupParentSep; ++ groupParentFolder += ELLIPSIS; ++ ++ widthGroupParent = getTextExtentBuffered(dc, groupParentFolder).x + gridGap_; ++ ++ int widthGroupStack = std::max(widthGroupParent, widthGroupName); ++ excessWidth = gridGap_ + widthGroupStack + widthGroupItems - maxWidth; ++ ++ if (excessWidth > 0) ++ { ++ //2. shrink group stack (group parent only) ++ if (widthGroupParent > widthGroupName) ++ { ++ widthGroupStack = widthGroupParent = std::max(widthGroupParent - excessWidth, widthGroupName); ++ excessWidth = gridGap_ + widthGroupStack + widthGroupItems - maxWidth; ++ } ++ if (excessWidth > 0) ++ { ++ //3. shrink item rendering ++ widthGroupItems = std::max(widthGroupItems - excessWidth, (iconMgr ? iconSize + gridGap_ : 0) + ellipsisWidth); ++ excessWidth = gridGap_ + widthGroupStack + widthGroupItems - maxWidth; ++ ++ if (excessWidth > 0) ++ { ++ //4. shrink group stack ++ widthGroupStack = std::max(widthGroupStack - excessWidth, (iconMgr ? iconSize + gridGap_ : 0) + ellipsisWidth + (iconMgr ? gridGap_ : 0)); ++ ++ widthGroupParent = std::min(widthGroupParent, widthGroupStack); ++ widthGroupName = std::min(widthGroupName, widthGroupStack); ++ } ++ } ++ } ++ } ++ else //group details on single row ++ { ++ //1. shrink group parent ++ if (!groupParentFolder.empty()) ++ { ++ widthGroupParent = std::max(widthGroupParent - excessWidth, ellipsisWidth + (iconMgr ? gridGap_ : 0)); ++ excessWidth = gridGap_ + widthGroupParent + widthGroupName + widthGroupItems - maxWidth; ++ } ++ if (excessWidth > 0) ++ { ++ //2. shrink item rendering ++ widthGroupItems = std::max(widthGroupItems - excessWidth, (iconMgr ? iconSize + gridGap_ : 0) + ellipsisWidth); ++ excessWidth = gridGap_ + widthGroupParent + widthGroupName + widthGroupItems - maxWidth; ++ ++ if (excessWidth > 0) ++ //3. shrink group name ++ if (!groupName.empty()) ++ widthGroupName = std::max(widthGroupName - excessWidth, (iconMgr ? iconSize + gridGap_ : 0) + ellipsisWidth + (iconMgr ? gridGap_ : 0)); ++ } ++ } ++ } ++ break; + } +- + return + { + itemName, +@@ -786,6 +809,9 @@ private: + rectGroup = rectGroupParent = rectGroupName = rectTmp; + + rectGroupParent.width = widthGroupParent; ++ // re-add back the width of groupname so that the directory name is clickable ++ if (itemPathFormat_ == ItemPathFormat::traditional) ++ rectGroupParent.width += widthGroupName; + rectGroupName .width = widthGroupName; + + if (stackedGroupRender) +@@ -837,7 +863,7 @@ private: + dc.GradientFillLinear(rectNav, getColorSelectionGradientFrom(), backCol, wxEAST); + } + +- if (!groupName.empty() && row == groupBeginRow) ++ if (!(itemPathFormat_ == ItemPathFormat::traditional) && !groupName.empty() && row == groupBeginRow) + { + wxDCTextColourChanger textColorGroupName(dc); + if (static_cast(rowHover) == HoverAreaGroup::groupName) +@@ -855,9 +881,9 @@ private: + drawCellText(dc, rectGroupName, groupName, wxALIGN_LEFT | wxALIGN_CENTER_VERTICAL, &getTextExtentBuffered(dc, groupName)); + } + +- if (!groupParentFolder.empty() && ++ if (itemPathFormat_ == ItemPathFormat::traditional || (!groupParentFolder.empty() && + ((stackedGroupRender && row == groupBeginRow + 1) || +- (!stackedGroupRender && row == groupBeginRow))) ++ (!stackedGroupRender && row == groupBeginRow)))) + { + drawCellText(dc, rectGroupParent, groupParentFolder, wxALIGN_LEFT | wxALIGN_CENTER_VERTICAL, &getTextExtentBuffered(dc, groupParentFolder)); + } +@@ -1020,6 +1046,8 @@ private: + return _("Relative path"); + case ItemPathFormat::full: + return _("Full path"); ++ case ItemPathFormat::traditional: ++ return _("Traditional"); + } + assert(false); + break; +diff --git a/FreeFileSync/Source/ui/file_grid_attr.h b/FreeFileSync/Source/ui/file_grid_attr.h +index 324619c1..7511a1ab 100644 +--- a/FreeFileSync/Source/ui/file_grid_attr.h ++++ b/FreeFileSync/Source/ui/file_grid_attr.h +@@ -79,6 +79,7 @@ enum class ItemPathFormat + name, + relative, + full, ++ traditional, + }; + + const ItemPathFormat defaultItemPathFormatLeftGrid = ItemPathFormat::relative; +diff --git a/FreeFileSync/Source/ui/main_dlg.cpp b/FreeFileSync/Source/ui/main_dlg.cpp +index 491b7321..2d5c20c3 100644 +--- a/FreeFileSync/Source/ui/main_dlg.cpp ++++ b/FreeFileSync/Source/ui/main_dlg.cpp +@@ -2716,6 +2716,7 @@ void MainDialog::onGridLabelContextRim(bool leftSide) + addFormatEntry(_("Item name" ), ItemPathFormat::name); + addFormatEntry(_("Relative path"), ItemPathFormat::relative); + addFormatEntry(_("Full path" ), ItemPathFormat::full); ++ addFormatEntry(_("Traditional" ), ItemPathFormat::traditional); + + //---------------------------------------------------------------------------------------------- + menu.addSeparator(); diff --git a/freefilesync/debian/patches/series b/freefilesync/debian/patches/series index 7ce7a97..7896b6e 100644 --- a/freefilesync/debian/patches/series +++ b/freefilesync/debian/patches/series @@ -8,3 +8,4 @@ ffs_libssh2.patch ffs_curl.patch revert_zenju_aggressive_upstreamisms.patch ffs_gcc.patch +ffs_traditional_view.patch -- cgit