Pārlūkot izejas kodu

merged changes back in from 3.15 branch
[SAB]


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

sabrogden 18 gadi atpakaļ
vecāks
revīzija
46cefedb6f

+ 17 - 17
CP_Main.cpp

@@ -126,7 +126,6 @@ CCP_MainApp::CCP_MainApp()
 	m_cfIgnoreClipboard = ::RegisterClipboardFormat(_T("Clipboard Viewer Ignore"));
 	m_cfDelaySavingData = ::RegisterClipboardFormat(_T("Ditto Delay Saving Data"));
 	m_RemoteCF_HDROP = ::RegisterClipboardFormat(_T("Ditto Remote CF_HDROP"));
-	m_DittoIdsFormat = ::RegisterClipboardFormat(_T("Ditto Clip Ids Format"));
 
 	m_QuickPasteMode = NONE_QUICK_PASTE;
 	m_pQuickPasteClip = NULL;
@@ -488,21 +487,21 @@ void CCP_MainApp::SendCopy()
 	keybd_event(VK_CONTROL, 0, KEYEVENTF_EXTENDEDKEY | KEYEVENTF_KEYUP, 0);
 	keybd_event(VK_MENU, 0, KEYEVENTF_EXTENDEDKEY | KEYEVENTF_KEYUP, 0);
 	keybd_event(VK_LWIN, 0, KEYEVENTF_EXTENDEDKEY | KEYEVENTF_KEYUP, 0);
-	
+
 	Sleep(50);
 
 	PumpMessageEx();
 
-	CString csPasteToApp = GetProcessName(m_hTargetWnd);
-	CString csPasteString = g_Opt.GetCopyString(csPasteToApp);
+	CString csToApp = GetProcessName(m_hTargetWnd);
+	CString csString = g_Opt.GetCopyString(csToApp);
 
 	CString csMessage;
-	csMessage = "Sending copy to app " + csPasteToApp + " key stroke " + csPasteString;
+	csMessage = "Sending copy to app " + csToApp + " key stroke " + csString;
 	Log(csMessage);
 
 	CSendKeys send;
 	//CString cs("^c");
-	send.SendKeys(csPasteString);
+	send.SendKeys(csString);
 }
 
 // sends Ctrl-X to the TargetWnd
@@ -529,15 +528,16 @@ void CCP_MainApp::SendCut()
 
 	PumpMessageEx();
 
-	Sleep(50);
-
-	keybd_event(VK_CONTROL, 0, KEYEVENTF_EXTENDEDKEY | 0, 0);
-	keybd_event('X', 0, KEYEVENTF_EXTENDEDKEY | 0, 0);
+	CString csToApp = GetProcessName(m_hTargetWnd);
+	CString csString = g_Opt.GetCutString(csToApp);
 
-	Sleep(50);
+	CString csMessage;
+	csMessage = "Sending cut to app " + csToApp + " key stroke " + csString;
+	Log(csMessage);
 
-	keybd_event('X', 0, KEYEVENTF_EXTENDEDKEY | KEYEVENTF_KEYUP, 0);
-	keybd_event(VK_CONTROL, 0, KEYEVENTF_EXTENDEDKEY | KEYEVENTF_KEYUP, 0);
+	CSendKeys send;
+	//CString cs("^x");
+	send.SendKeys(csString);
 }
 
 // CopyThread
@@ -712,9 +712,9 @@ void CCP_MainApp::RefreshView()
 	if(pWnd)
 	{
 		if(m_bAsynchronousRefreshView)
-			pWnd->PostMessage(WM_REFRESH_VIEW, 0, 0);
+			pWnd->PostMessage(WM_REFRESH_VIEW);
 		else
-			pWnd->SendMessage(WM_REFRESH_VIEW, 0, 0);
+			pWnd->SendMessage(WM_REFRESH_VIEW);
 	}
 }
 
@@ -885,7 +885,7 @@ void CCP_MainApp::ShowPersistent( bool bVal )
 	if( m_bShowingQuickPaste )
 	{
 		ASSERT( QPasteWnd() );
-		QPasteWnd()->SetCaptionColorActive(!g_Opt.m_bShowPersistent, theApp.GetConnectCV());
+		QPasteWnd()->SetCaptionColorActive(g_Opt.m_bShowPersistent, theApp.GetConnectCV());
 		QPasteWnd()->RefreshNc();
 	}
 }
@@ -972,7 +972,7 @@ void CCP_MainApp::SetConnectCV(bool bConnect)
 
 	if(QPasteWnd())
 	{
-		QPasteWnd()->SetCaptionColorActive(!g_Opt.m_bShowPersistent, theApp.GetConnectCV());
+		QPasteWnd()->SetCaptionColorActive(g_Opt.m_bShowPersistent, theApp.GetConnectCV());
 		QPasteWnd()->RefreshNc();
 	}
 }

+ 0 - 1
CP_Main.h

@@ -175,7 +175,6 @@ public:
 	CLIPFORMAT m_HTML_Format;
 	CLIPFORMAT m_RemoteCF_HDROP;
 	CLIPFORMAT m_RTFFormat;
-	CLIPFORMAT m_DittoIdsFormat;
 
 	COleDateTime m_oldtStartUp;
 

+ 20 - 24
CP_Main.rc

@@ -87,7 +87,6 @@ IDB_BACK                BITMAP                  "res\\back.bmp"
 IDB_BACK_PRESSED        BITMAP                  "res\\back1.bmp"
 IDB_BACK_FOCUSED        BITMAP                  "res\\back2.bmp"
 IDR_EDIT_WND            BITMAP                  "res\\mainfram.bmp"
-IDR_TOOLBAR_GROUP       BITMAP                  "res\\toolbar1.bmp"
 
 /////////////////////////////////////////////////////////////////////////////
 //
@@ -121,13 +120,6 @@ BEGIN
     BUTTON      ID_BUTTON_CLOSE
 END
 
-IDR_TOOLBAR_GROUP TOOLBAR  16, 15
-BEGIN
-    BUTTON      ID_BUTTON_REFRESH_GROUP
-    BUTTON      ID_BUTTON_PIN
-    BUTTON      ID_BUTTON_NEW_GROUP
-END
-
 
 /////////////////////////////////////////////////////////////////////////////
 //
@@ -310,7 +302,7 @@ BEGIN
             MENUITEM "Prompt to Delete Clip",       32852,MFT_STRING,
             MFS_ENABLED
         END
-        POPUP "Send To",                        65535,MFT_STRING,MFS_ENABLED
+        POPUP "Sent To",                        65535,MFT_STRING,MFS_ENABLED
         BEGIN
             MENUITEM "Friend One",                  32824,MFT_STRING,
             MFS_ENABLED
@@ -471,19 +463,19 @@ BEGIN
     CONTROL         "Enable Quick Paste Transparency",IDC_TRANSPARENCY,
                     "Button",BS_AUTOCHECKBOX | WS_TABSTOP,18,67,155,10
     EDITTEXT        IDC_TRANS_PERC,177,66,19,12,ES_AUTOHSCROLL
-    PUSHBUTTON      "Font",IDC_BUTTON_FONT,18,146,143,17
-    PUSHBUTTON      "Default Font",IDC_BUTTON_DEFAULT_FAULT,164,149,70,12
+    PUSHBUTTON      "Font",IDC_BUTTON_FONT,18,160,143,17
+    PUSHBUTTON      "Default Font",IDC_BUTTON_DEFAULT_FAULT,164,163,70,12
     CONTROL         "At Caret",IDC_AT_CARET,"Button",BS_AUTORADIOBUTTON,22,
-                    182,93,10
+                    195,93,10
     CONTROL         "At Cursor",IDC_AT_CURSOR,"Button",BS_AUTORADIOBUTTON,22,
-                    192,97,10
+                    205,97,10
     CONTROL         "At Previous Position",IDC_AT_PREVIOUS,"Button",
-                    BS_AUTORADIOBUTTON,22,202,117,10
+                    BS_AUTORADIOBUTTON,22,215,117,10
     LTEXT           "%",IDC_STATIC,199,66,8,12,SS_CENTERIMAGE
-    GROUPBOX        "Popup Positioning",IDC_STATIC_POPUP,10,173,138,41
+    GROUPBOX        "Popup Positioning",IDC_STATIC_POPUP,10,186,138,41
     LTEXT           "  * = Don't Auto Delete\n  s = Shortcut exists\n G = Item is a Group\n  ! = Item is attached to a Group",
-                    IDC_STATIC_LEG,158,183,154,36
-    GROUPBOX        "List Item Prefix Legend",IDC_STATIC_LEGEND,153,173,165,
+                    IDC_STATIC_LEG,158,196,154,36
+    GROUPBOX        "List Item Prefix Legend",IDC_STATIC_LEGEND,153,186,165,
                     50
     CONTROL         "Show thumbnails (for CF_DIB types) (Could Increase Memory Usage and Display Speed)",
                     IDC_SHOW_THUMBNAILS,"Button",BS_AUTOCHECKBOX | 
@@ -502,6 +494,10 @@ BEGIN
     CONTROL         "Prompt when deleting clips",
                     IDC_CHECK_PROMPT_DELETE_CLIP,"Button",BS_AUTOCHECKBOX | 
                     WS_TABSTOP,18,128,335,10
+    LTEXT           "Theme",IDC_STATIC_THEME,18,142,36,12,SS_CENTERIMAGE
+    COMBOBOX        IDC_COMBO_THEME,59,142,130,95,CBS_DROPDOWNLIST | 
+                    CBS_SORT | WS_VSCROLL | WS_TABSTOP
+    PUSHBUTTON      "About Theme",IDC_BUTTON_THEME,198,142,106,12
 END
 
 IDD_OPTIONS_KEYSTROKES DIALOGEX 0, 0, 350, 206
@@ -586,7 +582,7 @@ BEGIN
     LTEXT           "Named Paste",IDC_STATIC_NAMED_COPY2,19,44,69,14,
                     SS_CENTERIMAGE
     LTEXT           "Send custom strokes Per Application",
-                    IDC_STATIC_CUSTOM_KEY,213,15,116,8
+                    IDC_STATIC_CUSTOM_KEYS,210,16,133,8
 END
 
 IDD_OPTIONS_GENERAL DIALOGEX 0, 0, 351, 259
@@ -756,11 +752,11 @@ BEGIN
     LTEXT           "Quick Paste Text",IDC_STATIC,7,56,62,13,SS_CENTERIMAGE
 END
 
-IDD_ABOUT DIALOGEX 0, 0, 292, 153
+IDD_ABOUT DIALOG  0, 0, 292, 153
 STYLE DS_SETFONT | DS_MODALFRAME | DS_FIXEDSYS | WS_POPUP | WS_CAPTION | 
     WS_SYSMENU
 CAPTION "About"
-FONT 8, "MS Shell Dlg", 0, 0, 0x0
+FONT 8, "MS Shell Dlg"
 BEGIN
     LISTBOX         IDC_LIST,7,16,271,86,LBS_NOINTEGRALHEIGHT | WS_VSCROLL | 
                     WS_TABSTOP
@@ -923,8 +919,8 @@ END
 //
 
 VS_VERSION_INFO VERSIONINFO
- FILEVERSION 3,15,0,0
- PRODUCTVERSION 3,15,0,0
+ FILEVERSION 3,15,1,0
+ PRODUCTVERSION 3,15,1,0
  FILEFLAGSMASK 0x3fL
 #ifdef _DEBUG
  FILEFLAGS 0x1L
@@ -940,12 +936,12 @@ BEGIN
         BLOCK "040904b0"
         BEGIN
             VALUE "FileDescription", "Ditto"
-            VALUE "FileVersion", "3, 15, 0, 0"
+            VALUE "FileVersion", "3, 15, 1, 0"
             VALUE "InternalName", "CP_Main"
             VALUE "LegalCopyright", "Copyright (C) 2003"
             VALUE "OriginalFilename", "Ditto"
             VALUE "ProductName", "Ditto"
-            VALUE "ProductVersion", "3, 15, 0, 0"
+            VALUE "ProductVersion", "3, 15, 1, 0"
         END
     END
     BLOCK "VarFileInfo"

+ 6 - 18
CP_Main.vcproj

@@ -831,9 +831,6 @@
 						ObjectFile="$(IntDir)/$(InputName)1.obj"/>
 				</FileConfiguration>
 			</File>
-			<File
-				RelativePath=".\DittoDropTarget.cpp">
-			</File>
 			<File
 				RelativePath=".\DittoRulerRichEditCtrl.cpp">
 			</File>
@@ -1068,9 +1065,6 @@
 						BasicRuntimeChecks="3"/>
 				</FileConfiguration>
 			</File>
-			<File
-				RelativePath=".\GroupWnd.cpp">
-			</File>
 			<File
 				RelativePath=".\HTMLFormatAggregator.cpp">
 			</File>
@@ -1111,9 +1105,6 @@
 						BasicRuntimeChecks="3"/>
 				</FileConfiguration>
 			</File>
-			<File
-				RelativePath=".\MagneticWnd.cpp">
-			</File>
 			<File
 				RelativePath="MainFrm.cpp">
 				<FileConfiguration
@@ -1950,6 +1941,9 @@
 						BasicRuntimeChecks="3"/>
 				</FileConfiguration>
 			</File>
+			<File
+				RelativePath=".\Theme.cpp">
+			</File>
 			<Filter
 				Name="Controls"
 				Filter="">
@@ -2702,9 +2696,6 @@
 			<File
 				RelativePath=".\DittoCopyBuffer.h">
 			</File>
-			<File
-				RelativePath=".\DittoDropTarget.h">
-			</File>
 			<File
 				RelativePath=".\DittoRulerRichEditCtrl.h">
 			</File>
@@ -2735,9 +2726,6 @@
 			<File
 				RelativePath="GroupTree.h">
 			</File>
-			<File
-				RelativePath=".\GroupWnd.h">
-			</File>
 			<File
 				RelativePath=".\HTMLFormatAggregator.h">
 			</File>
@@ -2750,9 +2738,6 @@
 			<File
 				RelativePath="InternetUpdate.h">
 			</File>
-			<File
-				RelativePath=".\MagneticWnd.h">
-			</File>
 			<File
 				RelativePath="MainFrm.h">
 			</File>
@@ -2846,6 +2831,9 @@
 			<File
 				RelativePath="TextConvert.h">
 			</File>
+			<File
+				RelativePath=".\Theme.h">
+			</File>
 			<File
 				RelativePath="UnicodeMacros.h">
 			</File>

+ 4 - 0
Debug/Language/English.xml

@@ -179,6 +179,10 @@
 		//New strings added in 3.6 6-9-06
 		<Item English_Text = "Prompt when deleting clips" ID = "2039"></Item>
 		
+		//New strings added in 3.15.2 10-6-07
+		<Item English_Text = "Theme" ID = "2092"></Item>
+		<Item English_Text = "About Theme" ID = "2094"></Item>
+		
 	</Ditto_Options_Quick_Paste>	
 	<Ditto_Options_Friends>
 		<Item English_Text = "When you recieve a sent copy if their ip or computer name is in this list then it will be put on the clipboard.  Otherwise it will be in the saved clips to use at a later time." ID = "2052"></Item>

+ 18 - 0
Debug/Themes/Ditto.xml

@@ -0,0 +1,18 @@
+<?xml version="1.0" encoding="Ascii"?>
+<Ditto_Theme_File Version = "1" Author = "Ditto" Notes = "Base theme file for future Ditto Themes">
+	<CaptionLeft>RGB(0, 84, 195)</CaptionLeft>
+	<CaptionRight>RGB(61, 149, 255)</CaptionRight>
+	<CaptionLeftTopMost>RGB(122, 150, 223)</CaptionLeftTopMost>
+	<CaptionRightTopMost>RGB(157, 185, 235)</CaptionRightTopMost>
+	<CaptionLeftNotConnected>RGB(255, 0, 0)</CaptionLeftNotConnected>
+	<CaptionRightNotConnected>RGB(255, 0, 0)</CaptionRightNotConnected>
+	<CaptionTextColor>RGB(255, 255, 255)</CaptionTextColor>
+	<ListBoxOddRowsBG>RGB(255, 255, 255)</ListBoxOddRowsBG>
+	<ListBoxEvenRowsBG>RGB(240, 240, 240)</ListBoxEvenRowsBG>
+	<ListBoxOddRowsText>RGB(0, 0, 0)</ListBoxOddRowsText>
+	<ListBoxEvenRowsText>RGB(0, 0, 0)</ListBoxEvenRowsText>
+	<ListBoxSelectedBG>RGB(30, 116, 211)</ListBoxSelectedBG>
+	<ListBoxSelectedNoFocusBG>RGB(236, 233, 216)</ListBoxSelectedNoFocusBG>
+	<ListBoxSelectedText>RGB(255, 255, 255)</ListBoxSelectedText>
+	<ListBoxSelectedNoFocusText>RGB(0, 0, 0)</ListBoxSelectedNoFocusText>
+</Ditto_Theme_File>

BIN
Debug/focus.dll


BIN
Debug/focus.lib


BIN
DittoSetup/7za.exe


+ 27 - 0
DittoSetup/Build Portable ZIP.bat

@@ -0,0 +1,27 @@
+Rmdir Ditto /s /q
+
+MkDir Ditto
+MkDir Ditto\Help
+MkDir Ditto\Language
+
+copy ..\Release\DittoU.exe Ditto\Ditto.exe
+copy ..\Release\sqlite3.dll Ditto\sqlite3.dll
+copy ..\Release\AccessToSqlite.dll Ditto\AccessToSqlite.dll
+copy ..\Release\focus.dll Ditto\focus.dll
+copy ..\zlib\zlib1.dll Ditto\zlib.dll
+
+copy Changes.txt Ditto\Changes.txt
+
+copy mfc-crt\* Ditto\
+
+copy Ditto.Settings Ditto\Ditto.Settings
+
+copy ..\Help\*.* Ditto\Help\
+copy ..\Debug\language\*.xml Ditto\language\
+
+7za.exe a -tzip Ditto_Portable.zip "Ditto\*" -r
+
+Rmdir Ditto /s /q
+
+
+

+ 8 - 0
DittoSetup/Changes.txt

@@ -1,3 +1,11 @@
+3.15.1.0   8-19-07
+- Custom Key strokes per application
+- Added option to hide friends, via registry setting only
+- Change some default values on new installs, limit copies to 500, disable friends, show at caret
+- Save word wrap option
+- Editor hot keys, added keys for undo, redo, wrap, bold, underline
+
+
 3.14.0.0   2-18-06
 - Added new feature, "Ditto copy buffers" Options - Copy buffers.  Can assign short cut keys for extra copy buffers.  These copy buffers work just like Ctrl-C and Ctrl-V.  Things can be copied and pasted without affecting the standard clipboard data.
 - Updated to latest sqlite db version.  This fixed the problem with foreign characters in the current user's name.

+ 9 - 6
DittoWindow.cpp

@@ -28,8 +28,9 @@ CDittoWindow::CDittoWindow(void)
 	m_crChevronBT.SetRectEmpty();
 	m_crMaximizeBT.SetRectEmpty();
 	m_crMinimizeBT.SetRectEmpty();
-	m_CaptionColorLeft = ::GetSysColor(COLOR_ACTIVECAPTION);
-	m_CaptionColorRight = ::GetSysColor(COLOR_GRADIENTACTIVECAPTION);
+	m_CaptionColorLeft = RGB(0, 84, 230);
+	m_CaptionColorRight = RGB(61, 149, 255);
+	m_CaptionTextColor = RGB(255, 255, 255);
 }
 
 CDittoWindow::~CDittoWindow(void)
@@ -296,7 +297,7 @@ void CDittoWindow::DoNcPaint(CWnd *pWnd)
 		DeleteObject(color);
 
 	int nOldBKMode = dc.SetBkMode(TRANSPARENT);
-	COLORREF oldColor = dc.SetTextColor(RGB(255, 255, 255));
+	COLORREF oldColor = dc.SetTextColor(m_CaptionTextColor);
 
 	CFont *pOldFont = NULL;
 	if(bVertical)
@@ -866,11 +867,13 @@ void CDittoWindow::SetCaptionOn(CWnd *pWnd, int nPos, bool bOnstartup)
 
 bool CDittoWindow::SetCaptionColors(COLORREF left, COLORREF right)
 {
-	if( left == m_CaptionColorLeft || right == m_CaptionColorRight )
-		return false;
-
 	m_CaptionColorLeft = left;
 	m_CaptionColorRight = right;
 
 	return true;
+}
+
+void CDittoWindow::SetCaptionTextColor(COLORREF color)
+{
+	m_CaptionTextColor = color;
 }

+ 2 - 1
DittoWindow.h

@@ -30,7 +30,7 @@ public:
 	bool DoPreTranslateMessage(MSG* pMsg);
 	void SetCaptionOn(CWnd *pWnd, int nPos, bool bOnstartup);
 	bool SetCaptionColors(COLORREF left, COLORREF right);
-	bool SetCaptionColorActive(bool bActive, bool ConnectedToClipboard);
+	void SetCaptionTextColor(COLORREF color);
 
 	long m_lTopBorder;
 	long m_lRightBorder;
@@ -64,4 +64,5 @@ public:
 
 	COLORREF m_CaptionColorLeft;
 	COLORREF m_CaptionColorRight;
+	COLORREF m_CaptionTextColor;
 };

+ 1 - 1
EditFrameWnd.cpp

@@ -60,7 +60,7 @@ int CEditFrameWnd::OnCreate(LPCREATESTRUCT lpCreateStruct)
 
 	m_DittoWindow.DoCreate(this);
 	m_DittoWindow.m_bDrawChevron = false;
-	m_DittoWindow.SetCaptionColors(::GetSysColor(COLOR_ACTIVECAPTION), ::GetSysColor(COLOR_GRADIENTACTIVECAPTION));
+	m_DittoWindow.SetCaptionColors(g_Opt.m_Theme.CaptionLeft(), g_Opt.m_Theme.CaptionRight());
 	m_DittoWindow.SetCaptionOn(this, CAPTION_TOP, true);
 
 	m_crIcon.SetRect(-2, -15, 15, 0);

BIN
EncryptDecrypt.lib


BIN
EncryptDecryptD.lib


+ 62 - 212
GroupTree.cpp

@@ -4,7 +4,6 @@
 #include "stdafx.h"
 #include "cp_main.h"
 #include "GroupTree.h"
-#include ".\grouptree.h"
 
 #ifdef _DEBUG
 #define new DEBUG_NEW
@@ -17,24 +16,25 @@ static char THIS_FILE[] = __FILE__;
 
 CGroupTree::CGroupTree()
 {
+	m_bHide = true;
 	m_lSelectedFolderID = -1;
-	m_bShowCounts = true;
+	m_bSendAllready = false;
 }
 
 CGroupTree::~CGroupTree()
 {
-	
 }
 
 
 BEGIN_MESSAGE_MAP(CGroupTree, CTreeCtrl)
 	//{{AFX_MSG_MAP(CGroupTree)
 	ON_WM_CREATE()
+	ON_NOTIFY_REFLECT(TVN_SELCHANGED, OnSelchanged)
+	ON_WM_KILLFOCUS()
+	ON_WM_ACTIVATE()
 	ON_NOTIFY_REFLECT(NM_DBLCLK, OnDblclk)
 	ON_NOTIFY_REFLECT(TVN_KEYDOWN, OnKeydown)
 	//}}AFX_MSG_MAP
-	ON_NOTIFY_REFLECT(TVN_ENDLABELEDIT, OnTvnEndlabeledit)
-	ON_NOTIFY_REFLECT(TVN_BEGINLABELEDIT, OnTvnBeginlabeledit)
 END_MESSAGE_MAP()
 
 
@@ -44,7 +44,6 @@ END_MESSAGE_MAP()
 BOOL CGroupTree::Create(LPCTSTR lpszClassName, LPCTSTR lpszWindowName, DWORD dwStyle, const RECT& rect, CWnd* pParentWnd, UINT nID, CCreateContext* pContext) 
 {
 	// TODO: Add your specialized code here and/or call the base class
-	dwStyle = dwStyle | TVS_EDITLABELS | TVS_SHOWSELALWAYS;
 	
 	return CWnd::Create(lpszClassName, lpszWindowName, dwStyle, rect, pParentWnd, nID, pContext);
 }
@@ -63,23 +62,19 @@ int CGroupTree::OnCreate(LPCREATESTRUCT lpCreateStruct)
 	m_bmOpenFolder.LoadBitmap(IDB_OPEN_FOLDER);
 	iml.Add(&m_bmOpenFolder, RGB(255, 0, 0));
 	
+
 	SetImageList(&iml, TVSIL_NORMAL);
 	iml.Detach();
-	
-	m_DropTarget.Register(this);
-	m_DropTarget.SetDropTarget(this);
-	
+		
 	return 0;
 }
 
 void CGroupTree::FillTree()
 {	
 	DeleteAllItems();
+	m_bSendAllready = false;
 
-	CString cs;
-	cs.Format(_T("Root (%d)"), GetGroupCount(-1));
-
-	HTREEITEM hItem = InsertItem(cs, TVI_ROOT);
+	HTREEITEM hItem = InsertItem(_T("Root"), TVI_ROOT);
 	SetItemData(hItem, -1);
 	SetItemState(hItem, TVIS_EXPANDED, TVIS_EXPANDED);
 
@@ -89,6 +84,7 @@ void CGroupTree::FillTree()
 	FillTree(-1, hItem);
 }
 
+
 void CGroupTree::FillTree(long lParentID, HTREEITEM hParent)
 {	
 	try
@@ -98,33 +94,22 @@ void CGroupTree::FillTree(long lParentID, HTREEITEM hParent)
 		if(q.eof() == false)
 		{
 			HTREEITEM hItem;
-			CString cs;
 
 			while(!q.eof())
 			{
-				int nGroupID = q.getIntField(_T("lID"));
-				if(m_bShowCounts)
+				if(q.getIntField(_T("lID")) == m_lSelectedFolderID)
 				{
-					cs.Format(_T("%s (%d)"), q.getStringField(_T("mText")), GetGroupCount(nGroupID));
-				}
-				else
-				{
-					cs.Format(_T("%s"), q.getStringField(_T("mText")));
-				}
-
-				if(nGroupID == m_lSelectedFolderID)
-				{
-					hItem = InsertItem(cs, 1, 1, hParent);
+					hItem = InsertItem(q.getStringField(_T("mText")), 1, 1, hParent);
 					SelectItem(hItem);
 				}
 				else
 				{				
-					hItem = InsertItem(cs, 0, 0, hParent);
+					hItem = InsertItem(q.getStringField(_T("mText")), 0, 0, hParent);
 				}
 
-				SetItemData(hItem, nGroupID);
+				SetItemData(hItem, q.getIntField(_T("lID")));
 				
-				FillTree(nGroupID, hItem);
+				FillTree(q.getIntField(_T("lID")), hItem);
 
 				q.nextRow();
 			}
@@ -133,16 +118,47 @@ void CGroupTree::FillTree(long lParentID, HTREEITEM hParent)
 	CATCH_SQLITE_EXCEPTION	
 }
 
+void CGroupTree::OnSelchanged(NMHDR* pNMHDR, LRESULT* pResult) 
+{
+	NM_TREEVIEW* pNMTreeView = (NM_TREEVIEW*)pNMHDR;
+	// TODO: Add your control notification handler code here
+	
+//	if(m_bHide == true)
+//	{	
+//		::SendMessage(m_NotificationWnd, NM_GROUP_TREE_MESSAGE, GetItemData(pNMTreeView->itemNew.hItem), 0);
+//	}
+	
+	*pResult = 0;
+}
+
+void CGroupTree::OnKillFocus(CWnd* pNewWnd) 
+{
+	CTreeCtrl::OnKillFocus(pNewWnd);
+}
+
+void CGroupTree::OnActivate(UINT nState, CWnd* pWndOther, BOOL bMinimized) 
+{
+	CTreeCtrl::OnActivate(nState, pWndOther, bMinimized);
+	
+	if(m_bHide)
+	{
+		if (nState == WA_INACTIVE)
+		{		
+			SendToParent(-1);
+		}
+	}
+}
+
 void CGroupTree::OnDblclk(NMHDR* pNMHDR, LRESULT* pResult) 
 {
 	HTREEITEM hItem =  GetNextItem(TVI_ROOT, TVGN_CARET);
 	if(hItem)
-		SendToParent(hItem);
+		SendToParent(GetItemData(hItem));
 			
 	*pResult = 1;
 }
 
-long CGroupTree::GetSelectedGroup()
+long CGroupTree::GetSelectedTree()
 {
 	HTREEITEM hItem =  GetNextItem(TVI_ROOT, TVGN_CARET);
 	if(hItem)
@@ -161,208 +177,42 @@ void CGroupTree::OnKeydown(NMHDR* pNMHDR, LRESULT* pResult)
 	{	
 		HTREEITEM hItem =  GetNextItem(TVI_ROOT, TVGN_CARET);
 		if(hItem)
-			SendToParent(hItem);
+			SendToParent(GetItemData(hItem));
 		
 		break;
 	}
-	case VK_F2:
-		{
-			HTREEITEM hItem =  GetNextItem(TVI_ROOT, TVGN_CARET);
-			if(hItem)
-				EditLabel(hItem);
-		}
+	case VK_ESCAPE:
+	{	
+		SendToParent(-1);
 		break;
+	}	
 	}
 	
 	*pResult = 1;
 }
 
 
-void CGroupTree::SendToParent(HTREEITEM Item)
+void CGroupTree::SendToParent(long lID)
 {
-	long lID = -1;
-	if(Item != NULL)
-		lID = GetItemData(Item);
-
-	::PostMessage(m_NotificationWnd, NM_GROUP_TREE_MESSAGE, lID, 0);
-	RefreshTreeItem(Item);
+	if(m_bSendAllready == false)
+	{
+		m_bSendAllready = true;
+		::PostMessage(m_NotificationWnd, NM_GROUP_TREE_MESSAGE, lID, 0);
+	}
 }
 
-HTREEITEM CGroupTree::AddNode(CString csText, long lID)
+bool CGroupTree::AddNode(CString csText, long lID)
 {
 	HTREEITEM hItem;
 
 	HTREEITEM hParent =  GetNextItem(TVI_ROOT, TVGN_CARET);
 	if(hParent == NULL)
-		return NULL;
+		return false;
 		
 	hItem = InsertItem(csText, 1, 1, hParent);
 	SelectItem(hItem);
 
 	SetItemData(hItem, lID);
 
-	return hItem;
-}
-
-int CGroupTree::GetGroupCount(long lGroupID)
-{
-	long lCount = 0;
-	try
-	{
-		lCount = theApp.m_db.execScalarEx(_T("SELECT COUNT(lID) FROM Main WHERE lParentID = %d"), lGroupID);
-	}
-	CATCH_SQLITE_EXCEPTION
-
-	return lCount;
-}
-
-void CGroupTree::OnTvnEndlabeledit(NMHDR *pNMHDR, LRESULT *pResult)
-{
-	LPNMTVDISPINFO pTVDispInfo = reinterpret_cast<LPNMTVDISPINFO>(pNMHDR);
-	*pResult = 0;
-
-	long lID = GetItemData(pTVDispInfo->item.hItem);
-	if((lID < 0 && lID != NEW_GROUP_ID) || pTVDispInfo->item.pszText == NULL)
-	{
-		if(lID == NEW_GROUP_ID)
-			DeleteItem(pTVDispInfo->item.hItem);
-
-		return;
-	}
-
-	if(lID == NEW_GROUP_ID)
-	{
-		HTREEITEM hParent = GetParentItem(pTVDispInfo->item.hItem);
-		long lParentID = -1;
-		if(hParent != NULL)
-			lParentID = GetItemData(hParent);
-
-		lID = NewGroupID(lParentID, pTVDispInfo->item.pszText);
-		if(lID >= 0)
-		{
-			SetItemData(pTVDispInfo->item.hItem, lID);
-		}
-		else
-		{
-			DeleteItem(pTVDispInfo->item.hItem);
-			return;
-		}
-	}
-
-	CClip clip;
-	if(clip.LoadMainTable(lID))
-	{
-		clip.m_Desc = pTVDispInfo->item.pszText;
-		if(clip.ModifyMainTable())
-		{
-			CString cs;
-			cs.Format(_T("%s (%d)"), pTVDispInfo->item.pszText, GetGroupCount(lID));
-			SetItemText(pTVDispInfo->item.hItem, cs);
-		}
-	}	
-}
-
-void CGroupTree::OnTvnBeginlabeledit(NMHDR *pNMHDR, LRESULT *pResult)
-{
-	LPNMTVDISPINFO pTVDispInfo = reinterpret_cast<LPNMTVDISPINFO>(pNMHDR);
-	long lID = GetItemData(pTVDispInfo->item.hItem);
-	if(lID < 0 && lID != NEW_GROUP_ID)
-	{
-		*pResult = 1;
-		return;
-	}
-
-	if(m_bShowCounts)
-	{
-		CString csText = GetItemText(pTVDispInfo->item.hItem);
-		if(csText.ReverseFind(')') == csText.GetLength()-1)
-		{
-			int nPos = csText.ReverseFind('(');
-			csText = csText.Left(nPos);
-			csText = csText.Trim();
-
-			CEdit* pEdit = GetEditControl();
-			if (pEdit != NULL)
-			{
-				pEdit->SetWindowText(csText);
-			}
-		}
-	}
-
-	// TODO: Add your control notification handler code here
-	*pResult = 0;
-}
-
-void CGroupTree::RefreshTreeItem(HTREEITEM Item)
-{
-	CString csText = GetItemText(Item);
-	if(csText.ReverseFind(')') == csText.GetLength()-1)
-	{
-		int nPos = csText.ReverseFind('(');
-		csText = csText.Left(nPos);
-		csText = csText.Trim();
-	}
-
-	CString csItemText;
-	long lGroupID = GetItemData(Item);
-	csItemText.Format(_T("%s (%d)"), csText, GetGroupCount(lGroupID));
-	SetItemText(Item, csItemText);
-}
-
-DROPEFFECT CGroupTree::DragEnter(COleDataObject* pDataObject, DWORD dwKeyState, CPoint point) 
-{
-	return DragOver(pDataObject, dwKeyState, point);
-}
-
-DROPEFFECT CGroupTree::DragOver(COleDataObject* pDataObject, DWORD dwKeyState, CPoint point) 
-{
-	if(pDataObject->IsDataAvailable(theApp.m_DittoIdsFormat) == false)
-		return DROPEFFECT_NONE;
-
-	HTREEITEM hItem = HitTest(point);
-	SelectDropTarget(hItem);
-
-	return DROPEFFECT_MOVE;
-}
-
-BOOL CGroupTree::Drop(COleDataObject* pDataObject, DROPEFFECT dropEffect, CPoint point) 
-{
-	
-	HTREEITEM hItem = HitTest(point);
-	long lGroupID = GetItemData(hItem);
-	
-	CClipIDs Clips;
-	HGLOBAL hData = pDataObject->GetGlobalData(theApp.m_DittoIdsFormat);
-	if(hData)
-	{
-		int *pData = (int*)GlobalLock(hData);
-		if(pData)
-		{
-			int nItems = GlobalSize(hData) / sizeof(int);
-
-			for(int nPos = 0; nPos < nItems; nPos++)
-			{
-				Clips.Add(pData[nPos]);
-			}
-
-			GlobalUnlock(hData);
-		}
-	}
-
-	if(Clips.GetCount() > 0)
-	{
-		Clips.MoveTo(lGroupID);
-		RefreshTreeItem(hItem);
-		::SendMessage(m_NotificationWnd, WM_REFRESH_VIEW, 1, 0);
-	}
-
-	SelectDropTarget(NULL);
-	SelectItem(hItem);
-
-	return FALSE;
-}
-
-void CGroupTree::DragLeave()
-{
-	SelectDropTarget(NULL);
+	return true;
 }

+ 43 - 24
GroupTree.h

@@ -1,10 +1,16 @@
-#pragma once
+#if !defined(AFX_GROUPTREE_H__A1F01358_5440_45A8_B402_3F32F46FCAA5__INCLUDED_)
+#define AFX_GROUPTREE_H__A1F01358_5440_45A8_B402_3F32F46FCAA5__INCLUDED_
 
-#include "DittoDropTarget.h"
+#if _MSC_VER > 1000
+#pragma once
+#endif // _MSC_VER > 1000
+// GroupTree.h : header file
+//
 
-#define NEW_GROUP_ID -2
+/////////////////////////////////////////////////////////////////////////////
+// CGroupTree window
 
-class CGroupTree : public CTreeCtrl, IDittoDropTarget
+class CGroupTree : public CTreeCtrl
 {
 // Construction
 public:
@@ -17,39 +23,52 @@ public:
 public:
 	void FillTree();
 	void SetNotificationWndEx(HWND hWnd)	{ m_NotificationWnd = hWnd;	}
-	long GetSelectedGroup();
-	void SetSelectedGroup(long lGroupID)	{ m_lSelectedFolderID = lGroupID; }
-	HTREEITEM AddNode(CString csText, long lID);
+	bool m_bHide;
+	long m_lSelectedFolderID;
+	long GetSelectedTree();
+	bool AddNode(CString csText, long lID);
 
 protected:
 	void FillTree(long lParentID, HTREEITEM hParent);
-	void SendToParent(HTREEITEM Item);
-	int GetGroupCount(long lGroupID);
-	void RefreshTreeItem(HTREEITEM Item);
+	void SendToParent(long lID);
 
 	HWND m_NotificationWnd;
 	CBitmap m_bmOpenFolder;
 	CBitmap m_bmClosedFolder;
-	CDittoDropTarget m_DropTarget;
-	long m_lSelectedFolderID;
-	bool m_bShowCounts;
+	bool m_bSendAllready;
 
+// Overrides
+	// ClassWizard generated virtual function overrides
+	//{{AFX_VIRTUAL(CGroupTree)
+	public:
+	virtual BOOL Create(LPCTSTR lpszClassName, LPCTSTR lpszWindowName, DWORD dwStyle, const RECT& rect, CWnd* pParentWnd, UINT nID, CCreateContext* pContext = NULL);
+	//}}AFX_VIRTUAL
+
+// Implementation
 public:
 	virtual ~CGroupTree();
 
 	// Generated message map functions
 protected:
-
-	DECLARE_MESSAGE_MAP()
-public:
-	virtual BOOL Create(LPCTSTR lpszClassName, LPCTSTR lpszWindowName, DWORD dwStyle, const RECT& rect, CWnd* pParentWnd, UINT nID, CCreateContext* pContext = NULL);
+	//{{AFX_MSG(CGroupTree)
 	afx_msg int OnCreate(LPCREATESTRUCT lpCreateStruct);
+	afx_msg void OnSelchanged(NMHDR* pNMHDR, LRESULT* pResult);
+	afx_msg void OnKillFocus(CWnd* pNewWnd);
+	afx_msg void OnActivate(UINT nState, CWnd* pWndOther, BOOL bMinimized);
 	afx_msg void OnDblclk(NMHDR* pNMHDR, LRESULT* pResult);
 	afx_msg void OnKeydown(NMHDR* pNMHDR, LRESULT* pResult);
-	afx_msg void OnTvnEndlabeledit(NMHDR *pNMHDR, LRESULT *pResult);
-	afx_msg void OnTvnBeginlabeledit(NMHDR *pNMHDR, LRESULT *pResult);
-	virtual DROPEFFECT DragEnter(COleDataObject* pDataObject, DWORD dwKeyState, CPoint point);
-	virtual DROPEFFECT DragOver(COleDataObject* pDataObject, DWORD dwKeyState, CPoint point);
-	virtual void DragLeave();
-	virtual BOOL Drop(COleDataObject* pDataObject, DROPEFFECT dropEffect, CPoint point);
-};
+	//}}AFX_MSG
+
+	DECLARE_MESSAGE_MAP()
+	// Generated OLE dispatch map functions
+	//{{AFX_DISPATCH(CGroupTree)
+		// NOTE - the ClassWizard will add and remove member functions here.
+	//}}AFX_DISPATCH
+};
+
+/////////////////////////////////////////////////////////////////////////////
+
+//{{AFX_INSERT_LOCATION}}
+// Microsoft Visual C++ will insert additional declarations immediately before the previous line.
+
+#endif // !defined(AFX_GROUPTREE_H__A1F01358_5440_45A8_B402_3F32F46FCAA5__INCLUDED_)

+ 3 - 3
MoveToGroupDlg.cpp

@@ -51,7 +51,7 @@ BOOL CMoveToGroupDlg::OnInitDialog()
 {
 	CDialog::OnInitDialog();
 	
-	m_Tree.SetSelectedGroup(m_nSelectedGroup);
+	m_Tree.m_lSelectedFolderID = m_nSelectedGroup;
 	m_Tree.SetNotificationWndEx(m_hWnd);
 	m_Tree.FillTree();
 
@@ -79,7 +79,7 @@ LRESULT CMoveToGroupDlg::OnTreeSelect(WPARAM wParam, LPARAM lParam)
 
 void CMoveToGroupDlg::OnOK() 
 {
-	m_nSelectedGroup = m_Tree.GetSelectedGroup();
+	m_nSelectedGroup = m_Tree.GetSelectedTree();
 	
 	CDialog::OnOK();
 }
@@ -100,7 +100,7 @@ void CMoveToGroupDlg::OnButtonNewGroup()
 		
 	CString csName = Name.m_csName;
 	
-	long lID = NewGroupID(m_Tree.GetSelectedGroup(), csName);
+	long lID = NewGroupID(m_Tree.GetSelectedTree(), csName);
 	if(lID >= 0)
 	{
 		m_Tree.AddNode(csName, lID);

+ 0 - 1
MultiLanguage.h

@@ -62,7 +62,6 @@ public:
 	CString GetNotes()	{ return m_csNotes;			}
 
 	void	SetOnlyGetHeader(bool bVal)	{ m_bOnlyGetHeader = true;	}
-
 	static CMenu* GetMenuPos(CMenu *pMenu, const CString &csLookingForMenuText, int &nMenuPos);
 
 	CString m_csLastError;

+ 21 - 33
OleClipSource.cpp

@@ -32,8 +32,6 @@ BOOL COleClipSource::DoDelayRender()
 	int count = types.GetSize();
 	for(int i=0; i < count; i++)
 		DelayRenderData(types[i]);
-
-	DelayRenderData(theApp.m_DittoIdsFormat);
 	
 	return count;
 }
@@ -195,43 +193,33 @@ BOOL COleClipSource::OnRenderGlobalData(LPFORMATETC lpFormatEtc, HGLOBAL* phGlob
 	}
 	else
 	{
-		if(lpFormatEtc->cfFormat == theApp.m_DittoIdsFormat)
+		CClip clip;
+
+		clip.LoadFormats(m_ClipIDs[0]);
+
+		CClipFormat *pDittoDelayCF_HDROP = clip.m_Formats.FindFormat(theApp.m_RemoteCF_HDROP);
+		CClipFormat *pCF_HDROP = clip.m_Formats.FindFormat(CF_HDROP);
+
+		if(pDittoDelayCF_HDROP && pCF_HDROP)
 		{
-			if(m_ClipIDs.GetCount() > 0)
+			CDittoCF_HDROP *pData = (CDittoCF_HDROP*)GlobalLock(pDittoDelayCF_HDROP->m_hgData);
+			if(pData)
 			{
-				hData = NewGlobalP(m_ClipIDs.GetData(), m_ClipIDs.GetCount()*sizeof(m_ClipIDs[0]));
+				CString csComputerName;
+				CString csIP;
+
+				CTextConvert::ConvertFromUTF8(pData->m_cIP, csIP);
+				CTextConvert::ConvertFromUTF8(pData->m_cComputerName, csComputerName);
+				
+				GlobalUnlock(pDittoDelayCF_HDROP->m_hgData);
+
+				CClient cl;
+				hData = cl.RequestCopiedFiles(*pCF_HDROP, csIP, csComputerName);
 			}
 		}
 		else
 		{
-			CClip clip;
-
-			clip.LoadFormats(m_ClipIDs[0]);
-
-			CClipFormat *pDittoDelayCF_HDROP = clip.m_Formats.FindFormat(theApp.m_RemoteCF_HDROP);
-			CClipFormat *pCF_HDROP = clip.m_Formats.FindFormat(CF_HDROP);
-
-			if(pDittoDelayCF_HDROP && pCF_HDROP)
-			{
-				CDittoCF_HDROP *pData = (CDittoCF_HDROP*)GlobalLock(pDittoDelayCF_HDROP->m_hgData);
-				if(pData)
-				{
-					CString csComputerName;
-					CString csIP;
-
-					CTextConvert::ConvertFromUTF8(pData->m_cIP, csIP);
-					CTextConvert::ConvertFromUTF8(pData->m_cComputerName, csComputerName);
-					
-					GlobalUnlock(pDittoDelayCF_HDROP->m_hgData);
-
-					CClient cl;
-					hData = cl.RequestCopiedFiles(*pCF_HDROP, csIP, csComputerName);
-				}
-			}
-			else
-			{
-				hData = m_ClipIDs.Render(lpFormatEtc->cfFormat);
-			}
+			hData = m_ClipIDs.Render(lpFormatEtc->cfFormat);
 		}
 
 		//Add to a cache of already rendered data

+ 50 - 53
Options.cpp

@@ -61,7 +61,7 @@ bool CGetSetOptions::m_bInConversion = false;
 bool CGetSetOptions::m_bFromIni = false;
 CString CGetSetOptions::m_csIniFileName;
 __int64 CGetSetOptions::nLastDbWriteTime = 0;
-bool CGetSetOptions::m_bGroupWndPinned = true;
+CTheme CGetSetOptions::m_Theme;
 
 CGetSetOptions g_Opt;
 
@@ -151,7 +151,6 @@ void CGetSetOptions::LoadSettings()
 	m_bEnableDebugLogging = GetEnableDebugLogging();
 	m_bEnsureConnectToClipboard = GetEnsureConnectToClipboard();
 	m_bOutputDebugString = false;
-	m_bGroupWndPinned = GetGroupWndPinned();
 
 	GetExtraNetworkPassword(true);
 
@@ -202,6 +201,8 @@ void CGetSetOptions::LoadSettings()
 			}
 		}
 	}
+
+	m_Theme.Load(GetTheme());
 }
 
 void CGetSetOptions::ConverSettingsToIni()
@@ -1629,6 +1630,18 @@ CString CGetSetOptions::GetPath(long lPathID)
 
 		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)
 		{
@@ -1751,63 +1764,56 @@ bool CGetSetOptions::GetIsPortableDitto()
 	return GetProfileLong(_T("Portable"), FALSE) == TRUE;
 }
 
-BOOL CGetSetOptions::GetEditWordWrap()
+CString CGetSetOptions::GetPasteString(CString csAppName)
 {
-	return GetProfileLong(_T("EditWordWrap"), TRUE);
+	CString csString = GetProfileString(csAppName, _T(""), _T("PasteStrings"));
+	if(csString.IsEmpty())
+		return GetDefaultPasteString();
+
+	return csString;
 }
 
-void CGetSetOptions::SetEditWordWrap(BOOL bSet)
+CString CGetSetOptions::GetDefaultPasteString()
 {
-	SetProfileLong(_T("EditWordWrap"), bSet);
+	return GetProfileString(_T("DefaultPasteString"), _T("^v"));
 }
 
-BOOL CGetSetOptions::SetGroupWndSize(CSize size)
+CString CGetSetOptions::GetCopyString(CString csAppName)
 {
-	BOOL bRet = SetProfileLong("GroupWndCX", size.cx);
-	bRet = SetProfileLong("GroupWndCY", size.cy);
+	CString csString = GetProfileString(csAppName, _T(""), _T("CopyStrings"));
+	if(csString.IsEmpty())
+		return GetDefaultCopyString();
 
-	return bRet;
+	return csString;
 }
 
-void CGetSetOptions::GetGroupWndSize(CSize &size)
+CString CGetSetOptions::GetDefaultCopyString()
 {
-	size.cx = GetProfileLong("GroupWndCX", 0);
-	size.cy = GetProfileLong("GroupWndCY", 0);
+	return GetProfileString(_T("DefaultCopyString"), _T("^c"));
 }
 
-BOOL CGetSetOptions::SetGroupWndPoint(CPoint point)
+CString CGetSetOptions::GetCutString(CString csAppName)
 {
-	BOOL bRet = SetProfileLong("GroupWndX", point.x);
-	bRet = SetProfileLong("GroupWndY", point.y);
-
-	return bRet;
-}
+	CString csString = GetProfileString(csAppName, _T(""), _T("CutStrings"));
+	if(csString.IsEmpty())
+		return GetDefaultCutString();
 
-void CGetSetOptions::GetGroupWndPoint(CPoint &point)
-{
-	point.x = GetProfileLong("GroupWndX", 0);
-	point.y = GetProfileLong("GroupWndY", 0);	
+	return csString;
 }
 
-int CGetSetOptions::GetGroupWndTransparency()
+CString CGetSetOptions::GetDefaultCutString()
 {
-	return GetProfileLong("GroupWndTrans", 0);
+	return GetProfileString(_T("DefaultCutString"), _T("^x"));
 }
 
-void CGetSetOptions::SetGroupWndTransparency(int nTrans)
+BOOL CGetSetOptions::GetEditWordWrap()
 {
-	SetProfileLong("GroupWndTrans", nTrans);
+	return GetProfileLong(_T("EditWordWrap"), TRUE);
 }
 
-bool CGetSetOptions::GetGroupWndPinned()
-{
-	return (GetProfileLong("GroupWndPinned", TRUE) == TRUE);
-
-}
-void CGetSetOptions::SetGroupWndPinned(bool bSet)
+void CGetSetOptions::SetEditWordWrap(BOOL bSet)
 {
-	m_bGroupWndPinned = (bSet == TRUE);
-	SetProfileLong("GroupWndPinned", bSet);
+	SetProfileLong(_T("EditWordWrap"), bSet);
 }
 
 bool CGetSetOptions::GetAllowFriends()
@@ -1815,31 +1821,22 @@ bool CGetSetOptions::GetAllowFriends()
 	return (GetProfileLong("AllowFriends", TRUE) == TRUE);
 }
 
-CString CGetSetOptions::GetPasteString(CString csAppName)
+long CGetSetOptions::GetAutoMaxDelay()
 {
-	CString csPasteString = GetProfileString(csAppName, _T(""), _T("PasteStrings"));
-	if(csPasteString.IsEmpty())
-		return GetDefaultPasteString();
-
-	return csPasteString;
+	return GetProfileLong(_T("AutoMaxDelaySeconds"), 2);
 }
 
-CString CGetSetOptions::GetDefaultPasteString()
+void CGetSetOptions::SetAutoMaxDelay(long lDelay)
 {
-	return GetProfileString(_T("DefaultPasteString"), _T("^v"));
+	SetProfileLong(_T("AutoMaxDelaySeconds"), lDelay);
 }
 
-CString CGetSetOptions::GetCopyString(CString csAppName)
+void CGetSetOptions::SetTheme(CString csTheme)
 {
-	CString csCopyString = GetProfileString(csAppName, _T(""), _T("CopyStrings"));
-	if(csCopyString.IsEmpty())
-		return GetDefaultCopyString();
-
-	return csCopyString;
+	SetProfileString(_T("Theme"), csTheme);
 }
 
-CString CGetSetOptions::GetDefaultCopyString()
+CString CGetSetOptions::GetTheme()
 {
-	return GetProfileString(_T("DefaultCopyString"), _T("^c"));
-}
-
+	return GetProfileString(_T("Theme"), "");
+}

+ 18 - 18
Options.h

@@ -1,5 +1,7 @@
 #pragma once
 
+#include "Theme.h"
+
 #define MAX_SEND_CLIENTS	15
 class CSendClients
 {
@@ -55,6 +57,7 @@ public:
 #define PATH_DATABASE		5
 #define PATH_INI			6
 #define PATH_U3_HWND_INI	7
+#define PATH_THEMES			8
 
 class CGetSetOptions
 {
@@ -66,6 +69,7 @@ public:
 	static CString m_csIniFileName;
 	static bool m_bInConversion;
 	static bool m_bU3;
+	static CTheme m_Theme;
 
 	static void LoadSettings();
 	static CString GetIniFileName(bool bLocalIniFile);
@@ -352,31 +356,27 @@ public:
 
 	static BOOL		GetSetCurrentDirectory();
 
-	static bool		GetIsPortableDitto();
-
-	static BOOL		GetEditWordWrap();
-	static void		SetEditWordWrap(BOOL bSet);
-
-	static BOOL SetGroupWndSize(CSize size);
-	static void GetGroupWndSize(CSize &size);
-
-	static BOOL SetGroupWndPoint(CPoint point);
-	static void GetGroupWndPoint(CPoint &point);
-
-	static int GetGroupWndTransparency();
-	static void SetGroupWndTransparency(int nTrans);
-
-	static bool m_bGroupWndPinned;
-	static bool GetGroupWndPinned();
-	static void SetGroupWndPinned(bool bSet);
-
 	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();
 };
 
 // global for easy access and for initialization of fast access variables

+ 1 - 1
OptionsKeyBoard.cpp

@@ -49,7 +49,7 @@ void COptionsKeyBoard::DoDataExchange(CDataExchange* pDX)
 	DDX_Control(pDX, IDC_NAMED_COPY, m_NamedCopy);
 	DDX_Control(pDX, IDC_HOTKEY, m_HotKey);
 	//}}AFX_DATA_MAP
-	DDX_Control(pDX, IDC_STATIC_CUSTOM_KEY, m_CustomeKeysHelp);
+	DDX_Control(pDX, IDC_STATIC_CUSTOM_KEYS, m_CustomeKeysHelp);
 }
 
 BEGIN_MESSAGE_MAP(COptionsKeyBoard, CPropertyPage)

+ 84 - 2
OptionsQuickPaste.cpp

@@ -4,6 +4,7 @@
 #include "stdafx.h"
 #include "CP_Main.h"
 #include "OptionsQuickPaste.h"
+#include ".\optionsquickpaste.h"
 
 #ifdef _DEBUG
 #define new DEBUG_NEW
@@ -11,6 +12,8 @@
 static char THIS_FILE[] = __FILE__;
 #endif
 
+#define DEFAULT_THEME _T("(Default)")
+
 /////////////////////////////////////////////////////////////////////////////
 // COptionsQuickPaste property page
 
@@ -54,6 +57,7 @@ void COptionsQuickPaste::DoDataExchange(CDataExchange* pDX)
 	DDX_Control(pDX, IDC_DESC_SHOW_LEADING_WHITESPACE, m_btDescShowLeadingWhiteSpace);
 	//}}AFX_DATA_MAP
 	DDX_Control(pDX, IDC_CHECK_PROMPT_DELETE_CLIP, m_PromptForDelete);
+	DDX_Control(pDX, IDC_COMBO_THEME, m_cbTheme);
 }
 
 
@@ -62,6 +66,7 @@ BEGIN_MESSAGE_MAP(COptionsQuickPaste, CPropertyPage)
 	ON_BN_CLICKED(IDC_BUTTON_FONT, OnButtonFont)
 	ON_BN_CLICKED(IDC_BUTTON_DEFAULT_FAULT, OnButtonDefaultFault)
 	//}}AFX_MSG_MAP
+	ON_BN_CLICKED(IDC_BUTTON_THEME, OnBnClickedButtonTheme)
 END_MESSAGE_MAP()
 
 /////////////////////////////////////////////////////////////////////////////
@@ -90,8 +95,6 @@ BOOL COptionsQuickPaste::OnInitDialog()
 	else if(CGetSetOptions::GetQuickPastePosition() == POS_AT_PREVIOUS)
 		CheckDlgButton(IDC_AT_PREVIOUS, BST_CHECKED);
 
-	
-
 	m_btDescShowLeadingWhiteSpace.SetCheck(g_Opt.m_bDescShowLeadingWhiteSpace);
 	m_btHistoryStartTop.SetCheck(g_Opt.m_bHistoryStartTop);
 	m_btUseCtrlNum.SetCheck(CGetSetOptions::GetUseCtrlNumForFirstTenHotKeys());
@@ -114,6 +117,8 @@ BOOL COptionsQuickPaste::OnInitDialog()
 	cs.Format(_T("Font - %s"), m_LogFont.lfFaceName);
 	m_btFont.SetWindowText(cs);
 
+	FillThemes();
+
 	theApp.m_Language.UpdateOptionQuickPaste(this);
 		
 	return FALSE;
@@ -147,6 +152,20 @@ BOOL COptionsQuickPaste::OnApply()
 	{
 		CGetSetOptions::SetFont(m_LogFont);
 	}
+
+	CString csTheme;
+	if(m_cbTheme.GetCurSel() >= 0)
+	{
+		m_cbTheme.GetLBText(m_cbTheme.GetCurSel(), csTheme);
+		if(csTheme == DEFAULT_THEME)
+			g_Opt.SetTheme("");
+		else
+			g_Opt.SetTheme(csTheme);
+	}
+	else
+	{
+		g_Opt.SetTheme("");
+	}
 	
 	return CPropertyPage::OnApply();
 }
@@ -191,3 +210,66 @@ void COptionsQuickPaste::OnButtonDefaultFault()
 	cs.Format(_T("Font - %s"), m_LogFont.lfFaceName);
 	m_btFont.SetWindowText(cs);
 }	
+
+void COptionsQuickPaste::FillThemes()
+{
+	CString csFile = CGetSetOptions::GetPath(PATH_THEMES);
+	csFile += "*.xml";
+
+	CString csTheme = CGetSetOptions::GetTheme();
+
+	CFileFind find;
+	BOOL bCont = find.FindFile(csFile);
+	bool bSetCurSel = false;
+
+	while(bCont)
+	{
+		bCont = find.FindNextFile();
+		int nIndex = m_cbTheme.AddString(find.GetFileTitle());
+
+		if(find.GetFileTitle() == csTheme)
+		{
+			m_cbTheme.SetCurSel(nIndex);
+			bSetCurSel = true;
+		}
+	}
+
+	int nIndex = m_cbTheme.AddString(DEFAULT_THEME);
+	if(bSetCurSel == false)
+	{
+		m_cbTheme.SetCurSel(nIndex);
+	}
+
+}
+void COptionsQuickPaste::OnBnClickedButtonTheme()
+{
+	CTheme theme;
+
+	CString csTheme;
+	m_cbTheme.GetLBText(m_cbTheme.GetCurSel(), csTheme);
+
+	if(csTheme == DEFAULT_THEME)
+		return;
+	
+	if(theme.Load(csTheme, true, false))
+	{
+		CString csMessage;
+
+		csMessage.Format(_T("Theme -  %s\n")
+			_T("Version -   %d\n")
+			_T("Author -   %s\n")
+			_T("Notes -   %s"), csTheme, 
+			theme.FileVersion(), 
+			theme.Author(), 
+			theme.Notes());
+
+		MessageBox(csMessage, _T("Ditto"), MB_OK);
+	}
+	else
+	{
+		CString csError;
+		csError.Format(_T("Error loading theme file - %s - reason = "), csTheme, theme.LastError());
+
+		MessageBox(csError, _T("Ditto"), MB_OK);
+	}
+}

+ 4 - 0
OptionsQuickPaste.h

@@ -57,6 +57,8 @@ protected:
 	LOGFONT m_LogFont;
 	CString m_csTitle;
 
+	void FillThemes();
+
 
 // Implementation
 protected:
@@ -70,6 +72,8 @@ protected:
 
 public:
 	CButton m_PromptForDelete;
+	CComboBox m_cbTheme;
+	afx_msg void OnBnClickedButtonTheme();
 };
 
 //{{AFX_INSERT_LOCATION}}

+ 11 - 18
QListCtrl.cpp

@@ -385,13 +385,13 @@ void CQListCtrl::OnCustomdrawList(NMHDR* pNMHDR, LRESULT* pResult)
 		{
             if(bListHasFocus)
 			{
-                crBkgnd = GetSysColor(COLOR_HIGHLIGHT);
-                OldColor = pDC->SetTextColor(GetSysColor(COLOR_HIGHLIGHTTEXT));
+                crBkgnd = g_Opt.m_Theme.ListBoxSelectedBG();
+                OldColor = pDC->SetTextColor(g_Opt.m_Theme.ListBoxSelectedText());
 			}
             else
 			{
-                crBkgnd = GetSysColor(COLOR_BTNFACE);
-                OldColor = pDC->SetTextColor(GetSysColor(COLOR_BTNTEXT));
+                crBkgnd = g_Opt.m_Theme.ListBoxSelectedNoFocusBG();
+                OldColor = pDC->SetTextColor(g_Opt.m_Theme.ListBoxSelectedNoFocusText());
 			}
 		}
         else
@@ -399,21 +399,14 @@ void CQListCtrl::OnCustomdrawList(NMHDR* pNMHDR, LRESULT* pResult)
             //Shade alternating Rows
 			if((nItem % 2) == 0)
 			{
-				COLORREF color = GetSysColor(COLOR_WINDOW);
-				int r = GetRValue(color) - 15;
-				int g = GetGValue(color) - 15;
-				int b = GetBValue(color) - 15;
-
-				r = max(r, 0);
-				g = max(g, 0);
-				b = max(b, 0);
-
-				crBkgnd = RGB(r, g, b);
+				crBkgnd = g_Opt.m_Theme.ListBoxOddRowsBG();
+				OldColor = pDC->SetTextColor(g_Opt.m_Theme.ListBoxOddRowsText());
 			}
 			else
-				crBkgnd = GetSysColor(COLOR_WINDOW);
-			
-            OldColor = pDC->SetTextColor(GetSysColor(COLOR_WINDOWTEXT));
+			{
+				crBkgnd = g_Opt.m_Theme.ListBoxEvenRowsBG();
+				OldColor = pDC->SetTextColor(g_Opt.m_Theme.ListBoxEvenRowsText());
+			}
 		}
 		
         pDC->FillSolidRect(rcItem, crBkgnd);
@@ -436,7 +429,7 @@ void CQListCtrl::OnCustomdrawList(NMHDR* pNMHDR, LRESULT* pResult)
 		int nSymEnd = csText.Find('|');
 		if( nSymEnd >= 0 )
 		{
-			strSymbols = csText.Left(nSymEnd);
+			strSymbols = csText.Left(nSymEnd);  
 			csText = csText.Mid(nSymEnd+1);
 		}
 		

+ 115 - 66
QPasteWnd.cpp

@@ -48,6 +48,7 @@ static char THIS_FILE[] = __FILE__;
 CQPasteWnd::CQPasteWnd()
 {	
 	m_Title = QPASTE_TITLE;
+	m_bHideWnd = true;
 	m_strSQLSearch = "";
 	m_bAllowRepaintImmediately = true;
 	m_bHandleSearchTextChange = true;
@@ -106,7 +107,8 @@ BEGIN_MESSAGE_MAP(CQPasteWnd, CWndEx)
 	ON_COMMAND(ID_MENU_QUICKOPTIONS_DOUBLECLICKINGONCAPTION_ROLLUPWINDOW, OnMenuQuickoptionsDoubleclickingoncaptionRollupwindow)
 	ON_COMMAND(ID_MENU_QUICKOPTIONS_DOUBLECLICKINGONCAPTION_TOGGLESALWAYSSHOWDESCRIPTION, OnMenuQuickoptionsDoubleclickingoncaptionTogglesshowdescription)
 	ON_COMMAND(ID_MENU_QUICKOPTIONS_PROMPTFORNEWGROUPNAMES, OnMenuQuickoptionsPromptfornewgroupnames)
-	ON_BN_CLICKED(ID_SHOW_GROUPS_BOTTOM, OnShowGroups)
+	ON_BN_CLICKED(ID_SHOW_GROUPS_BOTTOM, OnShowGroupsBottom)
+	ON_BN_CLICKED(ID_SHOW_GROUPS_TOP, OnShowGroupsTop)
 	ON_COMMAND(ID_MENU_VIEWGROUPS, OnMenuViewgroups)
 	ON_COMMAND(ID_MENU_QUICKPROPERTIES_SETTONEVERAUTODELETE, OnMenuQuickpropertiesSettoneverautodelete)
 	ON_COMMAND(ID_MENU_QUICKPROPERTIES_AUTODELETE, OnMenuQuickpropertiesAutodelete)
@@ -231,14 +233,11 @@ int CQPasteWnd::OnCreate(LPCREATESTRUCT lpCreateStruct)
 		return -1;
 	}
 
-	m_GroupWnd.CreateEx(NULL, _T("SysTreeView32"), NULL, WS_POPUP, CRect(0, 0, 0, 0), this, 0);
-	m_GroupWnd.SetNotifyWnd(m_hWnd);
-
-	CPoint Point;
-	CSize Size;
-	CGetSetOptions::GetQuickPastePoint(Point);
-	CGetSetOptions::GetQuickPasteSize(Size);
-	m_GroupWnd.MoveWindow(Point.x, Point.y, Size.cx, Size.cy);
+	((CWnd *)&m_GroupTree)->CreateEx(NULL, _T("SysTreeView32"), NULL, WS_BORDER|TVS_HASLINES|TVS_LINESATROOT|TVS_HASBUTTONS, CRect(0, 0, 100, 100), this, 0);
+	m_GroupTree.ModifyStyle(WS_CAPTION, WS_BORDER);
+	
+	m_GroupTree.SetNotificationWndEx(m_hWnd);
+	m_GroupTree.ShowWindow(SW_HIDE);
 	
 	m_ShowGroupsFolderBottom.Create(NULL, WS_CHILD | BS_OWNERDRAW | WS_TABSTOP, CRect(0, 0, 0, 0), this, ID_SHOW_GROUPS_BOTTOM);
 	m_ShowGroupsFolderBottom.LoadBitmaps(IDB_CLOSED_FOLDER, IDB_CLOSED_FOLDER_PRESSED, IDB_CLOSED_FOLDER_FOCUSED);
@@ -298,11 +297,7 @@ int CQPasteWnd::OnCreate(LPCREATESTRUCT lpCreateStruct)
 	m_SearchingEvent = CreateEvent(NULL, TRUE, FALSE, _T(""));
 
 	AfxBeginThread(StartThread, this);
-
-	AddWindowToSnapTo(&m_GroupWnd);
-	SetMoveAttachedWnds(true);
-	m_GroupWnd.AddWindowToSnapTo(this);
-
+		
 	return 0;
 }
 
@@ -370,7 +365,7 @@ void CQPasteWnd::OnSetFocus(CWnd* pOldWnd)
 {
 	CWndEx::OnSetFocus(pOldWnd);
 
-	//::SetWindowPos(m_hWnd, HWND_TOPMOST, 0, 0, 0, 0, SWP_NOSIZE|SWP_NOMOVE|SWP_SHOWWINDOW);
+	::SetWindowPos(m_hWnd, HWND_TOPMOST, 0, 0, 0, 0, SWP_NOSIZE|SWP_NOMOVE|SWP_SHOWWINDOW);
 	
 	// Set the focus to the list control
 	if(::IsWindow(m_lstHeader.m_hWnd))
@@ -380,23 +375,22 @@ void CQPasteWnd::OnSetFocus(CWnd* pOldWnd)
 void CQPasteWnd::OnActivate(UINT nState, CWnd* pWndOther, BOOL bMinimized) 
 {
 	CWndEx::OnActivate(nState, pWndOther, bMinimized);
-		
+	
+	if(m_bHideWnd == false || m_lstHeader.GetToolTipHWnd() == pWndOther->GetSafeHwnd())
+		return;
+	
 	if (nState == WA_INACTIVE)
 	{
-		HWND hNew = ::GetForegroundWindow();
-		DWORD OtherThreadID = GetWindowThreadProcessId(hNew, NULL);
-		DWORD ThisThreadID = GetWindowThreadProcessId(m_hWnd, NULL);
-
-		if(OtherThreadID != ThisThreadID)
+		if(!g_Opt.m_bShowPersistent)
 		{
 			HideQPasteWindow();
-			
-			//re register the global hot keys for the last ten
-			if(theApp.m_bAppExiting == false)
-				g_HotKeys.RegisterAll();
-
-			m_lstHeader.HidePopup();
 		}
+		
+		//re register the global hot keys for the last ten
+		if(theApp.m_bAppExiting == false)
+			g_HotKeys.RegisterAll();
+
+		m_lstHeader.HidePopup();
 	}
 	else if (nState == WA_ACTIVE || nState == WA_CLICKACTIVE)
 	{
@@ -424,6 +418,7 @@ BOOL CQPasteWnd::HideQPasteWindow()
 	theApp.ReleaseFocus();
 	
 	SetEvent(m_Events[THREAD_DESTROY_ACCELERATORS]);
+//	m_lstHeader.DestroyAndCreateAccelerator(FALSE);
 	
 	KillTimer(TIMER_FILL_CACHE);
 	
@@ -433,14 +428,8 @@ BOOL CQPasteWnd::HideQPasteWindow()
 	CGetSetOptions::SetQuickPasteSize(rect.Size());
 	CGetSetOptions::SetQuickPastePoint(rect.TopLeft());
 
-	//Save the group wnd size
-	m_GroupWnd.GetWindowRect(&rect);
-	CGetSetOptions::SetGroupWndSize(rect.Size());
-	CGetSetOptions::SetGroupWndPoint(rect.TopLeft());
-
 	// Hide the window when the focus is lost
 	ShowWindow(SW_HIDE);
-	m_GroupWnd.ShowWindow(SW_HIDE);
 	
 	//Reset the selection in the search combo
 	m_bHandleSearchTextChange = false;
@@ -470,9 +459,12 @@ BOOL CQPasteWnd::HideQPasteWindow()
 
 BOOL CQPasteWnd::ShowQPasteWindow(BOOL bFillList)
 {
+	//Ensure we have the latest theme file, this checks the last write time so it doesn't read the file each time
+	g_Opt.m_Theme.Load(g_Opt.GetTheme(), false, true);
+
 	//Set the flag so we can't open this up again
 	theApp.m_bShowingQuickPaste = true;
-	SetCaptionColorActive(!g_Opt.m_bShowPersistent, theApp.GetConnectCV());
+	SetCaptionColorActive(g_Opt.m_bShowPersistent, theApp.GetConnectCV());
 	
 	// use invalidation to avoid unnecessary repainting
 	m_bAllowRepaintImmediately = false;
@@ -480,6 +472,8 @@ BOOL CQPasteWnd::ShowQPasteWindow(BOOL bFillList)
 	
 	SetEvent(m_Events[THREAD_FILL_ACCELERATORS]);
 	
+	m_bHideWnd = true;
+	
 #ifdef AFTER_98
 	//Set the transparency
 	if(CGetSetOptions::GetEnableTransparency())
@@ -512,7 +506,11 @@ BOOL CQPasteWnd::ShowQPasteWindow(BOOL bFillList)
 	
 	// from now on, for interactive use, we can repaint immediately
 	m_bAllowRepaintImmediately = true;
-		
+	
+	// always on top... for persistent showing (g_Opt.m_bShowPersistent)
+	// SHOWWINDOW was also integrated into this function rather than calling it separately
+	::SetWindowPos( m_hWnd, HWND_TOPMOST, 0, 0, 0, 0, SWP_NOSIZE|SWP_NOMOVE|SWP_SHOWWINDOW );
+	
 	return TRUE;
 }
 
@@ -619,8 +617,12 @@ BOOL CQPasteWnd::NewGroup( bool bGroupSelection )
 	CString csName("");
 	
 	if(g_Opt.m_bPrompForNewGroupName)
-	{	
+	{
+		m_bHideWnd = false;
+		
 		int nRet = Name.DoModal();
+	
+		m_bHideWnd = true;
 		
 		if(nRet == IDOK)
 			csName = Name.m_csName;
@@ -712,13 +714,6 @@ LRESULT CQPasteWnd::OnRefreshView(WPARAM wParam, LPARAM lParam)
 
 	theApp.m_FocusID = -1;
 
-	if (((int)wParam) > 0)
-	{
-		int nCaretPos = m_lstHeader.GetCaret();
-		if(nCaretPos >= 0 && theApp.m_FocusID < 0)
-			theApp.m_FocusID = m_lstHeader.GetItemData(nCaretPos);
-	}
-
 	if(theApp.m_bShowingQuickPaste)
 	{
 		FillList();
@@ -1228,6 +1223,8 @@ void CQPasteWnd::OnMenuToggleConnectCV()
 
 void CQPasteWnd::OnMenuProperties() 
 {	
+	m_bHideWnd = false;
+	
 	ARRAY IDs, Indexes;
 	m_lstHeader.GetSelectionItemData(IDs);
 	m_lstHeader.GetSelectionIndexes(Indexes);
@@ -1280,6 +1277,8 @@ void CQPasteWnd::OnMenuProperties()
 		m_lstHeader.SetFocus();
 		m_lstHeader.SetListPos(nRow);
 	}
+	
+	m_bHideWnd = true;
 }
 
 void CQPasteWnd::UpdateFont()
@@ -1397,7 +1396,7 @@ void CQPasteWnd::OnMenuQuickoptionsPromptfornewgroupnames()
 
 void CQPasteWnd::OnMenuViewgroups() 
 {
-	OnShowGroups();
+	OnShowGroupsTop();
 }
 
 void CQPasteWnd::OnMenuQuickpropertiesSettoneverautodelete() 
@@ -1624,6 +1623,8 @@ void CQPasteWnd::OnMenuSenttoPromptforip()
 
 void CQPasteWnd::OnMenuGroupsMovetogroup() 
 {
+	m_bHideWnd = false;
+
 	CMoveToGroupDlg dlg;
 
 	int nRet = dlg.DoModal();
@@ -1639,6 +1640,8 @@ void CQPasteWnd::OnMenuGroupsMovetogroup()
 		}
 		FillList();
 	}
+
+	m_bHideWnd = true;
 }
 
 void CQPasteWnd::OnMenuPasteplaintextonly() 
@@ -1691,6 +1694,8 @@ void CQPasteWnd::OnMenuExport()
 	ofn.lpstrDefExt = _T("dto");
 	ofn.Flags = OFN_PATHMUSTEXIST | OFN_FILEMUSTEXIST | OFN_OVERWRITEPROMPT;
 
+	m_bHideWnd = false;
+
 	if(GetSaveFileName(&ofn)) 
 	{
 		using namespace nsPath;
@@ -1701,11 +1706,15 @@ void CQPasteWnd::OnMenuExport()
 		CString csFile(ofn.lpstrFile);
 		IDs.Export(csFile);
 	}
+
+	m_bHideWnd = true;
 }
 
 void CQPasteWnd::OnMenuImport()
 {
+	m_bHideWnd = false;
 	theApp.ImportClips(m_hWnd);
+	m_bHideWnd = true;
 }
 
 void CQPasteWnd::OnMenuHelp() 
@@ -1718,6 +1727,8 @@ void CQPasteWnd::OnMenuHelp()
 
 void CQPasteWnd::OnMenuQuickoptionsFont() 
 {
+	m_bHideWnd = false;
+
 	CFont *pFont = m_lstHeader.GetFont();
 	LOGFONT lf;
 	pFont->GetLogFont(&lf);
@@ -1727,6 +1738,8 @@ void CQPasteWnd::OnMenuQuickoptionsFont()
 		CGetSetOptions::SetFont(*dlg.m_cf.lpLogFont);
 		m_lstHeader.SetLogFont(*dlg.m_cf.lpLogFont);
 	}
+	
+	m_bHideWnd = true;
 }
 
 void CQPasteWnd::OnMenuQuickoptionsShowthumbnails() 
@@ -1799,6 +1812,8 @@ BOOL CQPasteWnd::SendToFriendbyPos(int nPos)
 
 	CWaitCursor wait;
 
+	m_bHideWnd = false;
+
 	CClipIDs IDs;
 	long lCount = m_lstHeader.GetSelectedCount();
 	if(lCount <= 0)
@@ -1849,6 +1864,8 @@ BOOL CQPasteWnd::SendToFriendbyPos(int nPos)
 	}
 	CATCH_SQLITE_EXCEPTION	
 
+	m_bHideWnd = true;
+
 	return bRet;
 }
 
@@ -1863,7 +1880,12 @@ void CQPasteWnd::DeleteSelectedRows()
 {
 	if(g_Opt.GetPromptWhenDeletingClips())
 	{
+		bool bStartValue = m_bHideWnd;
+		m_bHideWnd = false;
+
 		int nRet = MessageBox(theApp.m_Language.GetString("Delete_Clip", "Delete Selected Clips?"), _T("Ditto"), MB_YESNO);
+	
+		m_bHideWnd = bStartValue;
 
 		if(nRet == IDNO)
 			return;
@@ -1988,11 +2010,11 @@ BOOL CQPasteWnd::PreTranslateMessage(MSG* pMsg)
 					}
 					else
 					{	
-	/*					if(m_GroupTree.IsWindowVisible() == FALSE)
+						if(m_GroupTree.IsWindowVisible() == FALSE)
 						{
 							HideQPasteWindow();
 							return TRUE;
-						}*/
+						}
 					}
 				}
 				break;
@@ -2016,7 +2038,7 @@ BOOL CQPasteWnd::PreTranslateMessage(MSG* pMsg)
 		case 'G':
 			if(GetKeyState(VK_CONTROL) & 0x8000)
 			{
-				OnShowGroups();
+				OnShowGroupsTop();
 				return TRUE;
 			}
 		case 'N':
@@ -2302,8 +2324,6 @@ void CQPasteWnd::OnNcLButtonDblClk(UINT nHitTest, CPoint point)
 		{
 		case TOGGLES_ALLWAYS_ON_TOP:
 			theApp.ShowPersistent( !g_Opt.m_bShowPersistent );
-			::SetWindowPos(m_hWnd, HWND_TOPMOST, 0, 0, 0, 0, SWP_NOSIZE|SWP_NOMOVE|SWP_SHOWWINDOW);
-			
 			break;
 		case TOGGLES_ALLWAYS_SHOW_DESCRIPTION:
 			CGetSetOptions::SetAllwaysShowDescription(!g_Opt.m_bAllwaysShowDescription);
@@ -2323,6 +2343,8 @@ void CQPasteWnd::OnWindowPosChanging(WINDOWPOS* lpwndpos)
 {
 	CWndEx::OnWindowPosChanging(lpwndpos);
 
+//	m_lstHeader.HidePopup();
+	
 	CRect rcScreen;
 	
 	CRect cr(lpwndpos->x, lpwndpos->y, lpwndpos->x + lpwndpos->cx, lpwndpos->y + lpwndpos->cy);
@@ -2355,30 +2377,55 @@ void CQPasteWnd::OnWindowPosChanging(WINDOWPOS* lpwndpos)
 	}
 }
 
-void CQPasteWnd::OnShowGroups()
+void CQPasteWnd::OnShowGroupsTop()
 {
-	if(m_GroupWnd.IsWindowVisible())
-	{
-		m_GroupWnd.ShowWindow(SW_HIDE);
-		SetFocus();
-	}
-	else
-	{
-		m_GroupWnd.RefreshTree(-1);
-		m_GroupWnd.ShowWindow(SW_SHOW);
-	}
+	OnShowGroupsBottom();
+	return;
+	m_GroupTree.m_bHide = false;
+	m_bHideWnd = false;
+	
+	CRect crList;
+	m_lstHeader.GetWindowRect(crList);
+	
+	CRect cr(crList.left, crList.top, crList.left + crList.Width(), crList.top + 200);
+	
+	m_GroupTree.MoveWindow(cr);
+	m_GroupTree.m_lSelectedFolderID = theApp.m_GroupID;
+	m_GroupTree.FillTree();
+	m_GroupTree.ShowWindow(SW_SHOW);
+	
+	m_GroupTree.m_bHide = true;
+	m_bHideWnd = true;
 }
 
-LRESULT CQPasteWnd::OnGroupTreeMessage(WPARAM wParam, LPARAM lParam)
+void CQPasteWnd::OnShowGroupsBottom()
 {
-	if(lParam == TRUE)
-	{
-		HideQPasteWindow();
-		return TRUE;
-	}
+	m_GroupTree.m_bHide = false;
+	m_bHideWnd = false;
+	
+	CRect crWindow, crList;
+	m_lstHeader.GetWindowRect(crList);
+	GetWindowRect(crWindow);
+	
+	CRect cr(crWindow.left, crWindow.bottom, crWindow.left + crWindow.Width(), crWindow.bottom + 200);
+	
+	m_GroupTree.MoveWindow(cr);
+	m_GroupTree.m_lSelectedFolderID = theApp.m_GroupID;
+	m_GroupTree.FillTree();
+	m_GroupTree.ShowWindow(SW_SHOW);
+	
+	m_GroupTree.m_bHide = true;
+	m_bHideWnd = true;
+}
 
+LRESULT CQPasteWnd::OnGroupTreeMessage(WPARAM wParam, LPARAM lParam)
+{
+	m_bHideWnd = false;
+	
 	long lID = (long)wParam;
 	
+	m_GroupTree.ShowWindow(SW_HIDE);
+	
 	m_bHandleSearchTextChange = false;
 	m_Search.SetWindowText(_T(""));
 	m_bHandleSearchTextChange = true;
@@ -2406,6 +2453,8 @@ LRESULT CQPasteWnd::OnGroupTreeMessage(WPARAM wParam, LPARAM lParam)
 		HideQPasteWindow();
 	}
 	
+	m_bHideWnd = true;
+	
 	return TRUE;
 }
 

+ 4 - 4
QPasteWnd.h

@@ -14,8 +14,6 @@
 #include "GroupTree.h"
 #include "AlphaBlend.h"
 #include "Sqlite\CppSQLite3.h"
-#include "GroupWnd.h"
-
 #include <vector>
 #include <afxmt.h>
 
@@ -78,10 +76,12 @@ public:
 	CSearchEditBox	m_Search;
 	CFont			m_SearchFont;
 	CButton			m_btCancel;
+	bool			m_bHideWnd;
 	CString			m_strSQLSearch;
 	CGroupStatic	m_stGroup;
 	CFont			GroupFont;
 	CString			m_Title;
+	CGroupTree		m_GroupTree;
 	CBitmapButton	m_ShowGroupsFolderBottom;
 	CBitmapButton	m_ShowGroupsFolderTop;
 	CBitmapButton	m_BackButton;
@@ -94,7 +94,6 @@ public:
 	bool			m_bHandleSearchTextChange;
 	bool			m_bFoundClipToSetFocusTo;
 	long			m_lItemsPerPage;
-	CGroupWnd		m_GroupWnd;
 
 	std::vector<CMainTable> m_Cache;
 
@@ -182,7 +181,8 @@ protected:
 	afx_msg void OnMenuQuickoptionsDoubleclickingoncaptionRollupwindow();
 	afx_msg void OnMenuQuickoptionsDoubleclickingoncaptionTogglesshowdescription();
 	afx_msg void OnMenuQuickoptionsPromptfornewgroupnames();
-	afx_msg void OnShowGroups();
+	afx_msg void OnShowGroupsBottom();
+	afx_msg void OnShowGroupsTop();
 	afx_msg void OnMenuViewgroups();
 	afx_msg void OnMenuQuickpropertiesSettoneverautodelete();
 	afx_msg void OnMenuQuickpropertiesAutodelete();

+ 6 - 3
QuickPaste.cpp

@@ -133,9 +133,12 @@ void CQuickPaste::ShowQPasteWnd(CWnd *pParent, bool bAtPrevPos, bool bFromKeyboa
 	{
 		CRect cr;
 		::GetWindowRect(theApp.m_hTargetWnd, cr);
-		ptCaret = cr.CenterPoint();
-		ptCaret.x -= csSize.cx/2;
-		ptCaret.y -= csSize.cy/2;
+		if(cr.PtInRect(ptCaret) == FALSE)
+		{
+			ptCaret = cr.CenterPoint();
+			ptCaret.x -= csSize.cx/2;
+			ptCaret.y -= csSize.cy/2;
+		}
 	}
 	
 	if(bAtPrevPos)

BIN
Release/focus.dll


BIN
Release/focus.lib


+ 7 - 8
Resource.h

@@ -29,7 +29,6 @@
 #define IDD_DIALOG_REMOTE_FILE          157
 #define IDR_FILE_COPY                   158
 #define IDD_OPTIONS_COPY_BUFFERS        166
-#define IDR_TOOLBAR_GROUP               167
 #define IDC_PATH                        1000
 #define IDC_GET_PATH                    1001
 #define IDC_SELECT_SOUND                1002
@@ -216,10 +215,13 @@
 #define IDC_WIN_COPY_2                  2090
 #define IDC_STATIC_CLIP_SEPARATOR       2090
 #define IDC_PASTE_2                     2091
+#define IDC_STATIC_CUSTOM_KEYS          2091
 #define IDC_WIN_PASTE_2                 2092
-#define IDC_STATIC_CUSTOM_KEY           2092
+#define IDC_STATIC_THEME                2092
 #define IDC_STATIC_COPY_2               2093
+#define IDC_COMBO_THEME                 2093
 #define IDC_STATIC_PASTE_2              2094
+#define IDC_BUTTON_THEME                2094
 #define IDC_CUT_2                       2095
 #define IDC_WIN_CUT_2                   2096
 #define IDC_STATIC_CUT_2                2097
@@ -325,18 +327,15 @@
 #define ID_FIRST_NEWCLIP                32868
 #define ID_BUTTON_SAVE_CLOSE_CLIPBOARD  32869
 #define ID_FIRST_COPYTODEVICE           32870
-#define ID_BUTTON_REFRESH_GROUP         32872
-#define ID_BUTTON_PIN                   32874
-#define ID_BUTTON_NEW_GROUP             32875
 
 // Next default values for new objects
 // 
 #ifdef APSTUDIO_INVOKED
 #ifndef APSTUDIO_READONLY_SYMBOLS
 #define _APS_3D_CONTROLS                     1
-#define _APS_NEXT_RESOURCE_VALUE        169
-#define _APS_NEXT_COMMAND_VALUE         32876
-#define _APS_NEXT_CONTROL_VALUE         2093
+#define _APS_NEXT_RESOURCE_VALUE        167
+#define _APS_NEXT_COMMAND_VALUE         32871
+#define _APS_NEXT_CONTROL_VALUE         2095
 #define _APS_NEXT_SYMED_VALUE           101
 #endif
 #endif

+ 151 - 0
Theme.cpp

@@ -0,0 +1,151 @@
+#include "stdafx.h"
+#include ".\theme.h"
+#include "TextConvert.h"
+#include "Misc.h"
+#include "Options.h"
+
+CTheme::CTheme(void)
+{
+	m_lFileVersion = 0;
+	m_LastWriteTime = 0;
+
+	m_CaptionLeft = RGB(0, 84, 195);
+	m_CaptionRight = RGB(61, 149, 255);
+	m_CaptionLeftTopMost = RGB(122, 150, 223);
+	m_CaptionRightTopMost = RGB(157, 185, 235);
+	m_CaptionLeftNotConnected = RGB(255, 0, 0);
+	m_CaptionRightNotConnected = RGB(255, 0, 0);
+	m_CaptionTextColor = RGB(255, 255, 255);
+	m_ListBoxOddRowsBG = RGB(255, 255, 255);
+	m_ListBoxEvenRowsBG = RGB(240, 240, 240);
+	m_ListBoxOddRowsText = RGB(0, 0, 0);
+	m_ListBoxEvenRowsText = RGB(0, 0, 0);
+	m_ListBoxSelectedBG = RGB(30, 116, 211);
+	m_ListBoxSelectedNoFocusBG = RGB(236, 233, 216);
+	m_ListBoxSelectedText = RGB(255, 255, 255);
+	m_ListBoxSelectedNoFocusText = RGB(0, 0, 0);
+}
+
+CTheme::~CTheme(void)
+{
+}
+
+
+bool CTheme::Load(CString csTheme, bool bHeaderOnly, bool bCheckLastWriteTime)
+{
+	if(csTheme.IsEmpty())
+		return false;
+
+	CString csPath = CGetSetOptions::GetPath(PATH_THEMES);
+	csPath += csTheme;
+	csPath += ".xml";
+
+	__int64 LastWrite = GetLastWriteTime(csPath);
+
+	if(bCheckLastWriteTime)
+	{	
+		if(LastWrite == m_LastWriteTime)
+		{
+			return true;
+		}
+	}
+
+	m_LastWriteTime = LastWrite;
+
+	Log(StrF(_T("Loading Theme %s"), csPath));
+
+	CStringA csPathA = CTextConvert::ConvertToChar(csPath);
+
+	TiXmlDocument doc(csPathA);
+	if(!doc.LoadFile())
+	{
+		m_csLastError.Format(_T("Error loading Theme %s - reason = %s"), csPath, doc.ErrorDesc());
+		ASSERT(!m_csLastError);
+		Log(m_csLastError);
+		return false;
+	}
+
+	TiXmlElement *ItemHeader = doc.FirstChildElement("Ditto_Theme_File");
+	if(!ItemHeader)
+	{
+		m_csLastError.Format(_T("Error finding the section Ditto_Theme_File"));
+		ASSERT(!m_csLastError);
+		Log(m_csLastError);
+		return false;
+	}
+
+	CString csVersion = ItemHeader->Attribute("Version");
+	m_lFileVersion = ATOI(csVersion);
+	m_csAuthor = ItemHeader->Attribute("Author");
+	m_csNotes = ItemHeader->Attribute("Notes");
+
+	if(bHeaderOnly)
+		return true;
+
+	LoadElement(ItemHeader, "CaptionLeft", m_CaptionLeft);
+	LoadElement(ItemHeader, "CaptionRight", m_CaptionRight);
+	LoadElement(ItemHeader, "CaptionLeftTopMost", m_CaptionLeftTopMost);
+	LoadElement(ItemHeader, "CaptionRightTopMost", m_CaptionRightTopMost);
+	LoadElement(ItemHeader, "CaptionLeftNotConnected", m_CaptionLeftNotConnected);
+	LoadElement(ItemHeader, "CaptionRightNotConnected", m_CaptionRightNotConnected);
+	LoadElement(ItemHeader, "CaptionTextColor", m_CaptionTextColor);
+	LoadElement(ItemHeader, "ListBoxOddRowsBG", m_ListBoxOddRowsBG);
+	LoadElement(ItemHeader, "ListBoxEvenRowsBG", m_ListBoxEvenRowsBG);
+	LoadElement(ItemHeader, "ListBoxOddRowsText", m_ListBoxOddRowsText);
+	LoadElement(ItemHeader, "ListBoxEvenRowsText", m_ListBoxEvenRowsText);
+	LoadElement(ItemHeader, "ListBoxSelectedBG", m_ListBoxSelectedBG);
+	LoadElement(ItemHeader, "ListBoxSelectedNoFocusBG", m_ListBoxSelectedNoFocusBG);
+	LoadElement(ItemHeader, "ListBoxSelectedText", m_ListBoxSelectedText);
+	LoadElement(ItemHeader, "ListBoxSelectedNoFocusText", m_ListBoxSelectedNoFocusText);
+
+	return true;
+}
+
+bool CTheme::LoadElement(TiXmlElement *pParent, CStringA csNode, COLORREF &Color)
+{
+	TiXmlElement *pColorNode = pParent->FirstChildElement(csNode);
+	if(pColorNode == NULL)
+	{
+		m_csLastError.Format(_T("Theme Load, error loading Node = %s"), csNode);
+		Log(m_csLastError);
+		return false;
+	}
+
+	TiXmlNode *pColor = pColorNode->FirstChild();
+	if(pColor == NULL)
+	{
+		m_csLastError.Format(_T("Theme Load, error getting node text for = %s"), csNode);
+		Log(m_csLastError);
+		return false;
+	}
+	
+	CString csColor = pColor->Value();
+	csColor = csColor.Trim();
+	csColor.Replace(_T("RGB("), _T(""));
+	csColor.Replace(_T(")"), _T(""));
+
+	CTokenizer token(csColor, _T(","));
+	CString csR;
+	CString csG;
+	CString csB;
+
+	token.Next(csR);
+	token.Next(csG);
+	token.Next(csB);
+
+	csR = csR.Trim();
+	csG = csG.Trim();
+	csB = csB.Trim();
+
+	//Only the first is valid they entered the RGB value as a single number
+	if(csR != "" && csG == "" && csB == "")
+	{	
+		Color = ATOI(csR);
+	}
+	else
+	{
+		Color = RGB(ATOI(csR), ATOI(csG), ATOI(csB));
+	}
+
+	return true;
+}

+ 64 - 0
Theme.h

@@ -0,0 +1,64 @@
+#pragma once
+
+#include "Tinyxml.h"
+#include "tinystr.h"
+
+class CTheme
+{
+public:
+	CTheme(void);
+	~CTheme(void);
+
+	bool Load(CString csTheme, bool bHeaderOnly = false, bool bCheckLastWriteTime = false);
+
+	COLORREF CaptionLeft() const { return m_CaptionLeft; }
+	COLORREF CaptionRight() const { return m_CaptionRight; }
+	COLORREF CaptionLeftTopMost() const { return m_CaptionLeftTopMost; }
+	COLORREF CaptionRightTopMost() const { return m_CaptionRightTopMost; }
+	COLORREF CaptionLeftNotConnected() const { return m_CaptionLeftNotConnected; }
+	COLORREF CaptionRightNotConnected() const { return m_CaptionRightNotConnected; }
+	COLORREF CaptionTextColor() const { return m_CaptionTextColor; }
+	
+	COLORREF ListBoxOddRowsBG() const { return m_ListBoxOddRowsBG; }
+	COLORREF ListBoxEvenRowsBG() const { return m_ListBoxEvenRowsBG; }
+	COLORREF ListBoxOddRowsText() const { return m_ListBoxOddRowsText; }
+	COLORREF ListBoxEvenRowsText() const { return m_ListBoxEvenRowsText; }
+	COLORREF ListBoxSelectedBG() const { return m_ListBoxSelectedBG; }
+	COLORREF ListBoxSelectedNoFocusBG() const { return m_ListBoxSelectedNoFocusBG; }
+	COLORREF ListBoxSelectedText() const { return m_ListBoxSelectedText; }
+	COLORREF ListBoxSelectedNoFocusText() const { return m_ListBoxSelectedNoFocusText; }
+
+	CString Notes() const { return m_csNotes; }
+	CString Author() const { return m_csAuthor; }
+	long FileVersion() const { return m_lFileVersion; }
+
+	CString LastError() const { return m_csLastError; }
+
+protected:
+	bool LoadElement(TiXmlElement *pParent, CStringA csNode, COLORREF &Color);
+
+protected:
+	COLORREF m_CaptionLeft;
+	COLORREF m_CaptionRight;
+	COLORREF m_CaptionLeftTopMost;
+	COLORREF m_CaptionRightTopMost;
+	COLORREF m_CaptionLeftNotConnected;
+	COLORREF m_CaptionRightNotConnected;
+	COLORREF m_CaptionTextColor;
+
+	COLORREF m_ListBoxOddRowsBG;
+	COLORREF m_ListBoxEvenRowsBG;
+	COLORREF m_ListBoxOddRowsText;
+	COLORREF m_ListBoxEvenRowsText;
+	COLORREF m_ListBoxSelectedBG;
+	COLORREF m_ListBoxSelectedNoFocusBG;
+	COLORREF m_ListBoxSelectedText;
+	COLORREF m_ListBoxSelectedNoFocusText;	
+
+	CString m_csLastError;
+	long m_lFileVersion;
+	CString m_csAuthor;
+	CString m_csNotes;
+
+	__int64 m_LastWriteTime;
+};

BIN
UEncryptDecrypt.lib


BIN
UEncryptDecryptD.lib


+ 41 - 28
WndEx.cpp

@@ -25,6 +25,7 @@ CWndEx::CWndEx()
 {	
 	SetCaptionColorActive(false, theApp.GetConnectCV());
 	m_crFullSizeWindow.SetRectEmpty();
+	m_lDelayMaxSeconds = 2;
 }
 
 CWndEx::~CWndEx()
@@ -44,17 +45,10 @@ void CWndEx::GetWindowRectEx(LPRECT lpRect)
 		return;
 	}
 	
-	CMagneticWnd::GetWindowRect(lpRect);
+	CWnd::GetWindowRect(lpRect);
 }
 
-bool CWndEx::SetCaptionColors( COLORREF left, COLORREF right )
-{
-	m_DittoWindow.SetCaptionColors(left, right);
-	
-	return true;
-}
-
-BEGIN_MESSAGE_MAP(CWndEx, CMagneticWnd)
+BEGIN_MESSAGE_MAP(CWndEx, CWnd)
 //{{AFX_MSG_MAP(CWndEx)
 	ON_WM_CREATE()
 	ON_WM_NCPAINT()
@@ -99,7 +93,7 @@ BOOL CWndEx::Create(const CRect& crStart, CWnd* pParentWnd)
 
 int CWndEx::OnCreate(LPCREATESTRUCT lpCreateStruct) 
 {
-	if (CMagneticWnd::OnCreate(lpCreateStruct) == -1)
+	if (CWnd::OnCreate(lpCreateStruct) == -1)
 		return -1;
 	
 	m_DittoWindow.DoCreate(this);
@@ -109,26 +103,33 @@ int CWndEx::OnCreate(LPCREATESTRUCT lpCreateStruct)
 	SetAutoHide(CGetSetOptions::GetAutoHide());
 	SetCaptionColorActive(false, theApp.GetConnectCV());
 	m_DittoWindow.SetCaptionOn(this, CGetSetOptions::GetCaptionPos(), true);
+	SetAutoMaxDelay(CGetSetOptions::GetAutoMaxDelay());
 	
 	return 0;
 }
 
-bool CWndEx::SetCaptionColorActive(bool bActive, bool ConnectedToClipboard)
+bool CWndEx::SetCaptionColorActive(BOOL bPersistant, BOOL ConnectedToClipboard)
 {
 	bool bResult;
 
 	if(ConnectedToClipboard == false)
 	{
-		bResult = SetCaptionColors(RGB(255, 0, 0), RGB(255, 0, 0));
+		bResult = m_DittoWindow.SetCaptionColors(g_Opt.m_Theme.CaptionLeftNotConnected(), g_Opt.m_Theme.CaptionRightNotConnected());
 	}
 	else
 	{
-		if(bActive)
-			bResult = SetCaptionColors(::GetSysColor(COLOR_ACTIVECAPTION), ::GetSysColor(COLOR_GRADIENTACTIVECAPTION));
+		if(bPersistant)
+		{
+			bResult = m_DittoWindow.SetCaptionColors(g_Opt.m_Theme.CaptionLeftTopMost(), g_Opt.m_Theme.CaptionRightTopMost());
+		}
 		else
-			bResult = SetCaptionColors(::GetSysColor(COLOR_INACTIVECAPTION), ::GetSysColor(COLOR_GRADIENTINACTIVECAPTION));
+		{
+			bResult = m_DittoWindow.SetCaptionColors(g_Opt.m_Theme.CaptionLeft(), g_Opt.m_Theme.CaptionRight());
+		}
 	}
 
+	m_DittoWindow.SetCaptionTextColor(g_Opt.m_Theme.CaptionTextColor());
+
 	return bResult;
 }
 
@@ -156,7 +157,7 @@ void CWndEx::OnNcPaint()
 
 void CWndEx::OnNcCalcSize(BOOL bCalcValidRects, NCCALCSIZE_PARAMS FAR* lpncsp) 
 {
-	CMagneticWnd::OnNcCalcSize(bCalcValidRects, lpncsp);
+	CWnd::OnNcCalcSize(bCalcValidRects, lpncsp);
 	
 	m_DittoWindow.DoNcCalcSize(bCalcValidRects, lpncsp);
 }
@@ -165,7 +166,7 @@ UINT CWndEx::OnNcHitTest(CPoint point)
 {
 	UINT Ret = m_DittoWindow.DoNcHitTest(this, point);
 	if(Ret == -1)
-		return CMagneticWnd::OnNcHitTest(point);
+		return CWnd::OnNcHitTest(point);
 
 	return Ret;
 }
@@ -174,7 +175,7 @@ void CWndEx::OnNcLButtonDown(UINT nHitTest, CPoint point)
 {
 	m_DittoWindow.DoNcLButtonDown(this, nHitTest, point);
 
-	CMagneticWnd::OnNcLButtonDown(nHitTest, point);
+	CWnd::OnNcLButtonDown(nHitTest, point);
 }
 
 void CWndEx::OnNcLButtonUp(UINT nHitTest, CPoint point) 
@@ -189,7 +190,7 @@ void CWndEx::OnNcLButtonUp(UINT nHitTest, CPoint point)
 		return;
 	}
 	
-	CMagneticWnd::OnNcLButtonUp(nHitTest, point);
+	CWnd::OnNcLButtonUp(nHitTest, point);
 }
 
 void CWndEx::MinMaxWindow(long lOption)
@@ -209,6 +210,7 @@ void CWndEx::MinMaxWindow(long lOption)
 				m_crFullSizeWindow.top, CAPTION_BORDER, 
 				m_crFullSizeWindow.Height());
 			m_DittoWindow.m_bMinimized = true;
+			m_TimeMinimized = COleDateTime::GetCurrentTime();
 			OnNcPaint();
 		}
 		else
@@ -220,6 +222,7 @@ void CWndEx::MinMaxWindow(long lOption)
 			
 			m_crFullSizeWindow.SetRectEmpty();
 			m_DittoWindow.m_bMinimized = false;
+			m_TimeMaximized = COleDateTime::GetCurrentTime();
 			OnNcPaint();
 		}
 	}
@@ -232,6 +235,7 @@ void CWndEx::MinMaxWindow(long lOption)
 				m_crFullSizeWindow.top, CAPTION_BORDER, 
 				m_crFullSizeWindow.Height());
 			m_DittoWindow.m_bMinimized = true;
+			m_TimeMinimized = COleDateTime::GetCurrentTime();
 			OnNcPaint();
 		}
 		else
@@ -243,6 +247,7 @@ void CWndEx::MinMaxWindow(long lOption)
 			
 			m_crFullSizeWindow.SetRectEmpty();
 			m_DittoWindow.m_bMinimized = false;
+			m_TimeMaximized = COleDateTime::GetCurrentTime();
 			OnNcPaint();
 		}
 	}
@@ -256,6 +261,7 @@ void CWndEx::MinMaxWindow(long lOption)
 				m_crFullSizeWindow.Width(), 
 				CAPTION_BORDER);
 			m_DittoWindow.m_bMinimized = true;
+			m_TimeMinimized = COleDateTime::GetCurrentTime();
 			OnNcPaint();
 		}
 		else
@@ -267,6 +273,7 @@ void CWndEx::MinMaxWindow(long lOption)
 			
 			m_crFullSizeWindow.SetRectEmpty();
 			m_DittoWindow.m_bMinimized = false;
+			m_TimeMaximized = COleDateTime::GetCurrentTime();
 			OnNcPaint();
 		}
 	}
@@ -280,6 +287,7 @@ void CWndEx::MinMaxWindow(long lOption)
 				m_crFullSizeWindow.Width(), 
 				CAPTION_BORDER);
 			m_DittoWindow.m_bMinimized = true;
+			m_TimeMinimized = COleDateTime::GetCurrentTime();
 			OnNcPaint();
 		}
 		else
@@ -292,6 +300,7 @@ void CWndEx::MinMaxWindow(long lOption)
 			
 			m_crFullSizeWindow.SetRectEmpty();
 			m_DittoWindow.m_bMinimized = false;
+			m_TimeMaximized = COleDateTime::GetCurrentTime();
 			OnNcPaint();
 		}
 	}
@@ -303,23 +312,27 @@ void CWndEx::OnNcMouseMove(UINT nHitTest, CPoint point)
 
 	if((m_bMaxSetTimer == false) && m_DittoWindow.m_bMinimized)
 	{
-		SetTimer(TIMER_AUTO_MAX, 250, NULL);
-		m_bMaxSetTimer = true;
+		COleDateTimeSpan sp = COleDateTime::GetCurrentTime() - m_TimeMinimized;
+		if(sp.GetTotalSeconds() >= m_lDelayMaxSeconds)
+		{
+			SetTimer(TIMER_AUTO_MAX, 250, NULL);
+			m_bMaxSetTimer = true;
+		}
 	}
 	
-	CMagneticWnd::OnNcMouseMove(nHitTest, point);
+	CWnd::OnNcMouseMove(nHitTest, point);
 }
 
 BOOL CWndEx::PreTranslateMessage(MSG* pMsg) 
 {
 	m_DittoWindow.DoPreTranslateMessage(pMsg);
 	
-	return CMagneticWnd::PreTranslateMessage(pMsg);
+	return CWnd::PreTranslateMessage(pMsg);
 }
 
 BOOL CWndEx::OnEraseBkgnd(CDC* pDC) 
 {
-	return CMagneticWnd::OnEraseBkgnd(pDC);
+	return CWnd::OnEraseBkgnd(pDC);
 }
 
 void CWndEx::OnTimer(UINT nIDEvent)
@@ -374,12 +387,12 @@ void CWndEx::OnTimer(UINT nIDEvent)
 		}
 	}
 	
-	CMagneticWnd::OnTimer(nIDEvent);
+	CWnd::OnTimer(nIDEvent);
 }
 
 void CWndEx::OnWindowPosChanging(WINDOWPOS* lpwndpos)
 {
-	CMagneticWnd::OnWindowPosChanging(lpwndpos);
+	CWnd::OnWindowPosChanging(lpwndpos);
 	
 	if(m_bMaxSetTimer)
 	{
@@ -391,7 +404,7 @@ void CWndEx::OnWindowPosChanging(WINDOWPOS* lpwndpos)
 
 void CWndEx::OnSize(UINT nType, int cx, int cy)
 {
-	CMagneticWnd::OnSize(nType, cx, cy);
+	CWnd::OnSize(nType, cx, cy);
 	
 	m_DittoWindow.DoSetRegion(this);
 }
@@ -416,7 +429,7 @@ void CWndEx::OnInitMenuPopup(CMenu *pPopupMenu, UINT nIndex,BOOL bSysMenu)
 	}
     else if ((hParentMenu = ::GetMenu(m_hWnd)) != NULL)
     {
-        CMagneticWnd* pParent = this;
+        CWnd* pParent = this;
 		// Child windows don't have menus--need to go to the top!
         if (pParent != NULL &&
 			(hParentMenu = ::GetMenu(pParent->m_hWnd)) != NULL)

+ 7 - 4
WndEx.h

@@ -8,13 +8,12 @@
 //
 
 #include "DittoWindow.h"
-#include "MagneticWnd.h"
 
 #define	SWAP_MIN_MAX			1
 #define FORCE_MIN				2
 #define FORCE_MAX				3
 
-class CWndEx : public CMagneticWnd
+class CWndEx : public CWnd
 {
 // Construction
 public:
@@ -35,18 +34,22 @@ public:
 	//}}AFX_VIRTUAL
 
 public:
-	bool SetCaptionColors( COLORREF left, COLORREF right );
 	void InvalidateNc();
 	void SetCaptionOn(int nPos, bool bOnstartup = false);
 	void SetAutoHide(BOOL bAutoHide);
 	void MinMaxWindow(long lOption = SWAP_MIN_MAX);
 	void GetWindowRectEx(LPRECT lpRect);
-	bool SetCaptionColorActive(bool bActive, bool ConnectedToClipboard);
+	bool SetCaptionColorActive(BOOL bPersistant, BOOL ConnectedToClipboard);
+	void SetAutoMaxDelay(long lDelay)	{ m_lDelayMaxSeconds = lDelay; }
 
 protected:
 	CDittoWindow m_DittoWindow;
 	CRect m_crFullSizeWindow;
 	bool m_bMaxSetTimer;
+	COleDateTime m_TimeMinimized;
+	COleDateTime m_TimeMaximized;
+	int m_lDelayMaxSeconds;
+
 
 // Implementation
 public:

BIN
focusdll/Release/focus.dll


BIN
focusdll/Release/focus.lib