// clear diff display
ASSERT(m_pDirView);
- m_pDirView->DeleteAllDisplayItems();
+ m_pDirView->ReusingDirView();
// hide the floating state bar
CDirFrame *pf = m_pDirView->GetParentFrame();
pf->ShowProcessingBar(FALSE);
// delete comparison parameters and results
- if (m_pCtxt != NULL)
- delete m_pCtxt;
+ delete m_pCtxt;
m_pCtxt = NULL;
return TRUE;
/**
* @brief Set directory description texts shown in headerbar
*/
-void CDirDoc::SetDescriptions(CString strLeftDesc, CString strRightDesc)
+void CDirDoc::SetDescriptions(const CString &strLeftDesc, const CString &strRightDesc)
{
m_strLeftDesc = strLeftDesc;
m_strRightDesc = strRightDesc;
void UpdateHeaderPath(BOOL bLeft);
void AbortCurrentScan();
bool IsCurrentScanAbortable() const;
- void SetDescriptions(CString strLeftDesc, CString strRightDesc);
+ void SetDescriptions(const CString &strLeftDesc, const CString &strRightDesc);
+
void SetPluginPrediffSetting(const CString & filteredFilenames, int newsetting);
void FetchPluginInfos(const CString& filteredFilenames,
PackingInfo ** infoUnpacker, PrediffingInfo ** infoPrediffer);
ON_UPDATE_COMMAND_UI(ID_DIR_MOVE_LEFT_TO_BROWSE, OnUpdateCtxtDirMoveLeftTo)
ON_COMMAND(ID_DIR_MOVE_RIGHT_TO_BROWSE, OnCtxtDirMoveRightTo)
ON_UPDATE_COMMAND_UI(ID_DIR_MOVE_RIGHT_TO_BROWSE, OnUpdateCtxtDirMoveRightTo)
+ ON_UPDATE_COMMAND_UI(ID_DIR_HIDE_FILENAMES, OnUpdateHideFilenames)
ON_WM_SIZE()
ON_COMMAND(ID_MERGE_DELETE, OnDelete)
ON_UPDATE_COMMAND_UI(ID_MERGE_DELETE, OnUpdateDelete)
}
/**
+ * @brief Prepare for reuse.
+ *
+ */
+void CDirView::ReusingDirView()
+{
+ DeleteAllDisplayItems();
+}
+
+/**
* @brief Given key, get index of item which has it stored.
* This function searches from list in UI.
*/
if (paths_DoesPathExist(leftParent) == IS_EXISTING_DIR &&
paths_DoesPathExist(rightParent) == IS_EXISTING_DIR)
{
- int bEnable = AllowUpwardDirectory(leftPath, rightPath);
+ BOOL bEnable = AllowUpwardDirectory(leftPath, rightPath);
AddParentFolderItem(bEnable);
retVal = 1;
}
* FALSE : upward RESTRICTED : both paths have a different rightmost subdirectory,
* the move can not be reversed (probably these are the original comparison directories)
*/
-BOOL CDirView::AllowUpwardDirectory(CString leftPath, CString rightPath)
+BOOL CDirView::AllowUpwardDirectory(const CString &leftPath, const CString &rightPath)
{
int lastSegmentPos = leftPath.ReverseFind(_T('/'));
if (lastSegmentPos == -1 || leftPath.ReverseFind(_T('\\')) > lastSegmentPos)
void CDirView::OnHideFilenames()
{
int sel = -1;
- int Cnt = 0, Max = 1000;
- int *pCells = new int[Max];
- // Build a dynamic int array, storing a sorted list of selected cells
+ m_pList->SetRedraw(FALSE); // Turn off updating (better performance)
while ((sel = m_pList->GetNextItem(sel, LVNI_SELECTED)) != -1)
{
- if (Cnt == Max)
- {
- Max += 1000; // Grow the array of selections
- int *pCellsTmp = new int[Max];
- memcpy(pCellsTmp, pCells, sizeof(int)*Cnt);
- delete[] pCells;
- pCells = pCellsTmp;
- }
- pCells[Cnt++] = sel;
- }
- if (Cnt)
- {
- // Remove cells in reverse order (largest to smallest count).
- m_pList->SetRedraw(FALSE); // Turn off updating (better performance)
- while (Cnt--)
- m_pList->DeleteItem(pCells[Cnt]);
- m_pList->SetRedraw(TRUE); // Turn updating back on
+ m_pList->DeleteItem(sel--);
}
- delete[] pCells;
+ m_pList->SetRedraw(TRUE); // Turn updating back on
+}
+
+/**
+ * @brief update menu item
+ */
+void CDirView::OnUpdateHideFilenames(CCmdUI* pCmdUI)
+{
+ pCmdUI->Enable(m_pList->GetSelectedCount() != 0);
}
/// User chose (context menu) Move left to...
VERIFY(msg.LoadString(IDS_STATUS_SELITEM1));
else
{
- TCHAR num[8] = {0};
+ TCHAR num[20] = {0};
_itot(items, num, 10);
AfxFormatString1(msg, IDS_STATUS_SELITEMS, num);
}
int GetItemIndex(DWORD key);
// for populating list
void DeleteAllDisplayItems();
+ void ReusingDirView();
void SetColumnWidths();
void SortColumnsAppropriately();
//DIFFITEM GetNextSelectedInd(int &ind);
DIFFITEM GetItemAt(int ind);
int AddSpecialItems();
- BOOL AllowUpwardDirectory(CString leftPath, CString rightPath);
+ BOOL AllowUpwardDirectory(const CString &leftPath, const CString &rightPath);
void AddParentFolderItem(BOOL bEnable);
void RefreshOptions();
afx_msg void OnUpdateCtxtDirMoveLeftTo(CCmdUI* pCmdUI);
afx_msg void OnCtxtDirMoveRightTo();
afx_msg void OnUpdateCtxtDirMoveRightTo(CCmdUI* pCmdUI);
+ afx_msg void OnUpdateHideFilenames(CCmdUI* pCmdUI);
afx_msg void OnDelete();
afx_msg void OnUpdateDelete(CCmdUI* pCmdUI);
afx_msg void OnMarkedRescan();