QPasteWnd.h 10 KB

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