From 2fa00f30fecfb0899d0d4ab74726804733e5823c Mon Sep 17 00:00:00 2001 From: Kimmo Varis Date: Wed, 17 Aug 2005 19:50:27 +0000 Subject: [PATCH] PATCH: [ 1261244 ] Proper update for Merge/Delete-menuitem --- Src/DirView.cpp | 29 +++++++++++++++++++---------- Src/DirView.h | 1 + Src/readme.txt | 2 ++ 3 files changed, 22 insertions(+), 10 deletions(-) diff --git a/Src/DirView.cpp b/Src/DirView.cpp index 24a225afa..b7e127b9c 100644 --- a/Src/DirView.cpp +++ b/Src/DirView.cpp @@ -1378,6 +1378,24 @@ void CDirView::DoUpdateOpenRightWith(CCmdUI* pCmdUI) pCmdUI->Enable(sel>=0); } +/** + * @brief Update main menu "Merge | Delete" item + */ +void CDirView::DoUpdateDelete(CCmdUI* pCmdUI) +{ + int sel = GetSingleSelectedItem(); + if (sel != -1) + { + const DIFFITEM& di = GetDiffItem(sel); + if (di.diffcode == 0 || + (!IsItemDeletableOnLeft(di) && !IsItemDeletableOnRight(di))) + { + sel = -1; + } + } + pCmdUI->Enable(sel>=0); +} + UINT CDirView::GetSelectedCount() const { return m_pList->GetSelectedCount(); @@ -2475,16 +2493,7 @@ void CDirView::OnDelete() */ void CDirView::OnUpdateDelete(CCmdUI* pCmdUI) { - if (GetDocument()->GetReadOnly(TRUE) || GetDocument()->GetReadOnly(FALSE)) - pCmdUI->Enable(FALSE); - else - { - int sel=-1; - if (m_pList->GetNextItem(sel, LVNI_SELECTED) != -1) - pCmdUI->Enable(TRUE); - else - pCmdUI->Enable(FALSE); - } + DoUpdateDelete(pCmdUI); } /** diff --git a/Src/DirView.h b/Src/DirView.h index 4c6c696c5..6ea562bbf 100644 --- a/Src/DirView.h +++ b/Src/DirView.h @@ -364,6 +364,7 @@ private: void DoUpdateOpenRight(CCmdUI* pCmdUI); void DoUpdateOpenLeftWith(CCmdUI* pCmdUI); void DoUpdateOpenRightWith(CCmdUI* pCmdUI); + void DoUpdateDelete(CCmdUI* pCmdUI); void DoUpdateCtxtDirCopyLeftTo(CCmdUI* pCmdUI); void DoUpdateCtxtDirCopyRightTo(CCmdUI* pCmdUI); void DoUpdateCtxtDirMoveLeftTo(CCmdUI* pCmdUI); diff --git a/Src/readme.txt b/Src/readme.txt index 4b00b2b64..62c8f627a 100644 --- a/Src/readme.txt +++ b/Src/readme.txt @@ -1,6 +1,8 @@ 2005-08-17 Kimmo PATCH: [ 1260244 ] Initialization of non-existing struct-members in editor Src/editlib: ccrystaltextview.cpp ccrystaltextview.h + PATCH: [ 1261244 ] Proper update for Merge/Delete-menuitem + Src: DirView.cpp DirView.h 2005-08-16 Kimmo PATCH: [ 1258270 ] ShellExtension: allow re-selecting first item -- 2.11.0