summaryrefslogtreecommitdiff
path: root/plugins/Popup/src/skin.cpp
diff options
context:
space:
mode:
authorVadim Dashevskiy <watcherhd@gmail.com>2012-06-15 18:52:16 +0000
committerVadim Dashevskiy <watcherhd@gmail.com>2012-06-15 18:52:16 +0000
commit58973a21a30bf95427fd43c456e41e35c386218c (patch)
tree1413fba069ecd351b2c99fa5a53e52c68d8a662c /plugins/Popup/src/skin.cpp
parent55b5cf8a5506f03350e5c80ac86f5717425e4d10 (diff)
another portion of "#ifsef Unicode" removal
git-svn-id: http://svn.miranda-ng.org/main/trunk@434 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c
Diffstat (limited to 'plugins/Popup/src/skin.cpp')
-rw-r--r--plugins/Popup/src/skin.cpp115
1 files changed, 18 insertions, 97 deletions
diff --git a/plugins/Popup/src/skin.cpp b/plugins/Popup/src/skin.cpp
index c18dcde07f..6cd3f7df14 100644
--- a/plugins/Popup/src/skin.cpp
+++ b/plugins/Popup/src/skin.cpp
@@ -75,25 +75,13 @@ SIZE PopupSkin::measureAction(HDC hdc, POPUPACTION *act) const
SIZE szText, szSpace;
-#if defined(_UNICODE)
+
LPWSTR wname = mir_a2u(name);
WCHAR *str = TranslateW(wname);
GetTextExtentPoint32W(hdc, str, lstrlenW(str), &szText);
mir_free(wname);
GetTextExtentPoint32W(hdc, L" ", 1, &szSpace);
-#else
- if (g_popup.isOsUnicode && MyGetTextExtentPoint32W) {
- LPWSTR wname = mir_a2u(name);
- WCHAR *str = TranslateW(wname);
- MyGetTextExtentPoint32W(hdc, str, lstrlenW(str), &szText);
- mir_free(wname);
- }
- else {
- char *str = Translate(name);
- GetTextExtentPoint32A(hdc, str, lstrlenA(str), &szText);
- }
- GetTextExtentPoint32A(hdc, " ", 1, &szSpace);
-#endif
+
sz.cy = max(sz.cy, szText.cy);
sz.cx += szSpace.cx;
sz.cx += szText.cx;
@@ -154,7 +142,7 @@ void PopupSkin::drawAction(MyBitmap *bmp, POPUPACTION *act, int x, int y, bool h
GetTextExtentPoint32A(bmp->getDC(), " ", 1, &szSpace);
-#if defined(_UNICODE)
+
LPWSTR wname = mir_a2u(name);
WCHAR *str = TranslateW(wname);
GetTextExtentPoint32W(bmp->getDC(), str, lstrlenW(str), &szText);
@@ -165,31 +153,7 @@ void PopupSkin::drawAction(MyBitmap *bmp, POPUPACTION *act, int x, int y, bool h
y+2 + (((PopUpOptions.actions&ACT_LARGE) ? 32 : 16) - szText.cy)/2
));
mir_free(wname);
-#else
- if (g_popup.isOsUnicode && MyGetTextExtentPoint32W)
- {
- LPWSTR wname = mir_a2u(name);
- WCHAR *str = TranslateW(wname);
- MyGetTextExtentPoint32W(bmp->getDC(), str, lstrlenW(str), &szText);
- bmp->Draw_TextW(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);
- }
- else {
- char *str = Translate(name);
- GetTextExtentPoint32A(bmp->getDC(), str, lstrlenA(str), &szText);
- bmp->Draw_TextA(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
- ));
- }
-#endif
+
SelectObject(bmp->getDC(), hFntSave);
}
else {
@@ -322,22 +286,13 @@ void PopupSkin::measure(HDC hdc, PopupWnd2 *wnd, int maxw, POPUPOPTIONS *options
}
case PopupWnd2::TT_UNICODE:
{
-#if defined(_UNICODE)
+
RECT rc; SetRect(&rc, 0, 0, szNew.cx, 0);
DrawTextExW(hdc, wnd->getTextW(), lstrlenW(wnd->getTextW()), &rc,
DT_CALCRECT|DT_EXPANDTABS|DT_LEFT|DT_NOPREFIX|DT_TOP|DT_WORDBREAK/*|DT_RTLREADING*/, NULL);
szNew.cx = rc.right;
szNew.cy = rc.bottom;
-#else
- if (g_popup.isOsUnicode && MyDrawTextExW)
- {
- RECT rc; SetRect(&rc, 0, 0, szNew.cx, 0);
- MyDrawTextExW(hdc, wnd->getTextW(), lstrlenW(wnd->getTextW()), &rc,
- DT_CALCRECT|DT_EXPANDTABS|DT_LEFT|DT_NOPREFIX|DT_TOP|DT_WORDBREAK/*|DT_RTLREADING*/, NULL);
- szNew.cx = rc.right;
- szNew.cy = rc.bottom;
- }
-#endif
+
break;
}
case PopupWnd2::TT_MTEXT:
@@ -390,22 +345,13 @@ void PopupSkin::measure(HDC hdc, PopupWnd2 *wnd, int maxw, POPUPOPTIONS *options
}
case PopupWnd2::TT_UNICODE:
{
-#if defined(_UNICODE)
+
RECT rc; SetRect(&rc, 0, 0, szNew.cx, 0);
DrawTextExW(hdc, wnd->getTitleW(), lstrlenW(wnd->getTitleW()), &rc,
DT_CALCRECT|DT_EXPANDTABS|DT_LEFT|DT_NOPREFIX|DT_TOP|DT_WORDBREAK/*|DT_RTLREADING*/, NULL);
szNew.cx = rc.right;
szNew.cy = rc.bottom;
-#else
- if (g_popup.isOsUnicode && MyDrawTextExW)
- {
- RECT rc; SetRect(&rc, 0, 0, szNew.cx, 0);
- MyDrawTextExW(hdc, wnd->getTitleW(), lstrlenW(wnd->getTitleW()), &rc,
- DT_CALCRECT|DT_EXPANDTABS|DT_LEFT|DT_NOPREFIX|DT_TOP|DT_WORDBREAK/*|DT_RTLREADING*/, NULL);
- szNew.cx = rc.right;
- szNew.cy = rc.bottom;
- }
-#endif
+
break;
}
case PopupWnd2::TT_MTEXT:
@@ -665,18 +611,11 @@ void PopupSkin::display(MyBitmap *bmp, PopupWnd2 *wnd, int maxw, POPUPOPTIONS *o
}
case PopupWnd2::TT_UNICODE:
{
-#if defined(_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,
DT_EXPANDTABS|DT_LEFT|DT_NOPREFIX|DT_TOP|DT_WORDBREAK/*|DT_RTLREADING*/, NULL);
-#else
- if (g_popup.isOsUnicode && MyDrawTextExW)
- {
- RECT rc; SetRect(&rc, pos.x, pos.y, pos.x+sz.cx, pos.y+sz.cy);
- MyDrawTextExW(hdc, wnd->getTextW(), lstrlenW(wnd->getTextW()), &rc,
- DT_EXPANDTABS|DT_LEFT|DT_NOPREFIX|DT_TOP|DT_WORDBREAK/*|DT_RTLREADING*/, NULL);
- }
-#endif
+
break;
}
case PopupWnd2::TT_MTEXT:
@@ -738,22 +677,13 @@ void PopupSkin::display(MyBitmap *bmp, PopupWnd2 *wnd, int maxw, POPUPOPTIONS *o
}
case PopupWnd2::TT_UNICODE:
{
-#if defined(_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,
DT_EXPANDTABS|DT_LEFT|DT_NOPREFIX|DT_TOP|DT_WORDBREAK/*|DT_RTLREADING*/, NULL);
SelectObject(hdc, hFntSave);
-#else
- if (g_popup.isOsUnicode && MyDrawTextExW)
- {
- HFONT hFntSave = (HFONT)SelectObject(hdc, fonts.title);
- RECT rc; SetRect(&rc, pos.x, pos.y, pos.x+sz.cx, pos.y+sz.cy);
- MyDrawTextExW(hdc, wnd->getTitleW(), lstrlenW(wnd->getTitleW()), &rc,
- DT_EXPANDTABS|DT_LEFT|DT_NOPREFIX|DT_TOP|DT_WORDBREAK/*|DT_RTLREADING*/, NULL);
- SelectObject(hdc, hFntSave);
- }
-#endif
+
break;
}
case PopupWnd2::TT_MTEXT:
@@ -1153,15 +1083,10 @@ void PopupSkin::loadSkin(std::istream &f)
void PopupSkin::loadSkin(LPCTSTR fn)
{
if (!fn) return;
-#if defined (_UNICODE) && _MSC_VER <= 1200
- char* temp= mir_t2a(fn);
- std::ifstream theFile;
- theFile.open(temp, std::ios::in);
- mir_free(temp);
-#else
+
std::ifstream theFile;
theFile.open(fn, std::ios::in);
-#endif
+
if (!theFile) return;
loadSkin(theFile);
theFile.close();
@@ -1350,22 +1275,18 @@ void PopupSkin::freeSkin(SKINELEMENT *head)
void PopupSkin::saveOpts() const
{
char buf[128];
-#if defined( _UNICODE )
+
mir_snprintf(buf, sizeof(buf), "skin.%.120S", m_name);
-#else
- mir_snprintf(buf, sizeof(buf), "skin.%.120s", m_name);
-#endif
+
DBWriteContactSettingDword(NULL, MODULNAME, buf, m_flags);
}
void PopupSkin::loadOpts() const
{
char buf[128];
-#if defined( _UNICODE )
+
mir_snprintf(buf, sizeof(buf), "skin.%.120S", m_name);
-#else
- mir_snprintf(buf, sizeof(buf), "skin.%.120s", m_name);
-#endif
+
m_flags = DBGetContactSettingDword(NULL, MODULNAME, buf, m_flags);
}