QPasteWnd.h 10 KB

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