Browse Source

show the border in red when ditto is not connected to the clipboard

git-svn-id: svn://svn.code.sf.net/p/ditto-cp/code/trunk@89 595ec19a-5cb4-439b-94a8-42fb3063c22c
sabrogden 21 năm trước cách đây
mục cha
commit
0e188eeef5
6 tập tin đã thay đổi với 54 bổ sung16 xóa
  1. 12 1
      CP_Main.cpp
  2. 4 0
      CP_Main.dsp
  3. 1 1
      CP_Main.h
  4. 1 1
      QPasteWnd.cpp
  5. 35 12
      WndEx.cpp
  6. 1 1
      WndEx.h

+ 12 - 1
CP_Main.cpp

@@ -611,7 +611,7 @@ void CCP_MainApp::ShowPersistent( bool bVal )
 	if( m_bShowingQuickPaste )
 	{
 		ASSERT( QPasteWnd() );
-		QPasteWnd()->SetCaptionColorActive( !g_Opt.m_bShowPersistent );
+		QPasteWnd()->SetCaptionColorActive(!g_Opt.m_bShowPersistent, theApp.GetConnectCV());
 		QPasteWnd()->RefreshNc();
 	}
 }
@@ -716,4 +716,15 @@ CString CCP_MainApp::GetTargetName()
 	}
 
 	return cWindowText; 
+}
+
+void CCP_MainApp::SetConnectCV(bool bConnect)
+{ 
+	m_CopyThread.SetConnectCV(bConnect); 
+
+	if(QPasteWnd())
+	{
+		QPasteWnd()->SetCaptionColorActive(!g_Opt.m_bShowPersistent, theApp.GetConnectCV());
+		QPasteWnd()->RefreshNc();
+	}
 }

+ 4 - 0
CP_Main.dsp

@@ -573,6 +573,10 @@ SOURCE=.\res\Ditto.ico
 # End Source File
 # Begin Source File
 
+SOURCE=.\res\Ditto_NoCopyCb.ico
+# End Source File
+# Begin Source File
+
 SOURCE=.\res\open_fol.bmp
 # End Source File
 # Begin Source File

+ 1 - 1
CP_Main.h

@@ -87,7 +87,7 @@ public:
 	bool IsClipboardViewerConnected() { return m_CopyThread.IsClipboardViewerConnected(); }
 	// user control over being in the clipboard viewer chain.
 	bool GetConnectCV() { return m_CopyThread.GetConnectCV(); }
-	void SetConnectCV( bool bConnect ) { m_CopyThread.SetConnectCV(bConnect); }
+	void SetConnectCV( bool bConnect );
 	bool ToggleConnectCV();
 	void UpdateMenuConnectCV( CMenu* pMenu, UINT nMenuID );
 

+ 1 - 1
QPasteWnd.cpp

@@ -361,7 +361,7 @@ BOOL CQPasteWnd::ShowQPasteWindow(BOOL bFillList)
 {
 	//Set the flag so we can't open this up again
 	theApp.m_bShowingQuickPaste = true;
-	SetCaptionColorActive( !g_Opt.m_bShowPersistent );
+	SetCaptionColorActive(!g_Opt.m_bShowPersistent, theApp.GetConnectCV());
 	
 	// use invalidation to avoid unnecessary repainting
 	m_bAllowRepaintImmediately = false;

+ 35 - 12
WndEx.cpp

@@ -32,7 +32,7 @@ CWndEx::CWndEx()
 	m_bMinimized = false;
 	m_bMaxSetTimer = false;
 	
-	SetCaptionColorActive(false);
+	SetCaptionColorActive(false, theApp.GetConnectCV());
 }
 
 CWndEx::~CWndEx()
@@ -66,14 +66,21 @@ bool CWndEx::SetCaptionColors( COLORREF left, COLORREF right )
 	return true;
 }
 
-bool CWndEx::SetCaptionColorActive( bool bVal )
+bool CWndEx::SetCaptionColorActive(bool bActive, bool ConnectedToClipboard)
 {
 	bool bResult;
-	
-	if( bVal )
-		bResult = SetCaptionColors( ::GetSysColor(COLOR_ACTIVECAPTION), ::GetSysColor(COLOR_GRADIENTACTIVECAPTION) );
+
+	if(ConnectedToClipboard == false)
+	{
+		bResult = SetCaptionColors(RGB(255, 0, 0), RGB(255, 0, 0));
+	}
 	else
-		bResult = SetCaptionColors( ::GetSysColor(COLOR_INACTIVECAPTION), ::GetSysColor(COLOR_GRADIENTINACTIVECAPTION) );
+	{
+		if(bActive)
+			bResult = SetCaptionColors( ::GetSysColor(COLOR_ACTIVECAPTION), ::GetSysColor(COLOR_GRADIENTACTIVECAPTION) );
+		else
+			bResult = SetCaptionColors( ::GetSysColor(COLOR_INACTIVECAPTION), ::GetSysColor(COLOR_GRADIENTINACTIVECAPTION) );
+	}
 	
 	return bResult;
 }
@@ -281,8 +288,16 @@ void CWndEx::OnNcPaint()
 	float eG = GetGValue(right);
 	float eB = GetBValue(right);
 	
+	bool bGradient = true;
+	if(left == right)
+	{
+		gR = eR;
+		gG = eG;
+		gB = eB; 
+		bGradient = false;
+	}
 	// calculate the slope for color gradient 
-	if(bVertical)
+	else if(bVertical)
 	{
 		gR = (eR - sR) / rcBorder.Height();
 		gG = (eG - sG) / rcBorder.Height(); 
@@ -303,7 +318,7 @@ void CWndEx::OnNcPaint()
 	long lCount = rcBorder.Width();
 	if(bVertical)
 		lCount = lHeight;
-	
+
 	for(int i = 0; i < lCount; i++) 
 	{ 
 		if(bVertical)
@@ -316,14 +331,22 @@ void CWndEx::OnNcPaint()
 			cr.left = i;
 			cr.right = i + 1;
 		}
-		color = CreateSolidBrush(RGB(int(gR * (float) i + gR),
-			int(gG * (float) i + sG),
-			int(gB * (float) i + sB)));
+		if(bGradient || i == 0)
+		{
+			color = CreateSolidBrush(RGB(int(gR * (float) i + gR),
+				int(gG * (float) i + sG),
+				int(gB * (float) i + sB)));
+		}
 		
 		::FillRect(dc, &cr, color);
-		DeleteObject(color);
+
+		if(bGradient)
+			DeleteObject(color);
 	}
 	
+	if(bGradient == false)
+		DeleteObject(color);
+
 	/*
 	HBRUSH color;
 	color = CreateSolidBrush(left);

+ 1 - 1
WndEx.h

@@ -41,7 +41,7 @@ public:
 	COLORREF		m_CaptionColorRight;
 
 	bool	SetCaptionColors( COLORREF left, COLORREF right );
-	bool	SetCaptionColorActive( bool bVal );
+	bool	SetCaptionColorActive(bool bActive, bool ConnectedToClipboard);
 
 	void	InvalidateNc();