OSDN Git Service

PATCH: [ 1224249 ] Use constant for dirview special items
authorKimmo Varis <kimmov@gmail.com>
Tue, 21 Jun 2005 13:49:06 +0000 (13:49 +0000)
committerKimmo Varis <kimmov@gmail.com>
Tue, 21 Jun 2005 13:49:06 +0000 (13:49 +0000)
Src/DirActions.cpp
Src/DirView.cpp
Src/DirView.h
Src/readme.txt

index ac286f7..e28aa88 100644 (file)
@@ -970,7 +970,7 @@ CString CDirView::GetSelectedFileName(SIDE_TYPE stype) const
 void CDirView::GetItemFileNames(int sel, CString& strLeft, CString& strRight) const
 {
        POSITION diffpos = GetItemKey(sel);
-       if (diffpos == (POSITION)-1)
+       if (diffpos == (POSITION)SPECIAL_ITEM_POS)
        {
                strLeft.Empty();
                strRight.Empty();
@@ -994,7 +994,7 @@ void CDirView::GetItemFileNames(int sel, PathContext * paths) const
 {
        ASSERT(paths);
        POSITION diffpos = GetItemKey(sel);
-       if (diffpos == (POSITION)-1)
+       if (diffpos == (POSITION)SPECIAL_ITEM_POS)
        {
                paths->SetLeft(_T(""));
                paths->SetRight(_T(""));
index 4416365..a74b82d 100644 (file)
@@ -842,9 +842,9 @@ void CDirView::OpenSelection(PackingInfo * infoUnpacker /*= NULL*/)
        {
                POSITION diffpos = GetItemKey(sel);
 
-               // Browse to parent folder(s) selected, -1 is position for
+               // Browse to parent folder(s) selected, SPECIAL_ITEM_POS is position for
                // special items, but there is currenly only one (parent folder)
-               if (diffpos == (POSITION) -1)
+               if (diffpos == (POSITION) SPECIAL_ITEM_POS)
                {
                        OpenParentDirectory();
                        break;
@@ -1152,7 +1152,7 @@ DIFFITEM CDirView::GetDiffItem(int sel)
        POSITION diffpos = GetItemKey(sel);
        
        // If it is special item, return empty DIFFITEM
-       if (diffpos == (POSITION) -1)
+       if (diffpos == (POSITION) SPECIAL_ITEM_POS)
        {
                static DIFFITEM item;
                return item;
@@ -2134,7 +2134,7 @@ void CDirView::AddParentFolderItem(BOOL bEnable)
 {
        int i = AddNewItem(0);
        SetImage(i, bEnable ? DIFFIMG_DIRUP : DIFFIMG_DIRUP_DISABLE);
-       SetItemKey(i, (POSITION) -1);
+       SetItemKey(i, (POSITION) SPECIAL_ITEM_POS);
 
        LV_ITEM lvItem;
        lvItem.mask = LVIF_TEXT;
@@ -2231,9 +2231,9 @@ void CDirView::OnSelectAll()
 
        for (int i = 0; i < selCount; i++)
        {
-               // Don't select special items (POSITION -1)
+               // Don't select special items (SPECIAL_ITEM_POS)
                POSITION diffpos = GetItemKey(i);
-               if (diffpos != (POSITION) -1)
+               if (diffpos != (POSITION) SPECIAL_ITEM_POS)
                        m_pList->SetItemState(i, LVIS_SELECTED, LVIS_SELECTED);
        }
 }
index 43f5c39..e2800dc 100644 (file)
@@ -48,10 +48,25 @@ class PathContext;
 
 namespace varprop { struct VariantValue; }
 
+/**
+ * @brief Position value for special items (..) in directory compare view.
+ */
+const int SPECIAL_ITEM_POS = -1;
+
 /** Default column width in directory compare */
 const UINT DefColumnWidth = 150;
 
-/** View displaying results of a diff, one row per file */
+/**
+ * @brief Directory compare results view.
+ *
+ * Directory compare view is list-view based, so it shows one result (for
+ * folder or file, commonly called as 'item') in one line. User can select
+ * visible columns, re-order columns, sort by column etc.
+ *
+ * Actual data is stored in CDiffContext in CDirDoc. Dircompare items and
+ * CDiffContext items are linked by storing POSITION of CDiffContext item
+ * as CDirView listitem key.
+ */
 class CDirView : public CListViewEx
 {
        class DirItemEnumerator;
index 8f69c4d..8a3b873 100644 (file)
@@ -1,3 +1,7 @@
+2005-06-21 Kimmo
+ PATCH: [ 1224249 ] Use constant for dirview special items
+  Src: DirActions.cpp DirView.cpp DirView.h
+
 2005-06-17 Kimmo
  PATCH: [ 1221672 ] MergeSwedish. rc 1.207 update
   Submitted by Hans Eriksson