From c8e0e909b4a8d18319fc65434a10dc446434817c Mon Sep 17 00:00:00 2001 From: Daniel Wilhelm Date: Fri, 18 Apr 2014 17:19:49 +0200 Subject: 5.3 --- ui/custom_grid.cpp | 34 +++++++++++++++++++++------------- 1 file changed, 21 insertions(+), 13 deletions(-) (limited to 'ui/custom_grid.cpp') diff --git a/ui/custom_grid.cpp b/ui/custom_grid.cpp index 465a1b6f..fdb72161 100644 --- a/ui/custom_grid.cpp +++ b/ui/custom_grid.cpp @@ -91,6 +91,12 @@ std::pair getVisibleRows(Grid& grid) //returns range [from } +Zstring getExtension(const Zstring& shortName) +{ + return contains(shortName, Zchar('.')) ? afterLast(shortName, Zchar('.')) : Zstring(); +}; + + class IconUpdater; class GridEventManager; @@ -121,7 +127,6 @@ private: Grid& grid_; }; - //######################################################################################################## template @@ -254,6 +259,7 @@ private: struct GetTextValue : public FSObjectVisitor { GetTextValue(ColumnTypeRim colType, const FileSystemObject& fso) : colType_(colType), fsObj_(fso) {} + virtual void visit(const FileMapping& fileObj) { switch (colType_) @@ -279,7 +285,7 @@ private: value = zen::utcToLocalTimeString(fileObj.getLastWriteTime()); break; case COL_TYPE_EXTENSION: //file extension - value = toWx(fileObj.getExtension()); + value = toWx(getExtension(fileObj.getShortName())); break; } } @@ -309,7 +315,7 @@ private: value = zen::utcToLocalTimeString(linkObj.getLastWriteTime()); break; case COL_TYPE_EXTENSION: //file extension - value = wxEmptyString; + value = toWx(getExtension(linkObj.getShortName())); break; } } @@ -543,30 +549,32 @@ private: virtual wxString getToolTip(size_t row, ColumnType colType) const { wxString toolTip; + const FileSystemObject* fsObj = getRawData(row); if (fsObj && !fsObj->isEmpty()) { + toolTip = toWx(gridDataView_->getFolderPairCount() > 1 ? //gridDataView_ bound in this path + fsObj->getFullName() : + fsObj->getRelativeName()); + struct AssembleTooltip : public FSObjectVisitor { AssembleTooltip(wxString& tipMsg) : tipMsg_(tipMsg) {} virtual void visit(const FileMapping& fileObj) { - tipMsg_ = copyStringTo(std::wstring() + fileObj.getRelativeName() + L"\n" + - _("Size") + L": " + zen::filesizeToShortString(to(fileObj.getFileSize())) + L"\n" + - _("Date") + L": " + zen::utcToLocalTimeString(fileObj.getLastWriteTime())); + tipMsg_ += L"\n" + + _("Size") + L": " + zen::filesizeToShortString(to(fileObj.getFileSize())) + L"\n" + + _("Date") + L": " + zen::utcToLocalTimeString(fileObj.getLastWriteTime()); } virtual void visit(const SymLinkMapping& linkObj) { - tipMsg_ = copyStringTo(std::wstring() + linkObj.getRelativeName() + L"\n" + - _("Date") + L": " + zen::utcToLocalTimeString(linkObj.getLastWriteTime())); + tipMsg_ += L"\n" + + _("Date") + L": " + zen::utcToLocalTimeString(linkObj.getLastWriteTime()); } - virtual void visit(const DirMapping& dirObj) - { - tipMsg_ = toWx(dirObj.getRelativeName()); - } + virtual void visit(const DirMapping& dirObj) {} wxString& tipMsg_; } assembler(toolTip); @@ -700,7 +708,7 @@ public: { case BLOCKPOS_CHECK_BOX: { - const FileSystemObject* fsObj = getRawData(rowFrom); + const FileSystemObject* fsObj = getRawData(dragSelection->first); const bool setIncluded = fsObj ? !fsObj->isActive() : true; CheckRowsEvent evt(rowFrom, rowTo, setIncluded); -- cgit