summaryrefslogtreecommitdiff
path: root/freefilesync/debian/patches/ffs_traditional_view.patch
blob: fe04e26bc8e10101dbf985ceabf8e4d42db902e6 (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
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
Version: 12.3
Date: 2023-05-19
Author: bgstack15@gmail.com
Message: restore a traditional view to FreeFileSync, and disable "welcomeShownVersion" About dialog
--- a/FreeFileSync/Source/ui/file_grid.cpp
+++ b/FreeFileSync/Source/ui/file_grid.cpp
@@ -474,8 +474,10 @@ private:
                         case ItemPathFormat::name:
                             return utfTo<std::wstring>(fsObj->getItemName<side>());
                         case ItemPathFormat::relative:
+                        case ItemPathFormat::tradrel:
                             return utfTo<std::wstring>(fsObj->getRelativePath<side>());
                         case ItemPathFormat::full:
+                        case ItemPathFormat::traditional:
                             return AFS::getDisplayPath(fsObj->getAbstractPath<side>());
                     }
 
@@ -535,8 +537,13 @@ private:
         else
             GridData::renderRowBackgound(dc, rect, row, true /*enabled*/, true /*selected*/, rowHover);
 
+        // trad patch section for removing lines around items in grid
+        int lineWidth { fastFromDIP(1) } ;
+        if (itemPathFormat_ == ItemPathFormat::traditional || itemPathFormat_ == ItemPathFormat::tradrel)
+            lineWidth = 0;
+
         //----------------------------------------------------------------------------------
-        const wxRect rectLine(rect.x, rect.y + rect.height - fastFromDIP(1), rect.width, fastFromDIP(1));
+        const wxRect rectLine(rect.x, rect.y + rect.height - lineWidth, rect.width, lineWidth);
         clearArea(dc, rectLine, row == pdi.groupLastRow - 1 /*last group item*/ ?
                   getColorGridLine() : getDefaultBackgroundColorAlternating(pdi.groupIdx % 2 != 0));
     }
@@ -642,6 +649,26 @@ 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;
+
+            case ItemPathFormat::tradrel:
+                if (pdi.folderGroupObj)
+                {
+                    groupName         = utfTo<std::wstring>(pdi.folderGroupObj->template getItemName    <side>());
+                    groupParentFolder = utfTo<std::wstring>(pdi.folderGroupObj->template getRelativePath<side>());
+                }
+                break;
+
         }
 
         //path components should follow the app layout direction and are NOT a single piece of text!
@@ -667,11 +694,38 @@ private:
         int       groupNameWidth    = groupName.empty() ? 0 : (gapSize_ + iconSize + gapSize_ + getTextExtentBuffered(dc, groupName).x);
         const int groupNameMinWidth = groupName.empty() ? 0 : (gapSize_ + iconSize + gapSize_ + ellipsisWidth);
 
-        const int groupSepWidth = (groupParentFolder.empty() && groupName.empty()) ? 0 : (2 * gapSize_ + fastFromDIP(1));
+        // trad patch section for removing lines around items in grid
+        // code duplication because this is a different scope!
+        int lineWidth { fastFromDIP(1) } ;
+        if (itemPathFormat_ == ItemPathFormat::traditional || itemPathFormat_ == ItemPathFormat::tradrel)
+            lineWidth = 0;
+
+        const int groupSepWidth = (groupParentFolder.empty() && groupName.empty()) ? 0 : (2 * gapSize_ + lineWidth);
 
         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
+        switch (itemPathFormat_)
+        {
+            case ItemPathFormat::traditional:
+            case ItemPathFormat::tradrel:
+                groupParentWidth -= groupNameWidth - getTextExtentBuffered(dc, utfTo<std::wstring>(FILE_NAME_SEPARATOR)).x;
+                if (!endsWith(groupParentFolder, L'/' ) && //e.g. ftp://server/
+                    !endsWith(groupParentFolder, L'\\') &&   /*e.g. C:\ */
+                    groupParentFolder.size() > 0 )
+                    groupParentFolder += contains(groupParentFolder, L'/') ? L'/' : (contains(groupParentFolder, L'\\') ? L'\\' : FILE_NAME_SEPARATOR);
+                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)
@@ -738,6 +792,11 @@ private:
             }
         }
 
+                // end of original section, and back to the trad patch!
+                break;
+        }
+        // and end the addition for trad patch
+
         return
         {
             itemName,
@@ -878,6 +937,9 @@ private:
                     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)
@@ -901,6 +963,11 @@ private:
                         rectGroupItems.width = 0;
                     }
 
+         // trad patch section for removing lines around items in grid
+        int lineWidth { fastFromDIP(1) } ;
+        if (itemPathFormat_ == ItemPathFormat::traditional || itemPathFormat_ == ItemPathFormat::tradrel)
+            lineWidth = 0;
+
                     //-------------------------------------------------------------------------
                     {
                         //clear background below parent path => harmonize with renderRowBackgound()
@@ -911,8 +978,9 @@ private:
                             wxRect rectGroupBack = rectGroup;
                             rectGroupBack.width += 2 * gapSize_; //include gap before vline
 
-                            if (row == pdi.groupLastRow - 1 /*last group item*/) //preserve the group separation line!
-                                rectGroupBack.height -= fastFromDIP(1);
+                           if (row == pdi.groupLastRow - 1 /*last group item*/) //preserve the group separation line!
+                              if (itemPathFormat_ != ItemPathFormat::traditional && itemPathFormat_ != ItemPathFormat::tradrel)
+                                rectGroupBack.height -= lineWidth;
 
                             clearArea(dc, rectGroupBack, getDefaultBackgroundColorAlternating(pdi.groupIdx % 2 == 0));
                             //clearArea() is surprisingly expensive => call just once!
@@ -920,9 +988,9 @@ private:
                             //accessibility: always set *both* foreground AND background colors!
                         }
 
-                        if (!groupParentFolder.empty() &&
+                        if (itemPathFormat_ == ItemPathFormat::traditional || itemPathFormat_ == ItemPathFormat::tradrel || (!groupParentFolder.empty() &&
                             (( stackedGroupRender && row == groupFirstRow + 1) ||
-                             (!stackedGroupRender && row == groupFirstRow)) &&
+                             (!stackedGroupRender && row == groupFirstRow))) &&
                             (groupName.empty() || !pdi.folderGroupObj->isEmpty<side>())) //don't show for missing folders
                         {
                             tryDrawNavMarker(rectGroupParent);
@@ -934,14 +1002,14 @@ private:
                             drawCellText(dc, rectGroupParentText, groupParentFolder, wxALIGN_LEFT | wxALIGN_CENTER_VERTICAL, &getTextExtentBuffered(dc, groupParentFolder));
                         }
 
-                        if (!groupName.empty() &&
+                        if (!(itemPathFormat_ == ItemPathFormat::traditional || itemPathFormat_ == ItemPathFormat::tradrel) && !groupName.empty() &&
                             row == groupFirstRow)
                         {
                             wxRect rectGroupNameBack = rectGroupName;
 
                             if (!itemName.empty())
                                 rectGroupNameBack.width += 2 * gapSize_; //include gap left of item vline
-                            rectGroupNameBack.height -= fastFromDIP(1); //harmonize with item separation lines
+                            rectGroupNameBack.height -= lineWidth; //harmonize with item separation lines
 
                             wxDCTextColourChanger textColorGroupName(dc);
                             //folder background: coordinate with renderRowBackgound()
@@ -985,16 +1053,16 @@ private:
                             rectGroupItems.x     += 2 * gapSize_;
                             rectGroupItems.width -= 2 * gapSize_;
 
-                            wxDCPenChanger dummy(dc, wxPen(getColorGridLine(), fastFromDIP(1)));
+                            wxDCPenChanger dummy(dc, wxPen(getColorGridLine(), lineWidth));
                             dc.DrawLine(rectGroupItems.GetTopLeft(), rectGroupItems.GetBottomLeft() + wxPoint(0, 1)); //draws half-open range!
 
-                            rectGroupItems.x     += fastFromDIP(1);
-                            rectGroupItems.width -= fastFromDIP(1);
+                            rectGroupItems.x     += lineWidth;
+                            rectGroupItems.width -= lineWidth;
                         }
                         //-------------------------------------------------------------------------
 
                         wxRect rectItemsBack = rectGroupItems;
-                        rectItemsBack.height -= fastFromDIP(1); //preserve item separation lines!
+                        rectItemsBack.height -= lineWidth; //preserve item separation lines!
 
                         drawCudHighlight(rectItemsBack, pdi.fsObj->getSyncOperation());
                         tryDrawNavMarker(rectGroupItems);
@@ -1125,7 +1193,12 @@ private:
                              groupNameWidth] = getGroupRenderLayout(dc, row, pdi, insanelyHugeWidth);
                 assert(!stackedGroupRender);
 
-                const int groupSepWidth = (groupParentFolder.empty() && groupName.empty()) ? 0 : (2 * gapSize_ + fastFromDIP(1));
+         // trad patch section for removing lines around items in grid
+        int lineWidth { fastFromDIP(1) } ;
+        if (itemPathFormat_ == ItemPathFormat::traditional || itemPathFormat_ == ItemPathFormat::tradrel)
+            lineWidth = 0;
+
+               const int groupSepWidth = (groupParentFolder.empty() && groupName.empty()) ? 0 : (2 * gapSize_ + lineWidth);
                 const int fileIconWidth = getIconManager().getIconBuffer() ? gapSize_ + getIconManager().getIconSize() : 0;
                 const int ellipsisWidth = getTextExtentBuffered(dc, ELLIPSIS).x;
                 const int itemWidth = itemName.empty() ? 0 :
@@ -1157,6 +1230,10 @@ private:
                         return _("Relative path");
                     case ItemPathFormat::full:
                         return _("Full path");
+                    case ItemPathFormat::traditional:
+                        return _("Traditional");
+                    case ItemPathFormat::tradrel:
+                        return _("Trad. relative");
                 }
                 assert(false);
                 break;
@@ -1414,7 +1491,8 @@ private:
             GridData::renderRowBackgound(dc, rect, row, true /*enabled*/, true /*selected*/, rowHover);
 
         //----------------------------------------------------------------------------------
-        const wxRect rectLine(rect.x, rect.y + rect.height - fastFromDIP(1), rect.width, fastFromDIP(1));
+        // just hardcoding this in this trad patch, because itempathFormat_ is not available in this scope.
+        const wxRect rectLine(rect.x, rect.y + rect.height - 0, rect.width, 0);
         clearArea(dc, rectLine, row == pdi.groupLastRow - 1 /*last group item*/ ?
                   getColorGridLine() : getDefaultBackgroundColorAlternating(pdi.groupIdx % 2 != 0));
     }
@@ -1438,7 +1516,8 @@ private:
                 {
                     wxRect rectBack = rect;
                     if (row == pdi.groupLastRow - 1 /*last group item*/) //preserve the group separation line!
-                        rectBack.height -= fastFromDIP(1);
+                        // just hardcoding this in this trad patch, because itempathFormat_ is not available in this scope.
+                        rectBack.height -= 0;
 
                     clearArea(dc, rectBack, col);
                 }
--- a/FreeFileSync/Source/ui/file_grid_attr.h
+++ b/FreeFileSync/Source/ui/file_grid_attr.h
@@ -79,6 +79,8 @@ enum class ItemPathFormat
     name,
     relative,
     full,
+    traditional,
+    tradrel,
 };
 
 const ItemPathFormat defaultItemPathFormatLeftGrid  = ItemPathFormat::relative;
--- a/FreeFileSync/Source/ui/main_dlg.cpp
+++ b/FreeFileSync/Source/ui/main_dlg.cpp
@@ -448,7 +448,6 @@ void MainDialog::create(const Zstring& g
 
         //showAboutDialog(mainDlg); => dialog centered incorrectly (Centos), or hidden behind main dialog (Lubuntu) https://freefilesync.org/forum/viewtopic.php?t=10246
         //mainDlg->CallAfter([mainDlg] { showAboutDialog(mainDlg); }); => dialog centered incorrectly (Windows, Centos)
-        mainDlg->guiQueue_.processAsync([] {}, [mainDlg]() { showAboutDialog(mainDlg); }); //apparently oh-kay?
     }
 
 
@@ -2777,6 +2776,8 @@ void MainDialog::onGridLabelContextRim(G
     addFormatEntry(_("Item name"    ), ItemPathFormat::name);
     addFormatEntry(_("Relative path"), ItemPathFormat::relative);
     addFormatEntry(_("Full path"    ), ItemPathFormat::full);
+    addFormatEntry(_("Traditional"  ), ItemPathFormat::traditional);
+    addFormatEntry(_("Trad. relative"),ItemPathFormat::tradrel);
 
     //----------------------------------------------------------------------------------------------
     auto setIconSize = [&](GridIconSize sz, bool showIcons)
--- a/FreeFileSync/Source/config.cpp
+++ b/FreeFileSync/Source/config.cpp
@@ -495,6 +495,12 @@ void writeText(const ItemPathFormat& val
         case ItemPathFormat::full:
             output = "Full";
             break;
+        case ItemPathFormat::traditional:
+            output = "Traditional";
+            break;
+        case ItemPathFormat::tradrel:
+            output = "Trad. relative";
+            break;
     }
 }
 
@@ -508,6 +514,10 @@ bool readText(const std::string& input,
         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;
--- a/FreeFileSync/Source/ui/file_view.cpp
+++ b/FreeFileSync/Source/ui/file_view.cpp
@@ -798,11 +798,13 @@ void FileView::sortView(ColumnTypeRim ty
                     break;
 
                 case ItemPathFormat::relative:
+                case ItemPathFormat::tradrel:
                     if      ( ascending) std::sort(sortedRef_.begin(), sortedRef_.end(), LessRelativeFolder<true >(folderPairs_));
                     else if (!ascending) std::sort(sortedRef_.begin(), sortedRef_.end(), LessRelativeFolder<false>(folderPairs_));
                     break;
 
                 case ItemPathFormat::full:
+                case ItemPathFormat::traditional:
                     if      ( ascending &&  onLeft) std::sort(sortedRef_.begin(), sortedRef_.end(), LessFullPath<true,   SelectSide::left>(folderPairs_));
                     else if ( ascending && !onLeft) std::sort(sortedRef_.begin(), sortedRef_.end(), LessFullPath<true,  SelectSide::right>(folderPairs_));
                     else if (!ascending &&  onLeft) std::sort(sortedRef_.begin(), sortedRef_.end(), LessFullPath<false,  SelectSide::left>(folderPairs_));
bgstack15