Forráskód Böngészése

Hide progress bar after we are done backing up db and now we are running script

git-svn-id: svn://svn.code.sf.net/p/ditto-cp/code/trunk@793 595ec19a-5cb4-439b-94a8-42fb3063c22c
sabrogden 10 éve
szülő
commit
227ee7d822
3 módosított fájl, 34 hozzáadás és 3 törlés
  1. 2 1
      DatabaseUtilities.cpp
  2. 29 2
      DittoPopupWindow.cpp
  3. 3 0
      DittoPopupWindow.h

+ 2 - 1
DatabaseUtilities.cpp

@@ -542,7 +542,8 @@ BOOL BackupDB(CString dbPath, CString prefix, CDittoPopupWindow **popUpMsg)
 
 	if ((*popUpMsg) != NULL)
 	{
-		(*popUpMsg)->UpdateText(_T("Running Ditto database scripts"));
+		(*popUpMsg)->HideProgressBar();
+		(*popUpMsg)->UpdateText(_T("Running Ditto database scripts ..."));
 	}
 
 	return ret;

+ 29 - 2
DittoPopupWindow.cpp

@@ -59,18 +59,45 @@ void CDittoPopupWindow::UpdateText(CString text)
 
 void CDittoPopupWindow::SetProgressBarPercent(int percent)
 {
-	m_progressWnd.ShowWindow(SW_SHOW);
+	if(::IsWindowVisible(m_progressWnd.m_hWnd) == FALSE)
+	{
+		m_progressWnd.ShowWindow(SW_SHOW);
+
+		CRect size;
+		GetClientRect(size);
+		DoSize(size.Width(), size.Height());
+	}
 	m_progressWnd.SetPos(percent);
 	PumpMessages();
 }
 
+void CDittoPopupWindow::HideProgressBar()
+{
+	m_progressWnd.ShowWindow(SW_HIDE);
+	PumpMessages();
+
+	CRect size;
+	GetClientRect(size);
+	DoSize(size.Width(), size.Height());
+}
+
 void CDittoPopupWindow::OnSize(UINT nType, int cx, int cy)
 {
 	CWndEx::OnSize(nType, cx, cy);
+	DoSize(cx, cy);	
+}
 
+void CDittoPopupWindow::DoSize(int cx, int cy)
+{
 	if(m_textLabel.m_hWnd != NULL)
 	{
-		m_textLabel.MoveWindow(10, 0, cx-20, cy-50);
+		int bottom = 0;
+		if(::IsWindowVisible(m_progressWnd.m_hWnd))
+		{
+			bottom = 50;
+		}
+		m_textLabel.MoveWindow(10, 0, cx-20, cy-bottom);
+		this->Invalidate();
 	}
 
 	if(m_progressWnd.m_hWnd != NULL)

+ 3 - 0
DittoPopupWindow.h

@@ -9,6 +9,7 @@ public:
 
 	void UpdateText(CString text);
 	void SetProgressBarPercent(int percent);
+	void HideProgressBar();
 	
 protected:
 	DECLARE_MESSAGE_MAP()
@@ -22,5 +23,7 @@ protected:
 	CFont m_font;
 
 	void PumpMessages();
+
+	void DoSize(int cx, int cy);
 };