diff options
author | George Hazan <ghazan@miranda.im> | 2023-03-22 14:26:26 +0300 |
---|---|---|
committer | George Hazan <ghazan@miranda.im> | 2023-03-22 14:26:26 +0300 |
commit | 9a2f89927666a7011de901651bb6fd3b29e0cef9 (patch) | |
tree | 17a141618f827e4636794fad6dac969acde473a0 /plugins | |
parent | 3a106e52d02453111925979a513792673e247f29 (diff) |
Scriver: old unused trash removed
Diffstat (limited to 'plugins')
-rw-r--r-- | plugins/Scriver/src/globals.cpp | 38 | ||||
-rw-r--r-- | plugins/Scriver/src/globals.h | 2 | ||||
-rw-r--r-- | plugins/Scriver/src/msgdialog.cpp | 36 | ||||
-rw-r--r-- | plugins/Scriver/src/tabs.cpp | 14 | ||||
-rw-r--r-- | plugins/Scriver/src/utils.cpp | 57 | ||||
-rw-r--r-- | plugins/Scriver/src/utils.h | 3 |
6 files changed, 29 insertions, 121 deletions
diff --git a/plugins/Scriver/src/globals.cpp b/plugins/Scriver/src/globals.cpp index 8eecb475ed..c62e8e4844 100644 --- a/plugins/Scriver/src/globals.cpp +++ b/plugins/Scriver/src/globals.cpp @@ -25,19 +25,6 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. GlobalMessageData g_dat;
-static int buttonIcons[] =
-{
- IDI_CLOSEX, IDI_QUOTE, IDI_ADDCONTACT, 0,
- IDI_USERDETAILS, IDI_HISTORY, IDI_SEND
-};
-
-static int chatButtonIcons[] =
-{
- IDI_CLOSEX, IDI_BBOLD, IDI_BITALICS, IDI_BUNDERLINE,
- IDI_COLOR, IDI_BKGCOLOR, IDI_HISTORY, IDI_FILTER,
- IDI_TOPICBUT, IDI_NICKLIST, IDI_SEND
-};
-
static IconItem iconList1[] =
{
{ LPGEN("Add contact"), "ADD", IDI_ADDCONTACT }, // 1
@@ -212,20 +199,10 @@ void LoadGlobalIcons() g_dat.hMsgIconBig = Skin_LoadIcon(SKINICON_EVENT_MESSAGE, true);
g_dat.hIconChatBig = IcoLib_GetIcon("chat_window", true);
- ImageList_RemoveAll(g_dat.hButtonIconList);
- ImageList_RemoveAll(g_dat.hChatButtonIconList);
- ImageList_RemoveAll(g_dat.hHelperIconList);
-
- for (auto &it : buttonIcons) {
- if (it == 0)
- ImageList_AddIcon_ProtoEx(g_dat.hButtonIconList, nullptr, ID_STATUS_OFFLINE);
- else
- g_plugin.addImgListIcon(g_dat.hButtonIconList, it);
- }
-
- for (auto &it : chatButtonIcons)
- g_plugin.addImgListIcon(g_dat.hChatButtonIconList, it);
+ if (!ImageList_GetImageCount(g_dat.hTabIconList))
+ g_plugin.addImgListIcon(g_dat.hTabIconList, IDI_CLOSEX);
+ ImageList_RemoveAll(g_dat.hHelperIconList);
g_plugin.addImgListIcon(g_dat.hHelperIconList, IDI_OVERLAY);
int overlayIcon = g_plugin.addImgListIcon(g_dat.hHelperIconList, IDI_OVERLAY);
@@ -273,13 +250,12 @@ void InitGlobals() ReloadGlobals();
g_dat.lastParent = nullptr;
g_dat.lastChatParent = nullptr;
- g_dat.hTabIconList = nullptr;
g_dat.tabIconListUsage = nullptr;
g_dat.tabIconListUsageSize = 0;
- g_dat.hButtonIconList = ImageList_Create(16, 16, ILC_COLOR32 | ILC_MASK, 0, 0);
- g_dat.hChatButtonIconList = ImageList_Create(16, 16, ILC_COLOR32 | ILC_MASK, 0, 0);
+
g_dat.hTabIconList = ImageList_Create(16, 16, ILC_COLOR32 | ILC_MASK, 0, 0);
g_dat.hHelperIconList = ImageList_Create(16, 16, ILC_COLOR32 | ILC_MASK, 0, 0);
+
g_dat.logPixelSX = GetDeviceCaps(hdc, LOGPIXELSX);
g_dat.logPixelSY = GetDeviceCaps(hdc, LOGPIXELSY);
LoadInfobarFonts();
@@ -292,10 +268,6 @@ void FreeGlobals() DeleteObject(g_dat.hInfobarBrush);
if (g_dat.hTabIconList)
ImageList_Destroy(g_dat.hTabIconList);
- if (g_dat.hButtonIconList)
- ImageList_Destroy(g_dat.hButtonIconList);
- if (g_dat.hChatButtonIconList)
- ImageList_Destroy(g_dat.hChatButtonIconList);
if (g_dat.hHelperIconList)
ImageList_Destroy(g_dat.hHelperIconList);
mir_free(g_dat.tabIconListUsage);
diff --git a/plugins/Scriver/src/globals.h b/plugins/Scriver/src/globals.h index 5a125e5039..995d823ebb 100644 --- a/plugins/Scriver/src/globals.h +++ b/plugins/Scriver/src/globals.h @@ -101,8 +101,6 @@ struct GlobalMessageData int limitChatsTabsNum;
int indentSize;
HIMAGELIST hTabIconList;
- HIMAGELIST hButtonIconList;
- HIMAGELIST hChatButtonIconList;
HIMAGELIST hHelperIconList;
HBRUSH hInfobarBrush;
int toolbarPosition;
diff --git a/plugins/Scriver/src/msgdialog.cpp b/plugins/Scriver/src/msgdialog.cpp index c7e0edcb05..f0cb3f11fb 100644 --- a/plugins/Scriver/src/msgdialog.cpp +++ b/plugins/Scriver/src/msgdialog.cpp @@ -764,11 +764,11 @@ INT_PTR CLogWindow::WndProc(UINT msg, WPARAM wParam, LPARAM lParam) switch (msg) {
case WM_MEASUREITEM:
- MeasureMenuItem(wParam, lParam);
+ Menu_MeasureItem(lParam);
return TRUE;
case WM_DRAWITEM:
- return DrawMenuItem(wParam, lParam);
+ return Menu_DrawItem(lParam);
}
return CSuper::WndProc(msg, wParam, lParam);
@@ -1181,29 +1181,25 @@ INT_PTR CMsgDialog::DlgProc(UINT msg, WPARAM wParam, LPARAM lParam) break;
case WM_MEASUREITEM:
- if (!MeasureMenuItem(wParam, lParam)) {
+ {
MEASUREITEMSTRUCT *mis = (MEASUREITEMSTRUCT *)lParam;
- if (mis->CtlType == ODT_MENU)
- return Menu_MeasureItem(lParam);
-
- int ih = Chat_GetTextPixelSize(L"AQGgl'", g_Settings.UserListFont, false);
- int ih2 = Chat_GetTextPixelSize(L"AQGg'", g_Settings.UserListHeadingsFont, false);
- int font = ih > ih2 ? ih : ih2;
- int height = db_get_b(0, CHAT_MODULE, "NicklistRowDist", 12);
- // make sure we have space for icon!
- if (db_get_b(0, CHAT_MODULE, "ShowContactStatus", 0))
- font = font > 16 ? font : 16;
- mis->itemHeight = height > font ? height : font;
+ if (mis->CtlID == IDC_SRMM_NICKLIST) {
+ int ih = Chat_GetTextPixelSize(L"AQGgl'", g_Settings.UserListFont, false);
+ int ih2 = Chat_GetTextPixelSize(L"AQGg'", g_Settings.UserListHeadingsFont, false);
+ int font = ih > ih2 ? ih : ih2;
+ int height = db_get_b(0, CHAT_MODULE, "NicklistRowDist", 12);
+ // make sure we have space for icon!
+ if (db_get_b(0, CHAT_MODULE, "ShowContactStatus", 0))
+ font = font > 16 ? font : 16;
+ mis->itemHeight = height > font ? height : font;
+ }
}
- return TRUE;
+ return Menu_MeasureItem(lParam);
case WM_DRAWITEM:
- if (!DrawMenuItem(wParam, lParam)) {
+ {
LPDRAWITEMSTRUCT dis = (LPDRAWITEMSTRUCT)lParam;
- if (dis->CtlType == ODT_MENU)
- return Menu_DrawItem(lParam);
-
- if (dis->hwndItem == GetDlgItem(m_hwnd, IDC_AVATAR)) {
+ if (dis->CtlID == IDC_AVATAR) {
int avatarWidth = 0, avatarHeight = 0;
int itemWidth = dis->rcItem.right - dis->rcItem.left + 1, itemHeight = dis->rcItem.bottom - dis->rcItem.top + 1;
HDC hdcMem = CreateCompatibleDC(dis->hDC);
diff --git a/plugins/Scriver/src/tabs.cpp b/plugins/Scriver/src/tabs.cpp index 7ac7de89c7..8af0659443 100644 --- a/plugins/Scriver/src/tabs.cpp +++ b/plugins/Scriver/src/tabs.cpp @@ -614,7 +614,7 @@ static LRESULT CALLBACK TabCtrlProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM l POINT pt = { LOWORD(lParam), HIWORD(lParam) };
IMAGEINFO info;
- ImageList_GetImageInfo(g_dat.hButtonIconList, 0, &info);
+ ImageList_GetImageInfo(g_dat.hTabIconList, 0, &info);
rect.left = rect.right - (info.rcImage.right - info.rcImage.left) - 6;
if (!atTop)
rect.top = rect.bottom - (info.rcImage.bottom - info.rcImage.top);
@@ -628,10 +628,10 @@ static LRESULT CALLBACK TabCtrlProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM l hBmp = CreateCompatibleBitmap(hdc, info.rcImage.right - info.rcImage.left + 1, info.rcImage.bottom - info.rcImage.top + 1);
hOldBitmap = (HBITMAP)SelectObject(hdcMem, hBmp);
SetPixel(hdcMem, pt.x, pt.y, 0x000000);
- ImageList_DrawEx(g_dat.hButtonIconList, 0, hdcMem, 0, 0, 0, 0, CLR_NONE, CLR_NONE, ILD_NORMAL);
+ ImageList_DrawEx(g_dat.hTabIconList, 0, hdcMem, 0, 0, 0, 0, CLR_NONE, CLR_NONE, ILD_NORMAL);
COLORREF color1 = GetPixel(hdcMem, pt.x, pt.y);
SetPixel(hdcMem, pt.x, pt.y, 0xFFFFFF);
- ImageList_DrawEx(g_dat.hButtonIconList, 0, hdcMem, 0, 0, 0, 0, CLR_NONE, CLR_NONE, ILD_NORMAL);
+ ImageList_DrawEx(g_dat.hTabIconList, 0, hdcMem, 0, 0, 0, 0, CLR_NONE, CLR_NONE, ILD_NORMAL);
COLORREF color2 = GetPixel(hdcMem, pt.x, pt.y);
SelectObject(hdcMem, hOldBitmap);
DeleteDC(hdcMem);
@@ -1252,9 +1252,9 @@ static void DrawTab(ParentWindowData *dat, HWND hwnd, WPARAM, LPARAM lParam) rect.left = rIcon.left + (info.rcImage.right - info.rcImage.left);
}
if (dat->flags2.bTabCloseButton) {
- ImageList_GetImageInfo(g_dat.hButtonIconList, 0, &info);
+ ImageList_GetImageInfo(g_dat.hTabIconList, 0, &info);
rIcon.left = rect.right - GetSystemMetrics(SM_CXEDGE) - (bSelected ? 6 : 2) - (info.rcImage.right - info.rcImage.left);
- ImageList_DrawEx(g_dat.hButtonIconList, 0, lpDIS->hDC, rIcon.left, rIcon.top, 0, 0, CLR_NONE, CLR_NONE, ILD_NORMAL);
+ ImageList_DrawEx(g_dat.hTabIconList, 0, lpDIS->hDC, rIcon.left, rIcon.top, 0, 0, CLR_NONE, CLR_NONE, ILD_NORMAL);
rect.right = rIcon.left - 1;
}
rect.top += GetSystemMetrics(SM_CYEDGE) + 2;
@@ -1269,10 +1269,10 @@ static void DrawTab(ParentWindowData *dat, HWND hwnd, WPARAM, LPARAM lParam) rect.left = rIcon.left + (info.rcImage.right - info.rcImage.left);
}
if (dat->flags2.bTabCloseButton) {
- ImageList_GetImageInfo(g_dat.hButtonIconList, 0, &info);
+ ImageList_GetImageInfo(g_dat.hTabIconList, 0, &info);
rIcon.top = rect.bottom - (info.rcImage.bottom - info.rcImage.top) - 2;
rIcon.left = rect.right - GetSystemMetrics(SM_CXEDGE) - (bSelected ? 6 : 2) - (info.rcImage.right - info.rcImage.left);
- ImageList_DrawEx(g_dat.hButtonIconList, 0, lpDIS->hDC, rIcon.left, rIcon.top, 0, 0, CLR_NONE, CLR_NONE, ILD_NORMAL);
+ ImageList_DrawEx(g_dat.hTabIconList, 0, lpDIS->hDC, rIcon.left, rIcon.top, 0, 0, CLR_NONE, CLR_NONE, ILD_NORMAL);
rect.right = rIcon.left - 1;
}
rect.bottom -= GetSystemMetrics(SM_CYEDGE) + 2;
diff --git a/plugins/Scriver/src/utils.cpp b/plugins/Scriver/src/utils.cpp index fd346b0ec4..4c7449c852 100644 --- a/plugins/Scriver/src/utils.cpp +++ b/plugins/Scriver/src/utils.cpp @@ -72,63 +72,6 @@ wchar_t* limitText(wchar_t *text, int limit) return text;
}
-int MeasureMenuItem(WPARAM, LPARAM lParam)
-{
- LPMEASUREITEMSTRUCT mis = (LPMEASUREITEMSTRUCT)lParam;
- if (mis->itemData != (ULONG_PTR)g_dat.hButtonIconList && mis->itemData != (ULONG_PTR)g_dat.hChatButtonIconList)
- return FALSE;
-
- mis->itemWidth = max(0, GetSystemMetrics(SM_CXSMICON) - GetSystemMetrics(SM_CXMENUCHECK) + 4);
- mis->itemHeight = GetSystemMetrics(SM_CYSMICON) + 2;
- return TRUE;
-}
-
-int DrawMenuItem(WPARAM, LPARAM lParam)
-{
- LPDRAWITEMSTRUCT dis = (LPDRAWITEMSTRUCT)lParam;
- if (dis->itemData != (ULONG_PTR)g_dat.hButtonIconList && dis->itemData != (ULONG_PTR)g_dat.hChatButtonIconList)
- return FALSE;
-
- int y = (dis->rcItem.bottom - dis->rcItem.top - GetSystemMetrics(SM_CYSMICON)) / 2 + 1;
- if (dis->itemState & ODS_SELECTED) {
- if (dis->itemState & ODS_CHECKED) {
- RECT rc;
- rc.left = 2;
- rc.right = GetSystemMetrics(SM_CXSMICON) + 2;
- rc.top = y;
- rc.bottom = rc.top + GetSystemMetrics(SM_CYSMICON) + 2;
- FillRect(dis->hDC, &rc, GetSysColorBrush(COLOR_HIGHLIGHT));
- ImageList_DrawEx((HIMAGELIST)dis->itemData, dis->itemID, dis->hDC, 2, y, 0, 0, CLR_NONE, CLR_DEFAULT, ILD_SELECTED);
- }
- else
- ImageList_DrawEx((HIMAGELIST)dis->itemData, dis->itemID, dis->hDC, 2, y, 0, 0, CLR_NONE, CLR_DEFAULT, ILD_FOCUS);
- }
- else {
- if (dis->itemState & ODS_CHECKED) {
- HBRUSH hBrush;
- RECT rc;
- COLORREF menuCol, hiliteCol;
- rc.left = 0;
- rc.right = GetSystemMetrics(SM_CXSMICON) + 4;
- rc.top = y - 2;
- rc.bottom = rc.top + GetSystemMetrics(SM_CYSMICON) + 4;
- DrawEdge(dis->hDC, &rc, BDR_SUNKENOUTER, BF_RECT);
- InflateRect(&rc, -1, -1);
- menuCol = GetSysColor(COLOR_MENU);
- hiliteCol = GetSysColor(COLOR_3DHIGHLIGHT);
- hBrush = CreateSolidBrush(RGB
- ((GetRValue(menuCol) + GetRValue(hiliteCol)) / 2, (GetGValue(menuCol) + GetGValue(hiliteCol)) / 2,
- (GetBValue(menuCol) + GetBValue(hiliteCol)) / 2));
- FillRect(dis->hDC, &rc, hBrush);
- DeleteObject(hBrush);
- ImageList_DrawEx((HIMAGELIST)dis->itemData, dis->itemID, dis->hDC, 2, y, 0, 0, CLR_NONE, GetSysColor(COLOR_MENU), ILD_BLEND25);
- }
- else
- ImageList_DrawEx((HIMAGELIST)dis->itemData, dis->itemID, dis->hDC, 2, y, 0, 0, CLR_NONE, CLR_NONE, ILD_NORMAL);
- }
- return TRUE;
-}
-
// Code taken from http://www.geekhideout.com/urlcode.shtml
/* Converts an integer value to its hex character*/
diff --git a/plugins/Scriver/src/utils.h b/plugins/Scriver/src/utils.h index 0a67a4811e..446818c94b 100644 --- a/plugins/Scriver/src/utils.h +++ b/plugins/Scriver/src/utils.h @@ -37,8 +37,7 @@ enum SEARCHENGINES { wchar_t *limitText(wchar_t *text, int limit);
void logInfo(const char *fmt, ...);
void SearchWord(wchar_t * word, int engine);
-int MeasureMenuItem(WPARAM wParam, LPARAM lParam);
-int DrawMenuItem(WPARAM wParam, LPARAM lParam);
+
HWND CreateToolTip(HWND hwndParent, LPTSTR ptszText, LPTSTR ptszTitle, RECT *rect);
void SetToolTipText(HWND hwndParent, HWND hwndTT, LPTSTR ptszText, LPTSTR ptszTitle);
void SetToolTipRect(HWND hwndParent, HWND hwndTT, RECT* rect);
|