From 81af1660759b655e0e65bf2f955ef50e87975a13 Mon Sep 17 00:00:00 2001 From: George Hazan Date: Sun, 30 Jul 2017 21:40:51 +0300 Subject: minor code cleaning --- plugins/DbEditorPP/src/main.cpp | 6 ++---- plugins/MenuItemEx/src/main.cpp | 3 +-- plugins/SmileyAdd/src/smileyroutines.cpp | 1 - plugins/TabSRMM/src/msgdialog.cpp | 7 +------ src/mir_app/src/hotkeys.cpp | 4 +--- src/mir_app/src/skin.h | 6 ++++-- 6 files changed, 9 insertions(+), 18 deletions(-) diff --git a/plugins/DbEditorPP/src/main.cpp b/plugins/DbEditorPP/src/main.cpp index 0ec3a08be8..fe31957c25 100644 --- a/plugins/DbEditorPP/src/main.cpp +++ b/plugins/DbEditorPP/src/main.cpp @@ -130,13 +130,11 @@ int ModulesLoaded(WPARAM, LPARAM) hUserMenu = Menu_AddContactMenuItem(&mi); // Register hotkeys - _A2T text(modFullname); HOTKEYDESC hkd = {}; - hkd.dwFlags = HKD_UNICODE; hkd.pszName = "hk_dbepp_open"; hkd.pszService = "DBEditorpp/MenuCommand"; - hkd.szDescription.w = LPGENW("Open Database Editor"); - hkd.szSection.w = text; + hkd.szSection.a = modFullname; + hkd.szDescription.a = LPGEN("Open Database Editor"); hkd.DefHotKey = HOTKEYCODE(HOTKEYF_SHIFT | HOTKEYF_EXT, 'D'); Hotkey_Register(&hkd); diff --git a/plugins/MenuItemEx/src/main.cpp b/plugins/MenuItemEx/src/main.cpp index c8534b46bb..2872e57272 100644 --- a/plugins/MenuItemEx/src/main.cpp +++ b/plugins/MenuItemEx/src/main.cpp @@ -908,8 +908,7 @@ static void TabsrmmButtonsModify(MCONTACT hContact) { if (!DirectoryExists(hContact)) { - BBButton bbd = { 0 }; - bbd.dwButtonID = 0; + BBButton bbd = {}; bbd.pszModuleName = MODULENAME; bbd.bbbFlags = BBSF_DISABLED | BBSF_HIDDEN; Srmm_SetButtonState(hContact, &bbd); diff --git a/plugins/SmileyAdd/src/smileyroutines.cpp b/plugins/SmileyAdd/src/smileyroutines.cpp index a56be87b9f..b893fca9fa 100644 --- a/plugins/SmileyAdd/src/smileyroutines.cpp +++ b/plugins/SmileyAdd/src/smileyroutines.cpp @@ -21,7 +21,6 @@ along with this program. If not, see . #include -ISmileyBase* CreateSmileyObject(SmileyType *sml); ISmileyBase* CreateAniSmileyObject(SmileyType *sml, COLORREF clr, bool ishpp); bool g_HiddenTextSupported = true; diff --git a/plugins/TabSRMM/src/msgdialog.cpp b/plugins/TabSRMM/src/msgdialog.cpp index 29b8826dd0..298fc77b1b 100644 --- a/plugins/TabSRMM/src/msgdialog.cpp +++ b/plugins/TabSRMM/src/msgdialog.cpp @@ -1535,12 +1535,6 @@ int CSrmmWindow::OnFilter(MSGFILTER *pFilter) bool isCtrl, isShift, isAlt; KbdState(isShift, isCtrl, isAlt); - MSG message; - message.hwnd = m_hwnd; - message.message = msg; - message.lParam = lp; - message.wParam = wp; - if (msg == WM_SYSKEYUP) { if (wp == VK_MENU) if (!m_bkeyProcessed && !(GetKeyState(VK_CONTROL) & 0x8000) && !(GetKeyState(VK_SHIFT) & 0x8000) && !(lp & (1 << 24))) @@ -1550,6 +1544,7 @@ int CSrmmWindow::OnFilter(MSGFILTER *pFilter) } if ((msg == WM_KEYDOWN || msg == WM_SYSKEYDOWN) && !(GetKeyState(VK_RMENU) & 0x8000)) { + MSG message = { m_hwnd, msg, wp, lp }; LRESULT mim_hotkey_check = Hotkey_Check(&message, TABSRMM_HK_SECTION_IM); if (mim_hotkey_check) m_bkeyProcessed = true; diff --git a/src/mir_app/src/hotkeys.cpp b/src/mir_app/src/hotkeys.cpp index b2b0247ab7..66993b6011 100644 --- a/src/mir_app/src/hotkeys.cpp +++ b/src/mir_app/src/hotkeys.cpp @@ -210,9 +210,7 @@ MIR_APP_DLL(int) Hotkey_Unregister(const char *pszName) cbNamePrefix = mir_strlen(pszNamePrefix); for (int i = 0; i < hotkeys.getCount(); i++) { - char *pszCurrentName = hotkeys[i]->rootHotkey ? - hotkeys[i]->rootHotkey->pszName : - hotkeys[i]->pszName; + char *pszCurrentName = hotkeys[i]->getName(); if (!pszCurrentName) continue; diff --git a/src/mir_app/src/skin.h b/src/mir_app/src/skin.h index 2ad06ff79b..602b3bb3d3 100644 --- a/src/mir_app/src/skin.h +++ b/src/mir_app/src/skin.h @@ -37,8 +37,8 @@ struct THotkeyBoxData struct THotkeyItem { THotkeyType type; - char *pszService, *pszName; // pszName is valid _only_ for "root" hotkeys - wchar_t *pwszSection, *pwszDescription; + char *pszService, *pszName; // pszName is valid _only_ for "root" hotkeys + wchar_t *pwszSection, *pwszDescription; LPARAM lParam; WORD DefHotkey, Hotkey; bool Enabled; @@ -56,6 +56,8 @@ struct THotkeyItem bool UnregisterHotkey; // valid only during WM_APP message in options UI, used to remove unregistered hotkeys from options + __inline char* getName() const { return (rootHotkey) ? rootHotkey->pszName : pszName; } + __inline wchar_t* getSection() const { return TranslateW_LP(pwszSection, hLangpack); } __inline wchar_t* getDescr() const { return TranslateW_LP(pwszDescription, hLangpack); } }; -- cgit v1.2.3