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

added add-in to set/reset the read only flag on files, added hot key to paste unformatted text

git-svn-id: svn://svn.code.sf.net/p/ditto-cp/code/trunk@486 595ec19a-5cb4-439b-94a8-42fb3063c22c
sabrogden 15 жил өмнө
parent
commit
9284769576

+ 1 - 1
AccessToSqlite.cpp

@@ -2,7 +2,7 @@
 #include "AccessToSqlite.h"
 #include "Options.h"
 #include "Misc.h"
-#include "TextConvert.h"
+#include "shared/TextConvert.h"
 
 
 BOOL CAccessToSqlite::ConvertDatabase(const TCHAR *pNewDatabase, const TCHAR *pOldDatabase)

+ 6 - 0
CP_Main.cpp

@@ -302,10 +302,16 @@ void CCP_MainApp::AfterMainCreate()
 	m_pPasteBuffer3 = new CHotKey("CopyBufferPasteHotKey_2", 0, true);
 	m_pCutBuffer3 = new CHotKey("CopyBufferCutHotKey_2", 0, true);
 
+	m_pTextOnlyPaste = new CHotKey("TextOnlyPaste", 0, true);
+
 	g_HotKeys.RegisterAll();
 	StartCopyThread();
 	StartStopServerThread();
 
+#ifdef UNICODE
+	m_Addins.LoadAll();
+#endif
+
 	m_bAppRunning = true;
 }
 

+ 2 - 1
CP_Main.h

@@ -9,7 +9,7 @@
 #include "DatabaseUtilities.h"
 #include "Misc.h"
 #include "Options.h"
-#include "ArrayEx.h"
+#include "Shared/ArrayEx.h"
 #include "MainFrm.h"
 #include "ProcessPaste.h"
 #include "MultiLanguage.h"
@@ -68,6 +68,7 @@ public:
 	CHotKey		*m_pCopyBuffer3;
 	CHotKey		*m_pPasteBuffer3;
 	CHotKey		*m_pCutBuffer3;
+	CHotKey		*m_pTextOnlyPaste;
 
 	ExternalWindowTracker m_activeWnd;
 	

+ 44 - 35
CP_Main.rc

@@ -13,7 +13,7 @@
 #undef APSTUDIO_READONLY_SYMBOLS
 
 /////////////////////////////////////////////////////////////////////////////
-// English (U.S.) resources
+// English (United States) resources
 
 #if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_ENU)
 LANGUAGE LANG_ENGLISH, SUBLANG_ENGLISH_US
@@ -271,6 +271,12 @@ BEGIN
             MENUITEM "Prompt for IP",               32839,MFT_STRING,MFS_ENABLED
         END
         MENUITEM "View Full Description",       32793,MFT_STRING,MFS_ENABLED
+        POPUP "Sticky Clips",                   65535,MFT_STRING,MFS_ENABLED
+        BEGIN
+            MENUITEM "Toggle Sticky",               ID_STICKYCLIPS_TOGGLESTICKY,MFT_STRING,MFS_ENABLED
+            MENUITEM "Move Up",                     ID_STICKYCLIPS_MOVEUP,MFT_STRING,MFS_ENABLED
+            MENUITEM "Move Down",                   ID_STICKYCLIPS_MOVEDOWN,MFT_STRING,MFS_ENABLED
+        END
         MENUITEM "View Groups",                 32819,MFT_STRING,MFS_ENABLED
         MENUITEM "Paste Plain Text Only",       32841,MFT_STRING,MFS_ENABLED
         MENUITEM MFT_SEPARATOR
@@ -414,42 +420,45 @@ FONT 8, "MS Shell Dlg", 0, 0, 0x1
 BEGIN
     CONTROL         "HotKey1",IDC_HOTKEY,"msctls_hotkey32",WS_BORDER | WS_TABSTOP,91,13,80,14
     CONTROL         "Win",IDC_CHECK_WIN_DITTO,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,174,13,33,14
-    CONTROL         "HotKey1",IDC_HOTKEY1,"msctls_hotkey32",WS_BORDER | WS_TABSTOP,66,64,80,14
-    CONTROL         "Win",IDC_CHECK_WIN1,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,146,64,33,14
-    CONTROL         "HotKey1",IDC_HOTKEY2,"msctls_hotkey32",WS_BORDER | WS_TABSTOP,66,79,80,14
-    CONTROL         "Win",IDC_CHECK_WIN2,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,146,79,33,14
-    CONTROL         "HotKey1",IDC_HOTKEY3,"msctls_hotkey32",WS_BORDER | WS_TABSTOP,66,94,80,14
-    CONTROL         "Win",IDC_CHECK_WIN3,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,147,94,33,14
-    CONTROL         "HotKey1",IDC_HOTKEY4,"msctls_hotkey32",WS_BORDER | WS_TABSTOP,66,109,80,14
-    CONTROL         "Win",IDC_CHECK_WIN4,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,146,109,33,14
-    CONTROL         "HotKey1",IDC_HOTKEY5,"msctls_hotkey32",WS_BORDER | WS_TABSTOP,66,124,80,14
-    CONTROL         "Win",IDC_CHECK_WIN5,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,146,124,33,14
-    CONTROL         "HotKey1",IDC_HOTKEY6,"msctls_hotkey32",WS_BORDER | WS_TABSTOP,229,64,80,14
-    CONTROL         "Win",IDC_CHECK_WIN6,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,309,64,27,14
-    CONTROL         "HotKey1",IDC_HOTKEY7,"msctls_hotkey32",WS_BORDER | WS_TABSTOP,229,79,80,14
-    CONTROL         "Win",IDC_CHECK_WIN7,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,309,79,26,14
-    CONTROL         "HotKey1",IDC_HOTKEY8,"msctls_hotkey32",WS_BORDER | WS_TABSTOP,229,94,80,14
-    CONTROL         "Win",IDC_CHECK_WIN8,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,310,94,26,14
-    CONTROL         "HotKey1",IDC_HOTKEY9,"msctls_hotkey32",WS_BORDER | WS_TABSTOP,229,109,80,14
-    CONTROL         "Win",IDC_CHECK_WIN9,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,309,109,27,14
-    CONTROL         "HotKey1",IDC_HOTKEY10,"msctls_hotkey32",WS_BORDER | WS_TABSTOP,229,124,80,14
-    CONTROL         "Win",IDC_CHECK_WIN10,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,309,124,27,14
-    GROUPBOX        "Global Hot Keys for Last Ten Items Copied",IDC_STATIC_GROUP,7,40,336,105
+    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
+    GROUPBOX        "Global Hot Keys for Last Ten Items Copied",IDC_STATIC_GROUP,7,56,336,105
     CONTROL         "Send Paste (Otherwise it will just load the item on the clipboard)",IDC_CHECK_SEND_PASTE,
-                    "Button",BS_AUTOCHECKBOX | WS_TABSTOP,19,50,324,13
+                    "Button",BS_AUTOCHECKBOX | WS_TABSTOP,19,66,324,13
     LTEXT           "Activate Ditto",IDC_STATIC_ACTIVATE,19,13,71,14,SS_CENTERIMAGE
-    RTEXT           "Position 1",IDC_STATIC_1,16,64,42,14,SS_CENTERIMAGE
-    RTEXT           "Position 2",IDC_STATIC_2,16,79,42,14,SS_CENTERIMAGE
-    RTEXT           "Position 3",IDC_STATIC_3,16,94,42,14,SS_CENTERIMAGE
-    RTEXT           "Position 4",IDC_STATIC_4,16,109,42,14,SS_CENTERIMAGE
-    RTEXT           "Position 5",IDC_STATIC_5,16,124,42,14,SS_CENTERIMAGE
-    RTEXT           "Position 6",IDC_STATIC_6,181,64,42,14,SS_CENTERIMAGE
-    RTEXT           "Position 7",IDC_STATIC_7,181,79,42,14,SS_CENTERIMAGE
-    RTEXT           "Position 8",IDC_STATIC_8,181,94,42,14,SS_CENTERIMAGE
-    RTEXT           "Position 9",IDC_STATIC_9,181,109,42,14,SS_CENTERIMAGE
-    RTEXT           "Position 10",IDC_STATIC_10,181,124,42,14,SS_CENTERIMAGE
-    LTEXT           "Check the ""Win"" Button to include the windows keyboard key in your hot key.",IDC_STATIC_WIN,7,149,336,25
+    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
     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
+    LTEXT           "Text Only Paste",IDC_STATIC_ACTIVATE2,19,33,71,14,SS_CENTERIMAGE
 END
 
 IDD_OPTIONS_GENERAL DIALOGEX 0, 0, 351, 259
@@ -1021,7 +1030,7 @@ BEGIN
     ID_BUTTON_CLOSE         "Close /t Escape"
 END
 
-#endif    // English (U.S.) resources
+#endif    // English (United States) resources
 /////////////////////////////////////////////////////////////////////////////
 
 

+ 4 - 19
CP_Main.vcxproj

@@ -460,6 +460,8 @@
     <ClCompile Include="MessagePumpThread.cpp" />
     <ClCompile Include="Popup.cpp" />
     <ClCompile Include="QPasteWndThread.cpp" />
+    <ClCompile Include="Shared\TextConvert.cpp" />
+    <ClCompile Include="Shared\Tokenizer.cpp" />
     <ClCompile Include="sqlite\CppSQLite3.cpp">
       <Optimization Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">Disabled</Optimization>
       <AdditionalIncludeDirectories Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
@@ -981,22 +983,6 @@
       <PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Unicode Release|Win32'">%(PreprocessorDefinitions)</PreprocessorDefinitions>
     </ClCompile>
     <ClCompile Include="TabCtrl.cpp" />
-    <ClCompile Include="TextConvert.cpp">
-      <Optimization Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">Disabled</Optimization>
-      <AdditionalIncludeDirectories Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
-      <PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">%(PreprocessorDefinitions)</PreprocessorDefinitions>
-      <BasicRuntimeChecks Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">EnableFastChecks</BasicRuntimeChecks>
-      <Optimization Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">MaxSpeed</Optimization>
-      <AdditionalIncludeDirectories Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
-      <PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">%(PreprocessorDefinitions)</PreprocessorDefinitions>
-      <Optimization Condition="'$(Configuration)|$(Platform)'=='Unicode Debug|Win32'">Disabled</Optimization>
-      <AdditionalIncludeDirectories Condition="'$(Configuration)|$(Platform)'=='Unicode Debug|Win32'">%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
-      <PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Unicode Debug|Win32'">%(PreprocessorDefinitions)</PreprocessorDefinitions>
-      <BasicRuntimeChecks Condition="'$(Configuration)|$(Platform)'=='Unicode Debug|Win32'">EnableFastChecks</BasicRuntimeChecks>
-      <Optimization Condition="'$(Configuration)|$(Platform)'=='Unicode Release|Win32'">MaxSpeed</Optimization>
-      <AdditionalIncludeDirectories Condition="'$(Configuration)|$(Platform)'=='Unicode Release|Win32'">%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
-      <PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Unicode Release|Win32'">%(PreprocessorDefinitions)</PreprocessorDefinitions>
-    </ClCompile>
     <ClCompile Include="Theme.cpp" />
     <ClCompile Include="AlphaBlend.cpp">
       <Optimization Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">Disabled</Optimization>
@@ -1142,7 +1128,6 @@
       <AdditionalIncludeDirectories Condition="'$(Configuration)|$(Platform)'=='Unicode Release|Win32'">%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
       <PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Unicode Release|Win32'">%(PreprocessorDefinitions)</PreprocessorDefinitions>
     </ClCompile>
-    <ClCompile Include="Tokenizer.cpp" />
     <ClCompile Include="ToolTipEx.cpp">
       <Optimization Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">Disabled</Optimization>
       <AdditionalIncludeDirectories Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
@@ -1314,7 +1299,8 @@
     <ClInclude Include="QPasteWndThread.h" />
     <ClInclude Include="RichEditCtrlEx.h" />
     <ClInclude Include="SearchEditBox.h" />
-    <ClInclude Include="Tokenizer.h" />
+    <ClInclude Include="Shared\TextConvert.h" />
+    <ClInclude Include="Shared\Tokenizer.h" />
     <ClInclude Include="ToolTipEx.h" />
     <ClInclude Include="WndEx.h" />
     <ClInclude Include="Client.h" />
@@ -1394,7 +1380,6 @@
     <ClInclude Include="StdAfx.h" />
     <ClInclude Include="SystemTray.h" />
     <ClInclude Include="TabCtrl.h" />
-    <ClInclude Include="TextConvert.h" />
     <ClInclude Include="Theme.h" />
     <ClInclude Include="UnicodeMacros.h" />
     <ClInclude Include="TinyXml\tinystr.h" />

+ 1 - 1
Client.cpp

@@ -5,7 +5,7 @@
 #include "stdafx.h"
 #include "cp_main.h"
 #include "Client.h"
-#include "TextConvert.h"
+#include "shared/TextConvert.h"
 #include "RecieveSocket.h"
 #include "FileRecieve.h"
 #include "FileTransferProgressDlg.h"

+ 2 - 2
Clip.cpp

@@ -8,7 +8,7 @@
 #include "DatabaseUtilities.h"
 #include "Crc32Dynamic.h"
 #include "sqlite\CppSQLite3.h"
-#include "TextConvert.h"
+#include "shared/TextConvert.h"
 #include "zlib/zlib.h"
 
 #include <Mmsystem.h>
@@ -605,7 +605,7 @@ 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');"),
+		cs.Format(_T("INSERT into Main values(NULL, %d, '%s', %d, %d, %d, %d, %d, '%s', NULL);"),
 							(long)m_Time.GetTime(),
 							m_Desc,
 							m_lShortCut,

+ 1 - 1
ClipIds.cpp

@@ -2,7 +2,7 @@
 #include "CP_Main.h"
 #include "ClipIds.h"
 #include "tinyxml.h"
-#include "TextConvert.h"
+#include "shared/TextConvert.h"
 #include "Clip_ImportExport.h"
 #include "CF_HDropAggregator.h"
 #include "CF_UnicodeTextAggregator.h"

+ 1 - 1
Clip_ImportExport.cpp

@@ -1,7 +1,7 @@
 #include "stdafx.h"
 #include "CP_Main.h"
 #include ".\clip_importexport.h"
-#include "TextConvert.h"
+#include "shared/TextConvert.h"
 #include "sqlite/CppSQLite3.h"
 #include "zlib/zlib.h"
 #include "Misc.h"

+ 42 - 0
ClipboardSaveRestore.cpp

@@ -82,5 +82,47 @@ bool CClipboardSaveRestore::Restore()
 		Log(_T("CClipboardSaveRestore::Restore failed to restore clipboard"));
 	}
 
+	return bRet;
+}
+
+bool CClipboardSaveRestore::RestoreTextOnly()
+{
+	bool bRet = false;
+
+	if(::OpenClipboard(theApp.m_MainhWnd))
+	{
+		::EmptyClipboard();
+
+		SetClipboardData(theApp.m_cfIgnoreClipboard, NewGlobalP("Ignore", sizeof("Ignore")));
+
+		int nSize = m_Clipboard.GetSize();
+		for(int nPos = 0; nPos < nSize; nPos++)
+		{
+			CClipFormat *pCF = &m_Clipboard.ElementAt(nPos);
+			if(pCF && pCF->m_hgData)
+			{
+				if(pCF->m_cfType == CF_TEXT || pCF->m_cfType == CF_UNICODETEXT)
+				{
+					//Make a copy of the data we are putting on the clipboard so we can still
+					//restore all clips later in Restore()
+					LPVOID localData = ::GlobalLock(pCF->m_hgData);
+
+					HGLOBAL newData = NewGlobalP(localData, ::GlobalSize(pCF->m_hgData));	
+					::SetClipboardData(pCF->m_cfType, newData);
+
+					::GlobalUnlock(pCF->m_hgData);
+				}
+			}
+		}
+
+		bRet = TRUE;
+		::CloseClipboard();
+	}
+
+	if(bRet == FALSE)
+	{
+		Log(_T("CClipboardSaveRestore::Restore failed to restore clipboard"));
+	}
+
 	return bRet;
 }

+ 1 - 0
ClipboardSaveRestore.h

@@ -11,6 +11,7 @@ public:
 	bool Save();
 	bool Restore();
 	void Clear()	{ m_Clipboard.RemoveAll(); }
+	bool RestoreTextOnly();
 
 	CClipFormats m_Clipboard;
 };

+ 3 - 1
DatabaseUtilities.cpp

@@ -190,7 +190,9 @@ BOOL CheckDBExists(CString csDBPath)
 			bRet = CreateDB(csDBPath);
 		}
 		else
+		{
 			bRet = TRUE;
+		}
 	}
 
 	if(bRet)
@@ -320,7 +322,7 @@ BOOL CreateDB(CString csFile)
 								_T("CRC INTEGER, ")
 								_T("bIsGroup INTEGER, ")
 								_T("lParentID INTEGER, ")
-								_T("QuickPasteText TEXT)"));
+								_T("QuickPasteText TEXT"));
 
 		db.execDML(_T("CREATE TABLE Data(")
 							_T("lID INTEGER PRIMARY KEY AUTOINCREMENT, ")

+ 1 - 1
DittoAddin.cpp

@@ -1,7 +1,7 @@
 #include "stdafx.h"
 #include "DittoAddin.h"
 #include "Misc.h"
-#include "TextConvert.h"
+#include "shared/TextConvert.h"
 
 CDittoAddin::CDittoAddin() :
 	m_hModule(NULL)

+ 1 - 1
DittoRulerRichEditCtrl.cpp

@@ -1,7 +1,7 @@
 #include "stdafx.h"
 #include "clip.h"
 #include "CP_Main.h"
-#include "TextConvert.h"
+#include "shared/TextConvert.h"
 #include ".\dittorulerricheditctrl.h"
 #include "CopyProperties.h"
 

+ 2 - 1
DittoSetup/Ditto.settings

@@ -3,4 +3,5 @@ SetCurrentDirectory = 1
 Portable = 1
 DisableRecieve = 1
 CheckForMaxEntries=1
-MaxEntries=100
+MaxEntries=100
+UseHookDllForFocus=0

+ 9 - 2
ExternalWindowTracker.cpp

@@ -119,10 +119,17 @@ bool ExternalWindowTracker::ActivateTarget()
 
 void ExternalWindowTracker::SendPaste(bool activateTarget)
 {
+	HWND activeWnd = m_activeWnd;
+
 	CSendKeys send;
 	send.AllKeysUp();
 
-	CString csPasteToApp = GetProcessName(m_activeWnd);
+	if(activateTarget == false)
+	{
+		activeWnd = ::GetForegroundWindow();
+	}
+
+	CString csPasteToApp = GetProcessName(activeWnd);
 	CString csPasteString = g_Opt.GetPasteString(csPasteToApp);
 	DWORD delay = g_Opt.SendKeysDelay();
 
@@ -130,7 +137,7 @@ void ExternalWindowTracker::SendPaste(bool activateTarget)
 	{
 		ActivateTarget();
 		theApp.PumpMessageEx();
-		WaitForActiveWnd(m_activeWnd, max(25, g_Opt.WaitForActiveWndTimeout()));
+		WaitForActiveWnd(activeWnd, max(25, g_Opt.WaitForActiveWndTimeout()));
 	}
 	else
 	{

+ 1 - 1
FileRecieve.cpp

@@ -6,7 +6,7 @@
 #include "cp_main.h"
 #include "FileRecieve.h"
 #include "RecieveSocket.h"
-#include "TextConvert.h"
+#include "shared/TextConvert.h"
 #include "Path.h"
 #include "UnicodeMacros.h"
 

+ 1 - 1
FileSend.cpp

@@ -6,7 +6,7 @@
 #include "cp_main.h"
 #include "FileSend.h"
 #include "Server.h"
-#include "TextConvert.h"
+#include "shared/TextConvert.h"
 
 #include <shlwapi.h>
 

+ 1 - 1
HTMLFormatAggregator.cpp

@@ -1,7 +1,7 @@
 #include "stdafx.h"
 #include ".\htmlformataggregator.h"
 #include "Misc.h"
-#include "Tokenizer.h"
+#include "shared/Tokenizer.h"
 
 CHTMLFormatAggregator::CHTMLFormatAggregator(CStringA csSepator) :
 	m_csSeparator(csSepator)

+ 1 - 1
HotKeys.h

@@ -1,6 +1,6 @@
 #pragma once
 
-#include "ArrayEx.h"
+#include "Shared/ArrayEx.h"
 
 class CHotKey
 {

+ 1 - 1
HyperLink.cpp

@@ -18,7 +18,7 @@
 
 #include "stdafx.h"
 #include "HyperLink.h"
-#include "TextConvert.h"
+#include "shared/TextConvert.h"
 
 #ifdef _DEBUG
 #define new DEBUG_NEW

+ 35 - 0
MainFrm.cpp

@@ -372,10 +372,36 @@ LRESULT CMainFrame::OnHotKey(WPARAM wParam, LPARAM lParam)
         Log(_T("Cut buffer 3 hot key"));
         theApp.m_CopyBuffer.StartCopy(2, true);
     }
+	else if(theApp.m_pTextOnlyPaste && wParam == theApp.m_pTextOnlyPaste->m_Atom)
+	{
+		DoTextOnlyPaste();
+	}
 
     return TRUE;
 }
 
+void CMainFrame::DoTextOnlyPaste()
+{
+	Log(_T("Text Only paste, saving clipboard to be restored later"));
+	m_textOnlyPaste.Save();
+
+	Log(_T("Text Only paste, Add cf_text or cf_unicodetext to clipboard"));
+	m_textOnlyPaste.RestoreTextOnly();
+
+	DWORD pasteDelay = g_Opt.GetTextOnlyPasteDelay();
+	DWORD restoreDelay = g_Opt.GetTextOnlyRestoreDelay();
+
+	Log(StrF(_T("Text Only paste, delaying %d ms before sending paste"), pasteDelay));
+
+	Sleep(pasteDelay);
+
+	Log(_T("Text Only paste, Sending paste"));
+	theApp.m_activeWnd.SendPaste(false);
+
+	Log(StrF(_T("Text Only paste, delaying %d ms before restoring clipboard to original state"), restoreDelay));
+	SetTimer(TEXT_ONLY_PASTE, restoreDelay, 0);
+}
+
 void CMainFrame::DoFirstTenPositionsPaste(int nPos)
 {
     try
@@ -506,6 +532,15 @@ void CMainFrame::OnTimer(UINT nIDEvent)
 	            theApp.m_activeWnd.TrackActiveWnd(m_tempFocusWnd);
 			}
             break;
+
+		case TEXT_ONLY_PASTE:
+			{
+				KillTimer(TEXT_ONLY_PASTE);
+
+				Log(_T("Text Only Paste, restoring original clipboard data"));
+				m_textOnlyPaste.Restore();
+			}
+			break;
     }
 
     CFrameWnd::OnTimer(nIDEvent);

+ 4 - 0
MainFrm.h

@@ -5,6 +5,7 @@
 #include "ToolTipEx.h"
 #include "EditFrameWnd.h"
 #include "MainFrmThread.h"
+#include "ClipboardSaveRestore.h"
 
 
 #define CLOSE_WINDOW_TIMER				1	
@@ -15,6 +16,7 @@
 #define KEY_STATE_MODIFIERS				8
 #define ACTIVE_WINDOW_TIMER				9
 #define FOCUS_CHANGED_TIMER				10
+#define TEXT_ONLY_PASTE					11
 
 class CMainFrame: public CFrameWnd
 {
@@ -58,6 +60,7 @@ public:
     short m_keyModifiersTimerCount;
     HWND m_tempFocusWnd;
     CMainFrmThread m_thread;
+	CClipboardSaveRestore m_textOnlyPaste;
 
     void DoDittoCopyBufferPaste(int nCopyBuffer);
     void DoFirstTenPositionsPaste(int nPos);
@@ -65,6 +68,7 @@ public:
     bool SaveQuickPasteEntry(CString csQuickPaste, CClipList *pClipList);
     void ShowErrorMessage(CString csTitle, CString csMessage);
     bool CloseAllOpenDialogs();
+	void DoTextOnlyPaste();
 
     void ShowEditWnd(CClipIDs &Ids);
     CEditFrameWnd *m_pEditFrameWnd;

+ 1 - 1
MainTableFunctions.cpp

@@ -5,7 +5,7 @@
 #include "stdafx.h"
 #include "cp_main.h"
 #include "MainTableFunctions.h"
-#include "Tokenizer.h"
+#include "shared/Tokenizer.h"
 
 #ifdef _DEBUG
 #undef THIS_FILE

+ 1 - 1
Misc.cpp

@@ -2,7 +2,7 @@
 #include "CP_Main.h"
 #include "Misc.h"
 #include "OptionsSheet.h"
-#include "TextConvert.h"
+#include "shared/TextConvert.h"
 #include "AlphaBlend.h"
 #include "Tlhelp32.h"
 

+ 1 - 1
Misc.h

@@ -6,7 +6,7 @@
 #pragma once
 #endif // _MSC_VER > 1000
 
-#include "ArrayEx.h"
+#include "Shared/ArrayEx.h"
 
 #define ONE_MINUTE				60000
 #define ONE_HOUR				3600000

+ 2 - 2
MultiLanguage.cpp

@@ -5,8 +5,8 @@
 #include "stdafx.h"
 #include "cp_main.h"
 #include "MultiLanguage.h"
-#include "TextConvert.h"
-#include "TextConvert.h"
+#include "shared/TextConvert.h"
+#include "shared/TextConvert.h"
 
 #ifdef _DEBUG
 #undef THIS_FILE

+ 1 - 1
OleClipSource.cpp

@@ -1,7 +1,7 @@
 #include "stdafx.h"
 #include "CP_Main.h"
 #include "OleClipSource.h"
-#include "TextConvert.h"
+#include "shared/TextConvert.h"
 #include "CF_HDropAggregator.h"
 #include "CF_UnicodeTextAggregator.h"
 #include "CF_TextAggregator.h"

+ 11 - 1
Options.cpp

@@ -2,7 +2,7 @@
 #include "Options.h"
 #include "AlphaBlend.h"
 #include "Misc.h"
-#include "TextConvert.h"
+#include "shared/TextConvert.h"
 #include "sqlite\CppSQLite3.h"
 #include "Path.h"
 
@@ -1923,4 +1923,14 @@ BOOL CGetSetOptions::GetConnectedToClipboard()
 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);
 }

+ 3 - 0
Options.h

@@ -391,6 +391,9 @@ public:
 
 	static BOOL		GetConnectedToClipboard();
 	static void		SetConnectedToClipboard(BOOL val);
+
+	static DWORD	GetTextOnlyRestoreDelay();
+	static DWORD 	GetTextOnlyPasteDelay();
 };
 
 // global for easy access and for initialization of fast access variables

+ 4 - 29
OptionsKeyBoard.cpp

@@ -46,6 +46,7 @@ void COptionsKeyBoard::DoDataExchange(CDataExchange* pDX)
 	DDX_Control(pDX, IDC_HOTKEY10, m_Ten);
 	DDX_Control(pDX, IDC_HOTKEY1, m_One);
 	DDX_Control(pDX, IDC_HOTKEY, m_HotKey);
+	DDX_Control(pDX, IDC_HOTKEY_TEXT_ONLY, m_TextOnlyKey);
 	//}}AFX_DATA_MAP
 	DDX_Control(pDX, IDC_STATIC_CUSTOM_KEYS, m_CustomeKeysHelp);
 }
@@ -80,6 +81,7 @@ BOOL COptionsKeyBoard::OnInitDialog()
 	theApp.m_pPosEight->CopyToCtrl(m_Eight, m_hWnd, IDC_CHECK_WIN8);
 	theApp.m_pPosNine->CopyToCtrl(m_Nine, m_hWnd, IDC_CHECK_WIN9);
 	theApp.m_pPosTen->CopyToCtrl(m_Ten, m_hWnd, IDC_CHECK_WIN10);
+	theApp.m_pTextOnlyPaste->CopyToCtrl(m_TextOnlyKey, m_hWnd, IDC_CHECK_WIN_TEXT_ONLY);
 
 	//Unregister hotkeys and Reregister them on cancel or ok
 	g_HotKeys.UnregisterAll();
@@ -88,20 +90,7 @@ BOOL COptionsKeyBoard::OnInitDialog()
 
 	m_HotKey.SetFocus();
 
-	theApp.m_Language.UpdateOptionShortcuts(this);
-
-	//A U3 device is unable to use the keyboard hooks, so named paste and copy 
-	//can't be used
-	if(g_Opt.m_bU3)
-	{
-		::ShowWindow(::GetDlgItem(m_hWnd, IDC_STATIC_NAMED_COPY), SW_HIDE);
-		::ShowWindow(::GetDlgItem(m_hWnd, IDC_STATIC_NAMED_COPY2), SW_HIDE);
-		::ShowWindow(::GetDlgItem(m_hWnd, IDC_NAMED_COPY), SW_HIDE);
-		::ShowWindow(::GetDlgItem(m_hWnd, IDC_NAMED_PASTE), SW_HIDE);
-		::ShowWindow(::GetDlgItem(m_hWnd, IDC_CHECK_WIN_NAMED_COPY), SW_HIDE);
-		::ShowWindow(::GetDlgItem(m_hWnd, IDC_CHECK_WIN_NAMED_PASTE), SW_HIDE);
-	}
-	
+	theApp.m_Language.UpdateOptionShortcuts(this);	
 		
 	return FALSE;
 }
@@ -138,6 +127,7 @@ BOOL COptionsKeyBoard::OnApply()
 	theApp.m_pPosEight->CopyFromCtrl(m_Eight, m_hWnd, IDC_CHECK_WIN8);
 	theApp.m_pPosNine->CopyFromCtrl(m_Nine, m_hWnd, IDC_CHECK_WIN9);
 	theApp.m_pPosTen->CopyFromCtrl(m_Ten, m_hWnd, IDC_CHECK_WIN10);
+	theApp.m_pTextOnlyPaste->CopyFromCtrl(m_TextOnlyKey, m_hWnd, IDC_CHECK_WIN_TEXT_ONLY);
 
 	ARRAY NewKeys;
 	g_HotKeys.GetKeys(NewKeys);
@@ -159,21 +149,6 @@ BOOL COptionsKeyBoard::OnApply()
 	return CPropertyPage::OnApply();
 }
 
-/*
-BOOL COptionsKeyBoard::ValidateHotKey(WORD wHotKey)
-{
-	ATOM id = GlobalAddAtom("HK_VALIDATE");
-	BOOL bResult = CGetSetOptions::RegisterHotKey(theApp.m_MainhWnd, wHotKey, FALSE);
-	
-	if(bResult)
-		UnregisterHotKey(GetSafeHwnd(), id);
-
-	GlobalDeleteAtom(id);
-
-	return bResult;
-}
-*/
-
 void COptionsKeyBoard::OnCancel() 
 {
 	g_HotKeys.RegisterAll( true );

+ 1 - 0
OptionsKeyBoard.h

@@ -39,6 +39,7 @@ public:
 	CHotKeyCtrl	m_Ten;
 	CHotKeyCtrl	m_One;
 	CHotKeyCtrl	m_HotKey;
+	CHotKeyCtrl m_TextOnlyKey;
 	//}}AFX_DATA
 
 

+ 1 - 1
OptionsTypes.cpp

@@ -4,7 +4,7 @@
 #include "stdafx.h"
 #include "CP_Main.h"
 #include "OptionsTypes.h"
-#include "ArrayEx.h"
+#include "Shared/ArrayEx.h"
 
 #ifdef _DEBUG
 #define new DEBUG_NEW

+ 1 - 1
ProcessPaste.h

@@ -9,7 +9,7 @@
 #pragma once
 #endif // _MSC_VER > 1000
 
-#include "ArrayEx.h"
+#include "Shared/ArrayEx.h"
 #include "Clip.h"
 #include "ClipIds.h"
 #include "OleClipSource.h"

+ 1 - 1
QListCtrl.h

@@ -6,7 +6,7 @@
 #endif // _MSC_VER > 1000
 // QListCtrl.h : header file
 //
-#include "ArrayEx.h"
+#include "Shared/ArrayEx.h"
 #include "ToolTipEx.h"
 #include "FormattedTextDraw.h"
 #include "sqlite/CppSQLite3.h"

+ 2 - 1
QPasteWnd.cpp

@@ -146,6 +146,7 @@ ON_UPDATE_COMMAND_UI(ID_MENU_DELETE, OnUpdateMenuDelete)
 ON_UPDATE_COMMAND_UI(ID_MENU_PROPERTIES, OnUpdateMenuProperties)
 ON_COMMAND(ID_QUICKOPTIONS_PROMPTTODELETECLIP, OnPromptToDeleteClip)
 ON_WM_DESTROY()
+
 //}}AFX_MSG_MAP
 ON_MESSAGE(NM_SELECT, OnListSelect)
 ON_MESSAGE(NM_END, OnListEnd)
@@ -915,7 +916,7 @@ BOOL CQPasteWnd::FillList(CString csSQLSearch /*=""*/)
 
     m_CritSection.Lock();
     //Format the count and select sql queries for the thread
-    m_CountSQL.Format(_T("SELECT COUNT(lID) FROM Main where %s ORDER by lDate"), strFilter);
+    m_CountSQL.Format(_T("SELECT COUNT(lID) FROM Main where %s"), strFilter);
 
     m_SQL.Format(_T("SELECT lID, mText, lParentID, lDontAutoDelete, ")_T("lShortCut, bIsGroup, QuickPasteText FROM Main where %s order by %s"), strFilter, csSort);
 

+ 1 - 1
RecieveSocket.cpp

@@ -3,7 +3,7 @@
 #include "Options.h"
 #include "Misc.h"
 #include "CP_Main.h"
-#include "TextConvert.h"
+#include "shared/TextConvert.h"
 
 CRecieveSocket::CRecieveSocket(SOCKET sock)
 {

+ 1 - 1
RichEditCtrlEx.cpp

@@ -3,7 +3,7 @@
 
 #include "stdafx.h"
 #include "RichEditCtrlEx.h"
-#include "TextConvert.h"
+#include "shared/TextConvert.h"
 
 #ifdef _DEBUG
 #define new DEBUG_NEW

+ 1 - 1
SendSocket.cpp

@@ -5,7 +5,7 @@
 #include "stdafx.h"
 #include "cp_main.h"
 #include "SendSocket.h"
-#include "TextConvert.h"
+#include "shared/TextConvert.h"
 
 #ifdef _DEBUG
 #undef THIS_FILE

+ 1 - 1
Server.h

@@ -2,7 +2,7 @@
 
 #include "Winsock2.h"
 #include "Encryption.h"
-#include "TextConvert.h"
+#include "shared/TextConvert.h"
 #include "RecieveSocket.h"
 #include "FileSend.h"
 #include "ServerDefines.h"

+ 2 - 2
Theme.cpp

@@ -1,9 +1,9 @@
 #include "stdafx.h"
 #include ".\theme.h"
-#include "TextConvert.h"
+#include "shared/TextConvert.h"
 #include "Misc.h"
 #include "Options.h"
-#include "Tokenizer.h"
+#include "shared/Tokenizer.h"
 
 CTheme::CTheme(void)
 {