-
Notifications
You must be signed in to change notification settings - Fork 172
/
Copy pathHelper.h
111 lines (95 loc) · 3.93 KB
/
Helper.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
/*
* Copyright (c) 2005-2018, BearWare.dk
*
* Contact Information:
*
* Bjoern D. Rasmussen
* Kirketoften 5
* DK-8260 Viby J
* Denmark
* Email: contact@bearware.dk
* Phone: +45 20 20 54 59
* Web: http://www.bearware.dk
*
* This source code is part of the TeamTalk SDK owned by
* BearWare.dk. Use of this file, or its compiled unit, requires a
* TeamTalk SDK License Key issued by BearWare.dk.
*
* The TeamTalk SDK License Agreement along with its Terms and
* Conditions are outlined in the file License.txt included with the
* TeamTalk SDK distribution.
*
*/
#if !defined(HELPER_H)
#define HELPER_H
#include "settings/ClientXML.h"
#if defined(ENABLE_TOLK)
#include <Tolk.h>
#endif
typedef struct
{
CString szFaceName;
int nSize;
BOOL bBold;
BOOL bItalic;
BOOL bUnderline;
} MyFont;
BOOL ConvertFont(const MyFont font, LOGFONT& destination);
BOOL FileExists(LPCTSTR szFileName);
CString GetExecutableFolder();
BOOL DirectoryExists(LPCTSTR szPath);
BOOL VersionSameOrLater(const CString& szCheck, const CString& szAgainst);
#if defined(UNICODE) || defined(_UNICODE)
//Unicode to UTF-8 conversion and back
CString STR_UTF8(LPCSTR str, int max_str_len = TT_STRLEN);
CString STR_UTF8(const std::string& str);
std::string STR_UTF8(LPCWSTR str, int max_str_len = TT_STRLEN);
std::string STR_LOCAL(LPCWSTR str, int max_str_len = TT_STRLEN);
void COPYSTR(LPWSTR lpTarget, LPCSTR lpSource, int nLength);
void COPYSTR(LPSTR lpTarget, LPCWSTR lpSource, int nLength);
#define COPYTTSTR(dst,src)\
do {\
_tcsncpy(dst, src, TT_STRLEN);\
} while(0)
#else
#define STR_UTF8
#define STR_LOCAL
#define COPYSTR strncpy
#endif
#define ZERO_STRUCT(a) memset(&a, 0, sizeof(a))
BOOL BrowseForFolder(HWND hwnd, LPCTSTR szCurrent, LPTSTR szPath);
void SetWindowNumber(CWnd& wnd, int nNumber);
int GetWindowNumber(CWnd& wnd);
void AddString(CComboBox& wnd, LPCTSTR szText, DWORD_PTR nItemData);
DWORD_PTR GetItemData(CComboBox& wnd, DWORD_PTR dwDefault);
void SetCurSelItemData(CComboBox& wnd, DWORD_PTR nItemData);
DWORD_PTR GetItemData(CListBox& wnd, DWORD_PTR dwDefault);
HTREEITEM GetItemDataItem(CTreeCtrl& wnd, DWORD_PTR dwItemData);
void PlayWaveFile(LPCTSTR szFilePath, BOOL bAsync);
CString LimitText(const CString& szName);
CString StripAmpersand(const CString& szText);
CString ExtractMenuText(int nID, CString szText);
CString LoadText(int nID, CString szInitial = _T(""));
void RemoveString(CStringList& strList, const CString& szStr);
void UpdateAllowTransmitMenuItem(int nUserID, const Channel& chan, StreamTypes uStreamType, CCmdUI *pCmdUI);
CString GetDisplayName(const User& user);
BOOL EndsWith(const CString& szText, LPCTSTR szEnd, BOOL bCaseSensitive = TRUE);
BOOL StartsWith(const CString& szText, LPCTSTR szStart, BOOL bCaseSensitive = TRUE);
BOOL IsWebLogin(const CString& szUsername); // Facebook or BearWare.dk
CString URLEncode(const CString& szText);
CString URLDecode(const CString& szUrlText);
CString GetLogTimeStamp();
CString GetLogFileName(LPCTSTR szFolder, LPCTSTR szName);
CString TrimForPath(LPCTSTR szPath);
BOOL OpenLogFile(CFile& file, LPCTSTR szFolder, LPCTSTR szName, CString& szLogFileName = CString());
void CloseLogFile(CFile& file);
void WriteLogMsg(CFile& file, LPCTSTR szMsg);
void SetAccessibleName(CWnd& wnd, LPCTSTR szHint);
int GetSoundInputDevice(teamtalk::ClientXML& xmlSettings, SoundDevice* pSoundDev = NULL);
int GetSoundOutputDevice(teamtalk::ClientXML& xmlSettings, SoundDevice* pSoundDev = NULL);
BOOL GetSoundDevice(int nSoundDeviceID, const CString& szDeviceID, BOOL bInput, SoundDevice& dev);
int GetSoundDuplexSampleRate(const SoundDevice& indev, const SoundDevice& outdev);
BOOL IsSoundDeviceEchoCapable(const SoundDevice& indev, const SoundDevice& outdev);
BOOL InitSoundSystem(teamtalk::ClientXML& xmlSettings, SoundDevice& indev, SoundDevice& outdev);
void AddTextToSpeechMessage(const CString& szMsg);
#endif