Browse Source

Added option to wrap description text

ScottBrogden 9 years ago
parent
commit
457a862327
6 changed files with 42 additions and 1 deletions
  1. 1 0
      CP_Main.rc
  2. 10 0
      Options.cpp
  3. 3 0
      Options.h
  4. 2 1
      Resource.h
  5. 24 0
      ToolTipEx.cpp
  6. 2 0
      ToolTipEx.h

+ 1 - 0
CP_Main.rc

@@ -329,6 +329,7 @@ BEGIN
         MENUITEM "Size window to content",      ID_FIRST_SIZEWINDOWTOCONTENT
         MENUITEM "Scale images to fit window",  ID_FIRST_SCALEIMAGESTOFITWINDOW
         MENUITEM "Hide description window on mouse clip selection", ID_FIRST_HIDEDESCRIPTIONWINDOWONM
+        MENUITEM "Wrap Text",                   ID_FIRST_WRAPTEXT
     END
 END
 

+ 10 - 0
Options.cpp

@@ -2314,4 +2314,14 @@ BOOL CGetSetOptions::GetMouseClickHidesDescription()
 void CGetSetOptions::SetMouseClickHidesDescription(int val)
 {
 	SetProfileLong(_T("MouseClickHidesDescription"), val);
+}
+
+BOOL CGetSetOptions::GetWrapDescriptionText()
+{
+	return GetProfileLong(_T("WrapDescriptionText"), FALSE);
+}
+
+void CGetSetOptions::SetWrapDescriptionText(int val)
+{
+	SetProfileLong(_T("WrapDescriptionText"), val);
 }

+ 3 - 0
Options.h

@@ -527,6 +527,9 @@ public:
 
 	static BOOL GetMouseClickHidesDescription();
 	static void SetMouseClickHidesDescription(int val);
+
+	static BOOL GetWrapDescriptionText();
+	static void SetWrapDescriptionText(int val);
 };
 
 // global for easy access and for initialization of fast access variables

+ 2 - 1
Resource.h

@@ -578,6 +578,7 @@
 #define ID_GROUPS_TOGGLELASTGROUP       32925
 #define ID_FIRST_HIDEDESCRIPTIONWINDOWONM 32926
 #define ID_SPECIALPASTE_PASTE32927      32927
+#define ID_FIRST_WRAPTEXT               32928
 
 // Next default values for new objects
 // 
@@ -585,7 +586,7 @@
 #ifndef APSTUDIO_READONLY_SYMBOLS
 #define _APS_3D_CONTROLS                     1
 #define _APS_NEXT_RESOURCE_VALUE        258
-#define _APS_NEXT_COMMAND_VALUE         32928
+#define _APS_NEXT_COMMAND_VALUE         32929
 #define _APS_NEXT_CONTROL_VALUE         2146
 #define _APS_NEXT_SYMED_VALUE           104
 #endif

+ 24 - 0
ToolTipEx.cpp

@@ -59,6 +59,7 @@ ON_WM_SETFOCUS()
 
 
 ON_COMMAND(ID_FIRST_HIDEDESCRIPTIONWINDOWONM, &CToolTipEx::OnFirstHidedescriptionwindowonm)
+ON_COMMAND(ID_FIRST_WRAPTEXT, &CToolTipEx::OnFirstWraptext)
 END_MESSAGE_MAP()
 
 
@@ -97,6 +98,8 @@ BOOL CToolTipEx::Create(CWnd *pParentWnd)
     m_RichEdit.SetReadOnly();
     m_RichEdit.SetBackgroundColor(FALSE, GetSysColor(COLOR_INFOBK));
 
+	ApplyWordWrap();
+
     SetLogFont(GetSystemToolTipFont(), FALSE);
 
 	m_optionsButton.Create(NULL, WS_CHILD | BS_OWNERDRAW | WS_TABSTOP, CRect(0, 0, 0, 0), this, 2);
@@ -786,6 +789,9 @@ void CToolTipEx::OnOptions()
 
 		if (CGetSetOptions::GetMouseClickHidesDescription())
 			cmSubMenu->CheckMenuItem(ID_FIRST_HIDEDESCRIPTIONWINDOWONM, MF_CHECKED);
+
+		if (CGetSetOptions::GetWrapDescriptionText())
+			cmSubMenu->CheckMenuItem(ID_FIRST_WRAPTEXT, MF_CHECKED);
 		
 		//theApp.m_Language.UpdateRightClickMenu(cmSubMenu);
 		
@@ -852,3 +858,21 @@ void CToolTipEx::OnFirstHidedescriptionwindowonm()
 {
 	CGetSetOptions::SetMouseClickHidesDescription(!CGetSetOptions::GetMouseClickHidesDescription());
 }
+
+void CToolTipEx::OnFirstWraptext()
+{
+	CGetSetOptions::SetWrapDescriptionText(!CGetSetOptions::GetWrapDescriptionText());	
+	ApplyWordWrap();
+}
+
+void CToolTipEx::ApplyWordWrap()
+{
+	if (CGetSetOptions::GetWrapDescriptionText())
+	{
+		m_RichEdit.SetTargetDevice(NULL, 0);
+	}
+	else
+	{
+		m_RichEdit.SetTargetDevice(NULL, 1);
+	}
+}

+ 2 - 0
ToolTipEx.h

@@ -83,6 +83,7 @@ protected:
 	BOOL IsCursorInToolTip();
 	void HighlightSearchText();
 	void DoSearch();
+	void ApplyWordWrap();
 
 	// Generated message map functions
 protected:
@@ -108,6 +109,7 @@ public:
 	afx_msg void OnPaint();
 	
 	afx_msg void OnFirstHidedescriptionwindowonm();
+	afx_msg void OnFirstWraptext();
 };
 
 /////////////////////////////////////////////////////////////////////////////