Forráskód Böngészése

- Added global hot keys for the last 10 items copied
- Added back button when viewing groups
- Added menu options to set to
- Never Auto Delete
- Auto Delete
- Remove Hot key
- Fixed bug, when setting the group in the properties screen it was not setting the item to Never Auto Delete


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

sabrogden 21 éve
szülő
commit
a18846d36b
19 módosított fájl, 429 hozzáadás és 56 törlés
  1. 13 2
      CP_Main.cpp
  2. 4 0
      CP_Main.dsp
  3. 12 1
      CP_Main.h
  4. 54 7
      CP_Main.rc
  5. 1 0
      CopyProperties.cpp
  6. 88 2
      MainFrm.cpp
  7. 2 0
      MainFrm.h
  8. 24 10
      Misc.cpp
  9. 15 10
      Misc.h
  10. 1 1
      OptionsGeneral.cpp
  11. 51 12
      OptionsKeyBoard.cpp
  12. 11 0
      OptionsKeyBoard.h
  13. 2 1
      ProcessPaste.cpp
  14. 1 0
      ProcessPaste.h
  15. 113 6
      QPasteWnd.cpp
  16. 7 1
      QPasteWnd.h
  17. 8 0
      QuickPaste.cpp
  18. 1 0
      QuickPaste.h
  19. 21 3
      Resource.h

+ 13 - 2
CP_Main.cpp

@@ -123,6 +123,17 @@ void CCP_MainApp::AfterMainCreate()
 	// create hotkeys here.  They are automatically deleted on exit
 	m_pDittoHotKey = new CHotKey("DittoHotKey",704); //704 is ctrl-tilda
 	m_pCopyHotKey = new CHotKey("CopyHotKey");
+	m_pPosOne = new CHotKey("Position1", 0, true);
+	m_pPosTwo = new CHotKey("Position2", 0, true);
+	m_pPosThree = new CHotKey("Position3", 0, true);
+	m_pPosFour = new CHotKey("Position4", 0, true);
+	m_pPosFive = new CHotKey("Position5", 0, true);
+	m_pPosSix = new CHotKey("Position6", 0, true);
+	m_pPosSeven = new CHotKey("Position7", 0, true);
+	m_pPosEight = new CHotKey("Position8", 0, true);
+	m_pPosNine = new CHotKey("Position9", 0, true);
+	m_pPosTen = new CHotKey("Position10", 0, true);
+
 	g_HotKeys.RegisterAll();
 
 	// CopyThread initialization
@@ -205,9 +216,9 @@ bool CCP_MainApp::ReleaseFocus()
 }
 
 // sends Ctrl-V to the TargetWnd
-void CCP_MainApp::SendPaste()
+void CCP_MainApp::SendPaste(bool bActivateTarget)
 {
-	if( !ActivateTarget() )
+	if(bActivateTarget && !ActivateTarget())
 	{
 		SetStatus("SendPaste FAILED!",TRUE);
 		return;

+ 4 - 0
CP_Main.dsp

@@ -521,6 +521,10 @@ SOURCE=.\res\Ditto.ico
 # End Source File
 # Begin Source File
 
+SOURCE=.\res\open_fol.bmp
+# End Source File
+# Begin Source File
+
 SOURCE=.\res\Toolbar.bmp
 # End Source File
 # End Group

+ 12 - 1
CP_Main.h

@@ -54,6 +54,17 @@ public:
 	CHotKey*	m_pDittoHotKey; // activate ditto's qpaste window
 	CHotKey*	m_pCopyHotKey;  // named copy
 
+	CHotKey*	m_pPosOne;
+	CHotKey*	m_pPosTwo;
+	CHotKey*	m_pPosThree;
+	CHotKey*	m_pPosFour;
+	CHotKey*	m_pPosFive;
+	CHotKey*	m_pPosSix;
+	CHotKey*	m_pPosSeven;
+	CHotKey*	m_pPosEight;
+	CHotKey*	m_pPosNine;
+	CHotKey*	m_pPosTen;
+
 // Focus Tracking
 	HWND	m_hTargetWnd;
 //	HWND	m_hTargetFocus;
@@ -61,7 +72,7 @@ public:
 	bool ActivateTarget();
 	bool ReleaseFocus(); // activate the target only if we are the active window
 	CString GetTargetName() { return GetWndText( m_hTargetWnd ); }
-	void SendPaste(); // Activates the Target and sends Ctrl-V
+	void SendPaste(bool bActivateTarget); // Activates the Target and sends Ctrl-V
 
 	CLIPFORMAT m_cfIgnoreClipboard; // used by CClip::LoadFromClipboard
 

+ 54 - 7
CP_Main.rc

@@ -82,6 +82,9 @@ IDB_CLOSED_FOLDER_FOCUSED BITMAP  DISCARDABLE     "res\\bmp00001.bmp"
 IDB_OPEN_FOLDER         BITMAP  DISCARDABLE     "res\\bmp00002.bmp"
 IDB_OPEN_FOLDER_FOCUSED BITMAP  DISCARDABLE     "res\\open_fol.bmp"
 IDB_OPEN_FOLDER_PRESSED BITMAP  DISCARDABLE     "res\\bmp00003.bmp"
+IDB_BACK                BITMAP  DISCARDABLE     "res\\back.bmp"
+IDB_BACK_PRESSED        BITMAP  DISCARDABLE     "res\\back1.bmp"
+IDB_BACK_FOCUSED        BITMAP  DISCARDABLE     "res\\back2.bmp"
 
 /////////////////////////////////////////////////////////////////////////////
 //
@@ -259,6 +262,15 @@ BEGIN
         MENUITEM "Delete Entry\tDel",           ID_MENU_DELETE
         MENUITEM SEPARATOR
         MENUITEM "Properties\tAlt-Enter",       ID_MENU_PROPERTIES
+        POPUP "Quick Properties"
+        BEGIN
+            MENUITEM "Never Auto Delete",           ID_MENU_QUICKPROPERTIES_SETTONEVERAUTODELETE
+
+            MENUITEM "Auto Delete",                 ID_MENU_QUICKPROPERTIES_AUTODELETE
+
+            MENUITEM "Remove Hot Key",              ID_MENU_QUICKPROPERTIES_REMOVEHOTKEY
+
+        END
         MENUITEM SEPARATOR
         MENUITEM "Reconnect To Clipboard Chain", 
                                                 ID_MENU_RECONNECTTOCLIPBOARDCHAIN
@@ -368,17 +380,52 @@ BEGIN
     GROUPBOX        "List Item Prefix Legend",IDC_STATIC,11,127,116,50
 END
 
-IDD_OPTIONS_KEYSTROKES DIALOG DISCARDABLE  0, 0, 186, 90
+IDD_OPTIONS_KEYSTROKES DIALOG DISCARDABLE  0, 0, 302, 206
 STYLE DS_MODALFRAME | WS_POPUP | WS_CAPTION | WS_SYSMENU
 CAPTION "Keyboard Shortcuts"
 FONT 8, "MS Sans Serif"
 BEGIN
-    LTEXT           "Activate Ditto",IDC_STATIC,19,22,44,8
     CONTROL         "HotKey1",IDC_HOTKEY,"msctls_hotkey32",WS_BORDER | 
-                    WS_TABSTOP,71,19,80,14
+                    WS_TABSTOP,73,13,80,14
     CONTROL         "HotKey1",IDC_NAMED_COPY,"msctls_hotkey32",WS_BORDER | 
-                    WS_TABSTOP,72,39,80,14
-    LTEXT           "Named Copy",IDC_STATIC,19,42,42,8
+                    WS_TABSTOP,73,29,80,14
+    CONTROL         "Send Paste (Otherwise it will just load the item on the clipboard)",
+                    IDC_CHECK_SEND_PASTE,"Button",BS_AUTOCHECKBOX | 
+                    WS_TABSTOP,19,60,257,13
+    CONTROL         "HotKey1",IDC_HOTKEY1,"msctls_hotkey32",WS_BORDER | 
+                    WS_TABSTOP,66,74,80,14
+    CONTROL         "HotKey1",IDC_HOTKEY2,"msctls_hotkey32",WS_BORDER | 
+                    WS_TABSTOP,66,89,80,14
+    CONTROL         "HotKey1",IDC_HOTKEY3,"msctls_hotkey32",WS_BORDER | 
+                    WS_TABSTOP,66,104,80,14
+    CONTROL         "HotKey1",IDC_HOTKEY4,"msctls_hotkey32",WS_BORDER | 
+                    WS_TABSTOP,66,119,80,14
+    CONTROL         "HotKey1",IDC_HOTKEY5,"msctls_hotkey32",WS_BORDER | 
+                    WS_TABSTOP,66,134,80,14
+    CONTROL         "HotKey1",IDC_HOTKEY6,"msctls_hotkey32",WS_BORDER | 
+                    WS_TABSTOP,203,74,80,14
+    CONTROL         "HotKey1",IDC_HOTKEY7,"msctls_hotkey32",WS_BORDER | 
+                    WS_TABSTOP,203,89,80,14
+    CONTROL         "HotKey1",IDC_HOTKEY8,"msctls_hotkey32",WS_BORDER | 
+                    WS_TABSTOP,203,104,80,14
+    CONTROL         "HotKey1",IDC_HOTKEY9,"msctls_hotkey32",WS_BORDER | 
+                    WS_TABSTOP,203,119,80,14
+    CONTROL         "HotKey1",IDC_HOTKEY10,"msctls_hotkey32",WS_BORDER | 
+                    WS_TABSTOP,203,134,80,14
+    LTEXT           "Activate Ditto",IDC_STATIC,19,16,44,8
+    LTEXT           "Named Copy",IDC_STATIC,19,34,42,8
+    LTEXT           "Position 1",IDC_STATIC,19,74,32,14,SS_CENTERIMAGE
+    LTEXT           "Position 2",IDC_STATIC,19,89,32,14,SS_CENTERIMAGE
+    LTEXT           "Position 3",IDC_STATIC,19,104,32,14,SS_CENTERIMAGE
+    LTEXT           "Position 4",IDC_STATIC,19,119,32,14,SS_CENTERIMAGE
+    LTEXT           "Position 5",IDC_STATIC,19,134,32,14,SS_CENTERIMAGE
+    LTEXT           "Position 6",IDC_STATIC,158,74,32,14,SS_CENTERIMAGE
+    LTEXT           "Position 7",IDC_STATIC,158,89,32,14,SS_CENTERIMAGE
+    LTEXT           "Position 8",IDC_STATIC,158,104,32,14,SS_CENTERIMAGE
+    LTEXT           "Position 9",IDC_STATIC,158,119,32,14,SS_CENTERIMAGE
+    LTEXT           "Position 10",IDC_STATIC,158,134,36,14,SS_CENTERIMAGE
+    GROUPBOX        "Global Hot Keys for Last Ten Items Copied",IDC_STATIC,7,
+                    49,288,106
 END
 
 IDD_OPTIONS_GENERAL DIALOG DISCARDABLE  0, 0, 294, 178
@@ -619,9 +666,9 @@ BEGIN
     IDD_OPTIONS_KEYSTROKES, DIALOG
     BEGIN
         LEFTMARGIN, 7
-        RIGHTMARGIN, 179
+        RIGHTMARGIN, 295
         TOPMARGIN, 7
-        BOTTOMMARGIN, 83
+        BOTTOMMARGIN, 199
     END
 
     IDD_OPTIONS_GENERAL, DIALOG

+ 1 - 0
CopyProperties.cpp

@@ -222,6 +222,7 @@ void CCopyProperties::OnOK()
 				m_MainTable.Edit();
 		
 			m_MainTable.m_lParentID = nParentID;
+			m_MainTable.m_lDontAutoDelete = (long)CTime::GetCurrentTime().GetTime();
 
 			m_lGroupChangedTo = nParentID;
 

+ 88 - 2
MainFrm.cpp

@@ -171,12 +171,12 @@ void CMainFrame::OnFirstExit()
 
 LRESULT CMainFrame::OnHotKey(WPARAM wParam, LPARAM lParam)
 {
-	if( wParam == theApp.m_pDittoHotKey->m_Atom )
+	if(wParam == theApp.m_pDittoHotKey->m_Atom)
 	{
 		theApp.TargetActiveWindow();
 		QuickPaste.ShowQPasteWnd(this);
 	}
-	else if( wParam == theApp.m_pCopyHotKey->m_Atom )
+	else if(wParam == theApp.m_pCopyHotKey->m_Atom)
 	{
 		theApp.TargetActiveWindow();
 
@@ -189,10 +189,96 @@ LRESULT CMainFrame::OnHotKey(WPARAM wParam, LPARAM lParam)
 		keybd_event('C', 0, KEYEVENTF_EXTENDEDKEY | KEYEVENTF_KEYUP, 0);
 		keybd_event(VK_CONTROL, 0, KEYEVENTF_EXTENDEDKEY | KEYEVENTF_KEYUP, 0);
 	}
+	else if(wParam == theApp.m_pPosOne->m_Atom)
+	{
+		DoFirstTenPositionsPaste(1);
+	}
+	else if(wParam == theApp.m_pPosTwo->m_Atom)
+	{
+		DoFirstTenPositionsPaste(2);
+	}
+	else if(wParam == theApp.m_pPosThree->m_Atom)
+	{
+		DoFirstTenPositionsPaste(3);
+	}	
+	else if(wParam == theApp.m_pPosFour->m_Atom)
+	{
+		DoFirstTenPositionsPaste(4);
+	}
+	else if(wParam == theApp.m_pPosFive->m_Atom)
+	{
+		DoFirstTenPositionsPaste(5);
+	}
+	else if(wParam == theApp.m_pPosSix->m_Atom)
+	{
+		DoFirstTenPositionsPaste(6);
+	}
+	else if(wParam == theApp.m_pPosSeven->m_Atom)
+	{
+		DoFirstTenPositionsPaste(7);
+	}
+	else if(wParam == theApp.m_pPosEight->m_Atom)
+	{
+		DoFirstTenPositionsPaste(8);
+	}
+	else if(wParam == theApp.m_pPosNine->m_Atom)
+	{
+		DoFirstTenPositionsPaste(9);
+	}
+	else if(wParam == theApp.m_pPosTen->m_Atom)
+	{
+		DoFirstTenPositionsPaste(10);
+	}
 
 	return TRUE;
 }
 
+void CMainFrame::DoFirstTenPositionsPaste(int nPos)
+{
+	try
+	{
+		CMainTable Recset;
+		Recset.m_strSort = "bIsGroup DESC, lDate DESC";
+		Recset.m_strFilter = "((bIsGroup = TRUE AND lParentID = 0) OR bIsGroup = FALSE)";
+
+		Recset.Open("");
+
+		if(!Recset.IsEOF())
+		{
+			Recset.MoveLast();
+
+			if(Recset.GetRecordCount() > nPos)
+			{
+				Recset.SetAbsolutePosition(nPos-1);
+				if(Recset.m_bIsGroup == FALSE)
+				{	
+					//Don't move these to the top
+					BOOL bItWas = g_Opt.m_bUpdateTimeOnPaste;
+					g_Opt.m_bUpdateTimeOnPaste = FALSE;
+
+					CProcessPaste paste;
+					paste.GetClipIDs().Add(Recset.m_lID);
+					paste.m_bActivateTarget = false;
+					paste.m_bSendPaste = g_Opt.m_bSendPasteOnFirstTenHotKeys ? true : false;
+					paste.DoPaste();
+					theApp.OnPasteCompleted();
+
+					g_Opt.m_bUpdateTimeOnPaste = bItWas;
+				}
+			}
+		}
+	}
+	catch(CDaoException* e)
+	{
+		AfxMessageBox(e->m_pErrorInfo->m_strDescription);
+		ASSERT(0);
+		e->Delete();
+	}
+
+	
+
+}
+
 void CMainFrame::OnTimer(UINT nIDEvent) 
 {
 	switch(nIDEvent)

+ 2 - 0
MainFrm.h

@@ -56,6 +56,8 @@ public:
 	CSystemTray m_TrayIcon;
 	ULONG m_ulCopyGap;
 
+	void DoFirstTenPositionsPaste(int nPos);
+
 // Generated message map functions
 protected:
 	//{{AFX_MSG(CMainFrame)

+ 24 - 10
Misc.cpp

@@ -417,6 +417,7 @@ BOOL CGetSetOptions::m_bDescShowLeadingWhiteSpace;
 BOOL CGetSetOptions::m_bAllwaysShowDescription;
 long CGetSetOptions::m_bDoubleClickingOnCaptionDoes;
 BOOL CGetSetOptions::m_bPrompForNewGroupName;
+BOOL CGetSetOptions::m_bSendPasteOnFirstTenHotKeys;
 
 CGetSetOptions g_Opt;
 
@@ -434,6 +435,7 @@ CGetSetOptions::CGetSetOptions()
 	m_bAllwaysShowDescription = GetAllwaysShowDescription();
 	m_bDoubleClickingOnCaptionDoes = GetDoubleClickingOnCaptionDoes();
 	m_bPrompForNewGroupName = GetPrompForNewGroupName();
+	m_bSendPasteOnFirstTenHotKeys = GetSendPasteOnFirstTenHotKeys();
 }
 
 CGetSetOptions::~CGetSetOptions()
@@ -902,12 +904,15 @@ long CGetSetOptions::GetDoubleClickingOnCaptionDoes()				{	return GetProfileLong
 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); }
 
 /*------------------------------------------------------------------*\
 CHotKey - a single system-wide hotkey
 \*------------------------------------------------------------------*/
 
-CHotKey::CHotKey( CString name, DWORD defKey ) : m_Name(name), m_bIsRegistered(false)
+CHotKey::CHotKey( CString name, DWORD defKey, bool bUnregOnShowDitto ) 
+: m_Name(name), m_bIsRegistered(false), m_bUnRegisterOnShowDitto(bUnregOnShowDitto)
 {
 	m_Atom = ::GlobalAddAtom( m_Name );
 	ASSERT( m_Atom );
@@ -974,22 +979,31 @@ bool CHotKey::Register()
 {
 	if( m_Key )
 	{
-		ASSERT( g_HotKeys.m_hWnd );
-		m_bIsRegistered = ::RegisterHotKey(	g_HotKeys.m_hWnd,
-			m_Atom,
-			GetModifier(),
-			LOBYTE(m_Key) ) == TRUE;
+		if(m_bIsRegistered == false)
+		{
+			ASSERT( g_HotKeys.m_hWnd );
+			m_bIsRegistered = ::RegisterHotKey(	g_HotKeys.m_hWnd,
+				m_Atom,
+				GetModifier(),
+				LOBYTE(m_Key) ) == TRUE;
+		}
 	}
 	else
 		m_bIsRegistered = true;
 	
 	return m_bIsRegistered;
 }
-bool CHotKey::Unregister()
+bool CHotKey::Unregister(bool bOnShowingDitto)
 {
 	if( !m_bIsRegistered )
 		return true;
 	
+	if(bOnShowingDitto)
+	{
+		if(m_bUnRegisterOnShowDitto == false)
+			return true;
+	}
+
 	if(m_Key)
 	{
 		ASSERT(g_HotKeys.m_hWnd);
@@ -1087,7 +1101,7 @@ void CHotKeys::RegisterAll( bool bMsgOnError )
 	}
 }
 
-void CHotKeys::UnregisterAll( bool bMsgOnError )
+void CHotKeys::UnregisterAll(bool bMsgOnError, bool bOnShowDitto)
 {
 	CString str;
 	CHotKey* pHotKey;
@@ -1095,7 +1109,7 @@ void CHotKeys::UnregisterAll( bool bMsgOnError )
 	for( int i=0; i < count; i++ )
 	{
 		pHotKey = ElementAt(i);
-		if( !pHotKey->Unregister() )
+		if(!pHotKey->Unregister(bOnShowDitto))
 		{
 			str =  "Error Unregistering ";
 			str += pHotKey->GetName();
@@ -1149,7 +1163,7 @@ bool CHotKeys::FindFirstConflict( ARRAY& keys, int* pX, int* pY )
 	if( bConflict )
 	{
 		if( pX )
-			*pX = i;
+			*pX = i-1;
 		if( pY )
 			*pY = j;
 	}

+ 15 - 10
Misc.h

@@ -188,27 +188,27 @@ public:
 	static BOOL		GetCheckForUpdates();
 	static BOOL		SetCheckForUpdates(BOOL bCheck);
 
-	static BOOL	m_bUseCtrlNumAccel;
+	static BOOL		m_bUseCtrlNumAccel;
 	static void		SetUseCtrlNumForFirstTenHotKeys(BOOL bVal);
 	static BOOL		GetUseCtrlNumForFirstTenHotKeys();
 
-	static BOOL	m_bAllowDuplicates;
+	static BOOL		m_bAllowDuplicates;
 	static void		SetAllowDuplicates(BOOL bVal);
 	static BOOL		GetAllowDuplicates();
 
-	static BOOL	m_bUpdateTimeOnPaste;
+	static BOOL		m_bUpdateTimeOnPaste;
 	static void		SetUpdateTimeOnPaste(BOOL bVal);
 	static BOOL		GetUpdateTimeOnPaste();
 
-	static BOOL	m_bSaveMultiPaste;
+	static BOOL		m_bSaveMultiPaste;
 	static void		SetSaveMultiPaste(BOOL bVal);
 	static BOOL		GetSaveMultiPaste();
 
-	static BOOL	m_bShowPersistent;
+	static BOOL		m_bShowPersistent;
 	static void		SetShowPersistent(BOOL bVal);
 	static BOOL		GetShowPersistent();
 
-	static BOOL	m_bHistoryStartTop;
+	static BOOL		m_bHistoryStartTop;
 	static void		SetHistoryStartTop(BOOL bVal);
 	static BOOL		GetHistoryStartTop();
 
@@ -244,6 +244,10 @@ public:
 	static void		SetPrompForNewGroupName(BOOL bOption);
 	static BOOL		GetPrompForNewGroupName();
 
+	static BOOL		m_bSendPasteOnFirstTenHotKeys;
+	static void		SetSendPasteOnFirstTenHotKeys(BOOL bOption);
+	static BOOL		GetSendPasteOnFirstTenHotKeys();
+
 
 	/*
 	BOOL IsAutoRun();
@@ -267,8 +271,9 @@ public:
 	ATOM	m_Atom;
 	DWORD	m_Key; //704 is ctrl-tilda
 	bool	m_bIsRegistered;
+	bool	m_bUnRegisterOnShowDitto;
 	
-	CHotKey( CString name, DWORD defKey = 0 );
+	CHotKey( CString name, DWORD defKey = 0, bool bUnregOnShowDitto = false );
 	~CHotKey();
 
 	bool	IsRegistered() { return m_bIsRegistered; }
@@ -291,7 +296,7 @@ public:
 	UINT GetModifier() { return GetModifier(m_Key); }
 
 	bool Register();
-	bool Unregister();
+	bool Unregister(bool bOnShowingDitto = false);
 };
 
 
@@ -316,8 +321,8 @@ public:
 	void LoadAllKeys();
 	void SaveAllKeys();
 
-	void RegisterAll( bool bMsgOnError = false );
-	void UnregisterAll( bool bMsgOnError = false );
+	void RegisterAll(bool bMsgOnError = false);
+	void UnregisterAll(bool bMsgOnError = false, bool bOnShowDitto = false);
 
 	void GetKeys( ARRAY& keys );
 	void SetKeys( ARRAY& keys, bool bSave = false ); // caution! this alters hotkeys based upon corresponding indexes

+ 1 - 1
OptionsGeneral.cpp

@@ -1,4 +1,4 @@
-// OptionsGeneral.cpp : implementation file
+	// OptionsGeneral.cpp : implementation file
 //
 
 #include "stdafx.h"

+ 51 - 12
OptionsKeyBoard.cpp

@@ -19,7 +19,6 @@ IMPLEMENT_DYNCREATE(COptionsKeyBoard, CPropertyPage)
 COptionsKeyBoard::COptionsKeyBoard() : CPropertyPage(COptionsKeyBoard::IDD)
 {
 	//{{AFX_DATA_INIT(COptionsKeyBoard)
-		// NOTE: the ClassWizard will add member initialization here
 	//}}AFX_DATA_INIT
 }
 
@@ -31,6 +30,17 @@ void COptionsKeyBoard::DoDataExchange(CDataExchange* pDX)
 {
 	CPropertyPage::DoDataExchange(pDX);
 	//{{AFX_DATA_MAP(COptionsKeyBoard)
+	DDX_Control(pDX, IDC_CHECK_SEND_PASTE, m_btSendPaste);
+	DDX_Control(pDX, IDC_HOTKEY9, m_Nine);
+	DDX_Control(pDX, IDC_HOTKEY8, m_Eight);
+	DDX_Control(pDX, IDC_HOTKEY7, m_Seven);
+	DDX_Control(pDX, IDC_HOTKEY6, m_Six);
+	DDX_Control(pDX, IDC_HOTKEY5, m_Five);
+	DDX_Control(pDX, IDC_HOTKEY4, m_Four);
+	DDX_Control(pDX, IDC_HOTKEY3, m_Three);
+	DDX_Control(pDX, IDC_HOTKEY2, m_Two);
+	DDX_Control(pDX, IDC_HOTKEY10, m_Ten);
+	DDX_Control(pDX, IDC_HOTKEY1, m_One);
 	DDX_Control(pDX, IDC_NAMED_COPY, m_NamedCopy);
 	DDX_Control(pDX, IDC_HOTKEY, m_HotKey);
 	//}}AFX_DATA_MAP
@@ -53,9 +63,22 @@ BOOL COptionsKeyBoard::OnInitDialog()
 	theApp.m_pDittoHotKey->CopyToCtrl( m_HotKey );
 	theApp.m_pCopyHotKey->CopyToCtrl( m_NamedCopy );
 
+	theApp.m_pPosOne->CopyToCtrl( m_One );
+	theApp.m_pPosTwo->CopyToCtrl( m_Two );
+	theApp.m_pPosThree->CopyToCtrl( m_Three );
+	theApp.m_pPosFour->CopyToCtrl( m_Four );
+	theApp.m_pPosFive->CopyToCtrl( m_Five );
+	theApp.m_pPosSix->CopyToCtrl( m_Six );
+	theApp.m_pPosSeven->CopyToCtrl( m_Seven );
+	theApp.m_pPosEight->CopyToCtrl( m_Eight );
+	theApp.m_pPosNine->CopyToCtrl( m_Nine );
+	theApp.m_pPosTen->CopyToCtrl( m_Ten );
+
 	//Unregister hotkeys and Reregister them on cancel or ok
 	g_HotKeys.UnregisterAll();
 
+	m_btSendPaste.SetCheck(g_Opt.m_bSendPasteOnFirstTenHotKeys);
+
 	m_HotKey.SetFocus();
 
 	return FALSE;
@@ -73,16 +96,32 @@ BOOL COptionsKeyBoard::OnWizardFinish()
 
 BOOL COptionsKeyBoard::OnApply()
 {
-int x,y;
-CString str;
-ARRAY keys;
-
+	CGetSetOptions::SetSendPasteOnFirstTenHotKeys(m_btSendPaste.GetCheck());
+					
+	int x,y;
+	CString str;
+	ARRAY keys;
+	
 	g_HotKeys.GetKeys( keys ); // save old keys just in case new ones are invalid
-
-	theApp.m_pDittoHotKey->CopyFromCtrl( m_HotKey );
-	theApp.m_pCopyHotKey->CopyFromCtrl( m_NamedCopy );
-
-	if( g_HotKeys.FindFirstConflict(keys,&x,&y) )
+	
+	theApp.m_pDittoHotKey->CopyFromCtrl(m_HotKey);
+	theApp.m_pCopyHotKey->CopyFromCtrl(m_NamedCopy);
+	
+	theApp.m_pPosOne->CopyFromCtrl(m_One);
+	theApp.m_pPosTwo->CopyFromCtrl(m_Two);
+	theApp.m_pPosThree->CopyFromCtrl(m_Three);
+	theApp.m_pPosFour->CopyFromCtrl(m_Four);
+	theApp.m_pPosFive->CopyFromCtrl(m_Five);
+	theApp.m_pPosSix->CopyFromCtrl(m_Six);
+	theApp.m_pPosSeven->CopyFromCtrl(m_Seven);
+	theApp.m_pPosEight->CopyFromCtrl(m_Eight);
+	theApp.m_pPosNine->CopyFromCtrl(m_Nine);
+	theApp.m_pPosTen->CopyFromCtrl(m_Ten);
+
+	ARRAY NewKeys;
+	g_HotKeys.GetKeys(NewKeys);
+	
+	if( g_HotKeys.FindFirstConflict(NewKeys, &x, &y) )
 	{
 		str =  g_HotKeys.ElementAt(x)->GetName();
 		str += " and ";
@@ -92,10 +131,10 @@ ARRAY keys;
 		g_HotKeys.SetKeys( keys ); // restore the original values
 		return FALSE;
 	}
-
+	
 	g_HotKeys.SaveAllKeys();
 	g_HotKeys.RegisterAll(true);
-		
+	
 	return CPropertyPage::OnApply();
 }
 

+ 11 - 0
OptionsKeyBoard.h

@@ -25,6 +25,17 @@ public:
 // Dialog Data
 	//{{AFX_DATA(COptionsKeyBoard)
 	enum { IDD = IDD_OPTIONS_KEYSTROKES };
+	CButton	m_btSendPaste;
+	CHotKeyCtrl	m_Nine;
+	CHotKeyCtrl	m_Eight;
+	CHotKeyCtrl	m_Seven;
+	CHotKeyCtrl	m_Six;
+	CHotKeyCtrl	m_Five;
+	CHotKeyCtrl	m_Four;
+	CHotKeyCtrl	m_Three;
+	CHotKeyCtrl	m_Two;
+	CHotKeyCtrl	m_Ten;
+	CHotKeyCtrl	m_One;
 	CHotKeyCtrl	m_NamedCopy;
 	CHotKeyCtrl	m_HotKey;
 	//}}AFX_DATA

+ 2 - 1
ProcessPaste.cpp

@@ -783,6 +783,7 @@ CProcessPaste::CProcessPaste()
 {
 	m_pOle = new COleClipSource;
 	m_bSendPaste = true;
+	m_bActivateTarget = true;
 }
 
 CProcessPaste::~CProcessPaste()
@@ -811,7 +812,7 @@ BOOL CProcessPaste::DoPaste()
 		m_pOle = NULL; // m_pOle should not be accessed past this point
 		
 		if(m_bSendPaste)
-			theApp.SendPaste();
+			theApp.SendPaste(m_bActivateTarget);
 		
 		return TRUE;
 	}

+ 1 - 0
ProcessPaste.h

@@ -113,6 +113,7 @@ class CProcessPaste
 public:
 	COleClipSource*	m_pOle;
 	bool m_bSendPaste;
+	bool m_bActivateTarget;
 
 	CProcessPaste();
 	~CProcessPaste();

+ 113 - 6
QPasteWnd.cpp

@@ -23,6 +23,7 @@ static char THIS_FILE[] = __FILE__;
 #define ID_GROUP_TEXT			0x204
 #define ID_SHOW_GROUPS_BOTTOM	0x205
 #define ID_SHOW_GROUPS_TOP		0x206
+#define ID_BACK_BUTTON			0x207
 
 
 #define QPASTE_WIDTH			200
@@ -89,7 +90,11 @@ ON_COMMAND(ID_MENU_QUICKOPTIONS_PROMPTFORNEWGROUPNAMES, OnMenuQuickoptionsPrompt
 ON_BN_CLICKED(ID_SHOW_GROUPS_BOTTOM, OnShowGroupsBottom)
 ON_BN_CLICKED(ID_SHOW_GROUPS_TOP, OnShowGroupsTop)
 ON_COMMAND(ID_MENU_VIEWGROUPS, OnMenuViewgroups)
-//}}AFX_MSG_MAP
+	ON_COMMAND(ID_MENU_QUICKPROPERTIES_SETTONEVERAUTODELETE, OnMenuQuickpropertiesSettoneverautodelete)
+	ON_COMMAND(ID_MENU_QUICKPROPERTIES_AUTODELETE, OnMenuQuickpropertiesAutodelete)
+	ON_COMMAND(ID_MENU_QUICKPROPERTIES_REMOVEHOTKEY, OnMenuQuickpropertiesRemovehotkey)
+	ON_UPDATE_COMMAND_UI(ID_MENU_GROUPS_MOVETOTHEGROUP_BLANK, OnUpdateMenuGroupsMovetothegroupBlank)
+	//}}AFX_MSG_MAP
 ON_MESSAGE(NM_SELECT, OnListSelect)
 ON_MESSAGE(NM_END, OnListEnd)
 ON_MESSAGE(CB_SEARCH, OnSearch)
@@ -113,6 +118,7 @@ ON_COMMAND(ID_SORT_DESCENDING, OnSortDescending)
 ON_COMMAND(ID_MENU_NEWGROUP, OnMenuNewGroup)
 ON_COMMAND(ID_MENU_NEWGROUPSELECTION, OnMenuNewGroupSelection)
 ON_MESSAGE(NM_GROUP_TREE_MESSAGE, OnGroupTreeMessage)
+ON_COMMAND(ID_BACK_BUTTON, OnBackButton)
 END_MESSAGE_MAP()
 
 
@@ -158,6 +164,10 @@ int CQPasteWnd::OnCreate(LPCREATESTRUCT lpCreateStruct)
 	m_ShowGroupsFolderTop.Create(NULL, WS_CHILD | BS_OWNERDRAW | WS_TABSTOP, CRect(0, 0, 0, 0), this, ID_SHOW_GROUPS_TOP);
 	m_ShowGroupsFolderTop.LoadBitmaps(IDB_OPEN_FOLDER, IDB_OPEN_FOLDER_PRESSED, IDB_OPEN_FOLDER_FOCUSED);
 	m_ShowGroupsFolderTop.ShowWindow(SW_SHOW);
+
+	m_BackButton.Create(NULL, WS_CHILD | BS_OWNERDRAW | WS_TABSTOP, CRect(0, 0, 0, 0), this, ID_BACK_BUTTON);
+	m_BackButton.LoadBitmaps(IDB_BACK, IDB_BACK_PRESSED, IDB_BACK_FOCUSED);
+	m_BackButton.ShowWindow(SW_SHOW);
 	
 	m_btCancel.Create("&C", WS_CHILD|BS_PUSHBUTTON|WS_TABSTOP/*|BS_FLAT*/, CRect(0, 0, 0, 0), this, ID_CANCEL);
 	
@@ -222,12 +232,17 @@ void CQPasteWnd::MoveControls()
 	{
 		m_stGroup.ShowWindow(SW_SHOW);
 		m_ShowGroupsFolderTop.ShowWindow(SW_SHOW);
-		m_stGroup.MoveWindow(22, 0, cx, 16);
-		m_ShowGroupsFolderTop.MoveWindow(0, 0, 18, 16);
+		m_BackButton.ShowWindow(SW_SHOW);
+
+		m_BackButton.MoveWindow(0, 0, 18, 16);
+		m_ShowGroupsFolderTop.MoveWindow(22, 0, 18, 16);
+		m_stGroup.MoveWindow(44, 0, cx, 16);
+		
 		lTopOfListBox = 16;	
 	}
 	else
 	{
+		m_BackButton.ShowWindow(SW_HIDE);
 		m_stGroup.ShowWindow(SW_HIDE);
 		m_ShowGroupsFolderTop.ShowWindow(SW_HIDE);
 	}
@@ -275,14 +290,24 @@ void CQPasteWnd::OnActivate(UINT nState, CWnd* pWndOther, BOOL bMinimized)
 	if (nState == WA_INACTIVE)
 	{
 		TRACE("WA_INACTIVE\n");
-		if( !g_Opt.m_bShowPersistent )
+		if(!g_Opt.m_bShowPersistent)
+		{
 			HideQPasteWindow();
+		}
+		//re register the global hot keys for the last ten
+		if(theApp.m_bAppExiting == false)
+			g_HotKeys.RegisterAll();
 	}
 	else if (nState == WA_ACTIVE || nState == WA_CLICKACTIVE)
 	{
 		TRACE("WA_ACTIVE\n");
-		if( !theApp.m_bShowingQuickPaste )
+		if(!theApp.m_bShowingQuickPaste)
+		{
 			ShowQPasteWindow();
+		}
+
+		//Unregister the global hot keys for the last ten copies
+		g_HotKeys.UnregisterAll(false, true);
 	}
 }
 
@@ -290,6 +315,7 @@ BOOL CQPasteWnd::HideQPasteWindow()
 {
 	if( !theApp.m_bShowingQuickPaste || m_cbSearch.GetShowingDropDown() )
 		return FALSE;
+
 	//Reset the flag
 	theApp.m_bShowingQuickPaste = false;
 	theApp.ReleaseFocus();
@@ -705,7 +731,7 @@ void CQPasteWnd::OnRclickQuickPaste(NMHDR* pNMHDR, LRESULT* pResult)
 		cmSubMenu = cmPopUp.GetSubMenu(0);
 		if(!cmSubMenu)
 			return;
-		
+
 		SetMenuChecks(cmSubMenu);
 		
 		m_lstHeader.m_Popup.Hide();
@@ -1132,7 +1158,75 @@ void CQPasteWnd::OnMenuViewgroups()
 	OnShowGroupsTop();
 }
 
+void CQPasteWnd::OnMenuQuickpropertiesSettoneverautodelete() 
+{
+	CWaitCursor wait;
+	ARRAY IDs;
+	m_lstHeader.GetSelectionItemData( IDs );
+    
+	int count = IDs.GetSize();
+
+	for(int i = 0; i < count; i++)
+	{
+		try
+		{
+			CMainTable recset;
+			recset.Open("SELECT * FROM Main WHERE lID = %d", IDs[i]);
+			recset.Edit();
+			recset.m_lDontAutoDelete = (long)CTime::GetCurrentTime().GetTime();
+			recset.Update();
+		}
+		CATCHDAO
+	}
+
+	m_lstHeader.RefreshVisibleRows();
+}
 
+void CQPasteWnd::OnMenuQuickpropertiesAutodelete() 
+{
+	CWaitCursor wait;
+	ARRAY IDs;
+	m_lstHeader.GetSelectionItemData( IDs );
+    
+	int count = IDs.GetSize();
+
+	for(int i = 0; i < count; i++)
+	{
+		try
+		{
+			CMainTable recset;
+			recset.Open("SELECT * FROM Main WHERE lID = %d", IDs[i]);
+			recset.Edit();
+			recset.m_lDontAutoDelete = 0;
+			recset.Update();
+		}
+		CATCHDAO
+	}
+	m_lstHeader.RefreshVisibleRows();
+}
+
+void CQPasteWnd::OnMenuQuickpropertiesRemovehotkey() 
+{
+	CWaitCursor wait;
+	ARRAY IDs;
+	m_lstHeader.GetSelectionItemData( IDs );
+    
+	int count = IDs.GetSize();
+
+	for(int i = 0; i < count; i++)
+	{
+		try
+		{
+			CMainTable recset;
+			recset.Open("SELECT * FROM Main WHERE lID = %d", IDs[i]);
+			recset.Edit();
+			recset.m_lShortCut = 0;
+			recset.Update();
+		}
+		CATCHDAO
+	}	
+	m_lstHeader.RefreshVisibleRows();
+}
 ///////////////////////////////////////////////////////////////////////
 //END END Menu Stuff
 ///////////////////////////////////////////////////////////////////////
@@ -1617,6 +1711,8 @@ void CQPasteWnd::OnWindowPosChanging(WINDOWPOS* lpwndpos)
 
 void CQPasteWnd::OnShowGroupsTop()
 {
+	OnShowGroupsBottom();
+	return;
 	m_GroupTree.m_bHide = false;
 	m_bHideWnd = false;
 	
@@ -1690,3 +1786,14 @@ LRESULT CQPasteWnd::OnGroupTreeMessage(WPARAM wParam, LPARAM lParam)
 	
 	return TRUE;
 }
+
+void CQPasteWnd::OnBackButton()
+{
+	theApp.EnterGroupID(theApp.m_GroupParentID);
+}
+
+void CQPasteWnd::OnUpdateMenuGroupsMovetothegroupBlank(CCmdUI* pCmdUI) 
+{
+	// TODO: Add your command update UI handler code here
+	
+}

+ 7 - 1
QPasteWnd.h

@@ -67,8 +67,9 @@ public:
 	CGroupTree		m_GroupTree;
 	CBitmapButton	m_ShowGroupsFolderBottom;
 	CBitmapButton	m_ShowGroupsFolderTop;
+	CBitmapButton	m_BackButton;
 	bool			m_bAllowRepaintImmediately;
-
+	
 	void RefreshNc( bool bRepaintImmediately = false );
 	void UpdateStatus( bool bRepaintImmediately = false );  // regenerates the status (caption) text
 	BOOL FillList(CString csSQLSearch = "");
@@ -140,6 +141,10 @@ protected:
 	afx_msg void OnShowGroupsBottom();
 	afx_msg void OnShowGroupsTop();
 	afx_msg void OnMenuViewgroups();
+	afx_msg void OnMenuQuickpropertiesSettoneverautodelete();
+	afx_msg void OnMenuQuickpropertiesAutodelete();
+	afx_msg void OnMenuQuickpropertiesRemovehotkey();
+	afx_msg void OnUpdateMenuGroupsMovetothegroupBlank(CCmdUI* pCmdUI);
 	//}}AFX_MSG
 	afx_msg LRESULT OnListSelect(WPARAM wParam, LPARAM lParam);
 	afx_msg LRESULT OnListEnd(WPARAM wParam, LPARAM lParam);
@@ -166,6 +171,7 @@ public:
 	afx_msg void OnSortDescending();
 	afx_msg void OnMenuNewGroup();
 	afx_msg void OnMenuNewGroupSelection();
+	afx_msg void OnBackButton();
 };
 
 

+ 8 - 0
QuickPaste.cpp

@@ -153,4 +153,12 @@ void CQuickPaste::HideQPasteWnd()
 		if (IsWindow(m_pwndPaste->m_hWnd))
 			m_pwndPaste->ShowWindow(SW_HIDE);
 	}
+}
+
+BOOL CQuickPaste::IsWindowVisibleEx()
+{
+	if(m_pwndPaste)
+		return IsWindowVisible(m_pwndPaste->m_hWnd);
+
+	return FALSE;
 }

+ 1 - 0
QuickPaste.h

@@ -21,6 +21,7 @@ public:
 	void ShowQPasteWnd(CWnd *pParent, BOOL bAtPrevPos = FALSE);
 	void HideQPasteWnd();
 	BOOL CloseQPasteWnd();
+	BOOL IsWindowVisibleEx();
 
 //protected:
 	CQPasteWnd *m_pwndPaste;

+ 21 - 3
Resource.h

@@ -18,6 +18,9 @@
 #define IDB_OPEN_FOLDER                 144
 #define IDB_OPEN_FOLDER_FOCUSED         145
 #define IDB_OPEN_FOLDER_PRESSED         146
+#define IDB_BACK                        147
+#define IDB_BACK_PRESSED                148
+#define IDB_BACK_FOCUSED                149
 #define IDC_PATH                        1000
 #define IDC_GET_PATH                    1001
 #define IDC_SELECT                      1003
@@ -65,6 +68,7 @@
 #define IDC_PARSE_EDIT                  1041
 #define IDC_CHECK1                      1042
 #define IDC_HISTORY_START_TOP           1042
+#define IDC_CHECK_SEND_PASTE            1042
 #define IDD_OPTIONS_KEYSTROKES          2001
 #define IDC_HOTKEY                      2002
 #define IDC_DISPLAY_IN_SYSTEMTRAY       2003
@@ -90,6 +94,16 @@
 #define IDC_DESC_SHOW_LEADING_WHITESPACE 2021
 #define IDC_NAME                        2022
 #define IDC_COMBO1                      2023
+#define IDC_HOTKEY1                     2024
+#define IDC_HOTKEY2                     2025
+#define IDC_HOTKEY3                     2026
+#define IDC_HOTKEY4                     2027
+#define IDC_HOTKEY5                     2028
+#define IDC_HOTKEY6                     2029
+#define IDC_HOTKEY7                     2030
+#define IDC_HOTKEY8                     2031
+#define IDC_HOTKEY9                     2032
+#define IDC_HOTKEY10                    2033
 #define ID_FIRST_OPTION                 32771
 #define ID_FIRST_EXIT                   32772
 #define ID_FIRST_SHOWQUICKPASTE         32773
@@ -136,15 +150,19 @@
 #define ID_MENU_QUICKOPTIONS_DOUBLECLICKINGONCAPTION_TOGGLESALWAYSSHOWDESCRIPTION 32816
 #define ID_MENU_QUICKOPTIONS_PROMPTFORNEWGROUPNAMES 32817
 #define ID_MENU_VIEWGROUPS              32819
+#define ID_MENU_QUICKPROPERTIES_SETTONEVERAUTODELETE 32820
+#define ID_MENU_QUICKPROPERTIES_AUTODELETE 32821
+#define ID_MENU_QUICKPROPERTIES_REMOVEHOTKEY 32822
+#define ID_MENU_GROUPS_MOVETOTHEGROUP_BLANK 32823
 
 // Next default values for new objects
 // 
 #ifdef APSTUDIO_INVOKED
 #ifndef APSTUDIO_READONLY_SYMBOLS
 #define _APS_3D_CONTROLS                     1
-#define _APS_NEXT_RESOURCE_VALUE        142
-#define _APS_NEXT_COMMAND_VALUE         32820
-#define _APS_NEXT_CONTROL_VALUE         2024
+#define _APS_NEXT_RESOURCE_VALUE        148
+#define _APS_NEXT_COMMAND_VALUE         32824
+#define _APS_NEXT_CONTROL_VALUE         2025
 #define _APS_NEXT_SYMED_VALUE           101
 #endif
 #endif