summaryrefslogtreecommitdiff
path: root/freefilesync/debian/patches
diff options
context:
space:
mode:
authorB Stack <bgstack15@gmail.com>2020-09-06 20:58:49 -0400
committerB Stack <bgstack15@gmail.com>2020-09-06 20:58:49 -0400
commita4abd0e068ed631878d269a3c6d4c7295eb1556f (patch)
tree853dd95b2c81620c64a4725298847592d9f20771 /freefilesync/debian/patches
parentadd gui_status_handler.h to revert (diff)
downloadstackrpms-a4abd0e068ed631878d269a3c6d4c7295eb1556f.tar.gz
stackrpms-a4abd0e068ed631878d269a3c6d4c7295eb1556f.tar.bz2
stackrpms-a4abd0e068ed631878d269a3c6d4c7295eb1556f.zip
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.
Diffstat (limited to 'freefilesync/debian/patches')
-rw-r--r--freefilesync/debian/patches/ffs_traditional_view.patch242
-rw-r--r--freefilesync/debian/patches/series1
2 files changed, 243 insertions, 0 deletions
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<std::wstring>(fsObj->getRelativePath<side>());
+ case ItemPathFormat::full:
++ case ItemPathFormat::traditional:
+ return AFS::getDisplayPath(fsObj->getAbstractPath<side>());
+ }
+ assert(false);
+@@ -615,6 +616,16 @@ private:
+ else //=> BaseFolderPair
+ groupParentFolder = AFS::getDisplayPath(pdi.fsObj->base().getAbstractPath<side>());
+ break;
++ case ItemPathFormat::traditional:
++ if (auto groupFolder = dynamic_cast<const FolderPair*>(pdi.folderGroupObj))
++ {
++ groupName = utfTo<std::wstring>(groupFolder->template getItemName<side>());
++ groupParentFolder = AFS::getDisplayPath(groupFolder->parent().template getAbstractPath<side>()) + \
++ FILE_NAME_SEPARATOR + utfTo<std::wstring>(groupFolder->template getItemName<side>());
++ }
++ else //=> BaseFolderPair
++ groupParentFolder = AFS::getDisplayPath(pdi.fsObj->base().getAbstractPath<side>());
++ 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<HoverAreaGroup>(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
bgstack15