QPasteWnd.h 10 KB

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