OSDN Git Service

BUG: [ 1396222 ] CDirView::MoveSelection() is confused
authorPerry Rapp <elsapo@users.sourceforge.net>
Sun, 8 Jan 2006 23:49:13 +0000 (23:49 +0000)
committerPerry Rapp <elsapo@users.sourceforge.net>
Sun, 8 Jan 2006 23:49:13 +0000 (23:49 +0000)
 (Rename MoveSelection to MoveFocus & add more commenting)
  Src: DirActions.cpp DirView.cpp DirView.h

Src/Changes.txt
Src/DirActions.cpp
Src/DirView.cpp
Src/DirView.h

index 7446605..b1f8a71 100644 (file)
@@ -1,3 +1,8 @@
+2006-01-09 Perry
+ BUG: [ 1396222 ] CDirView::MoveSelection() is confused
+ (Rename MoveSelection to MoveFocus & add more commenting)
+  Src: DirActions.cpp DirView.cpp DirView.h
+
 2006-01-07 Perry
  PATCH: [ 1398064 ] Catalan translation update
  By Jordi Vilar
index 735bdd3..2bd23ad 100644 (file)
@@ -839,7 +839,7 @@ void CDirView::UpdateDeletedItems(ActionList & actionList)
        }
        if (curSel < 1)
                ++curSel;
-       MoveSelection(0, curSel - 1, 0);
+       MoveFocus(0, curSel - 1, 0);
 }
 
 /// Get directories of first selected item
index 238e722..d4870ac 100644 (file)
@@ -1587,7 +1587,7 @@ void CDirView::OnFirstdiff()
                const DIFFITEM &di = GetItemAt(i);
                if (IsItemNavigableDiff(di))
                {
-                       MoveSelection(currentInd, i, selCount);
+                       MoveFocus(currentInd, i, selCount);
                        found = TRUE;
                }
                i++;
@@ -1618,7 +1618,7 @@ void CDirView::OnLastdiff()
                const DIFFITEM &di = GetItemAt(i);
                if (IsItemNavigableDiff(di))
                {
-                       MoveSelection(currentInd, i, selCount);
+                       MoveFocus(currentInd, i, selCount);
                        found = TRUE;
                }
                i--;
@@ -1652,7 +1652,7 @@ void CDirView::OnNextdiff()
                const DIFFITEM &di = GetItemAt(i);
                if (IsItemNavigableDiff(di))
                {
-                       MoveSelection(currentInd, i, selCount);
+                       MoveFocus(currentInd, i, selCount);
                        found = TRUE;
                }
                i++;
@@ -1691,7 +1691,7 @@ void CDirView::OnPrevdiff()
                const DIFFITEM &di = GetItemAt(i);
                if (IsItemNavigableDiff(di))
                {
-                       MoveSelection(currentInd, i, selCount);
+                       MoveFocus(currentInd, i, selCount);
                        found = TRUE;
                }
                i--;
@@ -1824,16 +1824,25 @@ bool CDirView::IsItemNavigableDiff(const DIFFITEM & di) const
        return true;
 }
 
-// move focus (& selection if only one selected) from currentInd to i
-void CDirView::MoveSelection(int currentInd, int i, int selCount)
+/**
+ * @brief Move focus to specified item (and selection if multiple items not selected)
+ *
+ * Moves the focus from item [currentInd] to item [i]
+ * Additionally, if there are not multiple items selected, 
+ *  deselects item [currentInd] and selects item [i]
+ */
+void CDirView::MoveFocus(int currentInd, int i, int selCount)
 {
        if (selCount <= 1)
        {
+               // Not multiple items selected, so bring selection with us
                m_pList->SetItemState(currentInd, 0, LVIS_SELECTED);
                m_pList->SetItemState(currentInd, 0, LVIS_FOCUSED);
                m_pList->SetItemState(i, LVIS_SELECTED, LVIS_SELECTED);
        }
 
+       // Move focus to specified item
+       // (this automatically defocuses old item)
        m_pList->SetItemState(i, LVIS_FOCUSED, LVIS_FOCUSED);
        m_pList->EnsureVisible(i, FALSE);
 }
@@ -1908,7 +1917,7 @@ LRESULT CDirView::OnUpdateUIMessage(WPARAM wParam, LPARAM lParam)
        if (GetOptionsMgr()->GetBool(OPT_SCROLL_TO_FIRST))
                OnFirstdiff();
        else
-               MoveSelection(0, 0, 0);
+               MoveFocus(0, 0, 0);
 
        return 0; // return value unused
 }
index 1cacfe8..41d8aac 100644 (file)
@@ -400,7 +400,7 @@ private:
        DIFFITEM GetDiffItem(int sel);
        int GetSingleSelectedItem() const;
        bool IsItemNavigableDiff(const DIFFITEM & di) const;
-       void MoveSelection(int currentInd, int i, int selCount);
+       void MoveFocus(int currentInd, int i, int selCount);
        void SaveColumnWidths();
        void SaveColumnOrders();
        void FixReordering();