Index: src/ch/ch.h =================================================================== diff -u -ra27d1acf1bda3c25b6dcce0d0eb0278009ce63ae -rb556d023b748dfea230575959b6513acf29fd7b3 --- src/ch/ch.h (.../ch.h) (revision a27d1acf1bda3c25b6dcce0d0eb0278009ce63ae) +++ src/ch/ch.h (.../ch.h) (revision b556d023b748dfea230575959b6513acf29fd7b3) @@ -19,39 +19,38 @@ #ifndef __COPYHANDLER_H__ #define __COPYHANDLER_H__ -#include "resource.h" // main symbols #include "AppHelper.h" -#include "CfgProperties.h" #include "../libictranslate/ResourceManager.h" #include "../libchcore/TConfig.h" #include "TShellExtensionClient.h" #include "TCommandLineParser.h" +#include "../liblogger/TLogger.h" +#include "../libchcore/TCoreEngine.h" +#include "TShellExtensionConfig.h" -///////////////////////////////////////////////////////////////////////////// -// CCopyHandlerApp: -// See CopyHandler.cpp for the implementation of this class -// - class CCopyHandlerApp : public CWinApp, public CAppHelper { public: CCopyHandlerApp(); ~CCopyHandlerApp(); - virtual BOOL InitInstance(); - virtual int ExitInstance(); + virtual BOOL InitInstance() override; + virtual int ExitInstance() override; - virtual void HtmlHelp(DWORD_PTR dwData, UINT nCmd); + virtual void HtmlHelp(DWORD_PTR dwData, UINT nCmd) override; PCTSTR GetHelpPath() const { return m_pszHelpFilePath; }; friend int MsgBox(UINT uiID, UINT nType=MB_OK, UINT nIDHelp=0); - friend LRESULT MainRouter(ULONGLONG ullDst, UINT uiMsg, WPARAM wParam, LPARAM lParam); - friend CCopyHandlerApp& GetApp(); - friend ictranslate::CResourceManager& GetResManager(); - friend chcore::TConfig& GetConfig(); + friend CCopyHandlerApp& GetApplication(); + static ictranslate::CResourceManager& GetResManager(); + static chcore::TConfig& GetConfig(); + logger::TLogFileDataPtr GetLogFileData() const; + logger::TMultiLoggerConfigPtr GetEngineLoggerConfig() const; + TShellExtensionConfigPtr GetShellExtensionConfig() const; + void RegisterShellExtension(); void UnregisterShellExtension(); @@ -68,12 +67,50 @@ bool ParseCommandLine(); protected: - TShellExtensionClient m_tShellExtClient; + logger::TMultiLoggerConfigPtr m_spAppLoggerConfig; + logger::TMultiLoggerConfigPtr m_spEngineLoggerConfig; + + logger::TLoggerPtr m_spLog; + TCommandLineParser m_cmdLineParser; + chcore::TCoreEngine m_chEngine; + + TShellExtensionConfigPtr m_shellExtConfig; + TShellExtensionClient m_tShellExtClient; + CWnd *m_pMainWindow; + bool m_bComInitialized = false; DECLARE_MESSAGE_MAP() + +private: + void InitLoggers(); }; +inline CCopyHandlerApp& GetApp() +{ + return GetApplication(); +} + +inline logger::TLogFileDataPtr GetLogFileData() +{ + return GetApp().GetLogFileData(); +} + +inline ictranslate::CResourceManager& GetResManager() +{ + return CCopyHandlerApp::GetResManager(); +} + +inline chcore::TConfig& GetConfig() +{ + return CCopyHandlerApp::GetConfig(); +} + +inline TShellExtensionConfigPtr GetShellExtensionConfig() +{ + return GetApp().GetShellExtensionConfig(); +} + #endif