瀏覽代碼

Use custom variable for window text so the default window text does not change on searching.

ScottBrogden 9 年之前
父節點
當前提交
fd310ae72c
共有 4 個文件被更改,包括 88 次插入78 次删除
  1. 7 2
      DittoWindow.cpp
  2. 78 75
      DittoWindow.h
  3. 1 1
      QPasteWnd.cpp
  4. 2 0
      WndEx.h

+ 7 - 2
DittoWindow.cpp

@@ -32,6 +32,8 @@ CDittoWindow::CDittoWindow(void)
 	m_CaptionColorRight = RGB(61, 149, 255);
 	m_CaptionColorRight = RGB(61, 149, 255);
 	m_CaptionTextColor = RGB(255, 255, 255);
 	m_CaptionTextColor = RGB(255, 255, 255);
 	m_sendWMClose = true;
 	m_sendWMClose = true;
+	m_customWindowTitle = _T("");
+	m_useCustomWindowTitle = false;
 }
 }
 
 
 CDittoWindow::~CDittoWindow(void)
 CDittoWindow::~CDittoWindow(void)
@@ -305,8 +307,11 @@ void CDittoWindow::DoNcPaint(CWnd *pWnd)
 	else
 	else
 		pOldFont=dc.SelectObject(&m_HorFont);
 		pOldFont=dc.SelectObject(&m_HorFont);
 
 
-	CString csText;
-	pWnd->GetWindowText(csText);
+	CString csText = m_customWindowTitle;
+	if (m_useCustomWindowTitle == false)
+	{
+		pWnd->GetWindowText(csText);
+	}
 
 
 	if(m_lRightBorder == CAPTION_BORDER)
 	if(m_lRightBorder == CAPTION_BORDER)
 	{
 	{

+ 78 - 75
DittoWindow.h

@@ -1,77 +1,80 @@
-#pragma once
-
-#include "GdipButton.h"
-
-#include "GdiImageDrawer.h"
-
-#define BUTTON_CLOSE 1
-#define BUTTON_CHEVRON 2
-#define BUTTON_MINIMIZE 3
-#define BUTTON_MAXIMIZE 4
-
-class CDittoWindow
-{
-public:
-	CDittoWindow(void);
-	~CDittoWindow(void);
-
-	void DoNcPaint(CWnd *pWnd);
-	void DrawChevronBtn(CWindowDC &dc, CWnd *pWnd);
-	void DrawCloseBtn(CWindowDC &dc, CWnd *pWnd);
-	void DrawMaximizeBtn(CWindowDC &dc, CWnd *pWnd);
-	void DrawMinimizeBtn(CWindowDC &dc);
-
-	void DoCreate(CWnd *pWnd);
-	void DoNcCalcSize(BOOL bCalcValidRects, NCCALCSIZE_PARAMS FAR* lpncsp);
-	UINT DoNcHitTest(CWnd *pWnd, CPoint point);
-	void DoSetRegion(CWnd *pWnd);
-	long DoNcLButtonUp(CWnd *pWnd, UINT nHitTest, CPoint point);
-	void DoNcLButtonDown(CWnd *pWnd, UINT nHitTest, CPoint point);
-	void DoNcMouseMove(CWnd *pWnd, UINT nHitTest, CPoint point) ;
-	bool DoPreTranslateMessage(MSG* pMsg);
-	void SetCaptionOn(CWnd *pWnd, int nPos, bool bOnstartup);
-	bool SetCaptionColors(COLORREF left, COLORREF right);
-	void SetCaptionTextColor(COLORREF color);
-
-	long m_lTopBorder;
-	long m_lRightBorder;
-	long m_lBottomBorder;
-	long m_lLeftBorder;
-
-	bool m_bDrawClose;
-	bool m_sendWMClose;
-	bool m_bDrawChevron;
-	bool m_bDrawMaximize;
-	bool m_bDrawMinimize;
-
-	CRect m_crCloseBT;
-	CRect m_crChevronBT;
-	CRect m_crMaximizeBT;
-	CRect m_crMinimizeBT;
-
-	CFont m_VertFont;
-	CFont m_HorFont;
-
-	bool m_bMinimized;
-
-	bool m_bMouseDownOnChevron;
-	bool m_bMouseOverChevron;
-	bool m_bMouseDownOnClose;
-	bool m_bMouseOverClose;
-	bool m_bMouseDownOnCaption;
-	bool m_bMouseDownOnMinimize;
-	bool m_bMouseOverMinimize;
-	bool m_bMouseDownOnMaximize;
-	bool m_bMouseOverMaximize;
-
-	COLORREF m_CaptionColorLeft;
-	COLORREF m_CaptionColorRight;
-	COLORREF m_CaptionTextColor;
-	
-	CGdiImageDrawer m_closeButton;
-	CGdiImageDrawer m_chevronRightButton;
+#pragma once
+
+#include "GdipButton.h"
+
+#include "GdiImageDrawer.h"
+
+#define BUTTON_CLOSE 1
+#define BUTTON_CHEVRON 2
+#define BUTTON_MINIMIZE 3
+#define BUTTON_MAXIMIZE 4
+
+class CDittoWindow
+{
+public:
+	CDittoWindow(void);
+	~CDittoWindow(void);
+
+	void DoNcPaint(CWnd *pWnd);
+	void DrawChevronBtn(CWindowDC &dc, CWnd *pWnd);
+	void DrawCloseBtn(CWindowDC &dc, CWnd *pWnd);
+	void DrawMaximizeBtn(CWindowDC &dc, CWnd *pWnd);
+	void DrawMinimizeBtn(CWindowDC &dc);
+
+	void DoCreate(CWnd *pWnd);
+	void DoNcCalcSize(BOOL bCalcValidRects, NCCALCSIZE_PARAMS FAR* lpncsp);
+	UINT DoNcHitTest(CWnd *pWnd, CPoint point);
+	void DoSetRegion(CWnd *pWnd);
+	long DoNcLButtonUp(CWnd *pWnd, UINT nHitTest, CPoint point);
+	void DoNcLButtonDown(CWnd *pWnd, UINT nHitTest, CPoint point);
+	void DoNcMouseMove(CWnd *pWnd, UINT nHitTest, CPoint point) ;
+	bool DoPreTranslateMessage(MSG* pMsg);
+	void SetCaptionOn(CWnd *pWnd, int nPos, bool bOnstartup);
+	bool SetCaptionColors(COLORREF left, COLORREF right);
+	void SetCaptionTextColor(COLORREF color);
+
+	long m_lTopBorder;
+	long m_lRightBorder;
+	long m_lBottomBorder;
+	long m_lLeftBorder;
+
+	bool m_bDrawClose;
+	bool m_sendWMClose;
+	bool m_bDrawChevron;
+	bool m_bDrawMaximize;
+	bool m_bDrawMinimize;
+
+	CRect m_crCloseBT;
+	CRect m_crChevronBT;
+	CRect m_crMaximizeBT;
+	CRect m_crMinimizeBT;
+
+	CFont m_VertFont;
+	CFont m_HorFont;
+
+	bool m_bMinimized;
+
+	bool m_bMouseDownOnChevron;
+	bool m_bMouseOverChevron;
+	bool m_bMouseDownOnClose;
+	bool m_bMouseOverClose;
+	bool m_bMouseDownOnCaption;
+	bool m_bMouseDownOnMinimize;
+	bool m_bMouseOverMinimize;
+	bool m_bMouseDownOnMaximize;
+	bool m_bMouseOverMaximize;
+
+	COLORREF m_CaptionColorLeft;
+	COLORREF m_CaptionColorRight;
+	COLORREF m_CaptionTextColor;
+	
+	CGdiImageDrawer m_closeButton;
+	CGdiImageDrawer m_chevronRightButton;
 	CGdiImageDrawer m_chevronLeftButton;
 	CGdiImageDrawer m_chevronLeftButton;
 	CGdiImageDrawer m_chevronTopButton;
 	CGdiImageDrawer m_chevronTopButton;
-	CGdiImageDrawer m_chevronBottomButton;
-	CGdiImageDrawer m_maximizeButton;
-};
+	CGdiImageDrawer m_chevronBottomButton;
+	CGdiImageDrawer m_maximizeButton;
+
+	CString m_customWindowTitle;
+	bool m_useCustomWindowTitle;
+};

+ 1 - 1
QPasteWnd.cpp

@@ -1130,7 +1130,7 @@ void CQPasteWnd::UpdateStatus(bool bRepaintImmediately)
 
 
     if(title != prev)
     if(title != prev)
     {
     {
-        SetWindowText(title);
+		SetCustomWindowTitle(title);
         RefreshNc();
         RefreshNc();
     }
     }
 }
 }

+ 2 - 0
WndEx.h

@@ -43,6 +43,8 @@ public:
 	void SetAutoMaxDelay(long lDelay)	{ m_lDelayMaxSeconds = lDelay; }
 	void SetAutoMaxDelay(long lDelay)	{ m_lDelayMaxSeconds = lDelay; }
 	bool GetMinimized()	{ return m_DittoWindow.m_bMinimized; }
 	bool GetMinimized()	{ return m_DittoWindow.m_bMinimized; }
 
 
+	void SetCustomWindowTitle(CString title) { m_DittoWindow.m_customWindowTitle = title;  m_DittoWindow.m_useCustomWindowTitle = true; }
+
 protected:
 protected:
 	CDittoWindow m_DittoWindow;
 	CDittoWindow m_DittoWindow;
 	CRect m_crFullSizeWindow;
 	CRect m_crFullSizeWindow;