summaryrefslogtreecommitdiff
path: root/freefilesync/debian/patches/ffs_traditional_view.patch
blob: e60203373829006ce50d8006fb939d5ed6fda964 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
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 -x .git -Naur 11.1-1/FreeFileSync/Source/config.cpp 11.1-2/FreeFileSync/Source/config.cpp
--- 11.1-1/FreeFileSync/Source/config.cpp	2020-09-01 19:07:43.715122167 -0400
+++ 11.1-2/FreeFileSync/Source/config.cpp	2020-09-10 09:38:14.539542699 -0400
@@ -528,6 +528,9 @@
         case ItemPathFormat::full:
             output = "Full";
             break;
+        case ItemPathFormat::traditional:
+            output = "Traditional";
+            break;
     }
 }
 
@@ -541,6 +545,8 @@
         value = ItemPathFormat::relative;
     else if (tmp == "Full")
         value = ItemPathFormat::full;
+    else if (tmp == "Traditional")
+        value = ItemPathFormat::traditional;
     else
         return false;
     return true;
diff -x .git -Naur 11.1-1/FreeFileSync/Source/ui/file_view.cpp 11.1-2/FreeFileSync/Source/ui/file_view.cpp
--- 11.1-1/FreeFileSync/Source/ui/file_view.cpp	2020-09-01 19:07:43.719122215 -0400
+++ 11.1-2/FreeFileSync/Source/ui/file_view.cpp	2020-09-10 09:40:11.609044834 -0400
@@ -798,6 +798,7 @@
                     break;
 
                 case ItemPathFormat::full:
+                case ItemPathFormat::traditional:
                     if      ( ascending &&  onLeft) std::sort(sortedRef_.begin(), sortedRef_.end(), LessFullPath<true,   LEFT_SIDE>(folderPairs_));
                     else if ( ascending && !onLeft) std::sort(sortedRef_.begin(), sortedRef_.end(), LessFullPath<true,  RIGHT_SIDE>(folderPairs_));
                     else if (!ascending &&  onLeft) std::sort(sortedRef_.begin(), sortedRef_.end(), LessFullPath<false,  LEFT_SIDE>(folderPairs_));
bgstack15