Browse Source

Revert "Revert "order by sticky clip order first then group, then clip order - updated indexes""

This reverts commit e6bf3801f22bfc52e710b2ea34e527775a9403d5.
sabrogden 5 years ago
parent
commit
94fcd9905e
6 changed files with 51 additions and 10 deletions
  1. 15 0
      AdvGeneral.cpp
  2. 20 3
      DatabaseUtilities.cpp
  3. 2 2
      DittoSetup/BuildDitto.bld
  4. 9 0
      MainFrm.cpp
  5. 1 1
      Options.cpp
  6. 4 4
      QPasteWnd.cpp

+ 15 - 0
AdvGeneral.cpp

@@ -124,6 +124,8 @@ END_MESSAGE_MAP()
 #define SETTING_FIRST_TEN_HOTKEYS_START 74
 #define SETTING_FIRST_TEN_HOTKEYS_FONT_SIZE 75
 
+#define SETTING_OPEN_TO_GROUP_AS_ACTIVE_EXE 76
+
 BOOL CAdvGeneral::OnInitDialog()
 {
 	CDialogEx::OnInitDialog();
@@ -189,6 +191,8 @@ BOOL CAdvGeneral::OnInitDialog()
 
 	AddTrueFalse(pGroupTest, _T("Multi-Paste in reverse order"), g_Opt.m_bMultiPasteReverse, SETTING_MULTIPASTE_REVERSE_ORDER);
 
+	AddTrueFalse(pGroupTest, _T("Open to group same as active exe"), CGetSetOptions::GetOpenToGroupByActiveExe(), SETTING_OPEN_TO_GROUP_AS_ACTIVE_EXE);
+
 	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);
@@ -751,6 +755,17 @@ void CAdvGeneral::OnBnClickedOk()
 					CGetSetOptions::SetFirstTenHotKeysFontSize(pNewValue->lVal);
 				}
 				break;
+			case SETTING_OPEN_TO_GROUP_AS_ACTIVE_EXE:
+				if (wcscmp(pNewValue->bstrVal, pOrigValue->bstrVal) != 0)
+				{
+					BOOL val = false;
+					if (wcscmp(pNewValue->bstrVal, L"True") == 0)
+					{
+						val = true;
+					}
+					CGetSetOptions::SetOpenToGroupByActiveExe(val);
+				}
+				break;
 			}
 		}
 	}

+ 20 - 3
DatabaseUtilities.cpp

@@ -435,6 +435,18 @@ BOOL ValidDB(CString csPath, BOOL bUpgrade)
 
 			e.errorCode();
 		}
+
+		db.execDML(_T("DROP INDEX IF EXISTS Main_NoGroup"));
+		db.execDML(_T("DROP INDEX IF EXISTS Main_InGroup"));
+		db.execDML(_T("DROP INDEX IF EXISTS Main_ShortCut"));
+
+		db.execDML(_T("CREATE INDEX IF NOT EXISTS Main_TopLevelParentID ON Main(lParentId ASC, stickyClipOrder DESC, bIsGroup ASC, clipOrder DESC);"));
+		db.execDML(_T("CREATE INDEX IF NOT EXISTS Main_TopLevel ON Main(stickyClipOrder DESC, bIsGroup ASC, clipOrder DESC);"));
+		db.execDML(_T("CREATE INDEX IF NOT EXISTS Main_InGroup2 ON Main(lParentId ASC, stickyClipGroupOrder DESC, bIsGroup ASC, clipGroupOrder DESC);"));
+
+		db.execDML(_T("CREATE INDEX IF NOT EXISTS Main_ShortCut2 on Main(lShortCut DESC, globalShortCut DESC)"));
+		db.execDML(_T("CREATE INDEX IF NOT EXISTS Main_MoveToGroup on Main(MoveToGroupShortCut DESC, GlobalMoveToGroupShortCut DESC)"));
+		db.execDML(_T("CREATE INDEX IF NOT EXISTS Main_CRC on Main(CRC ASC)"));
 	}
 	CATCH_SQLITE_EXCEPTION_AND_RETURN(FALSE)
 
@@ -687,7 +699,6 @@ BOOL CreateDB(CString csFile)
 		db.execDML(_T("CREATE INDEX Main_ClipGroupOrder on Main(clipGroupOrder DESC)"));
 		db.execDML(_T("CREATE INDEX Main_ParentId on Main(lParentID DESC)"));
 		db.execDML(_T("CREATE INDEX Main_IsGroup on Main(bIsGroup DESC)"));
-        db.execDML(_T("CREATE INDEX Main_ShortCut on Main(lShortCut DESC)"));
 
 		db.execDML(_T("CREATE TRIGGER delete_data_trigger BEFORE DELETE ON Main FOR EACH ROW\n")
 			_T("BEGIN\n")
@@ -709,10 +720,16 @@ BOOL CreateDB(CString csFile)
 				_T("DELETE FROM Data WHERE lParentID = old.clipID;\n")
 			_T("END\n"));
 
-		db.execDML(_T("CREATE INDEX Main_NoGroup ON Main(bIsGroup ASC, stickyClipOrder DESC, clipOrder DESC);"));
-		db.execDML(_T("CREATE INDEX Main_InGroup ON Main(lParentId ASC, bIsGroup ASC, stickyClipGroupOrder DESC, clipGroupOrder DESC);"));
 		db.execDML(_T("CREATE INDEX Data_ParentId_Format ON Data(lParentID COLLATE BINARY ASC, strClipBoardFormat COLLATE NOCASE ASC);"));
 
+		db.execDML(_T("CREATE INDEX IF NOT EXISTS Main_TopLevelParentID ON Main(lParentId ASC, stickyClipOrder DESC, bIsGroup ASC, clipOrder DESC);"));
+		db.execDML(_T("CREATE INDEX IF NOT EXISTS Main_TopLevel ON Main(stickyClipOrder DESC, bIsGroup ASC, clipOrder DESC);"));
+		db.execDML(_T("CREATE INDEX IF NOT EXISTS Main_InGroup2 ON Main(lParentId ASC, stickyClipGroupOrder DESC, bIsGroup ASC, clipGroupOrder DESC);"));
+
+		db.execDML(_T("CREATE INDEX IF NOT EXISTS Main_ShortCut2 on Main(lShortCut DESC, globalShortCut DESC)"));
+		db.execDML(_T("CREATE INDEX IF NOT EXISTS Main_MoveToGroup on Main(MoveToGroupShortCut DESC, GlobalMoveToGroupShortCut DESC)"));
+		db.execDML(_T("CREATE INDEX IF NOT EXISTS Main_CRC on Main(CRC ASC)"));
+
 		db.close();
 	}
 	CATCH_SQLITE_EXCEPTION_AND_RETURN(FALSE)

+ 2 - 2
DittoSetup/BuildDitto.bld

@@ -2944,7 +2944,7 @@ var sc_security="b3f57099";
 		</step>
 		<step action='Git'>
 			<Command>log</Command>
-			<Options>--pretty=format:"%%ad %%s" --date=short   --since=2018-12-23</Options>
+			<Options>--pretty=format:"%%ad %%s" --date=short   --since=2020-01-01</Options>
 			<WorkDir>%workDir%</WorkDir>
 			<buildfailsteps type='11'>0</buildfailsteps>
 			<indent type='3'>2</indent>
@@ -3063,7 +3063,7 @@ var sc_security="b3f57099";
 			<value>3</value>
 		</macro>
 		<macro name='verMinor'>
-			<value>22</value>
+			<value>23</value>
 		</macro>
 		<macro name='verRevision'>
 			<value>0</value>

+ 9 - 0
MainFrm.cpp

@@ -1249,6 +1249,15 @@ LRESULT CMainFrame::OnOptionsClosed(WPARAM wParam, LPARAM lParam)
 
 	m_trayIcon.SetMenu(NULL, IDR_MENU);
 	theApp.m_Language.UpdateTrayIconRightClickMenu(&m_trayIcon.GetMenu());
+
+	if (CGetSetOptions::GetShowIconInSysTray())
+	{
+		m_trayIcon.Show();
+	}
+	else
+	{
+		m_trayIcon.Hide();
+	}
 	
 
 	return 0;

+ 1 - 1
Options.cpp

@@ -2663,7 +2663,7 @@ CString	CGetSetOptions::GetRegexFilterByProcessName(int pos)
 
 BOOL CGetSetOptions::GetOpenToGroupByActiveExe()
 {
-	return GetProfileLong(_T("OpenToGroupByActiveExe"), TRUE);
+	return GetProfileLong(_T("OpenToGroupByActiveExe"), FALSE);
 }
 
 void CGetSetOptions::SetOpenToGroupByActiveExe(int val)

+ 4 - 4
QPasteWnd.cpp

@@ -1317,8 +1317,8 @@ BOOL CQPasteWnd::FillList(CString csSQLSearch /*=""*/)
 	if (theApp.m_GroupID < 0)
 	{
 		//do not change this this directly relates to the views in the Main table
-		csSort = "Main.bIsGroup ASC, "
-			"Main.stickyClipOrder DESC, "
+		csSort = "Main.stickyClipOrder DESC, "
+			"Main.bIsGroup ASC, "			
 			"Main.clipOrder DESC";
 
 		if (g_Opt.m_bShowAllClipsInMainList)
@@ -1342,8 +1342,8 @@ BOOL CQPasteWnd::FillList(CString csSQLSearch /*=""*/)
 		// it's some other group
 	{
 		//do not change this this directly relates to the views in the Main table
-		csSort = "Main.bIsGroup ASC, "
-			"Main.stickyClipGroupOrder DESC, "
+		csSort = "Main.stickyClipGroupOrder DESC, "
+			"Main.bIsGroup ASC, "			
 			"Main.clipGroupOrder DESC";
 
 		//Main.stickyClipGroupOrder DESC, Main.clipGroupOrder DESC";//