1 // TortoiseSVN - a Windows shell extension for easy version control
3 // Copyright (C) 2008 - TortoiseSVN
5 // This program is free software; you can redistribute it and/or
6 // modify it under the terms of the GNU General Public License
7 // as published by the Free Software Foundation; either version 2
8 // of the License, or (at your option) any later version.
10 // This program is distributed in the hope that it will be useful,
11 // but WITHOUT ANY WARRANTY; without even the implied warranty of
12 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 // GNU General Public License for more details.
15 // You should have received a copy of the GNU General Public License
16 // along with this program; if not, write to the Free Software Foundation,
17 // 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
21 #include ".\resource.h"
22 #include "GitStatusListCtrl.h"
25 // registry version number of column-settings of GitLogListBase
26 #define BLAME_COLUMN_VERSION 4
29 #define assert(x) ATLASSERT(x)
31 // assign property list
34 PropertyList::operator= (const char* rhs
)
36 // do you really want to replace the property list?
38 assert (properties
.empty());
41 // add all properties in the list
43 while ((rhs
!= NULL
) && (*rhs
!= 0))
45 const char* next
= strchr (rhs
, ' ');
47 CString
name (rhs
, static_cast<int>(next
== NULL
? strlen (rhs
) : next
- rhs
));
48 properties
.insert (std::make_pair (name
, CString()));
50 rhs
= next
== NULL
? NULL
: next
+1;
58 // collect property names in a set
60 void PropertyList::GetPropertyNames (std::set
<CString
>& names
)
62 for ( CIT iter
= properties
.begin(), end
= properties
.end()
66 names
.insert (iter
->first
);
70 // get a property value.
72 CString
PropertyList::operator[](const CString
& name
) const
74 CIT iter
= properties
.find (name
);
76 return iter
== properties
.end()
81 // set a property value.
83 CString
& PropertyList::operator[](const CString
& name
)
85 return properties
[name
];
88 /// check whether that property has been set on this item.
90 bool PropertyList::HasProperty (const CString
& name
) const
92 return properties
.find (name
) != properties
.end();
95 // due to frequent use: special check for svn:needs-lock
97 bool PropertyList::IsNeedsLockSet() const
99 static const CString svnNeedsLock
= _T("svn:needs-lock");
100 return HasProperty (svnNeedsLock
);
106 void ColumnManager::ReadSettings
107 ( DWORD defaultColumns
109 , const CString
& containerName
114 DWORD selectedStandardColumns
= defaultColumns
& ~hideColumns
;
115 m_dwDefaultColumns
= defaultColumns
& ~hideColumns
;
117 columns
.resize (maxsize
);
119 for (size_t i
= 0; i
< maxsize
; ++i
)
121 columns
[i
].index
= static_cast<int>(i
);
123 columns
[i
].width
= 0;
125 columns
[i
].width
= widthlist
[i
];
126 columns
[i
].visible
= true;
127 columns
[i
].relevant
= !(hideColumns
& power
);
131 // userProps.clear();
133 // where the settings are stored within the registry
135 registryPrefix
= _T("Software\\TortoiseGit\\StatusColumns\\") + containerName
;
137 // we accept settings of current version only
138 bool valid
= (DWORD
)CRegDWORD (registryPrefix
+ _T("Version"), 0xff) == BLAME_COLUMN_VERSION
;
141 // read (possibly different) column selection
143 selectedStandardColumns
= CRegDWORD (registryPrefix
, selectedStandardColumns
) & ~hideColumns
;
145 // read user-prop lists
147 CString userPropList
= CRegString (registryPrefix
+ _T("UserProps"));
148 CString shownUserProps
= CRegString (registryPrefix
+ _T("ShownUserProps"));
150 ParseUserPropSettings (userPropList
, shownUserProps
);
152 // read column widths
154 CString colWidths
= CRegString (registryPrefix
+ _T("_Width"));
156 ParseWidths (colWidths
);
159 // process old-style visibility setting
161 SetStandardColumnVisibility (selectedStandardColumns
);
163 // clear all previously set header columns
165 int c
= ((CHeaderCtrl
*)(control
->GetDlgItem(0)))->GetItemCount()-1;
167 control
->DeleteColumn(c
--);
171 for (int i
= 0, count
= GetColumnCount(); i
< count
; ++i
)
172 control
->InsertColumn (i
, GetName(i
), LVCFMT_LEFT
, IsVisible(i
)&&IsRelevant(i
) ? -1 : GetVisibleWidth(i
, false));
174 // restore column ordering
177 ParseColumnOrder (CRegString (registryPrefix
+ _T("_Order")));
179 ParseColumnOrder (CString());
183 // auto-size the columns so we can see them while fetching status
184 // (seems the same values will not take affect in InsertColumn)
186 for (int i
= 0, count
= GetColumnCount(); i
< count
; ++i
)
188 control
->SetColumnWidth (i
, GetVisibleWidth (i
, true));
191 void ColumnManager::WriteSettings() const
193 CRegDWORD
regVersion (registryPrefix
+ _T("Version"), 0, TRUE
);
194 regVersion
= BLAME_COLUMN_VERSION
;
196 // write (possibly different) column selection
198 CRegDWORD
regStandardColumns (registryPrefix
, 0, TRUE
);
199 regStandardColumns
= GetSelectedStandardColumns();
201 // write user-prop lists
203 CRegString
regUserProps (registryPrefix
+ _T("UserProps"), CString(), TRUE
);
204 regUserProps
= GetUserPropList();
206 CRegString
regShownUserProps (registryPrefix
+ _T("ShownUserProps"), CString(), TRUE
);
207 regShownUserProps
= GetShownUserProps();
209 // write column widths
211 CRegString
regWidths (registryPrefix
+ _T("_Width"), CString(), TRUE
);
212 regWidths
= GetWidthString();
214 // write column ordering
216 CRegString
regColumnOrder (registryPrefix
+ _T("_Order"), CString(), TRUE
);
217 regColumnOrder
= GetColumnOrderString();
220 // read column definitions
222 int ColumnManager::GetColumnCount() const
224 return static_cast<int>(columns
.size());
227 bool ColumnManager::IsVisible (int column
) const
229 size_t index
= static_cast<size_t>(column
);
230 assert (columns
.size() > index
);
232 return columns
[index
].visible
;
235 int ColumnManager::GetInvisibleCount() const
237 int invisibleCount
= 0;
238 for (std::vector
<ColumnInfo
>::const_iterator it
= columns
.begin(); it
!= columns
.end(); ++it
)
243 return invisibleCount
;
246 bool ColumnManager::IsRelevant (int column
) const
248 size_t index
= static_cast<size_t>(column
);
249 assert (columns
.size() > index
);
251 return columns
[index
].relevant
;
254 bool ColumnManager::IsUserProp (int column
) const
256 size_t index
= static_cast<size_t>(column
);
257 assert (columns
.size() > index
);
259 return columns
[index
].index
>= SVNSLC_USERPROPCOLOFFSET
;
262 int ColumnManager::SetNames(UINT
* buffer
, int size
)
265 for(int i
=0;i
<size
;i
++)
266 itemName
.push_back(*buffer
++);
270 CString
ColumnManager::GetName (int column
) const
273 size_t index
= static_cast<size_t>(column
);
274 if (index
< itemName
.size())
277 result
.LoadString (itemName
[index
]);
283 // if (index < columns.size())
284 // return userProps[columns[index].index - SVNSLC_USERPROPCOLOFFSET].name;
291 int ColumnManager::GetWidth (int column
, bool useDefaults
) const
293 size_t index
= static_cast<size_t>(column
);
294 assert (columns
.size() > index
);
296 int width
= columns
[index
].width
;
297 if ((width
== 0) && useDefaults
)
298 width
= LVSCW_AUTOSIZE_USEHEADER
;
303 int ColumnManager::GetVisibleWidth (int column
, bool useDefaults
) const
305 return IsVisible (column
)
306 ? GetWidth (column
, useDefaults
)
310 // switch columns on and off
312 void ColumnManager::SetVisible
316 size_t index
= static_cast<size_t>(column
);
317 assert (index
< columns
.size());
319 if (columns
[index
].visible
!= visible
)
321 columns
[index
].visible
= visible
;
322 columns
[index
].relevant
|= visible
;
324 columns
[index
].width
= 0;
326 control
->SetColumnWidth (column
, GetVisibleWidth (column
, true));
329 control
->Invalidate (FALSE
);
333 // tracking column modifications
335 void ColumnManager::ColumnMoved (int column
, int position
)
337 // in front of what column has it been inserted?
339 int index
= columns
[column
].index
;
341 std::vector
<int> gridColumnOrder
= GetGridColumnOrder();
343 size_t visiblePosition
= static_cast<size_t>(position
);
344 size_t columnCount
= gridColumnOrder
.size();
346 for (; (visiblePosition
< columnCount
)
347 && !columns
[gridColumnOrder
[visiblePosition
]].visible
348 ; ++visiblePosition
)
353 if (visiblePosition
!= columnCount
)
355 next
= gridColumnOrder
[visiblePosition
];
358 // move logical column index just in front of that "next" column
360 columnOrder
.erase (std::find ( columnOrder
.begin(), columnOrder
.end(), index
));
361 columnOrder
.insert ( std::find ( columnOrder
.begin(), columnOrder
.end(), next
), index
);
363 // make sure, invisible columns are still put in front of all others
368 void ColumnManager::ColumnResized (int column
)
370 size_t index
= static_cast<size_t>(column
);
371 assert (index
< columns
.size());
372 assert (columns
[index
].visible
);
374 int width
= control
->GetColumnWidth (column
);
375 columns
[index
].width
= width
;
377 int propertyIndex
= columns
[index
].index
;
378 if (propertyIndex
>= SVNSLC_USERPROPCOLOFFSET
)
379 userProps
[propertyIndex
- SVNSLC_USERPROPCOLOFFSET
].width
= width
;
381 control
->Invalidate (FALSE
);
384 // call these to update the user-prop list
385 // (will also auto-insert /-remove new list columns)
387 void ColumnManager::UpdateUserPropList
388 (const std::vector
<FileEntry
*>& files
)
390 // collect all user-defined props
392 std::set
<CString
> aggregatedProps
;
393 for (size_t i
= 0, count
= files
.size(); i
< count
; ++i
)
394 files
[i
]->present_props
.GetPropertyNames (aggregatedProps
);
396 aggregatedProps
.erase (_T("svn:needs-lock"));
397 itemProps
= aggregatedProps
;
399 // add new ones to the internal list
401 std::set
<CString
> newProps
= aggregatedProps
;
402 for (size_t i
= 0, count
= userProps
.size(); i
< count
; ++i
)
403 newProps
.erase (userProps
[i
].name
);
405 while (newProps
.size() + userProps
.size()
406 > SVNSLC_MAXCOLUMNCOUNT
- SVNSLC_USERPROPCOLOFFSET
)
407 newProps
.erase (--newProps
.end());
409 typedef std::set
<CString
>::const_iterator CIT
;
410 for ( CIT iter
= newProps
.begin(), end
= newProps
.end()
414 int index
= static_cast<int>(userProps
.size())
415 + SVNSLC_USERPROPCOLOFFSET
;
416 columnOrder
.push_back (index
);
419 userProp
.name
= *iter
;
422 userProps
.push_back (userProp
);
425 // remove unused columns from control.
426 // remove used ones from the set of aggregatedProps.
428 for (size_t i
= columns
.size(); i
> 0; --i
)
429 if ((columns
[i
-1].index
>= SVNSLC_USERPROPCOLOFFSET
)
430 && (aggregatedProps
.erase (GetName ((int)i
-1)) == 0))
432 // this user-prop has not been set on any item
434 if (!columns
[i
-1].visible
)
436 control
->DeleteColumn (static_cast<int>(i
-1));
437 columns
.erase (columns
.begin() + i
-1);
441 // aggregatedProps now contains new columns only.
442 // we can't use newProps here because some props may have been used
443 // earlier but were not in the recent list of used props.
444 // -> they are neither in columns[] nor in newProps.
446 for ( CIT iter
= aggregatedProps
.begin(), end
= aggregatedProps
.end()
450 // get the logical column index / ID
454 for (size_t i
= 0, count
= userProps
.size(); i
< count
; ++i
)
455 if (userProps
[i
].name
== *iter
)
457 index
= static_cast<int>(i
) + SVNSLC_USERPROPCOLOFFSET
;
458 width
= userProps
[i
].width
;
462 assert (index
!= -1);
464 // find insertion position
466 std::vector
<ColumnInfo
>::iterator columnIter
= columns
.begin();
467 std::vector
<ColumnInfo
>::iterator end
= columns
.end();
468 for (; (columnIter
!= end
) && columnIter
->index
< index
; ++columnIter
);
469 int pos
= static_cast<int>(columnIter
- columns
.begin());
472 column
.index
= index
;
473 column
.width
= width
;
474 column
.visible
= false;
476 columns
.insert (columnIter
, column
);
480 int result
= control
->InsertColumn (pos
, *iter
, LVCFMT_LEFT
, GetVisibleWidth(pos
, false));
481 assert (result
!= -1);
482 UNREFERENCED_PARAMETER(result
);
485 // update column order
491 void ColumnManager::UpdateRelevance
492 ( const std::vector
<FileEntry
*>& files
493 , const std::vector
<size_t>& visibleFiles
)
495 // collect all user-defined props that belong to shown files
497 std::set
<CString
> aggregatedProps
;
498 for (size_t i
= 0, count
= visibleFiles
.size(); i
< count
; ++i
)
499 files
[visibleFiles
[i
]]->present_props
.GetPropertyNames (aggregatedProps
);
501 aggregatedProps
.erase (_T("svn:needs-lock"));
502 itemProps
= aggregatedProps
;
504 // invisible columns for unused props are not relevant
506 for (int i
= 0, count
= GetColumnCount(); i
< count
; ++i
)
507 if (IsUserProp(i
) && !IsVisible(i
))
510 = aggregatedProps
.find (GetName(i
)) != aggregatedProps
.end();
515 // don't clutter the context menu with irrelevant prop info
517 bool ColumnManager::AnyUnusedProperties() const
519 return columns
.size() < userProps
.size() + itemName
.size();
522 void ColumnManager::RemoveUnusedProps()
524 // determine what column indexes / IDs to keep.
525 // map them onto new IDs (we may delete some IDs in between)
527 std::map
<int, int> validIndices
;
528 int userPropID
= SVNSLC_USERPROPCOLOFFSET
;
530 for (size_t i
= 0, count
= columns
.size(); i
< count
; ++i
)
532 int index
= columns
[i
].index
;
534 if (itemProps
.find (GetName((int)i
)) != itemProps
.end()
535 || columns
[i
].visible
536 || index
< SVNSLC_USERPROPCOLOFFSET
)
538 validIndices
[index
] = index
< SVNSLC_USERPROPCOLOFFSET
544 // remove everything else:
546 // remove from columns and control.
547 // also update index values in columns
549 for (size_t i
= columns
.size(); i
> 0; --i
)
551 std::map
<int, int>::const_iterator iter
552 = validIndices
.find (columns
[i
-1].index
);
554 if (iter
== validIndices
.end())
556 control
->DeleteColumn (static_cast<int>(i
-1));
557 columns
.erase (columns
.begin() + i
-1);
561 columns
[i
-1].index
= iter
->second
;
565 // remove from user props
567 for (size_t i
= userProps
.size(); i
> 0; --i
)
569 int index
= static_cast<int>(i
)-1 + SVNSLC_USERPROPCOLOFFSET
;
570 if (validIndices
.find (index
) == validIndices
.end())
571 userProps
.erase (userProps
.begin() + i
-1);
574 // remove from and update column order
576 for (size_t i
= columnOrder
.size(); i
> 0; --i
)
578 std::map
<int, int>::const_iterator iter
579 = validIndices
.find (columnOrder
[i
-1]);
581 if (iter
== validIndices
.end())
582 columnOrder
.erase (columnOrder
.begin() + i
-1);
584 columnOrder
[i
-1] = iter
->second
;
588 // bring everything back to its "natural" order
590 void ColumnManager::ResetColumns (DWORD defaultColumns
)
592 // update internal data
594 std::sort (columnOrder
.begin(), columnOrder
.end());
596 for (size_t i
= 0, count
= columns
.size(); i
< count
; ++i
)
598 columns
[i
].width
= 0;
599 columns
[i
].visible
= (i
< 32) && (((defaultColumns
>> i
) & 1) != 0);
602 for (size_t i
= 0, count
= userProps
.size(); i
< count
; ++i
)
603 userProps
[i
].width
= 0;
607 for (int i
= 0, count
= GetColumnCount(); i
< count
; ++i
)
608 control
->SetColumnWidth (i
, GetVisibleWidth (i
, true));
612 control
->Invalidate (FALSE
);
615 // initialization utilities
617 void ColumnManager::ParseUserPropSettings(const CString
& userPropList
, const CString
& shownUserProps
)
619 assert (userProps
.empty());
621 static CString
delimiters (_T(" "));
623 // parse list of visible user-props
625 std::set
<CString
> visibles
;
628 CString name
= shownUserProps
.Tokenize (delimiters
, pos
);
629 while (!name
.IsEmpty())
631 visibles
.insert (name
);
632 name
= shownUserProps
.Tokenize (delimiters
, pos
);
635 // create list of all user-props
638 name
= userPropList
.Tokenize (delimiters
, pos
);
639 while (!name
.IsEmpty())
641 bool visible
= visibles
.find (name
) != visibles
.end();
644 newEntry
.name
= name
;
647 userProps
.push_back (newEntry
);
649 // auto-create columns for visible user-props
650 // (others may be added later)
654 ColumnInfo newColumn
;
656 newColumn
.visible
= true;
657 newColumn
.relevant
= true;
658 newColumn
.index
= static_cast<int>(userProps
.size())
659 + SVNSLC_USERPROPCOLOFFSET
- 1;
661 columns
.push_back (newColumn
);
664 name
= userPropList
.Tokenize (delimiters
, pos
);
668 void ColumnManager::ParseWidths (const CString
& widths
)
670 for (int i
= 0, count
= widths
.GetLength() / 8; i
< count
; ++i
)
672 long width
= _tcstol (widths
.Mid (i
*8, 8), NULL
, 16);
673 if (i
< itemName
.size())
677 columns
[i
].width
= width
;
679 else if (i
>= SVNSLC_USERPROPCOLOFFSET
)
681 // a user-prop column
683 size_t index
= static_cast<size_t>(i
- SVNSLC_USERPROPCOLOFFSET
);
684 assert (index
< userProps
.size());
685 userProps
[index
].width
= width
;
687 for (size_t k
= 0, count
= columns
.size(); k
< count
; ++k
)
688 if (columns
[k
].index
== i
)
689 columns
[k
].width
= width
;
693 // there is no such column
700 void ColumnManager::SetStandardColumnVisibility
703 for (size_t i
= 0; i
< itemName
.size(); ++i
)
705 columns
[i
].visible
= (visibility
& 1) > 0;
710 void ColumnManager::ParseColumnOrder
711 (const CString
& widths
)
713 std::set
<int> alreadyPlaced
;
716 // place columns according to valid entries in orderString
718 int limit
= static_cast<int>(SVNSLC_USERPROPCOLOFFSET
+ userProps
.size());
719 for (int i
= 0, count
= widths
.GetLength() / 2; i
< count
; ++i
)
721 int index
= _tcstol (widths
.Mid (i
*2, 2), NULL
, 16);
722 if ((index
< itemName
.size())
723 || ((index
>= SVNSLC_USERPROPCOLOFFSET
) && (index
< limit
)))
725 alreadyPlaced
.insert (index
);
726 columnOrder
.push_back (index
);
730 // place the remaining colums behind it
732 for (int i
= 0; i
< itemName
.size(); ++i
)
733 if (alreadyPlaced
.find (i
) == alreadyPlaced
.end())
734 columnOrder
.push_back (i
);
736 for (int i
= SVNSLC_USERPROPCOLOFFSET
; i
< limit
; ++i
)
737 if (alreadyPlaced
.find (i
) == alreadyPlaced
.end())
738 columnOrder
.push_back (i
);
741 // map internal column order onto visible column order
742 // (all invisibles in front)
744 std::vector
<int> ColumnManager::GetGridColumnOrder()
746 // extract order of used columns from order of all columns
748 std::vector
<int> result
;
749 result
.reserve (SVNSLC_MAXCOLUMNCOUNT
+1);
751 size_t colCount
= columns
.size();
752 bool visible
= false;
756 // put invisible cols in front
758 for (size_t i
= 0, count
= columnOrder
.size(); i
< count
; ++i
)
760 int index
= columnOrder
[i
];
761 for (size_t k
= 0; k
< colCount
; ++k
)
763 const ColumnInfo
& column
= columns
[k
];
764 if ((column
.index
== index
) && (column
.visible
== visible
))
765 result
.push_back (static_cast<int>(k
));
776 void ColumnManager::ApplyColumnOrder()
778 // extract order of used columns from order of all columns
780 int order
[SVNSLC_MAXCOLUMNCOUNT
+1];
781 SecureZeroMemory (order
, sizeof (order
));
783 std::vector
<int> gridColumnOrder
= GetGridColumnOrder();
784 std::copy (gridColumnOrder
.begin(), gridColumnOrder
.end(), stdext::checked_array_iterator
<int*>(&order
[0], sizeof(order
)));
786 // we must have placed all columns or something is really fishy ..
788 assert (gridColumnOrder
.size() == columns
.size());
789 assert (GetColumnCount() == ((CHeaderCtrl
*)(control
->GetDlgItem(0)))->GetItemCount());
791 // o.k., apply our column ordering
793 control
->SetColumnOrderArray (GetColumnCount(), order
);
796 // utilities used when writing data to the registry
798 DWORD
ColumnManager::GetSelectedStandardColumns() const
801 for (size_t i
= itemName
.size(); i
> 0; --i
)
802 result
= result
* 2 + (columns
[i
-1].visible
? 1 : 0);
807 CString
ColumnManager::GetUserPropList() const
811 for (size_t i
= 0, count
= userProps
.size(); i
< count
; ++i
)
812 result
+= userProps
[i
].name
+ _T(' ');
817 CString
ColumnManager::GetShownUserProps() const
821 for (size_t i
= 0, count
= columns
.size(); i
< count
; ++i
)
823 size_t index
= static_cast<size_t>(columns
[i
].index
);
824 if (columns
[i
].visible
&& (index
>= SVNSLC_USERPROPCOLOFFSET
))
825 result
+= userProps
[index
- SVNSLC_USERPROPCOLOFFSET
].name
832 CString
ColumnManager::GetWidthString() const
839 for (size_t i
= 0; i
< itemName
.size(); ++i
)
841 _stprintf_s (buf
, 10, _T("%08X"), columns
[i
].width
);
845 // range with no column IDs
847 result
+= CString ('0', 8 * (SVNSLC_USERPROPCOLOFFSET
- itemName
.size()));
851 for (size_t i
= 0, count
= userProps
.size(); i
< count
; ++i
)
853 _stprintf_s (buf
, 10, _T("%08X"), userProps
[i
].width
);
860 CString
ColumnManager::GetColumnOrderString() const
865 for (size_t i
= 0, count
= columnOrder
.size(); i
< count
; ++i
)
867 _stprintf_s (buf
, 3, _T("%02X"), columnOrder
[i
]);
874 // sorter utility class
876 CSorter::CSorter ( ColumnManager
* columnManager
879 : columnManager (columnManager
)
880 , sortedColumn (sortedColumn
)
881 , ascending (ascending
)
885 bool CSorter::operator() (const CTGitPath
* entry1
, const CTGitPath
* entry2
) const
887 #define SGN(x) ((x)==0?0:((x)>0?1:-1))
890 switch (sortedColumn
)
896 __int64 writetime1
= entry1
->GetLastWriteTime();
897 __int64 writetime2
= entry2
->GetLastWriteTime();
899 FILETIME
* filetime1
= (FILETIME
*)(__int64
*)&writetime1
;
900 FILETIME
* filetime2
= (FILETIME
*)(__int64
*)&writetime2
;
902 result
= CompareFileTime(filetime1
,filetime2
);
909 // result = entry1->copyfrom_url.CompareNoCase(entry2->copyfrom_url);
916 // result = SGN(entry1->needslock - entry2->needslock);
923 // result = SGN(entry1->last_commit_date - entry2->last_commit_date);
930 // result = entry1->remoterev - entry2->remoterev;
937 // result = entry1->last_commit_rev - entry2->last_commit_rev;
944 // result = entry1->last_commit_author.CompareNoCase(entry2->last_commit_author);
947 case 11: //Del Number
951 // result = entry1->lock_comment.CompareNoCase(entry2->lock_comment);
952 result
= A2L(entry1
->m_StatDel
)-A2L(entry2
->m_StatDel
);
955 case 10: //Add Number
959 //result = entry1->lock_owner.CompareNoCase(entry2->lock_owner);
960 result
= A2L(entry1
->m_StatAdd
)-A2L(entry2
->m_StatAdd
);
963 case 9: //Modification Data
967 // result = entry1->url.CompareNoCase(entry2->url);
974 // result = entry1->remotepropstatus - entry2->remotepropstatus;
981 // result = entry1->remotetextstatus - entry2->remotetextstatus;
988 // result = entry1->propstatus - entry2->propstatus;
991 case 5: //Prop Status
995 // result = entry1->textstatus - entry2->textstatus;
998 case 4: //Text Status
1002 // result = entry1->remotestatus - entry2->remotestatus;
1009 result
= entry1
->GetActionName(entry1
->m_Action
).CompareNoCase(entry2
->GetActionName(entry2
->m_Action
));
1016 result
= entry1
->GetFileExtension().CompareNoCase(entry2
->GetFileExtension());
1019 case 1: // File name
1023 result
= entry1
->GetFileOrDirectoryName().CompareNoCase(entry2
->GetFileOrDirectoryName());
1026 case 0: // Full path column
1030 result
= CTGitPath::Compare(entry1
->GetGitPathString(), entry2
->GetGitPathString());
1034 if ((result
== 0) && (sortedColumn
> 0))
1036 // N/A props are "less than" empty props
1038 // const CString& propName = columnManager->GetName (sortedColumn);
1040 // bool entry1HasProp = entry1->present_props.HasProperty (propName);
1041 // bool entry2HasProp = entry2->present_props.HasProperty (propName);
1043 // if (entry1HasProp)
1045 // result = entry2HasProp
1046 // ? entry1->present_props[propName].Compare
1047 // (entry2->present_props[propName])
1052 // result = entry2HasProp ? -1 : 0;
1055 } // switch (m_nSortedColumn)