Browse Source

added options for first ten start index and font size

scott brogden 6 years ago
parent
commit
04b01770bf
7 changed files with 1113 additions and 1086 deletions
  1. 19 0
      AdvGeneral.cpp
  2. 208 209
      FileSend.cpp
  3. 26 0
      Options.cpp
  4. 8 0
      Options.h
  5. 232 254
      QListCtrl.cpp
  6. 228 231
      QListCtrl.h
  7. 392 392
      QPasteWnd.cpp

+ 19 - 0
AdvGeneral.cpp

@@ -117,9 +117,12 @@ END_MESSAGE_MAP()
 #define SETTING_TOOLTIP_LINES 69
 #define SETTING_TOOLTIP_CHARACTERS 70
 
+
 #define SETTING_ACTIVATE_WINDOW_DELAY 71
 #define SETTING_DOUBLE_KEYSTROKE_TIMEOUT 72
 #define SETTING_SEND_KEYS_DELAY 73
+#define SETTING_FIRST_TEN_HOTKEYS_START 74
+#define SETTING_FIRST_TEN_HOTKEYS_FONT_SIZE 75
 
 BOOL CAdvGeneral::OnInitDialog()
 {
@@ -171,6 +174,10 @@ BOOL CAdvGeneral::OnInitDialog()
 	AddTrueFalse(pGroupTest, _T("Ensure Ditto is always connected to the clipboard"), CGetSetOptions::GetEnsureConnectToClipboard(), SETTING_ENSURE_CONNECTED);
 	AddTrueFalse(pGroupTest, _T("Ensure Entire Window is Visible"), CGetSetOptions::GetEnsureEntireWindowCanBeSeen(), SETTING_ENSURE_WINDOW_IS_VISIBLE);
 	AddTrueFalse(pGroupTest, _T("Find As You Type"), CGetSetOptions::GetFindAsYouType(), SETTING_FIND_AS_TYPE);
+
+	pGroupTest->AddSubItem(new CMFCPropertyGridProperty(_T("First Ten HotHeys Start Index)"), (long)CGetSetOptions::GetFirstTenHotKeysStart(), _T(""), SETTING_FIRST_TEN_HOTKEYS_START));
+	pGroupTest->AddSubItem(new CMFCPropertyGridProperty(_T("First Ten HotHeys Font Size)"), (long)CGetSetOptions::GetFirstTenHotKeysFontSize(), _T(""), SETTING_FIRST_TEN_HOTKEYS_FONT_SIZE));
+
 	AddTrueFalse(pGroupTest, _T("Hide Ditto on Hot Key if Ditto is Visible"), CGetSetOptions::GetHideDittoOnHotKeyIfAlreadyShown(), SETTING_HIDE_ON_HOTKEY_IF_VISIBLE);
 	pGroupTest->AddSubItem( new CMFCPropertyGridProperty(_T("Maximum Clip Size in Bytes (0 for no limit)"), g_Opt.m_lMaxClipSizeInBytes, _T(""), SETTING_MAX_CLIP_SIZE));
 	
@@ -731,6 +738,18 @@ void CAdvGeneral::OnBnClickedOk()
 					CGetSetOptions::SetDoubleKeyStrokeTimeout(pNewValue->lVal);
 				}
 				break;
+			case SETTING_FIRST_TEN_HOTKEYS_START:
+				if (pNewValue->lVal != pOrigValue->lVal)
+				{
+					CGetSetOptions::SetFirstTenHotKeysStart(pNewValue->lVal);
+				}
+				break;
+			case SETTING_FIRST_TEN_HOTKEYS_FONT_SIZE:
+				if (pNewValue->lVal != pOrigValue->lVal)
+				{
+					CGetSetOptions::SetFirstTenHotKeysFontSize(pNewValue->lVal);
+				}
+				break;
 			}
 		}
 	}

+ 208 - 209
FileSend.cpp

@@ -1,210 +1,209 @@
-// FileSend.cpp: implementation of the CFileSend class.
-//
-//////////////////////////////////////////////////////////////////////
-
-#include "stdafx.h"
-#include "cp_main.h"
-#include "FileSend.h"
-#include "Server.h"
-#include "shared/TextConvert.h"
-#include "Md5.h"
-
-#include <shlwapi.h>
-
-
-#ifdef _DEBUG
-#undef THIS_FILE
-static char THIS_FILE[]=__FILE__;
-#define new DEBUG_NEW
-#endif
-
-//using namespace nsPath;
-
-
-CFileSend::CFileSend()
-{
-
-}
-
-CFileSend::~CFileSend()
-{
-
-}
-
-BOOL CFileSend::SendClientFiles(SOCKET sock, CClipList *pClipList)
-{
-	if(!pClipList || pClipList->GetCount() <= 0)
-	{
-		LogSendRecieveInfo("::ERROR SendClientFiles called either pClipList was null or empty");
-		return FALSE;
-	}
-
-	m_Send.SetSocket(sock);
-
-	CSendInfo Info;
-	BOOL bRet = FALSE;
-
-	CStringArray CopyFiles;
-
-	CClipFormat *pFormat = GetCF_HDROP_Data(pClipList);
-	if(pFormat)
-	{
-		HDROP drop = (HDROP)GlobalLock(pFormat->m_hgData);
- 		int nNumFiles = DragQueryFile(drop, -1, NULL, 0);
- 		TCHAR file[MAX_PATH];
-
- 		for(int nFile = 0; nFile < nNumFiles; nFile++)
- 		{
- 			if(DragQueryFile(drop, nFile, file, sizeof(file)) > 0)
- 			{
-				if(PathIsDirectory(file) == FALSE)
-				{
-					CopyFiles.Add(file);
-				}
- 			}
- 		}
-
-		GlobalUnlock(pFormat->m_hgData);
-	}
-
-	Info.m_lParameter1 = (long)CopyFiles.GetSize();
-	if(Info.m_lParameter1 > 0)
-	{
-		if(m_Send.SendCSendData(Info, MyEnums::START))
-		{
-			for(int nFile = 0; nFile < Info.m_lParameter1; nFile++)
-			{
-				SendFile(CopyFiles[nFile]);
-			}
-		}
-	}
-	
-	if(m_Send.SendCSendData(Info, MyEnums::END))
-			bRet = TRUE;
-	
-	return bRet;
-}
-
-CClipFormat* CFileSend::GetCF_HDROP_Data(CClipList *pClipList)
-{
-	CClip* pClip;
-	CClipFormat* pCF;
-	POSITION pos;
-	
-	pos = pClipList->GetHeadPosition();
-	while(pos)
-	{
-		pClip = pClipList->GetNext(pos);
-		if(pClip)
-		{
-			pCF = pClip->m_Formats.FindFormat(CF_HDROP);
-			if(pCF)
-				return pCF;
-		}
-	}
-
-	return NULL;
-}
- 
-BOOL CFileSend::SendFile(CString csFile)
-{
-	CFile file;
-	BOOL bRet = FALSE;
-	CSendInfo Info;
-	
-	char *pBuffer = new char[CHUNK_WRITE_SIZE];
-	if(pBuffer == NULL)
-	{
-		LogSendRecieveInfo("Error creating buffer to send file over in");
-		return FALSE;
-	}
-	
-	try
-	{
-		CFileException ex;
-		if(file.Open(csFile, CFile::modeRead|CFile::typeBinary|CFile::shareDenyNone, &ex))
-		{
-			CStringA dest;
-			if(CTextConvert::ConvertToUTF8(csFile, dest))
-			{
-				strncpy(Info.m_cDesc, dest, sizeof(Info.m_cDesc));
-				Info.m_cDesc[sizeof(Info.m_cDesc)-1] = 0;
-			}
-
-			Info.m_lParameter1 = (long)file.GetLength();
-			if(m_Send.SendCSendData(Info, MyEnums::DATA_START))
-			{
-				long lReadBytes = 0;
-				BOOL bError = FALSE;
-				CMd5 md5;
-				md5.MD5Init();
-
-				BOOL calcMd5 = CGetSetOptions::GetCheckMd5OnFileTransfers();
-
-				DWORD d = GetTickCount();
-				
-				do
-				{
-					lReadBytes = file.Read(pBuffer, CHUNK_WRITE_SIZE);
-					
-					if(m_Send.SendExactSize(pBuffer, lReadBytes, false) == FALSE)
-					{
-						LogSendRecieveInfo("Error sending SendExactSize in SendFile");
-						bError = TRUE;
-						break;
-					}
-
-					if (calcMd5)
-					{
-						md5.MD5Update((unsigned char *)pBuffer, lReadBytes);
-					}
-					
-				}while(lReadBytes >= CHUNK_WRITE_SIZE);
-				
-				DWORD end = GetTickCount() - d;
-
-				if(bError == FALSE)
-				{
-					Info.m_lParameter1 = 0;
-					Info.m_lParameter2 = 0;
-
-					FILETIME creationTime;
-					FILETIME lastAccessTime;
-					FILETIME lastWriteTime;
-
-					if (GetFileTime(file, &creationTime, &lastAccessTime, &lastWriteTime))
-					{
-						Info.m_lParameter1 = lastWriteTime.dwLowDateTime;
-						Info.m_lParameter2 = lastWriteTime.dwHighDateTime;
-					}
-
-					
-					CStringA csMd5 = md5.MD5FinalToString();
-					strncpy(Info.m_md5, csMd5, sizeof(Info.m_md5));
-
-					LogSendRecieveInfo(StrF(_T("Sending data_end for file: %s, md5: %s"), csFile, CTextConvert::MultiByteToUnicodeString(csMd5)));
-
-					if(m_Send.SendCSendData(Info, MyEnums::DATA_END))
-						bRet = TRUE;
-				}
-			}
-		}
-		else
-		{
-			TCHAR szError[100];
-			ex.GetErrorMessage(szError, 100);
-			LogSendRecieveInfo(StrF(_T("Error opening file in Send file, error: %s"), szError));
-		}
-	}
-	catch(CFileException *e)
-	{
-		TCHAR szError[100];
-		e->GetErrorMessage(szError, 100);
-		LogSendRecieveInfo(StrF(_T("Exception - Error in Send file, error: %s"), szError));
-	}
-	
-	delete []pBuffer;
-	pBuffer = NULL;
-	
-	return bRet;
+// FileSend.cpp: implementation of the CFileSend class.
+//
+//////////////////////////////////////////////////////////////////////
+
+#include "stdafx.h"
+#include "cp_main.h"
+#include "FileSend.h"
+#include "Server.h"
+#include "shared/TextConvert.h"
+#include "Md5.h"
+
+#include <shlwapi.h>
+
+
+#ifdef _DEBUG
+#undef THIS_FILE
+static char THIS_FILE[]=__FILE__;
+#define new DEBUG_NEW
+#endif
+
+//using namespace nsPath;
+
+
+CFileSend::CFileSend()
+{
+
+}
+
+CFileSend::~CFileSend()
+{
+
+}
+
+BOOL CFileSend::SendClientFiles(SOCKET sock, CClipList *pClipList)
+{
+	if(!pClipList || pClipList->GetCount() <= 0)
+	{
+		LogSendRecieveInfo("::ERROR SendClientFiles called either pClipList was null or empty");
+		return FALSE;
+	}
+
+	m_Send.SetSocket(sock);
+
+	CSendInfo Info;
+	BOOL bRet = FALSE;
+
+	CStringArray CopyFiles;
+
+	CClipFormat *pFormat = GetCF_HDROP_Data(pClipList);
+	if(pFormat)
+	{
+		HDROP drop = (HDROP)GlobalLock(pFormat->m_hgData);
+ 		int nNumFiles = DragQueryFile(drop, -1, NULL, 0);
+ 		TCHAR file[MAX_PATH];
+
+ 		for(int nFile = 0; nFile < nNumFiles; nFile++)
+ 		{
+ 			if(DragQueryFile(drop, nFile, file, sizeof(file)) > 0)
+ 			{
+				if(PathIsDirectory(file) == FALSE)
+				{
+					CopyFiles.Add(file);
+				}
+ 			}
+ 		}
+
+		GlobalUnlock(pFormat->m_hgData);
+	}
+
+	Info.m_lParameter1 = (long)CopyFiles.GetSize();
+	if(Info.m_lParameter1 > 0)
+	{
+		if(m_Send.SendCSendData(Info, MyEnums::START))
+		{
+			for(int nFile = 0; nFile < Info.m_lParameter1; nFile++)
+			{
+				SendFile(CopyFiles[nFile]);
+			}
+		}
+	}
+	
+	if(m_Send.SendCSendData(Info, MyEnums::END))
+			bRet = TRUE;
+	
+	return bRet;
+}
+
+CClipFormat* CFileSend::GetCF_HDROP_Data(CClipList *pClipList)
+{
+	CClip* pClip;
+	CClipFormat* pCF;
+	POSITION pos;
+	
+	pos = pClipList->GetHeadPosition();
+	while(pos)
+	{
+		pClip = pClipList->GetNext(pos);
+		if(pClip)
+		{
+			pCF = pClip->m_Formats.FindFormat(CF_HDROP);
+			if(pCF)
+				return pCF;
+		}
+	}
+
+	return NULL;
+}
+ 
+BOOL CFileSend::SendFile(CString csFile)
+{
+	CFile file;
+	BOOL bRet = FALSE;
+	CSendInfo Info;
+	
+	char *pBuffer = new char[CHUNK_WRITE_SIZE];
+	if(pBuffer == NULL)
+	{
+		LogSendRecieveInfo("Error creating buffer to send file over in");
+		return FALSE;
+	}
+	
+	try
+	{
+		CFileException ex;
+		if(file.Open(csFile, CFile::modeRead|CFile::typeBinary|CFile::shareDenyNone, &ex))
+		{
+			CStringA dest;
+			if(CTextConvert::ConvertToUTF8(csFile, dest))
+			{
+				strncpy(Info.m_cDesc, dest, sizeof(Info.m_cDesc));
+				Info.m_cDesc[sizeof(Info.m_cDesc)-1] = 0;
+			}
+
+			Info.m_lParameter1 = (long)file.GetLength();
+			if(m_Send.SendCSendData(Info, MyEnums::DATA_START))
+			{
+				long lReadBytes = 0;
+				BOOL bError = FALSE;
+				CMd5 md5;
+				md5.MD5Init();
+
+				BOOL calcMd5 = CGetSetOptions::GetCheckMd5OnFileTransfers();
+
+				DWORD d = GetTickCount();
+				
+				do
+				{
+					lReadBytes = file.Read(pBuffer, CHUNK_WRITE_SIZE);
+					
+					if(m_Send.SendExactSize(pBuffer, lReadBytes, false) == FALSE)
+					{
+						LogSendRecieveInfo("Error sending SendExactSize in SendFile");
+						bError = TRUE;
+						break;
+					}
+
+					if (calcMd5)
+					{
+						md5.MD5Update((unsigned char *)pBuffer, lReadBytes);
+					}
+					
+				}while(lReadBytes >= CHUNK_WRITE_SIZE);
+				
+				DWORD end = GetTickCount() - d;
+
+				if(bError == FALSE)
+				{
+					Info.m_lParameter1 = 0;
+					Info.m_lParameter2 = 0;
+
+					FILETIME creationTime;
+					FILETIME lastAccessTime;
+					FILETIME lastWriteTime;
+
+					if (GetFileTime(file, &creationTime, &lastAccessTime, &lastWriteTime))
+					{
+						Info.m_lParameter1 = lastWriteTime.dwLowDateTime;
+						Info.m_lParameter2 = lastWriteTime.dwHighDateTime;
+					}
+										
+					CStringA csMd5 = md5.MD5FinalToString();
+					strncpy(Info.m_md5, csMd5, sizeof(Info.m_md5));
+
+					LogSendRecieveInfo(StrF(_T("Sending data_end for file: %s, md5: %s"), csFile, CTextConvert::MultiByteToUnicodeString(csMd5)));
+
+					if(m_Send.SendCSendData(Info, MyEnums::DATA_END))
+						bRet = TRUE;
+				}
+			}
+		}
+		else
+		{
+			TCHAR szError[100];
+			ex.GetErrorMessage(szError, 100);
+			LogSendRecieveInfo(StrF(_T("Error opening file in Send file, error: %s"), szError));
+		}
+	}
+	catch(CFileException *e)
+	{
+		TCHAR szError[100];
+		e->GetErrorMessage(szError, 100);
+		LogSendRecieveInfo(StrF(_T("Exception - Error in Send file, error: %s"), szError));
+	}
+	
+	delete []pBuffer;
+	pBuffer = NULL;
+	
+	return bRet;
 }

+ 26 - 0
Options.cpp

@@ -74,6 +74,8 @@ CChaiScriptXml CGetSetOptions::m_pasteScripts;
 long CGetSetOptions::m_tooltipTimeout;
 BOOL CGetSetOptions::m_cleanRTFBeforeDrawing = TRUE;
 int CGetSetOptions::m_doubleKeyStrokeTimeout = 350;
+int CGetSetOptions::m_firstTenHotKeysStart = 1;
+int CGetSetOptions::m_firstTenHotKeysFontSize = 5;
 
 CGetSetOptions::CGetSetOptions()
 {
@@ -194,6 +196,8 @@ void CGetSetOptions::LoadSettings()
 	m_bShowAlwaysOnTopWarning = GetShowAlwaysOnTopWarning();
 	m_excludeCF_DIBInExcel = GetExcludeCF_DIBInExcel();
 	m_doubleKeyStrokeTimeout = GetDoubleKeyStrokeTimeout();
+	m_firstTenHotKeysStart = GetFirstTenHotKeysStart();
+	m_firstTenHotKeysFontSize = GetFirstTenHotKeysFontSize();
 
 	GetExtraNetworkPassword(true);
 
@@ -2814,4 +2818,26 @@ void CGetSetOptions::SetDoubleKeyStrokeTimeout(int val)
 {
 	m_doubleKeyStrokeTimeout = val;
 	SetProfileLong("DoubleKeyStrokeTimeout", val);
+}
+
+int CGetSetOptions::GetFirstTenHotKeysStart()
+{
+	return GetProfileLong("FirstTenHotKeysStart", 1);
+}
+
+void CGetSetOptions::SetFirstTenHotKeysStart(int val)
+{
+	m_firstTenHotKeysStart = val;
+	SetProfileLong("FirstTenHotKeysStart", val);
+}
+
+int CGetSetOptions::GetFirstTenHotKeysFontSize()
+{
+	return GetProfileLong("FirstTenHotKeysFontSize", 5);
+}
+
+void CGetSetOptions::SetFirstTenHotKeysFontSize(int val)
+{
+	m_firstTenHotKeysFontSize = val;
+	SetProfileLong("FirstTenHotKeysFontSize", val);
 }

+ 8 - 0
Options.h

@@ -625,6 +625,14 @@ public:
 	static int m_doubleKeyStrokeTimeout;
 	static int GetDoubleKeyStrokeTimeout();
 	static void SetDoubleKeyStrokeTimeout(int val);
+
+	static int m_firstTenHotKeysStart;
+	static int GetFirstTenHotKeysStart();
+	static void SetFirstTenHotKeysStart(int val);
+
+	static int m_firstTenHotKeysFontSize;
+	static int GetFirstTenHotKeysFontSize();
+	static void SetFirstTenHotKeysFontSize(int val);
 };
 
 // global for easy access and for initialization of fast access variables

File diff suppressed because it is too large
+ 232 - 254
QListCtrl.cpp


+ 228 - 231
QListCtrl.h

@@ -1,231 +1,228 @@
- #if !defined(AFX_QLISTCTRL_H__30BEB04A_4B97_4943_BB73_C5128E66B4ED__INCLUDED_)
-#define AFX_QLISTCTRL_H__30BEB04A_4B97_4943_BB73_C5128E66B4ED__INCLUDED_
-
-#if _MSC_VER > 1000
-#pragma once
-#endif // _MSC_VER > 1000
-// QListCtrl.h : header file
-//
-#include "Shared/ArrayEx.h"
-#include "ToolTipEx.h"
-#include "FormattedTextDraw.h"
-#include "sqlite/CppSQLite3.h"
-#include "ClipFormatQListCtrl.h"
-#include "Accels.h"
-#include "GdiImageDrawer.h"
-#include "DPI.h"
-
-#define NM_SEARCH_ENTER_PRESSED		WM_USER+0x100
-#define NM_RIGHT					WM_USER+0x101
-#define NM_LEFT						WM_USER+0x102
-#define NM_END						WM_USER+0x103
-#define NM_DELETE					WM_USER+0x104
-#define NM_PROPERTIES				WM_USER+0x105
-#define NM_LBUTTONDOWN				WM_USER+0x106
-#define NM_GETTOOLTIPTEXT	        WM_USER+0x107
-#define NM_SELECT_DB_ID		        WM_USER+0x108
-#define NM_GROUP_TREE_MESSAGE       WM_USER+0x110
-#define CB_SEARCH					WM_USER+0x112
-#define CB_UPDOWN					WM_USER+0x113
-#define NM_INACTIVE_TOOLTIPWND		WM_USER+0x114
-#define NM_FILL_REST_OF_LIST		WM_USER+0x115
-
-#define NM_SET_LIST_COUNT			WM_USER+0x116
-#define NM_ITEM_DELETED				WM_USER+0x118
-#define NM_ALL_SELECTED				WM_USER+0x119
-#define NM_REFRESH_ROW				WM_USER+0x120
-#define NM_REFRESH_ROW_EXTRA_DATA	WM_USER+0x121
-#define NM_SHOW_HIDE_SCROLLBARS		WM_USER+0x122
-#define NM_CANCEL_SEARCH			WM_USER+0x123
-#define NM_POST_OPTIONS_WINDOW		WM_USER+0x124
-#define NM_SHOW_PROPERTIES			WM_USER+0x125
-#define NM_NEW_GROUP				WM_USER+0x126
-#define NM_DELETE_ID				WM_USER+0x127
-#define NM_MOVE_TO_GROUP			WM_USER+0x128
-#define NM_FOCUS_ON_SEARCH			WM_USER+0x129
-#define NM_COPY_CLIP				WM_USER+0x130
-
-
-
-#define COPY_BUFFER_HOT_KEY_1_ID	-100
-#define COPY_BUFFER_HOT_KEY_2_ID	-101
-#define COPY_BUFFER_HOT_KEY_3_ID	-102
-
-#define LVIF_CF_DIB 0x10000000
-#define LVIF_CF_RICHTEXT 0x10000000
-
-
-//#define NM_LIST_CUT			        WM_USER+0x111
-//#define NM_LIST_COPY		        WM_USER+0x112
-//#define NM_LIST_PASTE		        WM_USER+0x113
-
-class CQListToolTipText
-{
-public:
-	NMHDR hdr;
-	long lItem;
-	LPTSTR pszText; 
-	int cchTextMax; 
-};
-
-
-
-typedef CMap<long, long, CClipFormat, CClipFormat&> CMapIDtoCF;
-
-class CQListCtrl : public CListCtrl
-{
-// Construction
-public:
-	CQListCtrl();
-
-// Attributes
-public:
-
-// Operations
-public:
-
-// Overrides
-	// ClassWizard generated virtual function overrides
-	//{{AFX_VIRTUAL(CQListCtrl)
-	public:
-	virtual INT_PTR OnToolHitTest(CPoint point, TOOLINFO * pTI) const;
-	virtual BOOL PreTranslateMessage(MSG* pMsg);
-	virtual BOOL OnChildNotify(UINT message, WPARAM wParam, LPARAM lParam, LRESULT* pLResult);
-	//}}AFX_VIRTUAL
-
-// Implementation
-public:
-	virtual ~CQListCtrl();
-
-	// The "FirstTen" block is either at the top or the bottom
-	//  of the list based upon m_bStartTop.
-	BOOL	m_bShowTextForFirstTenHotKeys;
-	BOOL	m_bStartTop;
-	// returns the position 1-10 if the index is in the FirstTen block else -1
-	int GetFirstTenNum( int index );
-	// returns the list index corresponding to the given FirstTen position number.
-	int GetFirstTenIndex( int num );
-
-	void SetNumberOfLinesPerRow(int nLines, bool force);
-	void GetSelectionIndexes(ARRAY &arr);
-	void GetSelectionItemData(ARRAY &arr);
-	void RefreshVisibleRows();
-	void RefreshRow(int row);
-	void RemoveAllSelection();
-	BOOL SetSelection(int nRow, BOOL bSelect = TRUE);
-	BOOL SetText(int nRow, int nCol, CString cs);
-	BOOL SetFormattedText(int nRow, int nCol, LPCTSTR lpszFormat,...);
-	BOOL SetCaret(int nRow, BOOL bFocus = TRUE);
-	long GetCaret();
-	// moves the caret to the given index, selects it, and ensures it is visible.
-	BOOL SetListPos(int index);
-	bool PutSelectedItemOnDittoCopyBuffer(long lBuffer);
-
-	virtual DROPEFFECT OnDragOver(COleDataObject* pDataObject, DWORD dwKeyState, CPoint point);
-
-	DWORD GetItemData(int nItem);
-	CClipFormatQListCtrl* GetItem_CF_DIB_ClipFormat(int nItem);
-	CClipFormatQListCtrl* GetItem_CF_RTF_ClipFormat(int nItem);
-	void GetToolTipText(int nItem, CString &csText);
-
-	void SetShowTextForFirstTenHotKeys(BOOL bVal)	{ m_bShowTextForFirstTenHotKeys = bVal;	}
-	void SetShowIfClipWasPasted(BOOL val) { m_showIfClipWasPasted = val; }
-
-	void DestroyAndCreateAccelerator(BOOL bCreate, CppSQLite3DB &db);
-
-	bool PostEventLoadedCheckDescription(int updatedRow);
-	bool ShowFullDescription(bool bFromAuto = false, bool fromNextPrev = false);
-	BOOL SetItemCountEx(int iCount, DWORD dwFlags = 0);
-
-	void HidePopup(bool checkShowPersistant);
-	void ToggleToolTipShowPersistant();
-	bool ToggleToolTipWordWrap();
-	void SetTooltipActions(CAccels *pToolTipActions) { m_pToolTipActions = pToolTipActions; }
-	bool IsToolTipShowPersistant();
-	void DoToolTipSearch();
-	void HideToolTip();
-
-	void SetLogFont(LOGFONT &font);
-
-	HWND GetToolTipHWnd();
-
-	BOOL HandleKeyDown(WPARAM wParam, LPARAM lParam);
-
-	BOOL OnItemDeleted(long lID);
-
-	BOOL IsToolTipWindowVisible();
-	BOOL IsToolTipWindowFocus();
-
-	int GetRowHeight() { return m_rowHeight; }
-
-	void SetSearchText(CString text);
-
-	void SetDpiInfo(CDPI *dpi);
-
-	void OnDpiChanged();
-	
-	void LoadCopyOrCutToClipboard();
-
-protected:
-	BOOL GetClipData(int nItem, CClipFormat &Clip);
-	BOOL DrawBitMap(int nItem, CRect &crRect, CDC *pDC, const CString &csDescription);
-	void LoadDittoCopyBufferHotkeys();
-	bool MouseInScrollBarArea(CRect crWindow, CPoint point);
-	BOOL DrawRtfText(int nItem, CRect &crRect, CDC *pDC);
-	void StopHideScrollBarTimer();
-		
-	WCHAR *m_pwchTip;
-	TCHAR *m_pchTip;
-	HFONT m_SmallFont;
-	CAccels	m_Accels;
-	CMapIDtoCF m_RTFData;
-	CToolTipEx *m_pToolTip;
-	HWND m_toolTipHwnd;
-	CFont m_Font;
-	CFont m_boldFont;
-	IFormattedTextDraw *m_pFormatter;
-	bool m_allSelected;
-	int m_linesPerRow;
-	DWORD m_mouseOverScrollAreaStart;
-	bool m_timerToHideScrollAreaSet;
-	CGdiImageDrawer m_groupFolder;
-	CGdiImageDrawer m_dontDeleteImage;
-	CGdiImageDrawer m_inFolderImage;
-	CGdiImageDrawer m_shortCutImage;
-	CGdiImageDrawer m_stickyImage;
-	int m_rowHeight;
-	CString m_searchText;
-	BOOL m_showIfClipWasPasted;
-	CAccels *m_pToolTipActions;
-	CRichEditCtrlEx m_rtfFormater;
-	CDPI *m_windowDpi;
-
-
-	// Generated message map functions
-protected:
-	//{{AFX_MSG(CQListCtrl)
-	afx_msg void OnKeydown(NMHDR* pNMHDR, LRESULT* pResult);
-	afx_msg void OnCustomdrawList(NMHDR* pNMHDR, LRESULT* pResult);
-	afx_msg void OnSysKeyDown(UINT nChar, UINT nRepCnt, UINT nFlags);
-	afx_msg BOOL OnEraseBkgnd(CDC* pDC);
-	afx_msg int OnCreate(LPCREATESTRUCT lpCreateStruct);
-	afx_msg void OnHScroll(UINT nSBCode, UINT nPos, CScrollBar* pScrollBar);
-	afx_msg void OnTimer(UINT_PTR nIDEvent);
-	afx_msg void OnSelectionChange(NMHDR* pNMHDR, LRESULT* pResult);
-	afx_msg void OnVScroll(UINT nSBCode, UINT nPos, CScrollBar* pScrollBar);
-	//}}AFX_MSG
-	afx_msg BOOL OnToolTipText(UINT id, NMHDR * pNMHDR, LRESULT * pResult);
-	afx_msg void MeasureItem(LPMEASUREITEMSTRUCT lpMeasureItemStruct);
-	afx_msg void OnMouseMove(UINT nFlags, CPoint point);
-	DECLARE_MESSAGE_MAP()
-public:
-	afx_msg void OnKillFocus(CWnd* pNewWnd);
-	afx_msg void OnMouseHWheel(UINT nFlags, short zDelta, CPoint pt);
-};
-
-/////////////////////////////////////////////////////////////////////////////
-
-//{{AFX_INSERT_LOCATION}}
-// Microsoft Visual C++ will insert additional declarations immediately before the previous line.
-
-#endif // !defined(AFX_QLISTCTRL_H__30BEB04A_4B97_4943_BB73_C5128E66B4ED__INCLUDED_)
+ #if !defined(AFX_QLISTCTRL_H__30BEB04A_4B97_4943_BB73_C5128E66B4ED__INCLUDED_)
+#define AFX_QLISTCTRL_H__30BEB04A_4B97_4943_BB73_C5128E66B4ED__INCLUDED_
+
+#if _MSC_VER > 1000
+#pragma once
+#endif // _MSC_VER > 1000
+// QListCtrl.h : header file
+//
+#include "Shared/ArrayEx.h"
+#include "ToolTipEx.h"
+#include "FormattedTextDraw.h"
+#include "sqlite/CppSQLite3.h"
+#include "ClipFormatQListCtrl.h"
+#include "Accels.h"
+#include "GdiImageDrawer.h"
+#include "DPI.h"
+
+#define NM_SEARCH_ENTER_PRESSED		WM_USER+0x100
+#define NM_RIGHT					WM_USER+0x101
+#define NM_LEFT						WM_USER+0x102
+#define NM_END						WM_USER+0x103
+#define NM_DELETE					WM_USER+0x104
+#define NM_PROPERTIES				WM_USER+0x105
+#define NM_LBUTTONDOWN				WM_USER+0x106
+#define NM_GETTOOLTIPTEXT	        WM_USER+0x107
+#define NM_SELECT_DB_ID		        WM_USER+0x108
+#define NM_GROUP_TREE_MESSAGE       WM_USER+0x110
+#define CB_SEARCH					WM_USER+0x112
+#define CB_UPDOWN					WM_USER+0x113
+#define NM_INACTIVE_TOOLTIPWND		WM_USER+0x114
+#define NM_FILL_REST_OF_LIST		WM_USER+0x115
+
+#define NM_SET_LIST_COUNT			WM_USER+0x116
+#define NM_ITEM_DELETED				WM_USER+0x118
+#define NM_ALL_SELECTED				WM_USER+0x119
+#define NM_REFRESH_ROW				WM_USER+0x120
+#define NM_REFRESH_ROW_EXTRA_DATA	WM_USER+0x121
+#define NM_SHOW_HIDE_SCROLLBARS		WM_USER+0x122
+#define NM_CANCEL_SEARCH			WM_USER+0x123
+#define NM_POST_OPTIONS_WINDOW		WM_USER+0x124
+#define NM_SHOW_PROPERTIES			WM_USER+0x125
+#define NM_NEW_GROUP				WM_USER+0x126
+#define NM_DELETE_ID				WM_USER+0x127
+#define NM_MOVE_TO_GROUP			WM_USER+0x128
+#define NM_FOCUS_ON_SEARCH			WM_USER+0x129
+#define NM_COPY_CLIP				WM_USER+0x130
+
+
+
+#define COPY_BUFFER_HOT_KEY_1_ID	-100
+#define COPY_BUFFER_HOT_KEY_2_ID	-101
+#define COPY_BUFFER_HOT_KEY_3_ID	-102
+
+#define LVIF_CF_DIB 0x10000000
+#define LVIF_CF_RICHTEXT 0x10000000
+
+
+//#define NM_LIST_CUT			        WM_USER+0x111
+//#define NM_LIST_COPY		        WM_USER+0x112
+//#define NM_LIST_PASTE		        WM_USER+0x113
+
+class CQListToolTipText
+{
+public:
+	NMHDR hdr;
+	long lItem;
+	LPTSTR pszText; 
+	int cchTextMax; 
+};
+
+
+
+typedef CMap<long, long, CClipFormat, CClipFormat&> CMapIDtoCF;
+
+class CQListCtrl : public CListCtrl
+{
+// Construction
+public:
+	CQListCtrl();
+
+// Attributes
+public:
+
+// Operations
+public:
+
+// Overrides
+	// ClassWizard generated virtual function overrides
+	//{{AFX_VIRTUAL(CQListCtrl)
+	public:
+	virtual INT_PTR OnToolHitTest(CPoint point, TOOLINFO * pTI) const;
+	virtual BOOL PreTranslateMessage(MSG* pMsg);
+	virtual BOOL OnChildNotify(UINT message, WPARAM wParam, LPARAM lParam, LRESULT* pLResult);
+	//}}AFX_VIRTUAL
+
+// Implementation
+public:
+	virtual ~CQListCtrl();
+
+	BOOL	m_bShowTextForFirstTenHotKeys;
+	// returns the position 1-10 if the index is in the FirstTen block else -1
+	int GetFirstTenNum( int index );
+
+	void SetNumberOfLinesPerRow(int nLines, bool force);
+	void GetSelectionIndexes(ARRAY &arr);
+	void GetSelectionItemData(ARRAY &arr);
+	void RefreshVisibleRows();
+	void RefreshRow(int row);
+	void RemoveAllSelection();
+	BOOL SetSelection(int nRow, BOOL bSelect = TRUE);
+	BOOL SetText(int nRow, int nCol, CString cs);
+	BOOL SetFormattedText(int nRow, int nCol, LPCTSTR lpszFormat,...);
+	BOOL SetCaret(int nRow, BOOL bFocus = TRUE);
+	long GetCaret();
+	// moves the caret to the given index, selects it, and ensures it is visible.
+	BOOL SetListPos(int index);
+	bool PutSelectedItemOnDittoCopyBuffer(long lBuffer);
+
+	virtual DROPEFFECT OnDragOver(COleDataObject* pDataObject, DWORD dwKeyState, CPoint point);
+
+	DWORD GetItemData(int nItem);
+	CClipFormatQListCtrl* GetItem_CF_DIB_ClipFormat(int nItem);
+	CClipFormatQListCtrl* GetItem_CF_RTF_ClipFormat(int nItem);
+	void GetToolTipText(int nItem, CString &csText);
+
+	void SetShowTextForFirstTenHotKeys(BOOL bVal)	{ m_bShowTextForFirstTenHotKeys = bVal;	}
+	void SetShowIfClipWasPasted(BOOL val) { m_showIfClipWasPasted = val; }
+
+	void DestroyAndCreateAccelerator(BOOL bCreate, CppSQLite3DB &db);
+
+	bool PostEventLoadedCheckDescription(int updatedRow);
+	bool ShowFullDescription(bool bFromAuto = false, bool fromNextPrev = false);
+	BOOL SetItemCountEx(int iCount, DWORD dwFlags = 0);
+
+	void HidePopup(bool checkShowPersistant);
+	void ToggleToolTipShowPersistant();
+	bool ToggleToolTipWordWrap();
+	void SetTooltipActions(CAccels *pToolTipActions) { m_pToolTipActions = pToolTipActions; }
+	bool IsToolTipShowPersistant();
+	void DoToolTipSearch();
+	void HideToolTip();
+
+	void SetLogFont(LOGFONT &font);
+
+	HWND GetToolTipHWnd();
+
+	BOOL HandleKeyDown(WPARAM wParam, LPARAM lParam);
+
+	BOOL OnItemDeleted(long lID);
+
+	BOOL IsToolTipWindowVisible();
+	BOOL IsToolTipWindowFocus();
+
+	int GetRowHeight() { return m_rowHeight; }
+
+	void SetSearchText(CString text);
+
+	void SetDpiInfo(CDPI *dpi);
+
+	void CreateSmallFont();
+
+	void OnDpiChanged();
+	
+	void LoadCopyOrCutToClipboard();
+
+protected:
+	BOOL GetClipData(int nItem, CClipFormat &Clip);
+	BOOL DrawBitMap(int nItem, CRect &crRect, CDC *pDC, const CString &csDescription);
+	void LoadDittoCopyBufferHotkeys();
+	bool MouseInScrollBarArea(CRect crWindow, CPoint point);
+	BOOL DrawRtfText(int nItem, CRect &crRect, CDC *pDC);
+	void StopHideScrollBarTimer();
+		
+	WCHAR *m_pwchTip;
+	TCHAR *m_pchTip;
+	HFONT m_SmallFont;
+	CAccels	m_Accels;
+	CMapIDtoCF m_RTFData;
+	CToolTipEx *m_pToolTip;
+	HWND m_toolTipHwnd;
+	CFont m_Font;
+	CFont m_boldFont;
+	IFormattedTextDraw *m_pFormatter;
+	bool m_allSelected;
+	int m_linesPerRow;
+	DWORD m_mouseOverScrollAreaStart;
+	bool m_timerToHideScrollAreaSet;
+	CGdiImageDrawer m_groupFolder;
+	CGdiImageDrawer m_dontDeleteImage;
+	CGdiImageDrawer m_inFolderImage;
+	CGdiImageDrawer m_shortCutImage;
+	CGdiImageDrawer m_stickyImage;
+	int m_rowHeight;
+	CString m_searchText;
+	BOOL m_showIfClipWasPasted;
+	CAccels *m_pToolTipActions;
+	CRichEditCtrlEx m_rtfFormater;
+	CDPI *m_windowDpi;
+
+
+	// Generated message map functions
+protected:
+	//{{AFX_MSG(CQListCtrl)
+	afx_msg void OnKeydown(NMHDR* pNMHDR, LRESULT* pResult);
+	afx_msg void OnCustomdrawList(NMHDR* pNMHDR, LRESULT* pResult);
+	afx_msg void OnSysKeyDown(UINT nChar, UINT nRepCnt, UINT nFlags);
+	afx_msg BOOL OnEraseBkgnd(CDC* pDC);
+	afx_msg int OnCreate(LPCREATESTRUCT lpCreateStruct);
+	afx_msg void OnHScroll(UINT nSBCode, UINT nPos, CScrollBar* pScrollBar);
+	afx_msg void OnTimer(UINT_PTR nIDEvent);
+	afx_msg void OnSelectionChange(NMHDR* pNMHDR, LRESULT* pResult);
+	afx_msg void OnVScroll(UINT nSBCode, UINT nPos, CScrollBar* pScrollBar);
+	//}}AFX_MSG
+	afx_msg BOOL OnToolTipText(UINT id, NMHDR * pNMHDR, LRESULT * pResult);
+	afx_msg void MeasureItem(LPMEASUREITEMSTRUCT lpMeasureItemStruct);
+	afx_msg void OnMouseMove(UINT nFlags, CPoint point);
+	DECLARE_MESSAGE_MAP()
+public:
+	afx_msg void OnKillFocus(CWnd* pNewWnd);
+	afx_msg void OnMouseHWheel(UINT nFlags, short zDelta, CPoint pt);
+};
+
+/////////////////////////////////////////////////////////////////////////////
+
+//{{AFX_INSERT_LOCATION}}
+// Microsoft Visual C++ will insert additional declarations immediately before the previous line.
+
+#endif // !defined(AFX_QLISTCTRL_H__30BEB04A_4B97_4943_BB73_C5128E66B4ED__INCLUDED_)

File diff suppressed because it is too large
+ 392 - 392
QPasteWnd.cpp


Some files were not shown because too many files changed in this diff