Update Turkish translation
[dasher.git] / Src / Win32 / Dasher.h
blobfce443a4fecb65cef88efad210bda9f18d0ee394
1 #pragma once
3 #include "Common/wincommon.h"
4 #include "../DasherCore/DashIntfScreenMsgs.h"
5 #include "../DasherCore/UserLog.h"
7 #ifdef WIN32_SPEECH
8 #include <sapi.h>
9 #endif
11 #include <string>
12 #include <vector>
14 extern CONST UINT WM_DASHER_FOCUS;
16 class CCanvas;
17 class CEdit;
18 class CDasherWindow;
20 namespace Dasher {
21 class CWinFileUtils :public CFileUtils {
22 public:
23 virtual int GetFileSize(const std::string &strFileName) override;
24 virtual void ScanFiles(AbstractParser *parser, const std::string &strPattern) override;
25 bool WriteUserDataFile(const std::string &filename, const std::string &strNewText, bool append) override;
26 private:
27 void ScanDirectory(const std::string &strMask, std::vector<std::string> &vFileList);
28 // Returns location where program data is stored.
29 // When user is false, result is system data location.
30 // When user is true, result is user data data location.
31 virtual std::string GetDataPath(bool user);
35 class CDasher : public CDashIntfScreenMsgs
37 public:
38 CDasher(HWND Parent, CDasherWindow *pWindow, CEdit *pEdit, Dasher::CSettingsStore* settings, CFileUtils* fileUtils);
39 ~CDasher(void);
41 // The following functions will not be part of the final interface
42 // In order to get rid of this, it'll be necessary to make this class
43 // act more like a UI widget.
45 //CCanvas *GetCanvas() {
46 // return m_pCanvas;
47 //}
49 // TODO: Can some of these be obtained by inheriting from something?
50 void Move(int iX, int iY, int iWidth, int iHeight);
51 void TakeFocus();
53 void HandleEvent(int iParameter) override;
54 void editOutput(const std::string &strText, CDasherNode *pSource) override;
55 void editDelete(const std::string &strText, CDasherNode *pSource) override;
56 unsigned int ctrlOffsetAfterMove(unsigned int offsetBefore, bool bForwards, CControlManager::EditDistance iDist) override;
57 unsigned int ctrlMove(bool bForwards, CControlManager::EditDistance iDist) override;
58 unsigned int ctrlDelete(bool bForwards, CControlManager::EditDistance iDist) override;
60 void Main();
62 virtual std::string GetAllContext() override;
63 std::string GetContext(unsigned int iStart, unsigned int iLength) override;
64 int GetAllContextLenght() override;
65 std::string GetTextAroundCursor(CControlManager::EditDistance iDist) override;
67 #ifdef WIN32_SPEECH
68 bool SupportsSpeech() override;
69 void Speak(const std::string &text, bool bInterrupt) override;
70 #endif
71 bool SupportsClipboard() override { return true; };
72 void CopyToClipboard(const std::string &text) override;
74 private:
75 virtual void CreateModules() override;
77 void ScanDirectory(const Tstring &strMask, std::vector<std::string> &vFileList);
78 bool GetWindowSize(int* pTop, int* pLeft, int* pBottom, int* pRight);
79 void Log(); // Does the logging
81 CCanvas *m_pCanvas;
82 HWND m_hParent;
83 CDasherWindow *m_pWindow;
84 CEdit *m_pEdit;
85 #ifdef WIN32_SPEECH
86 ISpVoice* getVoice(const string& lang);
87 CComPtr<ISpVoice> m_pDefaultVoice;
88 bool m_bAttemptedSpeech;
89 map<string, CComPtr<ISpVoice> > m_voicesByLangCode;
90 #endif