Browse Source

max tooltip characters to 1500

scott brogden 6 years ago
parent
commit
99ac89235f
4 changed files with 38 additions and 19 deletions
  1. 10 0
      Options.cpp
  2. 3 0
      Options.h
  3. 2 1
      QListCtrl.cpp
  4. 23 18
      QPasteWnd.cpp

+ 10 - 0
Options.cpp

@@ -2773,4 +2773,14 @@ BOOL CGetSetOptions::GetMaxToolTipLines()
 void CGetSetOptions::SetMaxToolTipLines(int val)
 {
 	SetProfileLong("MaxToolTipLines", val);
+}
+
+BOOL CGetSetOptions::GetMaxToolTipCharacters()
+{
+	return GetProfileLong("MaxToolTipCharacters", 1500);
+}
+
+void CGetSetOptions::SetMaxToolTipCharacters(int val)
+{
+	SetProfileLong("MaxToolTipCharacters", val);
 }

+ 3 - 0
Options.h

@@ -616,6 +616,9 @@ public:
 
 	static BOOL GetMaxToolTipLines();
 	static void SetMaxToolTipLines(int val);
+
+	static BOOL GetMaxToolTipCharacters();
+	static void SetMaxToolTipCharacters(int val);
 };
 
 // global for easy access and for initialization of fast access variables

+ 2 - 1
QListCtrl.cpp

@@ -1202,7 +1202,8 @@ void CQListCtrl::GetToolTipText(int nItem, CString &csText)
 		info.hdr.idFrom = GetDlgCtrlID();
 		info.lItem = nItem;
 		//plus 100 for extra info - shortcut and such
-		info.cchTextMax = g_Opt.m_bDescTextSize + 100;
+		int maxCharacters = CGetSetOptions::GetMaxToolTipCharacters();
+		info.cchTextMax = min(maxCharacters, g_Opt.m_bDescTextSize) + 200;
 		info.pszText = csText.GetBufferSetLength(info.cchTextMax);
 		
 		pParent->SendMessage(WM_NOTIFY,(WPARAM)info.hdr.idFrom,(LPARAM)&info);

+ 23 - 18
QPasteWnd.cpp

@@ -5361,6 +5361,7 @@ void CQPasteWnd::OnGetToolTipText(NMHDR *pNMHDR, LRESULT *pResult)
     try
     {
         CString cs;
+		CString clipData = _T("");
 
         int id = m_lstHeader.GetItemData(pInfo->lItem);
         CppSQLite3Query q = theApp.m_db.execQueryEx(_T("SELECT lID, mText, lDate, lShortCut, clipOrder, clipGroupOrder, stickyClipOrder, stickyClipGroupOrder, lDontAutoDelete, QuickPasteText, lastPasteDate, globalShortCut, lParentID FROM Main WHERE lID = %d"), id);
@@ -5375,48 +5376,47 @@ void CQPasteWnd::OnGetToolTipText(NMHDR *pNMHDR, LRESULT *pResult)
 			while (tokenizer.Next(token))
 			{
 				cs += token + "\r\n";
-				if (lines > 30)
+				if (lines > maxLines)
 					break;
 				lines++;
 			}
-
-            cs += "\n\n";
+			
             #ifdef _DEBUG
-                cs += StrF(_T("(Index = %d) (DB ID = %d) (Seq = %f) (Group Seq = %f) (Sticky Seq = %f) (Sticky Group Seq = %f)\n"), 
+			clipData += StrF(_T("(Index = %d) (DB ID = %d) (Seq = %f) (Group Seq = %f) (Sticky Seq = %f) (Sticky Group Seq = %f)\n"),
 								pInfo->lItem, q.getIntField(_T("lID")), 
 													q.getFloatField(_T("clipOrder")), q.getFloatField(_T("clipGroupOrder")), 
 													q.getFloatField(_T("stickyClipOrder")), q.getFloatField(_T("stickyClipGroupOrder")));
             #endif 
 
             COleDateTime time((time_t)q.getIntField(_T("lDate")));
-            cs += "\nAdded: " + time.Format();
+			clipData += "\nAdded: " + time.Format();
 
 			COleDateTime modified((time_t)q.getIntField(_T("lastPasteDate")));
-			cs += "\nLast Used: " + modified.Format();
+			clipData += "\nLast Used: " + modified.Format();
 
             if(q.getIntField(_T("lDontAutoDelete")) > 0)
             {
-                cs += "\nNever Auto Delete";
+				clipData += "\nNever Auto Delete";
             }
 
             CString csQuickPaste = q.getStringField(_T("QuickPasteText"));
 
             if(csQuickPaste.IsEmpty() == FALSE)
             {
-                cs += "\nQuick Paste = ";
-                cs += csQuickPaste;
+				clipData += "\nQuick Paste = ";
+				clipData += csQuickPaste;
             }
 
             int shortCut = q.getIntField(_T("lShortCut"));
             if(shortCut > 0)
             {
-                cs += "\r\n";
-                cs += CHotKey::GetHotKeyDisplayStatic(shortCut);
+				clipData += "\r\n";
+				clipData += CHotKey::GetHotKeyDisplayStatic(shortCut);
 
 				BOOL globalShortCut = q.getIntField(_T("globalShortCut"));
 				if(globalShortCut)
 				{
-					cs += " - Global Shortcut Key";
+					clipData += " - Global Shortcut Key";
 				}
             }
 
@@ -5425,8 +5425,8 @@ void CQPasteWnd::OnGetToolTipText(NMHDR *pNMHDR, LRESULT *pResult)
 				int sticky = q.getIntField(_T("stickyClipGroupOrder"));
 				if (sticky != INVALID_STICKY)
 				{
-					cs += "\r\n";
-					cs += _T(" - Sticky In Group");
+					clipData += "\r\n";
+					clipData += _T(" - Sticky In Group");
 				}
 			}
 			else
@@ -5434,19 +5434,24 @@ void CQPasteWnd::OnGetToolTipText(NMHDR *pNMHDR, LRESULT *pResult)
 				int sticky = q.getIntField(_T("stickyClipOrder"));
 				if (sticky != INVALID_STICKY)
 				{
-					cs += "\r\n";
-					cs += _T(" - Sticky");
+					clipData += "\r\n";
+					clipData += _T(" - Sticky");
 				}
 			}
 
 			int parentId = q.getIntField(_T("lParentID"));
 			if (parentId > 0)
 			{
-				cs += "\r\n";
-				cs += FolderPath(parentId);
+				clipData += "\r\n";
+				clipData += FolderPath(parentId);
 			}
         }
 
+		cs = cs.Left(pInfo->cchTextMax - clipData.GetLength());
+
+		cs += "\r\n\r\n";
+		cs += clipData;
+
         lstrcpyn(pInfo->pszText, cs, pInfo->cchTextMax);
         pInfo->pszText[pInfo->cchTextMax - 1] = '\0';
     }