* @brief Get text for specified column. * This function retrieves the text for the specified colum. Text is * retrieved by using column-specific handler functions. * @param [in] pCtxt Compare context. * @param [in] col Column number. * @param [in] di Difference data. * @return Text for the specified column. */
| 1856 | * @return Text for the specified column. |
| 1857 | */ |
| 1858 | String |
| 1859 | DirViewColItems::ColGetTextToDisplay(const CDiffContext *pCtxt, int col, |
| 1860 | const DIFFITEM &di) const |
| 1861 | { |
| 1862 | // Custom properties have custom get functions |
| 1863 | const DirColInfo * pColInfo = GetDirColInfo(col); |
| 1864 | if (pColInfo == nullptr) |
| 1865 | { |
| 1866 | assert(false); // fix caller, should not ask for nonexistent columns |
| 1867 | return _T("???"); |
| 1868 | } |
| 1869 | ColGetFncPtrType fnc = pColInfo->getfnc; |
| 1870 | size_t offset = pColInfo->offset; |
| 1871 | String s = (*fnc)(pCtxt, reinterpret_cast<const char *>(&di) + offset, pColInfo->opt); |
| 1872 | |
| 1873 | // Add '*' to newer time field |
| 1874 | if (IsColLmTime(col) || IsColMmTime(col) || IsColRmTime(col)) |
| 1875 | { |
| 1876 | if (m_nDirs < 3) |
| 1877 | { |
| 1878 | if (di.diffFileInfo[0].mtime != 0 || di.diffFileInfo[1].mtime != 0) |
| 1879 | { |
| 1880 | if |
| 1881 | ( |
| 1882 | IsColLmTime(col) && di.diffFileInfo[0].mtime > di.diffFileInfo[1].mtime // Left modification time |
| 1883 | || IsColRmTime(col) && di.diffFileInfo[0].mtime < di.diffFileInfo[1].mtime // Right modification time |
| 1884 | ) |
| 1885 | { |
| 1886 | s.insert(0, _T("* ")); |
| 1887 | } |
| 1888 | else |
| 1889 | { |
| 1890 | s.insert(0, _T(" ")); // Looks best with a fixed-font, but not too bad otherwise |
| 1891 | } |
| 1892 | // GreyMerlin (14 Nov 2009) - the flagging of Date needs to be done with |
| 1893 | // something not involving extra characters. Perhaps <red> for oldest, |
| 1894 | // <green> for newest. Note (20 March 2017): the introduction of 3-Way |
| 1895 | // Merge and the yellow difference highlighting adds to the design |
| 1896 | // difficulty of any changes. So maybe this "* "/" " scheme is good enough. |
| 1897 | |
| 1898 | } |
| 1899 | } |
| 1900 | else |
| 1901 | { |
| 1902 | if (di.diffFileInfo[0].mtime != 0 || di.diffFileInfo[1].mtime != 0 || di.diffFileInfo[2].mtime != 0) |
| 1903 | { |
| 1904 | if |
| 1905 | ( |
| 1906 | IsColLmTime(col) && di.diffFileInfo[0].mtime > di.diffFileInfo[1].mtime && di.diffFileInfo[0].mtime > di.diffFileInfo[2].mtime // Left modification time |
| 1907 | || IsColMmTime(col) && di.diffFileInfo[1].mtime > di.diffFileInfo[0].mtime && di.diffFileInfo[1].mtime > di.diffFileInfo[2].mtime // Middle modification time |
| 1908 | || IsColRmTime(col) && di.diffFileInfo[2].mtime > di.diffFileInfo[0].mtime && di.diffFileInfo[2].mtime > di.diffFileInfo[1].mtime // Right modification time |
| 1909 | ) |
| 1910 | { |
| 1911 | s.insert(0, _T("* ")); |
| 1912 | } |
| 1913 | else |
| 1914 | { |
| 1915 | s.insert(0, _T(" ")); // Looks best with a fixed-font, but not too bad otherwise |
no test coverage detected