QPasteWnd.h 9.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285
  1. #if !defined(AFX_QPASTEWND_H__65261F0F_FEFD_48CF_A0CD_01D8BFEB353B__INCLUDED_)
  2. #define AFX_QPASTEWND_H__65261F0F_FEFD_48CF_A0CD_01D8BFEB353B__INCLUDED_
  3. #if _MSC_VER > 1000
  4. #pragma once
  5. #endif // _MSC_VER > 1000
  6. // QPasteWnd.h : header file
  7. //
  8. #include "QListCtrl.h"
  9. #include "SearchEditBox.h"
  10. #include "WndEx.h"
  11. #include "GroupStatic.h"
  12. #include "GroupTree.h"
  13. #include "AlphaBlend.h"
  14. #include "Sqlite\CppSQLite3.h"
  15. #include <vector>
  16. #include <afxmt.h>
  17. class CMainTable
  18. {
  19. public:
  20. CMainTable():
  21. m_lID(-1),
  22. m_bDontAutoDelete(false),
  23. m_bIsGroup(false),
  24. m_bHasShortCut(false),
  25. m_bHasParent(false)
  26. {
  27. }
  28. long m_lID;
  29. CString m_Desc;
  30. bool m_bDontAutoDelete;
  31. bool m_bIsGroup;
  32. bool m_bHasShortCut;
  33. bool m_bHasParent;
  34. CString m_QuickPaste;
  35. };
  36. /////////////////////////////////////////////////////////////////////////////
  37. // CQPasteWnd window
  38. class CQPasteWnd : public CWndEx
  39. {
  40. // Construction
  41. public:
  42. CQPasteWnd();
  43. // Attributes
  44. public:
  45. // Operations
  46. public:
  47. // Overrides
  48. // ClassWizard generated virtual function overrides
  49. //{{AFX_VIRTUAL(CQPasteWnd)
  50. public:
  51. virtual BOOL Create(const POINT& ptStart, CWnd* pParentWnd);
  52. virtual BOOL PreTranslateMessage(MSG* pMsg);
  53. //}}AFX_VIRTUAL
  54. // Implementation
  55. public:
  56. bool Add(const CString &csHeader, const CString &csText, int nID);
  57. virtual ~CQPasteWnd();
  58. void UpdateFont();
  59. //protected:
  60. CQListCtrl m_lstHeader;
  61. CAlphaBlend m_Alpha;
  62. CFont m_TitleFont;
  63. CSearchEditBox m_Search;
  64. CFont m_SearchFont;
  65. CButton m_btCancel;
  66. bool m_bHideWnd;
  67. CString m_strSQLSearch;
  68. CGroupStatic m_stGroup;
  69. CFont GroupFont;
  70. CString m_Title;
  71. CGroupTree m_GroupTree;
  72. CBitmapButton m_ShowGroupsFolderBottom;
  73. CBitmapButton m_ShowGroupsFolderTop;
  74. CBitmapButton m_BackButton;
  75. bool m_bAllowRepaintImmediately;
  76. CString m_SQL;
  77. CString m_CountSQL;
  78. long m_lRecordCount;
  79. bool m_bStopQuery;
  80. bool m_bHandleSearchTextChange;
  81. bool m_bFoundClipToSetFocusTo;
  82. long m_lItemsPerPage;
  83. bool m_bModifersMoveActive;
  84. std::vector<CMainTable> m_Cache;
  85. HANDLE m_Events[4];
  86. HANDLE m_ExitEvent;
  87. HANDLE m_SearchingEvent;
  88. CCriticalSection m_CritSection;
  89. CAccels m_MainAccels;
  90. void RefreshNc( bool bRepaintImmediately = false );
  91. void UpdateStatus( bool bRepaintImmediately = false ); // regenerates the status (caption) text
  92. BOOL FillList(CString csSQLSearch = "");
  93. BOOL HideQPasteWindow();
  94. BOOL ShowQPasteWindow(BOOL bFillList = TRUE);
  95. void MoveControls();
  96. void DeleteSelectedRows();
  97. BOOL OpenID(long lID, bool bOnlyLoad_CF_TEXT = false, CClipFormats *pPasteFormats = NULL);
  98. BOOL OpenSelection(bool bOnlyLoad_CF_TEXT = false);
  99. BOOL OpenIndex( long nItem );
  100. BOOL NewGroup( bool bGroupSelection = true );
  101. // moves the caret to the given ID, selects it, and ensures it is visible.
  102. long SetListID( long lID );
  103. CString LoadDescription( int nItem );
  104. bool SaveDescription( int nItem, CString text );
  105. //Menu Items
  106. void SetLinesPerRow(long lLines);
  107. void SetTransparency(long lPercent);
  108. void OnUpdateLinesPerRow(CCmdUI* pCmdUI, int nValue);
  109. void OnUpdateTransparency(CCmdUI* pCmdUI, int nValue);
  110. void SetMenuChecks(CMenu *pMenu);
  111. void SetSendToMenu(CMenu *pMenu, int nMenuID, int nArrayPos);
  112. BOOL SendToFriendbyPos(int nPos);
  113. bool InsertNextNRecords(int nEnd);
  114. CString GetDisplayText(long lDontAutoDelete, long lShortCut, bool bIsGroup, long lParentID, CString csText);
  115. void FillMainTable(CMainTable &table, CppSQLite3Query &q);
  116. void RunThread();
  117. void MoveSelection(bool down);
  118. void OnKeyStateUp();
  119. void SetKeyModiferState(bool bActive);
  120. // Generated message map functions
  121. protected:
  122. //{{AFX_MSG(CQPasteWnd)
  123. DECLARE_MESSAGE_MAP()
  124. afx_msg int OnCreate(LPCREATESTRUCT lpCreateStruct);
  125. afx_msg void OnSize(UINT nType, int cx, int cy);
  126. afx_msg void OnSetFocus(CWnd* pOldWnd);
  127. afx_msg void OnActivate(UINT nState, CWnd* pWndOther, BOOL bMinimized);
  128. afx_msg void OnMenuLinesperrow1();
  129. afx_msg void OnMenuLinesperrow2();
  130. afx_msg void OnMenuLinesperrow3();
  131. afx_msg void OnMenuLinesperrow4();
  132. afx_msg void OnMenuLinesperrow5();
  133. afx_msg void OnMenuTransparency10();
  134. afx_msg void OnMenuTransparency15();
  135. afx_msg void OnMenuTransparency20();
  136. afx_msg void OnMenuTransparency25();
  137. afx_msg void OnMenuTransparency30();
  138. afx_msg void OnMenuTransparency40();
  139. afx_msg void OnMenuTransparency5();
  140. afx_msg void OnMenuTransparencyNone();
  141. afx_msg void OnRclickQuickPaste(NMHDR* pNMHDR, LRESULT* pResult);
  142. afx_msg void OnMenuDelete();
  143. afx_msg void OnMenuPositioningAtcaret();
  144. afx_msg void OnMenuPositioningAtcursor();
  145. afx_msg void OnMenuPositioningAtpreviousposition();
  146. afx_msg void OnMenuOptions();
  147. afx_msg void OnCancelFilter();
  148. afx_msg void OnMenuExitprogram();
  149. afx_msg void OnMenuToggleConnectCV();
  150. afx_msg void OnMenuProperties();
  151. afx_msg void OnClose();
  152. afx_msg void OnBegindrag(NMHDR* pNMHDR, LRESULT* pResult);
  153. afx_msg void OnSysKeyDown(UINT nChar, UINT nRepCnt, UINT nFlags);
  154. afx_msg void GetDispInfo(NMHDR* pNMHDR, LRESULT* pResult);
  155. afx_msg void OnFindItem(NMHDR* pNMHDR, LRESULT* pResult);
  156. afx_msg void OnMenuFirsttenhotkeysUsectrlnum();
  157. afx_msg void OnMenuFirsttenhotkeysShowhotkeytext();
  158. afx_msg void OnMenuQuickoptionsAllwaysshowdescription();
  159. afx_msg void OnMenuQuickoptionsDoubleclickingoncaptionTogglesalwaysontop();
  160. afx_msg void OnMenuQuickoptionsDoubleclickingoncaptionRollupwindow();
  161. afx_msg void OnMenuQuickoptionsDoubleclickingoncaptionTogglesshowdescription();
  162. afx_msg void OnMenuQuickoptionsPromptfornewgroupnames();
  163. afx_msg void OnShowGroupsBottom();
  164. afx_msg void OnShowGroupsTop();
  165. afx_msg void OnMenuViewgroups();
  166. afx_msg void OnMenuQuickpropertiesSettoneverautodelete();
  167. afx_msg void OnMenuQuickpropertiesAutodelete();
  168. afx_msg void OnMenuQuickpropertiesRemovehotkey();
  169. afx_msg void OnMenuSenttoFriendEight();
  170. afx_msg void OnMenuSenttoFriendEleven();
  171. afx_msg void OnMenuSenttoFriendFifteen();
  172. afx_msg void OnMenuSenttoFriendFive();
  173. afx_msg void OnMenuSenttoFriendFore();
  174. afx_msg void OnMenuSenttoFriendForeteen();
  175. afx_msg void OnMenuSenttoFriendNine();
  176. afx_msg void OnMenuSenttoFriendSeven();
  177. afx_msg void OnMenuSenttoFriendSix();
  178. afx_msg void OnMenuSenttoFriendTen();
  179. afx_msg void OnMenuSenttoFriendThirteen();
  180. afx_msg void OnMenuSenttoFriendThree();
  181. afx_msg void OnMenuSenttoFriendTwelve();
  182. afx_msg void OnMenuSenttoFriendTwo();
  183. afx_msg void OnMenuSenttoFriendone();
  184. afx_msg void OnMenuSenttoPromptforip();
  185. afx_msg void OnMenuGroupsMovetogroup();
  186. afx_msg void OnMenuPasteplaintextonly();
  187. afx_msg void OnMenuHelp();
  188. afx_msg void OnMenuQuickoptionsFont();
  189. afx_msg void OnMenuQuickoptionsShowthumbnails();
  190. afx_msg void OnMenuQuickoptionsDrawrtftext();
  191. afx_msg void OnMenuQuickoptionsPasteclipafterselection();
  192. afx_msg void OnSearchEditChange();
  193. afx_msg void OnMenuQuickoptionsFindasyoutype();
  194. afx_msg void OnMenuQuickoptionsEnsureentirewindowisvisible();
  195. afx_msg void OnMenuQuickoptionsShowclipsthatareingroupsinmainlist();
  196. afx_msg void OnMenuPastehtmlasplaintext();
  197. afx_msg void OnPromptToDeleteClip();
  198. afx_msg void OnUpdateMenuNewgroup(CCmdUI* pCmdUI);
  199. afx_msg void OnUpdateMenuNewgroupselection(CCmdUI* pCmdUI);
  200. afx_msg void OnUpdateMenuAllwaysontop(CCmdUI* pCmdUI);
  201. afx_msg void OnUpdateMenuViewfulldescription(CCmdUI* pCmdUI);
  202. afx_msg void OnUpdateMenuViewgroups(CCmdUI* pCmdUI);
  203. afx_msg void OnUpdateMenuPasteplaintextonly(CCmdUI* pCmdUI);
  204. afx_msg void OnUpdateMenuDelete(CCmdUI* pCmdUI);
  205. afx_msg void OnUpdateMenuProperties(CCmdUI* pCmdUI);
  206. afx_msg void OnDestroy();
  207. afx_msg LRESULT OnListSelect(WPARAM wParam, LPARAM lParam);
  208. afx_msg LRESULT OnListEnd(WPARAM wParam, LPARAM lParam);
  209. afx_msg LRESULT OnSearch(WPARAM wParam, LPARAM lParam);
  210. afx_msg LRESULT OnDelete(WPARAM wParam, LPARAM lParam);
  211. afx_msg LRESULT OnProperties(WPARAM wParam, LPARAM lParam);
  212. afx_msg void OnGetToolTipText(NMHDR* pNMHDR, LRESULT* pResult);
  213. afx_msg LRESULT OnListSelect_DB_ID(WPARAM wParam, LPARAM lParam);
  214. afx_msg LRESULT OnListSelect_Index(WPARAM wParam, LPARAM lParam);
  215. afx_msg LRESULT OnRefreshView(WPARAM wParam, LPARAM lParam);
  216. afx_msg LRESULT OnGroupTreeMessage(WPARAM wParam, LPARAM lParam);
  217. afx_msg LRESULT OnFillRestOfList(WPARAM wParam, LPARAM lParam);
  218. afx_msg LRESULT OnRefeshVisibleRows(WPARAM wParam, LPARAM lParam);
  219. afx_msg LRESULT OnSetListCount(WPARAM wParam, LPARAM lParam);
  220. afx_msg HBRUSH CtlColor(CDC* pDC, UINT nCtlColor) ;
  221. afx_msg void OnNcLButtonDblClk(UINT nHitTest, CPoint point);
  222. afx_msg void OnWindowPosChanging(WINDOWPOS* lpwndpos);
  223. afx_msg void OnViewcaptionbaronRight();
  224. afx_msg void OnViewcaptionbaronBottom();
  225. afx_msg void OnViewcaptionbaronLeft();
  226. afx_msg void OnViewcaptionbaronTop();
  227. afx_msg void OnMenuAutohide();
  228. afx_msg void OnMenuViewfulldescription();
  229. afx_msg void OnMenuAllwaysontop();
  230. afx_msg void OnSortAscending();
  231. afx_msg void OnSortDescending();
  232. afx_msg void OnMenuNewGroup();
  233. afx_msg void OnMenuNewGroupSelection();
  234. afx_msg void OnBackButton();
  235. afx_msg LRESULT OnUpDown(WPARAM wParam, LPARAM lParam);
  236. afx_msg LRESULT OnItemDeleted(WPARAM wParam, LPARAM lParam);
  237. LRESULT OnToolTipWndInactive(WPARAM wParam, LPARAM lParam);
  238. afx_msg void OnTimer(UINT_PTR nIDEvent);
  239. afx_msg void OnMenuExport();
  240. afx_msg void OnMenuImport();
  241. afx_msg void OnQuickpropertiesRemovequickpaste();
  242. afx_msg void OnMenuEdititem();
  243. afx_msg void OnMenuNewclip();
  244. afx_msg void OnUpdateMenuEdititem(CCmdUI *pCmdUI);
  245. afx_msg void OnUpdateMenuNewclip(CCmdUI *pCmdUI);
  246. afx_msg void CQPasteWnd::OnAddinSelect(UINT id);
  247. //}}AFX_MSG
  248. };
  249. /////////////////////////////////////////////////////////////////////////////
  250. //{{AFX_INSERT_LOCATION}}
  251. // Microsoft Visual C++ will insert additional declarations immediately before the previous line.
  252. #endif // !defined(AFX_QPASTEWND_H__65261F0F_FEFD_48CF_A0CD_01D8BFEB353B__INCLUDED_)