1
0
Эх сурвалжийг харах

- simple search (not not or ands)
- option to move clips to the top if pasted from top 10 shortcut keys
- sticky clips

git-svn-id: svn://svn.code.sf.net/p/ditto-cp/code/trunk@676 595ec19a-5cb4-439b-94a8-42fb3063c22c

sabrogden 12 жил өмнө
parent
commit
eb36b174f3
19 өөрчлөгдсөн 3084 нэмэгдсэн , 2537 устгасан
  1. 41 32
      CP_Main.rc
  2. 3 0
      CP_Main.vcxproj
  3. 2 0
      CP_Main.vcxproj.filters
  4. 126 3
      Clip.cpp
  5. 7 0
      Clip.h
  6. 22 3
      DatabaseUtilities.cpp
  7. 12 1
      FormatSQL.cpp
  8. 1 1
      MainFrm.cpp
  9. 35 0
      MyDropTarget.cpp
  10. 18 0
      MyDropTarget.h
  11. 2066 2039
      Options.cpp
  12. 440 435
      Options.h
  13. 4 0
      OptionsKeyBoard.cpp
  14. 1 0
      OptionsKeyBoard.h
  15. 20 18
      QListCtrl.cpp
  16. 2 0
      QListCtrl.h
  17. 236 4
      QPasteWnd.cpp
  18. 41 0
      QPasteWnd.h
  19. 7 1
      Resource.h

+ 41 - 32
CP_Main.rc

@@ -291,6 +291,12 @@ BEGIN
             MENUITEM "Remove Hot Key",              32822,MFT_STRING,MFS_ENABLED
             MENUITEM "Remove Quick Paste",          32856,MFT_STRING | MFT_RIGHTJUSTIFY,MFS_ENABLED
         END
+        POPUP "Sticky Clips",                   65535,MFT_STRING,MFS_ENABLED
+        BEGIN
+            MENUITEM "Make Top Sticky Clip",        ID_STICKYCLIPS_MAKETOPSTICKYCLIP,MFT_STRING,MFS_ENABLED
+            MENUITEM "Make Last Sticky Clip",       ID_STICKYCLIPS_MAKELASTSTICKYCLIP,MFT_STRING,MFS_ENABLED
+            MENUITEM "Remove Sticky Setting",       ID_STICKYCLIPS_REMOVESTICKYSETTING,MFT_STRING,MFS_ENABLED
+        END
         MENUITEM MFT_SEPARATOR
         MENUITEM "Import Clip(s)",              32855,MFT_STRING,MFS_ENABLED
         MENUITEM "Export Clip(s)",              32853,MFT_STRING,MFS_ENABLED
@@ -312,6 +318,7 @@ BEGIN
         MENUITEM "Search Description",          ID_MENU_SEARCHDESCRIPTION
         MENUITEM "Search Full Text",            ID_MENU_SEARCHFULLTEXT
         MENUITEM "Search Quick Paste",          ID_MENU_SEARCHQUICKPASTE
+        MENUITEM "Contains Text Search Only",   ID_MENU_CONTAINSTEXTSEARCHONLY
     END
 END
 
@@ -431,42 +438,44 @@ BEGIN
     LTEXT           "Send custom strokes Per Application",IDC_STATIC_CUSTOM_KEYS,210,16,133,8
     CONTROL         "",IDC_HOTKEY_TEXT_ONLY,"msctls_hotkey32",WS_BORDER | WS_TABSTOP,91,33,80,14
     CONTROL         "Win",IDC_CHECK_WIN_TEXT_ONLY,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,174,33,33,14
-    CONTROL         "HotKey1",IDC_HOTKEY1,"msctls_hotkey32",WS_BORDER | WS_TABSTOP,66,80,80,14
-    CONTROL         "Win",IDC_CHECK_WIN1,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,146,80,33,14
-    CONTROL         "HotKey1",IDC_HOTKEY2,"msctls_hotkey32",WS_BORDER | WS_TABSTOP,66,95,80,14
-    CONTROL         "Win",IDC_CHECK_WIN2,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,146,95,33,14
-    CONTROL         "HotKey1",IDC_HOTKEY3,"msctls_hotkey32",WS_BORDER | WS_TABSTOP,66,110,80,14
-    CONTROL         "Win",IDC_CHECK_WIN3,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,147,110,33,14
-    CONTROL         "HotKey1",IDC_HOTKEY4,"msctls_hotkey32",WS_BORDER | WS_TABSTOP,66,125,80,14
-    CONTROL         "Win",IDC_CHECK_WIN4,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,146,125,33,14
-    CONTROL         "HotKey1",IDC_HOTKEY5,"msctls_hotkey32",WS_BORDER | WS_TABSTOP,66,140,80,14
-    CONTROL         "Win",IDC_CHECK_WIN5,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,146,140,33,14
-    CONTROL         "HotKey1",IDC_HOTKEY6,"msctls_hotkey32",WS_BORDER | WS_TABSTOP,229,80,80,14
-    CONTROL         "Win",IDC_CHECK_WIN6,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,309,80,27,14
-    CONTROL         "HotKey1",IDC_HOTKEY7,"msctls_hotkey32",WS_BORDER | WS_TABSTOP,229,95,80,14
-    CONTROL         "Win",IDC_CHECK_WIN7,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,309,95,26,14
-    CONTROL         "HotKey1",IDC_HOTKEY8,"msctls_hotkey32",WS_BORDER | WS_TABSTOP,229,110,80,14
-    CONTROL         "Win",IDC_CHECK_WIN8,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,310,110,26,14
-    CONTROL         "HotKey1",IDC_HOTKEY9,"msctls_hotkey32",WS_BORDER | WS_TABSTOP,229,125,80,14
-    CONTROL         "Win",IDC_CHECK_WIN9,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,309,125,27,14
-    CONTROL         "HotKey1",IDC_HOTKEY10,"msctls_hotkey32",WS_BORDER | WS_TABSTOP,229,140,80,14
-    CONTROL         "Win",IDC_CHECK_WIN10,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,309,140,27,14
+    CONTROL         "HotKey1",IDC_HOTKEY1,"msctls_hotkey32",WS_BORDER | WS_TABSTOP,66,92,80,14
+    CONTROL         "Win",IDC_CHECK_WIN1,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,146,92,33,14
+    CONTROL         "HotKey1",IDC_HOTKEY2,"msctls_hotkey32",WS_BORDER | WS_TABSTOP,66,107,80,14
+    CONTROL         "Win",IDC_CHECK_WIN2,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,146,107,33,14
+    CONTROL         "HotKey1",IDC_HOTKEY3,"msctls_hotkey32",WS_BORDER | WS_TABSTOP,66,122,80,14
+    CONTROL         "Win",IDC_CHECK_WIN3,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,147,122,33,14
+    CONTROL         "HotKey1",IDC_HOTKEY4,"msctls_hotkey32",WS_BORDER | WS_TABSTOP,66,137,80,14
+    CONTROL         "Win",IDC_CHECK_WIN4,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,146,137,33,14
+    CONTROL         "HotKey1",IDC_HOTKEY5,"msctls_hotkey32",WS_BORDER | WS_TABSTOP,66,152,80,14
+    CONTROL         "Win",IDC_CHECK_WIN5,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,146,152,33,14
+    CONTROL         "HotKey1",IDC_HOTKEY6,"msctls_hotkey32",WS_BORDER | WS_TABSTOP,229,92,80,14
+    CONTROL         "Win",IDC_CHECK_WIN6,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,309,92,27,14
+    CONTROL         "HotKey1",IDC_HOTKEY7,"msctls_hotkey32",WS_BORDER | WS_TABSTOP,229,107,80,14
+    CONTROL         "Win",IDC_CHECK_WIN7,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,309,107,26,14
+    CONTROL         "HotKey1",IDC_HOTKEY8,"msctls_hotkey32",WS_BORDER | WS_TABSTOP,229,122,80,14
+    CONTROL         "Win",IDC_CHECK_WIN8,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,310,122,26,14
+    CONTROL         "HotKey1",IDC_HOTKEY9,"msctls_hotkey32",WS_BORDER | WS_TABSTOP,229,137,80,14
+    CONTROL         "Win",IDC_CHECK_WIN9,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,309,137,27,14
+    CONTROL         "HotKey1",IDC_HOTKEY10,"msctls_hotkey32",WS_BORDER | WS_TABSTOP,229,152,80,14
+    CONTROL         "Win",IDC_CHECK_WIN10,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,309,152,27,14
     CONTROL         "Send Paste (Otherwise it will just load the item on the clipboard)",IDC_CHECK_SEND_PASTE,
                     "Button",BS_AUTOCHECKBOX | WS_TABSTOP,19,66,324,13
-    GROUPBOX        "Global Hot Keys for Last Ten Items Copied",IDC_STATIC_GROUP,7,56,336,105
+    GROUPBOX        "Global Hot Keys for Last Ten Items Copied",IDC_STATIC_GROUP,7,55,336,116
     LTEXT           "Activate Ditto",IDC_STATIC_ACTIVATE,19,13,71,14,SS_CENTERIMAGE
-    RTEXT           "Position 1",IDC_STATIC_1,16,80,42,14,SS_CENTERIMAGE
-    RTEXT           "Position 2",IDC_STATIC_2,16,95,42,14,SS_CENTERIMAGE
-    RTEXT           "Position 3",IDC_STATIC_3,16,110,42,14,SS_CENTERIMAGE
-    RTEXT           "Position 4",IDC_STATIC_4,16,125,42,14,SS_CENTERIMAGE
-    RTEXT           "Position 5",IDC_STATIC_5,16,140,42,14,SS_CENTERIMAGE
-    RTEXT           "Position 6",IDC_STATIC_6,181,80,42,14,SS_CENTERIMAGE
-    RTEXT           "Position 7",IDC_STATIC_7,181,95,42,14,SS_CENTERIMAGE
-    RTEXT           "Position 8",IDC_STATIC_8,181,110,42,14,SS_CENTERIMAGE
-    RTEXT           "Position 9",IDC_STATIC_9,181,125,42,14,SS_CENTERIMAGE
-    RTEXT           "Position 10",IDC_STATIC_10,181,140,42,14,SS_CENTERIMAGE
-    LTEXT           "Check the ""Win"" Button to include the windows keyboard key in your hot key.",IDC_STATIC_WIN,7,165,336,25
+    RTEXT           "Position 1",IDC_STATIC_1,16,92,42,14,SS_CENTERIMAGE
+    RTEXT           "Position 2",IDC_STATIC_2,16,107,42,14,SS_CENTERIMAGE
+    RTEXT           "Position 3",IDC_STATIC_3,16,122,42,14,SS_CENTERIMAGE
+    RTEXT           "Position 4",IDC_STATIC_4,16,137,42,14,SS_CENTERIMAGE
+    RTEXT           "Position 5",IDC_STATIC_5,16,152,42,14,SS_CENTERIMAGE
+    RTEXT           "Position 6",IDC_STATIC_6,181,92,42,14,SS_CENTERIMAGE
+    RTEXT           "Position 7",IDC_STATIC_7,181,107,42,14,SS_CENTERIMAGE
+    RTEXT           "Position 8",IDC_STATIC_8,181,122,42,14,SS_CENTERIMAGE
+    RTEXT           "Position 9",IDC_STATIC_9,181,137,42,14,SS_CENTERIMAGE
+    RTEXT           "Position 10",IDC_STATIC_10,181,152,42,14,SS_CENTERIMAGE
+    LTEXT           "Check the ""Win"" Button to include the windows keyboard key in your hot key.",IDC_STATIC_WIN,7,176,336,18
     LTEXT           "Text Only Paste",IDC_STATIC_ACTIVATE2,19,33,71,14,SS_CENTERIMAGE
+    CONTROL         "Move clips to the top of the list on paste",IDC_CHECK_MOVE_CLIPS_ON_PASTE,
+                    "Button",BS_AUTOCHECKBOX | WS_TABSTOP,19,78,324,13
 END
 
 IDD_OPTIONS_GENERAL DIALOGEX 0, 0, 351, 281

+ 3 - 0
CP_Main.vcxproj

@@ -21,6 +21,7 @@
   <PropertyGroup Label="Globals">
     <RootNamespace>CP_Main</RootNamespace>
     <Keyword>MFCProj</Keyword>
+    <ProjectGuid>{8ECC3EF2-AF07-27B6-A773-779874943C0D}</ProjectGuid>
   </PropertyGroup>
   <Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
   <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration">
@@ -567,6 +568,7 @@
     <ClCompile Include="HotKeys.cpp" />
     <ClCompile Include="MainFrmThread.cpp" />
     <ClCompile Include="MessagePumpThread.cpp" />
+    <ClCompile Include="MyDropTarget.cpp" />
     <ClCompile Include="Popup.cpp" />
     <ClCompile Include="QPasteWndThread.cpp" />
     <ClCompile Include="Shared\TextConvert.cpp" />
@@ -1769,6 +1771,7 @@
     <ClInclude Include="MainFrmThread.h" />
     <ClInclude Include="memdc.h" />
     <ClInclude Include="MessagePumpThread.h" />
+    <ClInclude Include="MyDropTarget.h" />
     <ClInclude Include="NumberEdit.h" />
     <ClInclude Include="Popup.h" />
     <ClInclude Include="QListCtrl.h" />

+ 2 - 0
CP_Main.vcxproj.filters

@@ -331,6 +331,7 @@
     <ClCompile Include="DPI.cpp">
       <Filter>source</Filter>
     </ClCompile>
+    <ClCompile Include="MyDropTarget.cpp" />
   </ItemGroup>
   <ItemGroup>
     <ClInclude Include="sqlite\CppSQLite3.h">
@@ -708,6 +709,7 @@
     <ClInclude Include="DPI.h">
       <Filter>header</Filter>
     </ClInclude>
+    <ClInclude Include="MyDropTarget.h" />
   </ItemGroup>
   <ItemGroup>
     <ResourceCompile Include="CP_Main.rc">

+ 126 - 3
Clip.cpp

@@ -167,6 +167,8 @@ CClip::CClip() :
 	m_bIsGroup(FALSE),
 	m_param1(0),
 	m_clipOrder(0),
+	m_stickyClipOrder(0),
+	m_stickyClipGroupOrder(0),
 	m_clipGroupOrder(0),
 	m_globalShortCut(FALSE)
 {
@@ -642,7 +644,8 @@ bool CClip::AddToMainTable()
 		m_csQuickPaste.Replace(_T("'"), _T("''"));
 
 		CString cs;
-		cs.Format(_T("INSERT into Main values(NULL, %d, '%s', %d, %d, %d, %d, %d, '%s', %f, %f, %d, %d);"),
+		cs.Format(_T("INSERT into Main (lDate, mText, lShortCut, lDontAutoDelete, CRC, bIsGroup, lParentID, QuickPasteText, clipOrder, clipGroupOrder, globalShortCut, lastPasteDate, stickyClipOrder, stickyClipGroupOrder) ")
+						_T("values(%d, '%s', %d, %d, %d, %d, %d, '%s', %f, %f, %d, %d, %f, %f);"),
 							(int)m_Time.GetTime(),
 							m_Desc,
 							m_shortCut,
@@ -654,7 +657,9 @@ bool CClip::AddToMainTable()
 							m_clipOrder,
 							m_clipGroupOrder,
 							m_globalShortCut,
-							(int)CTime::GetCurrentTime().GetTime());
+							(int)CTime::GetCurrentTime().GetTime(),
+							m_stickyClipOrder,
+							m_stickyClipGroupOrder);
 
 		theApp.m_db.execDML(cs);
 
@@ -685,7 +690,9 @@ bool CClip::ModifyMainTable()
 			_T("QuickPasteText = '%s', ")
 			_T("clipOrder = %f, ")
 			_T("clipGroupOrder = %f, ")
-			_T("globalShortCut = %d ")
+			_T("globalShortCut = %d, ")
+			_T("stickyClipOrder = %f, ")
+			_T("stickyClipGroupOrder = %f ")
 			_T("WHERE lID = %d;"), 
 			m_shortCut, 
 			m_Desc, 
@@ -695,6 +702,8 @@ bool CClip::ModifyMainTable()
 			m_clipOrder,
 			m_clipGroupOrder,
 			m_globalShortCut,
+			m_stickyClipOrder,
+			m_stickyClipGroupOrder,
 			m_id);
 
 		bRet = true;
@@ -744,6 +753,118 @@ bool CClip::AddToDataTable()
 	return true;
 }
 
+void CClip::MakeStickyTop(int parentId)
+{
+	if (parentId < 0)
+	{
+		m_stickyClipOrder = GetNewTopSticky(parentId, m_id);
+	}
+	else
+	{
+		m_stickyClipGroupOrder = GetNewTopSticky(parentId, m_id);
+	}
+}
+
+void CClip::MakeStickyLast(int parentId)
+{
+	if (parentId < 0)
+	{
+		m_stickyClipOrder = GetNewLastSticky(parentId, m_id);
+	}
+	else
+	{
+		m_stickyClipGroupOrder = GetNewLastSticky(parentId, m_id);
+	}
+}
+
+void CClip::RemoveStickySetting(int parentId)
+{
+	if (parentId < 0)
+	{
+		m_stickyClipOrder = 0;
+	}
+	else
+	{
+		m_stickyClipGroupOrder = 0;
+	}
+}
+
+double CClip::GetNewTopSticky(int parentId, int clipId)
+{
+	double newOrder = 1;
+	double existingMaxOrder = 0;
+	CString existingDesc = _T("");
+
+	try
+	{
+		if (parentId < 0)
+		{
+			CppSQLite3Query q = theApp.m_db.execQuery(_T("SELECT stickyClipOrder, mText FROM Main ORDER BY stickyClipOrder DESC LIMIT 1"));
+			if (q.eof() == false)
+			{
+				existingMaxOrder = q.getFloatField(_T("stickyClipOrder"));
+				existingDesc = q.getStringField(_T("mText"));
+				newOrder = existingMaxOrder + 1;
+			}
+		}
+		else
+		{
+			CppSQLite3Query q = theApp.m_db.execQueryEx(_T("SELECT stickyClipGroupOrder, mText FROM Main WHERE lParentID = %d ORDER BY stickyClipGroupOrder DESC LIMIT 1"), parentId);
+			if (q.eof() == false)
+			{
+				existingMaxOrder = q.getFloatField(_T("stickyClipGroupOrder"));
+				newOrder = existingMaxOrder + 1;
+			}
+		}
+
+		if (newOrder == 0.0)
+			newOrder += 1;
+
+		Log(StrF(_T("GetNewTopSticky, Id: %d, parentId: %d, CurrentMax: %f, CurrentDesc: %s, NewMax: %f"), clipId, parentId, existingMaxOrder, existingDesc, newOrder));
+	}
+	CATCH_SQLITE_EXCEPTION
+
+	return newOrder;
+}
+
+double CClip::GetNewLastSticky(int parentId, int clipId)
+{
+	double newOrder = 1;
+	double existingMaxOrder = 0;
+	CString existingDesc = _T("");
+
+	try
+	{
+		if (parentId < 0)
+		{
+			CppSQLite3Query q = theApp.m_db.execQuery(_T("SELECT stickyClipOrder, mText FROM Main ORDER BY stickyClipOrder LIMIT 1"));
+			if (q.eof() == false)
+			{
+				existingMaxOrder = q.getFloatField(_T("stickyClipOrder"));
+				existingDesc = q.getStringField(_T("mText"));
+				newOrder = existingMaxOrder - 1;
+			}
+		}
+		else
+		{
+			CppSQLite3Query q = theApp.m_db.execQueryEx(_T("SELECT stickyClipGroupOrder, mText FROM Main WHERE lParentID = %d ORDER BY stickyClipGroupOrder LIMIT 1"), parentId);
+			if (q.eof() == false)
+			{
+				existingMaxOrder = q.getFloatField(_T("stickyClipGroupOrder"));
+				newOrder = existingMaxOrder - 1;
+			}
+		}
+
+		if (newOrder == 0.0)
+			newOrder -= 1;
+
+		Log(StrF(_T("GetNewLastSticky, Id: %d, parentId: %d, CurrentMax: %f, CurrentDesc: %s, NewMax: %f"), clipId, parentId, existingMaxOrder, existingDesc, newOrder));
+	}
+	CATCH_SQLITE_EXCEPTION
+
+		return newOrder;
+}
+
 void CClip::MakeLatestOrder()
 {
 	m_clipOrder = GetNewOrder(-1, m_id);
@@ -805,6 +926,8 @@ BOOL CClip::LoadMainTable(int id)
 			m_clipGroupOrder = q.getFloatField(_T("clipGroupOrder"));
 			m_globalShortCut = q.getIntField(_T("globalShortCut"));
 			m_lastPasteDate = q.getIntField(_T("lastPasteDate"));
+			m_stickyClipOrder = q.getFloatField(_T("stickyClipOrder"));
+			m_stickyClipGroupOrder = q.getFloatField(_T("stickyClipGroupOrder"));
 
 			m_id = id;
 

+ 7 - 0
Clip.h

@@ -100,6 +100,8 @@ public:
 	int m_param1;
 	double m_clipOrder;
 	double m_clipGroupOrder;
+	double m_stickyClipOrder;
+	double m_stickyClipGroupOrder;
 	BOOL m_globalShortCut;
 	CTime m_lastPasteDate;
 
@@ -126,6 +128,9 @@ public:
 	bool ModifyMainTable();
 	bool SaveFromEditWnd(BOOL bUpdateDesc);
 	void MakeLatestOrder();
+	void MakeStickyTop(int parentId);
+	void MakeStickyLast(int parentId);
+	void RemoveStickySetting(int parentId);
 	BOOL LoadMainTable(int id);
 	DWORD GenerateCRC();
 
@@ -137,6 +142,8 @@ public:
 	static void LoadTypes(int id, CClipTypes& types);
 
 	static double GetNewOrder(int parentId, int clipId);
+	static double GetNewTopSticky(int parentId, int clipId);
+	static double GetNewLastSticky(int parentId, int clipId);
 	
 protected:
 	bool AddToMainTable();

+ 22 - 3
DatabaseUtilities.cpp

@@ -376,6 +376,21 @@ BOOL ValidDB(CString csPath, BOOL bUpgrade)
 
 			e.errorCode();
 		}
+
+		try
+		{
+			db.execQuery(_T("SELECT stickyClipOrder FROM Main"));
+		}
+		catch (CppSQLite3Exception& e)
+		{
+			if (didBackup == FALSE)
+				didBackup = BackupDB(csPath, backupFilePrefix);
+
+			db.execDML(_T("ALTER TABLE Main ADD stickyClipOrder REAL"));
+			db.execDML(_T("ALTER TABLE Main ADD stickyClipGroupOrder REAL"));
+
+			e.errorCode();
+		}
 	}
 	CATCH_SQLITE_EXCEPTION_AND_RETURN(FALSE)
 
@@ -569,17 +584,21 @@ BOOL RemoveOldEntries(bool checkIdleTime)
 				CClipIDs IDs;
 				int clipId;
 				
-				CppSQLite3Query q = db.execQueryEx(_T("SELECT lID, lShortCut, lParentID, lDontAutoDelete FROM Main WHERE bIsGroup = 0 ORDER BY clipOrder DESC LIMIT -1 OFFSET %d"), lMax);
+				CppSQLite3Query q = db.execQueryEx(_T("SELECT lID, lShortCut, lParentID, lDontAutoDelete, stickyClipOrder, stickyClipGroupOrder FROM Main WHERE bIsGroup = 0 ORDER BY clipOrder DESC LIMIT -1 OFFSET %d"), lMax);
 				while(q.eof() == false)
 				{
 					int shortcut = q.getIntField(_T("lShortCut"));
 					int dontDelete = q.getIntField(_T("lDontAutoDelete"));
 					int parentId = q.getIntField(_T("lParentID"));
+					double stickyClipOrder = q.getFloatField(_T("stickyClipOrder"));
+					double stickyClipGroupOrder = q.getFloatField(_T("stickyClipGroupOrder"));
 
 					//Only delete entries that have no shortcut and don't have the flag set
 					if(shortcut == 0 && 
 						dontDelete == 0 &&
-						parentId <= 0)
+						parentId <= 0 &&
+						stickyClipOrder == 0.0 &&
+						stickyClipGroupOrder == 0.0)
 					{
 						clipId = q.getIntField(_T("lID"));
 						IDs.Add(clipId);
@@ -609,7 +628,7 @@ BOOL RemoveOldEntries(bool checkIdleTime)
 				
 				CppSQLite3Query q = db.execQueryEx(_T("SELECT lID FROM Main ")
 													_T("WHERE lastPasteDate < %d AND ")
-													_T("bIsGroup = 0 AND lShortCut = 0 AND lParentID <= 0 AND lDontAutoDelete = 0"), (int)now.GetTime());
+													_T("bIsGroup = 0 AND lShortCut = 0 AND lParentID <= 0 AND lDontAutoDelete = 0 AND stickyClipOrder = 0 AND stickyClipGroupOrder = 0"), (int)now.GetTime());
 
 				while(q.eof() == false)
 				{

+ 12 - 1
FormatSQL.cpp

@@ -33,6 +33,13 @@ void CFormatSQL::Parse(CString cs)
 	//Replace all "|" with a space
 	cs.Replace(_T("|"), _T(" "));
 
+	if(CGetSetOptions::GetSimpleTextSearch())
+	{
+		eSpecialTypes invalid = eINVALID;
+		AddToSQL(cs, invalid, invalid);
+		return;
+	}
+
 	cs.Replace(_T("["), _T(" "));
 	cs.Replace(_T("]"), _T(" "));
 
@@ -128,7 +135,11 @@ bool CFormatSQL::AddToSQL(CString cs, eSpecialTypes &eNOTValue, eSpecialTypes &e
 	cs.TrimLeft();
 	cs.TrimRight();
 
-	if(cs.Find(_T("%")) < 0 && cs.Find(_T("?")) < 0)
+	if (CGetSetOptions::GetSimpleTextSearch())
+	{
+		csThisSQL.Format(_T("%s LIKE \'%%%s%%\'"), m_csVariable, cs);
+	}
+	else if(cs.Find(_T("%")) < 0 && cs.Find(_T("?")) < 0)
 	{
 		csThisSQL.Format(_T("%s%sLIKE \'%%%s%%\'"), m_csVariable, GetKeyWordString(eNOTValue), cs);
 	}

+ 1 - 1
MainFrm.cpp

@@ -413,7 +413,7 @@ void CMainFrame::DoFirstTenPositionsPaste(int nPos)
             {
                 //Don't move these to the top
                 BOOL bItWas = g_Opt.m_bUpdateTimeOnPaste;
-                g_Opt.m_bUpdateTimeOnPaste = FALSE;
+                g_Opt.m_bUpdateTimeOnPaste = CGetSetOptions::GetMoveClipsOnGlobal10();
 
                 CProcessPaste paste;
                 paste.GetClipIDs().Add(q.getIntField(_T("lID")));

+ 35 - 0
MyDropTarget.cpp

@@ -0,0 +1,35 @@
+#include "stdafx.h"
+#include "MyDropTarget.h"
+#include "QPasteWnd.h"
+
+
+CMyDropTarget::CMyDropTarget(CWnd *pMainWnd)
+{
+	m_pParent = pMainWnd;
+}
+
+CMyDropTarget::~CMyDropTarget()
+{
+
+}
+
+DROPEFFECT CMyDropTarget::OnDragEnter(CWnd* pWnd, COleDataObject* pDataObject, DWORD dwKeyState, CPoint point)
+{
+	return ((CQPasteWnd*) m_pParent)->OnDragEnter(pDataObject, dwKeyState, point);
+}
+
+DROPEFFECT CMyDropTarget::OnDragOver(CWnd* pWnd, COleDataObject* pDataObject, DWORD dwKeyState, CPoint point)
+{
+	return ((CQPasteWnd*) m_pParent)->OnDragOver(pDataObject, dwKeyState, point);
+}
+
+BOOL CMyDropTarget::OnDrop(CWnd* pWnd, COleDataObject* pDataObject, DROPEFFECT dropEffect, CPoint point)
+{
+	return ((CQPasteWnd*) m_pParent)->OnDrop(pDataObject, dropEffect, point);
+}
+
+void CMyDropTarget::OnDragLeave(CWnd* pWnd)
+{
+	return ((CQPasteWnd*) m_pParent)->OnDragLeave();
+}
+

+ 18 - 0
MyDropTarget.h

@@ -0,0 +1,18 @@
+#pragma once
+#include "afxole.h"
+
+class CMyDropTarget : public COleDropTarget
+{
+public:
+	DROPEFFECT OnDragEnter(CWnd* pWnd, COleDataObject* pDataObject, DWORD dwKeyState, CPoint point);
+	DROPEFFECT OnDragOver(CWnd* pWnd, COleDataObject* pDataObject, DWORD dwKeyState, CPoint point);
+	BOOL OnDrop(CWnd* pWnd, COleDataObject* pDataObject, DROPEFFECT dropEffect, CPoint point);
+	void OnDragLeave(CWnd* pWnd);
+
+	CMyDropTarget(CWnd *pMainWnd);
+	virtual ~CMyDropTarget();
+
+private:
+	CWnd *m_pParent;
+};
+

+ 2066 - 2039
Options.cpp

@@ -1,2040 +1,2067 @@
-#include "stdafx.h"
-#include "Options.h"
-#include "AlphaBlend.h"
-#include "Misc.h"
-#include "shared/TextConvert.h"
-#include "sqlite\CppSQLite3.h"
-#include "Path.h"
-
-using namespace nsPath;
-
-UINT WritePrivateProfileInt(LPCTSTR lpAppName, LPCTSTR lpKeyName, INT nValue, LPCTSTR lpFileName)
-{
-	// Locals
-	TCHAR	szBuff[25];
-
-	// Format
-	SPRINTF(szBuff, _T("%d"), nValue);
-
-	// Write
-	return WritePrivateProfileString(lpAppName, lpKeyName, szBuff, lpFileName);
-}
-
-long CGetSetOptions::m_nLinesPerRow;
-BOOL CGetSetOptions::m_bUseCtrlNumAccel;
-BOOL CGetSetOptions::m_bAllowDuplicates;
-BOOL CGetSetOptions::m_bUpdateTimeOnPaste;
-BOOL CGetSetOptions::m_bSaveMultiPaste;
-BOOL CGetSetOptions::m_bShowPersistent;
-long CGetSetOptions::m_bDescTextSize;
-BOOL CGetSetOptions::m_bDescShowLeadingWhiteSpace;
-BOOL CGetSetOptions::m_bAllwaysShowDescription;
-long CGetSetOptions::m_bDoubleClickingOnCaptionDoes;
-BOOL CGetSetOptions::m_bPrompForNewGroupName;
-BOOL CGetSetOptions::m_bSendPasteOnFirstTenHotKeys;
-CSendClients CGetSetOptions::m_SendClients[MAX_SEND_CLIENTS];
-long CGetSetOptions::m_lAutoSendClientCount;
-CString CGetSetOptions::m_csIPListToPutOnClipboard;
-BOOL CGetSetOptions::m_bLogSendReceiveErrors;
-BOOL CGetSetOptions::m_HideDittoOnHotKeyIfAlreadyShown;
-long CGetSetOptions::m_lPort;
-BOOL CGetSetOptions::m_bDrawThumbnail;
-CStringA CGetSetOptions::m_csPassword;
-BOOL CGetSetOptions::m_bDrawRTF;
-BOOL CGetSetOptions::m_bMultiPasteReverse;
-CString CGetSetOptions::m_csPlaySoundOnCopy;
-CStringArray CGetSetOptions::m_csNetworkPasswordArray;
-BOOL CGetSetOptions::m_bSendPasteMessageAfterSelection;
-BOOL CGetSetOptions::m_bFindAsYouType;
-BOOL CGetSetOptions::m_bEnsureEntireWindowCanBeSeen;
-BOOL CGetSetOptions::m_bShowAllClipsInMainList;
-long CGetSetOptions::m_lMaxClipSizeInBytes;
-DWORD CGetSetOptions::m_dwSaveClipDelay;
-long CGetSetOptions::m_lProcessDrawClipboardDelay;
-BOOL CGetSetOptions::m_bEnableDebugLogging;
-BOOL CGetSetOptions::m_bEnsureConnectToClipboard;
-bool CGetSetOptions::m_bOutputDebugString;
-bool CGetSetOptions::m_bU3 = false;
-bool CGetSetOptions::m_bInConversion = false;
-bool CGetSetOptions::m_bFromIni = false;
-bool CGetSetOptions::m_portable = false;
-CString CGetSetOptions::m_csIniFileName;
-__int64 CGetSetOptions::nLastDbWriteTime = 0;
-CTheme CGetSetOptions::m_Theme;
-BOOL CGetSetOptions::m_showScrollBar = false;
-CGetSetOptions g_Opt;
-
-CGetSetOptions::CGetSetOptions()
-{
-}
-
-CGetSetOptions::~CGetSetOptions()
-{
-
-}
-
-void CGetSetOptions::LoadSettings()
-{
-	m_csIniFileName = GetIniFileName(true);
-
-	CString portable = GetFilePath(m_csIniFileName);
-	portable += _T("portable");
-	if(FileExists(portable)) 
-	{
-		m_portable = true;
-	}
-
-	if(m_bU3)
-	{
-		m_bFromIni = true;
-	}
-	else
-	{
-		//first check if ini file is in app directory
-		if(m_portable || FileExists(m_csIniFileName))
-		{
-			m_bFromIni = true;
-		}
-		else
-		{
-			//next check if it's in app data
-			m_csIniFileName = GetIniFileName(false);
-			if(FileExists(m_csIniFileName))
-			{
-				m_bFromIni = true;
-			}
-		}
-	}
-
-	if(m_bFromIni)
-	{
-		CString csPath = GetFilePath(m_csIniFileName);
-		if(FileExists(csPath) == FALSE)
-			CreateDirectory(csPath, NULL);
-	}
-
-	GetSetCurrentDirectory();
-
-	m_nLinesPerRow = GetLinesPerRow();
-	m_bUseCtrlNumAccel = GetUseCtrlNumForFirstTenHotKeys();
-	m_bAllowDuplicates = GetAllowDuplicates();
-	m_bUpdateTimeOnPaste = GetUpdateTimeOnPaste();
-	m_bSaveMultiPaste = GetSaveMultiPaste();
-	m_bShowPersistent = GetShowPersistent();
-	m_bDescTextSize = GetDescTextSize();
-	m_bDescShowLeadingWhiteSpace = GetDescShowLeadingWhiteSpace();
-	m_bAllwaysShowDescription = GetAllwaysShowDescription();
-	m_bDoubleClickingOnCaptionDoes = GetDoubleClickingOnCaptionDoes();
-	m_bPrompForNewGroupName = GetPrompForNewGroupName();
-	m_bSendPasteOnFirstTenHotKeys = GetSendPasteOnFirstTenHotKeys();
-	m_csIPListToPutOnClipboard = GetListToPutOnClipboard();
-	m_bLogSendReceiveErrors = GetLogSendReceiveErrors();
-	m_HideDittoOnHotKeyIfAlreadyShown = GetHideDittoOnHotKeyIfAlreadyShown();
-	m_lPort = GetPort();
-	m_bDrawThumbnail = GetDrawThumbnail();
-	m_csPassword = GetNetworkPassword();
-	m_bDrawRTF = GetDrawRTF();
-	m_bMultiPasteReverse = GetMultiPasteReverse();
-	m_csPlaySoundOnCopy = GetPlaySoundOnCopy();
-	m_bSendPasteMessageAfterSelection = GetSendPasteAfterSelection();
-	m_bFindAsYouType = GetFindAsYouType();
-	m_bEnsureEntireWindowCanBeSeen = GetEnsureEntireWindowCanBeSeen();
-	m_bShowAllClipsInMainList = GetShowAllClipsInMainList();
-	m_lMaxClipSizeInBytes = GetMaxClipSizeInBytes();
-	m_dwSaveClipDelay = GetSaveClipDelay();
-	m_lProcessDrawClipboardDelay = GetProcessDrawClipboardDelay();
-	m_bEnableDebugLogging = GetEnableDebugLogging();
-	m_bEnsureConnectToClipboard = GetEnsureConnectToClipboard();
-	m_bOutputDebugString = false;
-	m_showScrollBar = GetShowScrollBar();
-
-	GetExtraNetworkPassword(true);
-
-	for(int i = 0; i < MAX_SEND_CLIENTS; i++)
-	{
-		GetSendClients(i);
-	}
-
-	GetClientSendCount();
-
-
-	//If running from a U3 device and no language file as been asigned
-	//then use the language defined by the U3 launcher
-	if(m_bU3)
-	{
-		CString csLanguage = GetLanguageFile();
-		if(csLanguage.IsEmpty())
-		{
-			CString csLanguage = GETENV(_T("U3_ENV_LANGUAGE"));
-			long lLanguage = ATOI(csLanguage);
-			csLanguage.Empty();
-			switch(lLanguage)
-			{
-			case 1036: //French
-				csLanguage = _T("Français");
-				break;
-
-			case 1040: //Italian
-				csLanguage = _T("Italiano");
-				break;
-
-			case 1031: //German
-				csLanguage = _T("German");
-				break;
-
-			case 3082: //German
-				csLanguage = _T("Español");
-				break;
-			}
-
-			if(csLanguage.IsEmpty() == FALSE)
-			{
-				SetLanguageFile(csLanguage);
-			}
-		}
-	}
-
-	m_Theme.Load(GetTheme());
-}
-
-void CGetSetOptions::ConverSettingsToIni()
-{
-	m_bInConversion = true;
-
-	CSize sz;
-	CPoint pt;
-
-	GetQuickPasteSize(sz);
-	SetQuickPasteSize(sz);
-	
-	GetQuickPastePoint(pt);
-	SetQuickPastePoint(pt);
-
-	GetEditWndSize(sz);
-	SetEditWndSize(sz);
-
-	GetEditWndPoint(pt);
-	SetEditWndPoint(pt);
-
-	SetShowIconInSysTray(GetShowIconInSysTray());
-	SetRunOnStartUp(GetRunOnStartUp());
-	SetEnableTransparency(GetEnableTransparency());
-	SetTransparencyPercent(GetTransparencyPercent());
-	SetLinesPerRow(GetLinesPerRow());
-	SetQuickPastePosition(GetQuickPastePosition());
-	SetCopyGap(GetCopyGap());
-	SetDBPath(GetDBPath());
-	SetCheckForMaxEntries(GetCheckForMaxEntries());
-	SetCheckForExpiredEntries(GetCheckForExpiredEntries());
-	SetMaxEntries(GetMaxEntries());
-	SetExpiredEntries(GetExpiredEntries());
-	SetTripCopyCount(GetTripCopyCount());
-	SetTripPasteCount(GetTripPasteCount());
-	SetTripDate(GetTripDate());
-	SetTotalCopyCount(GetTotalCopyCount());
-	SetTotalPasteCount(GetTotalPasteCount());
-	SetTotalDate(GetTotalDate());
-	SetUpdateFilePath(GetUpdateFilePath());
-	SetUpdateInstallPath(GetUpdateInstallPath());	
-	SetLastUpdate(GetLastUpdate());
-	SetCheckForUpdates(GetCheckForUpdates());
-	SetUseCtrlNumForFirstTenHotKeys(GetUseCtrlNumForFirstTenHotKeys());
-	SetAllowDuplicates(GetAllowDuplicates());
-	SetUpdateTimeOnPaste(GetUpdateTimeOnPaste());
-	SetSaveMultiPaste(GetSaveMultiPaste());
-	SetShowPersistent(GetShowPersistent());
-	SetShowTextForFirstTenHotKeys(GetShowTextForFirstTenHotKeys());
-	SetMainHWND(GetMainHWND());
-	SetCaptionPos(GetCaptionPos());
-	SetAutoHide(GetAutoHide());
-	SetDescTextSize(GetDescTextSize());
-	SetDescShowLeadingWhiteSpace(GetDescShowLeadingWhiteSpace());
-	SetAllwaysShowDescription(GetAllwaysShowDescription());
-	SetDoubleClickingOnCaptionDoes(GetDoubleClickingOnCaptionDoes());
-	SetPrompForNewGroupName(GetPrompForNewGroupName());
-	SetSendPasteOnFirstTenHotKeys(GetSendPasteOnFirstTenHotKeys());
-
-	for(int i = 0; i < MAX_SEND_CLIENTS; i++)
-	{
-		GetSendClients(i);
-		SetSendClients(m_SendClients[i], i);
-	}
-
-	SetListToPutOnClipboard(GetListToPutOnClipboard());
-	SetLogSendReceiveErrors(GetLogSendReceiveErrors());
-	SetHideDittoOnHotKeyIfAlreadyShown(GetHideDittoOnHotKeyIfAlreadyShown());
-	SetPort(GetPort());
-	SetDisableRecieve(GetDisableRecieve());
-
-	LOGFONT font;
-	GetFont(font);
-	SetFont(font);
-
-	SetDrawThumbnail(GetDrawThumbnail());	
-
-	CStringA PassA = GetNetworkPassword();
-	CString PassW = PassA;
-	SetNetworkPassword(PassW);
-
-	SetDrawRTF(GetDrawRTF());
-	SetMultiPasteReverse(GetMultiPasteReverse());
-	SetPlaySoundOnCopy(GetPlaySoundOnCopy());
-	SetSendPasteAfterSelection(GetSendPasteAfterSelection());
-	SetFindAsYouType(GetFindAsYouType());
-	SetEnsureEntireWindowCanBeSeen(GetEnsureEntireWindowCanBeSeen());
-	SetShowAllClipsInMainList(GetShowAllClipsInMainList());
-	SetExtraNetworkPassword(GetExtraNetworkPassword(false));
-	SetMaxClipSizeInBytes(GetMaxClipSizeInBytes());
-	SetLanguageFile(GetLanguageFile());
-	SetSaveClipDelay(GetSaveClipDelay());
-	SetProcessDrawClipboardDelay(GetProcessDrawClipboardDelay());
-	SetEnableDebugLogging(GetEnableDebugLogging());
-	SetEnsureConnectToClipboard(GetEnsureConnectToClipboard());
-	SetPromptWhenDeletingClips(GetPromptWhenDeletingClips());
-	SetLastImportDir(GetLastImportDir());
-	SetLastExportDir(GetLastExportDir());
-	SetUpdateDescWhenSavingClip(GetUpdateDescWhenSavingClip());
-
-	m_bInConversion = false;
-}
-
-CString CGetSetOptions::GetIniFileName(bool bLocalIniFile)
-{
-	CString csPath = _T("c:\\program files\\Ditto\\");
-
-	if(m_bU3)
-	{
-		csPath = CGetSetOptions::GetPath(PATH_INI);
-	}
-	else
-	{	
-		if(bLocalIniFile)
-		{
-			csPath = GetFilePath(GetExeFileName());
-		}
-		else
-		{
-			csPath = GetAppDataPath();
-		}
-	}
-
-	csPath += "Ditto.Settings";
-
-	return csPath;
-}
-
-CString CGetSetOptions::GetAppDataPath()
-{
-	CString csPath;
-	LPMALLOC pMalloc;
-
-	if(SUCCEEDED(::SHGetMalloc(&pMalloc))) 
-	{ 
-		LPITEMIDLIST pidlPrograms;
-
-		SHGetSpecialFolderLocation(NULL, CSIDL_APPDATA, &pidlPrograms);
-
-		TCHAR string[MAX_PATH];
-		SHGetPathFromIDList(pidlPrograms, string);
-
-		pMalloc->Free(pidlPrograms);
-		pMalloc->Release();
-
-		csPath = string;		
-	}
-	FIX_CSTRING_PATH(csPath);
-	csPath += "Ditto\\";
-
-	return csPath;
-}
-
-long CGetSetOptions::GetProfileLong(CString csName, long lDefaultValue, CString csNewPath)
-{
-	if(m_bFromIni && !m_bInConversion)
-	{
-		CString csApp(_T("Ditto"));
-
-		if(csNewPath.IsEmpty() == FALSE)
-		{
-			csApp = csNewPath;
-		}
-
-		return GetPrivateProfileInt(csApp, csName, lDefaultValue, m_csIniFileName);
-	}
-
-	CString csPath(_T(REG_PATH));
-	if(csNewPath.IsEmpty() == FALSE)
-	{
-		csPath += "\\" + csNewPath;
-	}
-
-	HKEY hkKey;
-
-	long lResult = RegOpenKeyEx(HKEY_CURRENT_USER, csPath, NULL, KEY_READ, &hkKey);
-
-	if(lResult != ERROR_SUCCESS)
-		return lDefaultValue;
-
-	DWORD buffer;
-	DWORD len =  sizeof(buffer);
-	DWORD type;
-
-	lResult = ::RegQueryValueEx(hkKey, csName, 0, &type, (LPBYTE)&buffer, &len);
-
-	RegCloseKey(hkKey);
-
-	if(lResult == ERROR_SUCCESS)
-		return (long)buffer;
-
-	return lDefaultValue;
-}
-
-CString CGetSetOptions::GetProfileString(CString csName, CString csDefault, CString csNewPath)
-{
-	if(m_bFromIni && !m_bInConversion)
-	{
-		CString csApp(_T("Ditto"));
-
-		if(csNewPath.IsEmpty() == FALSE)
-		{
-			csApp = csNewPath;
-		}
-
-		TCHAR cString[MAX_PATH];
-		GetPrivateProfileString(csApp, csName, csDefault, cString, sizeof(cString), m_csIniFileName);
-
-		return cString;
-	}
-
-	CString csPath(_T(REG_PATH));
-	if(csNewPath.IsEmpty() == FALSE)
-	{
-		csPath += "\\" + csNewPath;
-	}
-
-	HKEY hkKey;
-	long lResult = RegOpenKeyEx(HKEY_CURRENT_USER, csPath, NULL, KEY_READ, &hkKey);
-
-	TCHAR szString[256];
-	ZeroMemory(szString, sizeof(szString));
-	DWORD dwBufLen = 256;
-
-	lResult = ::RegQueryValueEx(hkKey , csName, NULL, NULL, (LPBYTE)szString, &dwBufLen);
-
-	RegCloseKey(hkKey);
-
-	if(lResult != ERROR_SUCCESS)
-		return csDefault;
-
-	return szString;
-}
-
-BOOL CGetSetOptions::SetProfileLong(CString csName, long lValue)
-{
-	if(m_bFromIni)
-	{
-		return WritePrivateProfileInt(_T("Ditto"), csName, lValue, m_csIniFileName);
-	}
-
-	HKEY hkKey;
-	DWORD dWord;
-	long lResult = RegCreateKeyEx(HKEY_CURRENT_USER, _T(REG_PATH), NULL, 
-		NULL, REG_OPTION_NON_VOLATILE, KEY_ALL_ACCESS, 
-		NULL, &hkKey, &dWord);
-
-	if(lResult != ERROR_SUCCESS)
-		return FALSE;
-
-	DWORD val = (DWORD)lValue;
-	lResult = ::RegSetValueEx(hkKey, csName, 0, REG_DWORD, (LPBYTE)&val, sizeof(DWORD));
-
-	RegCloseKey(hkKey);
-
-	return lResult == ERROR_SUCCESS;
-}
-
-BOOL CGetSetOptions::SetProfileString(CString csName, CString csValue)
-{
-	if(m_bFromIni)
-	{
-		return WritePrivateProfileString(_T("Ditto"), csName, csValue, m_csIniFileName);
-	}
-
-	HKEY hkKey;
-	DWORD dWord;
-	long lResult = RegCreateKeyEx(HKEY_CURRENT_USER, _T(REG_PATH), NULL, 
-		NULL, REG_OPTION_NON_VOLATILE, KEY_ALL_ACCESS, 
-		NULL, &hkKey, &dWord);
-
-	if(lResult != ERROR_SUCCESS)
-		return FALSE;
-
-	::RegSetValueEx(hkKey, csName, NULL, REG_SZ,
-		(BYTE*)(LPCTSTR)csValue, csValue.GetLength()*sizeof(TCHAR));
-
-	RegCloseKey(hkKey);
-
-	return lResult == ERROR_SUCCESS;
-}
-
-BOOL CGetSetOptions::SetProfileData(CString csName, LPVOID lpData, DWORD dwLength)
-{
-	if(m_bFromIni)
-	{
-		ASSERT(!"SetProfileData not supported in .ini settings");
-		return FALSE;
-	}
-
-	HKEY hkKey;
-	DWORD dWord;
-	long lResult = RegCreateKeyEx(HKEY_CURRENT_USER, _T(REG_PATH), NULL, 
-		NULL, REG_OPTION_NON_VOLATILE, KEY_ALL_ACCESS, 
-		NULL, &hkKey, &dWord);
-
-	if(lResult != ERROR_SUCCESS)
-		return FALSE;
-
-	::RegSetValueEx(hkKey, csName, NULL, REG_BINARY,
-		(BYTE*)lpData, dwLength);
-
-	RegCloseKey(hkKey);
-
-	return lResult == ERROR_SUCCESS;
-}
-
-BOOL CGetSetOptions::GetProfileFont(CString csSection, LOGFONT &font)
-{
-	font.lfHeight = GetPrivateProfileInt(csSection, _T("Height"), 0, m_csIniFileName);
-	font.lfWidth = GetPrivateProfileInt(csSection, _T("Width"), 0, m_csIniFileName);
-	font.lfEscapement = GetPrivateProfileInt(csSection, _T("Escapement"), 0, m_csIniFileName);
-	font.lfOrientation = GetPrivateProfileInt(csSection, _T("Orientation"), 0, m_csIniFileName);
-	font.lfWeight = GetPrivateProfileInt(csSection, _T("Weight"), 0, m_csIniFileName);
-	font.lfItalic = GetPrivateProfileInt(csSection, _T("Italic"), 0, m_csIniFileName);
-	font.lfUnderline = GetPrivateProfileInt(csSection, _T("Underline"), 0, m_csIniFileName);
-	font.lfStrikeOut = GetPrivateProfileInt(csSection, _T("StrikeOut"), 0, m_csIniFileName);
-	font.lfCharSet = GetPrivateProfileInt(csSection, _T("CharSet"), 0, m_csIniFileName);
-	font.lfOutPrecision = GetPrivateProfileInt(csSection, _T("OutPrecision"), 0, m_csIniFileName);
-	font.lfClipPrecision = GetPrivateProfileInt(csSection, _T("ClipPrecision"), 0, m_csIniFileName);
-	font.lfQuality = GetPrivateProfileInt(csSection, _T("Quality"), 0, m_csIniFileName);
-	font.lfPitchAndFamily = GetPrivateProfileInt(csSection, _T("PitchAndFamily"), 0, m_csIniFileName);
-	GetPrivateProfileString(csSection, _T("FaceName"), _T(""), font.lfFaceName, sizeof(font.lfFaceName), m_csIniFileName);
-
-	return TRUE;
-}
-
-BOOL CGetSetOptions::SetProfileFont(CString csSection, LOGFONT &font)
-{
-	WritePrivateProfileInt(csSection, _T("Height"), font.lfHeight, m_csIniFileName);
-	WritePrivateProfileInt(csSection, _T("Width"), font.lfWidth, m_csIniFileName);
-	WritePrivateProfileInt(csSection, _T("Escapement"), font.lfEscapement, m_csIniFileName);
-	WritePrivateProfileInt(csSection, _T("Orientation"), font.lfOrientation, m_csIniFileName);
-	WritePrivateProfileInt(csSection, _T("Weight"), font.lfWeight, m_csIniFileName);
-	WritePrivateProfileInt(csSection, _T("Italic"), font.lfItalic, m_csIniFileName);
-	WritePrivateProfileInt(csSection, _T("Underline"), font.lfUnderline, m_csIniFileName);
-	WritePrivateProfileInt(csSection, _T("StrikeOut"), font.lfStrikeOut, m_csIniFileName);
-	WritePrivateProfileInt(csSection, _T("CharSet"), font.lfCharSet, m_csIniFileName);
-	WritePrivateProfileInt(csSection, _T("OutPrecision"), font.lfOutPrecision, m_csIniFileName);
-	WritePrivateProfileInt(csSection, _T("ClipPrecision"), font.lfClipPrecision, m_csIniFileName);
-	WritePrivateProfileInt(csSection, _T("Quality"), font.lfQuality, m_csIniFileName);
-	WritePrivateProfileInt(csSection, _T("PitchAndFamily"), font.lfPitchAndFamily, m_csIniFileName);
-	WritePrivateProfileString(csSection, _T("FaceName"), font.lfFaceName, m_csIniFileName);
-
-	return TRUE;
-}
-
-LPVOID CGetSetOptions::GetProfileData(CString csName, DWORD &dwLength)
-{
-	if(m_bFromIni && !m_bInConversion)
-	{
-		ASSERT(!"GetProfileData not supported in .ini settings");
-		return NULL;
-	}
-
-	HKEY hkKey;
-
-	long lResult = RegOpenKeyEx(HKEY_CURRENT_USER, _T(REG_PATH),
-		NULL, KEY_READ, &hkKey);
-
-	lResult = ::RegQueryValueEx(hkKey , csName, NULL, NULL, NULL, &dwLength);
-
-	if(lResult != ERROR_SUCCESS)
-		return NULL;
-
-	LPVOID lpVoid = new BYTE[dwLength];
-
-	lResult = ::RegQueryValueEx(hkKey , csName, NULL, NULL, (LPBYTE)lpVoid, &dwLength);
-
-	RegCloseKey(hkKey);
-
-	if(lResult != ERROR_SUCCESS)
-		return NULL;
-
-	return lpVoid;
-}
-
-BOOL CGetSetOptions::GetShowIconInSysTray() 
-{
-	return GetProfileLong("ShowIconInSystemTray", TRUE);
-}
-
-BOOL CGetSetOptions::SetShowIconInSysTray(BOOL bShow) 
-{
-	return SetProfileLong("ShowIconInSystemTray", bShow);
-}
-
-BOOL CGetSetOptions::SetEnableTransparency(BOOL bCheck)
-{
-	return SetProfileLong("EnableTransparency", bCheck);
-}
-
-BOOL CGetSetOptions::GetEnableTransparency()
-{
-	return GetProfileLong("EnableTransparency", FALSE);
-}
-
-BOOL CGetSetOptions::SetTransparencyPercent(long lPercent)
-{
-#ifdef AFTER_98
-	if(lPercent > OPACITY_MAX)
-		lPercent = OPACITY_MAX;
-	if(lPercent < 0)
-		lPercent = 0;
-
-	return SetProfileLong("TransparencyPercent", lPercent);
-#endif
-	return FALSE;
-}
-
-long CGetSetOptions::GetTransparencyPercent()
-{
-#ifdef AFTER_98
-	long lValue = GetProfileLong("TransparencyPercent", 14);
-
-	if(lValue > OPACITY_MAX) lValue = OPACITY_MAX;
-	if(lValue < 0) lValue = 0;
-
-	return lValue;
-#endif
-	return 0;
-}
-
-BOOL CGetSetOptions::SetLinesPerRow(long lLines)
-{
-	m_nLinesPerRow = lLines;
-	return SetProfileLong("LinesPerRow", lLines);
-}
-
-long CGetSetOptions::GetLinesPerRow()
-{
-	return GetProfileLong("LinesPerRow", 2);
-}
-
-BOOL CGetSetOptions::GetRunOnStartUp()
-{
-	HKEY hkRun;
-
-	LONG nResult = RegOpenKeyEx(HKEY_CURRENT_USER,
-		_T("Software\\Microsoft\\Windows\\CurrentVersion\\Run"),
-		NULL, KEY_READ, &hkRun);
-
-	if(nResult != ERROR_SUCCESS)
-		return FALSE;
-
-	nResult = RegQueryValueEx(hkRun, GetAppName(), NULL, NULL, NULL, NULL);
-	RegCloseKey(hkRun);
-	return nResult == ERROR_SUCCESS;
-}
-
-void CGetSetOptions::SetRunOnStartUp(BOOL bRun)
-{
-	//Can't set auto run when running from U3 device
-	if(m_bU3)
-		return;
-
-	if(bRun == GetRunOnStartUp())
-		return;
-
-	HKEY hkRun;
-	LONG nResult = RegOpenKeyEx(HKEY_CURRENT_USER,
-		_T("Software\\Microsoft\\Windows\\CurrentVersion\\Run"),
-		NULL, KEY_ALL_ACCESS, &hkRun);
-
-	if(nResult != ERROR_SUCCESS)
-		return;
-
-	if(bRun)
-	{
-		CString sExeName = GetExeFileName();
-		::RegSetValueEx(hkRun, GetAppName(), NULL, REG_SZ,
-			(BYTE*)(LPCTSTR)sExeName, sExeName.GetLength()*sizeof(TCHAR));
-	} 
-	else 
-	{
-		::RegDeleteValue(hkRun, GetAppName());
-	}
-
-	::RegCloseKey(hkRun);
-}
-
-CString CGetSetOptions::GetExeFileName()
-{
-	CString sExeName;
-	GetModuleFileName(NULL, sExeName.GetBuffer(_MAX_PATH),_MAX_PATH);
-	sExeName.ReleaseBuffer();
-	return sExeName;
-}
-
-CString CGetSetOptions::GetAppName()
-{
-	return "Ditto";
-}
-
-BOOL CGetSetOptions::SetQuickPastePosition(long lPosition)
-{
-	return SetProfileLong("ShowQuickPastePosition", lPosition);
-}
-
-long CGetSetOptions::GetQuickPastePosition()
-{
-	return GetProfileLong("ShowQuickPastePosition", POS_AT_CURSOR);
-}
-
-BOOL CGetSetOptions::SetQuickPasteSize(CSize size)
-{
-	BOOL bRet = SetProfileLong("QuickPasteCX", size.cx);
-	bRet = SetProfileLong("QuickPasteCY", size.cy);
-
-	return bRet;
-}
-void CGetSetOptions::GetQuickPasteSize(CSize &size)
-{
-	size.cx = GetProfileLong("QuickPasteCX", 300);
-	size.cy = GetProfileLong("QuickPasteCY", 300);
-	if(size.cx <= 0 && size.cy <= 0)
-	{
-		size.cx = 300;
-		size.cy = 300;
-	}
-}
-
-BOOL CGetSetOptions::SetQuickPastePoint(CPoint point)
-{
-	BOOL bRet = SetProfileLong("QuickPasteX", point.x);
-	bRet = SetProfileLong("QuickPasteY", point.y);
-
-	return bRet;
-}
-
-void CGetSetOptions::GetQuickPastePoint(CPoint &point)
-{
-	point.x = GetProfileLong("QuickPasteX", 300);
-	point.y = GetProfileLong("QuickPasteY", 300);
-
-	if(point.x <= 0 && point.y <= 0)
-	{
-		point.x = 300;
-		point.y = 300;
-	}
-}
-
-BOOL CGetSetOptions::SetEditWndSize(CSize size)
-{
-	BOOL bRet = SetProfileLong("EditWndCX", size.cx);
-	bRet = SetProfileLong("EditWndCY", size.cy);
-
-	return bRet;
-}
-
-void CGetSetOptions::GetEditWndSize(CSize &size)
-{
-	size.cx = GetProfileLong("EditWndCX", 600);
-	size.cy = GetProfileLong("EditWndCY", 600);
-	if(size.cx <= 0 && size.cy <= 0)
-	{
-		size.cx = 600;
-		size.cy = 600;
-	}
-}
-
-BOOL CGetSetOptions::SetEditWndPoint(CPoint point)
-{
-	BOOL bRet = SetProfileLong("EditWndX", point.x);
-	bRet = SetProfileLong("EditWndY", point.y);
-
-	return bRet;
-}
-
-void CGetSetOptions::GetEditWndPoint(CPoint &point)
-{
-	point.x = GetProfileLong("EditWndX", 100);
-	point.y = GetProfileLong("EditWndY", 100);
-
-	if(point.x <= 0 && point.y <= 0)
-	{
-		point.x = 100;
-		point.y = 100;
-	}
-}
-
-long CGetSetOptions::GetCopyGap()
-{
-	return GetProfileLong("CopyGap", 150);
-}
-
-void CGetSetOptions::SetCopyGap(long lGap)
-{
-	SetProfileLong("CopyGap", lGap);
-}
-
-BOOL CGetSetOptions::SetDBPathOld(CString csPath)
-{
-	return SetProfileString("DBPath", csPath);
-}
-
-CString CGetSetOptions::GetDBPathOld()
-{
-	return GetProfileString("DBPath", "");
-}
-
-BOOL CGetSetOptions::SetDBPath(CString csPath)
-{
-	return SetProfileString("DBPath3", csPath);
-}
-
-CString CGetSetOptions::GetDBPath()
-{
-	CString csDBPath;
-	if(m_bU3)
-	{
-		csDBPath = GetProfileString("DBPath3", "");
-		if(csDBPath.IsEmpty())
-		{
-			csDBPath = GetDefaultDBName();
-		}
-
-		CPath ExistingPath(csDBPath);
-		csDBPath = CGetSetOptions::GetPath(PATH_DATABASE);
-		csDBPath += ExistingPath.GetName();
-	}
-	else
-	{
-		csDBPath = GetProfileString("DBPath3", "");
-	}
-
-	return csDBPath;
-}
-
-void CGetSetOptions::SetCheckForMaxEntries(BOOL bVal)
-{
-	SetProfileLong("CheckForMaxEntries", bVal);
-}
-
-BOOL CGetSetOptions::GetCheckForMaxEntries()
-{
-	BOOL bDefault = FALSE;
-	if(m_bU3)
-		bDefault = TRUE;
-	if(GetIsPortableDitto())
-		bDefault = TRUE;
-
-	return GetProfileLong("CheckForMaxEntries", bDefault);
-}
-
-void CGetSetOptions::SetCheckForExpiredEntries(BOOL bVal)
-{
-	SetProfileLong("CheckForExpiredEntries", bVal);
-}
-
-BOOL CGetSetOptions::GetCheckForExpiredEntries()
-{
-	return GetProfileLong("CheckForExpiredEntries", FALSE);
-}
-
-void CGetSetOptions::SetMaxEntries(long lVal)
-{
-	SetProfileLong("MaxEntries", lVal);
-}
-
-long CGetSetOptions::GetMaxEntries()
-{
-	long lMax = 500;
-	if(m_bU3)
-		lMax = 75;
-	if(GetIsPortableDitto())
-		lMax = 100;
-	return GetProfileLong("MaxEntries", lMax);
-}
-
-void CGetSetOptions::SetExpiredEntries(long lVal)
-{
-	SetProfileLong("ExpiredEntries", lVal);
-}
-
-long CGetSetOptions::GetExpiredEntries()
-{
-	return GetProfileLong("ExpiredEntries", 5);
-}
-
-void CGetSetOptions::SetTripCopyCount(long lVal)
-{
-	// negative means a relative offset
-	if(lVal < 0)
-		lVal = GetTripCopyCount() - lVal; // add the absolute value
-
-	if(GetTripDate() == 0)
-		SetTripDate(-1);
-
-	SetProfileLong("TripCopies", lVal);
-}
-
-long CGetSetOptions::GetTripCopyCount()
-{
-	return GetProfileLong("TripCopies", 0);
-}
-
-void CGetSetOptions::SetTripPasteCount(long lVal)
-{
-	// negative means a relative offset
-	if(lVal < 0)
-		lVal = GetTripPasteCount() - lVal; // add the absolute value
-
-	if(GetTripDate() == 0)
-		SetTripDate(-1);
-
-	SetProfileLong("TripPastes", lVal);
-}
-
-long CGetSetOptions::GetTripPasteCount()
-{
-	return GetProfileLong("TripPastes", 0);
-}
-
-void CGetSetOptions::SetTripDate(long lDate)
-{
-	if(lDate == -1)
-		lDate = (long)CTime::GetCurrentTime().GetTime();
-
-	SetProfileLong("TripDate", lDate);
-}
-
-long CGetSetOptions::GetTripDate()
-{
-	return GetProfileLong("TripDate", 0);
-}
-
-void CGetSetOptions::SetTotalCopyCount(long lVal)
-{
-	// negative means a relative offset
-	if(lVal < 0)
-		lVal = GetTotalCopyCount() - lVal; // add the absolute value
-
-	if(GetTotalDate() == 0)
-		SetTotalDate(-1);
-
-	SetProfileLong("TotalCopies", lVal);
-}
-
-long CGetSetOptions::GetTotalCopyCount()
-{
-	return GetProfileLong("TotalCopies", 0);
-}
-
-void CGetSetOptions::SetTotalPasteCount(long lVal)
-{
-	// negative means a relative offset
-	if(lVal < 0)
-		lVal = GetTotalPasteCount() - lVal; // add the absolute value
-
-	if(GetTotalDate() == 0)
-		SetTotalDate(-1);
-
-	SetProfileLong("TotalPastes", lVal);
-}
-
-long CGetSetOptions::GetTotalPasteCount()
-{
-	return GetProfileLong("TotalPastes", 0);
-}
-
-void CGetSetOptions::SetTotalDate(long lDate)
-{
-	if(lDate == -1)
-		lDate = (long)CTime::GetCurrentTime().GetTime();
-
-	SetProfileLong("TotalDate", lDate);
-}
-
-long CGetSetOptions::GetTotalDate()
-{
-	return GetProfileLong("TotalDate", 0);
-}
-
-CString	CGetSetOptions::GetUpdateFilePath()			
-{ 
-	return GetProfileString("UpdateFilePath", "");	
-}
-BOOL CGetSetOptions::SetUpdateFilePath(CString cs)	
-{ 
-	return SetProfileString("UpdateFilePath", cs);	
-}
-
-CString	CGetSetOptions::GetUpdateInstallPath()			
-{ 
-	return GetProfileString("UpdateInstallPath", "");	
-}
-BOOL CGetSetOptions::SetUpdateInstallPath(CString cs)	
-{ 
-	return SetProfileString("UpdateInstallPath", cs);	
-}
-
-long CGetSetOptions::GetLastUpdate()			
-{ 
-	return GetProfileLong("LastUpdateDay", 0);		
-}
-long CGetSetOptions::SetLastUpdate(long lValue)	
-{ 
-	return SetProfileLong("LastUpdateDay", lValue);	
-}
-
-BOOL CGetSetOptions::GetCheckForUpdates()				
-{ 
-	return GetProfileLong("CheckForUpdates", TRUE);	
-}
-BOOL CGetSetOptions::SetCheckForUpdates(BOOL bCheck)	
-{ 
-	return SetProfileLong("CheckForUpdates", bCheck);	
-}
-
-void CGetSetOptions::SetUseCtrlNumForFirstTenHotKeys(BOOL bVal)	
-{	
-	SetProfileLong("UseCtrlNumForFirstTenHotKeys", bVal);	
-	m_bUseCtrlNumAccel = bVal;	
-}
-BOOL CGetSetOptions::GetUseCtrlNumForFirstTenHotKeys()			
-{	
-	return GetProfileLong("UseCtrlNumForFirstTenHotKeys", 0); 
-}
-
-void CGetSetOptions::SetAllowDuplicates(BOOL bVal)	
-{	
-	SetProfileLong("AllowDuplicates", bVal); 
-	m_bAllowDuplicates = bVal; 
-}
-BOOL CGetSetOptions::GetAllowDuplicates()			
-{	
-	return GetProfileLong("AllowDuplicates", 0); 
-}
-
-void CGetSetOptions::SetUpdateTimeOnPaste(BOOL bVal)	
-{	
-	SetProfileLong("UpdateTimeOnPaste", bVal); 
-	m_bUpdateTimeOnPaste = bVal; 
-}
-BOOL CGetSetOptions::GetUpdateTimeOnPaste()			
-{	
-	return GetProfileLong("UpdateTimeOnPaste", TRUE); 
-}
-
-void CGetSetOptions::SetSaveMultiPaste(BOOL bVal)	
-{	
-	SetProfileLong("SaveMultiPaste", bVal); 
-	m_bSaveMultiPaste = bVal; 
-}
-BOOL CGetSetOptions::GetSaveMultiPaste()			
-{	
-	return GetProfileLong("SaveMultiPaste", 0); 
-}
-
-void CGetSetOptions::SetShowPersistent(BOOL bVal)	
-{	
-	SetProfileLong("ShowPersistent", bVal); 
-	m_bShowPersistent = bVal; 
-}
-BOOL CGetSetOptions::GetShowPersistent()			
-{	
-	return GetProfileLong("ShowPersistent", 0); 
-}
-
-void CGetSetOptions::SetShowTextForFirstTenHotKeys(BOOL bVal)	
-{	
-	SetProfileLong("ShowTextForFirstTenHotKeys", bVal);			
-}
-BOOL CGetSetOptions::GetShowTextForFirstTenHotKeys()			
-{	
-	return GetProfileLong("ShowTextForFirstTenHotKeys", TRUE);	
-}
-
-void CGetSetOptions::SetMainHWND(long lhWnd)	
-{	
-	SetProfileLong("MainhWnd", lhWnd);		
-}
-BOOL CGetSetOptions::GetMainHWND()				
-{	
-	return GetProfileLong("MainhWnd", 0);	
-}
-
-void CGetSetOptions::SetCaptionPos(long lPos)	
-{	
-	SetProfileLong("CaptionPos", lPos);					
-}
-long CGetSetOptions::GetCaptionPos()			
-{	
-	return GetProfileLong("CaptionPos", CAPTION_RIGHT);	
-}
-
-void CGetSetOptions::SetAutoHide(BOOL bAutoHide)
-{	
-	SetProfileLong("AutoHide", bAutoHide);					
-}
-BOOL CGetSetOptions::GetAutoHide()				
-{	
-	return GetProfileLong("AutoHide", FALSE);				
-}
-
-void CGetSetOptions::SetDescTextSize(long lSize)
-{	
-	SetProfileLong("DescTextSize", lSize); 
-	m_bDescTextSize = lSize; 
-}
-long CGetSetOptions::GetDescTextSize()			
-{	
-	return GetProfileLong("DescTextSize", 500); 
-}
-
-void CGetSetOptions::SetDescShowLeadingWhiteSpace(BOOL bVal)
-{ 
-	SetProfileLong("DescShowLeadingWhiteSpace", bVal); 
-	m_bDescShowLeadingWhiteSpace = bVal; 
-}
-BOOL CGetSetOptions::GetDescShowLeadingWhiteSpace()         
-{ 
-	return GetProfileLong("DescShowLeadingWhiteSpace", FALSE); 
-}
-
-void CGetSetOptions::SetAllwaysShowDescription(long bShow)	
-{	
-	SetProfileLong("AllwaysShowDescription", bShow); 
-	m_bAllwaysShowDescription = bShow; 
-}
-BOOL CGetSetOptions::GetAllwaysShowDescription()			
-{	
-	return GetProfileLong("AllwaysShowDescription", FALSE); 
-}
-
-void CGetSetOptions::SetDoubleClickingOnCaptionDoes(long lOption)	
-{	
-	SetProfileLong("DoubleClickingOnCaptionDoes", lOption); 
-	m_bDoubleClickingOnCaptionDoes = lOption; 
-}
-long CGetSetOptions::GetDoubleClickingOnCaptionDoes()				
-{	
-	return GetProfileLong("DoubleClickingOnCaptionDoes", TOGGLES_ALLWAYS_ON_TOP); 
-}
-
-void CGetSetOptions::SetPrompForNewGroupName(BOOL bOption)	
-{	
-	SetProfileLong("PrompForNewGroupName", bOption); 
-	m_bPrompForNewGroupName = bOption; 
-}
-BOOL CGetSetOptions::GetPrompForNewGroupName()				
-{	
-	return GetProfileLong("PrompForNewGroupName", TRUE); 
-}
-
-void CGetSetOptions::SetSendPasteOnFirstTenHotKeys(BOOL bOption)	
-{	
-	SetProfileLong("SendPasteOnFirstTenHotKeys", bOption); 
-	m_bSendPasteOnFirstTenHotKeys = bOption; 
-}
-BOOL CGetSetOptions::GetSendPasteOnFirstTenHotKeys()				
-{	
-	return GetProfileLong("SendPasteOnFirstTenHotKeys", TRUE); 
-}
-
-void CGetSetOptions::SetSendClients(CSendClients Client, int nPos)
-{
-	CString cs;
-
-	cs.Format(_T("sendclient_ip_%d"), nPos);
-	SetProfileString(cs, Client.csIP);
-
-	cs.Format(_T("sendclient_autosend_%d"), nPos);
-	SetProfileLong(cs, Client.bSendAll);
-
-	cs.Format(_T("sendclient_description_%d"), nPos);
-	SetProfileString(cs, Client.csDescription);
-
-	Client.bShownFirstError = m_SendClients[nPos].bShownFirstError;
-
-	m_SendClients[nPos] = Client;
-}
-
-CSendClients CGetSetOptions::GetSendClients(int nPos)
-{
-	CSendClients Client;
-
-	CString cs;
-
-	cs.Format(_T("sendclient_ip_%d"), nPos);
-	Client.csIP = GetProfileString(cs, "");
-
-	cs.Format(_T("sendclient_autosend_%d"), nPos);
-	Client.bSendAll = GetProfileLong(cs, FALSE);
-
-	cs.Format(_T("sendclient_description_%d"), nPos);
-	Client.csDescription = GetProfileString(cs, "");
-
-	m_SendClients[nPos] = Client;
-
-	return Client;
-}
-
-void CGetSetOptions::GetClientSendCount()
-{
-	m_lAutoSendClientCount = 0;
-	for(int i = 0; i < MAX_SEND_CLIENTS; i++)
-	{
-		if(m_SendClients[i].csIP.GetLength() > 0)
-		{
-			if(m_SendClients[i].bSendAll)
-				m_lAutoSendClientCount++;
-		}
-	}
-}
-
-CString	CGetSetOptions::GetListToPutOnClipboard()			
-{ 
-	CString cs = GetProfileString("ListToPutOnClipboard", "");
-	cs.MakeUpper();
-	return cs;
-}
-BOOL CGetSetOptions::SetListToPutOnClipboard(CString cs)	
-{ 
-	cs.MakeUpper();
-	m_csIPListToPutOnClipboard = cs;
-	return SetProfileString("ListToPutOnClipboard", cs); 
-
-}
-
-void CGetSetOptions::SetLogSendReceiveErrors(BOOL bOption)
-{
-	m_bLogSendReceiveErrors = bOption;
-
-	SetProfileLong("LogSendReceiveErrors", bOption);
-}
-
-BOOL CGetSetOptions::GetLogSendReceiveErrors()
-{
-	return GetProfileLong("LogSendReceiveErrors", FALSE);
-}
-
-BOOL CGetSetOptions::GetHideDittoOnHotKeyIfAlreadyShown()
-{
-	return GetProfileLong("HideDittoOnHotKeyIfAlreadyShown", TRUE);
-}
-
-void CGetSetOptions::SetHideDittoOnHotKeyIfAlreadyShown(BOOL bVal)
-{
-	m_HideDittoOnHotKeyIfAlreadyShown = bVal;
-
-	SetProfileLong("HideDittoOnHotKeyIfAlreadyShown", bVal);
-}
-
-void CGetSetOptions::SetPort(long lPort)
-{
-	m_lPort = lPort;
-	SetProfileLong("SendRecvPort", lPort);
-}
-
-long CGetSetOptions::GetPort()
-{
-	return GetProfileLong("SendRecvPort", 23443);
-}
-
-BOOL CGetSetOptions::GetDisableRecieve()
-{
-	BOOL bDefault = FALSE;
-	if(m_bU3)
-		bDefault = TRUE;
-	if(GetIsPortableDitto())
-		bDefault = TRUE;
-
-	return GetProfileLong("DisableRecieve", bDefault);
-}
-
-void CGetSetOptions::SetDisableRecieve(BOOL bVal)
-{
-	SetProfileLong("DisableRecieve", bVal);
-}
-
-BOOL CGetSetOptions::GetFont(LOGFONT &font)
-{
-	if(m_bFromIni && !m_bInConversion)
-	{
-		GetProfileFont("DisplayFont", font);
-
-		//Return true if there is a font name
-		//other wise load the default font below
-		if(font.lfFaceName[0] != 0)
-		{
-			return TRUE;
-		}
-	}
-	else
-	{
-		DWORD dwLength = 0;
-		#ifdef _UNICODE
-			LPVOID lpVoid = GetProfileData("DisplayFont3", dwLength);
-		#else
-			LPVOID lpVoid = GetProfileData("DisplayFont", dwLength);
-		#endif
-		if(lpVoid)
-		{
-			if(sizeof(font) == dwLength)
-			{
-				memcpy(&font, lpVoid, dwLength);
-				delete[] lpVoid;
-				lpVoid = NULL;
-				return TRUE;
-			}
-			else
-			{
-				ASSERT(!"invalid font struct size");
-			}
-
-			delete[] lpVoid;
-			lpVoid = NULL;
-		}
-	}
-
-	ZeroMemory(&font, sizeof(font));
-	font.lfHeight = -11;
-	font.lfWeight = 400;
-	font.lfCharSet = 1;
-	STRCPY(font.lfFaceName, _T("Arial Unicode MS"));
-	return TRUE;
-}
-
-void CGetSetOptions::SetFont(LOGFONT &font)
-{
-	if(m_bFromIni)
-	{
-		SetProfileFont("DisplayFont", font);
-	}
-	else
-	{
-		#ifdef _UNICODE
-			CString csParam = "DisplayFont3";
-		#else
-			CString csParam = "DisplayFont";
-		#endif
-
-		SetProfileData(csParam, &font, sizeof(LOGFONT));
-	}
-}
-
-void CGetSetOptions::SetDrawThumbnail(long bDraw)
-{
-	SetProfileLong("DrawThumbnail", bDraw); 
-	m_bDrawThumbnail = bDraw;
-}
-
-BOOL CGetSetOptions::GetDrawThumbnail()
-{
-	BOOL bDrawThumbnails = TRUE;
-	if(g_Opt.m_bU3)
-		bDrawThumbnails = FALSE;
-
-	return GetProfileLong("DrawThumbnail", bDrawThumbnails);
-}
-
-void CGetSetOptions::SetExtraNetworkPassword(CString csPassword)
-{
-	SetProfileString("NetworkExtraPassword", csPassword);
-}
-
-CString CGetSetOptions::GetExtraNetworkPassword(bool bFillArray)
-{
-	CString cs = GetProfileString("NetworkExtraPassword", "");
-
-	if(bFillArray)
-	{
-		m_csNetworkPasswordArray.RemoveAll();
-
-		TCHAR seps[]   = _T(",");
-		TCHAR *token;
-
-		TCHAR *pString = cs.GetBuffer(cs.GetLength());
-
-		/* Establish string and get the first token: */
-		token = STRTOK(pString, seps);
-		while(token != NULL)
-		{
-			CString cs(token);
-			cs.TrimLeft();
-			cs.TrimRight();
-
-			m_csNetworkPasswordArray.Add(cs);
-
-			// Get next token
-			token = STRTOK(NULL, seps);
-		}
-
-		cs.ReleaseBuffer();
-	}
-
-	return cs;
-}
-
-void CGetSetOptions::SetNetworkPassword(CString csPassword)
-{
-	CTextConvert Con;
-	Con.ConvertToUTF8(csPassword, m_csPassword);
-
-	SetProfileString("NetworkStringPassword", csPassword);
-}
-
-CStringA CGetSetOptions::GetNetworkPassword()
-{
-	CString cs = GetProfileString("NetworkStringPassword", "LetMeIn");
-
-	CTextConvert Con;
-	CStringA csReturn;
-	Con.ConvertToUTF8(cs, csReturn);
-
-	return csReturn;
-}
-
-void CGetSetOptions::SetDrawRTF(long bDraw)
-{
-//this only works under 32 bit build
-#ifdef _M_IX86
-	SetProfileLong("DrawRTF", bDraw); 
-	m_bDrawRTF = bDraw;
-#endif
-}
-
-BOOL CGetSetOptions::GetDrawRTF()
-{
-//this only works under 32 bit build
-#ifdef _M_IX86
-	return GetProfileLong("DrawRTF", FALSE);
-#endif
-	return FALSE;
-}
-
-void CGetSetOptions::SetMultiPasteReverse(BOOL bVal)
-{
-	SetProfileLong("MultiPasteReverse", bVal); 
-	m_bMultiPasteReverse = bVal;
-}
-
-BOOL CGetSetOptions::GetMultiPasteReverse()
-{
-	return GetProfileLong("MultiPasteReverse", TRUE); 
-}
-
-void CGetSetOptions::SetPlaySoundOnCopy(CString cs)
-{
-	m_csPlaySoundOnCopy = cs;
-
-	SetProfileString("PlaySoundOnCopy", cs);
-}
-
-CString CGetSetOptions::GetPlaySoundOnCopy()
-{
-	return GetProfileString("PlaySoundOnCopy", "");
-}
-
-void CGetSetOptions::SetSendPasteAfterSelection(BOOL bVal)
-{
-	m_bSendPasteMessageAfterSelection = bVal;
-
-	SetProfileLong("SendPasteMessageAfterSelection", bVal);
-}
-
-BOOL CGetSetOptions::GetSendPasteAfterSelection()
-{
-	return GetProfileLong("SendPasteMessageAfterSelection", TRUE);
-}
-
-void CGetSetOptions::SetFindAsYouType(BOOL bVal)
-{
-	m_bFindAsYouType = bVal;
-	SetProfileLong("FindAsYouType", bVal);
-}
-
-BOOL CGetSetOptions::GetFindAsYouType()
-{
-	return GetProfileLong("FindAsYouType", TRUE);
-}
-
-void CGetSetOptions::SetEnsureEntireWindowCanBeSeen(BOOL bVal)
-{
-	m_bEnsureEntireWindowCanBeSeen = bVal;
-	SetProfileLong("EnsureEntireWindowCanBeSeen", bVal);
-}
-
-BOOL CGetSetOptions::GetEnsureEntireWindowCanBeSeen()
-{
-	return GetProfileLong("EnsureEntireWindowCanBeSeen", TRUE);
-}
-
-void CGetSetOptions::SetShowAllClipsInMainList(BOOL bVal)
-{
-	m_bShowAllClipsInMainList = bVal;
-	SetProfileLong("ShowAllClipsInMainList", bVal);
-}
-
-BOOL CGetSetOptions::GetShowAllClipsInMainList()
-{
-	return GetProfileLong("ShowAllClipsInMainList", TRUE);
-}
-
-long CGetSetOptions::GetMaxClipSizeInBytes()
-{
-	return GetProfileLong("MaxClipSizeInBytes", 0);
-}
-
-void CGetSetOptions::SetMaxClipSizeInBytes(long lSize)
-{
-	m_lMaxClipSizeInBytes = lSize;
-	SetProfileLong("MaxClipSizeInBytes", lSize);
-}
-
-CString CGetSetOptions::GetLanguageFile()
-{
-	return GetProfileString("LanguageFile", "");
-}
-
-void CGetSetOptions::SetLanguageFile(CString csLanguage)
-{
-	SetProfileString("LanguageFile", csLanguage);
-}
-
-ULONG CGetSetOptions::GetSaveClipDelay()
-{
-	return (ULONG)GetProfileLong("SaveClipDelay", 500);
-}
-
-void CGetSetOptions::SetSaveClipDelay(DWORD dwDelay)
-{
-	m_dwSaveClipDelay = dwDelay;
-	SetProfileLong("SaveClipDelay", dwDelay);
-}
-
-long CGetSetOptions::GetProcessDrawClipboardDelay()
-{
-	return GetProfileLong("ProcessDrawClipboardDelay", 100);
-}
-
-void CGetSetOptions::SetProcessDrawClipboardDelay(long lDelay)
-{
-	m_lProcessDrawClipboardDelay = lDelay;
-	SetProfileLong("ProcessDrawClipboardDelay", lDelay);
-}
-
-BOOL CGetSetOptions::GetEnableDebugLogging()
-{
-	return GetProfileLong("EnableDebugLogging", FALSE);
-}
-
-void CGetSetOptions::SetEnableDebugLogging(BOOL bEnable)
-{
-	m_bEnableDebugLogging = bEnable;
-	SetProfileLong("EnableDebugLogging", bEnable);
-}
-
-BOOL CGetSetOptions::GetEnsureConnectToClipboard()
-{
-	return GetProfileLong("EnsureConnected", TRUE);
-}
-
-void CGetSetOptions::SetEnsureConnectToClipboard(BOOL bSet)
-{
-	m_bEnsureConnectToClipboard = bSet;
-	SetProfileLong("EnsureConnected", bSet);
-}
-
-BOOL CGetSetOptions::GetPromptWhenDeletingClips()
-{
-	return GetProfileLong("PromptWhenDeletingClips", TRUE);
-}
-
-void CGetSetOptions::SetPromptWhenDeletingClips(BOOL bSet)
-{
-	SetProfileLong("PromptWhenDeletingClips", bSet);
-}
-
-CString CGetSetOptions::GetLastImportDir()
-{
-	return GetProfileString("LastImportDir", "");
-}
-
-void CGetSetOptions::SetLastImportDir(CString csDir)
-{
-	SetProfileString("LastImportDir", csDir);
-}
-
-CString CGetSetOptions::GetLastExportDir()
-{
-	return GetProfileString("LastExportDir", "");
-}
-
-void CGetSetOptions::SetLastExportDir(CString csDir)
-{
-	SetProfileString("LastExportDir", csDir);
-}
-
-BOOL CGetSetOptions::GetUpdateDescWhenSavingClip()
-{
-	return GetProfileLong("UpdateDescWhenSaving", TRUE);
-}
-
-void CGetSetOptions::SetUpdateDescWhenSavingClip(BOOL bSet)
-{
-	SetProfileLong("UpdateDescWhenSaving", bSet);
-}
-
-CString CGetSetOptions::GetPath(long lPathID)
-{
-	CString csDir = CGetSetOptions::GetExeFileName();
-	csDir = GetFilePath(csDir);
-	FIX_CSTRING_PATH(csDir);
-
-	//U3_APP_DATA_PATH    -	<U3_DEVICE_PATH>\System\Apps\{app_unique_id}\Data
-	//U3_HOST_EXEC_PATH	  - %APPDATA%\U3\{device_serial_number}\{app_unique_id}\Exec
-	//U3_DEVICE_EXEC_PATH -	<U3_DEVICE_PATH>\System\Apps\{app_unique_id}\Exec
-
-	switch(lPathID)
-	{
-	case PATH_HELP:
-		if(m_bU3)
-		{
-			csDir = GETENV(_T("U3_DEVICE_EXEC_PATH"));
-			FIX_CSTRING_PATH(csDir);
-		}
-
-		csDir += "Help\\";
-		break;
-	
-	case PATH_LANGUAGE:
-		if(m_bU3)
-		{
-			csDir = GETENV(_T("U3_DEVICE_EXEC_PATH"));
-			FIX_CSTRING_PATH(csDir);
-		}
-
-		csDir += "language\\";
-
-		break;
-
-	case PATH_THEMES:
-
-		if(m_bU3)
-		{
-			csDir = GETENV(_T("U3_DEVICE_EXEC_PATH"));
-			FIX_CSTRING_PATH(csDir);
-		}
-
-		csDir += "Themes\\";
-
-		break;
-
-	case PATH_REMOTE_FILES:
-		if(m_bU3)
-		{
-			csDir = GETENV(_T("U3_HOST_EXEC_PATH"));
-			FIX_CSTRING_PATH(csDir);
-		}
-		else if(CGetSetOptions::GetIsPortableDitto() == false)
-		{
-			csDir = GetAppDataPath();
-		}
-
-		csDir += "ReceivedFiles\\";
-		break;
-
-	case PATH_LOG_FILE:
-		if(m_bU3)
-		{
-			csDir = GETENV(_T("U3_HOST_EXEC_PATH"));
-			FIX_CSTRING_PATH(csDir);
-		}
-		else if(CGetSetOptions::GetIsPortableDitto() == false)
-		{
-			csDir = GetAppDataPath();
-		}
-
-		break;
-
-	case PATH_UPDATE_FILE:
-		//same path as the executable
-		break;
-
-	case PATH_DATABASE:
-		if(m_bU3)
-		{
-			csDir = GETENV(_T("U3_APP_DATA_PATH"));
-			FIX_CSTRING_PATH(csDir);
-		}
-		break;
-
-
-	case PATH_INI:
-		if(m_bU3)
-		{
-			csDir = GETENV(_T("U3_APP_DATA_PATH"));
-			FIX_CSTRING_PATH(csDir);
-		}
-		break;
-
-	case PATH_U3_HWND_INI:
-		if(m_bU3)
-		{
-			csDir = GETENV(_T("U3_HOST_EXEC_PATH"));
-			FIX_CSTRING_PATH(csDir);
-		}
-		break;
-
-	case PATH_ADDINS:
-		if(m_bU3)
-		{
-			csDir = GETENV(_T("U3_DEVICE_EXEC_PATH"));
-			FIX_CSTRING_PATH(csDir);
-		}
-
-		csDir += "Addins\\";
-		
-		break;
-	}
-
-	CreateDirectory(csDir, NULL);
-
-	return csDir;
-}
-
-void CGetSetOptions::WriteU3Hwnd(HWND hWnd)
-{
-	CString csIniFile = GetPath(PATH_U3_HWND_INI);
-	csIniFile += _T("DittohWnd.ini");
-	WritePrivateProfileInt(_T("Ditto"), _T("MainhWnd"), (int)hWnd, csIniFile);
-}
-
-long CGetSetOptions::GetDittoRestoreClipboardDelay()
-{
-	return GetProfileLong("RestoreClipboardDelay", 750);
-
-}
-void CGetSetOptions::SetDittoRestoreClipboardDelay(long lDelay)
-{
-	SetProfileLong("RestoreClipboardDelay", lDelay);
-}
-
-void CGetSetOptions::GetCopyBufferItem(int nPos, CCopyBufferItem &Item)
-{
-	Item.m_lCopyHotKey = GetProfileLong(StrF(_T("CopyBufferCopyHotKey_%d"), nPos), 0);
-	Item.m_lPasteHotKey = GetProfileLong(StrF(_T("CopyBufferPasteHotKey_%d"), nPos), 0);
-	Item.m_lCutHotKey = GetProfileLong(StrF(_T("CopyBufferCutHotKey_%d"), nPos), 0);
-	Item.m_bPlaySoundOnCopy = GetProfileLong(StrF(_T("CopyBufferPlaySound_%d"), nPos), 0);
-}
-
-void CGetSetOptions::SetCopyBufferItem(int nPos, CCopyBufferItem &Item)
-{
-	SetProfileLong(StrF(_T("CopyBufferCopyHotKey_%d"), nPos), Item.m_lCopyHotKey);
-	SetProfileLong(StrF(_T("CopyBufferPasteHotKey_%d"), nPos), Item.m_lPasteHotKey);
-	SetProfileLong(StrF(_T("CopyBufferCutHotKey_%d"), nPos), Item.m_lCutHotKey);
-	SetProfileLong(StrF(_T("CopyBufferPlaySound_%d"), nPos), Item.m_bPlaySoundOnCopy);
-}
-
-CString CGetSetOptions::GetMultiPasteSeparator(bool bConvertToLineFeeds)
-{
-	CString csSep = GetProfileString(_T("MultiPasteSeparator"), _T("[LF]"));
-	if(bConvertToLineFeeds)
-	{
-		CString csLineFeed(_T("\r\n"));
-		csSep.Replace(_T("[LF]"), csLineFeed);
-		csSep.Replace(_T("[lf]"), csLineFeed);
-	}
-
-	return csSep;
-}
-
-void CGetSetOptions::SetMultiPasteSeparator(CString csSep)
-{
-	SetProfileString(_T("MultiPasteSeparator"), csSep);
-}
-
-BOOL CGetSetOptions::GetSetCurrentDirectory()
-{
-	if(m_portable)
-	{
-		CString csExePath = GetFilePath(GetExeFileName());
-		FIX_CSTRING_PATH(csExePath);
-		::SetCurrentDirectory(csExePath);
-	}
-
-	return m_portable == true;
-}
-
-bool CGetSetOptions::GetIsPortableDitto()
-{
-	return m_portable;
-}
-
-CString CGetSetOptions::GetPasteString(CString csAppName)
-{
-	CString csString = GetProfileString(csAppName, _T(""), _T("PasteStrings"));
-	if(csString.IsEmpty())
-		return GetDefaultPasteString();
-
-	return csString;
-}
-
-CString CGetSetOptions::GetDefaultPasteString()
-{
-	return GetProfileString(_T("DefaultPasteString"), _T("^v"));
-}
-
-CString CGetSetOptions::GetCopyString(CString csAppName)
-{
-	CString csString = GetProfileString(csAppName, _T(""), _T("CopyStrings"));
-	if(csString.IsEmpty())
-		return GetDefaultCopyString();
-
-	return csString;
-}
-
-CString CGetSetOptions::GetDefaultCopyString()
-{
-	return GetProfileString(_T("DefaultCopyString"), _T("^c"));
-}
-
-CString CGetSetOptions::GetCutString(CString csAppName)
-{
-	CString csString = GetProfileString(csAppName, _T(""), _T("CutStrings"));
-	if(csString.IsEmpty())
-		return GetDefaultCutString();
-
-	return csString;
-}
-
-CString CGetSetOptions::GetDefaultCutString()
-{
-	return GetProfileString(_T("DefaultCutString"), _T("^x"));
-}
-
-BOOL CGetSetOptions::GetEditWordWrap()
-{
-	return GetProfileLong(_T("EditWordWrap"), TRUE);
-}
-
-void CGetSetOptions::SetEditWordWrap(BOOL bSet)
-{
-	SetProfileLong(_T("EditWordWrap"), bSet);
-}
-
-bool CGetSetOptions::GetAllowFriends()
-{
-	return (GetProfileLong("AllowFriends", TRUE) == TRUE);
-}
-
-long CGetSetOptions::GetAutoMaxDelay()
-{
-	return GetProfileLong(_T("AutoMaxDelaySeconds"), 2);
-}
-
-void CGetSetOptions::SetAutoMaxDelay(long lDelay)
-{
-	SetProfileLong(_T("AutoMaxDelaySeconds"), lDelay);
-}
-
-void CGetSetOptions::SetTheme(CString csTheme)
-{
-	SetProfileString(_T("Theme"), csTheme);
-}
-
-CString CGetSetOptions::GetTheme()
-{
-	return GetProfileString(_T("Theme"), "");
-}
-
-long CGetSetOptions::GetKeyStateWaitTimerCount()
-{
-	return GetProfileLong(_T("KeyStateWaitTimerCount"), 20);
-}
-
-long CGetSetOptions::GetKeyStatePasteDelay()
-{
-	return GetProfileLong(_T("KeyStatePasteDelay"), 200);
-}
-
-DWORD CGetSetOptions::GetDittoHotKey()
-{
-	return (DWORD)GetProfileLong(_T("DittoHotKey"), 704);
-}
-
-DWORD CGetSetOptions::SendKeysDelay()
-{
-	return (DWORD)GetProfileLong(_T("SendKeysDelay"), 50);
-}
-
-DWORD CGetSetOptions::WaitForActiveWndTimeout()
-{
-	return (DWORD)GetProfileLong(_T("WaitForActiveWndTimeout"), 100);
-}
-
-DWORD CGetSetOptions::FocusChangedDelay()
-{
-	return (DWORD)GetProfileLong(_T("FocusChangedDelay"), 100);
-}
-
-DWORD CGetSetOptions::FocusWndTimerTimeout()
-{
-	return (DWORD)GetProfileLong(_T("FocusWndTimerTimeout"), 2000);
-}
-
-BOOL CGetSetOptions::GetConnectedToClipboard()
-{
-	return GetProfileLong("ConnectedToClipboard", TRUE);
-}
-
-void CGetSetOptions::SetConnectedToClipboard(BOOL val)
-{
-	SetProfileLong("ConnectedToClipboard", val);
-}
-
-DWORD CGetSetOptions::GetTextOnlyRestoreDelay()
-{
-	return (DWORD)GetProfileLong(_T("TextOnlyRestoreDelay"), 2000);
-}
-
-DWORD CGetSetOptions::GetTextOnlyPasteDelay()
-{
-	return (DWORD)GetProfileLong(_T("TextOnlyPasteDelay"), 500);
-}
-
-BOOL CGetSetOptions::GetSetFocusToApp(CString csAppName)
-{
-	CString focusCheck;
-	focusCheck = "SetFocus_";
-	focusCheck += csAppName;
-	return GetProfileLong(focusCheck, FALSE);
-}
-
-DWORD CGetSetOptions::SelectedIndex()
-{
-	return (DWORD)GetProfileLong(_T("SelectedIndex"), 0);
-}
-
-void CGetSetOptions::SetCopyAppInclude(CString csAppName)
-{
-	SetProfileString(_T("CopyAppInclude"), csAppName);
-}
-
-CString CGetSetOptions::GetCopyAppInclude()
-{
-	CString includeApp = GetProfileString(_T("CopyAppInclude"), "*");
-	if(includeApp == "")
-	{
-		includeApp = "*";
-	}
-
-	return includeApp;
-}
-
-void CGetSetOptions::SetCopyAppExclude(CString csAppName)
-{
-	SetProfileString(_T("CopyAppExclude"), csAppName);
-}
-
-CString CGetSetOptions::GetCopyAppExclude()
-{
-	return GetProfileString(_T("CopyAppExclude"), "");
-}
-
-CString CGetSetOptions::GetCopyAppSeparator()
-{
-	return GetProfileString(_T("CopyAppSeparator"), ";");
-}
-
-DWORD CGetSetOptions::GetNoFormatsRetryDelay()
-{
-	return GetProfileLong(_T("NoFormatsRetryDelay"), 200);
-}
-
-DWORD CGetSetOptions::GetMainDeletesDeleteCount()
-{  
-	return GetProfileLong(_T("MainDeletesDeleteCount"), 100);
-}
-
-DWORD CGetSetOptions::GetIdleSecondsBeforeDelete()
-{  
-	return GetProfileLong(_T("IdleSecondsBeforeDelete"), 60*10);
-}
-
-DWORD CGetSetOptions::GetDbTimeout()
-{  
-	return GetProfileLong(_T("DbTimeout"), 5000);
-}
-
-DWORD CGetSetOptions::GetFunnyTickCountAdjustment()
-{  
-	return GetProfileLong(_T("FunnyTickCountAdjustment"), 300001);
-}
-
-DWORD CGetSetOptions::GetMinIdleTimeBeforeTrackFocus()
-{
-	return GetProfileLong(_T("MinIdleTimeBeforeTrackFocus"), 100);
-}
-
-DWORD CGetSetOptions::GetTimeBeforeExpandWindow()
-{
-	return GetProfileLong(_T("TimeBeforeExpandWindow"), 250);
-}
-
-DWORD CGetSetOptions::GetUseGuiThreadInfoForFocus()
-{
-	return GetProfileLong(_T("UseGuiThreadInfoForFocus"), 1);
-}
-
-void CGetSetOptions::SetSearchDescription(BOOL val)
-{
-	SetProfileLong(_T("SearchDescription"), val);
-}
-
-BOOL CGetSetOptions::GetSearchDescription()
-{
-	return GetProfileLong(_T("SearchDescription"), 1);
-}
-
-void CGetSetOptions::SetSearchFullText(BOOL val)
-{
-	SetProfileLong(_T("SearchFullText"), val);
-}
-
-BOOL CGetSetOptions::GetSearchFullText()
-{
-	return GetProfileLong(_T("SearchFullText"), 0);
-}
-
-void CGetSetOptions::SetSearchQuickPaste(BOOL val)
-{
-	SetProfileLong(_T("SearchQuickPaste"), val);
-}
-
-BOOL CGetSetOptions::GetSearchQuickPaste()
-{
-	return GetProfileLong(_T("SearchQuickPaste"), 0);
-}
-
-void CGetSetOptions::SetShowScrollBar(BOOL val)
-{
-	m_showScrollBar = val;
-	SetProfileLong(_T("ShowScrollBar"), val);
-}
-
-BOOL CGetSetOptions::GetShowScrollBar()
-{
-	return GetProfileLong(_T("ShowScrollBar"), 0);
+#include "stdafx.h"
+#include "Options.h"
+#include "AlphaBlend.h"
+#include "Misc.h"
+#include "shared/TextConvert.h"
+#include "sqlite\CppSQLite3.h"
+#include "Path.h"
+
+using namespace nsPath;
+
+UINT WritePrivateProfileInt(LPCTSTR lpAppName, LPCTSTR lpKeyName, INT nValue, LPCTSTR lpFileName)
+{
+	// Locals
+	TCHAR	szBuff[25];
+
+	// Format
+	SPRINTF(szBuff, _T("%d"), nValue);
+
+	// Write
+	return WritePrivateProfileString(lpAppName, lpKeyName, szBuff, lpFileName);
+}
+
+long CGetSetOptions::m_nLinesPerRow;
+BOOL CGetSetOptions::m_bUseCtrlNumAccel;
+BOOL CGetSetOptions::m_bAllowDuplicates;
+BOOL CGetSetOptions::m_bUpdateTimeOnPaste;
+BOOL CGetSetOptions::m_bSaveMultiPaste;
+BOOL CGetSetOptions::m_bShowPersistent;
+long CGetSetOptions::m_bDescTextSize;
+BOOL CGetSetOptions::m_bDescShowLeadingWhiteSpace;
+BOOL CGetSetOptions::m_bAllwaysShowDescription;
+long CGetSetOptions::m_bDoubleClickingOnCaptionDoes;
+BOOL CGetSetOptions::m_bPrompForNewGroupName;
+BOOL CGetSetOptions::m_bSendPasteOnFirstTenHotKeys;
+CSendClients CGetSetOptions::m_SendClients[MAX_SEND_CLIENTS];
+long CGetSetOptions::m_lAutoSendClientCount;
+CString CGetSetOptions::m_csIPListToPutOnClipboard;
+BOOL CGetSetOptions::m_bLogSendReceiveErrors;
+BOOL CGetSetOptions::m_HideDittoOnHotKeyIfAlreadyShown;
+long CGetSetOptions::m_lPort;
+BOOL CGetSetOptions::m_bDrawThumbnail;
+CStringA CGetSetOptions::m_csPassword;
+BOOL CGetSetOptions::m_bDrawRTF;
+BOOL CGetSetOptions::m_bMultiPasteReverse;
+CString CGetSetOptions::m_csPlaySoundOnCopy;
+CStringArray CGetSetOptions::m_csNetworkPasswordArray;
+BOOL CGetSetOptions::m_bSendPasteMessageAfterSelection;
+BOOL CGetSetOptions::m_bFindAsYouType;
+BOOL CGetSetOptions::m_bEnsureEntireWindowCanBeSeen;
+BOOL CGetSetOptions::m_bShowAllClipsInMainList;
+long CGetSetOptions::m_lMaxClipSizeInBytes;
+DWORD CGetSetOptions::m_dwSaveClipDelay;
+long CGetSetOptions::m_lProcessDrawClipboardDelay;
+BOOL CGetSetOptions::m_bEnableDebugLogging;
+BOOL CGetSetOptions::m_bEnsureConnectToClipboard;
+bool CGetSetOptions::m_bOutputDebugString;
+bool CGetSetOptions::m_bU3 = false;
+bool CGetSetOptions::m_bInConversion = false;
+bool CGetSetOptions::m_bFromIni = false;
+bool CGetSetOptions::m_portable = false;
+CString CGetSetOptions::m_csIniFileName;
+__int64 CGetSetOptions::nLastDbWriteTime = 0;
+CTheme CGetSetOptions::m_Theme;
+BOOL CGetSetOptions::m_showScrollBar = false;
+CGetSetOptions g_Opt;
+
+CGetSetOptions::CGetSetOptions()
+{
+}
+
+CGetSetOptions::~CGetSetOptions()
+{
+
+}
+
+void CGetSetOptions::LoadSettings()
+{
+	m_csIniFileName = GetIniFileName(true);
+
+	CString portable = GetFilePath(m_csIniFileName);
+	portable += _T("portable");
+	if(FileExists(portable)) 
+	{
+		m_portable = true;
+	}
+
+	if(m_bU3)
+	{
+		m_bFromIni = true;
+	}
+	else
+	{
+		//first check if ini file is in app directory
+		if(m_portable || FileExists(m_csIniFileName))
+		{
+			m_bFromIni = true;
+		}
+		else
+		{
+			//next check if it's in app data
+			m_csIniFileName = GetIniFileName(false);
+			if(FileExists(m_csIniFileName))
+			{
+				m_bFromIni = true;
+			}
+		}
+	}
+
+	if(m_bFromIni)
+	{
+		CString csPath = GetFilePath(m_csIniFileName);
+		if(FileExists(csPath) == FALSE)
+			CreateDirectory(csPath, NULL);
+	}
+
+	GetSetCurrentDirectory();
+
+	//First time we run, set some defaults
+	if (GetDBPath() == _T("") &&
+		GetTotalCopyCount() == 0)
+	{
+		SetCheckForMaxEntries(TRUE);
+		SetSimpleTextSearch(TRUE);
+	}
+
+	m_nLinesPerRow = GetLinesPerRow();
+	m_bUseCtrlNumAccel = GetUseCtrlNumForFirstTenHotKeys();
+	m_bAllowDuplicates = GetAllowDuplicates();
+	m_bUpdateTimeOnPaste = GetUpdateTimeOnPaste();
+	m_bSaveMultiPaste = GetSaveMultiPaste();
+	m_bShowPersistent = GetShowPersistent();
+	m_bDescTextSize = GetDescTextSize();
+	m_bDescShowLeadingWhiteSpace = GetDescShowLeadingWhiteSpace();
+	m_bAllwaysShowDescription = GetAllwaysShowDescription();
+	m_bDoubleClickingOnCaptionDoes = GetDoubleClickingOnCaptionDoes();
+	m_bPrompForNewGroupName = GetPrompForNewGroupName();
+	m_bSendPasteOnFirstTenHotKeys = GetSendPasteOnFirstTenHotKeys();
+	m_csIPListToPutOnClipboard = GetListToPutOnClipboard();
+	m_bLogSendReceiveErrors = GetLogSendReceiveErrors();
+	m_HideDittoOnHotKeyIfAlreadyShown = GetHideDittoOnHotKeyIfAlreadyShown();
+	m_lPort = GetPort();
+	m_bDrawThumbnail = GetDrawThumbnail();
+	m_csPassword = GetNetworkPassword();
+	m_bDrawRTF = GetDrawRTF();
+	m_bMultiPasteReverse = GetMultiPasteReverse();
+	m_csPlaySoundOnCopy = GetPlaySoundOnCopy();
+	m_bSendPasteMessageAfterSelection = GetSendPasteAfterSelection();
+	m_bFindAsYouType = GetFindAsYouType();
+	m_bEnsureEntireWindowCanBeSeen = GetEnsureEntireWindowCanBeSeen();
+	m_bShowAllClipsInMainList = GetShowAllClipsInMainList();
+	m_lMaxClipSizeInBytes = GetMaxClipSizeInBytes();
+	m_dwSaveClipDelay = GetSaveClipDelay();
+	m_lProcessDrawClipboardDelay = GetProcessDrawClipboardDelay();
+	m_bEnableDebugLogging = GetEnableDebugLogging();
+	m_bEnsureConnectToClipboard = GetEnsureConnectToClipboard();
+	m_bOutputDebugString = false;
+	m_showScrollBar = GetShowScrollBar();
+
+	GetExtraNetworkPassword(true);
+
+	for(int i = 0; i < MAX_SEND_CLIENTS; i++)
+	{
+		GetSendClients(i);
+	}
+
+	GetClientSendCount();
+
+
+	//If running from a U3 device and no language file as been asigned
+	//then use the language defined by the U3 launcher
+	if(m_bU3)
+	{
+		CString csLanguage = GetLanguageFile();
+		if(csLanguage.IsEmpty())
+		{
+			CString csLanguage = GETENV(_T("U3_ENV_LANGUAGE"));
+			long lLanguage = ATOI(csLanguage);
+			csLanguage.Empty();
+			switch(lLanguage)
+			{
+			case 1036: //French
+				csLanguage = _T("Français");
+				break;
+
+			case 1040: //Italian
+				csLanguage = _T("Italiano");
+				break;
+
+			case 1031: //German
+				csLanguage = _T("German");
+				break;
+
+			case 3082: //German
+				csLanguage = _T("Español");
+				break;
+			}
+
+			if(csLanguage.IsEmpty() == FALSE)
+			{
+				SetLanguageFile(csLanguage);
+			}
+		}
+	}
+
+	m_Theme.Load(GetTheme());
+}
+
+void CGetSetOptions::ConverSettingsToIni()
+{
+	m_bInConversion = true;
+
+	CSize sz;
+	CPoint pt;
+
+	GetQuickPasteSize(sz);
+	SetQuickPasteSize(sz);
+	
+	GetQuickPastePoint(pt);
+	SetQuickPastePoint(pt);
+
+	GetEditWndSize(sz);
+	SetEditWndSize(sz);
+
+	GetEditWndPoint(pt);
+	SetEditWndPoint(pt);
+
+	SetShowIconInSysTray(GetShowIconInSysTray());
+	SetRunOnStartUp(GetRunOnStartUp());
+	SetEnableTransparency(GetEnableTransparency());
+	SetTransparencyPercent(GetTransparencyPercent());
+	SetLinesPerRow(GetLinesPerRow());
+	SetQuickPastePosition(GetQuickPastePosition());
+	SetCopyGap(GetCopyGap());
+	SetDBPath(GetDBPath());
+	SetCheckForMaxEntries(GetCheckForMaxEntries());
+	SetCheckForExpiredEntries(GetCheckForExpiredEntries());
+	SetMaxEntries(GetMaxEntries());
+	SetExpiredEntries(GetExpiredEntries());
+	SetTripCopyCount(GetTripCopyCount());
+	SetTripPasteCount(GetTripPasteCount());
+	SetTripDate(GetTripDate());
+	SetTotalCopyCount(GetTotalCopyCount());
+	SetTotalPasteCount(GetTotalPasteCount());
+	SetTotalDate(GetTotalDate());
+	SetUpdateFilePath(GetUpdateFilePath());
+	SetUpdateInstallPath(GetUpdateInstallPath());	
+	SetLastUpdate(GetLastUpdate());
+	SetCheckForUpdates(GetCheckForUpdates());
+	SetUseCtrlNumForFirstTenHotKeys(GetUseCtrlNumForFirstTenHotKeys());
+	SetAllowDuplicates(GetAllowDuplicates());
+	SetUpdateTimeOnPaste(GetUpdateTimeOnPaste());
+	SetSaveMultiPaste(GetSaveMultiPaste());
+	SetShowPersistent(GetShowPersistent());
+	SetShowTextForFirstTenHotKeys(GetShowTextForFirstTenHotKeys());
+	SetMainHWND(GetMainHWND());
+	SetCaptionPos(GetCaptionPos());
+	SetAutoHide(GetAutoHide());
+	SetDescTextSize(GetDescTextSize());
+	SetDescShowLeadingWhiteSpace(GetDescShowLeadingWhiteSpace());
+	SetAllwaysShowDescription(GetAllwaysShowDescription());
+	SetDoubleClickingOnCaptionDoes(GetDoubleClickingOnCaptionDoes());
+	SetPrompForNewGroupName(GetPrompForNewGroupName());
+	SetSendPasteOnFirstTenHotKeys(GetSendPasteOnFirstTenHotKeys());
+
+	for(int i = 0; i < MAX_SEND_CLIENTS; i++)
+	{
+		GetSendClients(i);
+		SetSendClients(m_SendClients[i], i);
+	}
+
+	SetListToPutOnClipboard(GetListToPutOnClipboard());
+	SetLogSendReceiveErrors(GetLogSendReceiveErrors());
+	SetHideDittoOnHotKeyIfAlreadyShown(GetHideDittoOnHotKeyIfAlreadyShown());
+	SetPort(GetPort());
+	SetDisableRecieve(GetDisableRecieve());
+
+	LOGFONT font;
+	GetFont(font);
+	SetFont(font);
+
+	SetDrawThumbnail(GetDrawThumbnail());	
+
+	CStringA PassA = GetNetworkPassword();
+	CString PassW = PassA;
+	SetNetworkPassword(PassW);
+
+	SetDrawRTF(GetDrawRTF());
+	SetMultiPasteReverse(GetMultiPasteReverse());
+	SetPlaySoundOnCopy(GetPlaySoundOnCopy());
+	SetSendPasteAfterSelection(GetSendPasteAfterSelection());
+	SetFindAsYouType(GetFindAsYouType());
+	SetEnsureEntireWindowCanBeSeen(GetEnsureEntireWindowCanBeSeen());
+	SetShowAllClipsInMainList(GetShowAllClipsInMainList());
+	SetExtraNetworkPassword(GetExtraNetworkPassword(false));
+	SetMaxClipSizeInBytes(GetMaxClipSizeInBytes());
+	SetLanguageFile(GetLanguageFile());
+	SetSaveClipDelay(GetSaveClipDelay());
+	SetProcessDrawClipboardDelay(GetProcessDrawClipboardDelay());
+	SetEnableDebugLogging(GetEnableDebugLogging());
+	SetEnsureConnectToClipboard(GetEnsureConnectToClipboard());
+	SetPromptWhenDeletingClips(GetPromptWhenDeletingClips());
+	SetLastImportDir(GetLastImportDir());
+	SetLastExportDir(GetLastExportDir());
+	SetUpdateDescWhenSavingClip(GetUpdateDescWhenSavingClip());
+
+	m_bInConversion = false;
+}
+
+CString CGetSetOptions::GetIniFileName(bool bLocalIniFile)
+{
+	CString csPath = _T("c:\\program files\\Ditto\\");
+
+	if(m_bU3)
+	{
+		csPath = CGetSetOptions::GetPath(PATH_INI);
+	}
+	else
+	{	
+		if(bLocalIniFile)
+		{
+			csPath = GetFilePath(GetExeFileName());
+		}
+		else
+		{
+			csPath = GetAppDataPath();
+		}
+	}
+
+	csPath += "Ditto.Settings";
+
+	return csPath;
+}
+
+CString CGetSetOptions::GetAppDataPath()
+{
+	CString csPath;
+	LPMALLOC pMalloc;
+
+	if(SUCCEEDED(::SHGetMalloc(&pMalloc))) 
+	{ 
+		LPITEMIDLIST pidlPrograms;
+
+		SHGetSpecialFolderLocation(NULL, CSIDL_APPDATA, &pidlPrograms);
+
+		TCHAR string[MAX_PATH];
+		SHGetPathFromIDList(pidlPrograms, string);
+
+		pMalloc->Free(pidlPrograms);
+		pMalloc->Release();
+
+		csPath = string;		
+	}
+	FIX_CSTRING_PATH(csPath);
+	csPath += "Ditto\\";
+
+	return csPath;
+}
+
+long CGetSetOptions::GetProfileLong(CString csName, long lDefaultValue, CString csNewPath)
+{
+	if(m_bFromIni && !m_bInConversion)
+	{
+		CString csApp(_T("Ditto"));
+
+		if(csNewPath.IsEmpty() == FALSE)
+		{
+			csApp = csNewPath;
+		}
+
+		return GetPrivateProfileInt(csApp, csName, lDefaultValue, m_csIniFileName);
+	}
+
+	CString csPath(_T(REG_PATH));
+	if(csNewPath.IsEmpty() == FALSE)
+	{
+		csPath += "\\" + csNewPath;
+	}
+
+	HKEY hkKey;
+
+	long lResult = RegOpenKeyEx(HKEY_CURRENT_USER, csPath, NULL, KEY_READ, &hkKey);
+
+	if(lResult != ERROR_SUCCESS)
+		return lDefaultValue;
+
+	DWORD buffer;
+	DWORD len =  sizeof(buffer);
+	DWORD type;
+
+	lResult = ::RegQueryValueEx(hkKey, csName, 0, &type, (LPBYTE)&buffer, &len);
+
+	RegCloseKey(hkKey);
+
+	if(lResult == ERROR_SUCCESS)
+		return (long)buffer;
+
+	return lDefaultValue;
+}
+
+CString CGetSetOptions::GetProfileString(CString csName, CString csDefault, CString csNewPath)
+{
+	if(m_bFromIni && !m_bInConversion)
+	{
+		CString csApp(_T("Ditto"));
+
+		if(csNewPath.IsEmpty() == FALSE)
+		{
+			csApp = csNewPath;
+		}
+
+		TCHAR cString[MAX_PATH];
+		GetPrivateProfileString(csApp, csName, csDefault, cString, sizeof(cString), m_csIniFileName);
+
+		return cString;
+	}
+
+	CString csPath(_T(REG_PATH));
+	if(csNewPath.IsEmpty() == FALSE)
+	{
+		csPath += "\\" + csNewPath;
+	}
+
+	HKEY hkKey;
+	long lResult = RegOpenKeyEx(HKEY_CURRENT_USER, csPath, NULL, KEY_READ, &hkKey);
+
+	TCHAR szString[256];
+	ZeroMemory(szString, sizeof(szString));
+	DWORD dwBufLen = 256;
+
+	lResult = ::RegQueryValueEx(hkKey , csName, NULL, NULL, (LPBYTE)szString, &dwBufLen);
+
+	RegCloseKey(hkKey);
+
+	if(lResult != ERROR_SUCCESS)
+		return csDefault;
+
+	return szString;
+}
+
+BOOL CGetSetOptions::SetProfileLong(CString csName, long lValue)
+{
+	if(m_bFromIni)
+	{
+		return WritePrivateProfileInt(_T("Ditto"), csName, lValue, m_csIniFileName);
+	}
+
+	HKEY hkKey;
+	DWORD dWord;
+	long lResult = RegCreateKeyEx(HKEY_CURRENT_USER, _T(REG_PATH), NULL, 
+		NULL, REG_OPTION_NON_VOLATILE, KEY_ALL_ACCESS, 
+		NULL, &hkKey, &dWord);
+
+	if(lResult != ERROR_SUCCESS)
+		return FALSE;
+
+	DWORD val = (DWORD)lValue;
+	lResult = ::RegSetValueEx(hkKey, csName, 0, REG_DWORD, (LPBYTE)&val, sizeof(DWORD));
+
+	RegCloseKey(hkKey);
+
+	return lResult == ERROR_SUCCESS;
+}
+
+BOOL CGetSetOptions::SetProfileString(CString csName, CString csValue)
+{
+	if(m_bFromIni)
+	{
+		return WritePrivateProfileString(_T("Ditto"), csName, csValue, m_csIniFileName);
+	}
+
+	HKEY hkKey;
+	DWORD dWord;
+	long lResult = RegCreateKeyEx(HKEY_CURRENT_USER, _T(REG_PATH), NULL, 
+		NULL, REG_OPTION_NON_VOLATILE, KEY_ALL_ACCESS, 
+		NULL, &hkKey, &dWord);
+
+	if(lResult != ERROR_SUCCESS)
+		return FALSE;
+
+	::RegSetValueEx(hkKey, csName, NULL, REG_SZ,
+		(BYTE*)(LPCTSTR)csValue, csValue.GetLength()*sizeof(TCHAR));
+
+	RegCloseKey(hkKey);
+
+	return lResult == ERROR_SUCCESS;
+}
+
+BOOL CGetSetOptions::SetProfileData(CString csName, LPVOID lpData, DWORD dwLength)
+{
+	if(m_bFromIni)
+	{
+		ASSERT(!"SetProfileData not supported in .ini settings");
+		return FALSE;
+	}
+
+	HKEY hkKey;
+	DWORD dWord;
+	long lResult = RegCreateKeyEx(HKEY_CURRENT_USER, _T(REG_PATH), NULL, 
+		NULL, REG_OPTION_NON_VOLATILE, KEY_ALL_ACCESS, 
+		NULL, &hkKey, &dWord);
+
+	if(lResult != ERROR_SUCCESS)
+		return FALSE;
+
+	::RegSetValueEx(hkKey, csName, NULL, REG_BINARY,
+		(BYTE*)lpData, dwLength);
+
+	RegCloseKey(hkKey);
+
+	return lResult == ERROR_SUCCESS;
+}
+
+BOOL CGetSetOptions::GetProfileFont(CString csSection, LOGFONT &font)
+{
+	font.lfHeight = GetPrivateProfileInt(csSection, _T("Height"), 0, m_csIniFileName);
+	font.lfWidth = GetPrivateProfileInt(csSection, _T("Width"), 0, m_csIniFileName);
+	font.lfEscapement = GetPrivateProfileInt(csSection, _T("Escapement"), 0, m_csIniFileName);
+	font.lfOrientation = GetPrivateProfileInt(csSection, _T("Orientation"), 0, m_csIniFileName);
+	font.lfWeight = GetPrivateProfileInt(csSection, _T("Weight"), 0, m_csIniFileName);
+	font.lfItalic = GetPrivateProfileInt(csSection, _T("Italic"), 0, m_csIniFileName);
+	font.lfUnderline = GetPrivateProfileInt(csSection, _T("Underline"), 0, m_csIniFileName);
+	font.lfStrikeOut = GetPrivateProfileInt(csSection, _T("StrikeOut"), 0, m_csIniFileName);
+	font.lfCharSet = GetPrivateProfileInt(csSection, _T("CharSet"), 0, m_csIniFileName);
+	font.lfOutPrecision = GetPrivateProfileInt(csSection, _T("OutPrecision"), 0, m_csIniFileName);
+	font.lfClipPrecision = GetPrivateProfileInt(csSection, _T("ClipPrecision"), 0, m_csIniFileName);
+	font.lfQuality = GetPrivateProfileInt(csSection, _T("Quality"), 0, m_csIniFileName);
+	font.lfPitchAndFamily = GetPrivateProfileInt(csSection, _T("PitchAndFamily"), 0, m_csIniFileName);
+	GetPrivateProfileString(csSection, _T("FaceName"), _T(""), font.lfFaceName, sizeof(font.lfFaceName), m_csIniFileName);
+
+	return TRUE;
+}
+
+BOOL CGetSetOptions::SetProfileFont(CString csSection, LOGFONT &font)
+{
+	WritePrivateProfileInt(csSection, _T("Height"), font.lfHeight, m_csIniFileName);
+	WritePrivateProfileInt(csSection, _T("Width"), font.lfWidth, m_csIniFileName);
+	WritePrivateProfileInt(csSection, _T("Escapement"), font.lfEscapement, m_csIniFileName);
+	WritePrivateProfileInt(csSection, _T("Orientation"), font.lfOrientation, m_csIniFileName);
+	WritePrivateProfileInt(csSection, _T("Weight"), font.lfWeight, m_csIniFileName);
+	WritePrivateProfileInt(csSection, _T("Italic"), font.lfItalic, m_csIniFileName);
+	WritePrivateProfileInt(csSection, _T("Underline"), font.lfUnderline, m_csIniFileName);
+	WritePrivateProfileInt(csSection, _T("StrikeOut"), font.lfStrikeOut, m_csIniFileName);
+	WritePrivateProfileInt(csSection, _T("CharSet"), font.lfCharSet, m_csIniFileName);
+	WritePrivateProfileInt(csSection, _T("OutPrecision"), font.lfOutPrecision, m_csIniFileName);
+	WritePrivateProfileInt(csSection, _T("ClipPrecision"), font.lfClipPrecision, m_csIniFileName);
+	WritePrivateProfileInt(csSection, _T("Quality"), font.lfQuality, m_csIniFileName);
+	WritePrivateProfileInt(csSection, _T("PitchAndFamily"), font.lfPitchAndFamily, m_csIniFileName);
+	WritePrivateProfileString(csSection, _T("FaceName"), font.lfFaceName, m_csIniFileName);
+
+	return TRUE;
+}
+
+LPVOID CGetSetOptions::GetProfileData(CString csName, DWORD &dwLength)
+{
+	if(m_bFromIni && !m_bInConversion)
+	{
+		ASSERT(!"GetProfileData not supported in .ini settings");
+		return NULL;
+	}
+
+	HKEY hkKey;
+
+	long lResult = RegOpenKeyEx(HKEY_CURRENT_USER, _T(REG_PATH),
+		NULL, KEY_READ, &hkKey);
+
+	lResult = ::RegQueryValueEx(hkKey , csName, NULL, NULL, NULL, &dwLength);
+
+	if(lResult != ERROR_SUCCESS)
+		return NULL;
+
+	LPVOID lpVoid = new BYTE[dwLength];
+
+	lResult = ::RegQueryValueEx(hkKey , csName, NULL, NULL, (LPBYTE)lpVoid, &dwLength);
+
+	RegCloseKey(hkKey);
+
+	if(lResult != ERROR_SUCCESS)
+		return NULL;
+
+	return lpVoid;
+}
+
+BOOL CGetSetOptions::GetShowIconInSysTray() 
+{
+	return GetProfileLong("ShowIconInSystemTray", TRUE);
+}
+
+BOOL CGetSetOptions::SetShowIconInSysTray(BOOL bShow) 
+{
+	return SetProfileLong("ShowIconInSystemTray", bShow);
+}
+
+BOOL CGetSetOptions::SetEnableTransparency(BOOL bCheck)
+{
+	return SetProfileLong("EnableTransparency", bCheck);
+}
+
+BOOL CGetSetOptions::GetEnableTransparency()
+{
+	return GetProfileLong("EnableTransparency", FALSE);
+}
+
+BOOL CGetSetOptions::SetTransparencyPercent(long lPercent)
+{
+#ifdef AFTER_98
+	if(lPercent > OPACITY_MAX)
+		lPercent = OPACITY_MAX;
+	if(lPercent < 0)
+		lPercent = 0;
+
+	return SetProfileLong("TransparencyPercent", lPercent);
+#endif
+	return FALSE;
+}
+
+long CGetSetOptions::GetTransparencyPercent()
+{
+#ifdef AFTER_98
+	long lValue = GetProfileLong("TransparencyPercent", 14);
+
+	if(lValue > OPACITY_MAX) lValue = OPACITY_MAX;
+	if(lValue < 0) lValue = 0;
+
+	return lValue;
+#endif
+	return 0;
+}
+
+BOOL CGetSetOptions::SetLinesPerRow(long lLines)
+{
+	m_nLinesPerRow = lLines;
+	return SetProfileLong("LinesPerRow", lLines);
+}
+
+long CGetSetOptions::GetLinesPerRow()
+{
+	return GetProfileLong("LinesPerRow", 2);
+}
+
+BOOL CGetSetOptions::GetRunOnStartUp()
+{
+	HKEY hkRun;
+
+	LONG nResult = RegOpenKeyEx(HKEY_CURRENT_USER,
+		_T("Software\\Microsoft\\Windows\\CurrentVersion\\Run"),
+		NULL, KEY_READ, &hkRun);
+
+	if(nResult != ERROR_SUCCESS)
+		return FALSE;
+
+	nResult = RegQueryValueEx(hkRun, GetAppName(), NULL, NULL, NULL, NULL);
+	RegCloseKey(hkRun);
+	return nResult == ERROR_SUCCESS;
+}
+
+void CGetSetOptions::SetRunOnStartUp(BOOL bRun)
+{
+	//Can't set auto run when running from U3 device
+	if(m_bU3)
+		return;
+
+	if(bRun == GetRunOnStartUp())
+		return;
+
+	HKEY hkRun;
+	LONG nResult = RegOpenKeyEx(HKEY_CURRENT_USER,
+		_T("Software\\Microsoft\\Windows\\CurrentVersion\\Run"),
+		NULL, KEY_ALL_ACCESS, &hkRun);
+
+	if(nResult != ERROR_SUCCESS)
+		return;
+
+	if(bRun)
+	{
+		CString sExeName = GetExeFileName();
+		::RegSetValueEx(hkRun, GetAppName(), NULL, REG_SZ,
+			(BYTE*)(LPCTSTR)sExeName, sExeName.GetLength()*sizeof(TCHAR));
+	} 
+	else 
+	{
+		::RegDeleteValue(hkRun, GetAppName());
+	}
+
+	::RegCloseKey(hkRun);
+}
+
+CString CGetSetOptions::GetExeFileName()
+{
+	CString sExeName;
+	GetModuleFileName(NULL, sExeName.GetBuffer(_MAX_PATH),_MAX_PATH);
+	sExeName.ReleaseBuffer();
+	return sExeName;
+}
+
+CString CGetSetOptions::GetAppName()
+{
+	return "Ditto";
+}
+
+BOOL CGetSetOptions::SetQuickPastePosition(long lPosition)
+{
+	return SetProfileLong("ShowQuickPastePosition", lPosition);
+}
+
+long CGetSetOptions::GetQuickPastePosition()
+{
+	return GetProfileLong("ShowQuickPastePosition", POS_AT_CURSOR);
+}
+
+BOOL CGetSetOptions::SetQuickPasteSize(CSize size)
+{
+	BOOL bRet = SetProfileLong("QuickPasteCX", size.cx);
+	bRet = SetProfileLong("QuickPasteCY", size.cy);
+
+	return bRet;
+}
+void CGetSetOptions::GetQuickPasteSize(CSize &size)
+{
+	size.cx = GetProfileLong("QuickPasteCX", 300);
+	size.cy = GetProfileLong("QuickPasteCY", 300);
+	if(size.cx <= 0 && size.cy <= 0)
+	{
+		size.cx = 300;
+		size.cy = 300;
+	}
+}
+
+BOOL CGetSetOptions::SetQuickPastePoint(CPoint point)
+{
+	BOOL bRet = SetProfileLong("QuickPasteX", point.x);
+	bRet = SetProfileLong("QuickPasteY", point.y);
+
+	return bRet;
+}
+
+void CGetSetOptions::GetQuickPastePoint(CPoint &point)
+{
+	point.x = GetProfileLong("QuickPasteX", 300);
+	point.y = GetProfileLong("QuickPasteY", 300);
+
+	if(point.x <= 0 && point.y <= 0)
+	{
+		point.x = 300;
+		point.y = 300;
+	}
+}
+
+BOOL CGetSetOptions::SetEditWndSize(CSize size)
+{
+	BOOL bRet = SetProfileLong("EditWndCX", size.cx);
+	bRet = SetProfileLong("EditWndCY", size.cy);
+
+	return bRet;
+}
+
+void CGetSetOptions::GetEditWndSize(CSize &size)
+{
+	size.cx = GetProfileLong("EditWndCX", 600);
+	size.cy = GetProfileLong("EditWndCY", 600);
+	if(size.cx <= 0 && size.cy <= 0)
+	{
+		size.cx = 600;
+		size.cy = 600;
+	}
+}
+
+BOOL CGetSetOptions::SetEditWndPoint(CPoint point)
+{
+	BOOL bRet = SetProfileLong("EditWndX", point.x);
+	bRet = SetProfileLong("EditWndY", point.y);
+
+	return bRet;
+}
+
+void CGetSetOptions::GetEditWndPoint(CPoint &point)
+{
+	point.x = GetProfileLong("EditWndX", 100);
+	point.y = GetProfileLong("EditWndY", 100);
+
+	if(point.x <= 0 && point.y <= 0)
+	{
+		point.x = 100;
+		point.y = 100;
+	}
+}
+
+long CGetSetOptions::GetCopyGap()
+{
+	return GetProfileLong("CopyGap", 150);
+}
+
+void CGetSetOptions::SetCopyGap(long lGap)
+{
+	SetProfileLong("CopyGap", lGap);
+}
+
+BOOL CGetSetOptions::SetDBPathOld(CString csPath)
+{
+	return SetProfileString("DBPath", csPath);
+}
+
+CString CGetSetOptions::GetDBPathOld()
+{
+	return GetProfileString("DBPath", "");
+}
+
+BOOL CGetSetOptions::SetDBPath(CString csPath)
+{
+	return SetProfileString("DBPath3", csPath);
+}
+
+CString CGetSetOptions::GetDBPath()
+{
+	CString csDBPath;
+	if(m_bU3)
+	{
+		csDBPath = GetProfileString("DBPath3", "");
+		if(csDBPath.IsEmpty())
+		{
+			csDBPath = GetDefaultDBName();
+		}
+
+		CPath ExistingPath(csDBPath);
+		csDBPath = CGetSetOptions::GetPath(PATH_DATABASE);
+		csDBPath += ExistingPath.GetName();
+	}
+	else
+	{
+		csDBPath = GetProfileString("DBPath3", "");
+	}
+
+	return csDBPath;
+}
+
+void CGetSetOptions::SetCheckForMaxEntries(BOOL bVal)
+{
+	SetProfileLong("CheckForMaxEntries", bVal);
+}
+
+BOOL CGetSetOptions::GetCheckForMaxEntries()
+{
+	BOOL bDefault = FALSE;
+	if(m_bU3)
+		bDefault = TRUE;
+	if(GetIsPortableDitto())
+		bDefault = TRUE;
+
+	return GetProfileLong("CheckForMaxEntries", bDefault);
+}
+
+void CGetSetOptions::SetCheckForExpiredEntries(BOOL bVal)
+{
+	SetProfileLong("CheckForExpiredEntries", bVal);
+}
+
+BOOL CGetSetOptions::GetCheckForExpiredEntries()
+{
+	return GetProfileLong("CheckForExpiredEntries", FALSE);
+}
+
+void CGetSetOptions::SetMaxEntries(long lVal)
+{
+	SetProfileLong("MaxEntries", lVal);
+}
+
+long CGetSetOptions::GetMaxEntries()
+{
+	long lMax = 500;
+	if(m_bU3)
+		lMax = 75;
+	if(GetIsPortableDitto())
+		lMax = 100;
+	return GetProfileLong("MaxEntries", lMax);
+}
+
+void CGetSetOptions::SetExpiredEntries(long lVal)
+{
+	SetProfileLong("ExpiredEntries", lVal);
+}
+
+long CGetSetOptions::GetExpiredEntries()
+{
+	return GetProfileLong("ExpiredEntries", 5);
+}
+
+void CGetSetOptions::SetTripCopyCount(long lVal)
+{
+	// negative means a relative offset
+	if(lVal < 0)
+		lVal = GetTripCopyCount() - lVal; // add the absolute value
+
+	if(GetTripDate() == 0)
+		SetTripDate(-1);
+
+	SetProfileLong("TripCopies", lVal);
+}
+
+long CGetSetOptions::GetTripCopyCount()
+{
+	return GetProfileLong("TripCopies", 0);
+}
+
+void CGetSetOptions::SetTripPasteCount(long lVal)
+{
+	// negative means a relative offset
+	if(lVal < 0)
+		lVal = GetTripPasteCount() - lVal; // add the absolute value
+
+	if(GetTripDate() == 0)
+		SetTripDate(-1);
+
+	SetProfileLong("TripPastes", lVal);
+}
+
+long CGetSetOptions::GetTripPasteCount()
+{
+	return GetProfileLong("TripPastes", 0);
+}
+
+void CGetSetOptions::SetTripDate(long lDate)
+{
+	if(lDate == -1)
+		lDate = (long)CTime::GetCurrentTime().GetTime();
+
+	SetProfileLong("TripDate", lDate);
+}
+
+long CGetSetOptions::GetTripDate()
+{
+	return GetProfileLong("TripDate", 0);
+}
+
+void CGetSetOptions::SetTotalCopyCount(long lVal)
+{
+	// negative means a relative offset
+	if(lVal < 0)
+		lVal = GetTotalCopyCount() - lVal; // add the absolute value
+
+	if(GetTotalDate() == 0)
+		SetTotalDate(-1);
+
+	SetProfileLong("TotalCopies", lVal);
+}
+
+long CGetSetOptions::GetTotalCopyCount()
+{
+	return GetProfileLong("TotalCopies", 0);
+}
+
+void CGetSetOptions::SetTotalPasteCount(long lVal)
+{
+	// negative means a relative offset
+	if(lVal < 0)
+		lVal = GetTotalPasteCount() - lVal; // add the absolute value
+
+	if(GetTotalDate() == 0)
+		SetTotalDate(-1);
+
+	SetProfileLong("TotalPastes", lVal);
+}
+
+long CGetSetOptions::GetTotalPasteCount()
+{
+	return GetProfileLong("TotalPastes", 0);
+}
+
+void CGetSetOptions::SetTotalDate(long lDate)
+{
+	if(lDate == -1)
+		lDate = (long)CTime::GetCurrentTime().GetTime();
+
+	SetProfileLong("TotalDate", lDate);
+}
+
+long CGetSetOptions::GetTotalDate()
+{
+	return GetProfileLong("TotalDate", 0);
+}
+
+CString	CGetSetOptions::GetUpdateFilePath()			
+{ 
+	return GetProfileString("UpdateFilePath", "");	
+}
+BOOL CGetSetOptions::SetUpdateFilePath(CString cs)	
+{ 
+	return SetProfileString("UpdateFilePath", cs);	
+}
+
+CString	CGetSetOptions::GetUpdateInstallPath()			
+{ 
+	return GetProfileString("UpdateInstallPath", "");	
+}
+BOOL CGetSetOptions::SetUpdateInstallPath(CString cs)	
+{ 
+	return SetProfileString("UpdateInstallPath", cs);	
+}
+
+long CGetSetOptions::GetLastUpdate()			
+{ 
+	return GetProfileLong("LastUpdateDay", 0);		
+}
+long CGetSetOptions::SetLastUpdate(long lValue)	
+{ 
+	return SetProfileLong("LastUpdateDay", lValue);	
+}
+
+BOOL CGetSetOptions::GetCheckForUpdates()				
+{ 
+	return GetProfileLong("CheckForUpdates", TRUE);	
+}
+BOOL CGetSetOptions::SetCheckForUpdates(BOOL bCheck)	
+{ 
+	return SetProfileLong("CheckForUpdates", bCheck);	
+}
+
+void CGetSetOptions::SetUseCtrlNumForFirstTenHotKeys(BOOL bVal)	
+{	
+	SetProfileLong("UseCtrlNumForFirstTenHotKeys", bVal);	
+	m_bUseCtrlNumAccel = bVal;	
+}
+BOOL CGetSetOptions::GetUseCtrlNumForFirstTenHotKeys()			
+{	
+	return GetProfileLong("UseCtrlNumForFirstTenHotKeys", 0); 
+}
+
+void CGetSetOptions::SetAllowDuplicates(BOOL bVal)	
+{	
+	SetProfileLong("AllowDuplicates", bVal); 
+	m_bAllowDuplicates = bVal; 
+}
+BOOL CGetSetOptions::GetAllowDuplicates()			
+{	
+	return GetProfileLong("AllowDuplicates", 0); 
+}
+
+void CGetSetOptions::SetUpdateTimeOnPaste(BOOL bVal)	
+{	
+	SetProfileLong("UpdateTimeOnPaste", bVal); 
+	m_bUpdateTimeOnPaste = bVal; 
+}
+BOOL CGetSetOptions::GetUpdateTimeOnPaste()			
+{	
+	return GetProfileLong("UpdateTimeOnPaste", TRUE); 
+}
+
+void CGetSetOptions::SetSaveMultiPaste(BOOL bVal)	
+{	
+	SetProfileLong("SaveMultiPaste", bVal); 
+	m_bSaveMultiPaste = bVal; 
+}
+BOOL CGetSetOptions::GetSaveMultiPaste()			
+{	
+	return GetProfileLong("SaveMultiPaste", 0); 
+}
+
+void CGetSetOptions::SetShowPersistent(BOOL bVal)	
+{	
+	SetProfileLong("ShowPersistent", bVal); 
+	m_bShowPersistent = bVal; 
+}
+BOOL CGetSetOptions::GetShowPersistent()			
+{	
+	return GetProfileLong("ShowPersistent", 0); 
+}
+
+void CGetSetOptions::SetShowTextForFirstTenHotKeys(BOOL bVal)	
+{	
+	SetProfileLong("ShowTextForFirstTenHotKeys", bVal);			
+}
+BOOL CGetSetOptions::GetShowTextForFirstTenHotKeys()			
+{	
+	return GetProfileLong("ShowTextForFirstTenHotKeys", TRUE);	
+}
+
+void CGetSetOptions::SetMainHWND(long lhWnd)	
+{	
+	SetProfileLong("MainhWnd", lhWnd);		
+}
+BOOL CGetSetOptions::GetMainHWND()				
+{	
+	return GetProfileLong("MainhWnd", 0);	
+}
+
+void CGetSetOptions::SetCaptionPos(long lPos)	
+{	
+	SetProfileLong("CaptionPos", lPos);					
+}
+long CGetSetOptions::GetCaptionPos()			
+{	
+	return GetProfileLong("CaptionPos", CAPTION_RIGHT);	
+}
+
+void CGetSetOptions::SetAutoHide(BOOL bAutoHide)
+{	
+	SetProfileLong("AutoHide", bAutoHide);					
+}
+BOOL CGetSetOptions::GetAutoHide()				
+{	
+	return GetProfileLong("AutoHide", FALSE);				
+}
+
+void CGetSetOptions::SetDescTextSize(long lSize)
+{	
+	SetProfileLong("DescTextSize", lSize); 
+	m_bDescTextSize = lSize; 
+}
+long CGetSetOptions::GetDescTextSize()			
+{	
+	return GetProfileLong("DescTextSize", 500); 
+}
+
+void CGetSetOptions::SetDescShowLeadingWhiteSpace(BOOL bVal)
+{ 
+	SetProfileLong("DescShowLeadingWhiteSpace", bVal); 
+	m_bDescShowLeadingWhiteSpace = bVal; 
+}
+BOOL CGetSetOptions::GetDescShowLeadingWhiteSpace()         
+{ 
+	return GetProfileLong("DescShowLeadingWhiteSpace", FALSE); 
+}
+
+void CGetSetOptions::SetAllwaysShowDescription(long bShow)	
+{	
+	SetProfileLong("AllwaysShowDescription", bShow); 
+	m_bAllwaysShowDescription = bShow; 
+}
+BOOL CGetSetOptions::GetAllwaysShowDescription()			
+{	
+	return GetProfileLong("AllwaysShowDescription", FALSE); 
+}
+
+void CGetSetOptions::SetDoubleClickingOnCaptionDoes(long lOption)	
+{	
+	SetProfileLong("DoubleClickingOnCaptionDoes", lOption); 
+	m_bDoubleClickingOnCaptionDoes = lOption; 
+}
+long CGetSetOptions::GetDoubleClickingOnCaptionDoes()				
+{	
+	return GetProfileLong("DoubleClickingOnCaptionDoes", TOGGLES_ALLWAYS_ON_TOP); 
+}
+
+void CGetSetOptions::SetPrompForNewGroupName(BOOL bOption)	
+{	
+	SetProfileLong("PrompForNewGroupName", bOption); 
+	m_bPrompForNewGroupName = bOption; 
+}
+BOOL CGetSetOptions::GetPrompForNewGroupName()				
+{	
+	return GetProfileLong("PrompForNewGroupName", TRUE); 
+}
+
+void CGetSetOptions::SetSendPasteOnFirstTenHotKeys(BOOL bOption)	
+{	
+	SetProfileLong("SendPasteOnFirstTenHotKeys", bOption); 
+	m_bSendPasteOnFirstTenHotKeys = bOption; 
+}
+BOOL CGetSetOptions::GetSendPasteOnFirstTenHotKeys()				
+{	
+	return GetProfileLong("SendPasteOnFirstTenHotKeys", TRUE); 
+}
+
+void CGetSetOptions::SetSendClients(CSendClients Client, int nPos)
+{
+	CString cs;
+
+	cs.Format(_T("sendclient_ip_%d"), nPos);
+	SetProfileString(cs, Client.csIP);
+
+	cs.Format(_T("sendclient_autosend_%d"), nPos);
+	SetProfileLong(cs, Client.bSendAll);
+
+	cs.Format(_T("sendclient_description_%d"), nPos);
+	SetProfileString(cs, Client.csDescription);
+
+	Client.bShownFirstError = m_SendClients[nPos].bShownFirstError;
+
+	m_SendClients[nPos] = Client;
+}
+
+CSendClients CGetSetOptions::GetSendClients(int nPos)
+{
+	CSendClients Client;
+
+	CString cs;
+
+	cs.Format(_T("sendclient_ip_%d"), nPos);
+	Client.csIP = GetProfileString(cs, "");
+
+	cs.Format(_T("sendclient_autosend_%d"), nPos);
+	Client.bSendAll = GetProfileLong(cs, FALSE);
+
+	cs.Format(_T("sendclient_description_%d"), nPos);
+	Client.csDescription = GetProfileString(cs, "");
+
+	m_SendClients[nPos] = Client;
+
+	return Client;
+}
+
+void CGetSetOptions::GetClientSendCount()
+{
+	m_lAutoSendClientCount = 0;
+	for(int i = 0; i < MAX_SEND_CLIENTS; i++)
+	{
+		if(m_SendClients[i].csIP.GetLength() > 0)
+		{
+			if(m_SendClients[i].bSendAll)
+				m_lAutoSendClientCount++;
+		}
+	}
+}
+
+CString	CGetSetOptions::GetListToPutOnClipboard()			
+{ 
+	CString cs = GetProfileString("ListToPutOnClipboard", "");
+	cs.MakeUpper();
+	return cs;
+}
+BOOL CGetSetOptions::SetListToPutOnClipboard(CString cs)	
+{ 
+	cs.MakeUpper();
+	m_csIPListToPutOnClipboard = cs;
+	return SetProfileString("ListToPutOnClipboard", cs); 
+
+}
+
+void CGetSetOptions::SetLogSendReceiveErrors(BOOL bOption)
+{
+	m_bLogSendReceiveErrors = bOption;
+
+	SetProfileLong("LogSendReceiveErrors", bOption);
+}
+
+BOOL CGetSetOptions::GetLogSendReceiveErrors()
+{
+	return GetProfileLong("LogSendReceiveErrors", FALSE);
+}
+
+BOOL CGetSetOptions::GetHideDittoOnHotKeyIfAlreadyShown()
+{
+	return GetProfileLong("HideDittoOnHotKeyIfAlreadyShown", TRUE);
+}
+
+void CGetSetOptions::SetHideDittoOnHotKeyIfAlreadyShown(BOOL bVal)
+{
+	m_HideDittoOnHotKeyIfAlreadyShown = bVal;
+
+	SetProfileLong("HideDittoOnHotKeyIfAlreadyShown", bVal);
+}
+
+void CGetSetOptions::SetPort(long lPort)
+{
+	m_lPort = lPort;
+	SetProfileLong("SendRecvPort", lPort);
+}
+
+long CGetSetOptions::GetPort()
+{
+	return GetProfileLong("SendRecvPort", 23443);
+}
+
+BOOL CGetSetOptions::GetDisableRecieve()
+{
+	BOOL bDefault = FALSE;
+	if(m_bU3)
+		bDefault = TRUE;
+	if(GetIsPortableDitto())
+		bDefault = TRUE;
+
+	return GetProfileLong("DisableRecieve", bDefault);
+}
+
+void CGetSetOptions::SetDisableRecieve(BOOL bVal)
+{
+	SetProfileLong("DisableRecieve", bVal);
+}
+
+BOOL CGetSetOptions::GetFont(LOGFONT &font)
+{
+	if(m_bFromIni && !m_bInConversion)
+	{
+		GetProfileFont("DisplayFont", font);
+
+		//Return true if there is a font name
+		//other wise load the default font below
+		if(font.lfFaceName[0] != 0)
+		{
+			return TRUE;
+		}
+	}
+	else
+	{
+		DWORD dwLength = 0;
+		#ifdef _UNICODE
+			LPVOID lpVoid = GetProfileData("DisplayFont3", dwLength);
+		#else
+			LPVOID lpVoid = GetProfileData("DisplayFont", dwLength);
+		#endif
+		if(lpVoid)
+		{
+			if(sizeof(font) == dwLength)
+			{
+				memcpy(&font, lpVoid, dwLength);
+				delete[] lpVoid;
+				lpVoid = NULL;
+				return TRUE;
+			}
+			else
+			{
+				ASSERT(!"invalid font struct size");
+			}
+
+			delete[] lpVoid;
+			lpVoid = NULL;
+		}
+	}
+
+	ZeroMemory(&font, sizeof(font));
+	font.lfHeight = -11;
+	font.lfWeight = 400;
+	font.lfCharSet = 1;
+	STRCPY(font.lfFaceName, _T("Arial Unicode MS"));
+	return TRUE;
+}
+
+void CGetSetOptions::SetFont(LOGFONT &font)
+{
+	if(m_bFromIni)
+	{
+		SetProfileFont("DisplayFont", font);
+	}
+	else
+	{
+		#ifdef _UNICODE
+			CString csParam = "DisplayFont3";
+		#else
+			CString csParam = "DisplayFont";
+		#endif
+
+		SetProfileData(csParam, &font, sizeof(LOGFONT));
+	}
+}
+
+void CGetSetOptions::SetDrawThumbnail(long bDraw)
+{
+	SetProfileLong("DrawThumbnail", bDraw); 
+	m_bDrawThumbnail = bDraw;
+}
+
+BOOL CGetSetOptions::GetDrawThumbnail()
+{
+	BOOL bDrawThumbnails = TRUE;
+	if(g_Opt.m_bU3)
+		bDrawThumbnails = FALSE;
+
+	return GetProfileLong("DrawThumbnail", bDrawThumbnails);
+}
+
+void CGetSetOptions::SetExtraNetworkPassword(CString csPassword)
+{
+	SetProfileString("NetworkExtraPassword", csPassword);
+}
+
+CString CGetSetOptions::GetExtraNetworkPassword(bool bFillArray)
+{
+	CString cs = GetProfileString("NetworkExtraPassword", "");
+
+	if(bFillArray)
+	{
+		m_csNetworkPasswordArray.RemoveAll();
+
+		TCHAR seps[]   = _T(",");
+		TCHAR *token;
+
+		TCHAR *pString = cs.GetBuffer(cs.GetLength());
+
+		/* Establish string and get the first token: */
+		token = STRTOK(pString, seps);
+		while(token != NULL)
+		{
+			CString cs(token);
+			cs.TrimLeft();
+			cs.TrimRight();
+
+			m_csNetworkPasswordArray.Add(cs);
+
+			// Get next token
+			token = STRTOK(NULL, seps);
+		}
+
+		cs.ReleaseBuffer();
+	}
+
+	return cs;
+}
+
+void CGetSetOptions::SetNetworkPassword(CString csPassword)
+{
+	CTextConvert Con;
+	Con.ConvertToUTF8(csPassword, m_csPassword);
+
+	SetProfileString("NetworkStringPassword", csPassword);
+}
+
+CStringA CGetSetOptions::GetNetworkPassword()
+{
+	CString cs = GetProfileString("NetworkStringPassword", "LetMeIn");
+
+	CTextConvert Con;
+	CStringA csReturn;
+	Con.ConvertToUTF8(cs, csReturn);
+
+	return csReturn;
+}
+
+void CGetSetOptions::SetDrawRTF(long bDraw)
+{
+//this only works under 32 bit build
+#ifdef _M_IX86
+	SetProfileLong("DrawRTF", bDraw); 
+	m_bDrawRTF = bDraw;
+#endif
+}
+
+BOOL CGetSetOptions::GetDrawRTF()
+{
+//this only works under 32 bit build
+#ifdef _M_IX86
+	return GetProfileLong("DrawRTF", FALSE);
+#endif
+	return FALSE;
+}
+
+void CGetSetOptions::SetMultiPasteReverse(BOOL bVal)
+{
+	SetProfileLong("MultiPasteReverse", bVal); 
+	m_bMultiPasteReverse = bVal;
+}
+
+BOOL CGetSetOptions::GetMultiPasteReverse()
+{
+	return GetProfileLong("MultiPasteReverse", TRUE); 
+}
+
+void CGetSetOptions::SetPlaySoundOnCopy(CString cs)
+{
+	m_csPlaySoundOnCopy = cs;
+
+	SetProfileString("PlaySoundOnCopy", cs);
+}
+
+CString CGetSetOptions::GetPlaySoundOnCopy()
+{
+	return GetProfileString("PlaySoundOnCopy", "");
+}
+
+void CGetSetOptions::SetSendPasteAfterSelection(BOOL bVal)
+{
+	m_bSendPasteMessageAfterSelection = bVal;
+
+	SetProfileLong("SendPasteMessageAfterSelection", bVal);
+}
+
+BOOL CGetSetOptions::GetSendPasteAfterSelection()
+{
+	return GetProfileLong("SendPasteMessageAfterSelection", TRUE);
+}
+
+void CGetSetOptions::SetFindAsYouType(BOOL bVal)
+{
+	m_bFindAsYouType = bVal;
+	SetProfileLong("FindAsYouType", bVal);
+}
+
+BOOL CGetSetOptions::GetFindAsYouType()
+{
+	return GetProfileLong("FindAsYouType", TRUE);
+}
+
+void CGetSetOptions::SetEnsureEntireWindowCanBeSeen(BOOL bVal)
+{
+	m_bEnsureEntireWindowCanBeSeen = bVal;
+	SetProfileLong("EnsureEntireWindowCanBeSeen", bVal);
+}
+
+BOOL CGetSetOptions::GetEnsureEntireWindowCanBeSeen()
+{
+	return GetProfileLong("EnsureEntireWindowCanBeSeen", TRUE);
+}
+
+void CGetSetOptions::SetShowAllClipsInMainList(BOOL bVal)
+{
+	m_bShowAllClipsInMainList = bVal;
+	SetProfileLong("ShowAllClipsInMainList", bVal);
+}
+
+BOOL CGetSetOptions::GetShowAllClipsInMainList()
+{
+	return GetProfileLong("ShowAllClipsInMainList", TRUE);
+}
+
+long CGetSetOptions::GetMaxClipSizeInBytes()
+{
+	return GetProfileLong("MaxClipSizeInBytes", 0);
+}
+
+void CGetSetOptions::SetMaxClipSizeInBytes(long lSize)
+{
+	m_lMaxClipSizeInBytes = lSize;
+	SetProfileLong("MaxClipSizeInBytes", lSize);
+}
+
+CString CGetSetOptions::GetLanguageFile()
+{
+	return GetProfileString("LanguageFile", "");
+}
+
+void CGetSetOptions::SetLanguageFile(CString csLanguage)
+{
+	SetProfileString("LanguageFile", csLanguage);
+}
+
+ULONG CGetSetOptions::GetSaveClipDelay()
+{
+	return (ULONG)GetProfileLong("SaveClipDelay", 500);
+}
+
+void CGetSetOptions::SetSaveClipDelay(DWORD dwDelay)
+{
+	m_dwSaveClipDelay = dwDelay;
+	SetProfileLong("SaveClipDelay", dwDelay);
+}
+
+long CGetSetOptions::GetProcessDrawClipboardDelay()
+{
+	return GetProfileLong("ProcessDrawClipboardDelay", 100);
+}
+
+void CGetSetOptions::SetProcessDrawClipboardDelay(long lDelay)
+{
+	m_lProcessDrawClipboardDelay = lDelay;
+	SetProfileLong("ProcessDrawClipboardDelay", lDelay);
+}
+
+BOOL CGetSetOptions::GetEnableDebugLogging()
+{
+	return GetProfileLong("EnableDebugLogging", FALSE);
+}
+
+void CGetSetOptions::SetEnableDebugLogging(BOOL bEnable)
+{
+	m_bEnableDebugLogging = bEnable;
+	SetProfileLong("EnableDebugLogging", bEnable);
+}
+
+BOOL CGetSetOptions::GetEnsureConnectToClipboard()
+{
+	return GetProfileLong("EnsureConnected", TRUE);
+}
+
+void CGetSetOptions::SetEnsureConnectToClipboard(BOOL bSet)
+{
+	m_bEnsureConnectToClipboard = bSet;
+	SetProfileLong("EnsureConnected", bSet);
+}
+
+BOOL CGetSetOptions::GetPromptWhenDeletingClips()
+{
+	return GetProfileLong("PromptWhenDeletingClips", TRUE);
+}
+
+void CGetSetOptions::SetPromptWhenDeletingClips(BOOL bSet)
+{
+	SetProfileLong("PromptWhenDeletingClips", bSet);
+}
+
+CString CGetSetOptions::GetLastImportDir()
+{
+	return GetProfileString("LastImportDir", "");
+}
+
+void CGetSetOptions::SetLastImportDir(CString csDir)
+{
+	SetProfileString("LastImportDir", csDir);
+}
+
+CString CGetSetOptions::GetLastExportDir()
+{
+	return GetProfileString("LastExportDir", "");
+}
+
+void CGetSetOptions::SetLastExportDir(CString csDir)
+{
+	SetProfileString("LastExportDir", csDir);
+}
+
+BOOL CGetSetOptions::GetUpdateDescWhenSavingClip()
+{
+	return GetProfileLong("UpdateDescWhenSaving", TRUE);
+}
+
+void CGetSetOptions::SetUpdateDescWhenSavingClip(BOOL bSet)
+{
+	SetProfileLong("UpdateDescWhenSaving", bSet);
+}
+
+CString CGetSetOptions::GetPath(long lPathID)
+{
+	CString csDir = CGetSetOptions::GetExeFileName();
+	csDir = GetFilePath(csDir);
+	FIX_CSTRING_PATH(csDir);
+
+	//U3_APP_DATA_PATH    -	<U3_DEVICE_PATH>\System\Apps\{app_unique_id}\Data
+	//U3_HOST_EXEC_PATH	  - %APPDATA%\U3\{device_serial_number}\{app_unique_id}\Exec
+	//U3_DEVICE_EXEC_PATH -	<U3_DEVICE_PATH>\System\Apps\{app_unique_id}\Exec
+
+	switch(lPathID)
+	{
+	case PATH_HELP:
+		if(m_bU3)
+		{
+			csDir = GETENV(_T("U3_DEVICE_EXEC_PATH"));
+			FIX_CSTRING_PATH(csDir);
+		}
+
+		csDir += "Help\\";
+		break;
+	
+	case PATH_LANGUAGE:
+		if(m_bU3)
+		{
+			csDir = GETENV(_T("U3_DEVICE_EXEC_PATH"));
+			FIX_CSTRING_PATH(csDir);
+		}
+
+		csDir += "language\\";
+
+		break;
+
+	case PATH_THEMES:
+
+		if(m_bU3)
+		{
+			csDir = GETENV(_T("U3_DEVICE_EXEC_PATH"));
+			FIX_CSTRING_PATH(csDir);
+		}
+
+		csDir += "Themes\\";
+
+		break;
+
+	case PATH_REMOTE_FILES:
+		if(m_bU3)
+		{
+			csDir = GETENV(_T("U3_HOST_EXEC_PATH"));
+			FIX_CSTRING_PATH(csDir);
+		}
+		else if(CGetSetOptions::GetIsPortableDitto() == false)
+		{
+			csDir = GetAppDataPath();
+		}
+
+		csDir += "ReceivedFiles\\";
+		break;
+
+	case PATH_LOG_FILE:
+		if(m_bU3)
+		{
+			csDir = GETENV(_T("U3_HOST_EXEC_PATH"));
+			FIX_CSTRING_PATH(csDir);
+		}
+		else if(CGetSetOptions::GetIsPortableDitto() == false)
+		{
+			csDir = GetAppDataPath();
+		}
+
+		break;
+
+	case PATH_UPDATE_FILE:
+		//same path as the executable
+		break;
+
+	case PATH_DATABASE:
+		if(m_bU3)
+		{
+			csDir = GETENV(_T("U3_APP_DATA_PATH"));
+			FIX_CSTRING_PATH(csDir);
+		}
+		break;
+
+
+	case PATH_INI:
+		if(m_bU3)
+		{
+			csDir = GETENV(_T("U3_APP_DATA_PATH"));
+			FIX_CSTRING_PATH(csDir);
+		}
+		break;
+
+	case PATH_U3_HWND_INI:
+		if(m_bU3)
+		{
+			csDir = GETENV(_T("U3_HOST_EXEC_PATH"));
+			FIX_CSTRING_PATH(csDir);
+		}
+		break;
+
+	case PATH_ADDINS:
+		if(m_bU3)
+		{
+			csDir = GETENV(_T("U3_DEVICE_EXEC_PATH"));
+			FIX_CSTRING_PATH(csDir);
+		}
+
+		csDir += "Addins\\";
+		
+		break;
+	}
+
+	CreateDirectory(csDir, NULL);
+
+	return csDir;
+}
+
+void CGetSetOptions::WriteU3Hwnd(HWND hWnd)
+{
+	CString csIniFile = GetPath(PATH_U3_HWND_INI);
+	csIniFile += _T("DittohWnd.ini");
+	WritePrivateProfileInt(_T("Ditto"), _T("MainhWnd"), (int)hWnd, csIniFile);
+}
+
+long CGetSetOptions::GetDittoRestoreClipboardDelay()
+{
+	return GetProfileLong("RestoreClipboardDelay", 750);
+
+}
+void CGetSetOptions::SetDittoRestoreClipboardDelay(long lDelay)
+{
+	SetProfileLong("RestoreClipboardDelay", lDelay);
+}
+
+void CGetSetOptions::GetCopyBufferItem(int nPos, CCopyBufferItem &Item)
+{
+	Item.m_lCopyHotKey = GetProfileLong(StrF(_T("CopyBufferCopyHotKey_%d"), nPos), 0);
+	Item.m_lPasteHotKey = GetProfileLong(StrF(_T("CopyBufferPasteHotKey_%d"), nPos), 0);
+	Item.m_lCutHotKey = GetProfileLong(StrF(_T("CopyBufferCutHotKey_%d"), nPos), 0);
+	Item.m_bPlaySoundOnCopy = GetProfileLong(StrF(_T("CopyBufferPlaySound_%d"), nPos), 0);
+}
+
+void CGetSetOptions::SetCopyBufferItem(int nPos, CCopyBufferItem &Item)
+{
+	SetProfileLong(StrF(_T("CopyBufferCopyHotKey_%d"), nPos), Item.m_lCopyHotKey);
+	SetProfileLong(StrF(_T("CopyBufferPasteHotKey_%d"), nPos), Item.m_lPasteHotKey);
+	SetProfileLong(StrF(_T("CopyBufferCutHotKey_%d"), nPos), Item.m_lCutHotKey);
+	SetProfileLong(StrF(_T("CopyBufferPlaySound_%d"), nPos), Item.m_bPlaySoundOnCopy);
+}
+
+CString CGetSetOptions::GetMultiPasteSeparator(bool bConvertToLineFeeds)
+{
+	CString csSep = GetProfileString(_T("MultiPasteSeparator"), _T("[LF]"));
+	if(bConvertToLineFeeds)
+	{
+		CString csLineFeed(_T("\r\n"));
+		csSep.Replace(_T("[LF]"), csLineFeed);
+		csSep.Replace(_T("[lf]"), csLineFeed);
+	}
+
+	return csSep;
+}
+
+void CGetSetOptions::SetMultiPasteSeparator(CString csSep)
+{
+	SetProfileString(_T("MultiPasteSeparator"), csSep);
+}
+
+BOOL CGetSetOptions::GetSetCurrentDirectory()
+{
+	if(m_portable)
+	{
+		CString csExePath = GetFilePath(GetExeFileName());
+		FIX_CSTRING_PATH(csExePath);
+		::SetCurrentDirectory(csExePath);
+	}
+
+	return m_portable == true;
+}
+
+bool CGetSetOptions::GetIsPortableDitto()
+{
+	return m_portable;
+}
+
+CString CGetSetOptions::GetPasteString(CString csAppName)
+{
+	CString csString = GetProfileString(csAppName, _T(""), _T("PasteStrings"));
+	if(csString.IsEmpty())
+		return GetDefaultPasteString();
+
+	return csString;
+}
+
+CString CGetSetOptions::GetDefaultPasteString()
+{
+	return GetProfileString(_T("DefaultPasteString"), _T("^v"));
+}
+
+CString CGetSetOptions::GetCopyString(CString csAppName)
+{
+	CString csString = GetProfileString(csAppName, _T(""), _T("CopyStrings"));
+	if(csString.IsEmpty())
+		return GetDefaultCopyString();
+
+	return csString;
+}
+
+CString CGetSetOptions::GetDefaultCopyString()
+{
+	return GetProfileString(_T("DefaultCopyString"), _T("^c"));
+}
+
+CString CGetSetOptions::GetCutString(CString csAppName)
+{
+	CString csString = GetProfileString(csAppName, _T(""), _T("CutStrings"));
+	if(csString.IsEmpty())
+		return GetDefaultCutString();
+
+	return csString;
+}
+
+CString CGetSetOptions::GetDefaultCutString()
+{
+	return GetProfileString(_T("DefaultCutString"), _T("^x"));
+}
+
+BOOL CGetSetOptions::GetEditWordWrap()
+{
+	return GetProfileLong(_T("EditWordWrap"), TRUE);
+}
+
+void CGetSetOptions::SetEditWordWrap(BOOL bSet)
+{
+	SetProfileLong(_T("EditWordWrap"), bSet);
+}
+
+bool CGetSetOptions::GetAllowFriends()
+{
+	return (GetProfileLong("AllowFriends", TRUE) == TRUE);
+}
+
+long CGetSetOptions::GetAutoMaxDelay()
+{
+	return GetProfileLong(_T("AutoMaxDelaySeconds"), 2);
+}
+
+void CGetSetOptions::SetAutoMaxDelay(long lDelay)
+{
+	SetProfileLong(_T("AutoMaxDelaySeconds"), lDelay);
+}
+
+void CGetSetOptions::SetTheme(CString csTheme)
+{
+	SetProfileString(_T("Theme"), csTheme);
+}
+
+CString CGetSetOptions::GetTheme()
+{
+	return GetProfileString(_T("Theme"), "");
+}
+
+long CGetSetOptions::GetKeyStateWaitTimerCount()
+{
+	return GetProfileLong(_T("KeyStateWaitTimerCount"), 20);
+}
+
+long CGetSetOptions::GetKeyStatePasteDelay()
+{
+	return GetProfileLong(_T("KeyStatePasteDelay"), 200);
+}
+
+DWORD CGetSetOptions::GetDittoHotKey()
+{
+	return (DWORD)GetProfileLong(_T("DittoHotKey"), 704);
+}
+
+DWORD CGetSetOptions::SendKeysDelay()
+{
+	return (DWORD)GetProfileLong(_T("SendKeysDelay"), 50);
+}
+
+DWORD CGetSetOptions::WaitForActiveWndTimeout()
+{
+	return (DWORD)GetProfileLong(_T("WaitForActiveWndTimeout"), 100);
+}
+
+DWORD CGetSetOptions::FocusChangedDelay()
+{
+	return (DWORD)GetProfileLong(_T("FocusChangedDelay"), 100);
+}
+
+DWORD CGetSetOptions::FocusWndTimerTimeout()
+{
+	return (DWORD)GetProfileLong(_T("FocusWndTimerTimeout"), 2000);
+}
+
+BOOL CGetSetOptions::GetConnectedToClipboard()
+{
+	return GetProfileLong("ConnectedToClipboard", TRUE);
+}
+
+void CGetSetOptions::SetConnectedToClipboard(BOOL val)
+{
+	SetProfileLong("ConnectedToClipboard", val);
+}
+
+DWORD CGetSetOptions::GetTextOnlyRestoreDelay()
+{
+	return (DWORD)GetProfileLong(_T("TextOnlyRestoreDelay"), 2000);
+}
+
+DWORD CGetSetOptions::GetTextOnlyPasteDelay()
+{
+	return (DWORD)GetProfileLong(_T("TextOnlyPasteDelay"), 500);
+}
+
+BOOL CGetSetOptions::GetSetFocusToApp(CString csAppName)
+{
+	CString focusCheck;
+	focusCheck = "SetFocus_";
+	focusCheck += csAppName;
+	return GetProfileLong(focusCheck, FALSE);
+}
+
+DWORD CGetSetOptions::SelectedIndex()
+{
+	return (DWORD)GetProfileLong(_T("SelectedIndex"), 0);
+}
+
+void CGetSetOptions::SetCopyAppInclude(CString csAppName)
+{
+	SetProfileString(_T("CopyAppInclude"), csAppName);
+}
+
+CString CGetSetOptions::GetCopyAppInclude()
+{
+	CString includeApp = GetProfileString(_T("CopyAppInclude"), "*");
+	if(includeApp == "")
+	{
+		includeApp = "*";
+	}
+
+	return includeApp;
+}
+
+void CGetSetOptions::SetCopyAppExclude(CString csAppName)
+{
+	SetProfileString(_T("CopyAppExclude"), csAppName);
+}
+
+CString CGetSetOptions::GetCopyAppExclude()
+{
+	return GetProfileString(_T("CopyAppExclude"), "");
+}
+
+CString CGetSetOptions::GetCopyAppSeparator()
+{
+	return GetProfileString(_T("CopyAppSeparator"), ";");
+}
+
+DWORD CGetSetOptions::GetNoFormatsRetryDelay()
+{
+	return GetProfileLong(_T("NoFormatsRetryDelay"), 200);
+}
+
+DWORD CGetSetOptions::GetMainDeletesDeleteCount()
+{  
+	return GetProfileLong(_T("MainDeletesDeleteCount"), 100);
+}
+
+DWORD CGetSetOptions::GetIdleSecondsBeforeDelete()
+{  
+	return GetProfileLong(_T("IdleSecondsBeforeDelete"), 60*10);
+}
+
+DWORD CGetSetOptions::GetDbTimeout()
+{  
+	return GetProfileLong(_T("DbTimeout"), 5000);
+}
+
+DWORD CGetSetOptions::GetFunnyTickCountAdjustment()
+{  
+	return GetProfileLong(_T("FunnyTickCountAdjustment"), 300001);
+}
+
+DWORD CGetSetOptions::GetMinIdleTimeBeforeTrackFocus()
+{
+	return GetProfileLong(_T("MinIdleTimeBeforeTrackFocus"), 100);
+}
+
+DWORD CGetSetOptions::GetTimeBeforeExpandWindow()
+{
+	return GetProfileLong(_T("TimeBeforeExpandWindow"), 250);
+}
+
+DWORD CGetSetOptions::GetUseGuiThreadInfoForFocus()
+{
+	return GetProfileLong(_T("UseGuiThreadInfoForFocus"), 1);
+}
+
+void CGetSetOptions::SetSearchDescription(BOOL val)
+{
+	SetProfileLong(_T("SearchDescription"), val);
+}
+
+BOOL CGetSetOptions::GetSearchDescription()
+{
+	return GetProfileLong(_T("SearchDescription"), 1);
+}
+
+void CGetSetOptions::SetSearchFullText(BOOL val)
+{
+	SetProfileLong(_T("SearchFullText"), val);
+}
+
+BOOL CGetSetOptions::GetSearchFullText()
+{
+	return GetProfileLong(_T("SearchFullText"), 0);
+}
+
+void CGetSetOptions::SetSearchQuickPaste(BOOL val)
+{
+	SetProfileLong(_T("SearchQuickPaste"), val);
+}
+
+BOOL CGetSetOptions::GetSearchQuickPaste()
+{
+	return GetProfileLong(_T("SearchQuickPaste"), 0);
+}
+
+void CGetSetOptions::SetSimpleTextSearch(BOOL val)
+{
+	SetProfileLong(_T("SimpleTextSearch"), val);
+}
+
+BOOL CGetSetOptions::GetSimpleTextSearch()
+{
+	return GetProfileLong(_T("SimpleTextSearch"), 0);
+}
+
+void CGetSetOptions::SetMoveClipsOnGlobal10(BOOL val)
+{
+	SetProfileLong(_T("MoveClipsOnGlobal10"), val);
+}
+BOOL CGetSetOptions::GetMoveClipsOnGlobal10()
+{
+	return GetProfileLong(_T("MoveClipsOnGlobal10"), 0);
+}
+
+void CGetSetOptions::SetShowScrollBar(BOOL val)
+{
+	m_showScrollBar = val;
+	SetProfileLong(_T("ShowScrollBar"), val);
+}
+
+BOOL CGetSetOptions::GetShowScrollBar()
+{
+	return GetProfileLong(_T("ShowScrollBar"), 0);
 }

+ 440 - 435
Options.h

@@ -1,437 +1,442 @@
-#pragma once
-
-#include "Theme.h"
-
-#define MAX_SEND_CLIENTS	15
-class CSendClients
-{
-public:
-	CSendClients()
-	{
-		bSendAll = FALSE;
-		bShownFirstError = FALSE;
-	}
-	BOOL bSendAll;
-	CString csIP;
-	CString csDescription;
-	BOOL bShownFirstError;
-};
-
-#define MAX_COPY_BUFFER	3
-class CCopyBufferItem
-{
-public:
-	CCopyBufferItem()
-	{
-		m_lCopyHotKey = -1;
-		m_lPasteHotKey = -1;
-		m_lCutHotKey = -1;
-		m_bPlaySoundOnCopy = FALSE;
-	}
-	long m_lCopyHotKey;
-	long m_lPasteHotKey;
-	long m_lCutHotKey;
-	BOOL m_bPlaySoundOnCopy;
-};
-
-#define REG_PATH					"Software\\Ditto"
-
-#define POS_AT_CARET	1
-#define POS_AT_CURSOR	2
-#define POS_AT_PREVIOUS	3
-
-#define CAPTION_RIGHT	1
-#define CAPTION_BOTTOM	2
-#define CAPTION_LEFT	3
-#define CAPTION_TOP		4
-
-#define TOGGLES_ALLWAYS_ON_TOP				1
-#define TOGGLES_ALLWAYS_SHOW_DESCRIPTION	2
-#define	ROLLES_UP_WINDOW					3
-
-#define PATH_HELP			0
-#define PATH_REMOTE_FILES	1
-#define PATH_LOG_FILE		2
-#define PATH_LANGUAGE		3
-#define PATH_UPDATE_FILE	4
-#define PATH_DATABASE		5
-#define PATH_INI			6
-#define PATH_U3_HWND_INI	7
-#define PATH_THEMES			8
-#define PATH_ADDINS			9
-
-class CGetSetOptions
-{
-public:
-	CGetSetOptions();
-	virtual ~CGetSetOptions();
-
-	static bool m_bFromIni;
-	static CString m_csIniFileName;
-	static bool m_bInConversion;
-	static bool m_bU3;
-	static CTheme m_Theme;
-	static bool m_portable;
-
-	static void LoadSettings();
-	static CString GetIniFileName(bool bLocalIniFile);
-	static void ConverSettingsToIni();
-	static CString GetAppDataPath();
-
-	static CString GetExeFileName();
-	static CString GetAppName();
-
-	static BOOL GetShowIconInSysTray();
-	static BOOL SetShowIconInSysTray(BOOL bShow);
-
-	static BOOL GetRunOnStartUp();
-	static void SetRunOnStartUp(BOOL bRun);
-
-	static BOOL SetProfileFont(CString csSection, LOGFONT &font);
-	static BOOL GetProfileFont(CString csSection, LOGFONT &font);
-
-	static BOOL SetProfileLong(CString csName, long lValue);
-	static long GetProfileLong(CString csName, long lDefaultValue = -1, CString csNewPath = _T(""));
-
-	static CString GetProfileString(CString csName, CString csDefault, CString csNewPath = _T(""));
-	static BOOL	SetProfileString(CString csName, CString csValue);
-
-	static LPVOID GetProfileData(CString csName, DWORD &dwLength);
-	static BOOL	SetProfileData(CString csName, LPVOID lpData, DWORD dwLength);
-
-	static BOOL SetQuickPasteSize(CSize size);
-	static void GetQuickPasteSize(CSize &size);
-
-	static BOOL SetQuickPastePoint(CPoint point);
-	static void GetQuickPastePoint(CPoint &point);
-
-	static BOOL SetEditWndSize(CSize size);
-	static void GetEditWndSize(CSize &size);
-
-	static BOOL SetEditWndPoint(CPoint point);
-	static void GetEditWndPoint(CPoint &point);
-
-	static BOOL SetEnableTransparency(BOOL bCheck);
-	static BOOL GetEnableTransparency();
-
-	static BOOL SetTransparencyPercent(long lPercent);
-	static long GetTransparencyPercent();
-
-	static long m_nLinesPerRow;
-	static BOOL SetLinesPerRow(long lLines);
-	static long GetLinesPerRow();
-
-	static BOOL SetQuickPastePosition(long lPosition);
-	static long GetQuickPastePosition();
-
-	static long GetCopyGap();
-	static void SetCopyGap(long lGap);
-
-	static BOOL SetDBPath(CString csPath);
-	static CString GetDBPath();
-
-	static BOOL SetDBPathOld(CString csPath);
-	static CString GetDBPathOld();
-
-	static void SetCheckForMaxEntries(BOOL bVal);
-	static BOOL GetCheckForMaxEntries();
-
-	static void SetCheckForExpiredEntries(BOOL bVal);
-	static BOOL GetCheckForExpiredEntries();
-
-	static void SetMaxEntries(long lVal);
-	static long GetMaxEntries();
-
-	static void SetExpiredEntries(long lVal);
-	static long GetExpiredEntries();
-
-	static void SetTripCopyCount(long lVal);
-	static long GetTripCopyCount();
-
-	static void SetTripPasteCount(long lVal);
-	static long GetTripPasteCount();
-
-	static void SetTripDate(long lDate);
-	static long GetTripDate();
-
-	static void SetTotalCopyCount(long lVal);
-	static long GetTotalCopyCount();
-
-	static void SetTotalPasteCount(long lVal);
-	static long GetTotalPasteCount();
-
-	static void SetTotalDate(long lDate);
-	static long GetTotalDate();
-
-	static CString	GetUpdateFilePath();
-	static BOOL		SetUpdateFilePath(CString cs);
-
-	static CString	GetUpdateInstallPath();
-	static BOOL		SetUpdateInstallPath(CString cs);
-
-	static long		GetLastUpdate();
-	static long		SetLastUpdate(long lValue);
-
-	static BOOL		GetCheckForUpdates();
-	static BOOL		SetCheckForUpdates(BOOL bCheck);
-
-	static BOOL		m_bUseCtrlNumAccel;
-	static void		SetUseCtrlNumForFirstTenHotKeys(BOOL bVal);
-	static BOOL		GetUseCtrlNumForFirstTenHotKeys();
-
-	static BOOL		m_bAllowDuplicates;
-	static void		SetAllowDuplicates(BOOL bVal);
-	static BOOL		GetAllowDuplicates();
-
-	static BOOL		m_bUpdateTimeOnPaste;
-	static void		SetUpdateTimeOnPaste(BOOL bVal);
-	static BOOL		GetUpdateTimeOnPaste();
-
-	static BOOL		m_bSaveMultiPaste;
-	static void		SetSaveMultiPaste(BOOL bVal);
-	static BOOL		GetSaveMultiPaste();
-
-	static BOOL		m_bShowPersistent;
-	static void		SetShowPersistent(BOOL bVal);
-	static BOOL		GetShowPersistent();
-
-	static void		SetShowTextForFirstTenHotKeys(BOOL bVal);
-	static BOOL		GetShowTextForFirstTenHotKeys();
-
-	static void		SetMainHWND(long lhWnd);
-	static BOOL		GetMainHWND();
-
-	static void		SetCaptionPos(long lPos);
-	static long		GetCaptionPos();
-
-	static void		SetAutoHide(BOOL bAutoHide);
-	static BOOL		GetAutoHide();
-
-	static long		m_bDescTextSize;
-	static void		SetDescTextSize(long lSize);
-	static long		GetDescTextSize();
-
-	static BOOL		m_bDescShowLeadingWhiteSpace;
-	static void		SetDescShowLeadingWhiteSpace(BOOL bVal);
-	static BOOL		GetDescShowLeadingWhiteSpace();
-
-	static BOOL		m_bAllwaysShowDescription;
-	static void		SetAllwaysShowDescription(long bShow);
-	static BOOL		GetAllwaysShowDescription();
-
-	static long		m_bDoubleClickingOnCaptionDoes;
-	static void		SetDoubleClickingOnCaptionDoes(long lOption);
-	static long		GetDoubleClickingOnCaptionDoes();
-
-	static BOOL		m_bPrompForNewGroupName;
-	static void		SetPrompForNewGroupName(BOOL bOption);
-	static BOOL		GetPrompForNewGroupName();
-
-	static BOOL		m_bSendPasteOnFirstTenHotKeys;
-	static void		SetSendPasteOnFirstTenHotKeys(BOOL bOption);
-	static BOOL		GetSendPasteOnFirstTenHotKeys();
-
-	static CSendClients m_SendClients[MAX_SEND_CLIENTS];
-	static long		m_lAutoSendClientCount;
-	static void		GetClientSendCount();
-	static void		SetSendClients(CSendClients Client, int nPos);
-	static CSendClients		GetSendClients(int nPos);
-
-	static CString m_csIPListToPutOnClipboard;
-	static CString	GetListToPutOnClipboard();
-	static BOOL		SetListToPutOnClipboard(CString cs);
-
-	static BOOL		m_bLogSendReceiveErrors;
-	static void		SetLogSendReceiveErrors(BOOL bOption);
-	static BOOL		GetLogSendReceiveErrors();
-
-	static BOOL		m_HideDittoOnHotKeyIfAlreadyShown;
-	static BOOL		GetHideDittoOnHotKeyIfAlreadyShown();
-	static void		SetHideDittoOnHotKeyIfAlreadyShown(BOOL bVal);
-
-	static long		m_lPort;
-	static void		SetPort(long lPort);
-	static long		GetPort();
-
-	static BOOL		GetDisableRecieve();
-	static void		SetDisableRecieve(BOOL bVal);
-
-	static BOOL		GetFont(LOGFONT &font);
-	static void		SetFont(LOGFONT &font);
-
-	static BOOL		m_bDrawThumbnail;
-	static void		SetDrawThumbnail(long bDraw);
-	static BOOL		GetDrawThumbnail();
-
-	static CStringA	m_csPassword;
-	static void		SetNetworkPassword(CString csPassword);
-	static CStringA	GetNetworkPassword();
-
-	static BOOL		m_bDrawRTF;
-	static void		SetDrawRTF(long bDraw);
-	static BOOL		GetDrawRTF();
-
-	static BOOL		m_bMultiPasteReverse;
-	static void		SetMultiPasteReverse(BOOL bVal);
-	static BOOL		GetMultiPasteReverse();
-
-	static CString	m_csPlaySoundOnCopy;
-	static void		SetPlaySoundOnCopy(CString cs);
-	static CString	GetPlaySoundOnCopy();
-
-	static BOOL		m_bSendPasteMessageAfterSelection;
-	static void		SetSendPasteAfterSelection(BOOL bVal);
-	static BOOL		GetSendPasteAfterSelection();
-
-	static BOOL		m_bFindAsYouType;
-	static void		SetFindAsYouType(BOOL bVal);
-	static BOOL		GetFindAsYouType();
-
-	static BOOL		m_bEnsureEntireWindowCanBeSeen;
-	static void		SetEnsureEntireWindowCanBeSeen(BOOL bVal);
-	static BOOL		GetEnsureEntireWindowCanBeSeen();
-
-	static BOOL		m_bShowAllClipsInMainList;
-	static void		SetShowAllClipsInMainList(BOOL bVal);
-	static BOOL		GetShowAllClipsInMainList();
-
-	static void		SetExtraNetworkPassword(CString csPassword);
-	static CString	GetExtraNetworkPassword(bool bFillArray);
-
-	static long		m_lMaxClipSizeInBytes;
-	static long		GetMaxClipSizeInBytes();
-	static void		SetMaxClipSizeInBytes(long lSize);
-
-	static CString	GetLanguageFile();
-	static void		SetLanguageFile(CString csLanguage);
-
-	static DWORD	m_dwSaveClipDelay;
-	static ULONG	GetSaveClipDelay();
-	static void		SetSaveClipDelay(DWORD dwDelay);
-
-	static long		m_lProcessDrawClipboardDelay;
-	static long		GetProcessDrawClipboardDelay();
-	static void		SetProcessDrawClipboardDelay(long lDelay);
-
-	static BOOL		m_bEnableDebugLogging;
-	static BOOL		GetEnableDebugLogging();
-	static void		SetEnableDebugLogging(BOOL bEnable);
-
-	static BOOL		m_bEnsureConnectToClipboard;
-	static BOOL		GetEnsureConnectToClipboard();
-	static void		SetEnsureConnectToClipboard(BOOL bSet);
-
-	static BOOL		GetPromptWhenDeletingClips();
-	static void		SetPromptWhenDeletingClips(BOOL bSet);
-
-	static CString	GetLastImportDir();
-	static void		SetLastImportDir(CString csDir);
-
-	static CString	GetLastExportDir();
-	static void		SetLastExportDir(CString csDir);
-
-	static BOOL		GetUpdateDescWhenSavingClip();
-	static void		SetUpdateDescWhenSavingClip(BOOL bSet);
-
-	static bool		m_bOutputDebugString;
-
-	static CStringArray m_csNetworkPasswordArray;
-
-	static CString  GetPath(long lPathID);
-
-	static void		WriteU3Hwnd(HWND hWnd);
-	static __int64	nLastDbWriteTime;
-
-	static long		GetDittoRestoreClipboardDelay();
-	static void		SetDittoRestoreClipboardDelay(long lDelay);
-
-	static void		GetCopyBufferItem(int nPos, CCopyBufferItem &Item);
-	static void		SetCopyBufferItem(int nPos, CCopyBufferItem &Item);
-
-	static CString  GetMultiPasteSeparator(bool bConvertToLineFeeds = true);
-	static void		SetMultiPasteSeparator(CString csSep);
-
-	static BOOL		GetSetCurrentDirectory();
-
-	static CString GetPasteString(CString csAppName);
-	static CString GetDefaultPasteString();
-
-	static CString GetCopyString(CString csAppName);
-	static CString GetDefaultCopyString();
-
-	static CString GetCutString(CString csAppName);
-	static CString GetDefaultCutString();
-
-	static BOOL	GetEditWordWrap();
-	static void	SetEditWordWrap(BOOL bSet);
-
-	static bool GetAllowFriends();
-
-	static bool		GetIsPortableDitto();
-
-	static long		GetAutoMaxDelay();
-	static void		SetAutoMaxDelay(long lDelay);
-
-	static void SetTheme(CString csTheme);
-	static CString GetTheme();
-
-	static long		GetKeyStateWaitTimerCount();
-	static long		GetKeyStatePasteDelay();
-
-	static DWORD	GetDittoHotKey();
-	static DWORD	SendKeysDelay();
-	static DWORD	WaitForActiveWndTimeout();
-	static DWORD	FocusChangedDelay();
-	static DWORD	FocusWndTimerTimeout();
-
-	static BOOL		GetConnectedToClipboard();
-	static void		SetConnectedToClipboard(BOOL val);
-
-	static DWORD	GetTextOnlyRestoreDelay();
-	static DWORD 	GetTextOnlyPasteDelay();
-
-	static BOOL		GetSetFocusToApp(CString csAppName);
-
-	static DWORD	SelectedIndex();
-
-	static void		SetCopyAppInclude(CString csAppName);
-	static CString  GetCopyAppInclude();
-
-	static void		SetCopyAppExclude(CString csAppName);
-	static CString  GetCopyAppExclude();
-
-	static CString  GetCopyAppSeparator();
-
-	static DWORD	GetNoFormatsRetryDelay();
-
-	static DWORD	GetMainDeletesDeleteCount();
-
-	static DWORD	GetIdleSecondsBeforeDelete();
-
-	static DWORD	GetDbTimeout();
-
-	static DWORD	GetFunnyTickCountAdjustment();
-
-	static DWORD	GetMinIdleTimeBeforeTrackFocus();
-
-	static DWORD	GetTimeBeforeExpandWindow();
-
-	static DWORD	GetUseGuiThreadInfoForFocus();
-
-	static void		SetSearchDescription(BOOL val);
-	static BOOL		GetSearchDescription();
-
-	static void		SetSearchFullText(BOOL val);
-	static BOOL		GetSearchFullText();
-
-	static void		SetSearchQuickPaste(BOOL val);
-	static BOOL		GetSearchQuickPaste();
-
+#pragma once
+
+#include "Theme.h"
+
+#define MAX_SEND_CLIENTS	15
+class CSendClients
+{
+public:
+	CSendClients()
+	{
+		bSendAll = FALSE;
+		bShownFirstError = FALSE;
+	}
+	BOOL bSendAll;
+	CString csIP;
+	CString csDescription;
+	BOOL bShownFirstError;
+};
+
+#define MAX_COPY_BUFFER	3
+class CCopyBufferItem
+{
+public:
+	CCopyBufferItem()
+	{
+		m_lCopyHotKey = -1;
+		m_lPasteHotKey = -1;
+		m_lCutHotKey = -1;
+		m_bPlaySoundOnCopy = FALSE;
+	}
+	long m_lCopyHotKey;
+	long m_lPasteHotKey;
+	long m_lCutHotKey;
+	BOOL m_bPlaySoundOnCopy;
+};
+
+#define REG_PATH					"Software\\Ditto"
+
+#define POS_AT_CARET	1
+#define POS_AT_CURSOR	2
+#define POS_AT_PREVIOUS	3
+
+#define CAPTION_RIGHT	1
+#define CAPTION_BOTTOM	2
+#define CAPTION_LEFT	3
+#define CAPTION_TOP		4
+
+#define TOGGLES_ALLWAYS_ON_TOP				1
+#define TOGGLES_ALLWAYS_SHOW_DESCRIPTION	2
+#define	ROLLES_UP_WINDOW					3
+
+#define PATH_HELP			0
+#define PATH_REMOTE_FILES	1
+#define PATH_LOG_FILE		2
+#define PATH_LANGUAGE		3
+#define PATH_UPDATE_FILE	4
+#define PATH_DATABASE		5
+#define PATH_INI			6
+#define PATH_U3_HWND_INI	7
+#define PATH_THEMES			8
+#define PATH_ADDINS			9
+
+class CGetSetOptions
+{
+public:
+	CGetSetOptions();
+	virtual ~CGetSetOptions();
+
+	static bool m_bFromIni;
+	static CString m_csIniFileName;
+	static bool m_bInConversion;
+	static bool m_bU3;
+	static CTheme m_Theme;
+	static bool m_portable;
+
+	static void LoadSettings();
+	static CString GetIniFileName(bool bLocalIniFile);
+	static void ConverSettingsToIni();
+	static CString GetAppDataPath();
+
+	static CString GetExeFileName();
+	static CString GetAppName();
+
+	static BOOL GetShowIconInSysTray();
+	static BOOL SetShowIconInSysTray(BOOL bShow);
+
+	static BOOL GetRunOnStartUp();
+	static void SetRunOnStartUp(BOOL bRun);
+
+	static BOOL SetProfileFont(CString csSection, LOGFONT &font);
+	static BOOL GetProfileFont(CString csSection, LOGFONT &font);
+
+	static BOOL SetProfileLong(CString csName, long lValue);
+	static long GetProfileLong(CString csName, long lDefaultValue = -1, CString csNewPath = _T(""));
+
+	static CString GetProfileString(CString csName, CString csDefault, CString csNewPath = _T(""));
+	static BOOL	SetProfileString(CString csName, CString csValue);
+
+	static LPVOID GetProfileData(CString csName, DWORD &dwLength);
+	static BOOL	SetProfileData(CString csName, LPVOID lpData, DWORD dwLength);
+
+	static BOOL SetQuickPasteSize(CSize size);
+	static void GetQuickPasteSize(CSize &size);
+
+	static BOOL SetQuickPastePoint(CPoint point);
+	static void GetQuickPastePoint(CPoint &point);
+
+	static BOOL SetEditWndSize(CSize size);
+	static void GetEditWndSize(CSize &size);
+
+	static BOOL SetEditWndPoint(CPoint point);
+	static void GetEditWndPoint(CPoint &point);
+
+	static BOOL SetEnableTransparency(BOOL bCheck);
+	static BOOL GetEnableTransparency();
+
+	static BOOL SetTransparencyPercent(long lPercent);
+	static long GetTransparencyPercent();
+
+	static long m_nLinesPerRow;
+	static BOOL SetLinesPerRow(long lLines);
+	static long GetLinesPerRow();
+
+	static BOOL SetQuickPastePosition(long lPosition);
+	static long GetQuickPastePosition();
+
+	static long GetCopyGap();
+	static void SetCopyGap(long lGap);
+
+	static BOOL SetDBPath(CString csPath);
+	static CString GetDBPath();
+
+	static BOOL SetDBPathOld(CString csPath);
+	static CString GetDBPathOld();
+
+	static void SetCheckForMaxEntries(BOOL bVal);
+	static BOOL GetCheckForMaxEntries();
+
+	static void SetCheckForExpiredEntries(BOOL bVal);
+	static BOOL GetCheckForExpiredEntries();
+
+	static void SetMaxEntries(long lVal);
+	static long GetMaxEntries();
+
+	static void SetExpiredEntries(long lVal);
+	static long GetExpiredEntries();
+
+	static void SetTripCopyCount(long lVal);
+	static long GetTripCopyCount();
+
+	static void SetTripPasteCount(long lVal);
+	static long GetTripPasteCount();
+
+	static void SetTripDate(long lDate);
+	static long GetTripDate();
+
+	static void SetTotalCopyCount(long lVal);
+	static long GetTotalCopyCount();
+
+	static void SetTotalPasteCount(long lVal);
+	static long GetTotalPasteCount();
+
+	static void SetTotalDate(long lDate);
+	static long GetTotalDate();
+
+	static CString	GetUpdateFilePath();
+	static BOOL		SetUpdateFilePath(CString cs);
+
+	static CString	GetUpdateInstallPath();
+	static BOOL		SetUpdateInstallPath(CString cs);
+
+	static long		GetLastUpdate();
+	static long		SetLastUpdate(long lValue);
+
+	static BOOL		GetCheckForUpdates();
+	static BOOL		SetCheckForUpdates(BOOL bCheck);
+
+	static BOOL		m_bUseCtrlNumAccel;
+	static void		SetUseCtrlNumForFirstTenHotKeys(BOOL bVal);
+	static BOOL		GetUseCtrlNumForFirstTenHotKeys();
+
+	static BOOL		m_bAllowDuplicates;
+	static void		SetAllowDuplicates(BOOL bVal);
+	static BOOL		GetAllowDuplicates();
+
+	static BOOL		m_bUpdateTimeOnPaste;
+	static void		SetUpdateTimeOnPaste(BOOL bVal);
+	static BOOL		GetUpdateTimeOnPaste();
+
+	static BOOL		m_bSaveMultiPaste;
+	static void		SetSaveMultiPaste(BOOL bVal);
+	static BOOL		GetSaveMultiPaste();
+
+	static BOOL		m_bShowPersistent;
+	static void		SetShowPersistent(BOOL bVal);
+	static BOOL		GetShowPersistent();
+
+	static void		SetShowTextForFirstTenHotKeys(BOOL bVal);
+	static BOOL		GetShowTextForFirstTenHotKeys();
+
+	static void		SetMainHWND(long lhWnd);
+	static BOOL		GetMainHWND();
+
+	static void		SetCaptionPos(long lPos);
+	static long		GetCaptionPos();
+
+	static void		SetAutoHide(BOOL bAutoHide);
+	static BOOL		GetAutoHide();
+
+	static long		m_bDescTextSize;
+	static void		SetDescTextSize(long lSize);
+	static long		GetDescTextSize();
+
+	static BOOL		m_bDescShowLeadingWhiteSpace;
+	static void		SetDescShowLeadingWhiteSpace(BOOL bVal);
+	static BOOL		GetDescShowLeadingWhiteSpace();
+
+	static BOOL		m_bAllwaysShowDescription;
+	static void		SetAllwaysShowDescription(long bShow);
+	static BOOL		GetAllwaysShowDescription();
+
+	static long		m_bDoubleClickingOnCaptionDoes;
+	static void		SetDoubleClickingOnCaptionDoes(long lOption);
+	static long		GetDoubleClickingOnCaptionDoes();
+
+	static BOOL		m_bPrompForNewGroupName;
+	static void		SetPrompForNewGroupName(BOOL bOption);
+	static BOOL		GetPrompForNewGroupName();
+
+	static BOOL		m_bSendPasteOnFirstTenHotKeys;
+	static void		SetSendPasteOnFirstTenHotKeys(BOOL bOption);
+	static BOOL		GetSendPasteOnFirstTenHotKeys();
+
+	static CSendClients m_SendClients[MAX_SEND_CLIENTS];
+	static long		m_lAutoSendClientCount;
+	static void		GetClientSendCount();
+	static void		SetSendClients(CSendClients Client, int nPos);
+	static CSendClients		GetSendClients(int nPos);
+
+	static CString m_csIPListToPutOnClipboard;
+	static CString	GetListToPutOnClipboard();
+	static BOOL		SetListToPutOnClipboard(CString cs);
+
+	static BOOL		m_bLogSendReceiveErrors;
+	static void		SetLogSendReceiveErrors(BOOL bOption);
+	static BOOL		GetLogSendReceiveErrors();
+
+	static BOOL		m_HideDittoOnHotKeyIfAlreadyShown;
+	static BOOL		GetHideDittoOnHotKeyIfAlreadyShown();
+	static void		SetHideDittoOnHotKeyIfAlreadyShown(BOOL bVal);
+
+	static long		m_lPort;
+	static void		SetPort(long lPort);
+	static long		GetPort();
+
+	static BOOL		GetDisableRecieve();
+	static void		SetDisableRecieve(BOOL bVal);
+
+	static BOOL		GetFont(LOGFONT &font);
+	static void		SetFont(LOGFONT &font);
+
+	static BOOL		m_bDrawThumbnail;
+	static void		SetDrawThumbnail(long bDraw);
+	static BOOL		GetDrawThumbnail();
+
+	static CStringA	m_csPassword;
+	static void		SetNetworkPassword(CString csPassword);
+	static CStringA	GetNetworkPassword();
+
+	static BOOL		m_bDrawRTF;
+	static void		SetDrawRTF(long bDraw);
+	static BOOL		GetDrawRTF();
+
+	static BOOL		m_bMultiPasteReverse;
+	static void		SetMultiPasteReverse(BOOL bVal);
+	static BOOL		GetMultiPasteReverse();
+
+	static CString	m_csPlaySoundOnCopy;
+	static void		SetPlaySoundOnCopy(CString cs);
+	static CString	GetPlaySoundOnCopy();
+
+	static BOOL		m_bSendPasteMessageAfterSelection;
+	static void		SetSendPasteAfterSelection(BOOL bVal);
+	static BOOL		GetSendPasteAfterSelection();
+
+	static BOOL		m_bFindAsYouType;
+	static void		SetFindAsYouType(BOOL bVal);
+	static BOOL		GetFindAsYouType();
+
+	static BOOL		m_bEnsureEntireWindowCanBeSeen;
+	static void		SetEnsureEntireWindowCanBeSeen(BOOL bVal);
+	static BOOL		GetEnsureEntireWindowCanBeSeen();
+
+	static BOOL		m_bShowAllClipsInMainList;
+	static void		SetShowAllClipsInMainList(BOOL bVal);
+	static BOOL		GetShowAllClipsInMainList();
+
+	static void		SetExtraNetworkPassword(CString csPassword);
+	static CString	GetExtraNetworkPassword(bool bFillArray);
+
+	static long		m_lMaxClipSizeInBytes;
+	static long		GetMaxClipSizeInBytes();
+	static void		SetMaxClipSizeInBytes(long lSize);
+
+	static CString	GetLanguageFile();
+	static void		SetLanguageFile(CString csLanguage);
+
+	static DWORD	m_dwSaveClipDelay;
+	static ULONG	GetSaveClipDelay();
+	static void		SetSaveClipDelay(DWORD dwDelay);
+
+	static long		m_lProcessDrawClipboardDelay;
+	static long		GetProcessDrawClipboardDelay();
+	static void		SetProcessDrawClipboardDelay(long lDelay);
+
+	static BOOL		m_bEnableDebugLogging;
+	static BOOL		GetEnableDebugLogging();
+	static void		SetEnableDebugLogging(BOOL bEnable);
+
+	static BOOL		m_bEnsureConnectToClipboard;
+	static BOOL		GetEnsureConnectToClipboard();
+	static void		SetEnsureConnectToClipboard(BOOL bSet);
+
+	static BOOL		GetPromptWhenDeletingClips();
+	static void		SetPromptWhenDeletingClips(BOOL bSet);
+
+	static CString	GetLastImportDir();
+	static void		SetLastImportDir(CString csDir);
+
+	static CString	GetLastExportDir();
+	static void		SetLastExportDir(CString csDir);
+
+	static BOOL		GetUpdateDescWhenSavingClip();
+	static void		SetUpdateDescWhenSavingClip(BOOL bSet);
+
+	static bool		m_bOutputDebugString;
+
+	static CStringArray m_csNetworkPasswordArray;
+
+	static CString  GetPath(long lPathID);
+
+	static void		WriteU3Hwnd(HWND hWnd);
+	static __int64	nLastDbWriteTime;
+
+	static long		GetDittoRestoreClipboardDelay();
+	static void		SetDittoRestoreClipboardDelay(long lDelay);
+
+	static void		GetCopyBufferItem(int nPos, CCopyBufferItem &Item);
+	static void		SetCopyBufferItem(int nPos, CCopyBufferItem &Item);
+
+	static CString  GetMultiPasteSeparator(bool bConvertToLineFeeds = true);
+	static void		SetMultiPasteSeparator(CString csSep);
+
+	static BOOL		GetSetCurrentDirectory();
+
+	static CString GetPasteString(CString csAppName);
+	static CString GetDefaultPasteString();
+
+	static CString GetCopyString(CString csAppName);
+	static CString GetDefaultCopyString();
+
+	static CString GetCutString(CString csAppName);
+	static CString GetDefaultCutString();
+
+	static BOOL	GetEditWordWrap();
+	static void	SetEditWordWrap(BOOL bSet);
+
+	static bool GetAllowFriends();
+
+	static bool		GetIsPortableDitto();
+
+	static long		GetAutoMaxDelay();
+	static void		SetAutoMaxDelay(long lDelay);
+
+	static void SetTheme(CString csTheme);
+	static CString GetTheme();
+
+	static long		GetKeyStateWaitTimerCount();
+	static long		GetKeyStatePasteDelay();
+
+	static DWORD	GetDittoHotKey();
+	static DWORD	SendKeysDelay();
+	static DWORD	WaitForActiveWndTimeout();
+	static DWORD	FocusChangedDelay();
+	static DWORD	FocusWndTimerTimeout();
+
+	static BOOL		GetConnectedToClipboard();
+	static void		SetConnectedToClipboard(BOOL val);
+
+	static DWORD	GetTextOnlyRestoreDelay();
+	static DWORD 	GetTextOnlyPasteDelay();
+
+	static BOOL		GetSetFocusToApp(CString csAppName);
+
+	static DWORD	SelectedIndex();
+
+	static void		SetCopyAppInclude(CString csAppName);
+	static CString  GetCopyAppInclude();
+
+	static void		SetCopyAppExclude(CString csAppName);
+	static CString  GetCopyAppExclude();
+
+	static CString  GetCopyAppSeparator();
+
+	static DWORD	GetNoFormatsRetryDelay();
+
+	static DWORD	GetMainDeletesDeleteCount();
+
+	static DWORD	GetIdleSecondsBeforeDelete();
+
+	static DWORD	GetDbTimeout();
+
+	static DWORD	GetFunnyTickCountAdjustment();
+
+	static DWORD	GetMinIdleTimeBeforeTrackFocus();
+
+	static DWORD	GetTimeBeforeExpandWindow();
+
+	static DWORD	GetUseGuiThreadInfoForFocus();
+
+	static void		SetSearchDescription(BOOL val);
+	static BOOL		GetSearchDescription();
+
+	static void		SetSearchFullText(BOOL val);
+	static BOOL		GetSearchFullText();
+
+	static void		SetSearchQuickPaste(BOOL val);
+	static BOOL		GetSearchQuickPaste();
+
+	static void		SetSimpleTextSearch(BOOL val);
+	static BOOL		GetSimpleTextSearch();
+
+	static void		SetMoveClipsOnGlobal10(BOOL val);
+	static BOOL		GetMoveClipsOnGlobal10();
+
 	static void		SetShowScrollBar(BOOL val);
-	static BOOL		GetShowScrollBar();
-	static BOOL		m_showScrollBar;
-
-};
-
-// global for easy access and for initialization of fast access variables
+	static BOOL		GetShowScrollBar();
+	static BOOL		m_showScrollBar;
+};
+
+// global for easy access and for initialization of fast access variables
 extern CGetSetOptions g_Opt; 

+ 4 - 0
OptionsKeyBoard.cpp

@@ -49,6 +49,7 @@ void COptionsKeyBoard::DoDataExchange(CDataExchange* pDX)
 	DDX_Control(pDX, IDC_HOTKEY_TEXT_ONLY, m_TextOnlyKey);
 	//}}AFX_DATA_MAP
 	DDX_Control(pDX, IDC_STATIC_CUSTOM_KEYS, m_CustomeKeysHelp);
+	DDX_Control(pDX, IDC_CHECK_MOVE_CLIPS_ON_PASTE, m_btMoveClipOnGlobal10);
 }
 
 BEGIN_MESSAGE_MAP(COptionsKeyBoard, CPropertyPage)
@@ -88,6 +89,8 @@ BOOL COptionsKeyBoard::OnInitDialog()
 
 	m_btSendPaste.SetCheck(g_Opt.m_bSendPasteOnFirstTenHotKeys);
 
+	m_btMoveClipOnGlobal10.SetCheck(g_Opt.GetMoveClipsOnGlobal10());
+
 	m_HotKey.SetFocus();
 
 	theApp.m_Language.UpdateOptionShortcuts(this);	
@@ -108,6 +111,7 @@ BOOL COptionsKeyBoard::OnWizardFinish()
 BOOL COptionsKeyBoard::OnApply()
 {
 	CGetSetOptions::SetSendPasteOnFirstTenHotKeys(m_btSendPaste.GetCheck());
+	CGetSetOptions::SetMoveClipsOnGlobal10(m_btMoveClipOnGlobal10.GetCheck());
 					
 	INT_PTR x,y;
 	CString str;

+ 1 - 0
OptionsKeyBoard.h

@@ -28,6 +28,7 @@ public:
 	//{{AFX_DATA(COptionsKeyBoard)
 	enum { IDD = IDD_OPTIONS_KEYSTROKES };
 	CButton	m_btSendPaste;
+	CButton	m_btMoveClipOnGlobal10;
 	CHotKeyCtrl	m_Nine;
 	CHotKeyCtrl	m_Eight;
 	CHotKeyCtrl	m_Seven;

+ 20 - 18
QListCtrl.cpp

@@ -182,6 +182,11 @@ void CQListCtrl::OnKeydown(NMHDR* pNMHDR, LRESULT* pResult)
 	*pResult = 0;
 }
 
+DROPEFFECT CQListCtrl::OnDragOver(COleDataObject* pDataObject, DWORD dwKeyState, CPoint point)
+{
+	return DROPEFFECT_COPY;
+}
+
 void CQListCtrl::OnDblclk(NMHDR* pNMHDR, LRESULT* pResult) 
 {
 	LPNMITEMACTIVATE lpnmItem = (LPNMITEMACTIVATE) pNMHDR;
@@ -375,6 +380,20 @@ void CQListCtrl::OnCustomdrawList(NMHDR* pNMHDR, LRESULT* pResult)
 		
 		COLORREF OldColor = -1;
 		int nOldBKMode = -1;
+
+		CString csText;
+		LPTSTR lpszText = csText.GetBufferSetLength(g_Opt.m_bDescTextSize);
+		GetItemText(nItem, 0, lpszText, g_Opt.m_bDescTextSize);
+		csText.ReleaseBuffer();
+
+		// extract symbols
+		CString strSymbols;
+		int nSymEnd = csText.Find('|');
+		if (nSymEnd >= 0)
+		{
+			strSymbols = csText.Left(nSymEnd);
+			csText = csText.Mid(nSymEnd + 1);
+		}
 		
 		// Draw the background of the list item.  Colors are selected 
 		// according to the item's state.
@@ -412,24 +431,7 @@ void CQListCtrl::OnCustomdrawList(NMHDR* pNMHDR, LRESULT* pResult)
         CRect rcText = rcItem;
         rcText.left += ROW_LEFT_BORDER;
 		rcText.top++;
-		
-        // Draw the text.
-        //CString csText = GetItemText(nItem, 0);
-		
-		CString csText;
-		LPTSTR lpszText = csText.GetBufferSetLength(g_Opt.m_bDescTextSize);
-		GetItemText(nItem, 0, lpszText, g_Opt.m_bDescTextSize);
-		csText.ReleaseBuffer();
-		
-		// extract symbols
-		CString strSymbols;
-		int nSymEnd = csText.Find('|');
-		if( nSymEnd >= 0 )
-		{
-			strSymbols = csText.Left(nSymEnd);  
-			csText = csText.Mid(nSymEnd+1);
-		}
-		
+		        		
 		// set firstTenNum to the first ten number (1-10) corresponding to
 		//  the current nItem.
 		// -1 means that nItem is not in the FirstTen block.

+ 2 - 0
QListCtrl.h

@@ -113,6 +113,8 @@ public:
 	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);

+ 236 - 4
QPasteWnd.cpp

@@ -14,6 +14,7 @@
 #include "MainTableFunctions.h"
 #include "Path.h"
 #include <algorithm>
+//#include "MyDropTarget.h"
 
 #ifdef _DEBUG
     #define new DEBUG_NEW
@@ -147,6 +148,10 @@ ON_UPDATE_COMMAND_UI(ID_MENU_PASTEPLAINTEXTONLY, OnUpdateMenuPasteplaintextonly)
 ON_UPDATE_COMMAND_UI(ID_MENU_DELETE, OnUpdateMenuDelete)
 ON_UPDATE_COMMAND_UI(ID_MENU_PROPERTIES, OnUpdateMenuProperties)
 ON_COMMAND(ID_QUICKOPTIONS_PROMPTTODELETECLIP, OnPromptToDeleteClip)
+ON_COMMAND(ID_STICKYCLIPS_MAKETOPSTICKYCLIP, OnMakeTopStickyClip)
+ON_COMMAND(ID_STICKYCLIPS_MAKELASTSTICKYCLIP, OnMakeLastStickyClip)
+ON_COMMAND(ID_STICKYCLIPS_REMOVESTICKYSETTING, OnRemoveStickySetting)
+
 ON_WM_DESTROY()
 
 //}}AFX_MSG_MAP
@@ -196,6 +201,7 @@ ON_MESSAGE(NM_POST_OPTIONS_WINDOW, OnPostOptions)
 ON_COMMAND(ID_MENU_SEARCHDESCRIPTION, OnMenuSearchDescription)
 ON_COMMAND(ID_MENU_SEARCHFULLTEXT, OnMenuSearchFullText)
 ON_COMMAND(ID_MENU_SEARCHQUICKPASTE, OnMenuSearchQuickPaste)
+ON_COMMAND(ID_MENU_CONTAINSTEXTSEARCHONLY, OnMenuSimpleTextSearch)
 //ON_WM_CTLCOLOR()
 //ON_WM_ERASEBKGND()
 //ON_WM_PAINT()
@@ -229,6 +235,9 @@ int CQPasteWnd::OnCreate(LPCREATESTRUCT lpCreateStruct)
         return -1;
     }
 
+	//m_pDropTarget = new CMyDropTarget(this);
+	//m_pDropTarget->Register(this);
+
     SetWindowText(_T(QPASTE_TITLE));
 
     m_search.Create(WS_TABSTOP | WS_CHILD | WS_VISIBLE | ES_MULTILINE, CRect(0, 0, 0, 0), this, ID_EDIT_SEARCH);
@@ -951,12 +960,15 @@ BOOL CQPasteWnd::FillList(CString csSQLSearch /*=""*/)
     CString strParentFilter;
     CString csSort;
 
-    // History Group
+    // History Groupiter->m_stickyClipGroupOrder = clip.m_stickyClipGroupOrder;
     if(theApp.m_GroupID < 0)
     {
         m_lstHeader.m_bStartTop = true;
         
-		csSort = "Main.bIsGroup ASC, Main.clipOrder DESC";
+		csSort = "case when Main.stickyClipOrder = 0 then -9999999 else Main.stickyClipOrder END DESC, "
+				 "case when Main.stickyClipOrder IS NULL then - 9999999 else Main.stickyClipOrder END DESC, "
+				 "Main.bIsGroup ASC, "
+				 "clipOrder DESC";
 
         if(g_Opt.m_bShowAllClipsInMainList)
         {
@@ -972,7 +984,12 @@ BOOL CQPasteWnd::FillList(CString csSQLSearch /*=""*/)
     {
         m_lstHeader.m_bStartTop = true;
 
-        csSort = "Main.bIsGroup DESC, Main.clipGroupOrder DESC";
+		csSort = "case when Main.stickyClipGroupOrder = 0 then -9999999 else Main.stickyClipGroupOrder END DESC, "
+				 "case when Main.stickyClipGroupOrder IS NULL then - 9999999 else Main.stickyClipGroupOrder END DESC, "
+				 "Main.bIsGroup ASC, "
+				 "clipGroupOrder DESC";
+			
+			//Main.stickyClipGroupOrder DESC, Main.clipGroupOrder DESC";//
         
         if(theApp.m_GroupID >= 0)
         {
@@ -1097,7 +1114,7 @@ BOOL CQPasteWnd::FillList(CString csSQLSearch /*=""*/)
 	    m_CountSQL.Format(_T("SELECT COUNT(Main.lID) FROM Main %s where %s"), dataJoin, strFilter);
 
 	    m_SQL.Format(_T("SELECT Main.lID, Main.mText, Main.lParentID, Main.lDontAutoDelete, ")
-			_T("Main.lShortCut, Main.bIsGroup, Main.QuickPasteText, Main.clipOrder, Main.clipGroupOrder FROM Main %s ")
+			_T("Main.lShortCut, Main.bIsGroup, Main.QuickPasteText, Main.clipOrder, Main.clipGroupOrder, Main.stickyClipOrder, Main.stickyClipGroupOrder FROM Main %s ")
 			_T("where %s order by %s"), dataJoin, strFilter, csSort);
 	}
 
@@ -1990,6 +2007,183 @@ void CQPasteWnd::OnPromptToDeleteClip()
     CGetSetOptions::SetPromptWhenDeletingClips(!CGetSetOptions::GetPromptWhenDeletingClips());
 }
 
+void CQPasteWnd::OnMakeTopStickyClip()
+{
+	ARRAY IDs;
+	m_lstHeader.GetSelectionItemData(IDs);
+
+	if (IDs.GetCount() > 0)
+	{
+		bool sort = false;
+		for (int i = IDs.GetCount() - 1; i >= 0; i--)
+		{
+			int id = IDs[i];
+			CClip clip;
+			if (clip.LoadMainTable(id))
+			{
+				clip.MakeStickyTop(theApp.m_GroupID);
+				clip.ModifyMainTable();
+
+				std::vector<CMainTable>::iterator iter = m_listItems.begin();
+				while (iter != m_listItems.end())
+				{
+					if (iter->m_lID == id)
+					{
+						if (theApp.m_GroupID > 0)
+						{
+							iter->m_stickyClipGroupOrder = clip.m_stickyClipGroupOrder;
+						}
+						else
+						{
+							iter->m_stickyClipOrder = clip.m_stickyClipOrder;							
+						}
+						sort = true;
+						break;
+					}
+					iter++;
+				}
+			}
+		}
+
+			//theApp.m_FocusID = id;
+
+		if(sort)
+		{
+			if (theApp.m_GroupID > 0)
+			{
+				std::sort(m_listItems.begin(), m_listItems.end(), CMainTable::GroupSortDesc);
+			}
+			else
+			{
+				std::sort(m_listItems.begin(), m_listItems.end(), CMainTable::SortDesc);
+			}
+
+			//SelectFocusID();
+
+			m_lstHeader.RefreshVisibleRows();
+			m_lstHeader.RedrawWindow();
+		}
+	}
+}
+
+void CQPasteWnd::OnMakeLastStickyClip()
+{
+	ARRAY IDs;
+	m_lstHeader.GetSelectionItemData(IDs);
+
+	if (IDs.GetCount() > 0)
+	{
+		bool sort = false;
+		for (int i = IDs.GetCount() - 1; i >= 0; i--)
+		{
+			int id = IDs[i];
+			CClip clip;
+			if (clip.LoadMainTable(id))
+			{
+				clip.MakeStickyLast(theApp.m_GroupID);
+				clip.ModifyMainTable();
+
+				std::vector<CMainTable>::iterator iter = m_listItems.begin();
+				while (iter != m_listItems.end())
+				{
+					if (iter->m_lID == id)
+					{
+						if (theApp.m_GroupID > 0)
+						{
+							iter->m_stickyClipGroupOrder = clip.m_stickyClipGroupOrder;
+						}
+						else
+						{
+							iter->m_stickyClipOrder = clip.m_stickyClipOrder;							
+						}
+						sort = true;
+						break;
+					}
+					iter++;
+				}
+			}
+		}
+
+		//theApp.m_FocusID = id;
+
+		if (sort)
+		{
+			if (theApp.m_GroupID > 0)
+			{
+				std::sort(m_listItems.begin(), m_listItems.end(), CMainTable::GroupSortDesc);
+			}
+			else
+			{
+				std::sort(m_listItems.begin(), m_listItems.end(), CMainTable::SortDesc);
+			}
+
+			//SelectFocusID();
+
+			m_lstHeader.RefreshVisibleRows();
+			m_lstHeader.RedrawWindow();
+		}
+	}
+}
+
+void CQPasteWnd::OnRemoveStickySetting()
+{
+	ARRAY IDs;
+	m_lstHeader.GetSelectionItemData(IDs);
+
+	if (IDs.GetCount() > 0)
+	{
+		bool sort = false;
+		for (int i = IDs.GetCount() - 1; i >= 0; i--)
+		{
+			int id = IDs[i];
+			CClip clip;
+			if (clip.LoadMainTable(id))
+			{
+				clip.RemoveStickySetting(theApp.m_GroupID);
+				clip.ModifyMainTable();
+
+				std::vector<CMainTable>::iterator iter = m_listItems.begin();
+				while (iter != m_listItems.end())
+				{
+					if (iter->m_lID == id)
+					{
+						if (theApp.m_GroupID > 0)
+						{
+							iter->m_stickyClipGroupOrder = clip.m_stickyClipGroupOrder;
+						}
+						else
+						{
+							iter->m_stickyClipOrder = clip.m_stickyClipOrder;
+						}
+						sort = true;
+						break;
+					}
+					iter++;
+				}
+			}
+		}
+
+		//theApp.m_FocusID = id;
+
+		if (sort)
+		{
+			if (theApp.m_GroupID > 0)
+			{
+				std::sort(m_listItems.begin(), m_listItems.end(), CMainTable::GroupSortDesc);
+			}
+			else
+			{
+				std::sort(m_listItems.begin(), m_listItems.end(), CMainTable::SortDesc);
+			}
+
+			//SelectFocusID();
+
+			m_lstHeader.RefreshVisibleRows();
+			m_lstHeader.RedrawWindow();
+		}
+	}
+}
+
 void CQPasteWnd::OnMenuExport()
 {
     CClipIDs IDs;
@@ -2631,6 +2825,28 @@ void CQPasteWnd::OnBegindrag(NMHDR *pNMHDR, LRESULT *pResult)
     *pResult = 0;
 }
 
+DROPEFFECT CQPasteWnd::OnDragEnter(COleDataObject* pDataObject, DWORD dwKeyState, CPoint point)
+{
+	int k = 0;
+
+	return DROPEFFECT_COPY;
+}
+
+DROPEFFECT CQPasteWnd::OnDragOver(COleDataObject* pDataObject, DWORD dwKeyState, CPoint point)
+{
+	return DROPEFFECT_COPY;
+}
+
+BOOL CQPasteWnd::OnDrop(COleDataObject* pDataObject, DROPEFFECT dropEffect, CPoint point)
+{
+	return TRUE;
+}
+
+void CQPasteWnd::OnDragLeave()
+{
+
+}
+
 void CQPasteWnd::OnSysKeyDown(UINT nChar, UINT nRepCnt, UINT nFlags)
 {
     CWndEx::OnSysKeyDown(nChar, nRepCnt, nFlags);
@@ -2670,6 +2886,12 @@ void CQPasteWnd::GetDispInfo(NMHDR *pNMHDR, LRESULT *pResult)
                             cs += "G";
                         }
 
+						if (m_listItems[pItem->iItem].m_stickyClipOrder > 0 || 
+							m_listItems[pItem->iItem].m_stickyClipGroupOrder)
+						{
+							cs += "Sticky";
+						}
+
                         // attached to a group
                         if(m_listItems[pItem->iItem].m_bHasParent)
                         {
@@ -3118,6 +3340,9 @@ void CQPasteWnd::OnSearchDescription()
 
 		if(CGetSetOptions::GetSearchQuickPaste())
 			cmSubMenu->CheckMenuItem(ID_MENU_SEARCHQUICKPASTE, MF_CHECKED);
+
+		if(CGetSetOptions::GetSimpleTextSearch())
+			cmSubMenu->CheckMenuItem(ID_MENU_CONTAINSTEXTSEARCHONLY, MF_CHECKED);
 				
 
 		//theApp.m_Language.UpdateRightClickMenu(cmSubMenu);
@@ -3167,6 +3392,11 @@ void CQPasteWnd::OnMenuSearchQuickPaste()
 	}
 }
 
+void CQPasteWnd::OnMenuSimpleTextSearch()
+{
+	CGetSetOptions::SetSimpleTextSearch(!CGetSetOptions::GetSimpleTextSearch());
+}
+
 void CQPasteWnd::OnSearchEditChange()
 {
     if(g_Opt.m_bFindAsYouType == FALSE)
@@ -3451,6 +3681,8 @@ void CQPasteWnd::FillMainTable(CMainTable &table, CppSQLite3Query &q)
     table.m_QuickPaste = q.fieldValue(_T("QuickPasteText"));
 	table.m_clipOrder = q.getFloatField(_T("clipOrder"));
 	table.m_clipGroupOrder = q.getFloatField(_T("clipGroupOrder"));
+	table.m_stickyClipOrder = q.getFloatField(_T("stickyClipOrder"));
+	table.m_stickyClipGroupOrder = q.getFloatField(_T("stickyClipGroupOrder"));
 }
 
 void CQPasteWnd::OnDestroy()

+ 41 - 0
QPasteWnd.h

@@ -43,14 +43,44 @@ public:
     CString m_QuickPaste;
 	double m_clipOrder;
 	double m_clipGroupOrder;
+	double m_stickyClipOrder;
+	double m_stickyClipGroupOrder;
 
 	static bool SortDesc(const CMainTable& d1, const CMainTable& d2)
 	{
+		double d1StickyOrder = d1.m_stickyClipOrder;
+		if (d1StickyOrder == 0)
+			d1StickyOrder = -9999999.0;
+
+		double d2StickyOrder = d2.m_stickyClipOrder;
+		if (d2StickyOrder == 0)
+			d2StickyOrder = -9999999.0;
+
+		if (d1StickyOrder != d2StickyOrder)
+			return d1StickyOrder > d2StickyOrder;
+
+		if (d1.m_bIsGroup != d2.m_bIsGroup)
+			return d1.m_bIsGroup < d2.m_bIsGroup;
+
 		return d1.m_clipOrder > d2.m_clipOrder;
 	}
 
 	static bool GroupSortDesc(const CMainTable& d1, const CMainTable& d2)
 	{
+		double d1StickyOrder = d1.m_stickyClipGroupOrder;
+		if (d1StickyOrder == 0)
+			d1StickyOrder = -9999999.0;
+
+		double d2StickyOrder = d2.m_stickyClipGroupOrder;
+		if (d2StickyOrder == 0)
+			d2StickyOrder = -9999999.0;
+
+		if (d1StickyOrder != d2StickyOrder)
+			return d1StickyOrder > d2StickyOrder;
+
+		if (d1.m_bIsGroup != d2.m_bIsGroup)
+			return d1.m_bIsGroup < d2.m_bIsGroup;
+
 		return d1.m_clipGroupOrder > d2.m_clipGroupOrder;
 	}
 };
@@ -167,6 +197,12 @@ public:
 	void HideMenuGroup(CMenu* menu, CString text);
 	void SetSearchImages();
 
+	DROPEFFECT OnDragOver(COleDataObject* pDataObject, DWORD dwKeyState, CPoint point);
+	DROPEFFECT OnDragEnter(COleDataObject* pDataObject, DWORD dwKeyState, CPoint point);
+	BOOL OnDrop(COleDataObject* pDataObject, DROPEFFECT dropEffect, CPoint point);
+	void OnDragLeave();
+	COleDropTarget *m_pDropTarget;
+
     // Generated message map functions
 protected:
     //{{AFX_MSG(CQPasteWnd)
@@ -298,9 +334,14 @@ protected:
 	afx_msg void OnMenuSearchDescription();
 	afx_msg void OnMenuSearchFullText();
 	afx_msg void OnMenuSearchQuickPaste();
+	afx_msg void OnMenuSimpleTextSearch();
 	//afx_msg HBRUSH OnCtlColor(CDC* pDC, CWnd* pWnd, UINT nCtlColor);
 	//afx_msg BOOL OnEraseBkgnd(CDC* pDC);
 	//afx_msg void OnPaint();
     //}}AFX_MSG
 	afx_msg LRESULT OnPostOptions(WPARAM wParam, LPARAM lParam);
+	afx_msg void OnMakeTopStickyClip();
+	afx_msg void OnMakeLastStickyClip();
+	afx_msg void OnRemoveStickySetting();
+
 };

+ 7 - 1
Resource.h

@@ -118,6 +118,7 @@
 #define IDC_ENSURE                      1042
 #define IDC_PLAY_SOUND_1                1042
 #define IDC_PLAY_SOUND_2                1043
+#define IDC_CHECK_MOVE_CLIPS_ON_PASTE   1043
 #define IDC_PLAY_SOUND_3                1044
 #define IDD_OPTIONS_KEYSTROKES          2001
 #define IDC_HOTKEY                      2002
@@ -370,6 +371,11 @@
 #define ID_MENU_SEARCHDESCRIPTION       32873
 #define ID_MENU_SEARCHFULLTEXT          32874
 #define ID_MENU_SEARCHQUICKPASTE        32875
+#define ID_MENU_CONTAINSTEXTSEARCHONLY  32876
+#define ID_MENU_STICKYCLIPS             32877
+#define ID_STICKYCLIPS_MAKETOPSTICKYCLIP 32878
+#define ID_STICKYCLIPS_MAKELASTSTICKYCLIP 32879
+#define ID_STICKYCLIPS_REMOVESTICKYSETTING 32880
 
 // Next default values for new objects
 // 
@@ -377,7 +383,7 @@
 #ifndef APSTUDIO_READONLY_SYMBOLS
 #define _APS_3D_CONTROLS                     1
 #define _APS_NEXT_RESOURCE_VALUE        184
-#define _APS_NEXT_COMMAND_VALUE         32876
+#define _APS_NEXT_COMMAND_VALUE         32881
 #define _APS_NEXT_CONTROL_VALUE         2101
 #define _APS_NEXT_SYMED_VALUE           101
 #endif