summaryrefslogtreecommitdiff
path: root/Plugins/emoticons/selwin.cpp
diff options
context:
space:
mode:
authorpescuma <pescuma@c086bb3d-8645-0410-b8da-73a8550f86e7>2008-04-13 23:45:56 +0000
committerpescuma <pescuma@c086bb3d-8645-0410-b8da-73a8550f86e7>2008-04-13 23:45:56 +0000
commit6ae86c78a2ab8ab7ee876f9caf11e5c3079284fe (patch)
treedb56a9f62ca680088b817df8cd053b849d036f96 /Plugins/emoticons/selwin.cpp
parent134649159b4928ef0370c25d3a74d3c59e61e147 (diff)
New grouped selection window
git-svn-id: http://pescuma.googlecode.com/svn/trunk/Miranda@79 c086bb3d-8645-0410-b8da-73a8550f86e7
Diffstat (limited to 'Plugins/emoticons/selwin.cpp')
-rw-r--r--Plugins/emoticons/selwin.cpp475
1 files changed, 58 insertions, 417 deletions
diff --git a/Plugins/emoticons/selwin.cpp b/Plugins/emoticons/selwin.cpp
index 9aba03c..4395b76 100644
--- a/Plugins/emoticons/selwin.cpp
+++ b/Plugins/emoticons/selwin.cpp
@@ -1,40 +1,6 @@
#include "commons.h"
-#define MIN_COLS 5
-#define MAX_LINES 8
-#define MAX_COLS 12
-#define BORDER 3
-
-
-struct EmoticonSelectionData
-{
- Module *module;
- COLORREF background;
- int max_height;
- int max_width;
- int lines;
- int cols;
- int selection;
-
- int xPosition;
- int yPosition;
- int Direction;
- HWND hwndTarget;
- UINT targetMessage;
- LPARAM targetWParam;
-
- void SetSelection(HWND hwnd, int sel)
- {
- if (sel < 0)
- sel = -1;
- if (sel >= module->emoticons.getCount())
- sel = -1;
- if (sel != selection)
- InvalidateRect(hwnd, NULL, FALSE);
- selection = sel;
- }
-};
HBITMAP CreateBitmap32(int cx, int cy)
@@ -59,68 +25,6 @@ HBITMAP CreateBitmap32(int cx, int cy)
}
-HWND CreateTooltip(HWND hwnd, RECT &rect, TCHAR *text)
-{
- // struct specifying control classes to register
- INITCOMMONCONTROLSEX iccex;
- HWND hwndTT; // handle to the ToolTip control
- // struct specifying info about tool in ToolTip control
- TOOLINFO ti;
- unsigned int uid = 0; // for ti initialization
-
- // Load the ToolTip class from the DLL.
- iccex.dwSize = sizeof(iccex);
- iccex.dwICC = ICC_BAR_CLASSES;
-
- if(!InitCommonControlsEx(&iccex))
- return NULL;
-
- /* CREATE A TOOLTIP WINDOW */
- hwndTT = CreateWindowEx(WS_EX_TOPMOST,
- TOOLTIPS_CLASS,
- NULL,
- WS_POPUP | TTS_NOPREFIX | TTS_ALWAYSTIP,
- CW_USEDEFAULT,
- CW_USEDEFAULT,
- CW_USEDEFAULT,
- CW_USEDEFAULT,
- hwnd,
- NULL,
- hInst,
- NULL
- );
-
- /* Gives problem with mToolTip
- SetWindowPos(hwndTT,
- HWND_TOPMOST,
- 0,
- 0,
- 0,
- 0,
- SWP_NOMOVE | SWP_NOSIZE | SWP_NOACTIVATE);
- */
-
- /* INITIALIZE MEMBERS OF THE TOOLINFO STRUCTURE */
- ti.cbSize = sizeof(TOOLINFO);
- ti.uFlags = TTF_SUBCLASS;
- ti.hwnd = hwnd;
- ti.hinst = hInst;
- ti.uId = uid;
- ti.lpszText = text;
- // ToolTip control will cover the whole window
- ti.rect.left = rect.left;
- ti.rect.top = rect.top;
- ti.rect.right = rect.right;
- ti.rect.bottom = rect.bottom;
-
- /* SEND AN ADDTOOL MESSAGE TO THE TOOLTIP CONTROL WINDOW */
- SendMessage(hwndTT, TTM_ADDTOOL, 0, (LPARAM) (LPTOOLINFO) &ti);
- SendMessage(hwndTT, TTM_SETDELAYTIME, (WPARAM) (DWORD) TTDT_AUTOPOP, (LPARAM) MAKELONG(24 * 60 * 60 * 1000, 0));
-
- return hwndTT;
-}
-
-
void AssertInsideScreen(RECT &rc)
{
// Make sure it is inside screen
@@ -173,144 +77,49 @@ INT_PTR CALLBACK EmoticonSeletionDlgProc(HWND hwnd, UINT msg, WPARAM wParam, LPA
{
switch(msg)
{
- case WM_INITDIALOG:
+ case WM_INITDIALOG:
{
EmoticonSelectionData *ssd = (EmoticonSelectionData *) lParam;
- SetWindowLong(hwnd, GWL_USERDATA, (LONG) ssd);
-
- ssd->selection = -1;
- // Load emoticons
- ssd->max_height = 4;
- ssd->max_width = 4;
-
- HDC hdc = GetDC(hwnd);
-
- int num_emotes = ssd->module->emoticons.getCount();
- int i;
- for(i = 0; i < num_emotes; i++)
+ // Get background
+ ssd->background = RGB(255, 255, 255);
+ if (ssd->hwndTarget != NULL)
{
- Emoticon *e = ssd->module->emoticons[i];
- if (e->img != NULL)
- e->img->Load(ssd->max_height, ssd->max_width);
-
- if (e->img == NULL || e->img->img == NULL)
- {
- HFONT hFont;
- if (ssd->hwndTarget != NULL)
- {
- CHARFORMAT2 cf;
- ZeroMemory(&cf, sizeof(cf));
- cf.cbSize = sizeof(cf);
- cf.dwMask = CFM_FACE | CFM_ITALIC | CFM_CHARSET | CFM_FACE | CFM_WEIGHT | CFM_SIZE;
- SendMessage(ssd->hwndTarget, EM_GETCHARFORMAT, SCF_SELECTION, (LPARAM) &cf);
-
- LOGFONT lf = {0};
- lf.lfHeight = -MulDiv(cf.yHeight / 20, GetDeviceCaps(hdc, LOGPIXELSY), 72);
- lf.lfWeight = cf.wWeight;
- lf.lfItalic = (cf.dwEffects & CFE_ITALIC) == CFE_ITALIC;
- lf.lfCharSet = cf.bCharSet;
- lf.lfPitchAndFamily = cf.bPitchAndFamily;
- lstrcpyn(lf.lfFaceName, cf.szFaceName, MAX_REGS(lf.lfFaceName));
-
- hFont = CreateFontIndirect(&lf);
- }
- else
- hFont = (HFONT) SendMessage(hwnd, WM_GETFONT, 0, 0);
-
- if (hFont != NULL)
- SelectObject(hdc, hFont);
-
- RECT rc = { 0, 0, 0xFFFF, 0xFFFF };
- DrawText(hdc, e->texts[0], lstrlen(e->texts[0]), &rc, DT_CALCRECT | DT_NOPREFIX);
-
- ssd->max_height = max(ssd->max_height, rc.bottom - rc.top + 1);
- ssd->max_width = max(ssd->max_width, rc.right - rc.left + 1);
-
- if (ssd->hwndTarget != NULL)
- DeleteObject(hFont);
- }
+ ssd->background = SendMessage(ssd->hwndTarget, EM_SETBKGNDCOLOR, 0, ssd->background);
+ SendMessage(ssd->hwndTarget, EM_SETBKGNDCOLOR, 0, ssd->background);
}
- ReleaseDC(hwnd, hdc);
+ // Create positioning object
+ EmoticonsSelectionLayout *layout = new GroupListEmoticons();
+ layout->ssd = ssd;
+ layout->hwnd = hwnd;
+ SetWindowLong(hwnd, GWL_USERDATA, (LONG) layout);
- ssd->cols = num_emotes / MAX_LINES;
- if (num_emotes % MAX_LINES != 0)
- ssd->cols++;
- ssd->cols = min(max(ssd->cols, MIN_COLS), MAX_COLS);
-
- ssd->lines = num_emotes / ssd->cols;
- if (num_emotes % ssd->cols != 0)
- ssd->lines++;
+ layout->Load();
// Calc position
- int width = ssd->max_width * ssd->cols + (ssd->cols + 1) * BORDER + 1;
- int height = ssd->max_height * ssd->lines + (ssd->lines + 1) * BORDER + 1;
int x = ssd->xPosition;
int y = ssd->yPosition;
switch (ssd->Direction)
{
- case 1:
- x -= width;
- break;
- case 2:
- x -= width;
- y -= height;
- break;
- case 3:
- y -= height;
- break;
- }
-
- // Get background
- ssd->background = RGB(255, 255, 255);
- if (ssd->hwndTarget != NULL)
- {
- ssd->background = SendMessage(ssd->hwndTarget, EM_SETBKGNDCOLOR, 0, ssd->background);
- SendMessage(ssd->hwndTarget, EM_SETBKGNDCOLOR, 0, ssd->background);
+ case 1:
+ x -= layout->window.width;
+ break;
+ case 2:
+ x -= layout->window.width;
+ y -= layout->window.height;
+ break;
+ case 3:
+ y -= layout->window.height;
+ break;
}
- RECT rc = { x, y, x + width, y + height };
+ RECT rc = { x, y, x + layout->window.width + 2, y + layout->window.height + 2 };
AssertInsideScreen(rc);
- SetWindowPos(hwnd, HWND_TOPMOST, rc.left, rc.top, width, height, 0);
+ SetWindowPos(hwnd, HWND_TOPMOST, rc.left, rc.top, rc.right - rc.left, rc.bottom - rc.top, 0);
- for(i = 0; i < ssd->lines; i++)
- {
- for(int j = 0; j < ssd->cols; j++)
- {
- int index = i * ssd->cols + j;
- if (index >= ssd->module->emoticons.getCount())
- break;
-
- Emoticon *e = ssd->module->emoticons[index];
-
- RECT fr;
- fr.left = BORDER + j * (ssd->max_width + BORDER) - 1;
- fr.right = fr.left + ssd->max_width + 2;
- fr.top = BORDER + i * (ssd->max_height + BORDER) - 1;
- fr.bottom = fr.top + ssd->max_height + 2;
-
- Buffer<TCHAR> tt;
- if (e->description[0] != _T('\0'))
- {
- tt += _T(" ");
- tt += e->description;
- tt.translate();
- tt += _T(" ");
- }
-
- for(int k = 0; k < e->texts.getCount(); k++)
- {
- tt += _T(" ");
- tt += e->texts[k];
- tt += _T(" ");
- }
- tt.pack();
-
- e->tt = CreateTooltip(hwnd, fr, tt.str);
- }
- }
+ layout->CreateToolTips();
TRACKMOUSEEVENT tme;
tme.cbSize = sizeof(TRACKMOUSEEVENT);
@@ -322,12 +131,12 @@ INT_PTR CALLBACK EmoticonSeletionDlgProc(HWND hwnd, UINT msg, WPARAM wParam, LPA
return TRUE;
}
- case WM_PAINT:
+ case WM_PAINT:
{
RECT r;
if (GetUpdateRect(hwnd, &r, FALSE))
{
- EmoticonSelectionData *ssd = (EmoticonSelectionData *) GetWindowLong(hwnd, GWL_USERDATA);
+ EmoticonsSelectionLayout *layout = (EmoticonsSelectionLayout *) GetWindowLong(hwnd, GWL_USERDATA);
PAINTSTRUCT ps;
@@ -343,120 +152,22 @@ INT_PTR CALLBACK EmoticonSeletionDlgProc(HWND hwnd, UINT msg, WPARAM wParam, LPA
SetBkMode(hdc, TRANSPARENT);
- // Erase background
- HBRUSH hB = CreateSolidBrush(ssd->background);
- FillRect(hdc, &rc, hB);
- DeleteObject(hB);
-
- // Draw emoticons
- for(int i = 0; i < ssd->lines; i++)
- {
- for(int j = 0; j < ssd->cols; j++)
- {
- int index = i * ssd->cols + j;
- if (index >= ssd->module->emoticons.getCount())
- break;
-
- Emoticon *e = ssd->module->emoticons[index];
- if (e->img == NULL || e->img->img == NULL)
- {
- HFONT hFont;
- if (ssd->hwndTarget != NULL)
- {
- CHARFORMAT2 cf;
- ZeroMemory(&cf, sizeof(cf));
- cf.cbSize = sizeof(cf);
- cf.dwMask = CFM_FACE | CFM_ITALIC | CFM_CHARSET | CFM_FACE | CFM_WEIGHT | CFM_SIZE | CFM_COLOR;
- SendMessage(ssd->hwndTarget, EM_GETCHARFORMAT, SCF_DEFAULT, (LPARAM) &cf);
-
- LOGFONT lf = {0};
- lf.lfHeight = -MulDiv(cf.yHeight / 20, GetDeviceCaps(hdc, LOGPIXELSY), 72);
- lf.lfWeight = cf.wWeight;
- lf.lfItalic = (cf.dwEffects & CFE_ITALIC) == CFE_ITALIC;
- lf.lfCharSet = cf.bCharSet;
- lf.lfPitchAndFamily = cf.bPitchAndFamily;
- lstrcpyn(lf.lfFaceName, cf.szFaceName, MAX_REGS(lf.lfFaceName));
-
- hFont = CreateFontIndirect(&lf);
- SetTextColor(hdc, cf.crTextColor);
- }
- else
- hFont = (HFONT) SendMessage(hwnd, WM_GETFONT, 0, 0);
-
- if (hFont != NULL)
- SelectObject(hdc, hFont);
-
- RECT rc = { 0, 0, 0xFFFF, 0xFFFF };
- DrawText(hdc, e->texts[0], lstrlen(e->texts[0]), &rc, DT_CALCRECT | DT_NOPREFIX);
-
- int height = rc.bottom - rc.top + 1;
- int width = rc.right - rc.left + 1;
-
- rc.left = BORDER + j * (ssd->max_width + BORDER) + (ssd->max_width - width) / 2;
- rc.top = BORDER + i * (ssd->max_height + BORDER) + (ssd->max_height - height) / 2;
-
- rc.right = rc.left + width;
- rc.bottom = rc.top + height;
-
- DrawText(hdc, e->texts[0], lstrlen(e->texts[0]), &rc, DT_NOPREFIX);
-
- if (ssd->hwndTarget != NULL)
- DeleteObject(hFont);
- }
- else
- {
- BITMAP bmp;
- GetObject(e->img->img, sizeof(bmp), &bmp);
-
- int x = BORDER + j * (ssd->max_width + BORDER) + (ssd->max_width - bmp.bmWidth) / 2;
- int y = BORDER + i * (ssd->max_height + BORDER) + (ssd->max_height - bmp.bmHeight) / 2;
-
- HDC hdc_img = CreateCompatibleDC(hdc);
- HBITMAP old_bmp = (HBITMAP) SelectObject(hdc_img, e->img->img);
-
- if (e->img->transparent)
- {
- BLENDFUNCTION bf = {0};
- bf.SourceConstantAlpha = 255;
- bf.AlphaFormat = AC_SRC_ALPHA;
- AlphaBlend(hdc, x, y, bmp.bmWidth, bmp.bmHeight, hdc_img, 0, 0, bmp.bmWidth, bmp.bmHeight, bf);
- }
- else
- {
- BitBlt(hdc, x, y, bmp.bmWidth, bmp.bmHeight, hdc_img, 0, 0, SRCCOPY);
- }
-
- SelectObject(hdc_img, old_bmp);
- DeleteDC(hdc_img);
-
- }
-
- if (ssd->selection == index)
- {
- RECT fr;
- fr.left = BORDER + j * (ssd->max_width + BORDER) - 1;
- fr.right = fr.left + ssd->max_width + 2;
- fr.top = BORDER + i * (ssd->max_height + BORDER) - 1;
- fr.bottom = fr.top + ssd->max_height + 2;
- FrameRect(hdc, &fr, (HBRUSH) GetStockObject(GRAY_BRUSH));
- }
- }
- }
+ layout->Draw(hdc);
// Copy buffer to screen
BitBlt(hdc_orig, rc.left, rc.top, rc.right - rc.left,
- rc.bottom - rc.top, hdc, rc.left, rc.top, SRCCOPY);
+ rc.bottom - rc.top, hdc, rc.left, rc.top, SRCCOPY);
DeleteDC(hdc);
DeleteObject(hBmp);
EndPaint(hwnd, &ps);
}
-
+
return TRUE;
}
- case WM_MOUSELEAVE:
+ case WM_MOUSELEAVE:
{
TRACKMOUSEEVENT tme;
tme.cbSize = sizeof(TRACKMOUSEEVENT);
@@ -465,14 +176,14 @@ INT_PTR CALLBACK EmoticonSeletionDlgProc(HWND hwnd, UINT msg, WPARAM wParam, LPA
tme.dwHoverTime = HOVER_DEFAULT;
TrackMouseEvent(&tme);
}
- case WM_NCMOUSEMOVE:
+ case WM_NCMOUSEMOVE:
{
- EmoticonSelectionData *ssd = (EmoticonSelectionData *) GetWindowLong(hwnd, GWL_USERDATA);
- ssd->SetSelection(hwnd, -1);
+ EmoticonsSelectionLayout *layout = (EmoticonsSelectionLayout *) GetWindowLong(hwnd, GWL_USERDATA);
+ layout->SetSelection(hwnd, -1);
break;
}
- case WM_MOUSEHOVER:
+ case WM_MOUSEHOVER:
{
TRACKMOUSEEVENT tme;
tme.cbSize = sizeof(TRACKMOUSEEVENT);
@@ -481,41 +192,20 @@ INT_PTR CALLBACK EmoticonSeletionDlgProc(HWND hwnd, UINT msg, WPARAM wParam, LPA
tme.dwHoverTime = HOVER_DEFAULT;
TrackMouseEvent(&tme);
}
- case WM_MOUSEMOVE:
+ case WM_MOUSEMOVE:
{
- EmoticonSelectionData *ssd = (EmoticonSelectionData *) GetWindowLong(hwnd, GWL_USERDATA);
+ EmoticonsSelectionLayout *layout = (EmoticonsSelectionLayout *) GetWindowLong(hwnd, GWL_USERDATA);
POINT p;
p.x = LOWORD(lParam);
p.y = HIWORD(lParam);
- int col;
- if (p.x % (BORDER + ssd->max_width) < BORDER)
- col = -1;
- else
- col = p.x / (BORDER + ssd->max_width);
-
- int line;
- if (p.y % (BORDER + ssd->max_height) < BORDER)
- line = -1;
- else
- line = p.y / (BORDER + ssd->max_height);
-
- int index = line * ssd->cols + col;
-
- if (col >= 0 && line >= 0 && index < ssd->module->emoticons.getCount())
- {
- ssd->SetSelection(hwnd, index);
- }
- else
- {
- ssd->SetSelection(hwnd, -1);
- }
+ layout->SetSelection(hwnd, p);
break;
}
- case WM_GETDLGCODE:
+ case WM_GETDLGCODE:
{
if (lParam != NULL)
{
@@ -525,74 +215,31 @@ INT_PTR CALLBACK EmoticonSeletionDlgProc(HWND hwnd, UINT msg, WPARAM wParam, LPA
if (msg->message == WM_KEYDOWN && msg->time != last_time)
{
last_time = msg->time;
+ EmoticonsSelectionLayout *layout = (EmoticonsSelectionLayout *) GetWindowLong(hwnd, GWL_USERDATA);
if (msg->wParam == VK_UP)
{
- EmoticonSelectionData *ssd = (EmoticonSelectionData *) GetWindowLong(hwnd, GWL_USERDATA);
-
- if (ssd->selection < 0)
- {
- ssd->SetSelection(hwnd, (ssd->lines - 1) * ssd->cols);
- }
- else
- {
- int index = (ssd->selection - ssd->cols) % ssd->module->emoticons.getCount();
- if (index < 0)
- index += ssd->module->emoticons.getCount();
- ssd->SetSelection(hwnd, index);
- }
+ layout->OnUp(hwnd);
}
else if (msg->wParam == VK_DOWN)
{
- EmoticonSelectionData *ssd = (EmoticonSelectionData *) GetWindowLong(hwnd, GWL_USERDATA);
-
- if (ssd->selection < 0)
- {
- ssd->SetSelection(hwnd, 0);
- }
- else
- {
- ssd->SetSelection(hwnd, (ssd->selection + ssd->cols) % ssd->module->emoticons.getCount());
- }
+ layout->OnDown(hwnd);
}
else if (msg->wParam == VK_LEFT)
{
- EmoticonSelectionData *ssd = (EmoticonSelectionData *) GetWindowLong(hwnd, GWL_USERDATA);
-
- if (ssd->selection < 0)
- {
- ssd->SetSelection(hwnd, ssd->cols - 1);
- }
- else
- {
- int index = (ssd->selection - 1) % ssd->module->emoticons.getCount();
- if (index < 0)
- index += ssd->module->emoticons.getCount();
- ssd->SetSelection(hwnd, index);
- }
+ layout->OnLeft(hwnd);
}
else if (msg->wParam == VK_RIGHT)
{
- EmoticonSelectionData *ssd = (EmoticonSelectionData *) GetWindowLong(hwnd, GWL_USERDATA);
-
- if (ssd->selection < 0)
- {
- ssd->SetSelection(hwnd, 0);
- }
- else
- {
- ssd->SetSelection(hwnd, (ssd->selection + 1) % ssd->module->emoticons.getCount());
- }
+ layout->OnRight(hwnd);
}
else if (msg->wParam == VK_HOME)
{
- EmoticonSelectionData *ssd = (EmoticonSelectionData *) GetWindowLong(hwnd, GWL_USERDATA);
- ssd->SetSelection(hwnd, 0);
+ layout->SetSelection(hwnd, 0);
}
else if (msg->wParam == VK_END)
{
- EmoticonSelectionData *ssd = (EmoticonSelectionData *) GetWindowLong(hwnd, GWL_USERDATA);
- ssd->SetSelection(hwnd, ssd->module->emoticons.getCount() - 1);
+ layout->SetSelection(hwnd, layout->ssd->module->emoticons.getCount() - 1);
}
}
}
@@ -624,17 +271,17 @@ INT_PTR CALLBACK EmoticonSeletionDlgProc(HWND hwnd, UINT msg, WPARAM wParam, LPA
case WM_LBUTTONUP:
{
- EmoticonSelectionData *ssd = (EmoticonSelectionData *) GetWindowLong(hwnd, GWL_USERDATA);
- if (ssd->selection >= 0 && ssd->hwndTarget != NULL)
+ EmoticonsSelectionLayout *layout = (EmoticonsSelectionLayout *) GetWindowLong(hwnd, GWL_USERDATA);
+ if (layout->selection >= 0 && layout->ssd->hwndTarget != NULL)
{
if (opts.only_replace_isolated)
{
TCHAR tmp[16];
- mir_sntprintf(tmp, MAX_REGS(tmp), _T(" %s "), ssd->module->emoticons[ssd->selection]->texts[0]);
- SendMessage(ssd->hwndTarget, ssd->targetMessage, ssd->targetWParam, (LPARAM) tmp);
+ mir_sntprintf(tmp, MAX_REGS(tmp), _T(" %s "), layout->ssd->module->emoticons[layout->selection]->texts[0]);
+ SendMessage(layout->ssd->hwndTarget, layout->ssd->targetMessage, layout->ssd->targetWParam, (LPARAM) tmp);
}
else
- SendMessage(ssd->hwndTarget, ssd->targetMessage, ssd->targetWParam, (LPARAM) ssd->module->emoticons[ssd->selection]->texts[0]);
+ SendMessage(layout->ssd->hwndTarget, layout->ssd->targetMessage, layout->ssd->targetWParam, (LPARAM) layout->ssd->module->emoticons[layout->selection]->texts[0]);
}
PostMessage(hwnd, WM_CLOSE, 0, 0);
@@ -643,24 +290,16 @@ INT_PTR CALLBACK EmoticonSeletionDlgProc(HWND hwnd, UINT msg, WPARAM wParam, LPA
case WM_CLOSE:
{
- EmoticonSelectionData *ssd = (EmoticonSelectionData *) GetWindowLong(hwnd, GWL_USERDATA);
+ EmoticonsSelectionLayout *layout = (EmoticonsSelectionLayout *) GetWindowLong(hwnd, GWL_USERDATA);
SetWindowLong(hwnd, GWL_USERDATA, NULL);
- for(int i = 0; i < ssd->module->emoticons.getCount(); i++)
- {
- Emoticon *e = ssd->module->emoticons[i];
-
- if (e->tt != NULL)
- {
- DestroyWindow(e->tt);
- e->tt = NULL;
- }
- }
+ layout->DestroyToolTips();
DestroyWindow(hwnd);
- SetFocus(ssd->hwndTarget);
- delete ssd;
+ SetFocus(layout->ssd->hwndTarget);
+ delete layout->ssd;
+ delete layout;
break;
}
}
@@ -688,6 +327,8 @@ int ShowSelectionService(WPARAM wParam, LPARAM lParam)
Module *m = GetModule(proto);
if (m == NULL)
return FALSE;
+ else if (m->emoticons.getCount() <= 0)
+ return FALSE;
EmoticonSelectionData * ssd = new EmoticonSelectionData();
ssd->module = m;