浏览代码

reworked config
- removed quick paste tb
- updated general page
- added advanced popup for rest of settings
- added regex filter config ui

ScottBrogden 8 年之前
父节点
当前提交
7231d9db4f
共有 20 个文件被更改,包括 1090 次插入284 次删除
  1. 6 0
      ActionEnums.cpp
  2. 1 0
      ActionEnums.h
  3. 581 0
      AdvGeneral.cpp
  4. 30 0
      AdvGeneral.h
  5. 94 47
      CP_Main.rc
  6. 2 0
      CP_Main.vcxproj
  7. 4 0
      CP_Main.vcxproj.filters
  8. 2 0
      DPI.h
  9. 3 0
      OptionFriends.cpp
  10. 30 6
      Options.cpp
  11. 6 0
      Options.h
  12. 253 193
      OptionsGeneral.cpp
  13. 17 9
      OptionsGeneral.h
  14. 1 1
      OptionsQuickPaste.cpp
  15. 8 4
      OptionsSheet.cpp
  16. 2 0
      OptionsSheet.h
  17. 2 0
      OptionsTypes.cpp
  18. 37 23
      QPasteWnd.cpp
  19. 2 0
      QPasteWnd.h
  20. 9 1
      Resource.h

+ 6 - 0
ActionEnums.cpp

@@ -275,6 +275,12 @@ CString ActionEnums::EnumDescription(ActionEnumValues value)
 	case REPLACE_TOP_STICKY_CLIP:
 		val = "Replace Top Sticky Clip";
 		break;
+	case PROMPT_SEND_TO_FRIEND:
+		val = "Prompt send to friend";
+		break;
+	case TOGGLE_CLIPBOARD_CONNECTION:
+		val = "Toggle clipboard connection";
+		break;
 	}
 
 	CString translatedValue = theApp.m_Language.GetQuickPasteKeyboardString(value, val);

+ 1 - 0
ActionEnums.h

@@ -95,6 +95,7 @@ public:
 		REPLACE_TOP_STICKY_CLIP,
 		PROMPT_SEND_TO_FRIEND,
 		SAVE_CF_HDROP_FIlE_DATA,
+		TOGGLE_CLIPBOARD_CONNECTION,
 
 		LAST_ACTION
 	};

+ 581 - 0
AdvGeneral.cpp

@@ -0,0 +1,581 @@
+// AdvGeneral.cpp : implementation file
+//
+
+#include "stdafx.h"
+#include "CP_Main.h"
+#include "AdvGeneral.h"
+#include "afxdialogex.h"
+
+
+// CAdvGeneral dialog
+
+IMPLEMENT_DYNAMIC(CAdvGeneral, CDialogEx)
+
+CAdvGeneral::CAdvGeneral(CWnd* pParent /*=NULL*/)
+	: CDialogEx(CAdvGeneral::IDD, pParent)
+{
+
+}
+
+CAdvGeneral::~CAdvGeneral()
+{
+}
+
+void CAdvGeneral::DoDataExchange(CDataExchange* pDX)
+{
+	CDialogEx::DoDataExchange(pDX);
+	DDX_Control(pDX, IDC_MFCPROPERTYGRID1, m_propertyGrid);
+}
+
+
+BEGIN_MESSAGE_MAP(CAdvGeneral, CDialogEx)
+	ON_BN_CLICKED(IDOK, &CAdvGeneral::OnBnClickedOk)
+	ON_WM_SIZE()
+	ON_BN_CLICKED(IDC_BT_COMPACT_AND_REPAIR, &CAdvGeneral::OnBnClickedBtCompactAndRepair)
+END_MESSAGE_MAP()
+
+
+// CAdvGeneral message handlers
+
+#define SETTING_DESC_SIZE 1
+#define SETTING_SHOW_TASKBAR_ICON 2
+#define SETTING_SAVE_MULTI_PASTE 3
+#define SETTING_HIDE_ON_HOTKEY_IF_VISIBLE 4
+#define SETTING_PASTE_IN_ACTIVE_WINDOW 5
+#define SETTING_MAX_CLIP_SIZE 6
+#define SETTING_CLIP_SEPARATOR 7
+#define SETTING_ENSURE_CONNECTED 8
+#define SETTING_COPY_PLAY_SOUND 9
+#define SETTING_TEXT_FIRST_TEN 10 
+#define SETTING_SHOW_LEADING_WHITESPACE 11
+#define SETTING_LINES_PER_ROW 12
+#define SETTING_ENABLE_TRANSPARENCY 13
+#define SETTING_DRAW_THUMBNAILS 14
+#define SETTING_DRAW_RTF 15
+#define SETTING_FIND_AS_TYPE 16
+#define SETTING_ENSURE_WINDOW_IS_VISIBLE 17
+#define SETTING_SHOW_GROUP_CLIPS_IN_LIST 18
+#define SETTING_PROMP_ON_DELETE 19
+#define SETTING_ALWAYS_SHOW_SCROLL_BAR 20
+#define SETTING_PASTE_AS_ADMIN 21
+#define SETTTING_SHOW_IN_TASKBAR 22
+#define SETTING_SHOW_CLIP_PASTED 23
+#define SETTING_DIFF_APP 24
+#define SETTING_TRANSPARENCY 25
+#define SETTING_UPDATE_ORDER 26
+#define SETTING_ALLOW_DUPLICATES 27
+#define SETTING_REGEX_FILTERING_1 28
+#define SETTING_REGEX_FILTERING_2 29
+#define SETTING_REGEX_FILTERING_3 30
+#define SETTING_REGEX_FILTERING_4 31
+#define SETTING_REGEX_FILTERING_5 32
+#define SETTING_REGEX_FILTERING_6 33
+#define SETTING_REGEX_FILTERING_7 34
+#define SETTING_REGEX_FILTERING_8 35
+#define SETTING_REGEX_FILTERING_9 36
+#define SETTING_REGEX_FILTERING_10 37
+#define SETTING_REGEX_FILTERING_11 38
+#define SETTING_REGEX_FILTERING_12 39
+#define SETTING_REGEX_FILTERING_13 40
+#define SETTING_REGEX_FILTERING_14 41
+#define SETTING_REGEX_FILTERING_15 42
+
+#define SETTING_REGEX_FILTERING_BY_PROCESS_NAME_1 43
+#define SETTING_REGEX_FILTERING_BY_PROCESS_NAME_2 44
+#define SETTING_REGEX_FILTERING_BY_PROCESS_NAME_3 45
+#define SETTING_REGEX_FILTERING_BY_PROCESS_NAME_4 46
+#define SETTING_REGEX_FILTERING_BY_PROCESS_NAME_5 47
+#define SETTING_REGEX_FILTERING_BY_PROCESS_NAME_6 48
+#define SETTING_REGEX_FILTERING_BY_PROCESS_NAME_7 49
+#define SETTING_REGEX_FILTERING_BY_PROCESS_NAME_8 50
+#define SETTING_REGEX_FILTERING_BY_PROCESS_NAME_9 51
+#define SETTING_REGEX_FILTERING_BY_PROCESS_NAME_10 52
+#define SETTING_REGEX_FILTERING_BY_PROCESS_NAME_11 53
+#define SETTING_REGEX_FILTERING_BY_PROCESS_NAME_12 54
+#define SETTING_REGEX_FILTERING_BY_PROCESS_NAME_13 55
+#define SETTING_REGEX_FILTERING_BY_PROCESS_NAME_14 56
+#define SETTING_REGEX_FILTERING_BY_PROCESS_NAME_15 57
+
+BOOL CAdvGeneral::OnInitDialog()
+{
+	CDialogEx::OnInitDialog();
+
+	m_propertyGrid.ModifyStyle(0, WS_CLIPCHILDREN);
+
+	CMFCPropertyGridProperty * pGroupTest = new CMFCPropertyGridProperty( _T( "Ditto" ) );
+	m_propertyGrid.AddProperty(pGroupTest);	
+
+	m_Resize.SetParent(m_hWnd);
+	m_Resize.AddControl(IDC_MFCPROPERTYGRID1, DR_SizeWidth | DR_SizeHeight);
+	m_Resize.AddControl(IDOK, DR_MoveTop | DR_MoveLeft);
+	m_Resize.AddControl(IDCANCEL, DR_MoveTop | DR_MoveLeft);
+	m_Resize.AddControl(IDC_BT_COMPACT_AND_REPAIR, DR_MoveTop);
+
+	HDITEM hdItem;
+	hdItem.mask = HDI_WIDTH; // indicating cxy is width
+	hdItem.cxy = 300; // whatever you want the property name column width to be
+	m_propertyGrid.GetHeaderCtrl().SetItem(0, &hdItem);
+
+	m_propertyGrid.SetFont(this->GetFont());
+	
+	
+	AddTrueFalse(pGroupTest, _T("Allow Duplicates"), CGetSetOptions::GetAllowDuplicates(), SETTING_ALLOW_DUPLICATES);
+	AddTrueFalse(pGroupTest, _T("Always Show Scroll Bar"), CGetSetOptions::GetShowScrollBar(), SETTING_ALWAYS_SHOW_SCROLL_BAR);
+	pGroupTest->AddSubItem( new CMFCPropertyGridProperty(_T("Amount of text to save for description"), g_Opt.m_bDescTextSize, _T(""), SETTING_DESC_SIZE));
+	
+	static TCHAR BASED_CODE szDiffFilter[] = _T("Diff Applications(*.exe)|*.exe||");
+	CMFCPropertyGridFileProperty* pDiffProp = new CMFCPropertyGridFileProperty(_T("Diff Application Path"), TRUE, CGetSetOptions::GetDiffApp(), _T("exe"), 0, szDiffFilter, (LPCTSTR)0, SETTING_DIFF_APP);
+	pGroupTest->AddSubItem(pDiffProp);
+
+
+	AddTrueFalse(pGroupTest, _T("Display Icon in System Tray"), CGetSetOptions::GetShowIconInSysTray(), SETTING_SHOW_TASKBAR_ICON);
+	AddTrueFalse(pGroupTest, _T("Draw RTF Text in List(for RTF types) (Could Increase Memory Usage an Display Speed)"), CGetSetOptions::GetDrawRTF(), SETTING_DRAW_RTF);
+	AddTrueFalse(pGroupTest, _T("Elevated privileges to paste into elevated apps"), CGetSetOptions::GetPasteAsAdmin(), SETTING_PASTE_AS_ADMIN);
+	AddTrueFalse(pGroupTest, _T("Ensure Ditto is always connected to the clipboard"), CGetSetOptions::GetEnsureConnectToClipboard(), SETTING_ENSURE_CONNECTED);
+	AddTrueFalse(pGroupTest, _T("Ensure Entire Window is Visible"), CGetSetOptions::GetEnsureEntireWindowCanBeSeen(), SETTING_ENSURE_WINDOW_IS_VISIBLE);
+	AddTrueFalse(pGroupTest, _T("Find As You Type"), CGetSetOptions::GetFindAsYouType(), SETTING_FIND_AS_TYPE);
+	AddTrueFalse(pGroupTest, _T("Hide Ditto on Hot Key if Ditto is Visible"), CGetSetOptions::GetHideDittoOnHotKeyIfAlreadyShown(), SETTING_HIDE_ON_HOTKEY_IF_VISIBLE);
+	pGroupTest->AddSubItem( new CMFCPropertyGridProperty(_T("Maximum Clip Size in Bytes (0 for no limit)"), g_Opt.m_lMaxClipSizeInBytes, _T(""), SETTING_MAX_CLIP_SIZE));
+	pGroupTest->AddSubItem( new CMFCPropertyGridProperty(_T("Multi-Paste clip separator ([LF] = line feed)"), g_Opt.GetMultiPasteSeparator(false), _T(""), SETTING_CLIP_SEPARATOR));
+
+	static TCHAR BASED_CODE szFilter[] = _T("Sounds(*.wav)|*.wav||");
+	CMFCPropertyGridFileProperty* pFileProp = new CMFCPropertyGridFileProperty(_T("On copy play the sound"), TRUE, CGetSetOptions::GetPlaySoundOnCopy(), _T("wav"), 0, szFilter, (LPCTSTR)0, SETTING_COPY_PLAY_SOUND);
+	pGroupTest->AddSubItem(pFileProp);
+
+	AddTrueFalse(pGroupTest, _T("Paste Clip in active window after selection"), CGetSetOptions::GetSendPasteAfterSelection(), SETTING_PASTE_IN_ACTIVE_WINDOW);
+	AddTrueFalse(pGroupTest, _T("Prompt when deleting clips"), CGetSetOptions::GetPromptWhenDeletingClips(), SETTING_PROMP_ON_DELETE);
+	AddTrueFalse(pGroupTest, _T("Save Multi-Pastes"), CGetSetOptions::GetSaveMultiPaste(), SETTING_SAVE_MULTI_PASTE);
+	AddTrueFalse(pGroupTest, _T("Show Clips That are in Groups in Main List"), CGetSetOptions::GetShowAllClipsInMainList(), SETTING_SHOW_GROUP_CLIPS_IN_LIST);
+	AddTrueFalse(pGroupTest, _T("Show leading whitespace"), CGetSetOptions::GetDescShowLeadingWhiteSpace(), SETTING_SHOW_LEADING_WHITESPACE);
+	AddTrueFalse(pGroupTest, _T("Show In Taskbar"), CGetSetOptions::GetShowInTaskBar(), SETTTING_SHOW_IN_TASKBAR);
+	AddTrueFalse(pGroupTest, _T("Show indicator a clip has been pasted"), CGetSetOptions::GetShowIfClipWasPasted(), SETTING_SHOW_CLIP_PASTED);
+	AddTrueFalse(pGroupTest, _T("Show text for first ten copy hot keys"), CGetSetOptions::GetShowTextForFirstTenHotKeys(), SETTING_TEXT_FIRST_TEN);
+	AddTrueFalse(pGroupTest, _T("Show thumbnails(for CF_DIB types) (Could Increase Memory Usage and Display Speed)"), CGetSetOptions::GetDrawThumbnail(), SETTING_DRAW_THUMBNAILS);
+	pGroupTest->AddSubItem(new CMFCPropertyGridProperty(_T("Text Lines per Clip"), CGetSetOptions::GetLinesPerRow(), _T(""), SETTING_LINES_PER_ROW));
+	AddTrueFalse(pGroupTest, _T("Transparency Enabled"), CGetSetOptions::GetEnableTransparency(), SETTING_ENABLE_TRANSPARENCY);
+	pGroupTest->AddSubItem(new CMFCPropertyGridProperty(_T("Transparency Percentage"), CGetSetOptions::GetTransparencyPercent(), _T(""), SETTING_TRANSPARENCY));
+	AddTrueFalse(pGroupTest, _T("Update Clip Order On Paste"), CGetSetOptions::GetUpdateTimeOnPaste(), SETTING_UPDATE_ORDER);
+
+	CMFCPropertyGridProperty * regexFilterGroup = new CMFCPropertyGridProperty(_T("Exlude clips by Regular Expressions"));
+	m_propertyGrid.AddProperty(regexFilterGroup);	
+
+	CString processFilterDesc = _T("Process making the copy first must match this before the Regex filter will be applied (separate multiples by ;)");
+	CString regexFilterDesc = _T("If copied text matches this regular expression then the clip will not be saved to Ditto");
+
+	regexFilterGroup->AddSubItem(new CMFCPropertyGridProperty(_T("Filter 1 Regex"), CGetSetOptions::GetRegexFilter(1), regexFilterDesc, SETTING_REGEX_FILTERING_1));
+	regexFilterGroup->AddSubItem(new CMFCPropertyGridProperty(_T("Filter 1 By Process Name"), CGetSetOptions::GetRegexFilterByProcessName(1), processFilterDesc, SETTING_REGEX_FILTERING_BY_PROCESS_NAME_1));
+	regexFilterGroup->AddSubItem(new CMFCPropertyGridProperty(_T("Filter 2 Regex"), CGetSetOptions::GetRegexFilter(2), regexFilterDesc, SETTING_REGEX_FILTERING_2));
+	regexFilterGroup->AddSubItem(new CMFCPropertyGridProperty(_T("Filter 2 By Process Name"), CGetSetOptions::GetRegexFilterByProcessName(2), processFilterDesc, SETTING_REGEX_FILTERING_BY_PROCESS_NAME_2));
+	regexFilterGroup->AddSubItem(new CMFCPropertyGridProperty(_T("Filter 3 Regex"), CGetSetOptions::GetRegexFilter(3), regexFilterDesc, SETTING_REGEX_FILTERING_3));
+	regexFilterGroup->AddSubItem(new CMFCPropertyGridProperty(_T("Filter 3 By Process Name"), CGetSetOptions::GetRegexFilterByProcessName(3), processFilterDesc, SETTING_REGEX_FILTERING_BY_PROCESS_NAME_3));
+	regexFilterGroup->AddSubItem(new CMFCPropertyGridProperty(_T("Filter 4 Regex"), CGetSetOptions::GetRegexFilter(4), regexFilterDesc, SETTING_REGEX_FILTERING_4));
+	regexFilterGroup->AddSubItem(new CMFCPropertyGridProperty(_T("Filter 4 By Process Name"), CGetSetOptions::GetRegexFilterByProcessName(4), processFilterDesc, SETTING_REGEX_FILTERING_BY_PROCESS_NAME_4));
+	regexFilterGroup->AddSubItem(new CMFCPropertyGridProperty(_T("Filter 5 Regex"), CGetSetOptions::GetRegexFilter(5), regexFilterDesc, SETTING_REGEX_FILTERING_5));
+	regexFilterGroup->AddSubItem(new CMFCPropertyGridProperty(_T("Filter 5 By Process Name"), CGetSetOptions::GetRegexFilterByProcessName(5), processFilterDesc, SETTING_REGEX_FILTERING_BY_PROCESS_NAME_5));
+	regexFilterGroup->AddSubItem(new CMFCPropertyGridProperty(_T("Filter 6 Regex"), CGetSetOptions::GetRegexFilter(6), regexFilterDesc, SETTING_REGEX_FILTERING_6));
+	regexFilterGroup->AddSubItem(new CMFCPropertyGridProperty(_T("Filter 6 By Process Name"), CGetSetOptions::GetRegexFilterByProcessName(6), processFilterDesc, SETTING_REGEX_FILTERING_BY_PROCESS_NAME_6));
+	regexFilterGroup->AddSubItem(new CMFCPropertyGridProperty(_T("Filter 7 Regex"), CGetSetOptions::GetRegexFilter(7), regexFilterDesc, SETTING_REGEX_FILTERING_7));
+	regexFilterGroup->AddSubItem(new CMFCPropertyGridProperty(_T("Filter 7 By Process Name"), CGetSetOptions::GetRegexFilterByProcessName(7), processFilterDesc, SETTING_REGEX_FILTERING_BY_PROCESS_NAME_7));
+	regexFilterGroup->AddSubItem(new CMFCPropertyGridProperty(_T("Filter 8 Regex"), CGetSetOptions::GetRegexFilter(8), regexFilterDesc, SETTING_REGEX_FILTERING_8));
+	regexFilterGroup->AddSubItem(new CMFCPropertyGridProperty(_T("Filter 8 By Process Name"), CGetSetOptions::GetRegexFilterByProcessName(8), processFilterDesc, SETTING_REGEX_FILTERING_BY_PROCESS_NAME_8));
+	regexFilterGroup->AddSubItem(new CMFCPropertyGridProperty(_T("Filter 9 Regex"), CGetSetOptions::GetRegexFilter(9), regexFilterDesc, SETTING_REGEX_FILTERING_9));
+	regexFilterGroup->AddSubItem(new CMFCPropertyGridProperty(_T("Filter 9 By Process Name"), CGetSetOptions::GetRegexFilterByProcessName(9), processFilterDesc, SETTING_REGEX_FILTERING_BY_PROCESS_NAME_9));
+	regexFilterGroup->AddSubItem(new CMFCPropertyGridProperty(_T("Filter 10 Regex"), CGetSetOptions::GetRegexFilter(10), regexFilterDesc, SETTING_REGEX_FILTERING_10));
+	regexFilterGroup->AddSubItem(new CMFCPropertyGridProperty(_T("Filter 10 By Process Name"), CGetSetOptions::GetRegexFilterByProcessName(10), processFilterDesc, SETTING_REGEX_FILTERING_BY_PROCESS_NAME_10));
+	regexFilterGroup->AddSubItem(new CMFCPropertyGridProperty(_T("Filter 11 Regex"), CGetSetOptions::GetRegexFilter(11), regexFilterDesc, SETTING_REGEX_FILTERING_11));
+	regexFilterGroup->AddSubItem(new CMFCPropertyGridProperty(_T("Filter 11 By Process Name"), CGetSetOptions::GetRegexFilterByProcessName(11), processFilterDesc, SETTING_REGEX_FILTERING_BY_PROCESS_NAME_11));
+	regexFilterGroup->AddSubItem(new CMFCPropertyGridProperty(_T("Filter 12 Regex"), CGetSetOptions::GetRegexFilter(12), regexFilterDesc, SETTING_REGEX_FILTERING_12));
+	regexFilterGroup->AddSubItem(new CMFCPropertyGridProperty(_T("Filter 12 By Process Name"), CGetSetOptions::GetRegexFilterByProcessName(12), processFilterDesc, SETTING_REGEX_FILTERING_BY_PROCESS_NAME_12));
+	regexFilterGroup->AddSubItem(new CMFCPropertyGridProperty(_T("Filter 13 Regex"), CGetSetOptions::GetRegexFilter(13), regexFilterDesc, SETTING_REGEX_FILTERING_13));
+	regexFilterGroup->AddSubItem(new CMFCPropertyGridProperty(_T("Filter 13 By Process Name"), CGetSetOptions::GetRegexFilterByProcessName(13), processFilterDesc, SETTING_REGEX_FILTERING_BY_PROCESS_NAME_13));
+	regexFilterGroup->AddSubItem(new CMFCPropertyGridProperty(_T("Filter 14 Regex"), CGetSetOptions::GetRegexFilter(14), regexFilterDesc, SETTING_REGEX_FILTERING_14));
+	regexFilterGroup->AddSubItem(new CMFCPropertyGridProperty(_T("Filter 14 By Process Name"), CGetSetOptions::GetRegexFilterByProcessName(14), processFilterDesc, SETTING_REGEX_FILTERING_BY_PROCESS_NAME_14));
+	regexFilterGroup->AddSubItem(new CMFCPropertyGridProperty(_T("Filter 15 Regex"), CGetSetOptions::GetRegexFilter(15), regexFilterDesc, SETTING_REGEX_FILTERING_15));
+	regexFilterGroup->AddSubItem(new CMFCPropertyGridProperty(_T("Filter 15 By Process Name"), CGetSetOptions::GetRegexFilterByProcessName(15), processFilterDesc, SETTING_REGEX_FILTERING_BY_PROCESS_NAME_14));
+
+	regexFilterGroup->Expand(FALSE);
+
+	return TRUE;
+}
+
+void CAdvGeneral::AddTrueFalse(CMFCPropertyGridProperty * pGroupTest, CString desc, BOOL value, int settingId)
+{
+	CString stringValue = _T("False");
+	if(value)
+	{
+		stringValue = _T("True");
+	}
+
+	CMFCPropertyGridProperty *pCombo = new CMFCPropertyGridProperty(desc, stringValue, _T(""), settingId);
+	pCombo->AddOption(_T("True"));
+	pCombo->AddOption(_T("False"));
+	pCombo->AllowEdit(FALSE);
+	pGroupTest->AddSubItem(pCombo);
+}
+
+void CAdvGeneral::OnBnClickedOk()
+{
+	int topLevelCount = m_propertyGrid.GetPropertyCount();
+	for (int topLevel = 0; topLevel < topLevelCount; topLevel++)
+	{
+		int count = m_propertyGrid.GetProperty(topLevel)->GetSubItemsCount();
+		for (int row = 0; row < count; row++)
+		{
+			CMFCPropertyGridProperty* prop = m_propertyGrid.GetProperty(topLevel)->GetSubItem(row);
+
+			COleVariant i = prop->GetValue();
+			LPVARIANT pNewValue = (LPVARIANT)i;
+
+			COleVariant iOrig = prop->GetOriginalValue();
+			LPVARIANT pOrigValue = (LPVARIANT)iOrig;
+
+			switch ((int)prop->GetData())
+			{
+			case SETTING_DESC_SIZE:
+				if (pNewValue->lVal != pOrigValue->lVal)
+				{
+					CGetSetOptions::SetDescTextSize(pNewValue->lVal);
+				}
+				break;
+			case SETTING_SHOW_TASKBAR_ICON:
+				if (wcscmp(pNewValue->bstrVal, pOrigValue->bstrVal) != 0)
+				{
+					BOOL val = false;
+					if (wcscmp(pNewValue->bstrVal, L"True") == 0)
+					{
+						val = true;
+					}
+					CGetSetOptions::SetShowIconInSysTray(val);
+				}
+				break;
+			case SETTING_SAVE_MULTI_PASTE:
+				if (wcscmp(pNewValue->bstrVal, pOrigValue->bstrVal) != 0)
+				{
+					BOOL val = false;
+					if (wcscmp(pNewValue->bstrVal, L"True") == 0)
+					{
+						val = true;
+					}
+					CGetSetOptions::SetSaveMultiPaste(val);
+				}
+				break;
+			case SETTING_HIDE_ON_HOTKEY_IF_VISIBLE:
+				if (wcscmp(pNewValue->bstrVal, pOrigValue->bstrVal) != 0)
+				{
+					BOOL val = false;
+					if (wcscmp(pNewValue->bstrVal, L"True") == 0)
+					{
+						val = true;
+					}
+					CGetSetOptions::SetHideDittoOnHotKeyIfAlreadyShown(val);
+				}
+				break;
+			case SETTING_PASTE_IN_ACTIVE_WINDOW:
+				if (wcscmp(pNewValue->bstrVal, pOrigValue->bstrVal) != 0)
+				{
+					BOOL val = false;
+					if (wcscmp(pNewValue->bstrVal, L"True") == 0)
+					{
+						val = true;
+					}
+					CGetSetOptions::SetSendPasteAfterSelection(val);
+				}
+				break;
+			case SETTING_MAX_CLIP_SIZE:
+				if (pNewValue->lVal != pOrigValue->lVal)
+				{
+					CGetSetOptions::SetMaxClipSizeInBytes(pNewValue->lVal);
+				}
+				break;
+			case SETTING_CLIP_SEPARATOR:
+				if (wcscmp(pNewValue->bstrVal, pOrigValue->bstrVal) != 0)
+				{
+					CGetSetOptions::SetMultiPasteSeparator(pNewValue->bstrVal);
+				}
+				break;
+
+			case SETTING_ENSURE_CONNECTED:
+				if (wcscmp(pNewValue->bstrVal, pOrigValue->bstrVal) != 0)
+				{
+					BOOL val = false;
+					if (wcscmp(pNewValue->bstrVal, L"True") == 0)
+					{
+						val = true;
+					}
+					CGetSetOptions::SetEnsureConnectToClipboard(val);
+				}
+				break;
+			case SETTING_COPY_PLAY_SOUND:
+				if (wcscmp(pNewValue->bstrVal, pOrigValue->bstrVal) != 0)
+				{
+					CGetSetOptions::SetPlaySoundOnCopy(pNewValue->bstrVal);
+				}
+				break;
+			case SETTING_TEXT_FIRST_TEN:
+				if (wcscmp(pNewValue->bstrVal, pOrigValue->bstrVal) != 0)
+				{
+					BOOL val = false;
+					if (wcscmp(pNewValue->bstrVal, L"True") == 0)
+					{
+						val = true;
+					}
+					CGetSetOptions::SetShowTextForFirstTenHotKeys(val);
+				}
+				break;
+			case SETTING_SHOW_LEADING_WHITESPACE:
+				if (wcscmp(pNewValue->bstrVal, pOrigValue->bstrVal) != 0)
+				{
+					BOOL val = false;
+					if (wcscmp(pNewValue->bstrVal, L"True") == 0)
+					{
+						val = true;
+					}
+					CGetSetOptions::SetDescShowLeadingWhiteSpace(val);
+				}
+				break;
+			case SETTING_LINES_PER_ROW:
+				if (pNewValue->lVal != pOrigValue->lVal)
+				{
+					CGetSetOptions::SetLinesPerRow(pNewValue->lVal);
+				}
+				break;
+			case SETTING_ENABLE_TRANSPARENCY:
+				if (wcscmp(pNewValue->bstrVal, pOrigValue->bstrVal) != 0)
+				{
+					BOOL val = false;
+					if (wcscmp(pNewValue->bstrVal, L"True") == 0)
+					{
+						val = true;
+					}
+					CGetSetOptions::SetEnableTransparency(val);
+				}
+				break;
+			case SETTING_TRANSPARENCY:
+				if (pNewValue->lVal != pOrigValue->lVal)
+				{
+					int value = 100;
+					if (pNewValue->lVal <= 100 && pNewValue->lVal > 0)
+					{
+						value = pNewValue->lVal;
+					}
+
+					CGetSetOptions::SetTransparencyPercent(value);
+				}
+				break;
+			case SETTING_DRAW_THUMBNAILS:
+				if (wcscmp(pNewValue->bstrVal, pOrigValue->bstrVal) != 0)
+				{
+					BOOL val = false;
+					if (wcscmp(pNewValue->bstrVal, L"True") == 0)
+					{
+						val = true;
+					}
+					CGetSetOptions::SetDrawThumbnail(val);
+				}
+				break;
+			case SETTING_DRAW_RTF:
+				if (wcscmp(pNewValue->bstrVal, pOrigValue->bstrVal) != 0)
+				{
+					BOOL val = false;
+					if (wcscmp(pNewValue->bstrVal, L"True") == 0)
+					{
+						val = true;
+					}
+					CGetSetOptions::SetDrawRTF(val);
+				}
+				break;
+			case SETTING_FIND_AS_TYPE:
+				if (wcscmp(pNewValue->bstrVal, pOrigValue->bstrVal) != 0)
+				{
+					BOOL val = false;
+					if (wcscmp(pNewValue->bstrVal, L"True") == 0)
+					{
+						val = true;
+					}
+					CGetSetOptions::SetFindAsYouType(val);
+				}
+				break;
+			case SETTING_ENSURE_WINDOW_IS_VISIBLE:
+				if (wcscmp(pNewValue->bstrVal, pOrigValue->bstrVal) != 0)
+				{
+					BOOL val = false;
+					if (wcscmp(pNewValue->bstrVal, L"True") == 0)
+					{
+						val = true;
+					}
+					CGetSetOptions::SetEnsureEntireWindowCanBeSeen(val);
+				}
+				break;
+			case SETTING_SHOW_GROUP_CLIPS_IN_LIST:
+				if (wcscmp(pNewValue->bstrVal, pOrigValue->bstrVal) != 0)
+				{
+					BOOL val = false;
+					if (wcscmp(pNewValue->bstrVal, L"True") == 0)
+					{
+						val = true;
+					}
+					CGetSetOptions::SetShowAllClipsInMainList(val);
+				}
+				break;
+			case SETTING_PROMP_ON_DELETE:
+				if (wcscmp(pNewValue->bstrVal, pOrigValue->bstrVal) != 0)
+				{
+					BOOL val = false;
+					if (wcscmp(pNewValue->bstrVal, L"True") == 0)
+					{
+						val = true;
+					}
+					CGetSetOptions::SetPromptWhenDeletingClips(val);
+				}
+				break;
+			case SETTING_ALWAYS_SHOW_SCROLL_BAR:
+				if (wcscmp(pNewValue->bstrVal, pOrigValue->bstrVal) != 0)
+				{
+					BOOL val = false;
+					if (wcscmp(pNewValue->bstrVal, L"True") == 0)
+					{
+						val = true;
+					}
+					CGetSetOptions::SetShowScrollBar(val);
+				}
+				break;
+			case SETTING_PASTE_AS_ADMIN:
+				if (wcscmp(pNewValue->bstrVal, pOrigValue->bstrVal) != 0)
+				{
+					BOOL val = false;
+					if (wcscmp(pNewValue->bstrVal, L"True") == 0)
+					{
+						val = true;
+					}
+					CGetSetOptions::SetPasteAsAdmin(val);
+				}
+				break;
+			case SETTTING_SHOW_IN_TASKBAR:
+				if (wcscmp(pNewValue->bstrVal, pOrigValue->bstrVal) != 0)
+				{
+					BOOL val = false;
+					if (wcscmp(pNewValue->bstrVal, L"True") == 0)
+					{
+						val = true;
+					}
+					CGetSetOptions::SetShowInTaskBar(val);
+				}
+				break;
+			case SETTING_SHOW_CLIP_PASTED:
+				if (wcscmp(pNewValue->bstrVal, pOrigValue->bstrVal) != 0)
+				{
+					BOOL val = false;
+					if (wcscmp(pNewValue->bstrVal, L"True") == 0)
+					{
+						val = true;
+					}
+					CGetSetOptions::SetShowIfClipWasPasted(val);
+				}
+				break;
+			case SETTING_DIFF_APP:
+				if (wcscmp(pNewValue->bstrVal, pOrigValue->bstrVal) != 0)
+				{
+					CGetSetOptions::SetDiffApp(pNewValue->bstrVal);
+				}
+				break;
+			case SETTING_UPDATE_ORDER:
+				if (wcscmp(pNewValue->bstrVal, pOrigValue->bstrVal) != 0)
+				{
+					BOOL val = false;
+					if (wcscmp(pNewValue->bstrVal, L"True") == 0)
+					{
+						val = true;
+					}
+					CGetSetOptions::SetUpdateTimeOnPaste(val);
+				}
+				break;
+			case SETTING_ALLOW_DUPLICATES:
+				if (wcscmp(pNewValue->bstrVal, pOrigValue->bstrVal) != 0)
+				{
+					BOOL val = false;
+					if (wcscmp(pNewValue->bstrVal, L"True") == 0)
+					{
+						val = true;
+					}
+					CGetSetOptions::SetAllowDuplicates(val);
+				}
+				break;
+			case SETTING_REGEX_FILTERING_1:
+			case SETTING_REGEX_FILTERING_2:
+			case SETTING_REGEX_FILTERING_3:
+			case SETTING_REGEX_FILTERING_4:
+			case SETTING_REGEX_FILTERING_5:
+			case SETTING_REGEX_FILTERING_6:
+			case SETTING_REGEX_FILTERING_7:
+			case SETTING_REGEX_FILTERING_8:
+			case SETTING_REGEX_FILTERING_9:
+			case SETTING_REGEX_FILTERING_10:
+			case SETTING_REGEX_FILTERING_11:
+			case SETTING_REGEX_FILTERING_12:
+			case SETTING_REGEX_FILTERING_13:
+			case SETTING_REGEX_FILTERING_14:
+			case SETTING_REGEX_FILTERING_15:
+				if (wcscmp(pNewValue->bstrVal, pOrigValue->bstrVal) != 0)
+				{
+					CGetSetOptions::SetRegexFilter(pNewValue->bstrVal, (((int)prop->GetData()) - SETTING_REGEX_FILTERING_1) + 1);
+				}
+				break;
+			case SETTING_REGEX_FILTERING_BY_PROCESS_NAME_1:
+			case SETTING_REGEX_FILTERING_BY_PROCESS_NAME_2:
+			case SETTING_REGEX_FILTERING_BY_PROCESS_NAME_3:
+			case SETTING_REGEX_FILTERING_BY_PROCESS_NAME_4:
+			case SETTING_REGEX_FILTERING_BY_PROCESS_NAME_5:
+			case SETTING_REGEX_FILTERING_BY_PROCESS_NAME_6:
+			case SETTING_REGEX_FILTERING_BY_PROCESS_NAME_7:
+			case SETTING_REGEX_FILTERING_BY_PROCESS_NAME_8:
+			case SETTING_REGEX_FILTERING_BY_PROCESS_NAME_9:
+			case SETTING_REGEX_FILTERING_BY_PROCESS_NAME_10:
+			case SETTING_REGEX_FILTERING_BY_PROCESS_NAME_11:
+			case SETTING_REGEX_FILTERING_BY_PROCESS_NAME_12:
+			case SETTING_REGEX_FILTERING_BY_PROCESS_NAME_13:
+			case SETTING_REGEX_FILTERING_BY_PROCESS_NAME_14:
+			case SETTING_REGEX_FILTERING_BY_PROCESS_NAME_15:
+				if (wcscmp(pNewValue->bstrVal, pOrigValue->bstrVal) != 0)
+				{
+					CGetSetOptions::SetRegexFilterByProcessName(pNewValue->bstrVal, (((int)prop->GetData()) - SETTING_REGEX_FILTERING_BY_PROCESS_NAME_1) + 1);
+				}
+				break;
+			}
+		}
+	}
+	CDialogEx::OnOK();
+}
+
+
+void CAdvGeneral::OnSize(UINT nType, int cx, int cy)
+{
+	CDialogEx::OnSize(nType, cx, cy);
+
+	m_Resize.MoveControls(CSize(cx, cy));
+}
+
+
+void CAdvGeneral::OnBnClickedBtCompactAndRepair()
+{
+	CWaitCursor wait;
+
+	try
+	{
+		try
+		{
+			for (int i = 0; i < 100; i++)
+			{
+				int toDeleteCount = theApp.m_db.execScalar(_T("SELECT COUNT(clipID) FROM MainDeletes"));
+				if (toDeleteCount <= 0)
+					break;
+
+				RemoveOldEntries(false);
+			}
+		}
+		CATCH_SQLITE_EXCEPTION
+
+		theApp.m_db.execDML(_T("PRAGMA auto_vacuum = 1"));
+		theApp.m_db.execQuery(_T("VACUUM"));
+	}
+	CATCH_SQLITE_EXCEPTION
+}

+ 30 - 0
AdvGeneral.h

@@ -0,0 +1,30 @@
+#pragma once
+#include "afxpropertygridctrl.h"
+#include "DialogResizer.h"
+
+class CAdvGeneral : public CDialogEx
+{
+	DECLARE_DYNAMIC(CAdvGeneral)
+
+public:
+	CAdvGeneral(CWnd* pParent = NULL);   // standard constructor
+	virtual ~CAdvGeneral();
+
+// Dialog Data
+	enum { IDD = IDD_ADV_OPTIONS };
+
+	CDialogResizer m_Resize;
+
+protected:
+	virtual void DoDataExchange(CDataExchange* pDX);    // DDX/DDV support
+
+	void AddTrueFalse(CMFCPropertyGridProperty * pGroupTest, CString desc, BOOL value, int settingId);
+
+	DECLARE_MESSAGE_MAP()
+public:
+	CMFCPropertyGridCtrl m_propertyGrid;
+	virtual BOOL OnInitDialog();
+	afx_msg void OnBnClickedOk();
+	afx_msg void OnSize(UINT nType, int cx, int cy);
+	afx_msg void OnBnClickedBtCompactAndRepair();
+};

+ 94 - 47
CP_Main.rc

@@ -612,55 +612,38 @@ BEGIN
                     "Button",BS_AUTOCHECKBOX | WS_TABSTOP,20,134,324,12
 END
 
-IDD_OPTIONS_GENERAL DIALOGEX 0, 0, 351, 281
+IDD_OPTIONS_GENERAL DIALOGEX 0, 0, 375, 316
 STYLE DS_SETFONT | DS_MODALFRAME | DS_FIXEDSYS | WS_POPUP | WS_CAPTION | WS_SYSMENU
 CAPTION "General"
-FONT 8, "MS Shell Dlg", 0, 0, 0x0
+FONT 8, "MS Shell Dlg", 0, 0, 0x1
 BEGIN
     CONTROL         "Start Ditto on System Startup",IDC_START_ON_STARTUP,
-                    "Button",BS_AUTOCHECKBOX | WS_TABSTOP,23,15,138,10
-    PUSHBUTTON      "Compact and Repair Database",IDC_BT_COMPACT_AND_REPAIR,170,14,105,11
-    CONTROL         "Display Icon in System Tray",IDC_DISPLAY_IN_SYSTEMTRAY,
-                    "Button",BS_AUTOCHECKBOX | WS_TABSTOP,23,28,321,10
-    CONTROL         "Maximum Number of Saved Copies",IDC_MAXIMUM,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,23,41,154,10
-    EDITTEXT        IDC_MAX_SAVED_COPIES,179,41,27,12,ES_AUTOHSCROLL
-    CONTROL         "Paste Entries Expire after",IDC_EXPIRE,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,23,54,153,10
-    EDITTEXT        IDC_EXPIRE_AFTER,179,53,27,12,ES_AUTOHSCROLL
-    COMBOBOX        IDC_COMBO_LANGUAGE,65,65,130,95,CBS_DROPDOWNLIST | CBS_SORT | WS_VSCROLL | WS_TABSTOP
-    PUSHBUTTON      "About Language",IDC_BUTTON_ABOUT,204,65,106,12
-    EDITTEXT        IDC_PATH,23,89,248,12,ES_AUTOHSCROLL
-    PUSHBUTTON      "....",IDC_GET_PATH,272,89,14,12
-    CONTROL         "Allow Duplicates",IDC_ALLOW_DUPLICATES,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,23,105,320,10
-    CONTROL         "Update Clip Order On Paste",IDC_UPDATE_TIME_ON_PASTE,
-                    "Button",BS_AUTOCHECKBOX | WS_TABSTOP,23,117,321,10
-    CONTROL         "Save Multi-Pastes",IDC_SAVE_MULTIPASTE,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,23,129,321,10
-    CONTROL         "Hide Ditto on Hot Key if Ditto is Visible",IDC_HIDE_DITO_ON_HOT_KEY,
-                    "Button",BS_AUTOCHECKBOX | WS_TABSTOP,23,140,322,10
-    LTEXT           "Amount of text to save for description",IDC_STATIC_AMOUNT,23,152,177,8
-    EDITTEXT        IDC_DESC_TEXT_SIZE,206,150,35,12,ES_AUTOHSCROLL
-    LTEXT           "On copy play the sound",IDC_STATIC_SOUND,23,164,139,10
-    EDITTEXT        IDC_EDIT_PLAY_SOUND,167,164,115,12,ES_AUTOHSCROLL
-    PUSHBUTTON      "Play",IDC_BUTTON_PLAY,285,164,35,12
-    PUSHBUTTON      "....",IDC_SELECT_SOUND,323,164,14,12
-    CONTROL         "Paste Clip in active window after selection",IDC_SEND_PASTE_MESSAGE,
-                    "Button",BS_AUTOCHECKBOX | WS_TABSTOP,23,177,318,10
-    LTEXT           "Maximum Clip Size in Bytes",IDC_STATIC_MAX_SIZE,23,189,137,8
-    EDITTEXT        IDC_EDIT_MAX_SIZE,164,187,59,12,ES_AUTOHSCROLL
-    LTEXT           "(Leave blank for no limit)",IDC_STATIC_NO_LIMIT,232,189,112,8
-    LTEXT           "Ignore copies that occur X milliseconds from the last copy (1000 ms = 1 sec)",IDC_STATIC_SAVE_DELAY,23,202,278,11
-    EDITTEXT        IDC_EDIT_SAVE_DELAY,306,201,38,12,ES_AUTOHSCROLL
-    LTEXT           "Multi-Paste clip separator ([LF] = line feed)",IDC_STATIC_CLIP_SEPARATOR,23,229,161,8
-    EDITTEXT        IDC_EDIT_CLIP_SEPARATOR,187,227,106,12,ES_AUTOHSCROLL
-    CONTROL         "Ensure Ditto is always connected to the clipboard",IDC_ENSURE,
-                    "Button",BS_AUTOCHECKBOX | WS_TABSTOP,23,215,306,10
-    LTEXT           "Days",IDC_STATIC_DAYS,211,53,51,12,SS_CENTERIMAGE
-    CONTROL         "Set Database Path",IDC_SET_DB_PATH,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,23,79,320,10
-    LTEXT           "Language",IDC_STATIC_LANGUAGE,23,65,36,12,SS_CENTERIMAGE
-    LTEXT           "Include",IDC_STATIC_INCLUDE_APPS,28,254,36,13,SS_CENTERIMAGE
-    LTEXT           "Exclude",IDC_STATIC_EXCLUDE_APPS,188,254,31,13,SS_CENTERIMAGE
-    EDITTEXT        IDC_EDIT_APP_COPY_INCLUDE,60,254,123,13,ES_AUTOHSCROLL
-    EDITTEXT        IDC_EDIT_APP_COPY_EXCLUDE,221,254,119,13,ES_AUTOHSCROLL
-    GROUPBOX        "Accepted Copy Applications (seperate by ;)",IDC_STATIC_APP_SEP_DESC,22,242,321,32
+                    "Button",BS_AUTOCHECKBOX | WS_TABSTOP,8,8,138,10
+    CONTROL         "Maximum Number of Saved Copies",IDC_MAXIMUM,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,8,25,154,10
+    EDITTEXT        IDC_MAX_SAVED_COPIES,164,25,27,12,ES_AUTOHSCROLL
+    CONTROL         "Paste Entries Expire after",IDC_EXPIRE,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,8,41,153,10
+    EDITTEXT        IDC_EXPIRE_AFTER,164,40,27,12,ES_AUTOHSCROLL
+    COMBOBOX        IDC_COMBO_LANGUAGE,67,60,130,95,CBS_DROPDOWNLIST | CBS_SORT | WS_VSCROLL | WS_TABSTOP
+    PUSHBUTTON      "About Language",IDC_BUTTON_ABOUT,207,60,106,14
+    EDITTEXT        IDC_PATH,67,148,283,12,ES_AUTOHSCROLL
+    PUSHBUTTON      "....",IDC_GET_PATH,354,148,14,12
+    LTEXT           "Days",IDC_STATIC_DAYS,196,40,51,12,SS_CENTERIMAGE
+    LTEXT           "Language",IDC_STATIC_LANGUAGE,9,60,36,12,SS_CENTERIMAGE
+    LTEXT           "Include",IDC_STATIC_INCLUDE_APPS,14,181,36,13,SS_CENTERIMAGE
+    LTEXT           "Exclude",IDC_STATIC_EXCLUDE_APPS,14,203,36,13,SS_CENTERIMAGE
+    EDITTEXT        IDC_EDIT_APP_COPY_INCLUDE,50,181,316,13,ES_AUTOHSCROLL
+    EDITTEXT        IDC_EDIT_APP_COPY_EXCLUDE,50,203,316,13,ES_AUTOHSCROLL
+    GROUPBOX        "Accepted Copy Applications (seperate by ;)",IDC_STATIC_APP_SEP_DESC,7,168,361,55
+    PUSHBUTTON      "Advanced",IDC_BUTTON_ADVANCED,318,297,50,14
+    COMBOBOX        IDC_COMBO_THEME,67,82,130,95,CBS_DROPDOWNLIST | CBS_SORT | WS_VSCROLL | WS_TABSTOP
+    PUSHBUTTON      "About Theme",IDC_BUTTON_THEME,207,82,106,14
+    PUSHBUTTON      "Font",IDC_BUTTON_FONT,67,125,130,14
+    PUSHBUTTON      "Default Font",IDC_BUTTON_DEFAULT_FAULT,207,125,106,14
+    LTEXT           "Theme",IDC_STATIC_THEME,9,82,36,12,SS_CENTERIMAGE
+    LTEXT           "Database Path",IDC_STATIC_DATABASE_PATH,9,147,57,13,SS_CENTERIMAGE
+    COMBOBOX        IDC_COMBO_POPUP_POSITION,67,104,130,95,CBS_DROPDOWNLIST | CBS_SORT | WS_VSCROLL | WS_TABSTOP
+    LTEXT           "Popup Position",IDC_STATIC_POPUP_POS,9,104,51,12,SS_CENTERIMAGE
+    LTEXT           "Display Font",IDC_STATIC_FONT,9,125,51,14,SS_CENTERIMAGE
 END
 
 IDD_SELECT_DB DIALOGEX 0, 0, 276, 46
@@ -969,6 +952,17 @@ BEGIN
     COMBOBOX        IDC_COMBO1,64,7,166,102,CBS_DROPDOWN | WS_VSCROLL | WS_TABSTOP
 END
 
+IDD_ADV_OPTIONS DIALOGEX 0, 0, 262, 258
+STYLE DS_SETFONT | WS_POPUP | WS_CAPTION | WS_SYSMENU | WS_THICKFRAME
+CAPTION "Dialog"
+FONT 10, "Segoe UI", 400, 0, 0x0
+BEGIN
+    DEFPUSHBUTTON   "OK",IDOK,147,240,50,11
+    PUSHBUTTON      "Cancel",IDCANCEL,205,239,50,12
+    CONTROL         "",IDC_MFCPROPERTYGRID1,"MfcPropertyGrid",0x100,7,7,248,228
+    PUSHBUTTON      "Compact and Repair Database",IDC_BT_COMPACT_AND_REPAIR,12,240,108,11
+END
+
 
 /////////////////////////////////////////////////////////////////////////////
 //
@@ -1059,9 +1053,9 @@ BEGIN
     IDD_OPTIONS_GENERAL, DIALOG
     BEGIN
         LEFTMARGIN, 7
-        RIGHTMARGIN, 344
+        RIGHTMARGIN, 368
         TOPMARGIN, 7
-        BOTTOMMARGIN, 276
+        BOTTOMMARGIN, 311
     END
 
     IDD_SELECT_DB, DIALOG
@@ -1179,6 +1173,14 @@ BEGIN
         TOPMARGIN, 7
         BOTTOMMARGIN, 39
     END
+
+    IDD_ADV_OPTIONS, DIALOG
+    BEGIN
+        LEFTMARGIN, 7
+        RIGHTMARGIN, 255
+        TOPMARGIN, 7
+        BOTTOMMARGIN, 251
+    END
 END
 #endif    // APSTUDIO_INVOKED
 
@@ -1451,6 +1453,16 @@ BEGIN
     0
 END
 
+IDD_OPTIONS_GENERAL AFX_DIALOG_LAYOUT
+BEGIN
+    0
+END
+
+IDD_ADV_OPTIONS AFX_DIALOG_LAYOUT
+BEGIN
+    0
+END
+
 
 /////////////////////////////////////////////////////////////////////////////
 //
@@ -1460,6 +1472,41 @@ END
 IDR_CP_MAIN             REGISTRY                "CP_Main.rgs"
 
 
+/////////////////////////////////////////////////////////////////////////////
+//
+// Dialog Info
+//
+
+IDD_ADV_OPTIONS DLGINIT
+BEGIN
+    IDC_MFCPROPERTYGRID1, 0x37c, 413, 0
+0x4d3c, 0x4346, 0x7250, 0x706f, 0x7265, 0x7974, 0x7247, 0x6469, 0x485f, 
+0x6165, 0x6564, 0x4372, 0x7274, 0x3e6c, 0x5254, 0x4555, 0x2f3c, 0x464d, 
+0x5043, 0x6f72, 0x6570, 0x7472, 0x4779, 0x6972, 0x5f64, 0x6548, 0x6461, 
+0x7265, 0x7443, 0x6c72, 0x3c3e, 0x464d, 0x5043, 0x6f72, 0x6570, 0x7472, 
+0x4779, 0x6972, 0x5f64, 0x6544, 0x6373, 0x6972, 0x7470, 0x6f69, 0x416e, 
+0x6572, 0x3e61, 0x5254, 0x4555, 0x2f3c, 0x464d, 0x5043, 0x6f72, 0x6570, 
+0x7472, 0x4779, 0x6972, 0x5f64, 0x6544, 0x6373, 0x6972, 0x7470, 0x6f69, 
+0x416e, 0x6572, 0x3e61, 0x4d3c, 0x4346, 0x7250, 0x706f, 0x7265, 0x7974, 
+0x7247, 0x6469, 0x415f, 0x706c, 0x6168, 0x6562, 0x6974, 0x4d63, 0x646f, 
+0x3e65, 0x4146, 0x534c, 0x3c45, 0x4d2f, 0x4346, 0x7250, 0x706f, 0x7265, 
+0x7974, 0x7247, 0x6469, 0x415f, 0x706c, 0x6168, 0x6562, 0x6974, 0x4d63, 
+0x646f, 0x3e65, 0x4d3c, 0x4346, 0x7250, 0x706f, 0x7265, 0x7974, 0x7247, 
+0x6469, 0x4d5f, 0x646f, 0x6669, 0x6569, 0x5064, 0x6f72, 0x6570, 0x7472, 
+0x6569, 0x3e73, 0x4146, 0x534c, 0x3c45, 0x4d2f, 0x4346, 0x7250, 0x706f, 
+0x7265, 0x7974, 0x7247, 0x6469, 0x4d5f, 0x646f, 0x6669, 0x6569, 0x5064, 
+0x6f72, 0x6570, 0x7472, 0x6569, 0x3e73, 0x4d3c, 0x4346, 0x7250, 0x706f, 
+0x7265, 0x7974, 0x7247, 0x6469, 0x565f, 0x4453, 0x746f, 0x654e, 0x4c74, 
+0x6f6f, 0x3e6b, 0x5254, 0x4555, 0x2f3c, 0x464d, 0x5043, 0x6f72, 0x6570, 
+0x7472, 0x4779, 0x6972, 0x5f64, 0x5356, 0x6f44, 0x4e74, 0x7465, 0x6f4c, 
+0x6b6f, 0x3c3e, 0x464d, 0x5043, 0x6f72, 0x6570, 0x7472, 0x4779, 0x6972, 
+0x5f64, 0x6544, 0x6373, 0x6972, 0x7470, 0x6f69, 0x526e, 0x776f, 0x3e73, 
+0x3c33, 0x4d2f, 0x4346, 0x7250, 0x706f, 0x7265, 0x7974, 0x7247, 0x6469, 
+0x445f, 0x7365, 0x7263, 0x7069, 0x6974, 0x6e6f, 0x6f52, 0x7377, "\076" 
+    0
+END
+
+
 /////////////////////////////////////////////////////////////////////////////
 //
 // Cursor

+ 2 - 0
CP_Main.vcxproj

@@ -406,6 +406,7 @@
       <PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">%(PreprocessorDefinitions)</PreprocessorDefinitions>
       <PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Release|x64'">%(PreprocessorDefinitions)</PreprocessorDefinitions>
     </ClCompile>
+    <ClCompile Include="AdvGeneral.cpp" />
     <ClCompile Include="AutoSendToClientThread.cpp" />
     <ClCompile Include="BitmapHelper.cpp">
       <Optimization Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">Disabled</Optimization>
@@ -1873,6 +1874,7 @@
   <ItemGroup>
     <ClInclude Include="Accels.h" />
     <ClInclude Include="ActionEnums.h" />
+    <ClInclude Include="AdvGeneral.h" />
     <ClInclude Include="AlphaBlend.h" />
     <ClInclude Include="ArrayEx.h" />
     <ClInclude Include="AutoSendToClientThread.h" />

+ 4 - 0
CP_Main.vcxproj.filters

@@ -430,6 +430,8 @@
     <ClCompile Include="Md5.cpp" />
     <ClCompile Include="FriendPromptDlg.cpp" />
     <ClCompile Include="DimWnd.cpp" />
+    <ClCompile Include="SymbolEdit.cpp" />
+    <ClCompile Include="AdvGeneral.cpp" />
   </ItemGroup>
   <ItemGroup>
     <ClInclude Include="sqlite\CppSQLite3.h">
@@ -900,6 +902,8 @@
     <ClInclude Include="Md5.h" />
     <ClInclude Include="FriendPromptDlg.h" />
     <ClInclude Include="DimWnd.h" />
+    <ClInclude Include="SymbolEdit.h" />
+    <ClInclude Include="AdvGeneral.h" />
   </ItemGroup>
   <ItemGroup>
     <ResourceCompile Include="CP_Main.rc">

+ 2 - 0
DPI.h

@@ -37,6 +37,8 @@ public:
 	// Convert a point size (1/72 of an inch) to raw pixels.
 	int PointsToPixels(int pt) { _Init(); return MulDiv(pt, _dpiY, 72); }
 
+	int PixelsToPoints(int px) { _Init(); return MulDiv(px, 72, _dpiY); }
+
 	// Invalidate any cached metrics.
 	void Invalidate() { _fInitialized = false; }
 

+ 3 - 0
OptionFriends.cpp

@@ -5,6 +5,7 @@
 #include "cp_main.h"
 #include "OptionFriends.h"
 #include "FriendDetails.h"
+#include "DimWnd.h"
 
 #ifdef _DEBUG
 #define new DEBUG_NEW
@@ -224,6 +225,8 @@ void COptionFriends::OnDblclkList(NMHDR* pNMHDR, LRESULT* pResult)
 
 BOOL COptionFriends::EditItem(int nItem)
 {
+	CDimWnd dim(this->GetParent());
+
 	CFriendDetails dlg(this);
 
 	if(m_List.GetItemText(nItem, 1) == "X")

+ 30 - 6
Options.cpp

@@ -657,28 +657,22 @@ BOOL CGetSetOptions::GetEnableTransparency()
 
 BOOL CGetSetOptions::SetTransparencyPercent(long lPercent)
 {
-#ifdef AFTER_98
 	if(lPercent > OPACITY_MAX)
 		lPercent = OPACITY_MAX;
 	if(lPercent < 0)
 		lPercent = 0;
 
 	return SetProfileLong("TransparencyPercent", lPercent);
-#endif
-	return FALSE;
 }
 
 long CGetSetOptions::GetTransparencyPercent()
 {
-#ifdef AFTER_98
 	long lValue = GetProfileLong("TransparencyPercent", 14);
 
 	if(lValue > OPACITY_MAX) lValue = OPACITY_MAX;
 	if(lValue < 0) lValue = 0;
 
 	return lValue;
-#endif
-	return 0;
 }
 
 BOOL CGetSetOptions::SetLinesPerRow(long lLines)
@@ -2439,4 +2433,34 @@ int CGetSetOptions::GetErrorMsgPopupTimeout()
 void CGetSetOptions::SetErrorMsgPopupTimeout(int val)
 {
 	SetProfileLong(_T("ErrorMsgPopupTimeout"), val);
+}
+
+void CGetSetOptions::SetRegexFilter(CString val, int pos)
+{
+	CString cs;
+	cs.Format(_T("RegexFilter_%d"), pos);
+
+	SetProfileString(cs, val);
+}
+
+CString	CGetSetOptions::GetRegexFilter(int pos)
+{
+	CString cs;
+	cs.Format(_T("RegexFilter_%d"), pos);
+	return GetProfileString(cs, "");
+}
+
+void CGetSetOptions::SetRegexFilterByProcessName(CString val, int pos)
+{
+	CString cs;
+	cs.Format(_T("RegexFilterByProcessName_%d"), pos);
+
+	SetProfileString(cs, val);
+}
+
+CString	CGetSetOptions::GetRegexFilterByProcessName(int pos)
+{
+	CString cs;
+	cs.Format(_T("RegexFilterByProcessName_%d"), pos);
+	return GetProfileString(cs, "*");
 }

+ 6 - 0
Options.h

@@ -555,6 +555,12 @@ public:
 
 	static int GetErrorMsgPopupTimeout();
 	static void SetErrorMsgPopupTimeout(int val);
+
+	static void		SetRegexFilter(CString val, int pos);
+	static CString	GetRegexFilter(int pos);
+
+	static void SetRegexFilterByProcessName(CString val, int pos);
+	static CString GetRegexFilterByProcessName(int pos);
 };
 
 // global for easy access and for initialization of fast access variables

+ 253 - 193
OptionsGeneral.cpp

@@ -9,9 +9,13 @@
 #include <Mmsystem.h> //play sound
 #include "Path.h"
 #include "AccessToSqlite.h"
+#include "AdvGeneral.h"
+#include "DimWnd.h"
 
 using namespace nsPath;
 
+#define DEFAULT_THEME _T("(Default)")
+
 #ifdef _DEBUG
 #define new DEBUG_NEW
 #undef THIS_FILE
@@ -30,7 +34,6 @@ COptionsGeneral::COptionsGeneral() : CPropertyPage(COptionsGeneral::IDD)
 	m_psp.dwFlags |= PSP_USETITLE; 
 
 	//{{AFX_DATA_INIT(COptionsGeneral)
-	m_csPlaySound = _T("");
 	//}}AFX_DATA_INIT
 }
 
@@ -42,42 +45,34 @@ void COptionsGeneral::DoDataExchange(CDataExchange* pDX)
 {
 	CPropertyPage::DoDataExchange(pDX);
 	//{{AFX_DATA_MAP(COptionsGeneral)
-	DDX_Control(pDX, IDC_ENSURE, m_EnsureConnected);
-	DDX_Control(pDX, IDC_EDIT_SAVE_DELAY, m_SaveDelay);
+	//DDX_Control(pDX, IDC_ENSURE, m_EnsureConnected);
+	//	DDX_Control(pDX, IDC_EDIT_SAVE_DELAY, m_SaveDelay);
 	DDX_Control(pDX, IDC_COMBO_LANGUAGE, m_cbLanguage);
-	DDX_Control(pDX, IDC_EDIT_MAX_SIZE, m_MaxClipSize);
-	DDX_Control(pDX, IDC_SEND_PASTE_MESSAGE, m_btSendPasteMessage);
-	DDX_Control(pDX, IDC_HIDE_DITO_ON_HOT_KEY, m_btHideDittoOnHotKey);
-	DDX_Control(pDX, IDC_DESC_TEXT_SIZE, m_DescTextSize);
-	DDX_Control(pDX, IDC_GET_PATH, m_btGetPath);
 	DDX_Control(pDX, IDC_PATH, m_ePath);
-	DDX_Control(pDX, IDC_SET_DB_PATH, m_btSetDatabasePath);
 	DDX_Control(pDX, IDC_EXPIRE_AFTER, m_eExpireAfter);
 	DDX_Control(pDX, IDC_MAX_SAVED_COPIES, m_eMaxSavedCopies);
-	DDX_Control(pDX, IDC_MAXIMUM, m_btMaximumCheck);
 	DDX_Control(pDX, IDC_EXPIRE, m_btExpire);
-	DDX_Control(pDX, IDC_DISPLAY_IN_SYSTEMTRAY, m_btShowIconInSysTray);
 	DDX_Control(pDX, IDC_START_ON_STARTUP, m_btRunOnStartup);
-	DDX_Text(pDX, IDC_EDIT_PLAY_SOUND, m_csPlaySound);
-	DDX_Control(pDX, IDC_EDIT_CLIP_SEPARATOR, m_ClipSeparator);
-	//}}AFX_DATA_MAP
-	DDX_Control(pDX, IDC_ALLOW_DUPLICATES, m_btAllowDuplicates);
-	DDX_Control(pDX, IDC_UPDATE_TIME_ON_PASTE, m_btUpdateTimeOnPaste);
-	DDX_Control(pDX, IDC_SAVE_MULTIPASTE, m_btSaveMultiPaste);
 	DDX_Control(pDX, IDC_EDIT_APP_COPY_INCLUDE, m_copyAppInclude);
 	DDX_Control(pDX, IDC_EDIT_APP_COPY_EXCLUDE, m_copyAppExclude);
+	//}}AFX_DATA_MAP
+	DDX_Control(pDX, IDC_COMBO_THEME, m_cbTheme);
+	DDX_Control(pDX, IDC_BUTTON_FONT, m_btFont);
+	DDX_Control(pDX, IDC_BUTTON_DEFAULT_FAULT, m_btDefaultButton);
+	DDX_Control(pDX, IDC_COMBO_POPUP_POSITION, m_popupPositionCombo);
 }
 
 
 BEGIN_MESSAGE_MAP(COptionsGeneral, CPropertyPage)
 	//{{AFX_MSG_MAP(COptionsGeneral)
-	ON_BN_CLICKED(IDC_BT_COMPACT_AND_REPAIR, OnBtCompactAndRepair)
-	ON_BN_CLICKED(IDC_SET_DB_PATH, OnSetDbPath)
 	ON_BN_CLICKED(IDC_GET_PATH, OnGetPath)
-	ON_BN_CLICKED(IDC_SELECT_SOUND, OnSelectSound)
-	ON_BN_CLICKED(IDC_BUTTON_PLAY, OnButtonPlay)
 	ON_BN_CLICKED(IDC_BUTTON_ABOUT, OnButtonAbout)
 	//}}AFX_MSG_MAP
+	ON_BN_CLICKED(IDC_BUTTON_ADVANCED, &COptionsGeneral::OnBnClickedButtonAdvanced)
+	ON_WM_CTLCOLOR()
+	ON_BN_CLICKED(IDC_BUTTON_THEME, &COptionsGeneral::OnBnClickedButtonTheme)
+	ON_BN_CLICKED(IDC_BUTTON_DEFAULT_FAULT, &COptionsGeneral::OnBnClickedButtonDefaultFault)
+	ON_BN_CLICKED(IDC_BUTTON_FONT, &COptionsGeneral::OnBnClickedButtonFont)
 END_MESSAGE_MAP()
 
 /////////////////////////////////////////////////////////////////////////////
@@ -86,6 +81,8 @@ END_MESSAGE_MAP()
 BOOL COptionsGeneral::OnInitDialog() 
 {
 	CPropertyPage::OnInitDialog();
+
+	m_brush.CreateSolidBrush(RGB(251, 251, 251));
 	
 	m_pParent = (COptionsSheet *)GetParent();
 
@@ -98,52 +95,60 @@ BOOL COptionsGeneral::OnInitDialog()
 	{
 		m_btRunOnStartup.SetCheck(CGetSetOptions::GetRunOnStartUp());
 	}
-	m_btShowIconInSysTray.SetCheck(CGetSetOptions::GetShowIconInSysTray());
-	m_btMaximumCheck.SetCheck(CGetSetOptions::GetCheckForMaxEntries());
+
 	m_btExpire.SetCheck(CGetSetOptions::GetCheckForExpiredEntries());
 	
 	m_eExpireAfter.SetNumber(CGetSetOptions::GetExpiredEntries());
 	m_eMaxSavedCopies.SetNumber(CGetSetOptions::GetMaxEntries());
-	m_DescTextSize.SetNumber(g_Opt.m_bDescTextSize);
-	m_SaveDelay.SetNumber(g_Opt.m_dwSaveClipDelay);
-
-	m_btAllowDuplicates.SetCheck( g_Opt.m_bAllowDuplicates );
-	m_btUpdateTimeOnPaste.SetCheck( g_Opt.m_bUpdateTimeOnPaste );
-	m_btSaveMultiPaste.SetCheck( g_Opt.m_bSaveMultiPaste );
-	m_btHideDittoOnHotKey.SetCheck(g_Opt.m_HideDittoOnHotKeyIfAlreadyShown);
-	m_btSendPasteMessage.SetCheck(g_Opt.m_bSendPasteMessageAfterSelection);
-	m_EnsureConnected.SetCheck(g_Opt.m_bEnsureConnectToClipboard);
-	
+
 	m_copyAppInclude.SetWindowText(g_Opt.GetCopyAppInclude());
 	m_copyAppExclude.SetWindowText(g_Opt.GetCopyAppExclude());
 
-	m_ClipSeparator.SetWindowText(g_Opt.GetMultiPasteSeparator(false));
-
-	if(g_Opt.m_lMaxClipSizeInBytes > 0)
-	{
-		CString csMax;
-		csMax.Format(_T("%d"), g_Opt.m_lMaxClipSizeInBytes);
-		m_MaxClipSize.SetWindowText(csMax);
-	}
-
 	CString csPath = CGetSetOptions::GetDBPath();
-	if(csPath.IsEmpty())
+	m_ePath.SetWindowText(csPath);
+	
+	if (CGetSetOptions::GetFont(m_LogFont))
 	{
-		m_ePath.EnableWindow(FALSE);
-		m_btGetPath.EnableWindow(FALSE);
-		csPath = CGetSetOptions::GetDBPath();
-		m_ePath.SetWindowText(csPath);
+		m_Font.CreateFontIndirect(&m_LogFont);
+		m_btFont.SetFont(&m_Font);
 	}
 	else
 	{
-		m_btSetDatabasePath.SetCheck(BST_CHECKED);
-		m_ePath.SetWindowText(csPath);
+		CFont *ft = m_btFont.GetFont();
+		ft->GetLogFont(&m_LogFont);
 	}
 
-	m_csPlaySound = g_Opt.m_csPlaySoundOnCopy;
+	CString cs;
+	cs.Format(_T("Font - %s (%d)"), m_LogFont.lfFaceName, abs(theApp.m_metrics.PixelsToPoints(m_LogFont.lfHeight)));
+	m_btFont.SetWindowText(cs);
 
+	FillThemes();
 	FillLanguages();
 
+	int caretPos = m_popupPositionCombo.AddString(_T("At Caret"));
+	m_popupPositionCombo.SetItemData(caretPos, POS_AT_CARET);
+
+	int cursorPos = m_popupPositionCombo.AddString(_T("At Cursor"));
+	m_popupPositionCombo.SetItemData(cursorPos, POS_AT_CURSOR);
+
+	int prevPos = m_popupPositionCombo.AddString(_T("At Previous Position"));
+	m_popupPositionCombo.SetItemData(prevPos, POS_AT_PREVIOUS);
+
+	switch (CGetSetOptions::GetQuickPastePosition())
+	{
+	case POS_AT_CARET:
+		m_popupPositionCombo.SetCurSel(caretPos);
+		break;
+	case POS_AT_CURSOR:
+		m_popupPositionCombo.SetCurSel(cursorPos);
+		break;
+	case POS_AT_PREVIOUS:
+		m_popupPositionCombo.SetCurSel(prevPos);
+		break;
+	default:
+		m_popupPositionCombo.SetCurSel(cursorPos);
+	}
+
 	UpdateData(FALSE);
 
 	theApp.m_Language.UpdateOptionGeneral(this);
@@ -191,40 +196,19 @@ BOOL COptionsGeneral::OnApply()
 {
 	UpdateData();
 
-	::SendMessage(theApp.m_MainhWnd, WM_SHOW_TRAY_ICON, m_btShowIconInSysTray.GetCheck(), 0);
-
-	CGetSetOptions::SetShowIconInSysTray(m_btShowIconInSysTray.GetCheck());
-
 	if (CGetSetOptions::GetIsWindowsApp() == FALSE)
 	{
 		CGetSetOptions::SetRunOnStartUp(m_btRunOnStartup.GetCheck());
 	}
 
-	CGetSetOptions::SetCheckForMaxEntries(m_btMaximumCheck.GetCheck());
 	CGetSetOptions::SetCheckForExpiredEntries(m_btExpire.GetCheck());
-	CGetSetOptions::SetHideDittoOnHotKeyIfAlreadyShown(m_btHideDittoOnHotKey.GetCheck());
-	CGetSetOptions::SetSendPasteAfterSelection(m_btSendPasteMessage.GetCheck());
-	CGetSetOptions::SetEnsureConnectToClipboard(m_EnsureConnected.GetCheck());
-	
 	CGetSetOptions::SetMaxEntries(m_eMaxSavedCopies.GetNumber());
 	CGetSetOptions::SetExpiredEntries(m_eExpireAfter.GetNumber());
-	CGetSetOptions::SetDescTextSize(m_DescTextSize.GetNumber());
-	CGetSetOptions::SetSaveClipDelay(m_SaveDelay.GetNumber());
-
-	CGetSetOptions::SetPlaySoundOnCopy(m_csPlaySound);
-
-	g_Opt.SetAllowDuplicates(m_btAllowDuplicates.GetCheck());
-	g_Opt.SetUpdateTimeOnPaste(m_btUpdateTimeOnPaste.GetCheck());
-	g_Opt.SetSaveMultiPaste(m_btSaveMultiPaste.GetCheck());
 	
 	CString stringVal;
 
-	m_ClipSeparator.GetWindowText(stringVal);
-	g_Opt.SetMultiPasteSeparator(stringVal);
-
 	m_copyAppInclude.GetWindowText(stringVal);
 	g_Opt.SetCopyAppInclude(stringVal);
-
 	m_copyAppExclude.GetWindowText(stringVal);
 	g_Opt.SetCopyAppExclude(stringVal);
 
@@ -246,66 +230,61 @@ BOOL COptionsGeneral::OnApply()
 		}
 	}
 
-	CString csMax;
-	m_MaxClipSize.GetWindowText(csMax);
-	g_Opt.SetMaxClipSizeInBytes(ATOI(csMax));
-
-	if(m_btSetDatabasePath.GetCheck() == BST_CHECKED)
-	{
-		CString csPath;
-		m_ePath.GetWindowText(csPath);
+	CString csPath;
+	m_ePath.GetWindowText(csPath);
 
-		bool bOpenNewDatabase = false;
+	bool bOpenNewDatabase = false;
 
-		if(csPath.IsEmpty() == FALSE)
+	if(csPath.IsEmpty() == FALSE)
+	{
+		if(FileExists(csPath) == FALSE)
 		{
-			if(FileExists(csPath) == FALSE)
-			{
-				CString cs;
-				cs.Format(_T("The database %s does not exist.\n\nCreate a new database?"), csPath);
+			CString cs;
+			cs.Format(_T("The database %s does not exist.\n\nCreate a new database?"), csPath);
 
-				if(MessageBox(cs, _T("Ditto"), MB_YESNO) == IDYES)
+			if(MessageBox(cs, _T("Ditto"), MB_YESNO) == IDYES)
+			{
+				// -- create a new one
+				if(CreateDB(csPath))
 				{
-					// -- create a new one
-					if(CreateDB(csPath))
-					{
-						bOpenNewDatabase = true;
-					}
-					else
-						MessageBox(_T("Error Creating Database"));
+					bOpenNewDatabase = true;
 				}
 				else
-					return FALSE;
+					MessageBox(_T("Error Creating Database"));
 			}
 			else
+				return FALSE;
+		}
+		else
+		{
+			if(ValidDB(csPath) == FALSE)
 			{
-				if(ValidDB(csPath) == FALSE)
-				{
-					MessageBox(_T("Invalid Database"), _T("Ditto"), MB_OK);
-					m_ePath.SetFocus();
-					return FALSE;
-				}
-				else
-				{
-					bOpenNewDatabase = true;
-				}
+				MessageBox(_T("Invalid Database"), _T("Ditto"), MB_OK);
+				m_ePath.SetFocus();
+				return FALSE;
+			}
+			else
+			{
+				bOpenNewDatabase = true;
 			}
+		}
 
-			if(bOpenNewDatabase)
+		if(bOpenNewDatabase)
+		{
+			if(OpenDatabase(csPath) == FALSE)
 			{
-				if(OpenDatabase(csPath) == FALSE)
-				{
-					MessageBox(_T("Error Opening new database"), _T("Ditto"), MB_OK);
-					m_ePath.SetFocus();
-					return FALSE;
-				}
-				else
-				{
-					theApp.RefreshView();
-				}
+				MessageBox(_T("Error Opening new database"), _T("Ditto"), MB_OK);
+				m_ePath.SetFocus();
+				return FALSE;
+			}
+			else
+			{
+				theApp.RefreshView();
 			}
-		}	
+		}
 	}
+
+	CGetSetOptions::SetQuickPastePosition(m_popupPositionCombo.GetItemData(m_popupPositionCombo.GetCurSel()));
 	
 	return CPropertyPage::OnApply();
 }
@@ -314,44 +293,20 @@ BOOL COptionsGeneral::OnSetActive()
 {	
 	return CPropertyPage::OnSetActive();
 }
-void COptionsGeneral::OnBtCompactAndRepair() 
-{
-	CWaitCursor wait;
-
-	try
-	{
-		try
-		{
-			for(int i = 0; i < 100; i++)
-			{
-				int toDeleteCount = theApp.m_db.execScalar(_T("SELECT COUNT(clipID) FROM MainDeletes"));
-				if(toDeleteCount <= 0)
-					break;
-
-				RemoveOldEntries(false);
-			}
-		}
-		CATCH_SQLITE_EXCEPTION
-
-		theApp.m_db.execDML(_T("PRAGMA auto_vacuum = 1"));
-		theApp.m_db.execQuery(_T("VACUUM"));
-	}
-	CATCH_SQLITE_EXCEPTION
-}
 
-void COptionsGeneral::OnSetDbPath() 
-{
-	if(m_btSetDatabasePath.GetCheck() == BST_CHECKED)
-	{
-		m_ePath.EnableWindow(TRUE);
-		m_btGetPath.EnableWindow(TRUE);
-	}
-	else
-	{
-		m_ePath.EnableWindow(FALSE);
-		m_btGetPath.EnableWindow(FALSE);
-	}	
-}
+//void COptionsGeneral::OnSetDbPath() 
+//{
+//	if(m_btSetDatabasePath.GetCheck() == BST_CHECKED)
+//	{
+//		m_ePath.EnableWindow(TRUE);
+//		m_btGetPath.EnableWindow(TRUE);
+//	}
+//	else
+//	{
+//		m_ePath.EnableWindow(FALSE);
+//		m_btGetPath.EnableWindow(FALSE);
+//	}	
+//}
 
 void COptionsGeneral::OnGetPath() 
 {
@@ -432,48 +387,10 @@ void COptionsGeneral::OnGetPath()
 	}
 }
 
-void COptionsGeneral::OnSelectSound() 
-{
-	OPENFILENAME	FileName;
-
-	TCHAR			szFileName[400];
-	TCHAR			szDir[400];
-
-	memset(&FileName, 0, sizeof(FileName));
-	memset(szFileName, 0, sizeof(szFileName));
-	memset(&szDir, 0, sizeof(szDir));
-
-	FileName.lStructSize = sizeof(FileName);
-
-	FileName.lpstrTitle = _T("Select .wav file");
-	FileName.Flags = OFN_HIDEREADONLY | OFN_OVERWRITEPROMPT | OFN_PATHMUSTEXIST | OFN_NOCHANGEDIR;
-	FileName.nMaxFile = 400;
-	FileName.lpstrFile = szFileName;
-	FileName.lpstrInitialDir = szDir;
-	FileName.lpstrFilter = _T("Sounds(*.wav)\0*.wav\0\0");
-	FileName.lpstrDefExt = _T("wav");
-	FileName.hwndOwner = m_hWnd;
-
-	if(GetOpenFileName(&FileName) == 0)
-		return;
-
-	CString	csPath(FileName.lpstrFile);
-
-	if(csPath.GetLength())
-		m_csPlaySound = csPath;
-
-	UpdateData(FALSE);
-}
-
-void COptionsGeneral::OnButtonPlay() 
-{
-	UpdateData();
-
-	PlaySound(m_csPlaySound, NULL, SND_FILENAME|SND_ASYNC);
-}
-
 void COptionsGeneral::OnButtonAbout() 
 {
+	CDimWnd dim(this->GetParent());
+
 	CMultiLanguage Lang;
 
 	CString csLanguage;
@@ -503,3 +420,146 @@ void COptionsGeneral::OnButtonAbout()
 		MessageBox(csError, _T("Ditto"), MB_OK);
 	}
 }
+
+void COptionsGeneral::OnBnClickedButtonAdvanced()
+{
+	CDimWnd dim(this->GetParent());
+
+	CAdvGeneral adv(this);
+	adv.DoModal();
+}
+
+
+HBRUSH COptionsGeneral::OnCtlColor(CDC* pDC, CWnd* pWnd, UINT nCtlColor)
+{
+	HBRUSH hbr = CPropertyPage::OnCtlColor(pDC, pWnd, nCtlColor);
+
+	
+
+	switch(nCtlColor)
+	{
+	case CTLCOLOR_DLG:     // dialog 
+	case CTLCOLOR_STATIC:  // static, checkbox, read-only edit, etc.
+		//pDC->SetBkColor(RGB(251, 251, 251));
+		//hbr = m_brush;
+		break;
+	}
+	return hbr;
+}
+
+void COptionsGeneral::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();
+
+		CTheme theme;
+		if (theme.Load(find.GetFileTitle(), true, false))
+		{
+			if (theme.FileVersion() >= 2 && theme.FileVersion() < 100)
+			{
+				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 COptionsGeneral::OnBnClickedButtonTheme()
+{
+	CDimWnd dim(this->GetParent());
+	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);
+	}
+}
+
+
+void COptionsGeneral::OnBnClickedButtonDefaultFault()
+{
+	CFont *ft = m_btDefaultButton.GetFont();
+	ft->GetLogFont(&m_LogFont);
+
+	memset(&m_LogFont, 0, sizeof(m_LogFont));
+
+	m_LogFont.lfHeight = -theApp.m_metrics.PointsToPixels(10);
+	m_LogFont.lfWeight = 400;
+	m_LogFont.lfCharSet = 1;
+	STRCPY(m_LogFont.lfFaceName, _T("Segoe UI"));
+
+	m_Font.DeleteObject();
+	m_Font.CreateFontIndirect(&m_LogFont);
+
+	m_btFont.SetFont(&m_Font);
+
+	CString cs;
+	cs.Format(_T("Font - %s (%d)"), m_LogFont.lfFaceName, abs(theApp.m_metrics.PixelsToPoints(m_LogFont.lfHeight)));
+	m_btFont.SetWindowText(cs);
+
+	this->SetFont(&m_Font);
+}
+
+
+void COptionsGeneral::OnBnClickedButtonFont()
+{
+	CFontDialog dlg(&m_LogFont, (CF_TTONLY | CF_SCREENFONTS), 0, this);
+	if (dlg.DoModal() == IDOK)
+	{
+		m_Font.DeleteObject();
+
+		memcpy(&m_LogFont, dlg.m_cf.lpLogFont, sizeof(LOGFONT));
+
+		m_Font.CreateFontIndirect(&m_LogFont);
+
+		m_btFont.SetFont(&m_Font);
+
+		CString cs;
+		cs.Format(_T("Font - %s (%d)"), m_LogFont.lfFaceName, abs(theApp.m_metrics.PixelsToPoints(m_LogFont.lfHeight)));
+		m_btFont.SetWindowText(cs);
+	}
+}

+ 17 - 9
OptionsGeneral.h

@@ -27,24 +27,20 @@ public:
 // Dialog Data
 	//{{AFX_DATA(COptionsGeneral)
 	enum { IDD = IDD_OPTIONS_GENERAL };
-	CButton	m_EnsureConnected;
+	//CButton	m_EnsureConnected;
 	CNumberEdit	m_SaveDelay;
 	CComboBox m_cbLanguage;
 	CEdit m_MaxClipSize;
 	CButton	m_btSendPasteMessage;
 	CButton	m_btHideDittoOnHotKey;
 	CNumberEdit	m_DescTextSize;
-	CButton	m_btGetPath;
 	CEdit m_ePath;
-	CButton	m_btSetDatabasePath;
 	CNumberEdit	m_eExpireAfter;
 	CNumberEdit	m_eMaxSavedCopies;
 	CButton	m_btMaximumCheck;
 	CButton	m_btExpire;
 	CButton m_btShowIconInSysTray;
 	CButton	m_btRunOnStartup;
-	CButton m_btAllowDuplicates;
-	CButton m_btUpdateTimeOnPaste;
 	CButton m_btSaveMultiPaste;
 	CString	m_csPlaySound;
 	CEdit m_ClipSeparator;
@@ -70,21 +66,33 @@ protected:
 
 	CString m_csTitle;
 
+	CBrush m_brush;
+
+	CFont m_Font;
+	LOGFONT m_LogFont;
+
+	void FillThemes();
+	
 	void FillLanguages();
 
 	// Generated message map functions
 	//{{AFX_MSG(COptionsGeneral)
 	virtual BOOL OnInitDialog();
-	afx_msg void OnBtCompactAndRepair();
-	afx_msg void OnSetDbPath();
 	afx_msg void OnGetPath();
-	afx_msg void OnSelectSound();
-	afx_msg void OnButtonPlay();
 	afx_msg void OnButtonAbout();
 	//}}AFX_MSG
 	DECLARE_MESSAGE_MAP()
 
 public:
+	afx_msg void OnBnClickedButtonAdvanced();
+	afx_msg HBRUSH OnCtlColor(CDC* pDC, CWnd* pWnd, UINT nCtlColor);
+	afx_msg void OnBnClickedButtonTheme();
+	afx_msg void OnBnClickedButtonDefaultFault();
+	afx_msg void OnBnClickedButtonFont();
+	CComboBox m_cbTheme;
+	CButton m_btFont;
+	CButton m_btDefaultButton;
+	CComboBox m_popupPositionCombo;
 };
 
 //{{AFX_INSERT_LOCATION}}

+ 1 - 1
OptionsQuickPaste.cpp

@@ -282,8 +282,8 @@ void COptionsQuickPaste::FillThemes()
 	{
 		m_cbTheme.SetCurSel(nIndex);
 	}
-
 }
+
 void COptionsQuickPaste::OnBnClickedButtonTheme()
 {
 	CTheme theme;

+ 8 - 4
OptionsSheet.cpp

@@ -33,7 +33,7 @@ COptionsSheet::COptionsSheet(LPCTSTR pszCaption, CWnd* pParentWnd, UINT iSelectP
 	m_themeChanged = FALSE;
 	m_pKeyBoardOptions = NULL;
 	m_pGeneralOptions = NULL;
-	m_pQuickPasteOptions = NULL;
+	//m_pQuickPasteOptions = NULL;
 	m_pCopyBuffers = NULL;
 	m_pStats = NULL;
 	m_pTypes = NULL;
@@ -49,7 +49,7 @@ COptionsSheet::COptionsSheet(LPCTSTR pszCaption, CWnd* pParentWnd, UINT iSelectP
 
 	m_pGeneralOptions = new COptionsGeneral;
 	m_pKeyBoardOptions = new COptionsKeyBoard;
-	m_pQuickPasteOptions = new COptionsQuickPaste;
+	//m_pQuickPasteOptions = new COptionsQuickPaste;
 	m_pQuickPasteShortCuts = new CQuickPasteKeyboard;
 
 	m_pCopyBuffers = new COptionsCopyBuffers;
@@ -61,7 +61,7 @@ COptionsSheet::COptionsSheet(LPCTSTR pszCaption, CWnd* pParentWnd, UINT iSelectP
 	AddPage(m_pTypes);
 	AddPage(m_pKeyBoardOptions);
 	AddPage(m_pCopyBuffers);
-	AddPage(m_pQuickPasteOptions);
+	//AddPage(m_pQuickPasteOptions);
 	AddPage(m_pQuickPasteShortCuts);
 	if(g_Opt.GetAllowFriends())
 	{
@@ -70,13 +70,15 @@ COptionsSheet::COptionsSheet(LPCTSTR pszCaption, CWnd* pParentWnd, UINT iSelectP
 	}
 	AddPage(m_pStats);
 	AddPage(m_pAbout);
+
+	
 }
 
 COptionsSheet::~COptionsSheet()
 {
 	delete m_pGeneralOptions;
 	delete m_pKeyBoardOptions;
-	delete m_pQuickPasteOptions;
+	//delete m_pQuickPasteOptions;
 	delete m_pCopyBuffers;
 	delete m_pStats;
 	delete m_pTypes;
@@ -113,6 +115,8 @@ BOOL COptionsSheet::OnInitDialog()
 	m_bModeless = FALSE;   
 	m_nFlags |= WF_CONTINUEMODAL;
 
+	
+
 	BOOL bResult = CPropertySheet::OnInitDialog();
 
 	SetWindowText(_T("Ditto"));

+ 2 - 0
OptionsSheet.h

@@ -8,6 +8,8 @@
 //
 //#include "ShowTaskBarIcon.h"
 
+#include "CBPropertySheet.h"
+
 /////////////////////////////////////////////////////////////////////////////
 // COptionsSheet
 

+ 2 - 0
OptionsTypes.cpp

@@ -5,6 +5,7 @@
 #include "CP_Main.h"
 #include "OptionsTypes.h"
 #include "Shared/ArrayEx.h"
+#include "DimWnd.h"
 
 #ifdef _DEBUG
 #define new DEBUG_NEW
@@ -129,6 +130,7 @@ void COptionsTypes::OnDelete()
 #include "AddType.h"
 void COptionsTypes::OnAdd() 
 {
+	CDimWnd dim(this->GetParent());
 	CAddType add(this);
 
 	if(add.DoModal() == IDOK)

+ 37 - 23
QPasteWnd.cpp

@@ -18,10 +18,10 @@
 #include "QRCodeViewer.h"
 #include "CreateQRCodeImage.h"
 #include "ClipCompare.h"
-//#include "MyDropTarget.h"
 #include "Misc.h"
 #include "FriendPromptDlg.h"
 #include "DimWnd.h"
+#include "client.h"
 
 #ifdef _DEBUG
     #define new DEBUG_NEW
@@ -295,6 +295,7 @@ ON_COMMAND(ID_SENDTO_PROMPTFORNAME, &CQPasteWnd::OnSendtoPromptforname)
 ON_UPDATE_COMMAND_UI(ID_SENDTO_PROMPTFORNAME, &CQPasteWnd::OnUpdateSendtoPromptforname)
 ON_COMMAND(ID_IMPORT_IMPORTCOPIEDFILE, &CQPasteWnd::OnImportImportcopiedfile)
 ON_UPDATE_COMMAND_UI(ID_IMPORT_IMPORTCOPIEDFILE, &CQPasteWnd::OnUpdateImportImportcopiedfile)
+ON_UPDATE_COMMAND_UI(32775, &CQPasteWnd::OnUpdate32775)
 END_MESSAGE_MAP()
 
 
@@ -385,9 +386,7 @@ int CQPasteWnd::OnCreate(LPCREATESTRUCT lpCreateStruct)
         return -1;
     }
 
-    #ifdef AFTER_98
-        m_Alpha.SetWindowHandle(m_hWnd);
-    #endif 
+    m_Alpha.SetWindowHandle(m_hWnd);
 		
 	m_SearchFont.CreateFont(-theApp.m_metrics.PointsToPixels(12), 0, 0, 0, 400, 0, 0, 0, DEFAULT_CHARSET, 3, 2, 1, 34, _T("Segoe UI"));
     m_search.SetFont(&m_SearchFont);
@@ -1816,24 +1815,22 @@ void CQPasteWnd::OnMenuTransparency40()
 
 void CQPasteWnd::SetTransparency(int percent)
 {
-    #ifdef AFTER_98
-        if(percent)
-        {
-            CGetSetOptions::SetTransparencyPercent(percent);
-            CGetSetOptions::SetEnableTransparency(TRUE);
+    if(percent)
+    {
+        CGetSetOptions::SetTransparencyPercent(percent);
+        CGetSetOptions::SetEnableTransparency(TRUE);
 
-            m_Alpha.SetTransparent(TRUE);
+        m_Alpha.SetTransparent(TRUE);
 
-            float fPercent = percent / (float)100.0;
+        float fPercent = percent / (float)100.0;
 
-            m_Alpha.SetOpacity(OPACITY_MAX - (int)(fPercent *OPACITY_MAX));
-        }
-        else
-        {
-            CGetSetOptions::SetEnableTransparency(FALSE);
-            m_Alpha.SetTransparent(FALSE);
-        }
-    #endif 
+        m_Alpha.SetOpacity(OPACITY_MAX - (int)(fPercent *OPACITY_MAX));
+    }
+    else
+    {
+        CGetSetOptions::SetEnableTransparency(FALSE);
+        m_Alpha.SetTransparent(FALSE);
+    }
 }
 
 void CQPasteWnd::SetCurrentTransparency()
@@ -1885,12 +1882,18 @@ void CQPasteWnd::OnMenuExitprogram()
 
 void CQPasteWnd::OnMenuToggleConnectCV()
 {
-    theApp.ToggleConnectCV();
-
-	UpdateStatus();
+	this->DoAction(ActionEnums::TOGGLE_CLIPBOARD_CONNECTION);
 }
 
-#include "client.h"
+void CQPasteWnd::OnUpdate32775(CCmdUI *pCmdUI)
+{
+	if (!pCmdUI->m_pMenu)
+	{
+		return;
+	}
+
+	UpdateMenuShortCut(pCmdUI, ActionEnums::TOGGLE_CLIPBOARD_CONNECTION);
+}
 
 void CQPasteWnd::OnMenuProperties()
 {
@@ -3028,6 +3031,9 @@ bool CQPasteWnd::DoAction(DWORD actionId)
 	case ActionEnums::SAVE_CF_HDROP_FIlE_DATA:
 		ret = DoActionSaveCF_HDROP_FileData();
 		break;
+	case ActionEnums::TOGGLE_CLIPBOARD_CONNECTION:
+		ret = DoActionToggleClipboardConnection();
+		break;
 	}
 
 	return ret;
@@ -4446,6 +4452,14 @@ bool CQPasteWnd::DoActionPromptSendToFriend()
 	return true;
 }
 
+bool CQPasteWnd::DoActionToggleClipboardConnection()
+{
+	theApp.ToggleConnectCV();
+	UpdateStatus();
+
+	return true;
+}
+
 bool CQPasteWnd::OnDeleteClipData()
 {
 	CWnd *pWnd = AfxGetMainWnd();

+ 2 - 0
QPasteWnd.h

@@ -276,6 +276,7 @@ public:
 	bool DoActionReplaceTopStickyClip();
 	bool DoActionPromptSendToFriend();
 	bool DoActionSaveCF_HDROP_FileData();
+	bool DoActionToggleClipboardConnection();
 
 	bool OnNewClip();
 	bool OnImportClip();
@@ -509,4 +510,5 @@ public:
 	afx_msg void OnUpdateSendtoPromptforname(CCmdUI *pCmdUI);
 	afx_msg void OnImportImportcopiedfile();
 	afx_msg void OnUpdateImportImportcopiedfile(CCmdUI *pCmdUI);
+	afx_msg void OnUpdate32775(CCmdUI *pCmdUI);
 };

+ 9 - 1
Resource.h

@@ -180,6 +180,8 @@
 #define IDC_CURSOR2                     323
 #define IDC_CURSOR_ZOOM_OUT             323
 #define IDD_DIALOG_FREIND_PROMPT        324
+#define IDD_DIALOG2                     325
+#define IDD_ADV_OPTIONS                 325
 #define IDC_PATH                        1000
 #define IDC_GET_PATH                    1001
 #define IDC_SELECT_SOUND                1002
@@ -389,6 +391,7 @@
 #define IDC_STATIC_LANGUAGE             2069
 #define IDC_COMBO_LANGUAGE              2070
 #define IDC_EDIT_SAVE_DELAY             2071
+#define IDC_COMBO_POPUP_POSITION        2071
 #define IDC_STATIC_SAVE_DELAY           2072
 #define IDC_BUTTON_ABOUT                2073
 #define IDC_EDIT_QUICK_PASTE            2074
@@ -428,10 +431,14 @@
 #define IDC_STATIC_APP_SEP_DESC         2098
 #define IDC_COPY_3                      2099
 #define IDC_CHECK_WIN                   2099
+#define IDC_STATIC_DATABASE_PATH        2099
 #define IDC_WIN_COPY_3                  2100
 #define IDC_EDIT_PROPERTIES             2100
+#define IDC_STATIC_POPUP_POS            2100
 #define IDC_PASTE_3                     2101
 #define IDC_CHECK_WIN_MOVE_TO_GROUP     2101
+#define IDC_STATIC_POPUP_POS2           2101
+#define IDC_STATIC_FONT                 2101
 #define IDC_WIN_PASTE_3                 2102
 #define IDC_TIME_CREATE_START           2102
 #define IDC_STATIC_COPY_3               2103
@@ -466,6 +473,7 @@
 #define IDC_BUTTON2                     2124
 #define IDC_BUTTON_DIFF_BROWSE          2124
 #define IDC_BUTTON_REMOVE               2124
+#define IDC_BUTTON_ADVANCED             2124
 #define IDC_STATIC_QUICK_PASTE          2125
 #define IDC_STATIC_DESC                 2126
 #define IDC_RADIO_USE_IP                2127
@@ -676,7 +684,7 @@
 #ifdef APSTUDIO_INVOKED
 #ifndef APSTUDIO_READONLY_SYMBOLS
 #define _APS_3D_CONTROLS                     1
-#define _APS_NEXT_RESOURCE_VALUE        326
+#define _APS_NEXT_RESOURCE_VALUE        328
 #define _APS_NEXT_COMMAND_VALUE         32942
 #define _APS_NEXT_CONTROL_VALUE         2151
 #define _APS_NEXT_SYMED_VALUE           104