diff options
author | George Hazan <ghazan@miranda.im> | 2018-01-26 22:31:20 +0300 |
---|---|---|
committer | George Hazan <ghazan@miranda.im> | 2018-01-26 22:31:27 +0300 |
commit | 391980ce1e890445542441eeb5d9f9cc18ae1baf (patch) | |
tree | ee1b165175dcdaeeaabd2ddb822542e648663a90 /plugins/TabSRMM/src | |
parent | bf8ad124d03b4fd059318d9ba8889b11faaf5b53 (diff) |
code optimization
Diffstat (limited to 'plugins/TabSRMM/src')
-rw-r--r-- | plugins/TabSRMM/src/chat_main.cpp | 6 | ||||
-rw-r--r-- | plugins/TabSRMM/src/chat_options.cpp | 32 | ||||
-rw-r--r-- | plugins/TabSRMM/src/chat_window.cpp | 18 | ||||
-rw-r--r-- | plugins/TabSRMM/src/hotkeyhandler.cpp | 4 | ||||
-rw-r--r-- | plugins/TabSRMM/src/msgdialog.cpp | 22 | ||||
-rw-r--r-- | plugins/TabSRMM/src/msgdlgutils.cpp | 4 | ||||
-rw-r--r-- | plugins/TabSRMM/src/msgoptions.cpp | 4 | ||||
-rw-r--r-- | plugins/TabSRMM/src/msgs.cpp | 27 | ||||
-rw-r--r-- | plugins/TabSRMM/src/tabctrl.cpp | 6 | ||||
-rw-r--r-- | plugins/TabSRMM/src/themeio.cpp | 27 | ||||
-rw-r--r-- | plugins/TabSRMM/src/themes.cpp | 6 | ||||
-rw-r--r-- | plugins/TabSRMM/src/typingnotify.cpp | 14 |
12 files changed, 81 insertions, 89 deletions
diff --git a/plugins/TabSRMM/src/chat_main.cpp b/plugins/TabSRMM/src/chat_main.cpp index 532984439f..c3fe689df4 100644 --- a/plugins/TabSRMM/src/chat_main.cpp +++ b/plugins/TabSRMM/src/chat_main.cpp @@ -253,9 +253,9 @@ int Chat_Unload(void) if (g_Settings.SelectionBGBrush)
DeleteObject(g_Settings.SelectionBGBrush);
- for (int i = 0; i < _countof(g_Settings.UserListFonts); i++)
- if (g_Settings.UserListFonts[i])
- DeleteObject(g_Settings.UserListFonts[i]);
+ for (auto &it : g_Settings.UserListFonts)
+ if (it)
+ DeleteObject(it);
delete g_Settings.Highlight;
return 0;
diff --git a/plugins/TabSRMM/src/chat_options.cpp b/plugins/TabSRMM/src/chat_options.cpp index 9d522e9382..ad7c49b08a 100644 --- a/plugins/TabSRMM/src/chat_options.cpp +++ b/plugins/TabSRMM/src/chat_options.cpp @@ -601,30 +601,30 @@ void RegisterFontServiceFonts() strncpy(fid.dbSettingsGroup, FONTMODULE, _countof(fid.dbSettingsGroup));
strncpy(cid.dbSettingsGroup, FONTMODULE, _countof(fid.dbSettingsGroup));
- for (int i = 0; i < _countof(_clrs); i++) {
- cid.order = _clrs[i].order;
- wcsncpy(cid.group, _clrs[i].tszGroup, _countof(fid.group));
- wcsncpy(cid.name, _clrs[i].tszName, _countof(cid.name));
- strncpy(cid.setting, _clrs[i].szSetting, _countof(cid.setting));
- if (_clrs[i].def & 0xff000000)
- cid.defcolour = GetSysColor(_clrs[i].def & 0x000000ff);
+ for (auto &it : _clrs) {
+ cid.order = it.order;
+ wcsncpy(cid.group, it.tszGroup, _countof(fid.group));
+ wcsncpy(cid.name, it.tszName, _countof(cid.name));
+ strncpy(cid.setting, it.szSetting, _countof(cid.setting));
+ if (it.def & 0xff000000)
+ cid.defcolour = GetSysColor(it.def & 0x000000ff);
else
- cid.defcolour = _clrs[i].def;
+ cid.defcolour = it.def;
Colour_RegisterW(&cid);
}
strncpy(cid.dbSettingsGroup, SRMSGMOD_T, _countof(fid.dbSettingsGroup));
// text and background colors for tabs
- for (int i = 0; i < _countof(_tabclrs); i++) {
- cid.order = _tabclrs[i].order;
- wcsncpy(cid.group, _tabclrs[i].tszGroup, _countof(fid.group));
- wcsncpy(cid.name, _tabclrs[i].tszName, _countof(cid.name));
- strncpy(cid.setting, _tabclrs[i].szSetting, _countof(cid.setting));
- if (_tabclrs[i].def & 0xff000000)
- cid.defcolour = GetSysColor(_tabclrs[i].def & 0x000000ff);
+ for (auto &it : _tabclrs) {
+ cid.order = it.order;
+ wcsncpy(cid.group, it.tszGroup, _countof(fid.group));
+ wcsncpy(cid.name, it.tszName, _countof(cid.name));
+ strncpy(cid.setting, it.szSetting, _countof(cid.setting));
+ if (it.def & 0xff000000)
+ cid.defcolour = GetSysColor(it.def & 0x000000ff);
else
- cid.defcolour = _tabclrs[i].def;
+ cid.defcolour = it.def;
Colour_RegisterW(&cid);
}
diff --git a/plugins/TabSRMM/src/chat_window.cpp b/plugins/TabSRMM/src/chat_window.cpp index 89fcf34b19..d7a9cb4cf2 100644 --- a/plugins/TabSRMM/src/chat_window.cpp +++ b/plugins/TabSRMM/src/chat_window.cpp @@ -1595,10 +1595,10 @@ INT_PTR CALLBACK CChatRoomDlg::FilterWndProc(HWND hwndDlg, UINT uMsg, WPARAM wPa int iFlags = 0, i; DWORD dwMask = 0; - for (i = 0; i < _countof(_eventorder); i++) { + for (auto &it : _eventorder) { int result = IsDlgButtonChecked(hwndDlg, IDC_1 + i); - dwMask |= (result != BST_INDETERMINATE ? _eventorder[i] : 0); - iFlags |= (result == BST_CHECKED ? _eventorder[i] : 0); + dwMask |= (result != BST_INDETERMINATE ? it : 0); + iFlags |= (result == BST_CHECKED ? it : 0); } if (iFlags & GC_EVENT_ADDSTATUS) @@ -1617,10 +1617,10 @@ INT_PTR CALLBACK CChatRoomDlg::FilterWndProc(HWND hwndDlg, UINT uMsg, WPARAM wPa dwMask = iFlags = 0; - for (i = 0; i < _countof(_eventorder); i++) { + for (auto &it : _eventorder) { int result = IsDlgButtonChecked(hwndDlg, IDC_P1 + i); - dwMask |= (result != BST_INDETERMINATE ? _eventorder[i] : 0); - iFlags |= (result == BST_CHECKED ? _eventorder[i] : 0); + dwMask |= (result != BST_INDETERMINATE ? it : 0); + iFlags |= (result == BST_CHECKED ? it : 0); } if (iFlags & GC_EVENT_ADDSTATUS) @@ -1639,10 +1639,10 @@ INT_PTR CALLBACK CChatRoomDlg::FilterWndProc(HWND hwndDlg, UINT uMsg, WPARAM wPa dwMask = iFlags = 0; - for (i = 0; i < _countof(_eventorder); i++) { + for (auto &it : _eventorder) { int result = IsDlgButtonChecked(hwndDlg, IDC_T1 + i); - dwMask |= (result != BST_INDETERMINATE ? _eventorder[i] : 0); - iFlags |= (result == BST_CHECKED ? _eventorder[i] : 0); + dwMask |= (result != BST_INDETERMINATE ? it : 0); + iFlags |= (result == BST_CHECKED ? it : 0); } if (iFlags & GC_EVENT_ADDSTATUS) iFlags |= GC_EVENT_REMOVESTATUS; diff --git a/plugins/TabSRMM/src/hotkeyhandler.cpp b/plugins/TabSRMM/src/hotkeyhandler.cpp index 7f20c84d5c..b53ec868d1 100644 --- a/plugins/TabSRMM/src/hotkeyhandler.cpp +++ b/plugins/TabSRMM/src/hotkeyhandler.cpp @@ -132,8 +132,8 @@ LONG_PTR CALLBACK HotkeyHandlerDlgProc(HWND hwndDlg, UINT msg, WPARAM wParam, LP switch (msg) {
case WM_CREATE:
- for (int i = 0; i < _countof(_hotkeydescs); i++)
- Hotkey_Register(&_hotkeydescs[i]);
+ for (auto &it : _hotkeydescs)
+ Hotkey_Register(&it);
WM_TASKBARCREATED = RegisterWindowMessageA("TaskbarCreated");
ShowWindow(hwndDlg, SW_HIDE);
diff --git a/plugins/TabSRMM/src/msgdialog.cpp b/plugins/TabSRMM/src/msgdialog.cpp index aec44485c5..b7aad94078 100644 --- a/plugins/TabSRMM/src/msgdialog.cpp +++ b/plugins/TabSRMM/src/msgdialog.cpp @@ -636,8 +636,8 @@ void CSrmmWindow::OnInitDialog() }
else m_wStatus = ID_STATUS_OFFLINE;
- for (int i = 0; i < _countof(btnControls); i++)
- CustomizeButton(GetDlgItem(m_hwnd, btnControls[i]));
+ for (auto &it : btnControls)
+ CustomizeButton(GetDlgItem(m_hwnd, it));
GetMYUIN();
GetClientIcon();
@@ -721,8 +721,8 @@ void CSrmmWindow::OnInitDialog() NotifyEvent(MSG_WINDOW_EVT_OPENING);
- for (int i = 0; i < _countof(tooltips); i++)
- SendDlgItemMessage(m_hwnd, tooltips[i].id, BUTTONADDTOOLTIP, (WPARAM)TranslateW(tooltips[i].text), BATF_UNICODE);
+ for (auto &it : tooltips)
+ SendDlgItemMessage(m_hwnd, it.id, BUTTONADDTOOLTIP, (WPARAM)TranslateW(it.text), BATF_UNICODE);
SetDlgItemText(m_hwnd, IDC_LOGFROZENTEXT, m_bNotOnList ? TranslateT("Contact not on list. You may add it...") :
TranslateT("Auto scrolling is disabled (press F12 to enable it)"));
@@ -733,10 +733,10 @@ void CSrmmWindow::OnInitDialog() SetDlgItemText(m_hwnd, IDC_RETRY, TranslateT("Retry"));
{
UINT _ctrls[] = { IDC_RETRY, IDC_CANCELSEND, IDC_MSGSENDLATER };
- for (int i = 0; i < _countof(_ctrls); i++) {
- SendDlgItemMessage(m_hwnd, _ctrls[i], BUTTONSETASPUSHBTN, TRUE, 0);
- SendDlgItemMessage(m_hwnd, _ctrls[i], BUTTONSETASFLATBTN, FALSE, 0);
- SendDlgItemMessage(m_hwnd, _ctrls[i], BUTTONSETASTHEMEDBTN, TRUE, 0);
+ for (auto &it : _ctrls) {
+ SendDlgItemMessage(m_hwnd, it, BUTTONSETASPUSHBTN, TRUE, 0);
+ SendDlgItemMessage(m_hwnd, it, BUTTONSETASFLATBTN, FALSE, 0);
+ SendDlgItemMessage(m_hwnd, it, BUTTONSETASTHEMEDBTN, TRUE, 0);
}
}
@@ -2443,9 +2443,9 @@ INT_PTR CSrmmWindow::DlgProc(UINT uMsg, WPARAM wParam, LPARAM lParam) return 0;
case WM_CBD_LOADICONS:
- for (int i = 0; i < _countof(buttonicons); i++) {
- SendDlgItemMessage(m_hwnd, buttonicons[i].id, BM_SETIMAGE, IMAGE_ICON, (LPARAM)*buttonicons[i].pIcon);
- SendDlgItemMessage(m_hwnd, buttonicons[i].id, BUTTONSETCONTAINER, (LPARAM)m_pContainer, 0);
+ for (auto &it : buttonicons) {
+ SendDlgItemMessage(m_hwnd, it.id, BM_SETIMAGE, IMAGE_ICON, (LPARAM)*it.pIcon);
+ SendDlgItemMessage(m_hwnd, it.id, BUTTONSETCONTAINER, (LPARAM)m_pContainer, 0);
}
Srmm_UpdateToolbarIcons(m_hwnd);
diff --git a/plugins/TabSRMM/src/msgdlgutils.cpp b/plugins/TabSRMM/src/msgdlgutils.cpp index 76cc3fbb1f..8635b41daf 100644 --- a/plugins/TabSRMM/src/msgdlgutils.cpp +++ b/plugins/TabSRMM/src/msgdlgutils.cpp @@ -1238,8 +1238,8 @@ void CTabBaseDlg::GetSendFormat() else if (m_SendFormat == 0)
m_SendFormat = PluginConfig.m_SendFormat ? 1 : 0;
- for (int i = 0; i < _countof(controls); i++)
- Utils::enableDlgControl(m_hwnd, controls[i], m_SendFormat != 0);
+ for (auto &it : controls)
+ Utils::enableDlgControl(m_hwnd, it, m_SendFormat != 0);
return;
}
diff --git a/plugins/TabSRMM/src/msgoptions.cpp b/plugins/TabSRMM/src/msgoptions.cpp index 5f32b2bd90..8d1760ac6b 100644 --- a/plugins/TabSRMM/src/msgoptions.cpp +++ b/plugins/TabSRMM/src/msgoptions.cpp @@ -666,8 +666,8 @@ class COptLogDlg : public CDlgBase Utils::showDlgControl(m_hwnd, IDC_EXPLAINMSGLOGSETTINGS, r == 0 ? SW_HIDE : SW_SHOW);
Utils::showDlgControl(m_hwnd, IDC_LOGOPTIONS, r == 0 ? SW_SHOW : SW_HIDE);
- for (int i = 0; i < _countof(__ctrls); i++)
- Utils::enableDlgControl(m_hwnd, __ctrls[i], r == 0);
+ for (auto &it : __ctrls)
+ Utils::enableDlgControl(m_hwnd, it, r == 0);
}
public:
diff --git a/plugins/TabSRMM/src/msgs.cpp b/plugins/TabSRMM/src/msgs.cpp index 416c2a1641..57a8b76483 100644 --- a/plugins/TabSRMM/src/msgs.cpp +++ b/plugins/TabSRMM/src/msgs.cpp @@ -879,11 +879,12 @@ static int TSAPI SetupIconLibConfig() sid.flags = SIDF_PATH_UNICODE;
for (int n = 0; n < _countof(ICONBLOCKS); n++) {
- sid.section.a = ICONBLOCKS[n].szSection;
- for (int i = 0; i < ICONBLOCKS[n].nItems; i++) {
- sid.pszName = ICONBLOCKS[n].idesc[i].szName;
- sid.description.a = ICONBLOCKS[n].idesc[i].szDesc;
- sid.iDefaultIndex = ICONBLOCKS[n].idesc[i].uId == -IDI_HISTORY ? 0 : ICONBLOCKS[n].idesc[i].uId; // workaround problem /w icoLib and a resource id of 1 (actually, a Windows problem)
+ auto &it = ICONBLOCKS[n];
+ sid.section.a = it.szSection;
+ for (int i = 0; i < it.nItems; i++) {
+ sid.pszName = it.idesc[i].szName;
+ sid.description.a = it.idesc[i].szDesc;
+ sid.iDefaultIndex = it.idesc[i].uId == -IDI_HISTORY ? 0 : it.idesc[i].uId; // workaround problem /w icoLib and a resource id of 1 (actually, a Windows problem)
if (n > 0 && n < 4)
PluginConfig.g_buttonBarIconHandles[j++] = IcoLib_AddIcon(&sid);
@@ -927,9 +928,9 @@ static int TSAPI SetupIconLibConfig() // load the icon theme from IconLib - check if it exists...
static int TSAPI LoadFromIconLib()
{
- for (int n = 0; n < _countof(ICONBLOCKS); n++)
- for (int i = 0; i < ICONBLOCKS[n].nItems; i++)
- *(ICONBLOCKS[n].idesc[i].phIcon) = IcoLib_GetIcon(ICONBLOCKS[n].idesc[i].szName);
+ for (auto &it : ICONBLOCKS)
+ for (int i = 0; i < it.nItems; i++)
+ *(it.idesc[i].phIcon) = IcoLib_GetIcon(it.idesc[i].szName);
PluginConfig.g_buttonBarIcons[0] = Skin_LoadIcon(SKINICON_OTHER_ADDCONTACT);
PluginConfig.g_buttonBarIcons[1] = Skin_LoadIcon(SKINICON_OTHER_HISTORY);
@@ -969,11 +970,11 @@ void TSAPI LoadIconTheme() static void UnloadIcons()
{
- for (int n = 0; n < _countof(ICONBLOCKS); n++)
- for (int i = 0; i < ICONBLOCKS[n].nItems; i++)
- if (*(ICONBLOCKS[n].idesc[i].phIcon) != nullptr) {
- DestroyIcon(*(ICONBLOCKS[n].idesc[i].phIcon));
- *(ICONBLOCKS[n].idesc[i].phIcon) = nullptr;
+ for (auto &it : ICONBLOCKS)
+ for (int i = 0; i < it.nItems; i++)
+ if (*(it.idesc[i].phIcon) != nullptr) {
+ DestroyIcon(*(it.idesc[i].phIcon));
+ *(it.idesc[i].phIcon) = nullptr;
}
if (PluginConfig.g_hbmUnknown)
diff --git a/plugins/TabSRMM/src/tabctrl.cpp b/plugins/TabSRMM/src/tabctrl.cpp index 49c4add36a..ca27b71ce8 100644 --- a/plugins/TabSRMM/src/tabctrl.cpp +++ b/plugins/TabSRMM/src/tabctrl.cpp @@ -1348,9 +1348,9 @@ void TSAPI FreeTabConfig() if (PluginConfig.tabConfig.m_hMenuFont)
DeleteObject(PluginConfig.tabConfig.m_hMenuFont);
- for (int i = 0; i < _countof(PluginConfig.tabConfig.m_brushes); i++)
- if (PluginConfig.tabConfig.m_brushes[i])
- DeleteObject(PluginConfig.tabConfig.m_brushes[i]);
+ for (auto &it : PluginConfig.tabConfig.m_brushes)
+ if (it)
+ DeleteObject(it);
memset(&PluginConfig.tabConfig, 0, sizeof(PluginConfig.tabConfig));
}
diff --git a/plugins/TabSRMM/src/themeio.cpp b/plugins/TabSRMM/src/themeio.cpp index 674c9bf512..5916d9f7cb 100644 --- a/plugins/TabSRMM/src/themeio.cpp +++ b/plugins/TabSRMM/src/themeio.cpp @@ -211,15 +211,11 @@ void TSAPI WriteThemeToINI(const wchar_t *szIniFilenameT, CSrmmWindow *dat) }
def = SRMSGDEFSET_BKGCOLOUR;
- for (i = 0; i < _countof(_extSettings); i++) {
- auto &p = _extSettings[i];
- WritePrivateProfileStringA(p.szIniSection, p.szIniName, _itoa(M.GetDword(p.szDbModule, p.szDbSetting, p.dwDef), szBuf, 10), szIniFilename);
- }
+ for (auto &it : _extSettings)
+ WritePrivateProfileStringA(it.szIniSection, it.szIniName, _itoa(M.GetDword(it.szDbModule, it.szDbSetting, it.dwDef), szBuf, 10), szIniFilename);
- for (i = 0; i < _countof(_extSettings_v5); i++) {
- auto &p = _extSettings_v5[i];
- WritePrivateProfileStringA(p.szIniSection, p.szIniName, _itoa(M.GetDword(p.szDbModule, p.szDbSetting, p.dwDef), szBuf, 10), szIniFilename);
- }
+ for (auto &it : _extSettings_v5)
+ WritePrivateProfileStringA(it.szIniSection, it.szIniName, _itoa(M.GetDword(it.szDbModule, it.szDbSetting, it.dwDef), szBuf, 10), szIniFilename);
WritePrivateProfileStringA("Message Log", "VGrid", _itoa(M.GetByte("wantvgrid", 0), szBuf, 10), szIniFilename);
WritePrivateProfileStringA("Message Log", "ExtraMicroLF", _itoa(M.GetByte("extramicrolf", 0), szBuf, 10), szIniFilename);
@@ -307,17 +303,12 @@ void TSAPI ReadThemeFromINI(const wchar_t *szIniFilenameT, TContainerData *dat, if (dwFlags & THEME_READ_FONTS) {
COLORREF defclr;
- for (i = 0; i < _countof(_extSettings); i++) {
- db_set_dw(0, _extSettings[i].szDbModule, _extSettings[i].szDbSetting,
- GetPrivateProfileIntA(_extSettings[i].szIniSection, _extSettings[i].szIniName, _extSettings[i].dwDef, szIniFilename));
- }
+ for (auto &it : _extSettings)
+ db_set_dw(0, it.szDbModule, it.szDbSetting, GetPrivateProfileIntA(it.szIniSection, it.szIniName, it.dwDef, szIniFilename));
- if (version >= 5) {
- for (i = 0; i < _countof(_extSettings_v5); i++) {
- db_set_dw(0, _extSettings_v5[i].szDbModule, _extSettings_v5[i].szDbSetting,
- GetPrivateProfileIntA(_extSettings_v5[i].szIniSection, _extSettings_v5[i].szIniName, _extSettings_v5[i].dwDef, szIniFilename));
- }
- }
+ if (version >= 5)
+ for (auto &it : _extSettings_v5)
+ db_set_dw(0, it.szDbModule, it.szDbSetting, GetPrivateProfileIntA(it.szIniSection, it.szIniName, it.dwDef, szIniFilename));
db_set_b(0, SRMSGMOD_T, "wantvgrid", (BYTE)(GetPrivateProfileIntA("Message Log", "VGrid", 0, szIniFilename)));
db_set_b(0, SRMSGMOD_T, "extramicrolf", (BYTE)(GetPrivateProfileIntA("Message Log", "ExtraMicroLF", 0, szIniFilename)));
diff --git a/plugins/TabSRMM/src/themes.cpp b/plugins/TabSRMM/src/themes.cpp index 1b58c8715d..1ef9533f8e 100644 --- a/plugins/TabSRMM/src/themes.cpp +++ b/plugins/TabSRMM/src/themes.cpp @@ -753,7 +753,6 @@ static struct void CImageItem::Create(const wchar_t *szImageFile)
{
HBITMAP hbm = Bitmap_Load(szImageFile);
- BITMAP bm;
m_hdc = nullptr;
m_hbmOld = nullptr;
@@ -765,6 +764,7 @@ void CImageItem::Create(const wchar_t *szImageFile) m_bf.BlendOp = AC_SRC_OVER;
m_bf.AlphaFormat = 0;
+ BITMAP bm;
GetObject(hbm, sizeof(bm), &bm);
if (bm.bmBitsPixel == 32 && m_dwFlags & IMAGE_PERPIXEL_ALPHA) {
CImageItem::PreMultiply(m_hbm, 1);
@@ -2428,8 +2428,8 @@ void CSkin::extractSkinsAndLogo(bool fForceOverwrite) const m_fAeroSkinsValid = true;
- for (int i = 0; i < _countof(my_default_skin); i++)
- if (!Utils::extractResource(g_hInst, my_default_skin[i].ulID, L"SKIN_GLYPH", tszBasePath, my_default_skin[i].tszName, fForceOverwrite))
+ for (auto &it : my_default_skin)
+ if (!Utils::extractResource(g_hInst, it.ulID, L"SKIN_GLYPH", tszBasePath, it.tszName, fForceOverwrite))
m_fAeroSkinsValid = false;
}
diff --git a/plugins/TabSRMM/src/typingnotify.cpp b/plugins/TabSRMM/src/typingnotify.cpp index 148505f51b..1f5d6f7d8a 100644 --- a/plugins/TabSRMM/src/typingnotify.cpp +++ b/plugins/TabSRMM/src/typingnotify.cpp @@ -191,9 +191,9 @@ static INT_PTR CALLBACK DlgProcOpts(HWND hwndDlg, UINT msg, WPARAM wParam, LPARA CheckDlgButton(hwndDlg, IDC_USEPOPUPCOLORS, BST_CHECKED);
}
- for (int i = 0; i < _countof(colorPicker); i++) {
- SendDlgItemMessage(hwndDlg, colorPicker[i].res, CPM_SETCOLOUR, 0, colorPicker[i].color);
- Utils::enableDlgControl(hwndDlg, colorPicker[i].res, (ColorMode == COLOR_OWN));
+ for (auto &it : colorPicker) {
+ SendDlgItemMessage(hwndDlg, it.res, CPM_SETCOLOUR, 0, it.color);
+ Utils::enableDlgControl(hwndDlg, it.res, (ColorMode == COLOR_OWN));
}
CheckDlgButton(hwndDlg, IDC_TIMEOUT_PERMANENT, (TimeoutMode == TIMEOUT_PERMANENT) ? BST_CHECKED : BST_UNCHECKED);
@@ -248,8 +248,8 @@ static INT_PTR CALLBACK DlgProcOpts(HWND hwndDlg, UINT msg, WPARAM wParam, LPARA bEnableOthers = true;
}
- for (int i = 0; i < _countof(colorPicker); i++)
- Utils::enableDlgControl(hwndDlg, colorPicker[i].res, bEnableOthers);
+ for (auto &it : colorPicker)
+ Utils::enableDlgControl(hwndDlg, it.res, bEnableOthers);
Utils::enableDlgControl(hwndDlg, IDC_USEPOPUPCOLORS, bEnableOthers);
@@ -522,8 +522,8 @@ int TN_ModuleInit() Timeout2 = M.GetByte(TypigModule, SET_TIMEOUT2, DEF_TIMEOUT2);
if (!(M.GetDword(TypigModule, colorPicker[0].desc, 1) && !M.GetDword(TypigModule, colorPicker[0].desc, 0)))
- for (i = 0; i < _countof(colorPicker); i++)
- colorPicker[i].color = M.GetDword(TypigModule, colorPicker[i].desc, 0);
+ for (auto &it : colorPicker)
+ it.color = M.GetDword(TypigModule, it.desc, 0);
mir_snwprintf(szStart, TranslateT("...is typing a message."));
mir_snwprintf(szStop, TranslateT("...has stopped typing."));
|