CP_Main.h 3.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133
  1. // CP_Main.h : main header file for the CP_MAIN application
  2. //
  3. #if !defined(AFX_CP_MAIN_H__DAB2F753_2CC1_4FED_8095_763987961026__INCLUDED_)
  4. #define AFX_CP_MAIN_H__DAB2F753_2CC1_4FED_8095_763987961026__INCLUDED_
  5. #if _MSC_VER > 1000
  6. #pragma once
  7. #endif // _MSC_VER > 1000
  8. #ifndef __AFXWIN_H__
  9. #error include 'stdafx.h' before including this file for PCH
  10. #endif
  11. #include "resource.h" // main symbols
  12. #include "ProcessCopy.h"
  13. #include "DatabaseUtilities.h"
  14. #include "Misc.h"
  15. #include "DataTable.h"
  16. #include "MainTable.h"
  17. #include "TypesTable.h"
  18. #include "ArrayEx.h"
  19. #include "MainFrm.h"
  20. #define MAIN_WND_TITLE "Ditto MainWnd"
  21. //#define GET_APP ((CCP_MainApp *)AfxGetApp())
  22. //#define GET_APP ((CMainWnd*)theApp)
  23. extern class CCP_MainApp theApp;
  24. /////////////////////////////////////////////////////////////////////////////
  25. // CCP_MainApp:
  26. // See CP_Main.cpp for the implementation of this class
  27. //
  28. class CCP_MainApp : public CWinApp
  29. {
  30. public:
  31. CCP_MainApp();
  32. ~CCP_MainApp();
  33. HANDLE m_hMutex; // for singleton app
  34. // track stages of startup / shutdown
  35. bool m_bAppRunning;
  36. bool m_bAppExiting;
  37. // MainFrame
  38. HWND m_MainhWnd;
  39. CMainFrame* m_pMainFrame;
  40. void AfterMainCreate(); // called after main window creation
  41. void BeforeMainClose(); // called before main window close
  42. // System-wide HotKeys
  43. CHotKey* m_pDittoHotKey; // activate ditto's qpaste window
  44. CHotKey* m_pCopyHotKey; // named copy
  45. // Focus Tracking
  46. HWND m_hTargetWnd;
  47. // HWND m_hTargetFocus;
  48. HWND TargetActiveWindow(); // returns the previously targeted window
  49. bool ActivateTarget();
  50. bool ReleaseFocus(); // activate the target only if we are the foreground window
  51. CLIPFORMAT m_cfIgnoreClipboard; // used by CClip::LoadFromClipboard
  52. // CopyThread and ClipViewer (Copy and Paste Management)
  53. CCopyThread m_CopyThread;
  54. void StartCopyThread();
  55. void StopCopyThread();
  56. // for posting messages
  57. HWND GetClipboardViewer() { return m_CopyThread.m_pClipboardViewer->m_hWnd; }
  58. // enables or disables copying the clipboard when it changes
  59. bool EnableCbCopy(bool bState) { return m_CopyThread.SetCopyOnChange(bState); }
  60. bool IsClipboardViewerConnected() { return m_CopyThread.IsClipboardViewerConnected(); }
  61. // CClipList m_SaveClipQueue;
  62. // Retrieves all clips from CopyThread and Saves them.
  63. // returns the ID of the last Clip saved (or 0 if none)
  64. long SaveCopyClips();
  65. CClipTypes* LoadTypesFromDB(); // returns a "new" allocated object
  66. void ReloadTypes();
  67. void RefreshView(); // refreshes the view if it is visible
  68. void OnCopyCompleted( long lLastID, int count = 1 );
  69. void OnPasteCompleted();
  70. // Window States
  71. bool m_bShowingOptions;
  72. bool m_bShowingQuickPaste;
  73. CString m_Status;
  74. CQPasteWnd* QPasteWnd() { return m_pMainFrame->QuickPaste.m_pwndPaste; }
  75. void SetStatus( const char* status = NULL );
  76. void ShowPersistent( bool bVal );
  77. bool m_bShowCopyProperties;
  78. void ShowCopyProperties( long lID );
  79. bool m_bRemoveOldEntriesPending;
  80. void Delayed_RemoveOldEntries( UINT delay );
  81. // Database
  82. CDaoDatabase* m_pDatabase;
  83. CDaoDatabase* EnsureOpenDB(CString csName = "");
  84. BOOL CloseDB();
  85. // Overrides
  86. // ClassWizard generated virtual function overrides
  87. //{{AFX_VIRTUAL(CCP_MainApp)
  88. public:
  89. virtual BOOL InitInstance();
  90. virtual int ExitInstance();
  91. //}}AFX_VIRTUAL
  92. // Implementation
  93. //{{AFX_MSG(CCP_MainApp)
  94. afx_msg void OnAppAbout();
  95. // NOTE - the ClassWizard will add and remove member functions here.
  96. // DO NOT EDIT what you see in these blocks of generated code !
  97. //}}AFX_MSG
  98. DECLARE_MESSAGE_MAP()
  99. virtual BOOL OnIdle(LONG lCount);
  100. };
  101. /////////////////////////////////////////////////////////////////////////////
  102. //{{AFX_INSERT_LOCATION}}
  103. // Microsoft Visual C++ will insert additional declarations immediately before the previous line.
  104. #endif // !defined(AFX_CP_MAIN_H__DAB2F753_2CC1_4FED_8095_763987961026__INCLUDED_)