OSDN Git Service

DirCompProgressBar: Show relative path instead of absolute path while comparing files
authorsdottaka <sdottaka@users.sourceforge.net>
Sun, 19 Apr 2015 09:39:20 +0000 (18:39 +0900)
committersdottaka <sdottaka@users.sourceforge.net>
Sun, 19 Apr 2015 09:39:20 +0000 (18:39 +0900)
--HG--
branch : stable

Src/DirCompProgressBar.cpp
Src/DirCompProgressBar.h
Src/DirView.cpp
Src/Merge.rc
Src/resource.h

index 57407b0..a51471b 100644 (file)
@@ -41,11 +41,10 @@ void DirCompProgressBar::ClearStat()
  * @brief Constructor.
  * @param [in] pParent Parent window for progress dialog.
  */
-DirCompProgressBar::DirCompProgressBar(const CDiffContext& ctxt)
+DirCompProgressBar::DirCompProgressBar()
 : m_bCompareReady(FALSE)
 , m_prevState(CompareStats::STATE_IDLE)
 , m_pCompareStats(NULL)
-, m_ctxt(ctxt)
 #ifdef __ITaskbarList3_INTERFACE_DEFINED__
 , m_pTaskbarList(NULL)
 #endif
@@ -162,12 +161,8 @@ void DirCompProgressBar::OnTimer(UINT_PTR nIDEvent)
                                state == CompareStats::STATE_COMPARE)
                {
                        SetProgressState(m_pCompareStats->GetComparedItems(), m_pCompareStats->GetTotalItems());
-                       if (const DIFFITEM *pdi = m_pCompareStats->GetCurDiffItem())\r
-                       {\r
-                               for (int i = 0; i < m_ctxt.GetCompareDirs(); ++i)\r
-                                       GetDlgItem(IDC_PATH0_STATIC + i)->SetWindowTextW(\r
-                                               paths_ConcatPath(m_ctxt.GetPath(i), pdi->diffFileInfo[i].GetFile()).c_str());\r
-                       }\r
+                       if (const DIFFITEM *pdi = m_pCompareStats->GetCurDiffItem())
+                               GetDlgItem(IDC_PATH_COMPARING)->SetWindowTextW(pdi->diffFileInfo[0].GetFile().c_str());
                }
                // Compare is ready
                // Update total items too since we might get only this one state
@@ -191,27 +186,23 @@ void DirCompProgressBar::OnSize(UINT nType, int cx, int cy)
 
        CWnd *pwndButton = GetDlgItem(IDC_COMPARISON_STOP);
        CWnd *pwndProgress = GetDlgItem(IDC_PROGRESSCOMPARE);
+       CWnd *pwndStatic = GetDlgItem(IDC_PATH_COMPARING);
 
-       if (pwndButton && pwndProgress)
+       if (pwndButton && pwndProgress && pwndStatic)
        {
-               CRect rectButton, rectProgress;
+               CRect rectButton, rectProgress, rectStatic;
                pwndButton->GetWindowRect(&rectButton);
                pwndProgress->GetWindowRect(&rectProgress);
+               pwndStatic->GetWindowRect(&rectStatic);
                ScreenToClient(&rectButton);
                ScreenToClient(&rectProgress);
+               ScreenToClient(&rectStatic);
                rectButton.left = cx - rectButton.Width() - rectProgress.left;
                rectProgress.right = cx - rectProgress.left;
+               rectStatic.right = rectProgress.right;
                pwndButton->SetWindowPos(NULL, rectButton.left, rectButton.top, 0, 0, SWP_NOZORDER|SWP_NOSIZE);
                pwndProgress->SetWindowPos(NULL, 0, 0, rectProgress.Width(), rectProgress.Height(), SWP_NOZORDER|SWP_NOMOVE);
-               for (int i = 0; i < 3; ++i)
-               {
-                       CWnd *pwndStatic = GetDlgItem(IDC_PATH0_STATIC + i);
-                       CRect rectStatic;
-                       pwndStatic->GetWindowRect(&rectStatic);
-                       ScreenToClient(&rectStatic);
-                       rectStatic.right = rectButton.left - 4;
-                       pwndStatic->SetWindowPos(NULL, 0, 0, rectStatic.Width(), rectStatic.Height(), SWP_NOZORDER|SWP_NOMOVE);
-               }
+               pwndStatic->SetWindowPos(NULL, 0, 0, rectStatic.Width(), rectStatic.Height(), SWP_NOZORDER|SWP_NOMOVE);
        }
 }
 
index 603562f..d420815 100644 (file)
@@ -8,7 +8,6 @@
 #include "CompareStats.h"
 
 class ITaskBarList3;
-class CDiffContext;
 
 /////////////////////////////////////////////////////////////////////////////
 // DirCompProgressBar dialog
@@ -35,7 +34,7 @@ class DirCompProgressBar : public CDialogBar
 {
 // Construction
 public:
-       DirCompProgressBar(const CDiffContext& ctxt);   // standard constructor
+       DirCompProgressBar();   // standard constructor
        ~DirCompProgressBar();
        BOOL Create(CWnd* pParentWnd);
        void SetCompareStat(CompareStats * pCompareStats);
@@ -66,7 +65,6 @@ private:
 #ifdef __ITaskbarList3_INTERFACE_DEFINED__
        ITaskbarList3 *m_pTaskbarList;
 #endif
-       const CDiffContext& m_ctxt;
 };
 
 //{{AFX_INSERT_LOCATION}}
index 38818ba..4fb8c97 100644 (file)
@@ -470,7 +470,7 @@ int CDirView::GetDefaultColImage() const
 void CDirView::StartCompare(CompareStats *pCompareStats)
 {
        if (m_pCmpProgressBar == NULL)
-               m_pCmpProgressBar.reset(new DirCompProgressBar(GetDocument()->GetDiffContext()));
+               m_pCmpProgressBar.reset(new DirCompProgressBar());
 
        if (!::IsWindow(m_pCmpProgressBar->GetSafeHwnd()))
                m_pCmpProgressBar->Create(GetParentFrame());
index a73d48a..75785b2 100644 (file)
@@ -1322,21 +1322,19 @@ BEGIN
                     ES_READONLY
 END
 
-IDD_DIRCOMP_PROGRESS DIALOGEX 0, 0, 256, 64
+IDD_DIRCOMP_PROGRESS DIALOGEX 0, 0, 256, 60
 STYLE DS_SETFONT | DS_FIXEDSYS | WS_CHILD 
 FONT 8, "MS Shell Dlg", 0, 0, 0x1
 BEGIN
     DEFPUSHBUTTON   "Stop",IDC_COMPARISON_STOP,167,15,83,14
     CONTROL         "",IDC_PROGRESSCOMPARE,"msctls_progress32",WS_BORDER,7,
-                    49,241,9
+                    44,241,9
     RTEXT           "0",IDC_ITEMSCOMPARED,95,29,30,9
     RTEXT           "0",IDC_ITEMSTOTAL,95,19,30,9
     LTEXT           "Comparing items...",IDC_STATIC,7,7,150,9
     LTEXT           "Items compared:",IDC_STATIC,7,29,85,9
     LTEXT           "Items total:",IDC_STATIC,7,19,85,9
-       LTEXT           "", IDC_PATH0_STATIC, 137, 19, 242, 9\r
-       LTEXT           "", IDC_PATH1_STATIC, 137, 29, 242, 9\r
-       LTEXT           "", IDC_PATH2_STATIC, 137, 39, 242, 9
+       LTEXT           "", IDC_PATH_COMPARING, 137, 29, 242, 9
 END
 
 IDD_WMGOTO DIALOGEX 0, 0, 210, 80
index 2943d88..3a595fe 100644 (file)
 #define IDC_SWAP02_BUTTON               1354
 #define IDC_COLORSCHEME_GITHUBBITBUCKET 1355
 #define IDC_FINDDLG_DONTCLOSE           1356
-#define IDC_PATH0_STATIC                1357
-#define IDC_PATH1_STATIC                1358
-#define IDC_PATH2_STATIC                1359
+#define IDC_PATH_COMPARING              1357
 #define IDC_EDIT_WHOLE_WORD             8603
 #define IDC_EDIT_MATCH_CASE             8604
 #define IDC_EDIT_FINDTEXT               8605
 #define _APS_3D_CONTROLS                     1
 #define _APS_NEXT_RESOURCE_VALUE        242
 #define _APS_NEXT_COMMAND_VALUE         33273
-#define _APS_NEXT_CONTROL_VALUE         1361
+#define _APS_NEXT_CONTROL_VALUE         1359
 #define _APS_NEXT_SYMED_VALUE           115
 #endif
 #endif