summaryrefslogtreecommitdiff
path: root/freefilesync/debian/patches/ffs_traditional_view.patch
diff options
context:
space:
mode:
Diffstat (limited to 'freefilesync/debian/patches/ffs_traditional_view.patch')
-rw-r--r--freefilesync/debian/patches/ffs_traditional_view.patch180
1 files changed, 111 insertions, 69 deletions
diff --git a/freefilesync/debian/patches/ffs_traditional_view.patch b/freefilesync/debian/patches/ffs_traditional_view.patch
index c74bef2..188a6a2 100644
--- a/freefilesync/debian/patches/ffs_traditional_view.patch
+++ b/freefilesync/debian/patches/ffs_traditional_view.patch
@@ -6,9 +6,26 @@ Message:
13.4 file_grip.cpp. The changes to file_grid.cpp were too extensive for my
intended level of effort. This means that this patch undoes the bullet point
"Wrap file grid folder paths instead of truncate" in the Latest Changes.
---- a/FreeFileSync/Source/ui/file_grid.cpp 2024-04-02 09:18:16.161133752 -0400
-+++ b/FreeFileSync/Source/ui/file_grid.cpp 2024-04-03 16:56:12.513543859 -0400
-@@ -308,8 +308,7 @@
+--- a/FreeFileSync/Source/ui/file_grid.cpp
++++ b/FreeFileSync/Source/ui/file_grid.cpp
+@@ -5,13 +5,13 @@
+ // *****************************************************************************
+
+ #include "file_grid.h"
+-//#include <set>
++#include <set>
+ #include <wx/dc.h>
+ #include <wx/settings.h>
+ #include <wx/timer.h>
+ #include <zen/i18n.h>
+-//#include <zen/file_error.h>
+-//#include <zen/format_unit.h>
++#include <zen/file_error.h>
++#include <zen/format_unit.h>
+ #include <zen/scope_guard.h>
+ #include <wx+/tooltip.h>
+ #include <wx+/rtl.h>
+@@ -308,8 +308,7 @@ struct SharedComponents //...between left, center, and right grids
NavigationMarker navMarker;
std::unique_ptr<GridEventManager> evtMgr;
GridViewType gridViewType = GridViewType::action;
@@ -18,7 +35,7 @@ Message:
};
//########################################################################################################
-@@ -352,7 +351,7 @@
+@@ -352,57 +351,18 @@ public:
const FileSystemObject* getFsObject(size_t row) const { return getDataView().getFsObject(row); }
@@ -27,11 +44,13 @@ Message:
{
auto& compExtentsBuf = sharedComp_.ref().compExtentsBuf_;
//- only used for parent path names and file names on view => should not grow "too big"
-@@ -360,47 +359,10 @@
+ //- cleaned up during GridDataBase::setData()
+- assert(!contains(text, L'\n'));
auto it = compExtentsBuf.find(text);
if (it == compExtentsBuf.end())
- it = compExtentsBuf.emplace(text, dc.GetTextExtent(copyStringTo<wxString>(text))).first;
+- //GetTextExtent() returns (0, 0) for empty string!
+ it = compExtentsBuf.emplace(text, dc.GetTextExtent(text)).first;
return it->second;
}
@@ -76,7 +95,7 @@ Message:
private:
size_t getRowCount() const override { return getDataView().rowsOnView(); }
-@@ -525,8 +487,10 @@
+@@ -527,8 +487,10 @@ private:
case ItemPathFormat::name:
return utfTo<std::wstring>(fsObj->getItemName<side>());
case ItemPathFormat::relative:
@@ -87,7 +106,7 @@ Message:
return AFS::getDisplayPath(fsObj->getAbstractPath<side>());
}
-@@ -586,11 +550,14 @@
+@@ -588,11 +550,14 @@ private:
else
GridData::renderRowBackgound(dc, rect, row, true /*enabled*/, true /*selected*/, rowHover);
@@ -105,7 +124,7 @@ Message:
getColorGridLine() : getDefaultBackgroundColorAlternating(pdi.groupIdx % 2 != 0));
}
-@@ -612,18 +579,18 @@
+@@ -614,18 +579,18 @@ private:
if (itemNamesWidth < 0)
{
itemNamesWidth = 0;
@@ -127,14 +146,14 @@ Message:
if (!itemWidths.empty())
{
-@@ -641,15 +608,17 @@
+@@ -643,15 +608,17 @@ private:
}
- struct GroupRowLayout
+ struct GroupRenderLayout
{
-- std::wstring groupParentPart; //... if distributed over multiple rows, otherswise full group parent folder
+- std::wstring groupParentPart; //... if distributed over multiple rows, otherwise full group parent folder
- std::wstring groupName; //only filled for first row of a group
std::wstring itemName;
+ std::wstring groupName;
@@ -149,7 +168,7 @@ Message:
{
assert(pdi.fsObj);
-@@ -657,15 +626,14 @@
+@@ -659,15 +626,14 @@ private:
const int iconSize = getIconManager().getIconWxsize();
//--------------------------------------------------------------------
@@ -162,12 +181,12 @@ Message:
//exception for readability: top row is always group start!
const size_t groupFirstRow = std::max<size_t>(pdi.groupFirstRow, refGrid().getRowAtWinPos(0));
-- const size_t groupLineCount = pdi.groupLastRow - groupFirstRow;
+- const size_t groupRowCount = pdi.groupLastRow - groupFirstRow;
+ const bool multiItemGroup = pdi.groupLastRow - groupFirstRow > 1;
std::wstring itemName;
if (itemPathFormat_ == ItemPathFormat::name || //hack: show folder name in item colum since groupName/groupParentFolder are unused!
-@@ -697,140 +665,166 @@
+@@ -699,140 +665,166 @@ private:
else //=> BaseFolderPair
groupParentFolder = AFS::getDisplayPath(pdi.fsObj->base().getAbstractPath<side>());
break;
@@ -252,10 +271,9 @@ Message:
const int groupItemsMinWidth = groupSepWidth + (drawFileIcons ? gapSize_ + iconSize : 0) + gapSize_ + ellipsisWidth;
- std::wstring groupParentPart;
-- if (row == groupFirstRow)
-- groupParentPart = groupParentFolder;
+ // start trad patch
-+
+
+- //not enough space? => trim or render on multiple rows
+ // rearrange this one section
+ switch (itemPathFormat_)
+ {
@@ -274,19 +292,17 @@ Message:
+ // 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? => trim or render on multiple rows
++
+ //not enough space? => collapse
if (int excessWidth = groupParentWidth + groupNameWidth + groupItemsWidth - maxWidth;
excessWidth > 0)
{
-- const bool stackedGroupRender = !groupParentFolder.empty() && groupLineCount > 1; //group parent details on multiple rows
--
- //1. shrink group parent
- if (!groupParentFolder.empty())
+ if (multiItemGroup && !groupParentFolder.empty() && !groupName.empty())
{
-- const int groupParentMinWidth = stackedGroupRender && !groupName.empty() ? 0 : gapSize_ + ellipsisWidth;
+- const int groupParentMinWidth = !groupName.empty() && groupRowCount > 1 ? //group parent details (possibly) on multiple rows
+- 0 : gapSize_ + ellipsisWidth;
+ //1. render group components on two rows
+ stackedGroupRender = true;
@@ -312,9 +328,15 @@ Message:
+ int groupStackWidth = std::max(groupParentWidth, groupNameWidth);
+ excessWidth = groupStackWidth + groupItemsWidth - maxWidth;
-- if (stackedGroupRender)
+- //group parent details on multiple lines
+- if (!groupParentFolder.empty())
- {
-- size_t comp1Len = getPathTrimmedSize(dc, groupParentFolder, groupParentWidth - gapSize_ - arrowRightDownWidth);
+- //let's not waste empty row space for medium + large icon sizes: print multiple lines per row!
+- const int linesPerRow = std::max(refGrid().getRowHeight() / charHeight_, 1);
+-
+- size_t compPos = 0;
+- for (size_t i = groupFirstRow; i <= row; ++i)
+- for (int l = 0; l < linesPerRow; ++l)
+ if (excessWidth > 0)
+ {
+ //2. shrink group stack (group parent only)
@@ -324,70 +346,69 @@ Message:
+ excessWidth = groupStackWidth + groupItemsWidth - maxWidth;
+ }
+ if (excessWidth > 0)
-+ {
+ {
+- const size_t compLen = i == pdi.groupLastRow - 1 && l == linesPerRow - 1 ? //not enough rows to show remaining parent folder components?
+- groupParentFolder.size() - compPos : //=> append the rest: will be truncated with ellipsis
+- getPathTrimmedSize(dc, makeStringView(groupParentFolder.begin() + compPos, groupParentFolder.end()),
+- groupParentWidth + (i == groupFirstRow ? 0 : groupNameWidth) - gapSize_ - arrowRightDownWidth);
+ //3. shrink item rendering
+ groupItemsWidth = std::max(groupItemsWidth - excessWidth, groupItemsMinWidth);
+ excessWidth = groupStackWidth + groupItemsWidth - maxWidth;
-- if (!groupName.empty() &&
-- getTextExtentBuffered(dc, makeStringView(groupParentFolder.begin(), comp1Len)).x > groupParentWidth - gapSize_ - arrowRightDownWidth)
-- comp1Len = 0; //exception: never truncate parent component on first row, but move to second row instead
+- if (i == groupFirstRow && !groupName.empty() && groupRowCount > 1 &&
+- getTextExtentBuffered(dc, makeStringView(groupParentFolder.begin() + compPos, compLen)).x > groupParentWidth - gapSize_ - arrowRightDownWidth)
+ if (excessWidth > 0)
-+ {
+ {
+- if (i == row && l != 0)
+- groupParentPart.insert(groupParentPart.begin(), linesPerRow - l, L'\n'); //effectively: "align bottom" for first row
+- break; //exception: never truncate parent component on first row, but continue on second row instead
+- }
+-
+- if (i == row)
+- groupParentPart += compPos + compLen == groupParentFolder.size() ?
+- groupParentFolder.substr(compPos) :
+- groupParentFolder.substr(compPos, compLen) + rightArrowDown_ + L'\n';
+- compPos += compLen;
+ //4. shrink group stack
+ groupStackWidth = std::max({groupStackWidth - excessWidth, groupNameMinWidth, groupParentMinWidth});
-- if (row == groupFirstRow)
+- if (compPos == groupParentFolder.size())
+- goto break2;
+ groupParentWidth = std::min(groupParentWidth, groupStackWidth);
+ groupNameWidth = std::min(groupNameWidth, groupStackWidth);
+ }
-+ }
+ }
+-break2:
+- if (endsWith(groupParentPart, L'\n'))
+- groupParentPart.pop_back();
+ }
+ }
+ else //group details on single row
+ {
+ //1. shrink group parent
+ if (!groupParentFolder.empty())
- {
-- groupParentPart = groupParentFolder.substr(0, comp1Len);
--
-- if (comp1Len != 0 && comp1Len != groupParentFolder.size())
-- groupParentPart += rightArrowDown_;
++ {
+ const int groupParentMinWidth = gapSize_ + ellipsisWidth;
+ groupParentWidth = std::max(groupParentWidth - excessWidth, groupParentMinWidth);
+ excessWidth = groupParentWidth + groupNameWidth + groupItemsWidth - maxWidth;
- }
-- else
++ }
+ if (excessWidth > 0)
- {
-- size_t compPos = comp1Len;
--
-- for (size_t i = groupFirstRow + 1; ; ++i)
-- {
-- const size_t compLen = getPathTrimmedSize(dc, makeStringView(groupParentFolder.begin() + compPos, groupParentFolder.end()),
-- groupParentWidth + groupNameWidth - gapSize_ - arrowRightDownWidth);
-- if (row == i)
-- {
-- groupParentPart = compPos + compLen == groupParentFolder.size() ||
-- row == pdi.groupLastRow - 1 ? //not enough rows to show all parent folder components?
-- groupParentFolder.substr(compPos) : //=> append to last row => will be truncated with ellipsis
-- groupParentFolder.substr(compPos, compLen) + rightArrowDown_;
-- break;
-- }
-- compPos += compLen;
++ {
+ //2. shrink item rendering
+ groupItemsWidth = std::max(groupItemsWidth - excessWidth, groupItemsMinWidth);
+ excessWidth = groupParentWidth + groupNameWidth + groupItemsWidth - maxWidth;
-
-- if (compPos == groupParentFolder.size())
-- break;
-- }
++
+ if (excessWidth > 0)
+ //3. shrink group name
+ if (!groupName.empty())
+ groupNameWidth = std::max(groupNameWidth - excessWidth, groupNameMinWidth);
- }
++ }
}
+- }
+- else
+- {
+- if (row == groupFirstRow)
+- groupParentPart = groupParentFolder;
}
- //path components should follow the app layout direction and are NOT a single piece of text!
@@ -422,7 +443,7 @@ Message:
void renderCell(wxDC& dc, const wxRect& rect, size_t row, ColumnType colType, bool enabled, bool selected, HoverArea rowHover) override
{
//-----------------------------------------------
-@@ -947,43 +941,62 @@
+@@ -949,43 +941,62 @@ break2:
};
//-------------------------------------------------------------------------
@@ -493,7 +514,7 @@ Message:
clearArea(dc, rectGroupBack, getDefaultBackgroundColorAlternating(pdi.groupIdx % 2 == 0));
//clearArea() is surprisingly expensive => call just once!
-@@ -991,18 +1004,22 @@
+@@ -993,31 +1004,22 @@ break2:
//accessibility: always set *both* foreground AND background colors!
}
@@ -509,9 +530,21 @@ Message:
wxRect rectGroupParentText = rectGroupParent;
rectGroupParentText.x += gapSize_;
- rectGroupParentText.width -= gapSize_;
-- drawCellText(dc, rectGroupParentText, groupParentPart, wxALIGN_LEFT | wxALIGN_CENTER_VERTICAL, &getTextExtentBuffered(dc, groupParentPart));
+ rectGroupParentText.width -= stackedGroupRender ? gapSize_ + gapSizeWide_ : gapSize_;
-+
+
+- //let's not waste empty row space for medium + large icon sizes: print multiple lines per row!
+- split(groupParentPart, L'\n', [&, linesPerRow = std::max(refGrid().getRowHeight() / charHeight_, 1),
+- lineNo = 0](const std::wstring_view line) mutable
+- {
+- drawCellText(dc, {
+- rectGroupParentText.x, //distribute lines evenly across multiple rows:
+- rectGroupParentText.y + (rectGroupParentText.height * (1 + lineNo++ * 2) - linesPerRow * charHeight_) / (linesPerRow * 2),
+- rectGroupParentText.width, charHeight_
+- }, line, wxALIGN_LEFT | wxALIGN_CENTER_VERTICAL, &getTextExtentBuffered(dc, line));
+- });
+-#if 0
+- drawCellText(dc, rectGroupParentText, groupParentPart, wxALIGN_LEFT | wxALIGN_CENTER_VERTICAL, &getTextExtentBuffered(dc, groupParentPart));
+-#endif
+ drawCellText(dc, rectGroupParentText, groupParentFolder, wxALIGN_LEFT | wxALIGN_CENTER_VERTICAL, &getTextExtentBuffered(dc, groupParentFolder));
}
@@ -521,7 +554,7 @@ Message:
{
wxRect rectGroupNameBack = rectGroupName;
-@@ -1047,7 +1064,7 @@
+@@ -1062,7 +1064,7 @@ break2:
if (!itemName.empty())
{
//draw group/items separation line
@@ -530,7 +563,7 @@ Message:
{
rectGroupItems.x += 2 * gapSize_;
rectGroupItems.width -= 2 * gapSize_;
-@@ -1150,15 +1167,18 @@
+@@ -1165,15 +1167,18 @@ break2:
if (const FileView::PathDrawInfo pdi = getDataView().getDrawInfo(row);
pdi.fsObj)
{
@@ -554,7 +587,7 @@ Message:
if (groupNameCellBeginX <= cellRelativePosX && cellRelativePosX < groupNameCellBeginX + groupNameWidth + 2 * gapSize_ /*include gap before vline*/)
return static_cast<HoverArea>(HoverAreaGroup::groupName);
-@@ -1181,13 +1201,22 @@
+@@ -1196,13 +1201,22 @@ break2:
/* ________________________ ___________________________________ _____________________________________________________
| (gap | group parent) | | (gap | icon | gap | group name) | | (2x gap | vline) | (gap | icon) | gap | item name |
------------------------ ----------------------------------- ----------------------------------------------------- */
@@ -581,7 +614,7 @@ Message:
const int fileIconWidth = getIconManager().getIconBuffer() ? gapSize_ + getIconManager().getIconWxsize() : 0;
const int ellipsisWidth = getTextExtentBuffered(dc, ELLIPSIS).x;
const int itemWidth = itemName.empty() ? 0 :
-@@ -1219,6 +1248,10 @@
+@@ -1234,6 +1248,10 @@ break2:
return _("Relative path");
case ItemPathFormat::full:
return _("Full path");
@@ -592,7 +625,16 @@ Message:
}
assert(false);
break;
-@@ -1341,11 +1374,6 @@
+@@ -1348,8 +1366,6 @@ break2:
+ const int gapSize_ = dipToWxsize(FILE_GRID_GAP_SIZE_DIP);
+ const int gapSizeWide_ = dipToWxsize(FILE_GRID_GAP_SIZE_WIDE_DIP);
+
+- const int charHeight_ = refGrid().getMainWin().GetCharHeight();
+-
+ ItemPathFormat itemPathFormat_ = ItemPathFormat::full;
+
+ std::vector<unsigned char> failedLoads_; //effectively a vector<bool> of size "number of rows"
+@@ -1358,11 +1374,6 @@ break2:
const std::wstring bslashBidi_ = (wxTheApp->GetLayoutDirection() == wxLayout_RightToLeft ? RTL_MARK : LTR_MARK) + std::wstring(L"\\");
//no need for LTR/RTL marks on both sides: text follows main direction if slash is between two strong characters with different directions
@@ -604,7 +646,7 @@ Message:
std::vector<int> groupItemNamesWidthBuf_; //buffer! groupItemNamesWidths essentially only depends on (groupIdx, side)
uint64_t viewUpdateIdLast_ = 0; //
};
-@@ -1481,6 +1509,7 @@
+@@ -1498,6 +1509,7 @@ private:
GridData::renderRowBackgound(dc, rect, row, true /*enabled*/, true /*selected*/, rowHover);
//----------------------------------------------------------------------------------
@@ -612,7 +654,7 @@ Message:
const wxRect rectLine(rect.x, rect.y + rect.height - dipToWxsize(1), rect.width, dipToWxsize(1));
clearArea(dc, rectLine, row == pdi.groupLastRow - 1 /*last group item*/ ?
getColorGridLine() : getDefaultBackgroundColorAlternating(pdi.groupIdx % 2 != 0));
-@@ -1505,6 +1534,7 @@
+@@ -1522,6 +1534,7 @@ private:
{
wxRect rectBack = rect;
if (row == pdi.groupLastRow - 1 /*last group item*/) //preserve the group separation line!
bgstack15