From 4ac8a5589cd54abe47f1c80c67b2a8265764528a Mon Sep 17 00:00:00 2001 From: George Hazan Date: Tue, 26 Dec 2017 15:57:50 +0300 Subject: TabSRMM: - custom color chooser removed; - unused menu items removed; - version bump --- plugins/TabSRMM/res/resource.rc | 28 --------------- plugins/TabSRMM/src/generic_msghandlers.cpp | 2 +- plugins/TabSRMM/src/globals.cpp | 8 ----- plugins/TabSRMM/src/hotkeyhandler.cpp | 2 +- plugins/TabSRMM/src/infopanel.cpp | 2 +- plugins/TabSRMM/src/msgdialog.cpp | 43 ++--------------------- plugins/TabSRMM/src/msgdlgutils.cpp | 53 ++--------------------------- plugins/TabSRMM/src/msgs.h | 5 ++- plugins/TabSRMM/src/resource.h | 10 ------ plugins/TabSRMM/src/sendlater.cpp | 2 +- plugins/TabSRMM/src/sendqueue.h | 1 - plugins/TabSRMM/src/utils.cpp | 35 +++++++++---------- plugins/TabSRMM/src/utils.h | 3 +- plugins/TabSRMM/src/version.h | 2 +- 14 files changed, 30 insertions(+), 166 deletions(-) (limited to 'plugins') diff --git a/plugins/TabSRMM/res/resource.rc b/plugins/TabSRMM/res/resource.rc index 7a0c7c38f0..3a3fe612e8 100644 --- a/plugins/TabSRMM/res/resource.rc +++ b/plugins/TabSRMM/res/resource.rc @@ -742,39 +742,11 @@ BEGIN MENUITEM "Don't play sounds", ID_TRAYCONTEXT_DON40223 MENUITEM "Be ""super quiet""", ID_TRAYCONTEXT_BE END - POPUP "Font" - BEGIN - MENUITEM "Default color", ID_FONT_DEFAULTCOLOR - MENUITEM "Red", ID_FONT_RED - MENUITEM "Green", ID_FONT_GREEN - MENUITEM "Blue", ID_FONT_BLUE - MENUITEM "Magenta", ID_FONT_MAGENTA - MENUITEM "Yellow", ID_FONT_YELLOW - MENUITEM "Cyan", ID_FONT_CYAN - MENUITEM "Black", ID_FONT_BLACK - MENUITEM "White", ID_FONT_WHITE - MENUITEM SEPARATOR - MENUITEM "Clear all formatting", ID_FONT_CLEARALLFORMATTING - END - POPUP "Dummy", INACTIVE - BEGIN - MENUITEM "No message sessions opened", ID_DUMMY_NOMESSAGESESSIONSOPENED - END POPUP "Favorites" BEGIN MENUITEM "Add contact to favorites", ID_FAVORITES_ADDCONTACTTOFAVORITES MENUITEM "Remove contact from favorites", ID_FAVORITES_REMOVECONTACTFROMFAVORITES END - POPUP "Apparentmenu" - BEGIN - MENUITEM "dummy", 65535 - END - POPUP "Panelpicmenu" - BEGIN - MENUITEM SEPARATOR - MENUITEM "Contact picture settings...", ID_PICMENU_SETTINGS - MENUITEM "Save this picture as...", ID_PANELPICMENU_SAVETHISPICTUREAS - END POPUP "Splitter context" BEGIN MENUITEM "Set position for this session", ID_SPLITTERCONTEXT_SETPOSITIONFORTHISSESSION diff --git a/plugins/TabSRMM/src/generic_msghandlers.cpp b/plugins/TabSRMM/src/generic_msghandlers.cpp index 49ca11556a..d603663344 100644 --- a/plugins/TabSRMM/src/generic_msghandlers.cpp +++ b/plugins/TabSRMM/src/generic_msghandlers.cpp @@ -335,7 +335,7 @@ LRESULT CTabBaseDlg::DM_MsgWindowCmdHandler(UINT cmd, WPARAM wParam, LPARAM lPar break; case IDC_INFOPANELMENU: - submenu = GetSubMenu(PluginConfig.g_hMenuContext, 9); + submenu = GetSubMenu(PluginConfig.g_hMenuContext, 7); GetWindowRect(GetDlgItem(m_hwnd, IDC_NAME), &rc); EnableMenuItem(submenu, ID_FAVORITES_ADDCONTACTTOFAVORITES, !m_cache->isFavorite() ? MF_ENABLED : MF_GRAYED); diff --git a/plugins/TabSRMM/src/globals.cpp b/plugins/TabSRMM/src/globals.cpp index 89b5fc0194..fcbfb1d36a 100644 --- a/plugins/TabSRMM/src/globals.cpp +++ b/plugins/TabSRMM/src/globals.cpp @@ -281,14 +281,6 @@ int CGlobals::ModulesLoaded(WPARAM, LPARAM) ::CreateImageList(TRUE); ::CB_InitCustomButtons(); - MENUITEMINFOA mii = { 0 }; - mii.cbSize = sizeof(mii); - mii.fMask = MIIM_BITMAP; - mii.hbmpItem = HBMMENU_CALLBACK; - HMENU submenu = GetSubMenu(PluginConfig.g_hMenuContext, 7); - for (int k = 0; k <= 8; k++) - SetMenuItemInfoA(submenu, (UINT_PTR)k, TRUE, &mii); - PluginConfig.reloadSystemModulesChanged(); ::Chat_ModulesLoaded(); diff --git a/plugins/TabSRMM/src/hotkeyhandler.cpp b/plugins/TabSRMM/src/hotkeyhandler.cpp index 75bb584b7d..94b6ccdc9d 100644 --- a/plugins/TabSRMM/src/hotkeyhandler.cpp +++ b/plugins/TabSRMM/src/hotkeyhandler.cpp @@ -218,7 +218,7 @@ LONG_PTR CALLBACK HotkeyHandlerDlgProc(HWND hwndDlg, UINT msg, WPARAM wParam, LP BOOL iSelection = TrackPopupMenu(PluginConfig.g_hMenuTrayUnread, TPM_RETURNCMD, pt.x, pt.y, 0, hwndDlg, nullptr); HandleMenuEntryFromhContact((MCONTACT)iSelection); } - else TrackPopupMenu(GetSubMenu(PluginConfig.g_hMenuContext, 8), TPM_RETURNCMD, pt.x, pt.y, 0, hwndDlg, nullptr); + else TrackPopupMenu(GetSubMenu(PluginConfig.g_hMenuContext, 6), TPM_RETURNCMD, pt.x, pt.y, 0, hwndDlg, nullptr); if (wParam == 100) PostMessage(hwndDlg, WM_NULL, 0, 0); diff --git a/plugins/TabSRMM/src/infopanel.cpp b/plugins/TabSRMM/src/infopanel.cpp index 05fa5f9e8d..1c2f0b106f 100644 --- a/plugins/TabSRMM/src/infopanel.cpp +++ b/plugins/TabSRMM/src/infopanel.cpp @@ -329,7 +329,7 @@ void CInfoPanel::renderContent(const HDC hdc) dis.rcItem = m_dat->m_rcPic; dis.hDC = hdc; dis.hwndItem = m_dat->GetHwnd(); - if (m_dat->MsgWindowDrawHandler(0, (LPARAM)&dis) == 0) { + if (m_dat->MsgWindowDrawHandler(&dis) == 0) { ::PostMessage(m_dat->GetHwnd(), WM_SIZE, 0, 1); ::PostMessage(m_dat->GetHwnd(), DM_FORCEREDRAW, 0, 0); } diff --git a/plugins/TabSRMM/src/msgdialog.cpp b/plugins/TabSRMM/src/msgdialog.cpp index 82c75e8783..f340f0d8a2 100644 --- a/plugins/TabSRMM/src/msgdialog.cpp +++ b/plugins/TabSRMM/src/msgdialog.cpp @@ -358,7 +358,7 @@ void CSrmmWindow::MsgWindowUpdateState(UINT msg) m_pWnd->Invalidate(); } -void TSAPI ShowMultipleControls(HWND hwndDlg, const UINT *controls, int cControls, int state) +static void ShowMultipleControls(HWND hwndDlg, const UINT *controls, int cControls, int state) { for (int i = 0; i < cControls; i++) Utils::showDlgControl(hwndDlg, controls[i], state); @@ -513,7 +513,7 @@ LRESULT CALLBACK SplitterSubclassProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM if (dat->m_bIsAutosizingInput) selection = ID_SPLITTERCONTEXT_SETPOSITIONFORTHISSESSION; else - selection = TrackPopupMenu(GetSubMenu(PluginConfig.g_hMenuContext, 12), TPM_RETURNCMD, pt.x, pt.y, 0, hwndParent, nullptr); + selection = TrackPopupMenu(GetSubMenu(PluginConfig.g_hMenuContext, 8), TPM_RETURNCMD, pt.x, pt.y, 0, hwndParent, nullptr); switch (selection) { case ID_SPLITTERCONTEXT_SAVEFORTHISCONTACTONLY: @@ -579,7 +579,6 @@ CSrmmWindow::CSrmmWindow() m_btnOk.OnClick = Callback(this, &CSrmmWindow::onClick_Ok); m_btnAdd.OnClick = Callback(this, &CSrmmWindow::onClick_Add); m_btnQuote.OnClick = Callback(this, &CSrmmWindow::onClick_Quote); - m_btnColor.OnClick = Callback(this, &CSrmmWindow::onClick_Color); m_btnCancelAdd.OnClick = Callback(this, &CSrmmWindow::onClick_CancelAdd); m_message.OnChange = Callback(this, &CSrmmWindow::onChange_Message); @@ -1183,42 +1182,6 @@ void CSrmmWindow::onClick_Add(CCtrlButton*) } } -void CSrmmWindow::onClick_Color(CCtrlButton *pButton) -{ - CHARFORMAT2 cf; - ZeroMemory(&cf, sizeof(CHARFORMAT2)); - cf.cbSize = sizeof(CHARFORMAT2); - cf.dwMask = CFM_COLOR; - cf.dwEffects = 0; - - RECT rc; - GetWindowRect(pButton->GetHwnd(), &rc); - int iSelection = TrackPopupMenu(GetSubMenu(PluginConfig.g_hMenuContext, 7), TPM_RETURNCMD, rc.left, rc.bottom, 0, m_hwnd, nullptr); - if (iSelection == ID_FONT_CLEARALLFORMATTING) { - cf.dwMask = CFM_BOLD | CFM_COLOR | CFM_ITALIC | CFM_UNDERLINE | CFM_STRIKEOUT; - cf.crTextColor = M.GetDword(FONTMODULE, "Font16Col", 0); - m_message.SendMsg(EM_SETCHARFORMAT, SCF_SELECTION, (LPARAM)&cf); - return; - } - - if (iSelection == ID_FONT_DEFAULTCOLOR) { - cf.crTextColor = M.GetDword(FONTMODULE, "Font16Col", 0); - for (int i = 0; i < Utils::rtf_clrs.getCount(); i++) - if (Utils::rtf_clrs[i].clr == cf.crTextColor) - cf.crTextColor = RGB(GetRValue(cf.crTextColor), GetGValue(cf.crTextColor), GetBValue(cf.crTextColor) == 0 ? GetBValue(cf.crTextColor) + 1 : GetBValue(cf.crTextColor) - 1); - - m_message.SendMsg(EM_SETCHARFORMAT, SCF_SELECTION, (LPARAM)&cf); - return; - } - - for (int i = 0; i < RTF_CTABLE_DEFSIZE; i++) { - if (Utils::rtf_clrs[i].menuid == iSelection) { - cf.crTextColor = Utils::rtf_clrs[i].clr; - m_message.SendMsg(EM_SETCHARFORMAT, SCF_SELECTION, (LPARAM)&cf); - } - } -} - void CSrmmWindow::onClick_Quote(CCtrlButton*) { CHARRANGE sel; @@ -2835,7 +2798,7 @@ INT_PTR CSrmmWindow::DlgProc(UINT uMsg, WPARAM wParam, LPARAM lParam) break; case WM_DRAWITEM: - return MsgWindowDrawHandler(wParam, lParam); + return MsgWindowDrawHandler((DRAWITEMSTRUCT*)lParam); case WM_APPCOMMAND: { diff --git a/plugins/TabSRMM/src/msgdlgutils.cpp b/plugins/TabSRMM/src/msgdlgutils.cpp index 125f6c140b..85fffcb7c7 100644 --- a/plugins/TabSRMM/src/msgdlgutils.cpp +++ b/plugins/TabSRMM/src/msgdlgutils.cpp @@ -1378,57 +1378,8 @@ void CTabBaseDlg::HandlePasteAndSend() // draw various elements of the message window, like avatar(s), info panel fields // and the color formatting menu -int CTabBaseDlg::MsgWindowDrawHandler(WPARAM, LPARAM lParam) +int CTabBaseDlg::MsgWindowDrawHandler(DRAWITEMSTRUCT *dis) { - LPDRAWITEMSTRUCT dis = (LPDRAWITEMSTRUCT)lParam; - if (dis->CtlType == ODT_MENU && dis->hwndItem == (HWND)GetSubMenu(PluginConfig.g_hMenuContext, 7)) { - RECT rc = { 0 }; - HBRUSH old, col; - COLORREF clr; - switch (dis->itemID) { - case ID_FONT_RED: - clr = RGB(255, 0, 0); - break; - case ID_FONT_BLUE: - clr = RGB(0, 0, 255); - break; - case ID_FONT_GREEN: - clr = RGB(0, 255, 0); - break; - case ID_FONT_MAGENTA: - clr = RGB(255, 0, 255); - break; - case ID_FONT_YELLOW: - clr = RGB(255, 255, 0); - break; - case ID_FONT_WHITE: - clr = RGB(255, 255, 255); - break; - case ID_FONT_DEFAULTCOLOR: - clr = GetSysColor(COLOR_MENU); - break; - case ID_FONT_CYAN: - clr = RGB(0, 255, 255); - break; - case ID_FONT_BLACK: - clr = RGB(0, 0, 0); - break; - default: - clr = 0; - } - col = (HBRUSH)CreateSolidBrush(clr); - old = (HBRUSH)SelectObject(dis->hDC, col); - rc.left = 2; - rc.top = dis->rcItem.top - 5; - rc.right = 15; - rc.bottom = dis->rcItem.bottom + 4; - Rectangle(dis->hDC, rc.left - 1, rc.top - 1, rc.right + 1, rc.bottom + 1); - FillRect(dis->hDC, &rc, col); - SelectObject(dis->hDC, old); - DeleteObject(col); - return TRUE; - } - HBITMAP hbmAvatar = m_ace ? m_ace->hbmPic : PluginConfig.g_hbmUnknown; if ((dis->hwndItem == GetDlgItem(m_hwnd, IDC_CONTACTPIC) && m_bShowAvatar) || (dis->hwndItem == m_hwnd && m_pPanel.isActive())) { if (hbmAvatar == nullptr) @@ -1570,7 +1521,7 @@ int CTabBaseDlg::MsgWindowDrawHandler(WPARAM, LPARAM lParam) return TRUE; } - return Menu_DrawItem(lParam); + return Menu_DrawItem((LPARAM)dis); } void TSAPI LoadThemeDefaults(TContainerData *pContainer) diff --git a/plugins/TabSRMM/src/msgs.h b/plugins/TabSRMM/src/msgs.h index f3664676a3..10b69baf5e 100644 --- a/plugins/TabSRMM/src/msgs.h +++ b/plugins/TabSRMM/src/msgs.h @@ -445,9 +445,9 @@ public: void UpdateReadChars() const; void UpdateSaveAndSendButton(); - int MsgWindowDrawHandler(WPARAM wParam, LPARAM lParam); - int MsgWindowUpdateMenu(HMENU submenu, int menuID); + int MsgWindowDrawHandler(DRAWITEMSTRUCT *dis); int MsgWindowMenuHandler(int selection, int menuId); + int MsgWindowUpdateMenu(HMENU submenu, int menuID); void RenderToolbarBG(HDC hdc, const RECT &rcWindow) const; void UpdateToolbarBG(); @@ -490,7 +490,6 @@ public: void onClick_Ok(CCtrlButton*); void onClick_Add(CCtrlButton*); - void onClick_Color(CCtrlButton*); void onClick_Quote(CCtrlButton*); void onClick_CancelAdd(CCtrlButton*); diff --git a/plugins/TabSRMM/src/resource.h b/plugins/TabSRMM/src/resource.h index 3e5a070072..c4472425c5 100644 --- a/plugins/TabSRMM/src/resource.h +++ b/plugins/TabSRMM/src/resource.h @@ -684,16 +684,6 @@ #define ID_SIZE_NORMAL 40189 #define ID_SIZE_SMALLER 40190 #define ID_SIZE_TINY 40191 -#define ID_FONT_RED 40192 -#define ID_FONT_GREEN 40193 -#define ID_FONT_BLUE 40194 -#define ID_FONT_MAGENTA 40195 -#define ID_FONT_YELLOW 40196 -#define ID_FONT_BLACK 40197 -#define ID_FONT_WHITE 40198 -#define ID_FONT_CLEARALLFORMATTING 40199 -#define ID_FONT_DEFAULTCOLOR 40200 -#define ID_FONT_CYAN 40201 #define ID_DUMMY_NOMESSAGESESSIONSOPENED 40202 #define ID_SENDMENU_SENDWITHOUTTIMEOUTS 40203 #define ID_TRAYCONTEXT_SHOWTHETRAYICON 40204 diff --git a/plugins/TabSRMM/src/sendlater.cpp b/plugins/TabSRMM/src/sendlater.cpp index 1a294368a9..7377e6f992 100644 --- a/plugins/TabSRMM/src/sendlater.cpp +++ b/plugins/TabSRMM/src/sendlater.cpp @@ -700,7 +700,7 @@ INT_PTR CALLBACK CSendLater::DlgProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM switch (((LPNMHDR)lParam)->code) { case NM_RCLICK: HMENU hMenu = ::LoadMenu(g_hInst, MAKEINTRESOURCE(IDR_TABCONTEXT)); - HMENU hSubMenu = ::GetSubMenu(hMenu, 13); + HMENU hSubMenu = ::GetSubMenu(hMenu, 9); ::TranslateMenu(hSubMenu); POINT pt; diff --git a/plugins/TabSRMM/src/sendqueue.h b/plugins/TabSRMM/src/sendqueue.h index 5f1d8315f7..9929843238 100644 --- a/plugins/TabSRMM/src/sendqueue.h +++ b/plugins/TabSRMM/src/sendqueue.h @@ -108,7 +108,6 @@ private: extern SendQueue *sendQueue; int TSAPI ActivateExistingTab(TContainerData *pContainer, HWND hwndChild); -void TSAPI ShowMultipleControls(const HWND hwndDlg, const UINT * controls, int cControls, int state); void TSAPI HandleIconFeedback(CTabBaseDlg *dat, HICON iIcon); #endif /* __SENDQUEUE_H */ diff --git a/plugins/TabSRMM/src/utils.cpp b/plugins/TabSRMM/src/utils.cpp index 3608625705..79d501e4a0 100644 --- a/plugins/TabSRMM/src/utils.cpp +++ b/plugins/TabSRMM/src/utils.cpp @@ -416,23 +416,23 @@ int CTabBaseDlg::FindRTLLocale() static TRTFColorTable _rtf_ctable[] = { - { L"black", 0, ID_FONT_BLACK }, - { L"", RGB(0,0,128), -1 }, - { L"", RGB(0,128,128), -1 }, - { L"", RGB(128,0,128), -1 }, - { L"", RGB(0,128,0), -1 }, - { L"", RGB(128,128,0), -1 }, - { L"", RGB(128,0,0), -1 }, - { L"", RGB(128,128,128), -1 }, - - { L"", RGB(192,192,192), -1 }, - { L"blue", RGB(0, 0, 255), ID_FONT_BLUE }, - { L"cyan", RGB(0, 255, 255), ID_FONT_CYAN }, - { L"magenta", RGB(255, 0, 255), ID_FONT_MAGENTA }, - { L"green", RGB(0, 255, 0), ID_FONT_GREEN }, - { L"yellow", RGB(255, 255, 0), ID_FONT_YELLOW }, - { L"red", RGB(255, 0, 0), ID_FONT_RED }, - { L"white", RGB(255, 255, 255), ID_FONT_WHITE } + { L"black", 0 }, + { L"", RGB(0,0,128) }, + { L"", RGB(0,128,128) }, + { L"", RGB(128,0,128) }, + { L"", RGB(0,128,0) }, + { L"", RGB(128,128,0) }, + { L"", RGB(128,0,0) }, + { L"", RGB(128,128,128) }, + + { L"", RGB(192,192,192) }, + { L"blue", RGB(0, 0, 255) }, + { L"cyan", RGB(0, 255, 255) }, + { L"magenta", RGB(255, 0, 255) }, + { L"green", RGB(0, 255, 0) }, + { L"yellow", RGB(255, 255, 0) }, + { L"red", RGB(255, 0, 0) }, + { L"white", RGB(255, 255, 255) } }; void Utils::RTF_CTableInit() @@ -451,7 +451,6 @@ void Utils::RTF_ColorAdd(const wchar_t *tszColname, size_t length) wchar_t *stopped; COLORREF clr = wcstol(tszColname, &stopped, 16); mir_snwprintf(p->szName, length + 1, L"%06x", clr); - p->menuid = 0; clr = wcstol(tszColname, &stopped, 16); p->clr = (RGB(GetBValue(clr), GetGValue(clr), GetRValue(clr))); diff --git a/plugins/TabSRMM/src/utils.h b/plugins/TabSRMM/src/utils.h index 9461b3acde..468c174733 100644 --- a/plugins/TabSRMM/src/utils.h +++ b/plugins/TabSRMM/src/utils.h @@ -38,9 +38,8 @@ struct TRTFColorTable { - wchar_t szName[10]; + wchar_t szName[10]; COLORREF clr; - int menuid; }; class Utils { diff --git a/plugins/TabSRMM/src/version.h b/plugins/TabSRMM/src/version.h index f98e15915b..b4e4e3dc6c 100644 --- a/plugins/TabSRMM/src/version.h +++ b/plugins/TabSRMM/src/version.h @@ -1,7 +1,7 @@ #define __MAJOR_VERSION 3 #define __MINOR_VERSION 5 #define __RELEASE_NUM 0 -#define __BUILD_NUM 7 +#define __BUILD_NUM 8 #include -- cgit v1.2.3