Version: 12.0 Date: 2023-01-23 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 @@ -473,8 +473,10 @@ private: case ItemPathFormat::name: return utfTo(fsObj->getItemName()); case ItemPathFormat::relative: + case ItemPathFormat::tradrel: return utfTo(fsObj->getRelativePath()); case ItemPathFormat::full: + case ItemPathFormat::traditional: return AFS::getDisplayPath(fsObj->getAbstractPath()); } @@ -534,8 +536,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)); } @@ -641,6 +648,26 @@ 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; + + case ItemPathFormat::tradrel: + if (pdi.folderGroupObj) + { + groupName = utfTo(pdi.folderGroupObj->template getItemName ()); + groupParentFolder = utfTo(pdi.folderGroupObj->template getRelativePath()); + } + break; + } //path components should follow the app layout direction and are NOT a single piece of text! @@ -666,11 +693,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(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) @@ -737,6 +791,11 @@ private: } } + // end of original section, and back to the trad patch! + break; + } + // and end the addition for trad patch + return { itemName, @@ -877,6 +936,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) @@ -900,6 +962,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() @@ -910,8 +977,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! @@ -919,9 +987,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())) //don't show for missing folders { tryDrawNavMarker(rectGroupParent); @@ -933,14 +1001,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() @@ -984,16 +1052,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); @@ -1124,7 +1192,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 : @@ -1156,6 +1229,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; @@ -1413,7 +1490,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)); } @@ -1437,7 +1515,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 @@ -439,7 +439,6 @@ void MainDialog::create(const Zstring& g if (mainDlg->globalCfg_.welcomeDialogLastVersion != ffsVersion) { mainDlg->globalCfg_.welcomeDialogLastVersion = ffsVersion; - showAboutDialog(mainDlg); } @@ -2765,6 +2764,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 @@ -494,6 +494,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; } } @@ -507,6 +513,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(folderPairs_)); else if (!ascending) std::sort(sortedRef_.begin(), sortedRef_.end(), LessRelativeFolder(folderPairs_)); break; case ItemPathFormat::full: + case ItemPathFormat::traditional: if ( ascending && onLeft) std::sort(sortedRef_.begin(), sortedRef_.end(), LessFullPath(folderPairs_)); else if ( ascending && !onLeft) std::sort(sortedRef_.begin(), sortedRef_.end(), LessFullPath(folderPairs_)); else if (!ascending && onLeft) std::sort(sortedRef_.begin(), sortedRef_.end(), LessFullPath(folderPairs_));