summaryrefslogtreecommitdiff
path: root/plugins/Popup/src
diff options
context:
space:
mode:
authorGeorge Hazan <george.hazan@gmail.com>2014-06-11 17:50:10 +0000
committerGeorge Hazan <george.hazan@gmail.com>2014-06-11 17:50:10 +0000
commit393c8dd0345138e00b6a5a1e13b06f60c83e02e8 (patch)
treeefe30c65cd729d81af51bd2bacdd093a32d38d81 /plugins/Popup/src
parent075c7d0030e543e59adceae9e73c73cbb661482f (diff)
ansi popups dead
git-svn-id: http://svn.miranda-ng.org/main/trunk@9433 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c
Diffstat (limited to 'plugins/Popup/src')
-rw-r--r--plugins/Popup/src/actions.cpp12
-rw-r--r--plugins/Popup/src/bitmap_funcs.cpp49
-rw-r--r--plugins/Popup/src/bitmap_funcs.h15
-rw-r--r--plugins/Popup/src/common.h10
-rw-r--r--plugins/Popup/src/formula.cpp10
-rw-r--r--plugins/Popup/src/formula.h16
-rw-r--r--plugins/Popup/src/history.cpp16
-rw-r--r--plugins/Popup/src/main.cpp14
-rw-r--r--plugins/Popup/src/opt_class.cpp5
-rw-r--r--plugins/Popup/src/opttree.cpp21
-rw-r--r--plugins/Popup/src/popup_wnd2.cpp222
-rw-r--r--plugins/Popup/src/popup_wnd2.h31
-rw-r--r--plugins/Popup/src/services.cpp75
-rw-r--r--plugins/Popup/src/services.h3
-rw-r--r--plugins/Popup/src/skin.cpp172
-rw-r--r--plugins/Popup/src/skin.h6
16 files changed, 216 insertions, 461 deletions
diff --git a/plugins/Popup/src/actions.cpp b/plugins/Popup/src/actions.cpp
index 7ecfa6b41f..22c8d854a9 100644
--- a/plugins/Popup/src/actions.cpp
+++ b/plugins/Popup/src/actions.cpp
@@ -143,10 +143,6 @@ DWORD MouseOverride(HWND hCombo, int number)
// options
-#define ListView_InsertItemW(hwnd, pitem) \
- (int)SendMessageW((hwnd), LVM_INSERTITEMW, 0, (LPARAM)(const LVITEMW *)(pitem))
-
-
void LoadOption_Actions() {
PopupOptions.actions = db_get_dw(NULL, MODULNAME, "Actions",
ACT_ENABLE | ACT_RIGHTICONS | ACT_DEF_KEEPWND | ACT_DEF_IMONLY |
@@ -248,9 +244,9 @@ INT_PTR CALLBACK DlgProcPopupActions(HWND hwnd, UINT msg, WPARAM wParam, LPARAM
LVGROUP group = {0};
group.cbSize = sizeof(group);
group.mask = LVGF_HEADER | LVGF_GROUPID;
- LPWSTR wszGroup = mir_a2u(szGroup);
- group.pszHeader = TranslateW(wszGroup);
- group.cchHeader = lstrlenW(wszGroup);
+ LPTSTR wszGroup = mir_a2t(szGroup);
+ group.pszHeader = TranslateTS(wszGroup);
+ group.cchHeader = lstrlen(wszGroup);
grpId = group.iGroupId = groups.getCount();
int grpId = ListView_InsertGroup(hwndList, -1, &group);
mir_free(wszGroup);
@@ -267,7 +263,7 @@ INT_PTR CALLBACK DlgProcPopupActions(HWND hwnd, UINT msg, WPARAM wParam, LPARAM
item.mask |= LVIF_GROUPID;
item.iGroupId = grpId;
item.iIndent = 0;
- ListView_InsertItemW(hwndList, &item);
+ ListView_InsertItem(hwndList, &item);
ListView_SetItemState(hwndList, i, (gActions[i]->flags & PAF_ENABLED) ? 0x2000 : 0x1000, LVIS_STATEIMAGEMASK);
}
diff --git a/plugins/Popup/src/bitmap_funcs.cpp b/plugins/Popup/src/bitmap_funcs.cpp
index 6d819dbc16..4385def2d1 100644
--- a/plugins/Popup/src/bitmap_funcs.cpp
+++ b/plugins/Popup/src/bitmap_funcs.cpp
@@ -55,7 +55,7 @@ MyBitmap::MyBitmap(int w, int h)
allocate(w,h);
}
-MyBitmap::MyBitmap(const char *fn, const char *fnAlpha)
+MyBitmap::MyBitmap(const TCHAR *fn, const TCHAR *fnAlpha)
{
dcBmp = 0;
hBmp = 0;
@@ -660,25 +660,12 @@ void MyBitmap::DrawIcon(HICON hic, int x, int y, int w, int h)
DeleteObject(info.hbmMask);
}
-void MyBitmap::Draw_TextA(char *str, int x, int y)
+void MyBitmap::Draw_Text(TCHAR *str, int x, int y)
{
- GdiFlush();
-
- SIZE sz; GetTextExtentPoint32A(this->getDC(), str, lstrlenA(str), &sz);
- RECT rc; SetRect(&rc, x, y, x+10000, y+10000);
- this->saveAlpha(x-2,y-2,sz.cx+2,sz.cy+2);
- ::DrawTextA(this->getDC(), str, (int)strlen(str), &rc, DT_LEFT | DT_TOP | DT_SINGLELINE | DT_NOPREFIX);
- this->restoreAlpha(x-2,y-2,sz.cx+2,sz.cy+2);
- //(x,y,sz.cx,sz.cy);
-}
-
-void MyBitmap::Draw_TextW(WCHAR *str, int x, int y)
-{
-
- SIZE sz; GetTextExtentPoint32W(this->getDC(), str, lstrlenW(str), &sz);
+ SIZE sz; GetTextExtentPoint32(this->getDC(), str, lstrlen(str), &sz);
RECT rc; SetRect(&rc, x, y, x+10000, y+10000);
this->saveAlpha(x,y,sz.cx,sz.cy);
- DrawTextW(this->getDC(), str, lstrlenW(str), &rc, DT_LEFT | DT_TOP | DT_SINGLELINE | DT_NOPREFIX);
+ DrawText(this->getDC(), str, lstrlen(str), &rc, DT_LEFT | DT_TOP | DT_SINGLELINE | DT_NOPREFIX);
this->restoreAlpha(x,y,sz.cx,sz.cy);
}
@@ -764,11 +751,11 @@ static int hex2dec(char hex)
return 0;
}
-bool MyBitmap::loadFromFile_pixel(const char *fn, const char *fnAlpha)
+bool MyBitmap::loadFromFile_pixel(const TCHAR *fn, const TCHAR *fnAlpha)
{
allocate(1,1);
int r, g, b, a=255;
- const char *p = fn + lstrlenA("pixel:");
+ const TCHAR *p = fn + lstrlen(_T("pixel:"));
r = (hex2dec(p[0]) << 4) + hex2dec(p[1]);
g = (hex2dec(p[2]) << 4) + hex2dec(p[3]);
b = (hex2dec(p[4]) << 4) + hex2dec(p[5]);
@@ -776,9 +763,9 @@ bool MyBitmap::loadFromFile_pixel(const char *fn, const char *fnAlpha)
return true;
}
-bool MyBitmap::loadFromFile_gradient(const char *fn, const char *fnAlpha)
+bool MyBitmap::loadFromFile_gradient(const TCHAR *fn, const TCHAR *fnAlpha)
{
- const char *p = fn + lstrlenA("gradient:");
+ const TCHAR *p = fn + lstrlen(_T("gradient:"));
if (*p == 'h') allocate(256,1);
else allocate(1,256);
@@ -810,7 +797,7 @@ bool MyBitmap::loadFromFile_gradient(const char *fn, const char *fnAlpha)
return true;
}
-bool MyBitmap::loadFromFile_png(const char *fn, const char *fnAlpha)
+bool MyBitmap::loadFromFile_png(const TCHAR *fn, const TCHAR *fnAlpha)
{
if (ServiceExists(MS_PNG2DIB))
{
@@ -819,7 +806,7 @@ bool MyBitmap::loadFromFile_png(const char *fn, const char *fnAlpha)
long cbFileSize = 0;
BITMAPINFOHEADER *pDib;
BYTE *pDibBits;
- if ((hFile = CreateFileA(fn, GENERIC_READ, FILE_SHARE_READ, NULL, OPEN_EXISTING, 0, NULL)) != INVALID_HANDLE_VALUE)
+ if ((hFile = CreateFile(fn, GENERIC_READ, FILE_SHARE_READ, NULL, OPEN_EXISTING, 0, NULL)) != INVALID_HANDLE_VALUE)
if ((hMap = CreateFileMapping(hFile, NULL, PAGE_READONLY, 0, 0, NULL)) != NULL)
if ((ppMap = (BYTE*)MapViewOfFile( hMap, FILE_MAP_READ, 0, 0, 0 )) != NULL)
cbFileSize = GetFileSize(hFile, NULL);
@@ -885,10 +872,10 @@ bool MyBitmap::loadFromFile_png(const char *fn, const char *fnAlpha)
}
}
-bool MyBitmap::loadFromFile_default(const char *fn, const char *fnAlpha)
+bool MyBitmap::loadFromFile_default(const TCHAR *fn, const TCHAR *fnAlpha)
{
SIZE sz;
- HBITMAP hBmpLoaded = (HBITMAP)LoadImageA(NULL, fn, IMAGE_BITMAP, 0, 0, LR_LOADFROMFILE);
+ HBITMAP hBmpLoaded = (HBITMAP)LoadImage(NULL, fn, IMAGE_BITMAP, 0, 0, LR_LOADFROMFILE);
if (!hBmpLoaded)
return false;
@@ -920,22 +907,22 @@ bool MyBitmap::loadFromFile_default(const char *fn, const char *fnAlpha)
return true;
}
-bool MyBitmap::loadFromFile(const char *fn, const char *fnAlpha)
+bool MyBitmap::loadFromFile(const TCHAR *fn, const TCHAR *fnAlpha)
{
if (bits) freemem();
- if (!strncmp(fn, "pixel:", lstrlenA("pixel:")))
+ if (!_tcsncmp(fn, _T("pixel:"), lstrlen(_T("pixel:"))))
{
return loadFromFile_pixel(fn, fnAlpha);
} else
- if (!strncmp(fn, "gradient:", lstrlenA("gradient:")))
+ if (!_tcsncmp(fn, _T("gradient:"), lstrlen(_T("gradient:"))))
{
return loadFromFile_gradient(fn, fnAlpha);
} else
{
- char ext[5];
- memcpy(ext,fn+(strlen(fn)-4),5);
- if (!lstrcmpiA(ext,".png"))
+ TCHAR ext[5];
+ _tcsncpy_s(ext, SIZEOF(ext), fn + (_tcslen(fn) - 4), _TRUNCATE);
+ if (!lstrcmpi(ext, _T(".png")))
{
return loadFromFile_png(fn, fnAlpha);
} else
diff --git a/plugins/Popup/src/bitmap_funcs.h b/plugins/Popup/src/bitmap_funcs.h
index d4c8157c86..75af1de6d0 100644
--- a/plugins/Popup/src/bitmap_funcs.h
+++ b/plugins/Popup/src/bitmap_funcs.h
@@ -43,20 +43,20 @@ private:
void freemem();
- bool loadFromFile_pixel(const char *fn, const char *fnAlpha = 0);
- bool loadFromFile_gradient(const char *fn, const char *fnAlpha = 0);
- bool loadFromFile_png(const char *fn, const char *fnAlpha = 0);
- bool loadFromFile_default(const char *fn, const char *fnAlpha = 0);
+ bool loadFromFile_pixel(const TCHAR *fn, const TCHAR *fnAlpha = 0);
+ bool loadFromFile_gradient(const TCHAR *fn, const TCHAR *fnAlpha = 0);
+ bool loadFromFile_png(const TCHAR *fn, const TCHAR *fnAlpha = 0);
+ bool loadFromFile_default(const TCHAR *fn, const TCHAR *fnAlpha = 0);
void premultipleChannels();
public:
MyBitmap();
MyBitmap(int w, int h);
- MyBitmap(const char *fn, const char *fnAlpha = 0);
+ MyBitmap(const TCHAR *fn, const TCHAR *fnAlpha = 0);
~MyBitmap();
void allocate(int w, int h);
- bool loadFromFile(const char *fn, const char *fnAlpha = 0);
+ bool loadFromFile(const TCHAR *fn, const TCHAR *fnAlpha = 0);
int getWidth() { return width; }
int getHeight() { return height; }
@@ -89,8 +89,7 @@ public:
// void DrawPartColorized(MyBitmap *bmp, int x, int y, int w, int h, COLOR32 color);
void DrawIcon(HICON hic, int x, int y, int w = 0, int h = 0);
- void Draw_TextA(char *str, int x, int y);
- void Draw_TextW(WCHAR *str, int x, int y);
+ void Draw_Text(TCHAR *str, int x, int y);
__forceinline COLOR32 *getBits() { return bits; }
__forceinline COLOR32 *getRow(int row) { return bits + row * width; }
diff --git a/plugins/Popup/src/common.h b/plugins/Popup/src/common.h
index 402f9ec4b0..aa8fb83bc5 100644
--- a/plugins/Popup/src/common.h
+++ b/plugins/Popup/src/common.h
@@ -77,11 +77,11 @@ inline INT_PTR DBGetContactSettingStringX(MCONTACT hContact, const char *ModuleN
case DBVT_ASCIIZ:
ret = (INT_PTR)mir_strdup(result ? Default : dbv.pszVal);
break;
- case DBVT_WCHAR:
+ case DBVT_TCHAR:
if (!result)
- ret = (INT_PTR)mir_wstrdup(dbv.pwszVal);
+ ret = (INT_PTR)mir_tstrdup(dbv.ptszVal);
else
- ret = (INT_PTR)mir_a2u(Default);
+ ret = (INT_PTR)mir_a2t(Default);
break;
}
if (!result)
@@ -99,13 +99,13 @@ inline void AddTooltipTranslated(HWND hwndToolTip, HWND hwnd, int id, RECT rc, c
ti.uId = id;
SendMessage(hwndToolTip, TTM_DELTOOL, 0, (LPARAM) (LPTOOLINFO) &ti);
- LPWSTR wtext = mir_a2u(text);
+ LPTSTR wtext = mir_a2t(text);
ti.uFlags = TTF_SUBCLASS;
ti.hwnd = hwnd;
ti.uId = id;
ti.hinst = hInst;
- ti.lpszText = TranslateW(wtext);
+ ti.lpszText = TranslateTS(wtext);
ti.rect = rc;
SendMessage(hwndToolTip, TTM_ADDTOOL, 0, (LPARAM) (LPTOOLINFO) &ti);
diff --git a/plugins/Popup/src/formula.cpp b/plugins/Popup/src/formula.cpp
index eaeedbc261..f4f1a1b2f1 100644
--- a/plugins/Popup/src/formula.cpp
+++ b/plugins/Popup/src/formula.cpp
@@ -28,7 +28,7 @@ static inline bool myisspace(char ch)
return (ch >= 0) && (ch <= 32);
}
-int Formula::eval_neq(char *&s, Args *args, bool *vars) const
+int Formula::eval_neq(TCHAR *&s, Args *args, bool *vars) const
{
int left = eval_sum(s, args, vars);
while (*s)
@@ -56,7 +56,7 @@ int Formula::eval_neq(char *&s, Args *args, bool *vars) const
return left;
}
-int Formula::eval_sum(char *&s, Args *args, bool *vars) const
+int Formula::eval_sum(TCHAR *&s, Args *args, bool *vars) const
{
int left = eval_mul(s, args, vars);
while (*s)
@@ -80,7 +80,7 @@ int Formula::eval_sum(char *&s, Args *args, bool *vars) const
return left;
}
-int Formula::eval_mul(char *&s, Args *args, bool *vars) const
+int Formula::eval_mul(TCHAR *&s, Args *args, bool *vars) const
{
int left = eval_atom(s, args, vars);
while (*s)
@@ -110,7 +110,7 @@ int Formula::eval_mul(char *&s, Args *args, bool *vars) const
return left;
}
-int Formula::eval_atom(char *&s, Args *args, bool *vars) const
+int Formula::eval_atom(TCHAR *&s, Args *args, bool *vars) const
{
while (*s)
{
@@ -162,7 +162,7 @@ int Formula::eval_atom(char *&s, Args *args, bool *vars) const
int Formula::eval(Args *args, bool *vars) const
{
if (vars) *vars = false;
- char *s = m_str;
+ TCHAR *s = m_str;
int res = eval_neq(s, args, vars);
return res;
}
diff --git a/plugins/Popup/src/formula.h b/plugins/Popup/src/formula.h
index 974d02da35..7115b25dad 100644
--- a/plugins/Popup/src/formula.h
+++ b/plugins/Popup/src/formula.h
@@ -72,17 +72,17 @@ public:
};
private:
- char *m_str;
- int eval_neq (char *&s, Args *args, bool *vars) const;
- int eval_sum (char *&s, Args *args, bool *vars) const;
- int eval_mul (char *&s, Args *args, bool *vars) const;
- int eval_atom(char *&s, Args *args, bool *vars) const;
+ TCHAR *m_str;
+ int eval_neq (TCHAR *&s, Args *args, bool *vars) const;
+ int eval_sum(TCHAR *&s, Args *args, bool *vars) const;
+ int eval_mul(TCHAR *&s, Args *args, bool *vars) const;
+ int eval_atom(TCHAR *&s, Args *args, bool *vars) const;
public:
- Formula():m_str(mir_strdup("")) {}
- Formula(char *s):m_str(mir_strdup(s)) {}
+ Formula():m_str(mir_tstrdup(_T(""))) {}
+ Formula(TCHAR *s):m_str(mir_tstrdup(s)) {}
~Formula() {mir_free(m_str);}
- void set(char *s){mir_free(m_str);m_str=mir_strdup(s);}
+ void set(TCHAR *s){mir_free(m_str);m_str=mir_tstrdup(s);}
int eval(Args *args, bool *vars = 0) const;
};
diff --git a/plugins/Popup/src/history.cpp b/plugins/Popup/src/history.cpp
index b43fe1c7a8..b9c52023b1 100644
--- a/plugins/Popup/src/history.cpp
+++ b/plugins/Popup/src/history.cpp
@@ -77,8 +77,8 @@ void PopupHistoryAdd(POPUPDATA2 *ppdNew)
POPUPDATA2 *ppd = (POPUPDATA2*)mir_alloc( sizeof(POPUPDATA2));
*ppd = *ppdNew;
if (ppd->flags & PU2_UNICODE) {
- ppd->lpwzTitle = mir_wstrdup(ppd->lpwzTitle);
- ppd->lpwzText = mir_wstrdup(ppd->lpwzText);
+ ppd->lptzTitle = mir_tstrdup(ppd->lpwzTitle);
+ ppd->lptzText = mir_tstrdup(ppd->lptzText);
}
else {
ppd->lpzTitle = mir_strdup(ppd->lpzTitle);
@@ -188,9 +188,9 @@ static INT_PTR CALLBACK HistoryDlgProc(HWND hwnd, UINT msg, WPARAM wParam, LPARA
ieData.dwFlags = 0;
ieData.color = ppd->colorText;
if (ppd->flags & PU2_UNICODE) {
- ieData.dwFlags |= IEEDF_UNICODE_TEXT|IEEDF_UNICODE_NICK;
- ieData.pszNickW = ppd->lpwzTitle;
- ieData.pszTextW = ppd->lpwzText;
+ ieData.dwFlags |= IEEDF_UNICODE_TEXT | IEEDF_UNICODE_NICK;
+ ieData.pszNickW = ppd->lptzTitle;
+ ieData.pszTextW = ppd->lptzText;
ieData.pszText2W = NULL;
}
else {
@@ -371,9 +371,9 @@ static INT_PTR CALLBACK HistoryDlgProc(HWND hwnd, UINT msg, WPARAM wParam, LPARA
ieData.iType = IEED_EVENT_SYSTEM;
ieData.color = ppd->colorText;
if (ppd->flags & PU2_UNICODE) {
- ieData.dwFlags |= IEEDF_UNICODE_TEXT|IEEDF_UNICODE_NICK;
- ieData.pszNickW = ppd->lpwzTitle;
- ieData.pszTextW = ppd->lpwzText;
+ ieData.dwFlags |= IEEDF_UNICODE_TEXT | IEEDF_UNICODE_NICK;
+ ieData.pszNickW = ppd->lptzTitle;
+ ieData.pszTextW = ppd->lptzText;
ieData.pszText2W = NULL;
}
else {
diff --git a/plugins/Popup/src/main.cpp b/plugins/Popup/src/main.cpp
index 144b7cc9e5..57aec5bb5f 100644
--- a/plugins/Popup/src/main.cpp
+++ b/plugins/Popup/src/main.cpp
@@ -376,7 +376,6 @@ MIRAPI int Load(void)
//Service Functions
hEventNotify = CreateHookableEvent(ME_POPUP_FILTER);
- CreateServiceFunction(MS_POPUP_ADDPOPUP, Popup_AddPopup);
CreateServiceFunction(MS_POPUP_ADDPOPUPW, Popup_AddPopupW);
CreateServiceFunction(MS_POPUP_ADDPOPUP2, Popup_AddPopup2);
@@ -388,7 +387,6 @@ MIRAPI int Load(void)
CreateServiceFunction(MS_POPUP_GETCONTACT, Popup_GetContact);
CreateServiceFunction(MS_POPUP_GETPLUGINDATA, Popup_GetPluginData);
- CreateServiceFunction(MS_POPUP_SHOWMESSAGE, Popup_ShowMessage);
CreateServiceFunction(MS_POPUP_SHOWMESSAGEW, Popup_ShowMessageW);
CreateServiceFunction(MS_POPUP_QUERY, Popup_Query);
@@ -442,12 +440,12 @@ MIRAPI int Unload(void)
PopupHistoryUnload();
SrmmMenu_Unload();
- UnregisterClass (MAKEINTATOM(g_wndClass.cPopupWnd2),hInst);
- UnregisterClassW(L"PopupEditBox",hInst);
- UnregisterClass (MAKEINTATOM(g_wndClass.cPopupMenuHostWnd),hInst);
- UnregisterClass (MAKEINTATOM(g_wndClass.cPopupThreadManagerWnd),hInst);
- UnregisterClass (MAKEINTATOM(g_wndClass.cPopupPreviewBoxWndclass),hInst);
- UnregisterClass (MAKEINTATOM(g_wndClass.cPopupPlusDlgBox),hInst);
+ UnregisterClass(MAKEINTATOM(g_wndClass.cPopupWnd2), hInst);
+ UnregisterClass(_T("PopupEditBox"), hInst);
+ UnregisterClass(MAKEINTATOM(g_wndClass.cPopupMenuHostWnd), hInst);
+ UnregisterClass(MAKEINTATOM(g_wndClass.cPopupThreadManagerWnd), hInst);
+ UnregisterClass(MAKEINTATOM(g_wndClass.cPopupPreviewBoxWndclass), hInst);
+ UnregisterClass(MAKEINTATOM(g_wndClass.cPopupPlusDlgBox), hInst);
UnloadGDIPlus();
diff --git a/plugins/Popup/src/opt_class.cpp b/plugins/Popup/src/opt_class.cpp
index 47ef910b19..8289dbb279 100644
--- a/plugins/Popup/src/opt_class.cpp
+++ b/plugins/Popup/src/opt_class.cpp
@@ -37,11 +37,6 @@ int ComboBox_SelectItem(HWND hwndCtl, int indexStart, char* data) {
}
//---------------------------------------------------------------------------
-//some help function (not realy needed)
-#define ComboBox_AddStringW(hwndCtl, lpwsz) ((int)(DWORD)MySendMessageW((HWND)(hwndCtl), CB_ADDSTRING, 0L, (LPARAM)(LPCWSTR)(lpwsz)))
-#define ComboBox_SetTextW(hwndCtl, lpwsz) ((int)(DWORD)MySetWindowTextW((HWND)(hwndCtl), (LPCWSTR)(lpwsz)))
-
-//---------------------------------------------------------------------------
//Dialog Proc
struct {
diff --git a/plugins/Popup/src/opttree.cpp b/plugins/Popup/src/opttree.cpp
index 4f6e45ff22..52ead4fe51 100644
--- a/plugins/Popup/src/opttree.cpp
+++ b/plugins/Popup/src/opttree.cpp
@@ -27,22 +27,17 @@ enum { IMG_GROUP, IMG_CHECK, IMG_NOCHECK, IMG_RCHECK, IMG_NORCHECK, IMG_GRPOPEN,
static void OptTree_TranslateItem(HWND hwndTree, HTREEITEM hItem)
{
- union
- {
- char ansi[128];
- WCHAR unicode[64];
- } buf;
-
+ TCHAR buf[64];
- TVITEMW tvi = {0};
+ TVITEM tvi = {0};
tvi.mask = TVIF_HANDLE | TVIF_TEXT;
tvi.hItem = hItem;
- tvi.pszText = buf.unicode;
- tvi.cchTextMax = SIZEOF(buf.unicode);
- SendMessageW(hwndTree, TVM_GETITEMW, 0, (LPARAM)&tvi);
- tvi.pszText = TranslateW(tvi.pszText);
- tvi.cchTextMax = lstrlenW(tvi.pszText);
- SendMessageW(hwndTree, TVM_SETITEMW, 0, (LPARAM)&tvi);
+ tvi.pszText = buf;
+ tvi.cchTextMax = SIZEOF(buf);
+ SendMessage(hwndTree, TVM_GETITEMW, 0, (LPARAM)&tvi);
+ tvi.pszText = TranslateTS(tvi.pszText);
+ tvi.cchTextMax = lstrlen(tvi.pszText);
+ SendMessage(hwndTree, TVM_SETITEMW, 0, (LPARAM)&tvi);
}
void OptTree_Translate(HWND hwndTree)
diff --git a/plugins/Popup/src/popup_wnd2.cpp b/plugins/Popup/src/popup_wnd2.cpp
index 6b45ef1acc..cbfc012529 100644
--- a/plugins/Popup/src/popup_wnd2.cpp
+++ b/plugins/Popup/src/popup_wnd2.cpp
@@ -75,18 +75,14 @@ bool LoadPopupWnd2()
MessageBox(NULL, msg, _T(MODULNAME_LONG), MB_ICONSTOP|MB_OK);
}
- // register custom class for edit box with drop-shadow attribute
- #define MyRegisterClassExW RegisterClassExW
- #define MyGetClassInfoExW GetClassInfoExW
-
WNDCLASSEXW wclw = {0};
wclw.cbSize = sizeof(wclw);
- if (!MyGetClassInfoExW(NULL, L"EDIT", &wclw))
+ if (!GetClassInfoEx(NULL, _T("EDIT"), &wclw))
MSGERROR(TranslateT("Failed to GetClassInfoExW from EDIT class."));
wclw.hInstance = hInst;
- wclw.lpszClassName = L"PopupEditBox";
+ wclw.lpszClassName = _T("PopupEditBox");
wclw.style |= CS_DROPSHADOW;
- g_wndClass.cPopupEditBox = MyRegisterClassExW(&wclw);
+ g_wndClass.cPopupEditBox = RegisterClassEx(&wclw);
err = GetLastError();
if (!g_wndClass.cPopupEditBox) {
TCHAR msg[2048];
@@ -166,8 +162,7 @@ PopupWnd2::~PopupWnd2()
setIcon(NULL);
mir_free(m_lpzSkin);
- mir_free(m_lpzTitle);
- mir_free(m_lpwzTitle);
+ mir_free(m_lptzTitle);
if (m_hwnd)
SetWindowLongPtr(m_hwnd, GWLP_USERDATA, 0);
@@ -287,8 +282,8 @@ void PopupWnd2::update()
{
SetTextColor(hdc, m_clClock);
HFONT hfnSave = (HFONT)SelectObject(m_bmpBase->getDC(), fonts.clock);
- SIZE sz; GetTextExtentPoint32A(m_bmpBase->getDC(), m_time, lstrlenA(m_time), &sz);
- m_bmpBase->Draw_TextA(m_time, this->m_sz.cx - sz.cx - STYLE_SZ_GAP - skin->getRightGap(), STYLE_SZ_GAP);
+ SIZE sz; GetTextExtentPoint32(m_bmpBase->getDC(), m_time, lstrlen(m_time), &sz);
+ m_bmpBase->Draw_Text(m_time, this->m_sz.cx - sz.cx - STYLE_SZ_GAP - skin->getRightGap(), STYLE_SZ_GAP);
SelectObject(m_bmpBase->getDC(), hfnSave);
}
@@ -535,17 +530,7 @@ void PopupWnd2::hide()
// hwnd = 0;
}
-bool __forceinline isTextEmpty(char *text)
-{
- if (!text)
- return true;
- while (*text)
- if (!isspace(BYTE(*text++)))
- return false;
- return true;
-}
-
-bool __forceinline isTextEmpty(WCHAR *text)
+bool __forceinline isTextEmpty(TCHAR *text)
{
if (!text)
return true;
@@ -580,12 +565,8 @@ void PopupWnd2::fixDefaults()
m_hContact = NULL;
switch (m_textType) {
- case TT_ANSI:
- m_bTextEmpty = ::isTextEmpty(m_lpzText);
- break;
-
case TT_UNICODE:
- m_bTextEmpty = ::isTextEmpty(m_lpwzText);
+ m_bTextEmpty = ::isTextEmpty(m_lptzText);
break;
default:
@@ -751,11 +732,9 @@ void PopupWnd2::updateData(POPUPDATAW_V2 *ppd)
m_iTimeout = ppd->iSeconds ? ppd->iSeconds : m_options->Seconds;
if (m_textType == TT_NONE) m_textType = TT_UNICODE;
- mir_free(m_lpzText); mir_free(m_lpzTitle);
- mir_free(m_lpwzText); mir_free(m_lpwzTitle);
- m_lpzTitle = m_lpzText = NULL;
- m_lpwzTitle = mir_wstrdup(ppd->lpwzContactName);
- m_lpwzText = mir_wstrdup(ppd->lpwzText);
+ mir_free(m_lptzText); mir_free(m_lptzTitle);
+ m_lptzTitle = mir_tstrdup(ppd->lptzContactName);
+ m_lptzText = mir_tstrdup(ppd->lptzText);
setIcon(ppd->lchIcon);
m_hNotification = ppd->hNotification;
@@ -763,7 +742,7 @@ void PopupWnd2::updateData(POPUPDATAW_V2 *ppd)
m_PluginWindowProc = ppd->PluginWindowProc;
if (m_options->DisplayTime)
- GetTimeFormatA(LOCALE_USER_DEFAULT, 0, NULL,"HH':'mm", m_time, SIZEOF(m_time));
+ GetTimeFormat(LOCALE_USER_DEFAULT, 0, NULL, _T("HH':'mm"), m_time, SIZEOF(m_time));
else m_time[0] = 0;
fixDefaults();
@@ -780,20 +759,11 @@ void PopupWnd2::updateData(POPUPDATA2 *ppd)
m_clClock = m_clTitle = m_clText = ppd->colorText;
m_iTimeout = ppd->iSeconds;
- mir_free(m_lpzText); mir_free(m_lpzTitle);
- mir_free(m_lpwzText); mir_free(m_lpwzTitle);
+ mir_free(m_lptzText); mir_free(m_lptzTitle);
if (ppd->flags & PU2_UNICODE) {
if (m_textType == TT_NONE) m_textType = TT_UNICODE;
- m_lpzTitle = m_lpzText = NULL;
- m_lpwzTitle = mir_wstrdup(ppd->lpwzTitle);
- m_lpwzText = mir_wstrdup(ppd->lpwzText);
- m_lpzTitle = m_lpzText = NULL;
- }
- else {
- if (m_textType == TT_NONE) m_textType = TT_ANSI;
- m_lpzTitle = mir_strdup(ppd->lpzTitle);
- m_lpzText = mir_strdup(ppd->lpzText);
- m_lpwzTitle = m_lpwzText = NULL;
+ m_lptzTitle = mir_tstrdup(ppd->lptzTitle);
+ m_lptzText = mir_tstrdup(ppd->lptzText);
}
setIcon(ppd->lchIcon);
@@ -810,14 +780,14 @@ void PopupWnd2::updateData(POPUPDATA2 *ppd)
{
if (ppd->dwTimestamp)
{
- DBTIMETOSTRING dbtts;
- dbtts.szFormat = "t";
+ DBTIMETOSTRINGT dbtts;
+ dbtts.szFormat = _T("t");
dbtts.szDest = m_time;
dbtts.cbDest = SIZEOF(m_time);
- CallService(MS_DB_TIME_TIMESTAMPTOSTRING, (WPARAM)ppd->dwTimestamp, (LPARAM)&dbtts);
+ CallService(MS_DB_TIME_TIMESTAMPTOSTRINGT, (WPARAM)ppd->dwTimestamp, (LPARAM)&dbtts);
} else
{
- GetTimeFormatA(LOCALE_USER_DEFAULT, 0, NULL,"HH':'mm", m_time, SIZEOF(m_time));
+ GetTimeFormat(LOCALE_USER_DEFAULT, 0, NULL, _T("HH':'mm"), m_time, SIZEOF(m_time));
}
}
else m_time[0] = 0;
@@ -837,75 +807,31 @@ void PopupWnd2::buildMText()
if (m_mtTitle)MText.Destroy(m_mtTitle);
m_mtText = m_mtTitle = NULL;
- if (m_lpwzText && m_lpwzTitle) {
- m_textType = TT_MTEXT;
- m_mtText = MText.CreateW(htuText, m_lpwzText);
- m_mtTitle = MText.CreateW(htuTitle,m_lpwzTitle);
- }
- else if (m_lpzText && m_lpzTitle) {
+ if (m_lptzText && m_lptzTitle) {
m_textType = TT_MTEXT;
- if (ServiceExists(MS_TEXT_CREATEW)) {
- LOGFONT lf;
- LPWSTR lpwzBuf = NULL;
-
- GetObject(m_hfnText, sizeof(lf), &lf);
- lpwzBuf = mir_a2u(m_lpzText);
- m_mtText = MText.CreateW(htuText, lpwzBuf);
- mir_free(lpwzBuf); lpwzBuf = NULL;
-
- GetObject(m_hfnTitle, sizeof(lf), &lf);
- lpwzBuf = mir_a2u(m_lpzTitle);
- m_mtTitle = MText.CreateW(htuTitle, lpwzBuf);
- mir_free(lpwzBuf); lpwzBuf = NULL;
- }
- else {
- m_mtText = MText.Create(htuText, m_lpzText);
- m_mtTitle = MText.Create(htuTitle,m_lpzTitle);
- }
- }
-}
-
-void PopupWnd2::updateText(char *text)
-{
- if (m_lpzText)
- {
- mir_free(m_lpzText);
- m_lpzText = mir_strdup(text);
- if (m_textType == TT_MTEXT)
- buildMText();
- }
- m_bTextEmpty = ::isTextEmpty(m_lpzText);
-}
-
-void PopupWnd2::updateText(WCHAR *text)
-{
- if (m_lpwzText)
- {
- mir_free(m_lpwzText);
- m_lpwzText = mir_wstrdup(text);
- if (m_textType == TT_MTEXT)
- buildMText();
- }
- m_bTextEmpty = ::isTextEmpty(m_lpwzText);
+ m_mtText = MText.Create(htuText, m_lptzText);
+ m_mtTitle = MText.Create(htuTitle, m_lptzTitle);
+ }
}
-void PopupWnd2::updateTitle(char *title)
+void PopupWnd2::updateText(TCHAR *text)
{
- if (m_lpzTitle)
+ if (m_lptzText)
{
- mir_free(m_lpzTitle);
- m_lpzTitle = mir_strdup(title);
+ mir_free(m_lptzText);
+ m_lptzText = mir_tstrdup(text);
if (m_textType == TT_MTEXT)
buildMText();
}
+ m_bTextEmpty = ::isTextEmpty(m_lptzText);
}
-void PopupWnd2::updateTitle(WCHAR *title)
+void PopupWnd2::updateTitle(TCHAR *title)
{
- if (m_lpwzTitle)
+ if (m_lptzTitle)
{
- mir_free(m_lpwzTitle);
- m_lpwzTitle = mir_wstrdup(title);
+ mir_free(m_lptzTitle);
+ m_lptzTitle = mir_tstrdup(title);
if (m_textType == TT_MTEXT)
buildMText();
}
@@ -960,7 +886,7 @@ void AddMessageToDB(MCONTACT hContact, char *msg, int flag/*bool utf*/)
dbei.szModule = GetContactProto(hContact);
dbei.timestamp = time(NULL);
if ( !((flag & PREF_UTF) == PREF_UTF) && (flag & PREF_UNICODE) == PREF_UNICODE)
- dbei.cbBlob = (lstrlenW((LPWSTR)msg) + 1)*sizeof(WCHAR/*TCHAR*/);
+ dbei.cbBlob = (lstrlen((LPTSTR)msg) + 1)*sizeof(TCHAR);
else
dbei.cbBlob = lstrlenA(msg) + 1;
dbei.pBlob = (PBYTE)msg;
@@ -979,42 +905,23 @@ LRESULT CALLBACK ReplyEditWndProc(HWND hwnd, UINT message, WPARAM wParam, LPARAM
{
char *buf = NULL;
int flag = 0;
- if (IsWindowUnicode(hwnd)) {
- WCHAR msg[2048];
- LPWSTR bufW = NULL;
+ TCHAR msg[2048];
+ LPTSTR bufW = NULL;
- SendMessageW(hwnd, WM_GETTEXT, SIZEOF(msg), (LPARAM)msg);
+ SendMessage(hwnd, WM_GETTEXT, SIZEOF(msg), (LPARAM)msg);
- if (wcslen(msg)==0){
- DestroyWindow(hwnd);
- return 0;
- }
- // we have unicode message, check if it is possible and reasonable to send it as unicode
- if (IsUtfSendAvailable(dat->hContact)) {
- buf = mir_utf8encodeW(msg);
- flag = PREF_UTF;
- }
- else {
- buf = mir_u2a(msg);
- flag = 0;
- }
+ if (wcslen(msg) == 0){
+ DestroyWindow(hwnd);
+ return 0;
+ }
+ // we have unicode message, check if it is possible and reasonable to send it as unicode
+ if (IsUtfSendAvailable(dat->hContact)) {
+ buf = mir_utf8encodeT(msg);
+ flag = PREF_UTF;
}
else {
- char msg[2048];
- GetWindowTextA(hwnd, msg, SIZEOF(msg));
- if (strlen(msg)==0){
- DestroyWindow(hwnd);
- return 0;
- }
- // we have message, check if it is possible and reasonable to send it as unicode
- if ( IsUtfSendAvailable( dat->hContact )) {
- buf = mir_utf8encode(msg);
- flag = PREF_UTF;
- }
- else {
- buf = mir_strdup(msg) /*mir_tstrdup(msg)*/;
- flag = 0 /*PREF_TCHAR*/;
- }
+ buf = mir_t2a(msg);
+ flag = 0;
}
CallContactService(dat->hContact, PSS_MESSAGE, flag, (LPARAM)buf);
@@ -1045,7 +952,7 @@ LRESULT CALLBACK ReplyEditWndProc(HWND hwnd, UINT message, WPARAM wParam, LPARAM
}
if (oldWndProc)
- return CallWindowProcW(oldWndProc, hwnd, message, wParam, lParam);
+ return CallWindowProc(oldWndProc, hwnd, message, wParam, lParam);
return DefWindowProc(hwnd, message, wParam, lParam);
}
@@ -1102,22 +1009,17 @@ LRESULT CALLBACK PopupWnd2::WindowProc(UINT message, WPARAM wParam, LPARAM lPara
//MapWindowPoints(hwnd, NULL, (LPPOINT)&rc, 2);
RECT rc; GetWindowRect(m_hwnd, &rc);
- HWND hwndEditBox = CreateWindowExW(WS_EX_TOOLWINDOW|WS_EX_TOPMOST,
- g_wndClass.cPopupEditBox ? L"PopupEditBox" : L"EDIT",
+ HWND hwndEditBox = CreateWindowEx(WS_EX_TOOLWINDOW | WS_EX_TOPMOST,
+ g_wndClass.cPopupEditBox ? _T("PopupEditBox") : _T("EDIT"),
NULL,
- WS_BORDER|WS_POPUP|WS_VISIBLE|ES_AUTOVSCROLL|ES_LEFT|ES_MULTILINE|ES_NOHIDESEL|ES_WANTRETURN,
+ WS_BORDER | WS_POPUP | WS_VISIBLE | ES_AUTOVSCROLL | ES_LEFT | ES_MULTILINE | ES_NOHIDESEL | ES_WANTRETURN,
rc.left, rc.top, rc.right-rc.left, rc.bottom-rc.top, NULL, NULL, hInst, NULL);
ReplyEditData *dat = (ReplyEditData *)mir_alloc(sizeof(ReplyEditData));
dat->oldWndProc = (WNDPROC)GetWindowLongPtr(hwndEditBox, (LONG_PTR)GWLP_WNDPROC);
dat->hwndPopup = m_hwnd;
dat->hContact = m_hContact;
- if (IsWindowUnicode(hwndEditBox)) {
- SendMessageW(hwndEditBox, WM_SETFONT, (WPARAM)fonts.text, TRUE);
- }
- else {
- SendMessageA(hwndEditBox, WM_SETFONT, (WPARAM)fonts.text, TRUE);
- }
+ SendMessage(hwndEditBox, WM_SETFONT, (WPARAM)fonts.text, TRUE);
SetWindowLongPtr(hwndEditBox, GWLP_USERDATA, (LONG_PTR)dat);
SetWindowLongPtr(hwndEditBox, GWLP_WNDPROC, (LONG_PTR)ReplyEditWndProc);
SetFocus(hwndEditBox);
@@ -1170,19 +1072,11 @@ LRESULT CALLBACK PopupWnd2::WindowProc(UINT message, WPARAM wParam, LPARAM lPara
HGLOBAL clipbuffer;
static TCHAR * buffer, *text;
- char* sztext;
- if ((this->m_lpwzText) || (this->m_lpwzTitle))
+ if ((this->m_lptzText) || (this->m_lptzTitle))
{
- size_t size = _tcslen(this->m_lpwzText) + _tcslen(this->m_lpwzTitle) + 3;
+ size_t size = _tcslen(this->m_lptzText) + _tcslen(this->m_lptzTitle) + 3;
text = (TCHAR*)mir_alloc(size * sizeof(TCHAR));
- mir_sntprintf(text, size, _T("%s\n\n%s"), this->m_lpwzTitle, this->m_lpwzText);
- }
- else if ((this->m_lpzText) || (this->m_lpzTitle))
- {
- int size = lstrlenA(this->m_lpzText) + lstrlenA(this->m_lpzTitle) + 3;
- sztext = (char*)mir_alloc(size * sizeof(char));
- mir_snprintf(sztext, size, "%s\n\n%s", this->m_lpzTitle, this->m_lpzText);
- text = mir_a2t(sztext);
+ mir_sntprintf(text, size, _T("%s\n\n%s"), this->m_lptzTitle, this->m_lptzText);
}
OpenClipboard(m_hwnd);
EmptyClipboard();
@@ -1192,8 +1086,6 @@ LRESULT CALLBACK PopupWnd2::WindowProc(UINT message, WPARAM wParam, LPARAM lPara
GlobalUnlock(clipbuffer);
SetClipboardData(CF_TCHAR, clipbuffer);
CloseClipboard();
- if (sztext)
- mir_free(text);
PUDeletePopup(m_hwnd);
break;
}
@@ -1340,10 +1232,8 @@ LRESULT CALLBACK PopupWnd2::WindowProc(UINT message, WPARAM wParam, LPARAM lPara
case UM_CHANGEPOPUP:
switch (wParam) {
- case CPT_TEXT: updateText((char *)lParam); mir_free((void *)lParam); break;
- case CPT_TEXTW: updateText((WCHAR *)lParam); mir_free((void *)lParam); break;
- case CPT_TITLE: updateTitle((char *)lParam); mir_free((void *)lParam); break;
- case CPT_TITLEW: updateTitle((WCHAR *)lParam); mir_free((void *)lParam); break;
+ case CPT_TEXTW: updateText((TCHAR *)lParam); mir_free((void *)lParam); break;
+ case CPT_TITLEW: updateTitle((TCHAR *)lParam); mir_free((void *)lParam); break;
case CPT_DATAW: updateData((POPUPDATAW_V2 *)lParam); mir_free((void *)lParam); break;
}
update();
diff --git a/plugins/Popup/src/popup_wnd2.h b/plugins/Popup/src/popup_wnd2.h
index 870c00306e..3f56bb2a29 100644
--- a/plugins/Popup/src/popup_wnd2.h
+++ b/plugins/Popup/src/popup_wnd2.h
@@ -34,7 +34,7 @@ class PopupWnd2 : public MZeroedObject
{
public:
typedef LRESULT (PopupWnd2::*MethodPtr)(LPARAM lParam);
- enum TextType {TT_NONE, TT_ANSI, TT_UNICODE, TT_MTEXT};
+ enum TextType {TT_NONE, TT_UNICODE, TT_MTEXT};
struct ActionInfo
{
@@ -54,14 +54,13 @@ private:
// content
TextType m_textType;
- char *m_lpzTitle, *m_lpzText;
- WCHAR *m_lpwzTitle, *m_lpwzText;
+ TCHAR *m_lptzTitle, *m_lptzText;
HANDLE m_mtTitle, m_mtText;
bool m_bTextEmpty, m_bIcoLib;
HFONT m_hfnTitle, m_hfnText;
HICON m_hIcon;
HBITMAP m_hbmAvatar;
- char m_time[2+1+2+1];
+ TCHAR m_time[2+1+2+1];
ActionInfo* m_actions;
int m_actionCount;
HANDLE m_hNotification;
@@ -133,10 +132,8 @@ public:
void updateData(POPUPDATAW_V2 *ppd);
void updateData(POPUPDATA2 *ppd);
void buildMText();
- void updateText(char *text);
- void updateText(WCHAR *text);
- void updateTitle(char *title);
- void updateTitle(WCHAR *title);
+ void updateText(TCHAR *text);
+ void updateTitle(TCHAR *title);
void updateTimer();
@@ -150,17 +147,15 @@ public:
bool isTextEmpty() { return m_bTextEmpty; }
bool isIcolib() { return m_bIcoLib; }
TextType getTextType() { return m_textType; }
- char *getTextA() { return m_lpzText; }
- WCHAR *getTextW() { return m_lpwzText; }
+ TCHAR *getText() { return m_lptzText; }
HANDLE getTextM() { return m_mtText; }
- char *getTitleA() { return m_lpzTitle; }
- WCHAR *getTitleW() { return m_lpwzTitle; }
+ TCHAR *getTitle() { return m_lptzTitle; }
HANDLE getTitleM() { return m_mtTitle; }
int getActionCount() { return m_actionCount; }
ActionInfo *getActions() { return m_actions; }
- char *getTime() { return m_time; }
+ TCHAR *getTime() { return m_time; }
HICON getIcon() { return m_hIcon; }
MCONTACT getContact() { return m_hContact; }
MCONTACT getContactPassed() { return m_hContactPassed; }
@@ -180,7 +175,7 @@ public:
this->m_sz = sz;
if (m_hwnd)
{
- SetWindowPos(m_hwnd, 0, 0, 0, sz.cx, sz.cy, SWP_NOZORDER|SWP_NOMOVE|SWP_NOACTIVATE|SWP_DEFERERASE|SWP_NOSENDCHANGING);
+ SetWindowPos(m_hwnd, 0, 0, 0, sz.cx, sz.cy, SWP_NOZORDER | SWP_NOMOVE | SWP_NOACTIVATE | SWP_DEFERERASE | SWP_NOSENDCHANGING);
if (!m_customPopup)
PopupThreadUpdateWindow(this);
}
@@ -195,7 +190,7 @@ public:
if (m_bSlide)
m_ptPosition1 = pt;
else
- SetWindowPos(m_hwnd, 0, pt.x, pt.y, 0, 0, SWP_NOZORDER|SWP_NOSIZE|SWP_NOACTIVATE|SWP_DEFERERASE|SWP_NOSENDCHANGING);
+ SetWindowPos(m_hwnd, 0, pt.x, pt.y, 0, 0, SWP_NOZORDER | SWP_NOSIZE | SWP_NOACTIVATE | SWP_DEFERERASE | SWP_NOSENDCHANGING);
}
// Thread-related methods
@@ -216,10 +211,8 @@ public:
LRESULT m_updateData_POPUPDATAW_V2(LPARAM arg) { updateData((POPUPDATAW_V2 *)arg); update(); return 0; }
LRESULT m_updateData_POPUPDATA2(LPARAM arg) { updateData((POPUPDATA2 *)arg); update(); return 0; }
- LRESULT m_updateText(LPARAM arg) { updateText((char *)arg); update(); return 0; }
- LRESULT m_updateTextW(LPARAM arg) { updateText((WCHAR *)arg); update(); return 0; }
- LRESULT m_updateTitle(LPARAM arg) { updateTitle((char *)arg); update(); return 0; }
- LRESULT m_updateTitleW(LPARAM arg) { updateTitle((WCHAR *)arg); update(); return 0; }
+ LRESULT m_updateText(LPARAM arg) { updateText((TCHAR *)arg); update(); return 0; }
+ LRESULT m_updateTitle(LPARAM arg) { updateTitle((TCHAR *)arg); update(); return 0; }
LRESULT m_show(LPARAM arg) { show(); return 0; }
LRESULT m_hide(LPARAM arg) { hide(); return 0; }
diff --git a/plugins/Popup/src/services.cpp b/plugins/Popup/src/services.cpp
index 96ab772199..71892e3b4e 100644
--- a/plugins/Popup/src/services.cpp
+++ b/plugins/Popup/src/services.cpp
@@ -25,30 +25,6 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
int num_classes = 0; //for core class api support
-//===== Popup/AddPopup
-INT_PTR Popup_AddPopup(WPARAM wParam, LPARAM lParam)
-{
- if (!gbPopupLoaded)
- return -1;
-
- POPUPDATA *ppd = (POPUPDATA*)wParam;
- if (!ppd)
- return -1;
-
- POPUPDATA2 ppd2 = { sizeof(ppd2) };
- ppd2.flags = PU2_ANSI;
- ppd2.lchContact = ppd->lchContact;
- ppd2.lchIcon = ppd->lchIcon;
- ppd2.lpzTitle = ppd->lpzContactName;
- ppd2.lpzText = ppd->lpzText;
- ppd2.colorBack = ppd->colorBack;
- ppd2.colorText = ppd->colorText;
- ppd2.PluginWindowProc = ppd->PluginWindowProc;
- ppd2.PluginData = ppd->PluginData;
- ppd2.iSeconds = ppd->iSeconds;
- return Popup_AddPopup2((WPARAM)&ppd2, lParam);
-}
-
//===== Popup/AddPopupW
INT_PTR Popup_AddPopupW(WPARAM wParam, LPARAM lParam)
{
@@ -197,7 +173,7 @@ INT_PTR Popup_ChangeTextW(WPARAM wParam, LPARAM lParam)
if (!wnd || !IsValidPopupObject(wnd))
return -1;
- wnd->callMethodSync(&PopupWnd2::m_updateTextW, lParam);
+ wnd->callMethodSync(&PopupWnd2::m_updateText, lParam);
return 0;
}
@@ -227,43 +203,6 @@ INT_PTR Popup_Change2(WPARAM wParam, LPARAM lParam)
return 0;
}
-//===== Popup/ShowMessage
-INT_PTR Popup_ShowMessage(WPARAM wParam, LPARAM lParam) {
- if (!gbPopupLoaded || !wParam || !lParam) return -1;
- if (closing) return 0;
-
- POPUPDATA2 ppd2 = {0};
- ppd2.cbSize = sizeof(ppd2);
- ppd2.flags = PU2_ANSI;
- ppd2.lpzText = (char*)wParam;
- switch (lParam & 0x7fffffff) {
- case SM_ERROR:
- ppd2.lchIcon = IcoLib_GetIcon(ICO_MISC_ERROR,0);
- ppd2.colorBack = RGB(191,0,0);
- ppd2.colorText = RGB(255,245,225);
- ppd2.lchNotification = g_hntfError;
- ppd2.lpzTitle = Translate("Error");
- break;
- case SM_WARNING:
- ppd2.lchIcon = IcoLib_GetIcon(ICO_MISC_WARNING,0);
- ppd2.colorBack = RGB(210,210,150);
- ppd2.colorText = RGB(0,0,0);
- ppd2.lchNotification = g_hntfWarning;
- ppd2.lpzTitle = Translate("Warning");
- break;
- case SM_NOTIFY:
- ppd2.lchIcon = IcoLib_GetIcon(ICO_MISC_NOTIFY,0);
- ppd2.colorBack = RGB(230,230,230);
- ppd2.colorText = RGB(0,0,0);
- ppd2.lchNotification = g_hntfNotification;
- ppd2.lpzTitle = Translate("Notify");
- break;
- default: //No no no... you must give me a good value.
- return -1;
- }
- return Popup_AddPopup2((WPARAM)&ppd2, (LPARAM)((lParam & 0x80000000)?APF_NO_HISTORY:0));
-}
-
INT_PTR Popup_ShowMessageW(WPARAM wParam, LPARAM lParam) {
if (!gbPopupLoaded || !wParam || !lParam) return -1;
if (closing) return 0;
@@ -271,28 +210,28 @@ INT_PTR Popup_ShowMessageW(WPARAM wParam, LPARAM lParam) {
POPUPDATA2 ppd2 = {0};
ppd2.cbSize = sizeof(ppd2);
ppd2.flags = PU2_UNICODE;
- ppd2.lpwzText = (WCHAR*)wParam;
+ ppd2.lptzText = (TCHAR*)wParam;
switch (lParam&0x7fffffff) {
case SM_ERROR:
ppd2.lchIcon = IcoLib_GetIcon(ICO_MISC_ERROR,0);
ppd2.colorBack = RGB(191,0,0);
ppd2.colorText = RGB(255,245,225);
ppd2.lchNotification = g_hntfError;
- ppd2.lpwzTitle = TranslateW(L"Error");
+ ppd2.lptzTitle = TranslateT("Error");
break;
case SM_WARNING:
ppd2.lchIcon = IcoLib_GetIcon(ICO_MISC_WARNING,0);
ppd2.colorBack = RGB(210,210,150);
ppd2.colorText = RGB(0,0,0);
ppd2.lchNotification = g_hntfWarning;
- ppd2.lpwzTitle = TranslateW(L"Warning");
+ ppd2.lptzTitle = TranslateT("Warning");
break;
case SM_NOTIFY:
ppd2.lchIcon = IcoLib_GetIcon(ICO_MISC_NOTIFY,0);
ppd2.colorBack = RGB(230,230,230);
ppd2.colorText = RGB(0,0,0);
ppd2.lchNotification = g_hntfNotification;
- ppd2.lpwzTitle = TranslateW(L"Notify");
+ ppd2.lptzTitle = TranslateT("Notify");
break;
default: //No no no... you must give me a good value.
return -1;
@@ -477,8 +416,8 @@ INT_PTR Popup_CreateClassPopup(WPARAM wParam, LPARAM lParam) {
ppd2.PluginWindowProc= pc->PluginWindowProc;
if (pc->flags & PCF_UNICODE) {
ppd2.flags = PU2_UNICODE;
- ppd2.lpwzTitle = (WCHAR*)pdc->pwszTitle;
- ppd2.lpwzText = (WCHAR*)pdc->pwszText;
+ ppd2.lptzTitle = (TCHAR*)pdc->ptszTitle;
+ ppd2.lptzText = (TCHAR*)pdc->ptszText;
}
else {
ppd2.flags = PU2_ANSI;
diff --git a/plugins/Popup/src/services.h b/plugins/Popup/src/services.h
index 8dd363b679..1bd913342f 100644
--- a/plugins/Popup/src/services.h
+++ b/plugins/Popup/src/services.h
@@ -27,8 +27,6 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
extern int num_classes; //for core class api support
INT_PTR Popup_AddPopupW(WPARAM, LPARAM);
-
-INT_PTR Popup_AddPopup(WPARAM, LPARAM);
INT_PTR Popup_AddPopup2(WPARAM, LPARAM);
INT_PTR Popup_GetContact(WPARAM, LPARAM);
@@ -39,7 +37,6 @@ INT_PTR Popup_ChangeTextW(WPARAM, LPARAM);
INT_PTR Popup_ChangeW(WPARAM, LPARAM);
INT_PTR Popup_Change2(WPARAM, LPARAM);
-INT_PTR Popup_ShowMessage(WPARAM, LPARAM);
INT_PTR Popup_ShowMessageW(WPARAM, LPARAM);
INT_PTR Popup_Query(WPARAM, LPARAM);
diff --git a/plugins/Popup/src/skin.cpp b/plugins/Popup/src/skin.cpp
index 6f3d6b2670..1d775b8d95 100644
--- a/plugins/Popup/src/skin.cpp
+++ b/plugins/Popup/src/skin.cpp
@@ -61,11 +61,11 @@ SIZE PopupSkin::measureAction(HDC hdc, POPUPACTION *act) const
else ++name;
SIZE szText, szSpace;
- LPWSTR wname = mir_a2u(name);
- WCHAR *str = TranslateW(wname);
- GetTextExtentPoint32W(hdc, str, lstrlenW(str), &szText);
+ LPTSTR wname = mir_a2t(name);
+ TCHAR *str = TranslateTS(wname);
+ GetTextExtentPoint32(hdc, str, lstrlen(str), &szText);
mir_free(wname);
- GetTextExtentPoint32W(hdc, L" ", 1, &szSpace);
+ GetTextExtentPoint32(hdc, _T(" "), 1, &szSpace);
sz.cy = max(sz.cy, szText.cy);
sz.cx += szSpace.cx;
@@ -122,12 +122,12 @@ void PopupSkin::drawAction(MyBitmap *bmp, POPUPACTION *act, int x, int y, bool h
SetTextColor(bmp->getDC(), hover ? fonts.clActionHover : fonts.clAction);
SetBkMode(bmp->getDC(), TRANSPARENT);
- GetTextExtentPoint32A(bmp->getDC(), " ", 1, &szSpace);
+ GetTextExtentPoint32(bmp->getDC(), _T(" "), 1, &szSpace);
- LPWSTR wname = mir_a2u(name);
- WCHAR *str = TranslateW(wname);
- GetTextExtentPoint32W(bmp->getDC(), str, lstrlenW(str), &szText);
- bmp->Draw_TextW(str,
+ LPTSTR wname = mir_a2t(name);
+ TCHAR *str = TranslateTS(wname);
+ GetTextExtentPoint32(bmp->getDC(), str, lstrlen(str), &szText);
+ bmp->Draw_Text(str,
(PopupOptions.actions&ACT_LARGE) ? (x + szSpace.cx + 32) : (x + szSpace.cx + 16),
max(y + 2, y + 2 + (((PopupOptions.actions&ACT_LARGE) ? 32 : 16) - szText.cy) / 2));
mir_free(wname);
@@ -184,7 +184,7 @@ void PopupSkin::measure(HDC hdc, PopupWnd2 *wnd, int maxw, POPUPOPTIONS *options
SIZE szNew;
szNew.cx = head->clocksize[CLOCK_LEFT] + head->clocksize[CLOCK_RIGHT];
szNew.cy = head->myBmp->getHeight();
- for (char *p = wnd->getTime(); *p; p++) {
+ for (TCHAR *p = wnd->getTime(); *p; p++) {
if (*p == ':')
szNew.cx += head->clocksize[CLOCK_SEPARATOR];
else if ((*p >= '0') && (*p <= '9'))
@@ -196,7 +196,7 @@ void PopupSkin::measure(HDC hdc, PopupWnd2 *wnd, int maxw, POPUPOPTIONS *options
}
else { //normal clock
HFONT hfnSave = (HFONT)SelectObject(hdc, fonts.clock);
- SIZE sz; GetTextExtentPoint32A(hdc, wnd->getTime(), lstrlenA(wnd->getTime()), &sz);
+ SIZE sz; GetTextExtentPoint32(hdc, wnd->getTime(), lstrlen(wnd->getTime()), &sz);
SelectObject(hdc, hfnSave);
wnd->getArgs()->add("clock.width", sz.cx + 2 * STYLE_SZ_GAP);
wnd->getArgs()->add("clock.height", sz.cy);
@@ -236,19 +236,10 @@ void PopupSkin::measure(HDC hdc, PopupWnd2 *wnd, int maxw, POPUPOPTIONS *options
else {
HFONT hFntSave = (HFONT)SelectObject(hdc, fonts.text);
switch (wnd->getTextType()) {
- case PopupWnd2::TT_ANSI:
- {
- RECT rc; SetRect(&rc, 0, 0, szNew.cx, 0);
- DrawTextExA(hdc, wnd->getTextA(), lstrlenA(wnd->getTextA()), &rc,
- DT_CALCRECT | DT_EXPANDTABS | DT_LEFT | DT_NOPREFIX | DT_TOP | DT_WORDBREAK/*|DT_RTLREADING*/, NULL);
- szNew.cx = rc.right;
- szNew.cy = rc.bottom;
- }
- break;
case PopupWnd2::TT_UNICODE:
{
RECT rc; SetRect(&rc, 0, 0, szNew.cx, 0);
- DrawTextExW(hdc, wnd->getTextW(), lstrlenW(wnd->getTextW()), &rc,
+ DrawTextEx(hdc, wnd->getText(), lstrlen(wnd->getText()), &rc,
DT_CALCRECT | DT_EXPANDTABS | DT_LEFT | DT_NOPREFIX | DT_TOP | DT_WORDBREAK/*|DT_RTLREADING*/, NULL);
szNew.cx = rc.right;
szNew.cy = rc.bottom;
@@ -288,19 +279,10 @@ void PopupSkin::measure(HDC hdc, PopupWnd2 *wnd, int maxw, POPUPOPTIONS *options
szNew.cx = wnd->getRenderInfo()->titlew;
HFONT hFntSave = (HFONT)SelectObject(hdc, fonts.title);
switch (wnd->getTextType()) {
- case PopupWnd2::TT_ANSI:
- {
- RECT rc; SetRect(&rc, 0, 0, szNew.cx, 0);
- DrawTextExA(hdc, wnd->getTitleA(), lstrlenA(wnd->getTitleA()), &rc,
- DT_CALCRECT | DT_EXPANDTABS | DT_LEFT | DT_NOPREFIX | DT_TOP | DT_WORDBREAK/*|DT_RTLREADING*/, NULL);
- szNew.cx = rc.right;
- szNew.cy = rc.bottom;
- }
- break;
case PopupWnd2::TT_UNICODE:
{
RECT rc; SetRect(&rc, 0, 0, szNew.cx, 0);
- DrawTextExW(hdc, wnd->getTitleW(), lstrlenW(wnd->getTitleW()), &rc,
+ DrawTextEx(hdc, wnd->getTitle(), lstrlen(wnd->getTitle()), &rc,
DT_CALCRECT | DT_EXPANDTABS | DT_LEFT | DT_NOPREFIX | DT_TOP | DT_WORDBREAK/*|DT_RTLREADING*/, NULL);
szNew.cx = rc.right;
szNew.cy = rc.bottom;
@@ -351,7 +333,7 @@ void PopupSkin::measure(HDC hdc, PopupWnd2 *wnd, int maxw, POPUPOPTIONS *options
if (head && head->myBmp) {
szNew.cx = head->clocksize[CLOCK_LEFT] + head->clocksize[CLOCK_RIGHT];
szNew.cy = head->myBmp->getHeight();
- for (char *p = wnd->getTime(); *p; p++) {
+ for (TCHAR *p = wnd->getTime(); *p; p++) {
if (*p == ':')
szNew.cx += head->clocksize[CLOCK_SEPARATOR];
else if ((*p >= '0') && (*p <= '9'))
@@ -362,7 +344,7 @@ void PopupSkin::measure(HDC hdc, PopupWnd2 *wnd, int maxw, POPUPOPTIONS *options
}
else {
HFONT hfnSave = (HFONT)SelectObject(hdc, fonts.clock);
- SIZE sz; GetTextExtentPoint32A(hdc, wnd->getTime(), lstrlenA(wnd->getTime()), &sz);
+ SIZE sz; GetTextExtentPoint32(hdc, wnd->getTime(), lstrlen(wnd->getTime()), &sz);
SelectObject(hdc, hfnSave);
wnd->getArgs()->add("clock.width", sz.cx + 2 * STYLE_SZ_GAP);
wnd->getArgs()->add("clock.height", sz.cy);
@@ -446,7 +428,7 @@ void PopupSkin::display(MyBitmap *bmp, PopupWnd2 *wnd, int maxw, POPUPOPTIONS *o
SIZE szNew;
szNew.cx = head->clocksize[CLOCK_LEFT] + head->clocksize[CLOCK_RIGHT];
szNew.cy = head->myBmp->getHeight();
- for (char *p = wnd->getTime(); *p; p++) {
+ for (TCHAR *p = wnd->getTime(); *p; p++) {
if (*p == ':')
szNew.cx += head->clocksize[CLOCK_SEPARATOR];
else if ((*p >= '0') && (*p <= '9'))
@@ -456,7 +438,7 @@ void PopupSkin::display(MyBitmap *bmp, PopupWnd2 *wnd, int maxw, POPUPOPTIONS *o
}
else {
HFONT hfnSave = (HFONT)SelectObject(hdc, fonts.clock);
- SIZE sz; GetTextExtentPoint32A(hdc, wnd->getTime(), lstrlenA(wnd->getTime()), &sz);
+ SIZE sz; GetTextExtentPoint32(hdc, wnd->getTime(), lstrlen(wnd->getTime()), &sz);
SelectObject(hdc, hfnSave);
STYLE_SZ_CLOCK = sz.cx + 2 * STYLE_SZ_GAP;
}
@@ -517,17 +499,10 @@ void PopupSkin::display(MyBitmap *bmp, PopupWnd2 *wnd, int maxw, POPUPOPTIONS *o
HFONT hFntSave = (HFONT)SelectObject(hdc, fonts.text);
bmp->saveAlpha();
switch (wnd->getTextType()) {
- case PopupWnd2::TT_ANSI:
- {
- RECT rc; SetRect(&rc, pos.x, pos.y, pos.x + sz.cx, pos.y + sz.cy);
- DrawTextExA(hdc, wnd->getTextA(), lstrlenA(wnd->getTextA()), &rc,
- DT_EXPANDTABS | DT_LEFT | DT_NOPREFIX | DT_TOP | DT_WORDBREAK/*|DT_RTLREADING*/, NULL);
- }
- break;
case PopupWnd2::TT_UNICODE:
{
RECT rc; SetRect(&rc, pos.x, pos.y, pos.x + sz.cx, pos.y + sz.cy);
- DrawTextExW(hdc, wnd->getTextW(), lstrlenW(wnd->getTextW()), &rc,
+ DrawTextEx(hdc, wnd->getText(), lstrlen(wnd->getText()), &rc,
DT_EXPANDTABS | DT_LEFT | DT_NOPREFIX | DT_TOP | DT_WORDBREAK/*|DT_RTLREADING*/, NULL);
}
break;
@@ -572,20 +547,11 @@ void PopupSkin::display(MyBitmap *bmp, PopupWnd2 *wnd, int maxw, POPUPOPTIONS *o
sz.cy = 1000;
switch (wnd->getTextType()) {
- case PopupWnd2::TT_ANSI:
- {
- HFONT hFntSave = (HFONT)SelectObject(hdc, fonts.title);
- RECT rc; SetRect(&rc, pos.x, pos.y, pos.x + sz.cx, pos.y + sz.cy);
- DrawTextExA(hdc, wnd->getTitleA(), lstrlenA(wnd->getTitleA()), &rc,
- DT_EXPANDTABS | DT_LEFT | DT_NOPREFIX | DT_TOP | DT_WORDBREAK/*|DT_RTLREADING*/, NULL);
- SelectObject(hdc, hFntSave);
- }
- break;
case PopupWnd2::TT_UNICODE:
{
HFONT hFntSave = (HFONT)SelectObject(hdc, fonts.title);
RECT rc; SetRect(&rc, pos.x, pos.y, pos.x + sz.cx, pos.y + sz.cy);
- DrawTextExW(hdc, wnd->getTitleW(), lstrlenW(wnd->getTitleW()), &rc,
+ DrawTextEx(hdc, wnd->getTitle(), lstrlen(wnd->getTitle()), &rc,
DT_EXPANDTABS | DT_LEFT | DT_NOPREFIX | DT_TOP | DT_WORDBREAK/*|DT_RTLREADING*/, NULL);
SelectObject(hdc, hFntSave);
}
@@ -697,7 +663,7 @@ void PopupSkin::display(MyBitmap *bmp, PopupWnd2 *wnd, int maxw, POPUPOPTIONS *o
bmp->BlendPart(head->myBmp, head->clockstart[CLOCK_LEFT], 0, head->clocksize[CLOCK_LEFT], sy, x, y, head->clocksize[CLOCK_LEFT], sy);
x += head->clocksize[CLOCK_LEFT];
- for (char *p = wnd->getTime(); *p; p++) {
+ for (TCHAR *p = wnd->getTime(); *p; p++) {
int clock_idx = -1;
if (*p == ':')
clock_idx = CLOCK_SEPARATOR;
@@ -725,8 +691,8 @@ void PopupSkin::display(MyBitmap *bmp, PopupWnd2 *wnd, int maxw, POPUPOPTIONS *o
SetTextColor(hdc, wnd->getClockColor());
HFONT hfnSave = (HFONT)SelectObject(bmp->getDC(), fonts.clock);
- SIZE sz; GetTextExtentPoint32A(bmp->getDC(), wnd->getTime(), lstrlenA(wnd->getTime()), &sz);
- bmp->Draw_TextA(wnd->getTime(), x, y);
+ SIZE sz; GetTextExtentPoint32(bmp->getDC(), wnd->getTime(), lstrlen(wnd->getTime()), &sz);
+ bmp->Draw_Text(wnd->getTime(), x, y);
SelectObject(bmp->getDC(), hfnSave);
}
break;
@@ -775,35 +741,35 @@ bool PopupSkin::onMouseLeave(PopupWnd2 *wnd) const
return res;
}
-void PopupSkin::loadOptions(std::istream &f)
+void PopupSkin::loadOptions(std::wistream &f)
{
- char *buf = new char[1024];
+ TCHAR *buf = new TCHAR[1024];
while (!f.eof()) {
f >> buf;
if (*buf == '#') {
f.ignore(1024, '\n');
continue;
}
- if (!strcmp(buf, "option")) {
+ if (!lstrcmp(buf, _T("option"))) {
int id, val;
f >> id >> val;
f.getline(buf, 1024);
id--;
if (m_flag_names[id])
mir_free(m_flag_names[id]);
- char *p = buf;
+ TCHAR *p = buf;
while (isspace(*p))
p++;
- char *q = p + lstrlenA(p) - 1;
+ TCHAR *q = p + lstrlen(p) - 1;
while ((q >= p) && isspace(*q))
*q-- = 0;
- m_flag_names[id] = mir_strdup(p);
+ m_flag_names[id] = mir_t2a(p);
if (val)
m_flags |= 1 << id;
else
m_flags &= ~(1 << id);
}
- else if (!strcmp(buf, "end"))
+ else if (!lstrcmp(buf, _T("end")))
break;
}
delete[] buf;
@@ -827,8 +793,8 @@ bool PopupSkin::load(LPCTSTR dir)
GetCurrentDirectory(1024, dir_save);
SetCurrentDirectory(dir);
- std::ifstream theFile;
- theFile.open("popupskin.config", std::ios::in);
+ std::wifstream theFile;
+ theFile.open("popupskin.config", std::wios::in);
if (theFile) {
loadOptions(theFile);
theFile.close();
@@ -852,7 +818,7 @@ bool PopupSkin::load(LPCTSTR dir)
return true;
}
-void PopupSkin::loadSkin(std::istream &f)
+void PopupSkin::loadSkin(std::wistream &f)
{
m_bottom_gap = m_right_gap = 0;
m_legacy_region_opacity = 64;
@@ -866,7 +832,7 @@ void PopupSkin::loadSkin(std::istream &f)
head->next = NULL;
while (!f.eof()) {
- char buf[1024];
+ TCHAR buf[1024];
f >> buf;
if (!*buf)
@@ -877,40 +843,40 @@ void PopupSkin::loadSkin(std::istream &f)
continue;
}
- if (!lstrcmpA(buf, "popup-version")) {
+ if (!lstrcmp(buf, _T("popup-version"))) {
f >> m_popup_version;
m_popup_version = PLUGIN_MAKE_VERSION((m_popup_version / 1000000) % 100, (m_popup_version / 10000) % 100, (m_popup_version / 100) % 100, (m_popup_version / 1) % 100);
if (!isCompatible())
break;
}
- else if (!lstrcmpA(buf, "padding-right")) {
+ else if (!lstrcmp(buf, _T("padding-right"))) {
f >> m_right_gap;
}
- else if (!lstrcmpA(buf, "padding-bottom")) {
+ else if (!lstrcmp(buf, _T("padding-bottom"))) {
f >> m_bottom_gap;
}
- else if (!lstrcmpA(buf, "shadow-region-opacity")) {
+ else if (!lstrcmp(buf, _T("shadow-region-opacity"))) {
f >> m_shadow_region_opacity;
}
- else if (!lstrcmpA(buf, "legacy-region-opacity")) {
+ else if (!lstrcmp(buf, _T("legacy-region-opacity"))) {
f >> m_legacy_region_opacity;
}
- else if (!lstrcmpA(buf, "w")) {
+ else if (!lstrcmp(buf, _T("w"))) {
f.getline(buf, 1024);
m_fw.set(buf);
}
- else if (!lstrcmpA(buf, "h")) {
+ else if (!lstrcmp(buf, _T("h"))) {
f.getline(buf, 1024);
m_fh.set(buf);
}
- else if (!lstrcmpA(buf, "object")) {
+ else if (!lstrcmp(buf, _T("object"))) {
head->next = loadObject(f);
if (head->next && ((head->next->type & ST_TYPEMASK) == ST_CLOCK))
m_internalClock = false;
head = head->next;
head->next = NULL;
}
- else if (!lstrcmpA(buf, "options")) {
+ else if (!lstrcmp(buf, _T("options"))) {
loadOptions(f);
}
}
@@ -924,8 +890,8 @@ void PopupSkin::loadSkin(LPCTSTR fn)
{
if (!fn) return;
- std::ifstream theFile;
- theFile.open(fn, std::ios::in);
+ std::wifstream theFile;
+ theFile.open(fn, std::wios::in);
if (!theFile) return;
loadSkin(theFile);
@@ -937,13 +903,13 @@ void PopupSkin::loadSkin(LPCTSTR lpName, LPCTSTR lpType)
HRSRC hRes = FindResource(hInst, lpName, lpType);
HRSRC hResLoad = (HRSRC)LoadResource(hInst, hRes);
char *lpResLock = (char *)LockResource(hResLoad);
- std::istringstream stream(lpResLock);
+ std::wistringstream stream((TCHAR*)_A2T(lpResLock));
loadSkin(stream);
UnlockResource(lpResLock);
FreeResource(hRes);
}
-PopupSkin::SKINELEMENT *PopupSkin::loadObject(std::istream &f)
+PopupSkin::SKINELEMENT *PopupSkin::loadObject(std::wistream &f)
{
SKINELEMENT *element = new SKINELEMENT;
element->proportional = 0;
@@ -954,7 +920,7 @@ PopupSkin::SKINELEMENT *PopupSkin::loadObject(std::istream &f)
element->myBmp = NULL;
while (!f.eof()) {
- char buf[1024];
+ TCHAR buf[1024];
f >> buf;
if (!*buf)
@@ -965,80 +931,80 @@ PopupSkin::SKINELEMENT *PopupSkin::loadObject(std::istream &f)
continue;
}
- if (!lstrcmpA(buf, "type")) {
+ if (!lstrcmp(buf, _T("type"))) {
f >> buf;
- if (!lstrcmpA(buf, "icon"))
+ if (!lstrcmp(buf, _T("icon")))
element->type = (element->type & ~ST_TYPEMASK) | ST_ICON;
- else if (!lstrcmpA(buf, "bitmap"))
+ else if (!lstrcmp(buf, _T("bitmap")))
element->type = (element->type & ~ST_TYPEMASK) | ST_MYBITMAP;
- else if (!lstrcmpA(buf, "text")) {
+ else if (!lstrcmp(buf, _T("text"))) {
element->type = (element->type & ~ST_TYPEMASK) | ST_TEXT;
element->textColor = (COLORREF)0xffffffff;
element->hfn = 0;
}
- else if (!lstrcmpA(buf, "title")) {
+ else if (!lstrcmp(buf, _T("title"))) {
element->type = (element->type & ~ST_TYPEMASK) | ST_TITLE;
element->textColor = (COLORREF)0xffffffff;
element->hfn = 0;
}
- else if (!lstrcmpA(buf, "avatar")) {
+ else if (!lstrcmp(buf, _T("avatar"))) {
element->type = (element->type & ~ST_TYPEMASK) | ST_AVATAR;
}
- else if (!lstrcmpA(buf, "clock")) {
+ else if (!lstrcmp(buf, _T("clock"))) {
element->type = (element->type & ~ST_TYPEMASK) | ST_CLOCK;
element->textColor = (COLORREF)0xffffffff;
element->hfn = 0;
}
}
- else if (!lstrcmpA(buf, "source")) {
+ else if (!lstrcmp(buf, _T("source"))) {
f >> buf;
if (((element->type & ST_TYPEMASK) == ST_MYBITMAP) || ((element->type & ST_TYPEMASK) == ST_CLOCK)) {
- char *alpha = mir_strdup(buf);
- alpha[strlen(alpha) - 1] = 'a';
+ TCHAR *alpha = mir_tstrdup(buf);
+ alpha[lstrlen(alpha) - 1] = 'a';
element->myBmp = new MyBitmap(buf, alpha);
mir_free(alpha);
}
}
- else if (!lstrcmpA(buf, "mono")) {
+ else if (!lstrcmp(buf, _T("mono"))) {
element->type |= ST_MONO;
}
- else if (!lstrcmpA(buf, "layer")) {
+ else if (!lstrcmp(buf, _T("layer"))) {
element->type |= ST_BLEND;
}
- else if (!lstrcmpA(buf, "proportional")) {
+ else if (!lstrcmp(buf, _T("proportional"))) {
f >> element->proportional;
}
- else if (!lstrcmpA(buf, "x")) {
+ else if (!lstrcmp(buf, _T("x"))) {
f.getline(buf, 1024);
element->fx.set(buf);
element->type &= ~ST_BADPOS;
}
- else if (!lstrcmpA(buf, "y")) {
+ else if (!lstrcmp(buf, _T("y"))) {
f.getline(buf, 1024);
element->fy.set(buf);
element->type &= ~ST_BADPOS;
}
- else if (!lstrcmpA(buf, "w")) {
+ else if (!lstrcmp(buf, _T("w"))) {
f.getline(buf, 1024);
element->fw.set(buf);
}
- else if (!lstrcmpA(buf, "h")) {
+ else if (!lstrcmp(buf, _T("h"))) {
f.getline(buf, 1024);
element->fh.set(buf);
}
- else if (!lstrcmpA(buf, "ifset")) {
+ else if (!lstrcmp(buf, _T("ifset"))) {
int id;
f >> id; id--;
element->flag_mask |= 1 << id;
element->flags |= 1 << id;
}
- else if (!lstrcmpA(buf, "ifnotset")) {
+ else if (!lstrcmp(buf, _T("ifnotset"))) {
int id;
f >> id; id--;
element->flag_mask |= 1 << id;
element->flags &= ~(1 << id);
}
- else if (!lstrcmpA(buf, "color")) {
+ else if (!lstrcmp(buf, _T("color"))) {
if (((element->type & ST_TYPEMASK) != ST_TEXT) &&
((element->type & ST_TYPEMASK) != ST_TITLE) &&
((element->type & ST_TYPEMASK) != ST_CLOCK)) continue;
@@ -1047,7 +1013,7 @@ PopupSkin::SKINELEMENT *PopupSkin::loadObject(std::istream &f)
f >> r >> g >> b;
element->textColor = RGB(r, g, b);
}
- else if (!lstrcmpA(buf, "clocksize")) {
+ else if (!lstrcmp(buf, _T("clocksize"))) {
element->clockstart[0] = 0;
f >> element->clocksize[0];
for (int i = 1; i < CLOCK_ITEMS; i++) {
@@ -1055,7 +1021,7 @@ PopupSkin::SKINELEMENT *PopupSkin::loadObject(std::istream &f)
f >> element->clocksize[i];
}
}
- else if (!lstrcmpA(buf, "end")) {
+ else if (!lstrcmp(buf, _T("end"))) {
break;
}
}
diff --git a/plugins/Popup/src/skin.h b/plugins/Popup/src/skin.h
index 6f66b54187..f6d95da214 100644
--- a/plugins/Popup/src/skin.h
+++ b/plugins/Popup/src/skin.h
@@ -110,9 +110,9 @@ private:
char *m_flag_names[32];
mutable unsigned long m_flags;
- void loadOptions(std::istream &f);
- SKINELEMENT *loadObject(std::istream &f);
- void loadSkin(std::istream &f);
+ void loadOptions(std::wistream &f);
+ SKINELEMENT *loadObject(std::wistream &f);
+ void loadSkin(std::wistream &f);
void loadSkin(LPCTSTR fn);
void loadSkin(LPCTSTR lpName, LPCTSTR lpType);