From: Kimmo Varis Date: Tue, 21 Jun 2005 13:49:06 +0000 (+0000) Subject: PATCH: [ 1224249 ] Use constant for dirview special items X-Git-Tag: 2.16.5~5872 X-Git-Url: http://git.osdn.net/view?a=commitdiff_plain;h=56bf512b17bc08a69d808ddc5dc7c70bd2f63ce1;p=winmerge-jp%2Fwinmerge-jp.git PATCH: [ 1224249 ] Use constant for dirview special items --- diff --git a/Src/DirActions.cpp b/Src/DirActions.cpp index ac286f739..e28aa884d 100644 --- a/Src/DirActions.cpp +++ b/Src/DirActions.cpp @@ -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("")); diff --git a/Src/DirView.cpp b/Src/DirView.cpp index 441636559..a74b82de0 100644 --- a/Src/DirView.cpp +++ b/Src/DirView.cpp @@ -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); } } diff --git a/Src/DirView.h b/Src/DirView.h index 43f5c39ff..e2800dce0 100644 --- a/Src/DirView.h +++ b/Src/DirView.h @@ -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; diff --git a/Src/readme.txt b/Src/readme.txt index 8f69c4d0a..8a3b87324 100644 --- a/Src/readme.txt +++ b/Src/readme.txt @@ -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