void CCP_MainApp::ShowPersistent( bool bVal ) { g_Opt.SetShowPersistent( bVal ); // give some visual indication if( m_bShowingQuickPaste ) { ASSERT( QPasteWnd() ); QPasteWnd()->SetCaptionColorActive(!g_Opt.m_bShowPersistent, theApp.GetConnectCV()); QPasteWnd()->RefreshNc(); } }
BOOL CCP_MainApp::EnterGroupID(long lID) { BOOL bResult = FALSE; if(m_GroupID == lID) return TRUE; // if we are switching to the parent, focus on the previous group if(m_GroupParentID == lID && m_GroupID > 0) m_FocusID = m_GroupID; switch(lID) { case -1: m_FocusID = -1; m_GroupID = -1; m_GroupParentID = -1; m_GroupText = "History"; bResult = TRUE; break; default: // Normal Group try { CppSQLite3Query q = theApp.m_db.execQueryEx(_T("SELECT lParentID, mText, bIsGroup FROM Main WHERE lID = %d"), lID); if(q.eof() == false) { if(q.getIntField(_T("bIsGroup")) > 0) { m_GroupID = lID; m_GroupParentID = q.getIntField(_T("lParentID")); // if( m_GroupParentID == 0 ) // m_GroupParentID = -1; // back out into "all top-level groups" list. m_GroupText = q.getStringField(_T("mText")); bResult = TRUE; } } } CATCH_SQLITE_EXCEPTION break; } if(bResult) { theApp.RefreshView(); if(QPasteWnd()) QPasteWnd()->UpdateStatus(true); } return bResult; }
void CCP_MainApp::SetConnectCV(bool bConnect) { m_CopyThread.SetConnectCV(bConnect); if(bConnect) m_pMainFrame->m_TrayIcon.SetIcon(IDR_MAINFRAME); else m_pMainFrame->m_TrayIcon.SetIcon(IDI_DITTO_NOCOPYCB); if(QPasteWnd()) { QPasteWnd()->SetCaptionColorActive(!g_Opt.m_bShowPersistent, theApp.GetConnectCV()); QPasteWnd()->RefreshNc(); } }
// Sets a menu entry according to the current Clipboard Viewer Connection status // - the menu text indicates the available command (opposite the current state) // - a check mark appears in the rare cases that the menu text actually represents // the current state, e.g. if we are supposed to be connected, but we somehow // lose that connection, "Disconnect from Clipboard" will have a check next to it. void CCP_MainApp::UpdateMenuConnectCV(CMenu* pMenu, UINT nMenuID) { if(pMenu == NULL) return; bool bConnect = theApp.GetConnectCV(); CString cs; if(bConnect) { cs = theApp.m_Language.GetString("Disconnect_Clipboard", "Disconnect from Clipboard."); pMenu->ModifyMenu(nMenuID, MF_BYCOMMAND, nMenuID, cs); } else { cs = theApp.m_Language.GetString("Connect_Clipboard", "Connect to Clipboard."); pMenu->ModifyMenu(nMenuID, MF_BYCOMMAND, nMenuID, cs); } }
BOOL CCP_MainApp::TryEnterOldGroupState() { BOOL enteredGroup = FALSE; if(m_oldGroupID > -2) { m_GroupID = m_oldGroupID; m_GroupParentID = m_oldGroupParentID; m_GroupText = m_oldGroupText; ClearOldGroupState(); theApp.RefreshView(); if(QPasteWnd()) QPasteWnd()->UpdateStatus(true); enteredGroup = TRUE; } return enteredGroup; }
BOOL CCP_MainApp::EnterGroupID(long lID, BOOL clearOldGroupState/* = TRUE*/, BOOL saveCurrentGroupState/* = FALSE*/) { BOOL bResult = FALSE; if(m_GroupID == lID) return TRUE; DWORD startTick = GetTickCount(); if(clearOldGroupState) { ClearOldGroupState(); } if(saveCurrentGroupState) { SaveCurrentGroupState(); } // if we are switching to the parent, focus on the previous group if(m_GroupParentID == lID && m_GroupID > 0) m_FocusID = m_GroupID; switch(lID) { case -1: m_FocusID = -1; m_GroupID = -1; m_GroupParentID = -1; m_GroupText = "History"; bResult = TRUE; break; default: // Normal Group try { CppSQLite3Query q = theApp.m_db.execQueryEx(_T("SELECT lParentID, mText, bIsGroup FROM Main WHERE lID = %d"), lID); if(q.eof() == false) { if(q.getIntField(_T("bIsGroup")) > 0) { m_GroupID = lID; m_GroupParentID = q.getIntField(_T("lParentID")); m_GroupText = q.getStringField(_T("mText")); bResult = TRUE; } } } CATCH_SQLITE_EXCEPTION break; } if(bResult) { theApp.RefreshView(); if(QPasteWnd()) QPasteWnd()->UpdateStatus(true); } DWORD endTick = GetTickCount(); if((endTick-startTick) > 150) Log(StrF(_T("Paste Timing EnterParentId: %d"), endTick-startTick)); return bResult; }