diff options
-rw-r--r-- | plugins/TopToolBar/CLCButton.cpp | 242 | ||||
-rw-r--r-- | plugins/TopToolBar/InternalButtons.cpp | 32 | ||||
-rw-r--r-- | plugins/TopToolBar/TopToolBar.vcxproj | 8 | ||||
-rw-r--r-- | plugins/TopToolBar/button.cpp | 27 | ||||
-rw-r--r-- | plugins/TopToolBar/common.h | 36 | ||||
-rw-r--r-- | plugins/TopToolBar/launchbt.cpp | 75 | ||||
-rw-r--r-- | plugins/TopToolBar/main.cpp | 143 | ||||
-rw-r--r-- | plugins/TopToolBar/main.rc | 92 | ||||
-rw-r--r-- | plugins/TopToolBar/separators.cpp | 6 | ||||
-rw-r--r-- | plugins/TopToolBar/ttbopt.cpp | 268 |
10 files changed, 436 insertions, 493 deletions
diff --git a/plugins/TopToolBar/CLCButton.cpp b/plugins/TopToolBar/CLCButton.cpp index 7993a085c9..d4078129ca 100644 --- a/plugins/TopToolBar/CLCButton.cpp +++ b/plugins/TopToolBar/CLCButton.cpp @@ -5,7 +5,7 @@ Copyright (C) 2002 Robert Rainwater This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 -of the License, or (at your option) any later version. +of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of @@ -13,17 +13,17 @@ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License -along with this program; if not, write to the Free Software -Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. +along with this program; if not, write to the Free Software +Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ #include "common.h" // TODO: // - Support for bitmap buttons (simple call to DrawIconEx()) extern HINSTANCE hInst; -LONG g_cxsmIcon, g_cysmIcon; +LONG g_cxsmIcon, g_cysmIcon; -static LRESULT CALLBACK TSButtonWndProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam); +static LRESULT CALLBACK TSButtonWndProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam); struct MButtonCtrl { @@ -33,7 +33,7 @@ struct MButtonCtrl HFONT hFont; // font HICON arrow; // uses down arrow int defbutton; // default button - HICON hIcon, hIconPrivate; + HICON hIcon, hIconPrivate; HBITMAP hBitmap; int pushBtn; int pbState; @@ -50,15 +50,15 @@ struct MButtonCtrl // External theme methods and properties static HMODULE themeAPIHandle = NULL; // handle to uxtheme.dll -static HANDLE (WINAPI *MyOpenThemeData)(HWND, LPCWSTR); +static HANDLE (WINAPI *MyOpenThemeData)(HWND, LPCWSTR); static HRESULT (WINAPI *MyCloseThemeData)(HANDLE); -static BOOL (WINAPI *MyIsThemeBackgroundPartiallyTransparent)(HANDLE, int, +static BOOL (WINAPI *MyIsThemeBackgroundPartiallyTransparent)(HANDLE, int, int); -static HRESULT (WINAPI *MyDrawThemeParentBackground)(HWND, HDC, RECT *); -static HRESULT (WINAPI *MyDrawThemeBackground)(HANDLE, HDC, int, int, - const RECT *, const RECT *); -static HRESULT (WINAPI *MyDrawThemeText)(HANDLE, HDC, int, int, LPCWSTR, int, - DWORD, DWORD, const RECT *); +static HRESULT (WINAPI *MyDrawThemeParentBackground)(HWND, HDC, RECT *); +static HRESULT (WINAPI *MyDrawThemeBackground)(HANDLE, HDC, int, int, + const RECT *, const RECT *); +static HRESULT (WINAPI *MyDrawThemeText)(HANDLE, HDC, int, int, LPCWSTR, int, + DWORD, DWORD, const RECT *); static CRITICAL_SECTION csTips; static HWND hwndToolTips = NULL; @@ -74,12 +74,12 @@ static int ThemeSupport() if (!themeAPIHandle) { themeAPIHandle = GetModuleHandleA("uxtheme"); if (themeAPIHandle) { - MyOpenThemeData = (HANDLE(WINAPI *)(HWND, LPCWSTR))MGPROC("OpenThemeData"); + MyOpenThemeData = (HANDLE(WINAPI *)(HWND, LPCWSTR))MGPROC("OpenThemeData"); MyCloseThemeData = (HRESULT(WINAPI *)(HANDLE))MGPROC("CloseThemeData"); - MyIsThemeBackgroundPartiallyTransparent = (BOOL(WINAPI *)(HANDLE, int, int))MGPROC("IsThemeBackgroundPartiallyTransparent"); - MyDrawThemeParentBackground = (HRESULT(WINAPI *)(HWND, HDC, RECT *))MGPROC("DrawThemeParentBackground"); - MyDrawThemeBackground = (HRESULT(WINAPI *)(HANDLE, HDC, int, int, const RECT *, const RECT *))MGPROC("DrawThemeBackground"); - MyDrawThemeText = (HRESULT(WINAPI *)(HANDLE, HDC, int, int, LPCWSTR, int, DWORD, DWORD, const RECT *))MGPROC("DrawThemeText"); + MyIsThemeBackgroundPartiallyTransparent = (BOOL(WINAPI *)(HANDLE, int, int))MGPROC("IsThemeBackgroundPartiallyTransparent"); + MyDrawThemeParentBackground = (HRESULT(WINAPI *)(HWND, HDC, RECT *))MGPROC("DrawThemeParentBackground"); + MyDrawThemeBackground = (HRESULT(WINAPI *)(HANDLE, HDC, int, int, const RECT *, const RECT *))MGPROC("DrawThemeBackground"); + MyDrawThemeText = (HRESULT(WINAPI *)(HANDLE, HDC, int, int, LPCWSTR, int, DWORD, DWORD, const RECT *))MGPROC("DrawThemeText"); } } // Make sure all of these methods are valid (i would hope either all or none work) @@ -107,8 +107,8 @@ static void LoadTheme(MButtonCtrl *ctl) { if (ThemeSupport()) { DestroyTheme(ctl); - ctl->hThemeButton = MyOpenThemeData(ctl->hwnd, L"BUTTON"); - ctl->hThemeToolbar = MyOpenThemeData(ctl->hwnd, L"TOOLBAR"); + ctl->hThemeButton = MyOpenThemeData(ctl->hwnd, L"BUTTON"); + ctl->hThemeToolbar = MyOpenThemeData(ctl->hwnd, L"TOOLBAR"); ctl->bThemed = TRUE; } } @@ -125,19 +125,19 @@ static int TBStateConvert2Flat(int state) return TS_NORMAL; } -static void PaintWorker(MButtonCtrl *ctl, HDC hdcPaint) +static void PaintWorker(MButtonCtrl *ctl, HDC hdcPaint) { - if (hdcPaint == NULL) + if (hdcPaint == NULL) return; HFONT hOldFont = NULL; RECT rcClient; - GetClientRect(ctl->hwnd, &rcClient); + GetClientRect(ctl->hwnd, &rcClient); HDC hdcMem = CreateCompatibleDC(hdcPaint); - HBITMAP hbmMem = CreateCompatibleBitmap(hdcPaint, rcClient.right - rcClient.left, rcClient.bottom - rcClient.top); - HDC hOld = (HDC)SelectObject(hdcMem, hbmMem); + HBITMAP hbmMem = CreateCompatibleBitmap(hdcPaint, rcClient.right - rcClient.left, rcClient.bottom - rcClient.top); + HDC hOld = (HDC)SelectObject(hdcMem, hbmMem); - // If its a push button, check to see if it should stay pressed + // If its a push button, check to see if it should stay pressed if (ctl->pushBtn && ctl->pbState) ctl->stateId = PBS_PRESSED; @@ -146,10 +146,10 @@ static void PaintWorker(MButtonCtrl *ctl, HDC hdcPaint) if (ctl->hThemeToolbar && ctl->bThemed) { RECT rc = rcClient; int state = IsWindowEnabled(ctl->hwnd) ? (ctl->stateId == PBS_NORMAL && ctl->defbutton ? PBS_DEFAULTED : ctl->stateId) : PBS_DISABLED; - if (MyIsThemeBackgroundPartiallyTransparent(ctl->hThemeToolbar, TP_BUTTON, TBStateConvert2Flat(state))) - MyDrawThemeParentBackground(ctl->hwnd, hdcMem, &rc); + if (MyIsThemeBackgroundPartiallyTransparent(ctl->hThemeToolbar, TP_BUTTON, TBStateConvert2Flat(state))) + MyDrawThemeParentBackground(ctl->hwnd, hdcMem, &rc); - MyDrawThemeBackground(ctl->hThemeToolbar, hdcMem, TP_BUTTON, TBStateConvert2Flat(state), &rc, &rc); + MyDrawThemeBackground(ctl->hThemeToolbar, hdcMem, TP_BUTTON, TBStateConvert2Flat(state), &rc, &rc); } else { HBRUSH hbr; @@ -160,113 +160,111 @@ static void PaintWorker(MButtonCtrl *ctl, HDC hdcPaint) else { HWND hwndParent = GetParent(ctl->hwnd); HDC dc = GetDC(hwndParent); - hbr = (HBRUSH) SendMessage(hwndParent, WM_CTLCOLORDLG, (WPARAM) dc, (LPARAM) hwndParent); - ReleaseDC(hwndParent, dc); + hbr = (HBRUSH) SendMessage(hwndParent, WM_CTLCOLORDLG, (WPARAM) dc, (LPARAM) hwndParent); + ReleaseDC(hwndParent, dc); } if (hbr) { - FillRect(hdcMem, &rc, hbr); + FillRect(hdcMem, &rc, hbr); DeleteObject(hbr); } if (ctl->stateId == PBS_HOT || ctl->focus) { if (ctl->pbState) - DrawEdge(hdcMem, &rc, EDGE_ETCHED, BF_RECT | BF_SOFT); + DrawEdge(hdcMem, &rc, EDGE_ETCHED, BF_RECT | BF_SOFT); else - DrawEdge(hdcMem, &rc, BDR_RAISEDOUTER, BF_RECT | BF_SOFT); + DrawEdge(hdcMem, &rc, BDR_RAISEDOUTER, BF_RECT | BF_SOFT); } - else if (ctl->stateId == PBS_PRESSED) - DrawEdge(hdcMem, &rc, BDR_SUNKENOUTER, BF_RECT | BF_SOFT); + else if (ctl->stateId == PBS_PRESSED) + DrawEdge(hdcMem, &rc, BDR_SUNKENOUTER, BF_RECT | BF_SOFT); } } else { // Draw background/border if (ctl->hThemeButton && ctl->bThemed) { int state = IsWindowEnabled(ctl->hwnd) ? (ctl->stateId == PBS_NORMAL && ctl->defbutton ? PBS_DEFAULTED : ctl->stateId) : PBS_DISABLED; - if (MyIsThemeBackgroundPartiallyTransparent(ctl->hThemeButton, BP_PUSHBUTTON, state)) { - MyDrawThemeParentBackground(ctl->hwnd, hdcMem, &rcClient); + if (MyIsThemeBackgroundPartiallyTransparent(ctl->hThemeButton, BP_PUSHBUTTON, state)) { + MyDrawThemeParentBackground(ctl->hwnd, hdcMem, &rcClient); } - MyDrawThemeBackground(ctl->hThemeButton, hdcMem, BP_PUSHBUTTON, state, &rcClient, &rcClient); + MyDrawThemeBackground(ctl->hThemeButton, hdcMem, BP_PUSHBUTTON, state, &rcClient, &rcClient); } else { UINT uState = DFCS_BUTTONPUSH | ((ctl->stateId == PBS_HOT) ? DFCS_HOT : 0) | ((ctl->stateId == PBS_PRESSED) ? DFCS_PUSHED : 0); if (ctl->defbutton && ctl->stateId == PBS_NORMAL) uState |= DLGC_DEFPUSHBUTTON; - DrawFrameControl(hdcMem, &rcClient, DFC_BUTTON, uState); + DrawFrameControl(hdcMem, &rcClient, DFC_BUTTON, uState); } // Draw focus rectangle if button has focus if (ctl->focus) { RECT focusRect = rcClient; - InflateRect(&focusRect, -3, -3); - DrawFocusRect(hdcMem, &focusRect); + InflateRect(&focusRect, -3, -3); + DrawFocusRect(hdcMem, &focusRect); } } - // If we have an icon or a bitmap, ignore text and only draw the image on the button + // If we have an icon or a bitmap, ignore text and only draw the image on the button if (ctl->hIcon || ctl->hIconPrivate || ctl->iIcon) { int ix = (rcClient.right - rcClient.left) / 2 - (g_cxsmIcon / 2); int iy = (rcClient.bottom - rcClient.top) / 2 - (g_cxsmIcon / 2); HICON hIconNew = ctl->hIconPrivate != 0 ? ctl->hIconPrivate : ctl->hIcon; if (lstrlenA(ctl->szText) == 0) { if (ctl->iIcon) - ImageList_DrawEx(ctl->hIml, ctl->iIcon, hdcMem, ix, iy, g_cxsmIcon, g_cysmIcon, CLR_NONE, CLR_NONE, ILD_NORMAL); + ImageList_DrawEx(ctl->hIml, ctl->iIcon, hdcMem, ix, iy, g_cxsmIcon, g_cysmIcon, CLR_NONE, CLR_NONE, ILD_NORMAL); else - DrawState(hdcMem, NULL, NULL, (LPARAM) hIconNew, 0, ix, iy, g_cxsmIcon, g_cysmIcon, IsWindowEnabled(ctl->hwnd) ? DST_ICON | DSS_NORMAL : DST_ICON | DSS_DISABLED); + DrawState(hdcMem, NULL, NULL, (LPARAM) hIconNew, 0, ix, iy, g_cxsmIcon, g_cysmIcon, IsWindowEnabled(ctl->hwnd) ? DST_ICON | DSS_NORMAL : DST_ICON | DSS_DISABLED); ctl->sLabel.cx = ctl->sLabel.cy = 0; } else { - hOldFont = (HFONT)SelectObject(hdcMem, ctl->hFont); - GetTextExtentPoint32A(hdcMem, ctl->szText, lstrlenA(ctl->szText), &ctl->sLabel); + hOldFont = (HFONT)SelectObject(hdcMem, ctl->hFont); + GetTextExtentPoint32A(hdcMem, ctl->szText, lstrlenA(ctl->szText), &ctl->sLabel); ix = (rcClient.right - rcClient.left) / 2 - ((g_cxsmIcon + ctl->sLabel.cx + 4) / 2); if (ctl->iIcon) - ImageList_DrawEx(ctl->hIml, ctl->iIcon, hdcMem, ix, iy, g_cxsmIcon, g_cysmIcon, CLR_NONE, CLR_NONE, ILD_NORMAL); + ImageList_DrawEx(ctl->hIml, ctl->iIcon, hdcMem, ix, iy, g_cxsmIcon, g_cysmIcon, CLR_NONE, CLR_NONE, ILD_NORMAL); else - DrawState(hdcMem, NULL, NULL, (LPARAM) hIconNew, 0, ix, iy, g_cxsmIcon, g_cysmIcon, IsWindowEnabled(ctl->hwnd) ? DST_ICON | DSS_NORMAL : DST_ICON | DSS_DISABLED); + DrawState(hdcMem, NULL, NULL, (LPARAM) hIconNew, 0, ix, iy, g_cxsmIcon, g_cysmIcon, IsWindowEnabled(ctl->hwnd) ? DST_ICON | DSS_NORMAL : DST_ICON | DSS_DISABLED); ctl->sLabel.cx += (g_cxsmIcon + 4); } } else if (ctl->hBitmap) { BITMAP bminfo; - int ix, iy; - - GetObject(ctl->hBitmap, sizeof(bminfo), &bminfo); - ix = (rcClient.right - rcClient.left) / 2 - (bminfo.bmWidth / 2); - iy = (rcClient.bottom - rcClient.top) / 2 - (bminfo.bmHeight / 2); + GetObject(ctl->hBitmap, sizeof(bminfo), &bminfo); + int ix = (rcClient.right - rcClient.left) / 2 - (bminfo.bmWidth / 2); + int iy = (rcClient.bottom - rcClient.top) / 2 - (bminfo.bmHeight / 2); if (ctl->stateId == PBS_PRESSED) { ix++; iy++; } - DrawState(hdcMem, NULL, NULL, (LPARAM) ctl->hBitmap, 0, ix, iy, bminfo.bmWidth, bminfo.bmHeight, IsWindowEnabled(ctl->hwnd) ? DST_BITMAP : DST_BITMAP | DSS_DISABLED); + DrawState(hdcMem, NULL, NULL, (LPARAM) ctl->hBitmap, 0, ix, iy, bminfo.bmWidth, bminfo.bmHeight, IsWindowEnabled(ctl->hwnd) ? DST_BITMAP : DST_BITMAP | DSS_DISABLED); } if (GetWindowTextLengthA(ctl->hwnd)) { // Draw the text and optinally the arrow RECT rcText; - CopyRect(&rcText, &rcClient); - SetBkMode(hdcMem, TRANSPARENT); + CopyRect(&rcText, &rcClient); + SetBkMode(hdcMem, TRANSPARENT); // XP w/themes doesn't used the glossy disabled text. Is it always using COLOR_GRAYTEXT? Seems so. - SetTextColor(hdcMem, IsWindowEnabled(ctl->hwnd) || !ctl->hThemeButton ? GetSysColor(COLOR_BTNTEXT) : GetSysColor(COLOR_GRAYTEXT)); + SetTextColor(hdcMem, IsWindowEnabled(ctl->hwnd) || !ctl->hThemeButton ? GetSysColor(COLOR_BTNTEXT) : GetSysColor(COLOR_GRAYTEXT)); if (ctl->arrow) - DrawState(hdcMem, NULL, NULL, (LPARAM) ctl->arrow, 0, rcClient.right - rcClient.left - 5 - g_cxsmIcon + (!ctl->hThemeButton && ctl->stateId == PBS_PRESSED ? 1 : 0), (rcClient.bottom - rcClient.top) / 2 - g_cysmIcon / 2 + (!ctl->hThemeButton && ctl->stateId == PBS_PRESSED ? 1 : 0), g_cxsmIcon, g_cysmIcon, IsWindowEnabled(ctl->hwnd) ? DST_ICON : DST_ICON | DSS_DISABLED); - SelectObject(hdcMem, ctl->hFont); - DrawStateA(hdcMem, NULL, NULL, (LPARAM) ctl->szText, 0, (rcText.right - rcText.left - ctl->sLabel.cx) / 2 + (!ctl->hThemeButton && ctl->stateId == PBS_PRESSED ? 1 : 0) + g_cxsmIcon + 4, ctl->hThemeButton ? (rcText.bottom - rcText.top - ctl->sLabel.cy) / 2 + 1 : (rcText.bottom - rcText.top - ctl->sLabel.cy) / 2 + (ctl->stateId == PBS_PRESSED ? 1 : 0), ctl->sLabel.cx, ctl->sLabel.cy, IsWindowEnabled(ctl->hwnd) || ctl->hThemeButton ? DST_PREFIXTEXT | DSS_NORMAL : DST_PREFIXTEXT | DSS_DISABLED); + DrawState(hdcMem, NULL, NULL, (LPARAM) ctl->arrow, 0, rcClient.right - rcClient.left - 5 - g_cxsmIcon + (!ctl->hThemeButton && ctl->stateId == PBS_PRESSED ? 1 : 0), (rcClient.bottom - rcClient.top) / 2 - g_cysmIcon / 2 + (!ctl->hThemeButton && ctl->stateId == PBS_PRESSED ? 1 : 0), g_cxsmIcon, g_cysmIcon, IsWindowEnabled(ctl->hwnd) ? DST_ICON : DST_ICON | DSS_DISABLED); + SelectObject(hdcMem, ctl->hFont); + DrawStateA(hdcMem, NULL, NULL, (LPARAM) ctl->szText, 0, (rcText.right - rcText.left - ctl->sLabel.cx) / 2 + (!ctl->hThemeButton && ctl->stateId == PBS_PRESSED ? 1 : 0) + g_cxsmIcon + 4, ctl->hThemeButton ? (rcText.bottom - rcText.top - ctl->sLabel.cy) / 2 + 1 : (rcText.bottom - rcText.top - ctl->sLabel.cy) / 2 + (ctl->stateId == PBS_PRESSED ? 1 : 0), ctl->sLabel.cx, ctl->sLabel.cy, IsWindowEnabled(ctl->hwnd) || ctl->hThemeButton ? DST_PREFIXTEXT | DSS_NORMAL : DST_PREFIXTEXT | DSS_DISABLED); } if (hOldFont) - SelectObject(hdcMem, hOldFont); + SelectObject(hdcMem, hOldFont); - BitBlt(hdcPaint, 0, 0, rcClient.right - rcClient.left, rcClient.bottom - rcClient.top, hdcMem, 0, 0, SRCCOPY); - SelectObject(hdcMem, hOld); + BitBlt(hdcPaint, 0, 0, rcClient.right - rcClient.left, rcClient.bottom - rcClient.top, hdcMem, 0, 0, SRCCOPY); + SelectObject(hdcMem, hOld); DeleteObject(hbmMem); DeleteDC(hdcMem); } -static LRESULT CALLBACK TSButtonWndProc(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lParam) +static LRESULT CALLBACK TSButtonWndProc(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lParam) { - MButtonCtrl *bct = (MButtonCtrl *) GetWindowLongPtr(hwndDlg, 0); + MButtonCtrl *bct = (MButtonCtrl *) GetWindowLongPtr(hwndDlg, 0); switch (msg) { case WM_NCCREATE: - SetWindowLongPtr(hwndDlg, GWL_STYLE, GetWindowLongPtr(hwndDlg, GWL_STYLE) | BS_OWNERDRAW); + SetWindowLongPtr(hwndDlg, GWL_STYLE, GetWindowLongPtr(hwndDlg, GWL_STYLE) | BS_OWNERDRAW); bct = ( MButtonCtrl* )malloc(sizeof(MButtonCtrl)); if (bct == NULL) return FALSE; @@ -289,9 +287,9 @@ static LRESULT CALLBACK TSButtonWndProc(HWND hwndDlg, UINT msg, WPARAM wParam, bct->flatBtn = 0; bct->bThemed = FALSE; LoadTheme(bct); - SetWindowLongPtr(hwndDlg, 0, (LONG) bct); + SetWindowLongPtr(hwndDlg, 0, (LONG) bct); if (((CREATESTRUCTA *) lParam)->lpszName) - SetWindowTextA(hwndDlg, ((CREATESTRUCTA *) lParam)->lpszName); + SetWindowTextA(hwndDlg, ((CREATESTRUCTA *) lParam)->lpszName); return TRUE; case WM_SETTEXT: @@ -305,8 +303,8 @@ static LRESULT CALLBACK TSButtonWndProc(HWND hwndDlg, UINT msg, WPARAM wParam, } tmp++; } - InvalidateRect(bct->hwnd, NULL, TRUE); - strncpy(bct->szText, (char*) lParam, 127); + InvalidateRect(bct->hwnd, NULL, TRUE); + strncpy(bct->szText, (char*) lParam, 127); bct->szText[127] = 0; } break; @@ -318,18 +316,18 @@ static LRESULT CALLBACK TSButtonWndProc(HWND hwndDlg, UINT msg, WPARAM wParam, bct->pbState = 0; else bct->pbState = 1; - InvalidateRect(bct->hwnd, NULL, TRUE); + InvalidateRect(bct->hwnd, NULL, TRUE); } - SendMessage(GetParent(hwndDlg), WM_COMMAND, MAKELONG(GetDlgCtrlID(hwndDlg), BN_CLICKED), (LPARAM) hwndDlg); + SendMessage(GetParent(hwndDlg), WM_COMMAND, MAKELONG(GetDlgCtrlID(hwndDlg), BN_CLICKED), (LPARAM) hwndDlg); return 0; } break; case WM_THEMECHANGED: - // themed changed, reload theme object + // themed changed, reload theme object if (bct->bThemed) LoadTheme(bct); - InvalidateRect(bct->hwnd, NULL, TRUE); // repaint it + InvalidateRect(bct->hwnd, NULL, TRUE); // repaint it break; case WM_SETFONT: @@ -343,10 +341,10 @@ static LRESULT CALLBACK TSButtonWndProc(HWND hwndDlg, UINT msg, WPARAM wParam, PAINTSTRUCT ps; HDC hdcPaint; - hdcPaint = BeginPaint(hwndDlg, &ps); + hdcPaint = BeginPaint(hwndDlg, &ps); if (hdcPaint) { - PaintWorker(bct, hdcPaint); - EndPaint(hwndDlg, &ps); + PaintWorker(bct, hdcPaint); + EndPaint(hwndDlg, &ps); } } break; @@ -359,15 +357,15 @@ static LRESULT CALLBACK TSButtonWndProc(HWND hwndDlg, UINT msg, WPARAM wParam, DestroyIcon(bct->hIconPrivate); ICONINFO ii; - GetIconInfo((HICON) lParam, &ii); + GetIconInfo((HICON) lParam, &ii); BITMAP bm; - GetObject(ii.hbmColor, sizeof(bm), &bm); + GetObject(ii.hbmColor, sizeof(bm), &bm); if (bm.bmWidth > g_cxsmIcon || bm.bmHeight > g_cysmIcon) { HIMAGELIST hImageList; - hImageList = ImageList_Create(g_cxsmIcon, g_cysmIcon, IsWinVerXPPlus() ? ILC_COLOR32 | ILC_MASK : ILC_COLOR16 | ILC_MASK, 1, 0); - ImageList_AddIcon(hImageList, (HICON) lParam); - bct->hIconPrivate = ImageList_GetIcon(hImageList, 0, ILD_NORMAL); + hImageList = ImageList_Create(g_cxsmIcon, g_cysmIcon, IsWinVerXPPlus() ? ILC_COLOR32 | ILC_MASK : ILC_COLOR16 | ILC_MASK, 1, 0); + ImageList_AddIcon(hImageList, (HICON) lParam); + bct->hIconPrivate = ImageList_GetIcon(hImageList, 0, ILD_NORMAL); ImageList_RemoveAll(hImageList); ImageList_Destroy(hImageList); bct->hIcon = 0; @@ -380,14 +378,14 @@ static LRESULT CALLBACK TSButtonWndProc(HWND hwndDlg, UINT msg, WPARAM wParam, DeleteObject(ii.hbmMask); DeleteObject(ii.hbmColor); bct->hBitmap = NULL; - InvalidateRect(bct->hwnd, NULL, TRUE); + InvalidateRect(bct->hwnd, NULL, TRUE); } else if (wParam == IMAGE_BITMAP) { bct->hBitmap = (HBITMAP) lParam; if (bct->hIconPrivate) DestroyIcon(bct->hIconPrivate); bct->hIcon = bct->hIconPrivate = NULL; - InvalidateRect(bct->hwnd, NULL, TRUE); + InvalidateRect(bct->hwnd, NULL, TRUE); } break; @@ -396,7 +394,7 @@ static LRESULT CALLBACK TSButtonWndProc(HWND hwndDlg, UINT msg, WPARAM wParam, bct->iIcon = 0; if (bct->hIconPrivate) DestroyIcon(bct->hIconPrivate); - bct->hIconPrivate = DuplicateIcon(hInst, (HICON) lParam); + bct->hIconPrivate = DuplicateIcon(hInst, (HICON) lParam); bct->hIcon = 0; break; @@ -406,7 +404,7 @@ static LRESULT CALLBACK TSButtonWndProc(HWND hwndDlg, UINT msg, WPARAM wParam, bct->hIml = (HIMAGELIST) wParam; bct->iIcon = (int) lParam; bct->hIcon = bct->hIconPrivate = 0; - InvalidateRect(bct->hwnd, NULL, TRUE); + InvalidateRect(bct->hwnd, NULL, TRUE); break; case BM_SETCHECK: @@ -419,7 +417,7 @@ static LRESULT CALLBACK TSButtonWndProc(HWND hwndDlg, UINT msg, WPARAM wParam, bct->pbState = 0; bct->stateId = PBS_NORMAL; } - InvalidateRect(bct->hwnd, NULL, TRUE); + InvalidateRect(bct->hwnd, NULL, TRUE); break; case BM_GETCHECK: @@ -431,7 +429,7 @@ static LRESULT CALLBACK TSButtonWndProc(HWND hwndDlg, UINT msg, WPARAM wParam, case BUTTONSETARROW: // turn arrow on/off if (wParam) { - //if (!bct->arrow) bct->arrow = (HICON) LoadImage(g_hInst, MAKEINTRESOURCE(IDI_MINIMIZE), IMAGE_ICON, g_cxsmIcon, g_cysmIcon, 0); + //if (!bct->arrow) bct->arrow = (HICON) LoadImage(g_hInst, MAKEINTRESOURCE(IDI_MINIMIZE), IMAGE_ICON, g_cxsmIcon, g_cysmIcon, 0); } else { if (bct->arrow) { @@ -439,22 +437,22 @@ static LRESULT CALLBACK TSButtonWndProc(HWND hwndDlg, UINT msg, WPARAM wParam, bct->arrow = NULL; } } - InvalidateRect(bct->hwnd, NULL, TRUE); + InvalidateRect(bct->hwnd, NULL, TRUE); break; case BUTTONSETDEFAULT: bct->defbutton = wParam ? 1 : 0; - InvalidateRect(bct->hwnd, NULL, TRUE); + InvalidateRect(bct->hwnd, NULL, TRUE); break; case BUTTONSETASPUSHBTN: bct->pushBtn = 1; - InvalidateRect(bct->hwnd, NULL, TRUE); + InvalidateRect(bct->hwnd, NULL, TRUE); break; case BUTTONSETASFLATBTN: bct->flatBtn = lParam == 0 ? 1 : 0; - InvalidateRect(bct->hwnd, NULL, TRUE); + InvalidateRect(bct->hwnd, NULL, TRUE); break; case BUTTONSETASFLATBTN + 10: @@ -465,20 +463,20 @@ static LRESULT CALLBACK TSButtonWndProc(HWND hwndDlg, UINT msg, WPARAM wParam, if (wParam) { EnterCriticalSection(&csTips); if (!hwndToolTips) - hwndToolTips = CreateWindowExA(WS_EX_TOPMOST, TOOLTIPS_CLASSA, "", WS_POPUP, 0, 0, 0, 0, NULL, NULL, GetModuleHandle(NULL), NULL); + hwndToolTips = CreateWindowExA(WS_EX_TOPMOST, TOOLTIPS_CLASSA, "", WS_POPUP, 0, 0, 0, 0, NULL, NULL, GetModuleHandle(NULL), NULL); - TOOLINFOA ti = { 0 }; + TOOLINFO ti = { 0 }; ti.cbSize = sizeof(ti); ti.uFlags = TTF_IDISHWND; ti.hwnd = bct->hwnd; ti.uId = (UINT) bct->hwnd; - if (SendMessage(hwndToolTips, TTM_GETTOOLINFO, 0, (LPARAM) &ti)) - SendMessage(hwndToolTips, TTM_DELTOOL, 0, (LPARAM) &ti); + if (SendMessage(hwndToolTips, TTM_GETTOOLINFO, 0, (LPARAM) &ti)) + SendMessage(hwndToolTips, TTM_DELTOOL, 0, (LPARAM) &ti); ti.uFlags = TTF_IDISHWND | TTF_SUBCLASS; ti.uId = (UINT) bct->hwnd; - ti.lpszText = (char*) wParam; - SendMessageA(hwndToolTips, TTM_ADDTOOLA, 0, (LPARAM) &ti); + ti.lpszText = (TCHAR*) wParam; + SendMessage(hwndToolTips, TTM_ADDTOOL, 0, (LPARAM) &ti); LeaveCriticalSection(&csTips); } break; @@ -486,23 +484,23 @@ static LRESULT CALLBACK TSButtonWndProc(HWND hwndDlg, UINT msg, WPARAM wParam, case WM_SETFOCUS: // set keybord focus and redraw bct->focus = 1; - InvalidateRect(bct->hwnd, NULL, TRUE); + InvalidateRect(bct->hwnd, NULL, TRUE); break; case WM_KILLFOCUS: // kill focus and redraw bct->focus = 0; - InvalidateRect(bct->hwnd, NULL, TRUE); + InvalidateRect(bct->hwnd, NULL, TRUE); break; case WM_WINDOWPOSCHANGED: - InvalidateRect(bct->hwnd, NULL, TRUE); + InvalidateRect(bct->hwnd, NULL, TRUE); break; case WM_ENABLE: // windows tells us to enable/disable bct->stateId = wParam ? PBS_NORMAL : PBS_DISABLED; - InvalidateRect(bct->hwnd, NULL, TRUE); + InvalidateRect(bct->hwnd, NULL, TRUE); break; case WM_MOUSELEAVE: @@ -510,7 +508,7 @@ static LRESULT CALLBACK TSButtonWndProc(HWND hwndDlg, UINT msg, WPARAM wParam, if (bct->stateId != PBS_DISABLED) { // don't change states if disabled bct->stateId = PBS_NORMAL; - InvalidateRect(bct->hwnd, NULL, TRUE); + InvalidateRect(bct->hwnd, NULL, TRUE); } break; @@ -518,7 +516,7 @@ static LRESULT CALLBACK TSButtonWndProc(HWND hwndDlg, UINT msg, WPARAM wParam, if (bct->stateId != PBS_DISABLED) { // don't change states if disabled bct->stateId = PBS_PRESSED; - InvalidateRect(bct->hwnd, NULL, TRUE); + InvalidateRect(bct->hwnd, NULL, TRUE); } break; @@ -535,32 +533,32 @@ static LRESULT CALLBACK TSButtonWndProc(HWND hwndDlg, UINT msg, WPARAM wParam, bct->stateId = PBS_HOT; else bct->stateId = PBS_NORMAL; - InvalidateRect(bct->hwnd, NULL, TRUE); + InvalidateRect(bct->hwnd, NULL, TRUE); } // Tell your daddy you got clicked. - SendMessage(GetParent(hwndDlg), WM_COMMAND, MAKELONG(GetDlgCtrlID(hwndDlg), BN_CLICKED), (LPARAM) hwndDlg); + SendMessage(GetParent(hwndDlg), WM_COMMAND, MAKELONG(GetDlgCtrlID(hwndDlg), BN_CLICKED), (LPARAM) hwndDlg); break; case WM_MOUSEMOVE: if (bct->stateId == PBS_NORMAL) { bct->stateId = PBS_HOT; - InvalidateRect(bct->hwnd, NULL, TRUE); + InvalidateRect(bct->hwnd, NULL, TRUE); } - // Call timer, used to start cheesy TrackMouseEvent faker - SetTimer(hwndDlg, BUTTON_POLLID, BUTTON_POLLDELAY, NULL); + // Call timer, used to start cheesy TrackMouseEvent faker + SetTimer(hwndDlg, BUTTON_POLLID, BUTTON_POLLDELAY, NULL); break; case WM_TIMER: // use a timer to check if they have did a mouseout if (wParam == BUTTON_POLLID) { RECT rc; POINT pt; - GetWindowRect(hwndDlg, &rc); + GetWindowRect(hwndDlg, &rc); GetCursorPos(&pt); - if (!PtInRect(&rc, pt)) { - // mouse must be gone, trigger mouse leave - PostMessage(hwndDlg, WM_MOUSELEAVE, 0, 0L); - KillTimer(hwndDlg, BUTTON_POLLID); + if (!PtInRect(&rc, pt)) { + // mouse must be gone, trigger mouse leave + PostMessage(hwndDlg, WM_MOUSELEAVE, 0, 0L); + KillTimer(hwndDlg, BUTTON_POLLID); } } break; @@ -577,10 +575,10 @@ static LRESULT CALLBACK TSButtonWndProc(HWND hwndDlg, UINT msg, WPARAM wParam, ti.uFlags = TTF_IDISHWND; ti.hwnd = bct->hwnd; ti.uId = (UINT) bct->hwnd; - if (SendMessage(hwndToolTips, TTM_GETTOOLINFO, 0, (LPARAM) &ti)) - SendMessage(hwndToolTips, TTM_DELTOOL, 0, (LPARAM) &ti); + if (SendMessage(hwndToolTips, TTM_GETTOOLINFO, 0, (LPARAM) &ti)) + SendMessage(hwndToolTips, TTM_DELTOOL, 0, (LPARAM) &ti); - if (SendMessage(hwndToolTips, TTM_GETTOOLCOUNT, 0, (LPARAM) &ti) == 0) { + if (SendMessage(hwndToolTips, TTM_GETTOOLCOUNT, 0, (LPARAM) &ti) == 0) { DestroyWindow(hwndToolTips); hwndToolTips = NULL; } @@ -591,11 +589,11 @@ static LRESULT CALLBACK TSButtonWndProc(HWND hwndDlg, UINT msg, WPARAM wParam, DestroyTheme(bct); free(bct); } - SetWindowLongPtr(hwndDlg, 0, (LONG) NULL); + SetWindowLongPtr(hwndDlg, 0, (LONG) NULL); break; // DONT! fall thru } - return DefWindowProc(hwndDlg, msg, wParam, lParam); + return DefWindowProc(hwndDlg, msg, wParam, lParam); } ///////////////////////////////////////////////////////////////////////////////////////// @@ -609,7 +607,7 @@ int LoadCLCButtonModule(void) wc.cbSize = sizeof(wc); wc.lpszClassName = "CLCButtonClass"; wc.lpfnWndProc = TSButtonWndProc; - wc.hCursor = LoadCursor(NULL, IDC_ARROW); + wc.hCursor = LoadCursor(NULL, IDC_ARROW); wc.cbWndExtra = sizeof(MButtonCtrl *); wc.hbrBackground = 0; wc.style = CS_GLOBALCLASS; @@ -618,7 +616,7 @@ int LoadCLCButtonModule(void) return 0; } -int UnloadTSButtonModule(WPARAM wParam, LPARAM lParam) +int UnloadTSButtonModule(WPARAM wParam, LPARAM lParam) { DeleteCriticalSection(&csTips); return 0; diff --git a/plugins/TopToolBar/InternalButtons.cpp b/plugins/TopToolBar/InternalButtons.cpp index d377053ee1..38108823e8 100644 --- a/plugins/TopToolBar/InternalButtons.cpp +++ b/plugins/TopToolBar/InternalButtons.cpp @@ -36,7 +36,7 @@ int OnSettingChanging(WPARAM wParam, LPARAM lParam) return 0;
DBCONTACTWRITESETTING *dbcws = (DBCONTACTWRITESETTING *)lParam;
- if (dbcws == NULL)
+ if (dbcws == NULL)
return 0;
if ( !strcmp(dbcws->szModule, "CList")) {
@@ -132,7 +132,7 @@ int UnLoadInternalButtons() bool framesexists = FALSE;
int windhandle;
-LRESULT CALLBACK TestProczzz(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam)
+LRESULT CALLBACK TestProczzz(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam)
{
switch(msg) {
case WM_CREATE:
@@ -149,20 +149,20 @@ LRESULT CALLBACK TestProczzz(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lPara PAINTSTRUCT lp;
HDC hdc = BeginPaint(hwnd, &lp);
if (hdc) {
- char buf[255];
- wsprintf(buf, "%d", GetTickCount());
- TextOutA(hdc, 4, 4, buf, strlen(buf));
+ TCHAR buf[255];
+ wsprintf(buf, _T("%d"), GetTickCount());
+ TextOut(hdc, 4, 4, buf, lstrlen(buf));
EndPaint(hwnd, &lp);
}
return 0;
}
}
- return(DefWindowProc(hwnd, msg, wParam, lParam));
+ return(DefWindowProc(hwnd, msg, wParam, lParam));
}
bool first = TRUE;
-char pluginname[] = "SimpleClassName";
+TCHAR pluginname[] = _T("SimpleClassName");
INT_PTR test(WPARAM wParam, LPARAM lParam)
{
@@ -170,7 +170,7 @@ INT_PTR test(WPARAM wParam, LPARAM lParam) WNDCLASS wndclass = { 0 };
wndclass.lpfnWndProc = TestProczzz;
wndclass.hInstance = hInst;
- wndclass.hCursor = LoadCursor (NULL, IDC_ARROW);
+ wndclass.hCursor = LoadCursor (NULL, IDC_ARROW);
wndclass.hbrBackground = (HBRUSH)(COLOR_3DFACE+1);//NULL;//(HBRUSH)(COLOR_3DFACE+1);
wndclass.lpszClassName = pluginname;
RegisterClass(&wndclass);
@@ -190,7 +190,7 @@ INT_PTR test(WPARAM wParam, LPARAM lParam) CLISTFrame Frame = { 0 };
Frame.name = (char *)malloc(255);
memset(Frame.name, 0, 255);
- memcpy(Frame.name, pluginname, sizeof(pluginname));
+ memcpy(Frame.name, pluginname, SIZEOF(pluginname));
Frame.cbSize = sizeof(Frame);
Frame.hWnd = pluginwind;
Frame.align = alTop;
@@ -234,8 +234,6 @@ int LoadInternalButtons(HWND hwnd) ttb.name = "Show only Online Users";
hOnlineBut = (HANDLE)TTBAddButton((WPARAM)&ttb, 0);
- memset(&ttb, 0, sizeof(ttb));
- ttb.cbSize = sizeof(ttb);
ttb.hIconUp = (HICON)LoadImage(hInst, MAKEINTRESOURCE(IDI_GROUPSUP), IMAGE_ICON, 16, 16, LR_DEFAULTCOLOR);
ttb.hIconDn = (HICON)LoadImage(hInst, MAKEINTRESOURCE(IDI_GROUPSDN), IMAGE_ICON, 16, 16, LR_DEFAULTCOLOR);
ttb.dwFlags = (ShowGroups?TTBBF_PUSHED:0)|TTBBF_VISIBLE|TTBBF_SHOWTOOLTIP;
@@ -244,19 +242,14 @@ int LoadInternalButtons(HWND hwnd) ttb.name = "Groups On/Off";
hGroupBut = (HANDLE)TTBAddButton((WPARAM)&ttb, 0);
- memset(&ttb, 0, sizeof(ttb));
- ttb.cbSize = sizeof(ttb);
ttb.hIconUp = (HICON)LoadImage(hInst, MAKEINTRESOURCE(IDI_SOUNDUP), IMAGE_ICON, 16, 16, LR_DEFAULTCOLOR);
ttb.hIconDn = (HICON)LoadImage(hInst, MAKEINTRESOURCE(IDI_SOUNDDN), IMAGE_ICON, 16, 16, LR_DEFAULTCOLOR);
-
ttb.dwFlags = (SoundsEnabled?TTBBF_PUSHED:0)|TTBBF_VISIBLE|TTBBF_SHOWTOOLTIP;
ttb.pszServiceDown = TTBI_SOUNDSONOFF;
ttb.pszServiceUp = TTBI_SOUNDSONOFF;
ttb.name = "Sounds Enable/Disable";
hSoundsBut = (HANDLE)TTBAddButton((WPARAM)&ttb, 0);
- memset(&ttb, 0, sizeof(ttb));
- ttb.cbSize = sizeof(ttb);
ttb.hIconUp = (HICON)LoadImage(hInst, MAKEINTRESOURCE(IDI_OPTIONSUP), IMAGE_ICON, 16, 16, LR_DEFAULTCOLOR);
ttb.hIconDn = (HICON)LoadImage(hInst, MAKEINTRESOURCE(IDI_OPTIONSDN), IMAGE_ICON, 16, 16, LR_DEFAULTCOLOR);
ttb.dwFlags = TTBBF_VISIBLE|TTBBF_SHOWTOOLTIP;
@@ -265,19 +258,14 @@ int LoadInternalButtons(HWND hwnd) ttb.name = "Show Options Page";
hOptionsBut = (HANDLE)TTBAddButton((WPARAM)&ttb, 0);
- memset(&ttb, 0, sizeof(ttb));
- ttb.cbSize = sizeof(ttb);
ttb.hIconUp = (HICON)LoadImage(hInst, MAKEINTRESOURCE(IDI_MINIMIZEUP), IMAGE_ICON, 16, 16, LR_DEFAULTCOLOR);
ttb.hIconDn = (HICON)LoadImage(hInst, MAKEINTRESOURCE(IDI_MINIMIZEDN), IMAGE_ICON, 16, 16, LR_DEFAULTCOLOR);
-
ttb.dwFlags = TTBBF_VISIBLE;
ttb.pszServiceDown = TTBI_MINIMIZEBUTT;
ttb.pszServiceUp = TTBI_MINIMIZEBUTT;
ttb.name = "Minimize Button";
hMinimizeBut = (HANDLE)TTBAddButton((WPARAM)&ttb, 0);
- memset(&ttb, 0, sizeof(ttb));
- ttb.cbSize = sizeof(ttb);
ttb.hIconUp = (HICON)LoadImage(hInst, MAKEINTRESOURCE(IDI_FINDADDUP), IMAGE_ICON, 16, 16, LR_DEFAULTCOLOR);
ttb.hIconDn = (HICON)LoadImage(hInst, MAKEINTRESOURCE(IDI_FINDADDDN), IMAGE_ICON, 16, 16, LR_DEFAULTCOLOR);
ttb.dwFlags = TTBBF_VISIBLE;
@@ -286,8 +274,6 @@ int LoadInternalButtons(HWND hwnd) ttb.name = "Find/Add Contacts";
hFindUsers = (HANDLE)TTBAddButton((WPARAM)&ttb, 0);
- memset(&ttb, 0, sizeof(ttb));
- ttb.cbSize = sizeof(ttb);
ttb.hIconUp = (HICON)LoadImage(hInst, MAKEINTRESOURCE(IDI_MIRANDAUP), IMAGE_ICON, 16, 16, LR_DEFAULTCOLOR);
ttb.hIconDn = (HICON)LoadImage(hInst, MAKEINTRESOURCE(IDI_MIRANDADN), IMAGE_ICON, 16, 16, LR_DEFAULTCOLOR);
ttb.dwFlags = TTBBF_VISIBLE|TTBBF_SHOWTOOLTIP;
diff --git a/plugins/TopToolBar/TopToolBar.vcxproj b/plugins/TopToolBar/TopToolBar.vcxproj index 4987149c7e..ff34f3083f 100644 --- a/plugins/TopToolBar/TopToolBar.vcxproj +++ b/plugins/TopToolBar/TopToolBar.vcxproj @@ -25,24 +25,24 @@ <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration">
<ConfigurationType>DynamicLibrary</ConfigurationType>
<UseOfMfc>false</UseOfMfc>
- <CharacterSet>MultiByte</CharacterSet>
+ <CharacterSet>Unicode</CharacterSet>
<WholeProgramOptimization>true</WholeProgramOptimization>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="Configuration">
<ConfigurationType>DynamicLibrary</ConfigurationType>
<UseOfMfc>false</UseOfMfc>
- <CharacterSet>MultiByte</CharacterSet>
+ <CharacterSet>Unicode</CharacterSet>
<WholeProgramOptimization>true</WholeProgramOptimization>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration">
<ConfigurationType>DynamicLibrary</ConfigurationType>
<UseOfMfc>false</UseOfMfc>
- <CharacterSet>MultiByte</CharacterSet>
+ <CharacterSet>Unicode</CharacterSet>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="Configuration">
<ConfigurationType>DynamicLibrary</ConfigurationType>
<UseOfMfc>false</UseOfMfc>
- <CharacterSet>MultiByte</CharacterSet>
+ <CharacterSet>Unicode</CharacterSet>
</PropertyGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
<ImportGroup Label="ExtensionSettings">
diff --git a/plugins/TopToolBar/button.cpp b/plugins/TopToolBar/button.cpp index 54bf8bf816..c783426a85 100644 --- a/plugins/TopToolBar/button.cpp +++ b/plugins/TopToolBar/button.cpp @@ -34,7 +34,7 @@ typedef struct { int pbState;
HANDLE hThemeButton;
HANDLE hThemeToolbar;
- char cHot;
+ TCHAR cHot;
int flatBtn;
} MButtonCtrl;
@@ -60,7 +60,7 @@ static int ThemeSupport() {
if (IsWinVerXPPlus()) {
if (!themeAPIHandle) {
- themeAPIHandle = GetModuleHandle("uxtheme");
+ themeAPIHandle = GetModuleHandleA("uxtheme");
if (themeAPIHandle) {
MyOpenThemeData = (HANDLE (WINAPI *)(HWND,LPCWSTR))MGPROC("OpenThemeData");
MyCloseThemeData = (HRESULT (WINAPI *)(HANDLE))MGPROC("CloseThemeData");
@@ -204,11 +204,9 @@ static void PaintWorker(MButtonCtrl *ctl, HDC hdcPaint) }
else if (ctl->hBitmap) {
BITMAP bminfo;
- int ix,iy;
-
GetObject(ctl->hBitmap, sizeof(bminfo), &bminfo);
- ix = (rcClient.right-rcClient.left)/2 - (bminfo.bmWidth/2);
- iy = (rcClient.bottom-rcClient.top)/2 - (bminfo.bmHeight/2);
+ int ix = (rcClient.right-rcClient.left)/2 - (bminfo.bmWidth/2);
+ int iy = (rcClient.bottom-rcClient.top)/2 - (bminfo.bmHeight/2);
if (ctl->stateId == PBS_PRESSED) {
ix++;
iy++;
@@ -217,12 +215,12 @@ static void PaintWorker(MButtonCtrl *ctl, HDC hdcPaint) }
else if (GetWindowTextLength(ctl->hwnd)) {
// Draw the text and optinally the arrow
- char szText[MAX_PATH];
+ TCHAR szText[MAX_PATH];
SIZE sz;
RECT rcText;
CopyRect(&rcText, &rcClient);
- GetWindowText(ctl->hwnd, szText, sizeof(szText));
+ GetWindowText(ctl->hwnd, szText, SIZEOF(szText));
SetBkMode(hdcMem, TRANSPARENT);
HFONT hOldFont = (HFONT)SelectObject(hdcMem, ctl->hFont);
// XP w/themes doesn't used the glossy disabled text. Is it always using COLOR_GRAYTEXT? Seems so.
@@ -230,8 +228,7 @@ static void PaintWorker(MButtonCtrl *ctl, HDC hdcPaint) GetTextExtentPoint32(hdcMem, szText, lstrlen(szText), &sz);
if (ctl->cHot) {
SIZE szHot;
-
- GetTextExtentPoint32(hdcMem, "&", 1, &szHot);
+ GetTextExtentPoint32(hdcMem, _T("&"), 1, &szHot);
sz.cx -= szHot.cx;
}
if (ctl->arrow) {
@@ -248,7 +245,7 @@ static void PaintWorker(MButtonCtrl *ctl, HDC hdcPaint) }
}
-static LRESULT CALLBACK MButtonWndProc(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lParam)
+static LRESULT CALLBACK MButtonWndProc(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lParam)
{
MButtonCtrl* bct = (MButtonCtrl *)GetWindowLongPtr(hwndDlg, 0);
switch(msg) {
@@ -393,7 +390,7 @@ static LRESULT CALLBACK MButtonWndProc(HWND hwndDlg, UINT msg, WPARAM wParam, L if (wParam) {
EnterCriticalSection(&csTips);
if (!hwndToolTips)
- hwndToolTips = CreateWindowEx(WS_EX_TOPMOST, TOOLTIPS_CLASS, "", WS_POPUP, 0, 0, 0, 0, NULL, NULL, GetModuleHandle(NULL), NULL);
+ hwndToolTips = CreateWindowEx(WS_EX_TOPMOST, TOOLTIPS_CLASS, _T(""), WS_POPUP, 0, 0, 0, 0, NULL, NULL, GetModuleHandle(NULL), NULL);
TOOLINFO ti = { 0 };
ti.cbSize = sizeof(ti);
@@ -405,7 +402,7 @@ static LRESULT CALLBACK MButtonWndProc(HWND hwndDlg, UINT msg, WPARAM wParam, L ti.uFlags = TTF_IDISHWND|TTF_SUBCLASS;
ti.uId = (UINT)bct->hwnd;
- ti.lpszText=(char*)wParam;
+ ti.lpszText = ( LPTSTR )wParam;
SendMessage(hwndToolTips,TTM_ADDTOOL,0,(LPARAM)&ti);
LeaveCriticalSection(&csTips);
}
@@ -518,9 +515,7 @@ int UnloadButtonModule(WPARAM wParam, LPARAM lParam) int LoadButtonModule(void)
{
- WNDCLASSEX wc;
-
- ZeroMemory(&wc, sizeof(wc));
+ WNDCLASSEX wc = { 0 };
wc.cbSize = sizeof(wc);
wc.lpszClassName = MYMIRANDABUTTONCLASS;
wc.lpfnWndProc = MButtonWndProc;
diff --git a/plugins/TopToolBar/common.h b/plugins/TopToolBar/common.h index 92d715701b..5bda9975c3 100644 --- a/plugins/TopToolBar/common.h +++ b/plugins/TopToolBar/common.h @@ -49,7 +49,8 @@ int ttbOptionsChanged(); int ArrangeButtons();
int RecreateWindows();
-typedef struct {
+struct TopButtonInt
+{
HWND hwnd;
HWND hwndTip;
int id;
@@ -62,24 +63,23 @@ typedef struct { HICON hIconUp, hIconDn;
char *pszServiceUp, *pszServiceDown;
- char *tooltip;
char *name;
-
+ TCHAR *tooltip;
+
LPARAM lParamUp;
WPARAM wParamUp;
LPARAM lParamDown;
WPARAM wParamDown;
WORD arrangedpos;
- char *UserDefinedbmUp;
- char *UserDefinedbmDown;
-
+ TCHAR *UserDefinedbmUp;
+ TCHAR *UserDefinedbmDown;
+};
-}TopButtonInt;
-
-typedef struct tagSortData {
+struct SortData
+{
int oldpos;
int arrangeval;
-} SortData;
+};
#define MAX_BUTTONS 64
//#define BUTTWIDTH 20
@@ -87,11 +87,12 @@ typedef struct tagSortData { //#define BUTTHEIGHT 16
#define SEPWIDTH 3
-typedef struct tagButtonOptData {
+struct ButtonOptData
+{
char *name;
int pos;
bool show;
-} ButtonOptData;
+};
extern bool OptionsOpened;
extern HWND OptionshWnd;
@@ -100,7 +101,7 @@ int OptionsPageRebuild(); void lockbut();
void ulockbut();
-//return - 0 success, -1 on error
+//return - 0 success, -1 on error
#define TTB_ADDSEPARATOR "TTB/AddSeparator"
//wparam sepid
#define TTB_REMOVESEPARATOR "TTB/RemoveSeparator"
@@ -127,7 +128,7 @@ char *AS(char *str, const char *setting, char *addstr) #define TTB_ADDLBUTTON "TTB/AddLButton"
#define TTB_REMOVELBUTTON "TTB/RemoveLButton"
-#define MYMIRANDABUTTONCLASS "MyMIRANDABUTTONCLASS"
+#define MYMIRANDABUTTONCLASS _T("MyMIRANDABUTTONCLASS")
int LoadInternalButtons( HWND );
int UnLoadInternalButtons( void );
@@ -153,13 +154,12 @@ INT_PTR GetLButton(WPARAM, LPARAM); INT_PTR InsertLBut(int id);
-typedef struct
+struct LBUTOPT
{
int hframe;
- char *lpath;
+ TCHAR *lpath;
char *name;
-}
- LBUTOPT;
+};
int LoadCLCButtonModule(void);
#define BM_SETPRIVATEICON (WM_USER + 6)
diff --git a/plugins/TopToolBar/launchbt.cpp b/plugins/TopToolBar/launchbt.cpp index a5becaeba7..378f92048d 100644 --- a/plugins/TopToolBar/launchbt.cpp +++ b/plugins/TopToolBar/launchbt.cpp @@ -35,10 +35,10 @@ INT_PTR GetLButton(WPARAM wParam, LPARAM lParam) return -1;
LBUTOPT *lbo = ( LBUTOPT* )lParam;
- if (lbo == NULL)
+ if (lbo == NULL)
return -1;
- if (LBUTS[wParam].hframe == 0)
+ if (LBUTS[wParam].hframe == 0)
return -1;
*lbo = LBUTS[wParam];
@@ -53,10 +53,10 @@ INT_PTR ModifyLButton(WPARAM wParam, LPARAM lParam) return -1;
LBUTOPT *lbo = ( LBUTOPT* )lParam;
- if (lbo == NULL)
+ if (lbo == NULL)
return -1;
- if (LBUTS[wParam].hframe == 0)
+ if (LBUTS[wParam].hframe == 0)
return -1;
DeleteLBut(wParam, 0);
@@ -68,14 +68,14 @@ INT_PTR ModifyLButton(WPARAM wParam, LPARAM lParam) if (lbo->name != NULL)
LBUTS[wParam].name = _strdup(lbo->name);
if (lbo->lpath != NULL)
- LBUTS[wParam].lpath = _strdup(lbo->lpath);
+ LBUTS[wParam].lpath = _tcsdup(lbo->lpath);
LBUTS[wParam].hframe = InsertLBut(wParam);
SaveAllLButs();
return 0;
}
-int InsertLBut(int id)
+INT_PTR InsertLBut(int id)
{
HBITMAP DefLUp = LoadBitmap(hInst, MAKEINTRESOURCE(IDB_LAUNCHDN));
HBITMAP DefLDn = LoadBitmap(hInst, MAKEINTRESOURCE(IDB_LAUNCHUP));
@@ -113,56 +113,48 @@ int LoadAllLButs() char buf[255];
char buf1[10];
char fixname[255];
- int id, i;
-// char *oldtb;
+ int id;
//must be locked
- memset(buf, 0, sizeof(buf));
+ memset(buf, 0, SIZEOF(buf));
memset(LBUTS, 0, sizeof(LBUTS));
- for (i = 0;i<MAXLBUTS;i++)
- {
- memset(buf1, 0, sizeof(buf1));
+ for (int i = 0; i < MAXLBUTS; i++) {
+ memset(buf1, 0, SIZEOF(buf1));
itoa(i, buf1, 10);
AS(fixname, "LBUT", buf1);
id = DBGetContactSettingWord(0, TTB_OPTDIR, AS(buf, fixname, ""), -1);
- if (id != -1)
- {
- LBUTS[i].name = DBGetString(0, TTB_OPTDIR, AS(buf, fixname, "_name"));
- LBUTS[i].lpath = DBGetString(0, TTB_OPTDIR, AS(buf, fixname, "_lpath"));
- if (LBUTS[i].lpath == NULL){LBUTS[i].lpath = _strdup("Execute Path");}
- LBUTS[i].hframe = 0;
- LBUTS[i].hframe = InsertLBut(i);
+ if (id != -1) {
+ LBUTS[i].name = DBGetString(0, TTB_OPTDIR, AS(buf, fixname, "_name"));
+ LBUTS[i].lpath = DBGetStringT(0, TTB_OPTDIR, AS(buf, fixname, "_lpath"));
+ if (LBUTS[i].lpath == NULL)
+ LBUTS[i].lpath = _tcsdup( _T("Execute Path"));
+ LBUTS[i].hframe = 0;
+ LBUTS[i].hframe = InsertLBut(i);
}
}
return 0;
-
}
-
int SaveAllLButs()
{
char buf[255];
char buf1[10];
char fixname[255];
- int i;
//must be locked
- memset(buf, 0, sizeof(buf));
+ memset(buf, 0, SIZEOF(buf));
- for (i = 0;i<MAXLBUTS;i++)
- {
+ for (int i = 0;i<MAXLBUTS;i++) {
itoa(i, buf1, 10);
- if (LBUTS[i].hframe != 0)
- {
- AS(fixname, "LBUT", buf1);
- DBWriteContactSettingWord(0, TTB_OPTDIR, AS(buf, fixname, ""), i);
- DBWriteContactSettingString(0, TTB_OPTDIR, AS(buf, fixname, "_name"), LBUTS[i].name);
- DBWriteContactSettingString(0, TTB_OPTDIR, AS(buf, fixname, "_lpath"), LBUTS[i].lpath);
+ if (LBUTS[i].hframe != 0) {
+ AS(fixname, "LBUT", buf1);
+ DBWriteContactSettingWord(0, TTB_OPTDIR, AS(buf, fixname, ""), i);
+ DBWriteContactSettingString(0, TTB_OPTDIR, AS(buf, fixname, "_name"), LBUTS[i].name);
+ DBWriteContactSettingTString(0, TTB_OPTDIR, AS(buf, fixname, "_lpath"), LBUTS[i].lpath);
}
- else
- {
- AS(fixname, "LBUT", buf1);
+ else {
+ AS(fixname, "LBUT", buf1);
DBWriteContactSettingWord(0, TTB_OPTDIR, AS(buf, fixname, ""), -1);
DBDeleteContactSetting(0, TTB_OPTDIR, AS(buf, fixname, ""));
DBDeleteContactSetting(0, TTB_OPTDIR, AS(buf, fixname, "_lpath"));
@@ -170,24 +162,19 @@ int SaveAllLButs() }
}
return 0;
-
}
-
//return 0 on success, -1 on error
INT_PTR InsertNewFreeLBut(WPARAM wParam, LPARAM lParam)
{
char buf[256];
- if (LButCnt<MAXLBUTS)
- {
- int i;
- for (i = 0;i<MAXLBUTS;i++)
- {
- if (LBUTS[i].hframe == 0)
+ if (LButCnt < MAXLBUTS) {
+ for (int i = 0;i<MAXLBUTS;i++) {
+ if (LBUTS[i].hframe == 0)
{
- wsprintf(buf, "%s %d", Translate("Default"), i);
+ wsprintfA(buf, "%s %d", Translate("Default"), i);
LBUTS[i].name = _strdup(buf);
- LBUTS[i].lpath = _strdup("Execute Path");
+ LBUTS[i].lpath = _tcsdup( _T("Execute Path"));
LBUTS[i].hframe = InsertLBut(i);
SaveAllLButs();
return 0;
diff --git a/plugins/TopToolBar/main.cpp b/plugins/TopToolBar/main.cpp index 6597cb041d..df441b85cb 100644 --- a/plugins/TopToolBar/main.cpp +++ b/plugins/TopToolBar/main.cpp @@ -22,14 +22,14 @@ extern int SaveAllSeparators(); extern INT_PTR InsertNewFreeSeparator(WPARAM wParam, LPARAM lParam);
extern INT_PTR DeleteSeparator(WPARAM id, LPARAM lParam);
-#define MIID_TTB {0xf593c752, 0x51d8, 0x4d46, {0xba, 0x27, 0x37, 0x57, 0x79, 0x53, 0xf5, 0x5c}}
+#define MIID_TTB {0xf593c752, 0x51d8, 0x4d46, {0xba, 0x27, 0x37, 0x57, 0x79, 0x53, 0xf5, 0x5c}}
int nextButtonId = 200;
int nButtonsCount = 0;
int lastxpos = 1;
int lastypos = 1;
-// == == == == == == == options
+// == == == == == == == options
COLORREF bkColour;
HBITMAP hBmpBackground;
int backgroundBmpUse;
@@ -48,13 +48,13 @@ int applyuserbitmaps(int pos) Buttons[pos].hbBitmapDown = Buttons[pos].hbDefBitmapDown;
Buttons[pos].hbBitmapUp = Buttons[pos].hbDefBitmapUp;
if (Buttons[pos].UserDefinedbmDown != NULL) {
- if (strstr(Buttons[pos].UserDefinedbmDown, ".ico"))
+ if ( _tcsstr(Buttons[pos].UserDefinedbmDown, _T(".ico")))
t = IMAGE_ICON;
Buttons[pos].hbBitmapDown = ( HBITMAP )LoadImage(0, Buttons[pos].UserDefinedbmDown, t, 0, 0, LR_LOADFROMFILE);
}
if (Buttons[pos].UserDefinedbmUp != NULL) {
- if (strstr(Buttons[pos].UserDefinedbmUp, ".ico"))
+ if ( _tcsstr(Buttons[pos].UserDefinedbmUp, _T(".ico")))
t = IMAGE_ICON;
Buttons[pos].hbBitmapUp = ( HBITMAP )LoadImage(0, Buttons[pos].UserDefinedbmUp, t, 0, 0, LR_LOADFROMFILE);
}
@@ -86,7 +86,7 @@ void ulockbut() int idtopos(int id)
{
for ( int i = 0;i<nButtonsCount;i++)
- if (Buttons[i].id == id)
+ if (Buttons[i].id == id)
return i;
return -1;
@@ -95,7 +95,7 @@ int idtopos(int id) int DBSaveButtonSettings(int butpos)
{
char buf[255];
- memset(buf, 0, sizeof(buf));
+ memset(buf, 0, SIZEOF(buf));
DBWriteContactSettingWord(0, TTB_OPTDIR, AS(buf, Buttons[butpos].name, "_Position"), Buttons[butpos].arrangedpos);
@@ -106,10 +106,10 @@ int DBSaveButtonSettings(int butpos) DBWriteContactSettingString(0, TTB_OPTDIR, AS(buf, Buttons[butpos].name, "_BmpUp"), "");
if (Buttons[butpos].UserDefinedbmDown != NULL)
- DBWriteContactSettingString(0, TTB_OPTDIR, AS(buf, Buttons[butpos].name, "_BmpDown"), Buttons[butpos].UserDefinedbmDown);
+ DBWriteContactSettingTString(0, TTB_OPTDIR, AS(buf, Buttons[butpos].name, "_BmpDown"), Buttons[butpos].UserDefinedbmDown);
if (Buttons[butpos].UserDefinedbmUp != NULL)
- DBWriteContactSettingString(0, TTB_OPTDIR, AS(buf, Buttons[butpos].name, "_BmpUp"), Buttons[butpos].UserDefinedbmUp);
+ DBWriteContactSettingTString(0, TTB_OPTDIR, AS(buf, Buttons[butpos].name, "_BmpUp"), Buttons[butpos].UserDefinedbmUp);
return 0;
}
@@ -127,7 +127,7 @@ int SaveAllButtonsOptions() int DBLoadButtonSettings(int butpos)
{
char buf[255];
- memset(buf, 0, sizeof(buf));
+ memset(buf, 0, SIZEOF(buf));
//bool
Buttons[butpos].arrangedpos = DBGetContactSettingWord(0, TTB_OPTDIR, AS(buf, Buttons[butpos].name, "_Position"), MAX_BUTTONS);
@@ -136,14 +136,14 @@ int DBLoadButtonSettings(int butpos) if ( DBGetContactSettingDword(0, TTB_OPTDIR, AS(buf, Buttons[butpos].name, "_Visible"), oldv) > 0 )
Buttons[butpos].dwFlags |= TTBBF_VISIBLE;
- Buttons[butpos].UserDefinedbmDown = DBGetString(0, TTB_OPTDIR, AS(buf, Buttons[butpos].name, "_BmpDown"));
- if ((Buttons[butpos].UserDefinedbmDown != NULL) && strlen(Buttons[butpos].UserDefinedbmDown) == 0) {
+ Buttons[butpos].UserDefinedbmDown = DBGetStringT(0, TTB_OPTDIR, AS(buf, Buttons[butpos].name, "_BmpDown"));
+ if ((Buttons[butpos].UserDefinedbmDown != NULL) && *Buttons[butpos].UserDefinedbmDown == 0) {
free(Buttons[butpos].UserDefinedbmDown);
Buttons[butpos].UserDefinedbmDown = NULL;
}
- Buttons[butpos].UserDefinedbmUp = DBGetString(0, TTB_OPTDIR, AS(buf, Buttons[butpos].name, "_BmpUp"));
- if ((Buttons[butpos].UserDefinedbmUp != NULL) && strlen(Buttons[butpos].UserDefinedbmUp) == 0) {
+ Buttons[butpos].UserDefinedbmUp = DBGetStringT(0, TTB_OPTDIR, AS(buf, Buttons[butpos].name, "_BmpUp"));
+ if ((Buttons[butpos].UserDefinedbmUp != NULL) && *Buttons[butpos].UserDefinedbmUp == 0) {
free(Buttons[butpos].UserDefinedbmUp);
Buttons[butpos].UserDefinedbmUp = NULL;
}
@@ -245,7 +245,7 @@ static int UpdateToolTip(int bpos) bool nameexists(const char *name)
{
for (int i = 0; i < nButtonsCount; i++)
- if (strcmp(Buttons[i].name, name) == 0)
+ if (strcmp(Buttons[i].name, name) == 0)
return TRUE;
return FALSE;
@@ -258,7 +258,7 @@ HICON LoadIconFromLibrary(char *SectName, char *Name, char *Description, HICON h if (Name != NULL && *Name != 0) {
char iconame[256];
- _snprintf(iconame, sizeof(iconame), "toptoolbar_%s", Name);
+ _snprintf(iconame, SIZEOF(iconame), "toptoolbar_%s", Name);
if ( ServiceExists(MS_SKIN2_ADDICON)) {
if (RegisterIt) {
SKINICONDESC sid = {0};
@@ -268,12 +268,12 @@ HICON LoadIconFromLibrary(char *SectName, char *Name, char *Description, HICON h sid.pszDefaultFile = NULL;
sid.pszDescription = Description;
sid.hDefaultIcon = hIcon;
- CallService(MS_SKIN2_ADDICON, 0, (LPARAM)&sid);
+ CallService(MS_SKIN2_ADDICON, 0, (LPARAM)&sid);
if (RegistredOk)
*RegistredOk = TRUE;
}
- return ((HICON)CallService(MS_SKIN2_GETICON, 0, (LPARAM)iconame));
+ return ((HICON)CallService(MS_SKIN2_GETICON, 0, (LPARAM)iconame));
}
}
@@ -283,9 +283,9 @@ HICON LoadIconFromLibrary(char *SectName, char *Name, char *Description, HICON h int CreateOneWindow(int ButtonPos)
{
if (DBGetContactSettingByte(0, TTB_OPTDIR, "UseMirandaButtonClass", UseMirandaButtonClassDefaultValue) && !(Buttons[ButtonPos].dwFlags & TTBBF_ISSEPARATOR))
- Buttons[ButtonPos].hwnd = CreateWindow(MYMIRANDABUTTONCLASS, "", BS_PUSHBUTTON|WS_CHILD|WS_TABSTOP|SS_NOTIFY, 0, 0, BUTTWIDTH, BUTTHEIGHT, hwndTopToolBar, NULL, hInst, 0);
+ Buttons[ButtonPos].hwnd = CreateWindow(MYMIRANDABUTTONCLASS, _T(""), BS_PUSHBUTTON|WS_CHILD|WS_TABSTOP|SS_NOTIFY, 0, 0, BUTTWIDTH, BUTTHEIGHT, hwndTopToolBar, NULL, hInst, 0);
else
- Buttons[ButtonPos].hwnd = CreateWindow("STATIC", "", WS_CHILD|SS_NOTIFY, 0, 0, BUTTWIDTH, BUTTHEIGHT, hwndTopToolBar, NULL, hInst, 0);
+ Buttons[ButtonPos].hwnd = CreateWindow( _T("STATIC"), _T(""), WS_CHILD|SS_NOTIFY, 0, 0, BUTTWIDTH, BUTTHEIGHT, hwndTopToolBar, NULL, hInst, 0);
SetWindowLongPtr(Buttons[ButtonPos].hwnd, GWLP_USERDATA, Buttons[ButtonPos].id);
if (DBGetContactSettingByte(0, TTB_OPTDIR, "UseFlatButton", 1))
@@ -297,30 +297,29 @@ int CreateOneWindow(int ButtonPos) INT_PTR TTBAddButton(WPARAM wParam, LPARAM lParam)
{
int i, retval;
- TTBButtonV2 but;
- if (wParam == 0)
+ if (wParam == 0)
return -1;
- if (hwndContactList == 0)
+
+ if (hwndContactList == 0)
hwndContactList = (HWND)CallService(MS_CLUI_GETHWND, 0, 0);
//oops clui even now not loaded...sorry no buttons available
- if (hwndContactList == 0)
+ if (hwndContactList == 0)
return -1;
lockbut();
- if (nButtonsCount == MAX_BUTTONS)
+ if (nButtonsCount == MAX_BUTTONS)
return -1;
i = nButtonsCount;
- memset(&but, 0, sizeof(but));
-
- if (((TTBButton*)wParam)->cbSize == sizeof(TTBButton))
+ TTBButtonV2 but = { 0 };
+ if (((TTBButton*)wParam)->cbSize == sizeof(TTBButton))
memcpy(&but, (void*)wParam, sizeof(TTBButton));
- if (((TTBButton*)wParam)->cbSize == sizeof(TTBButtonV2))
+ if (((TTBButton*)wParam)->cbSize == sizeof(TTBButtonV2))
memcpy(&but, (void*)wParam, sizeof(TTBButtonV2));
- if ( but.name == NULL|| nameexists(but.name)) {
+ if ( but.name == NULL|| nameexists(but.name)) {
ulockbut();
return -1;
}
@@ -363,18 +362,18 @@ INT_PTR TTBAddButton(WPARAM wParam, LPARAM lParam) Buttons[i].hIconDn = LoadIconFromLibrary("TopToolBar", buf, buf, but.hIconUp, TRUE, NULL);
}
- Buttons[i].hwndTip = CreateWindowEx(0, TOOLTIPS_CLASS, NULL,
+ Buttons[i].hwndTip = CreateWindowEx(0, TOOLTIPS_CLASS, NULL,
WS_POPUP | TTS_NOPREFIX | TTS_ALWAYSTIP,
- CW_USEDEFAULT, CW_USEDEFAULT,
- CW_USEDEFAULT, CW_USEDEFAULT,
- hwndTopToolBar, NULL, hInst,
+ CW_USEDEFAULT, CW_USEDEFAULT,
+ CW_USEDEFAULT, CW_USEDEFAULT,
+ hwndTopToolBar, NULL, hInst,
NULL);
- SetWindowPos(Buttons[i].hwndTip, HWND_TOPMOST, 0, 0, 0, 0, SWP_NOMOVE | SWP_NOSIZE | SWP_NOACTIVATE);
+ SetWindowPos(Buttons[i].hwndTip, HWND_TOPMOST, 0, 0, 0, 0, SWP_NOMOVE | SWP_NOSIZE | SWP_NOACTIVATE);
TOOLINFO ti = { 0 };
ti.cbSize = sizeof(ti);
- ti.lpszText = "";
+ ti.lpszText = _T("");
ti.hinst = hInst;
ti.uFlags = TTF_IDISHWND|TTF_SUBCLASS ;
ti.uId = (UINT_PTR)Buttons[i].hwnd;
@@ -463,7 +462,7 @@ int ArrangeButtons() int i;
int newheight, cnt, perline;
- if (StopArrange == TRUE)
+ if (StopArrange == TRUE)
return 0;
BUTTHEIGHT = DBGetContactSettingByte(0, TTB_OPTDIR, "BUTTHEIGHT", 16);
@@ -492,11 +491,11 @@ int ArrangeButtons() visbut++;
}
- if (winrc.left == 0)
+ if (winrc.left == 0)
return 0;
perline = winrc.left/(BUTTWIDTH+1);
- if (perline == 0)
+ if (perline == 0)
perline = 1;
cnt = (visbut)/perline;
@@ -522,7 +521,7 @@ int ArrangeButtons() InvalidateRect(Buttons[arrangedbuts[i].oldpos].hwnd, NULL, TRUE);
//lastxpos += BUTTWIDTH+1;
- if (i == v-1)
+ if (i == v-1)
break;
if ( !(Buttons[arrangedbuts[i+1].oldpos].dwFlags & TTBBF_VISIBLE))
continue;
@@ -553,7 +552,7 @@ int ArrangeButtons() int SetButtBitmap(int pos)
{
int t = IMAGE_BITMAP;
- char *curname = (Buttons[pos].bPushed)?(Buttons[pos].UserDefinedbmDown):(Buttons[pos].UserDefinedbmUp);
+ TCHAR *curname = (Buttons[pos].bPushed)?(Buttons[pos].UserDefinedbmDown):(Buttons[pos].UserDefinedbmUp);
int curstyle = GetWindowLongPtr(Buttons[pos].hwnd, GWL_STYLE);
curstyle &= (~SS_BITMAP);
@@ -561,20 +560,20 @@ int SetButtBitmap(int pos) if (!UseIcoLib||(Buttons[pos].dwFlags&TTBBF_ISSEPARATOR)) {
if (curname != NULL) {
- if (strstr(curname, ".ico"))
+ if ( _tcsstr(curname, _T(".ico")))
t = IMAGE_ICON;
- curstyle |= (t == IMAGE_ICON || UseIcoLib) ? SS_ICON : SS_BITMAP;
+ curstyle |= (t == IMAGE_ICON || UseIcoLib) ? SS_ICON : SS_BITMAP;
SetWindowLongPtr(Buttons[pos].hwnd, GWL_STYLE, curstyle);
}
- else SetWindowLongPtr(Buttons[pos].hwnd, GWL_STYLE, curstyle|(Buttons[pos].hbBitmapDown == NULL?SS_ICON:SS_BITMAP));
+ else SetWindowLongPtr(Buttons[pos].hwnd, GWL_STYLE, curstyle|(Buttons[pos].hbBitmapDown == NULL?SS_ICON:SS_BITMAP));
}
else if (GetWindowLongPtr(Buttons[pos].hwnd, GWL_STYLE)&SS_ICON)
SetWindowLongPtr(Buttons[pos].hwnd, GWL_STYLE, curstyle|SS_ICON);
if ( !UseIcoLib||(Buttons[pos].dwFlags & TTBBF_ISSEPARATOR)) {
if (!(Buttons[pos].dwFlags & TTBBF_DRAWBORDER)) {
- if (Buttons[pos].hbBitmapDown == NULL) {
+ if (Buttons[pos].hbBitmapDown == NULL) {
t = IMAGE_ICON;
SendMessage(Buttons[pos].hwnd, STM_SETIMAGE, t, (LPARAM)((Buttons[pos].bPushed)?(Buttons[pos].hIconDn):(Buttons[pos].hIconUp)));
SendMessage(Buttons[pos].hwnd, BM_SETIMAGE, t, (LPARAM)((Buttons[pos].bPushed)?(Buttons[pos].hIconDn):(Buttons[pos].hIconUp)));
@@ -618,7 +617,7 @@ INT_PTR TTBGetState(WPARAM wParam, LPARAM lParam) return -1;
}
- int retval = (Buttons[pos].bPushed == TRUE) ? TTBST_PUSHED : TTBST_RELEASED;
+ int retval = (Buttons[pos].bPushed == TRUE) ? TTBST_PUSHED : TTBST_RELEASED;
ulockbut();
return retval;
}
@@ -693,7 +692,7 @@ INT_PTR TTBSetOptions(WPARAM wParam, LPARAM lParam) switch(LOWORD(wParam)) {
case TTBO_FLAGS:
- if (Buttons[pos].dwFlags == lParam)
+ if (Buttons[pos].dwFlags == lParam)
break;
Buttons[pos].dwFlags = lParam;
@@ -722,11 +721,11 @@ INT_PTR TTBSetOptions(WPARAM wParam, LPARAM lParam) break;
case TTBO_TIPNAME:
- if (lParam == 0)
+ if (lParam == 0)
break;
if (Buttons[pos].tooltip != NULL)
free(Buttons[pos].tooltip);
- Buttons[pos].tooltip = _strdup((LPCSTR)lParam);
+ Buttons[pos].tooltip = _tcsdup((LPCTSTR)lParam);
UpdateToolTip(pos);
retval = 1;
break;
@@ -780,7 +779,7 @@ BOOL WINAPI DllMain(HINSTANCE hinstDLL, DWORD fdwReason, LPVOID lpvReserved) return TRUE;
}
-LRESULT CALLBACK TopToolBarProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam)
+LRESULT CALLBACK TopToolBarProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam)
{
switch(msg) {
case WM_CREATE:
@@ -817,7 +816,7 @@ LRESULT CALLBACK TopToolBarProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lP rcPaint = &(paintst.rcPaint);
GetClientRect(hwnd, &clRect);
- if (rcPaint == NULL) rcPaint = &clRect;
+ if (rcPaint == NULL) rcPaint = &clRect;
y = -yScroll;
hdcMem = CreateCompatibleDC(hdc);
hBmpOsb = CreateBitmap(clRect.right, clRect.bottom, 1, GetDeviceCaps(hdc, BITSPIXEL), NULL);
@@ -910,7 +909,7 @@ LRESULT CALLBACK TopToolBarProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lP if (DBGetContactSettingByte(NULL, "CLUI", "ClientAreaDrag", 0)) {
POINT pt;
GetCursorPos(&pt);
- return SendMessage(GetParent(hwnd), WM_SYSCOMMAND, SC_MOVE|HTCAPTION, MAKELPARAM(pt.x, pt.y));
+ return SendMessage(GetParent(hwnd), WM_SYSCOMMAND, SC_MOVE|HTCAPTION, MAKELPARAM(pt.x, pt.y));
}
return 0;
@@ -918,7 +917,7 @@ LRESULT CALLBACK TopToolBarProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lP return 0;
case WM_COMMAND:
- if ((HIWORD(wParam) == STN_CLICKED|| HIWORD(wParam) == STN_DBLCLK)) {
+ if ((HIWORD(wParam) == STN_CLICKED|| HIWORD(wParam) == STN_DBLCLK)) {
int id = GetWindowLongPtr((HWND)lParam, GWLP_USERDATA);
if (id != 0) {
lockbut();
@@ -950,15 +949,15 @@ LRESULT CALLBACK TopToolBarProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lP break;
default:
- return DefWindowProc(hwnd, msg, wParam, lParam);
+ return DefWindowProc(hwnd, msg, wParam, lParam);
}
return(TRUE);
}
+static TCHAR pluginname[] = _T("TopToolBar");
+
int addTopToolBarWindow(HWND parent)
{
- char pluginname[] = "TopToolBar";
-
WNDCLASS wndclass;
wndclass.style = 0;
wndclass.lpfnWndProc = TopToolBarProc;
@@ -966,7 +965,7 @@ int addTopToolBarWindow(HWND parent) wndclass.cbWndExtra = 0;
wndclass.hInstance = hInst;
wndclass.hIcon = NULL;
- wndclass.hCursor = LoadCursor (NULL, IDC_ARROW);
+ wndclass.hCursor = LoadCursor (NULL, IDC_ARROW);
wndclass.hbrBackground = (HBRUSH)(COLOR_BTNFACE+1);//NULL;//(HBRUSH)(COLOR_3DFACE+1);
wndclass.lpszMenuName = NULL;
wndclass.lpszClassName = pluginname;
@@ -978,31 +977,26 @@ int addTopToolBarWindow(HWND parent) ttbOptionsChanged();
CLISTFrame Frame = { 0 };
- Frame.name = (char *)malloc(255);
- memset(Frame.name, 0, 255);
- memcpy(Frame.name, pluginname, sizeof(pluginname));
Frame.cbSize = sizeof(Frame);
+ Frame.tname = pluginname;
Frame.hWnd = pluginwind;
Frame.align = alTop;
- Frame.Flags = F_VISIBLE|F_NOBORDER|F_LOCKED;
+ Frame.Flags = F_VISIBLE | F_NOBORDER | F_LOCKED | F_TCHAR;
Frame.height = 18;
-
- int retval = CallService(MS_CLIST_FRAMES_ADDFRAME, (WPARAM)&Frame, 0);
- free(Frame.name);
- return retval;
+ return (int)CallService(MS_CLIST_FRAMES_ADDFRAME, (WPARAM)&Frame, 0);
}
VOID CALLBACK TimerProc(HWND hwnd, UINT uMsg, UINT_PTR idEvent, DWORD dwTime)
{
KillTimer(0, idEvent);
- NotifyEventHooks(hHookTTBModuleLoaded, 0, 0);
+ NotifyEventHooks(hHookTTBModuleLoaded, 0, 0);
}
static INT_PTR OnEventFire(WPARAM wParam, LPARAM lParam)
{
CallService(MS_SYSTEM_REMOVEWAIT, wParam, 0);
StopArrange = FALSE;
- NotifyEventHooks(hHookTTBModuleLoaded, 0, 0);
+ NotifyEventHooks(hHookTTBModuleLoaded, 0, 0);
return 0;
}
@@ -1031,23 +1025,12 @@ static int OnBGChange(WPARAM wParam, LPARAM lParam) static int OnmodulesLoad(WPARAM wParam, LPARAM lParam)
{
- int ex = 0;
-
- hwndContactList = (HWND)CallService(MS_CLUI_GETHWND, 0, 0);
-
if (!ServiceExists(MS_CLIST_FRAMES_ADDFRAME)) {
- MessageBox(0, "Frames Services not found - plugin disabled.You need MultiWindow plugin.", "TopToolBar", 0);
- return 0;
- ex = 1;
- }
- if (!ServiceExists(MS_CLUI_GETHWNDTREE)) {
- MessageBox(0, "MS_CLUI_GETHWNDTREE Service not found - plugin disabled", "TopToolBar", 0);
+ MessageBox(0, TranslateT("Frames Services not found - plugin disabled.You need MultiWindow plugin."), _T("TopToolBar"), 0);
return 0;
- ex = 1;
}
- if (ex == 1)
- return 0;
+ hwndContactList = (HWND)CallService(MS_CLUI_GETHWND, 0, 0);
OptionsOpened = false;
CreateServiceFunction(MS_TTB_ADDBUTTON, TTBAddButton);
@@ -1092,7 +1075,7 @@ static int OnmodulesLoad(WPARAM wParam, LPARAM lParam) /////////////////////////////////////////////////////////////////////////////////////////
-static const MUUID interfaces[] = {MIID_TTB, MIID_LAST};
+static const MUUID interfaces[] = {MIID_TTB, MIID_LAST};
extern "C" __declspec(dllexport) const MUUID* MirandaPluginInterfaces(void)
{
diff --git a/plugins/TopToolBar/main.rc b/plugins/TopToolBar/main.rc index 077a62be21..72857524c4 100644 --- a/plugins/TopToolBar/main.rc +++ b/plugins/TopToolBar/main.rc @@ -17,7 +17,7 @@ #if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_NEU)
#ifdef _WIN32
-LANGUAGE LANG_NEUTRAL, SUBLANG_NEUTRAL
+LANGUAGE LANG_NEUTRAL, SUBLANG_NEUTRAL
#pragma code_page(1251)
#endif //_WIN32
@@ -26,9 +26,9 @@ LANGUAGE LANG_NEUTRAL, SUBLANG_NEUTRAL // Dialog
//
-IDD_OPT_BUTORDER DIALOGEX 0, 0, 300, 231
+IDD_OPT_BUTORDER DIALOGEX 0, 0, 300, 231
STYLE DS_SETFONT | WS_CHILD
-FONT 8, "MS Sans Serif", 0, 0, 0x1
+FONT 8, "MS Sans Serif", 0, 0, 0x1
BEGIN
GROUPBOX "Buttons Order && Visibility", IDC_STATIC, 10, 0, 150, 180
CONTROL "Tree1", IDC_BUTTONORDERTREE, "SysTreeView32", TVS_NOTOOLTIPS | WS_BORDER | WS_TABSTOP, 20, 25, 132, 100
@@ -71,18 +71,18 @@ END #ifdef APSTUDIO_INVOKED
GUIDELINES DESIGNINFO
BEGIN
- IDD_OPT_BUTORDER, DIALOG
+ IDD_OPT_BUTORDER, DIALOG
BEGIN
- VERTGUIDE, 8
- VERTGUIDE, 140
- VERTGUIDE, 158
- VERTGUIDE, 290
- VERTGUIDE, 297
- BOTTOMMARGIN, 229
- HORZGUIDE, 17
- HORZGUIDE, 38
- HORZGUIDE, 133
- HORZGUIDE, 138
+ VERTGUIDE, 8
+ VERTGUIDE, 140
+ VERTGUIDE, 158
+ VERTGUIDE, 290
+ VERTGUIDE, 297
+ BOTTOMMARGIN, 229
+ HORZGUIDE, 17
+ HORZGUIDE, 38
+ HORZGUIDE, 133
+ HORZGUIDE, 138
END
END
#endif // APSTUDIO_INVOKED
@@ -96,7 +96,7 @@ END #if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_RUS)
#ifdef _WIN32
-LANGUAGE LANG_RUSSIAN, SUBLANG_DEFAULT
+LANGUAGE LANG_RUSSIAN, SUBLANG_DEFAULT
#pragma code_page(1251)
#endif //_WIN32
@@ -105,9 +105,9 @@ LANGUAGE LANG_RUSSIAN, SUBLANG_DEFAULT // Dialog
//
-IDD_FRAMEPLUG2 DIALOG 0, 0, 211, 11
+IDD_FRAMEPLUG2 DIALOG 0, 0, 211, 11
STYLE DS_SETFONT | WS_CHILD | WS_VISIBLE | WS_CLIPCHILDREN
-FONT 8, "MS Sans Serif"
+FONT 8, "MS Sans Serif"
BEGIN
CONTROL 262, IDC_P2ONLINEBUTT, "Static", SS_BITMAP | SS_NOTIFY | NOT WS_VISIBLE, 55, 0, 13, 10
CONTROL 269, IDC_P2GROUPBUTT, "Static", SS_BITMAP | SS_NOTIFY | NOT WS_VISIBLE, 70, 0, 13, 10
@@ -122,10 +122,10 @@ END #ifdef APSTUDIO_INVOKED
GUIDELINES DESIGNINFO
BEGIN
- IDD_FRAMEPLUG2, DIALOG
+ IDD_FRAMEPLUG2, DIALOG
BEGIN
- RIGHTMARGIN, 197
- BOTTOMMARGIN, 10
+ RIGHTMARGIN, 197
+ BOTTOMMARGIN, 10
END
END
#endif // APSTUDIO_INVOKED
@@ -210,18 +210,18 @@ BEGIN BEGIN
BLOCK "041904b0"
BEGIN
- VALUE "FileDescription", "ToptoolBar adds buttons in top frame for fast access."
- VALUE "FileVersion", "0.7.3.1"
- VALUE "InternalName", "TopToolBar"
- VALUE "LegalCopyright", "© 2003-2008 Bethoven"
- VALUE "OriginalFilename", "TopToolbar.dll"
- VALUE "ProductName", "TopToolBar"
- VALUE "ProductVersion", "0.7.3.1"
+ VALUE "FileDescription", "ToptoolBar adds buttons in top frame for fast access."
+ VALUE "FileVersion", "0.7.3.1"
+ VALUE "InternalName", "TopToolBar"
+ VALUE "LegalCopyright", "© 2003-2008 Bethoven"
+ VALUE "OriginalFilename", "TopToolbar.dll"
+ VALUE "ProductName", "TopToolBar"
+ VALUE "ProductVersion", "0.7.3.1"
END
END
BLOCK "VarFileInfo"
BEGIN
- VALUE "Translation", 0x419, 1200
+ VALUE "Translation", 0x419, 1200
END
END
@@ -234,7 +234,7 @@ END #if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_ENG)
#ifdef _WIN32
-LANGUAGE LANG_ENGLISH, SUBLANG_ENGLISH_UK
+LANGUAGE LANG_ENGLISH, SUBLANG_ENGLISH_UK
#pragma code_page(1252)
#endif //_WIN32
@@ -256,7 +256,7 @@ IDI_TICK ICON "icos\\notick1.ico" #if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_ENC)
#ifdef _WIN32
-LANGUAGE LANG_ENGLISH, SUBLANG_ENGLISH_CAN
+LANGUAGE LANG_ENGLISH, SUBLANG_ENGLISH_CAN
#pragma code_page(1252)
#endif //_WIN32
@@ -265,10 +265,10 @@ LANGUAGE LANG_ENGLISH, SUBLANG_ENGLISH_CAN // Dialog
//
-IDD_OPT_TTBBKG DIALOGEX 0, 0, 235, 132
+IDD_OPT_TTBBKG DIALOGEX 0, 0, 235, 132
STYLE DS_SETFONT | DS_FIXEDSYS | WS_CHILD | WS_VISIBLE
EXSTYLE WS_EX_CONTROLPARENT
-FONT 8, "MS Shell Dlg", 0, 0, 0x1
+FONT 8, "MS Shell Dlg", 0, 0, 0x1
BEGIN
GROUPBOX "TopToolBar Background", IDC_STATIC, 4, 4, 227, 124
LTEXT "Background colour:", IDC_STATIC, 12, 20, 72, 8, NOT WS_GROUP
@@ -295,21 +295,21 @@ END #ifdef APSTUDIO_INVOKED
GUIDELINES DESIGNINFO
BEGIN
- IDD_OPT_TTBBKG, DIALOG
+ IDD_OPT_TTBBKG, DIALOG
BEGIN
- LEFTMARGIN, 4
- RIGHTMARGIN, 231
- VERTGUIDE, 12
- VERTGUIDE, 22
- VERTGUIDE, 122
- TOPMARGIN, 4
- BOTTOMMARGIN, 128
- HORZGUIDE, 24
- HORZGUIDE, 40
- HORZGUIDE, 73
- HORZGUIDE, 89
- HORZGUIDE, 102
- HORZGUIDE, 115
+ LEFTMARGIN, 4
+ RIGHTMARGIN, 231
+ VERTGUIDE, 12
+ VERTGUIDE, 22
+ VERTGUIDE, 122
+ TOPMARGIN, 4
+ BOTTOMMARGIN, 128
+ HORZGUIDE, 24
+ HORZGUIDE, 40
+ HORZGUIDE, 73
+ HORZGUIDE, 89
+ HORZGUIDE, 102
+ HORZGUIDE, 115
END
END
#endif // APSTUDIO_INVOKED
diff --git a/plugins/TopToolBar/separators.cpp b/plugins/TopToolBar/separators.cpp index 28cd67857e..ae122b1b71 100644 --- a/plugins/TopToolBar/separators.cpp +++ b/plugins/TopToolBar/separators.cpp @@ -13,7 +13,7 @@ int InsertSeparator(int id) HBITMAP Separator = LoadBitmap(hInst, MAKEINTRESOURCE(IDB_SEP));
char buf[255];
- wsprintf(buf, "%s %d", Translate("Separator"), id);
+ wsprintfA(buf, "%s %d", Translate("Separator"), id);
TTBButton ttb = { 0 };
ttb.cbSize = sizeof(ttb);
@@ -57,7 +57,7 @@ int LoadAllSeparators() _itoa(i, buf1, 10);
int id = DBGetContactSettingWord(0, TTB_OPTDIR, AS(buf, "Sep", buf1), -1);
- if (id == i)
+ if (id == i)
Separators[i] = InsertSeparator(i);
}
return 0;
@@ -86,7 +86,7 @@ INT_PTR InsertNewFreeSeparator(WPARAM wParam, LPARAM lParam) {
if (SeparatorCnt < MAXSEPS) {
for (int i = 0; i < MAXSEPS; i++) {
- if (Separators[i] == 0) {
+ if (Separators[i] == 0) {
Separators[i] = InsertSeparator(i);
SaveAllSeparators();
return 0;
diff --git a/plugins/TopToolBar/ttbopt.cpp b/plugins/TopToolBar/ttbopt.cpp index aea347c2fe..6167f3e19e 100644 --- a/plugins/TopToolBar/ttbopt.cpp +++ b/plugins/TopToolBar/ttbopt.cpp @@ -2,7 +2,7 @@ #include <shlobj.h>
#pragma hdrstop
-static BOOL CALLBACK DlgProcTTBBkgOpts(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lParam);
+static INT_PTR CALLBACK DlgProcTTBBkgOpts(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lParam);
extern int ttbOptionsChanged();
extern HINSTANCE hInst;
@@ -20,42 +20,41 @@ struct OrderData HTREEITEM hDragItem;
};
-char *SetEndSlash(char *str)
+TCHAR *SetEndSlash(TCHAR *str)
{
- if (str == NULL || *str == 0)
+ if (str == NULL || *str == 0)
return NULL;
- char *outs = str;
- if (str[strlen(str)-1] != '\\') {
- outs = (char*)malloc(strlen(str)+3);
- memset(outs, 0, strlen(str)+3);
- strcat(outs, str);
- outs[strlen(str)] = '\\';
+ TCHAR *outs = str;
+ if (str[_tcslen(str)-1] != '\\') {
+ outs = (TCHAR*)calloc( sizeof(TCHAR), _tcslen(str)+3);
+ _tcscat(outs, str);
+ outs[_tcslen(str)] = '\\';
}
return outs;
}
-bool FileExists(char *fname)
+bool FileExists(TCHAR *fname)
{
WIN32_FIND_DATA wfd = { 0 };
HANDLE h = FindFirstFile(fname, &wfd);
- if (h == INVALID_HANDLE_VALUE)
+ if (h == INVALID_HANDLE_VALUE)
return FALSE;
FindClose(h);
return TRUE;
}
-char *ReplaceBadChar(char *str, char bad, char toreplace)
+TCHAR *ReplaceBadChar(TCHAR *str, TCHAR bad, TCHAR toreplace)
{
- for (int i = 0; i < strlen(str); i++)
- if (str[i] == bad)
+ for (int i = 0; str[i] != 0; i++)
+ if (str[i] == bad)
str[i] = toreplace;
return str;
}
-char *ReplaceAll(char *str)
+TCHAR *ReplaceAll(TCHAR *str)
{
ReplaceBadChar(str, '\\', '_');
ReplaceBadChar(str, '/', '_');
@@ -69,42 +68,42 @@ char *ReplaceAll(char *str) return str;
}
-void AssignBitmapsFromDir(char *dir)
+void AssignBitmapsFromDir(TCHAR *dir)
{
- if (dir == NULL || *dir == 0 )
+ if (dir == NULL || *dir == 0 )
return;
dir = SetEndSlash(dir);
lockbut();
for (int i = 0; i < nButtonsCount; i++) {
- char curnameUP[512], curnameDN[512], ChangedName[512];
- strcpy(ChangedName, Buttons[i].name);
+ TCHAR curnameUP[512], curnameDN[512], ChangedName[512];
+ _tcscpy(ChangedName, _A2T(Buttons[i].name));
ReplaceAll(ChangedName);
- wsprintf(curnameUP, "%s%s_UP.bmp", dir, ChangedName);
- wsprintf(curnameDN, "%s%s_DN.bmp", dir, ChangedName);
+ wsprintf(curnameUP, _T("%s%s_UP.bmp"), dir, ChangedName);
+ wsprintf(curnameDN, _T("%s%s_DN.bmp"), dir, ChangedName);
if ( FileExists(curnameUP)) {
if (Buttons[i].UserDefinedbmUp != NULL){free(Buttons[i].UserDefinedbmUp);}
- Buttons[i].UserDefinedbmUp = _strdup(curnameUP);
+ Buttons[i].UserDefinedbmUp = _tcsdup(curnameUP);
}
if ( FileExists(curnameDN)) {
if (Buttons[i].UserDefinedbmDown != NULL){free(Buttons[i].UserDefinedbmDown);}
- Buttons[i].UserDefinedbmDown = _strdup(curnameDN);
+ Buttons[i].UserDefinedbmDown = _tcsdup(curnameDN);
}
- wsprintf(curnameUP, "%s%s_UP.ico", dir, ChangedName);
- wsprintf(curnameDN, "%s%s_DN.ico", dir, ChangedName);
+ wsprintf(curnameUP, _T("%s%s_UP.ico"), dir, ChangedName);
+ wsprintf(curnameDN, _T("%s%s_DN.ico"), dir, ChangedName);
if ( FileExists(curnameUP)) {
if (Buttons[i].UserDefinedbmUp != NULL){free(Buttons[i].UserDefinedbmUp);}
- Buttons[i].UserDefinedbmUp = _strdup(curnameUP);
+ Buttons[i].UserDefinedbmUp = _tcsdup(curnameUP);
}
if ( FileExists(curnameDN)) {
if (Buttons[i].UserDefinedbmDown != NULL){free(Buttons[i].UserDefinedbmDown);}
- Buttons[i].UserDefinedbmDown = _strdup(curnameDN);
+ Buttons[i].UserDefinedbmDown = _tcsdup(curnameDN);
}
}
@@ -115,20 +114,19 @@ void AssignBitmapsFromDir(char *dir) void ApplyNewDir(HWND hwnd)
{
- char buf[512];
- char *buf2;
- GetDlgItemText(hwnd, IDC_IMGDIR, buf, 512);
- buf2 = DBGetString(0, TTB_OPTDIR, "ImgDir");
- if ( buf2 == NULL || strcmp(buf, buf2)) {
- DBWriteContactSettingString(0, TTB_OPTDIR, "ImgDir", buf);
+ TCHAR buf[512], *buf2;
+ GetDlgItemText(hwnd, IDC_IMGDIR, buf, SIZEOF(buf));
+ buf2 = DBGetStringT(0, TTB_OPTDIR, "ImgDir");
+ if ( buf2 == NULL || lstrcmp(buf, buf2)) {
+ DBWriteContactSettingTString(0, TTB_OPTDIR, "ImgDir", buf);
AssignBitmapsFromDir(buf);
}
}
int BuildTree(HWND hwndDlg)
{
- PostMessage(GetDlgItem(hwndDlg, IDC_BMPUP), STM_SETIMAGE, IMAGE_BITMAP, 0);
- PostMessage(GetDlgItem(hwndDlg, IDC_BMPDN), STM_SETIMAGE, IMAGE_BITMAP, 0);
+ PostMessage(GetDlgItem(hwndDlg, IDC_BMPUP), STM_SETIMAGE, IMAGE_BITMAP, 0);
+ PostMessage(GetDlgItem(hwndDlg, IDC_BMPDN), STM_SETIMAGE, IMAGE_BITMAP, 0);
OrderData *dat = (struct OrderData*)GetWindowLongPtr(GetDlgItem(hwndDlg, IDC_BUTTONORDERTREE), GWLP_USERDATA);
@@ -138,19 +136,19 @@ int BuildTree(HWND hwndDlg) tvis.item.mask = TVIF_PARAM|TVIF_TEXT|TVIF_IMAGE|TVIF_SELECTEDIMAGE;
TreeView_DeleteAllItems(GetDlgItem(hwndDlg, IDC_BUTTONORDERTREE));
- if (nButtonsCount == 0)
+ if (nButtonsCount == 0)
return FALSE;
for (int i = 0; i < nButtonsCount; i++) {
ButtonOptData *PD = (ButtonOptData*)malloc(sizeof(ButtonOptData));
-
PD->name = Buttons[arrangedbuts[i].oldpos].name;
PD->show = Buttons[arrangedbuts[i].oldpos].dwFlags&TTBBF_VISIBLE?TRUE:FALSE;
PD->pos = arrangedbuts[i].oldpos;
tvis.item.lParam = (LPARAM)PD;
- tvis.item.pszText = Translate(PD->name);
+ tvis.item.pszText = TranslateTS( mir_a2t( PD->name));
tvis.item.iImage = tvis.item.iSelectedImage = PD->show;
TreeView_InsertItem(GetDlgItem(hwndDlg, IDC_BUTTONORDERTREE), &tvis);
+ mir_free( tvis.item.pszText );
tvis.item.iImage = tvis.item.iSelectedImage = PD->show;
}
@@ -185,7 +183,7 @@ int SaveTree(HWND hwndDlg) int pos = ((ButtonOptData *)tvi.lParam)->pos;
if (pos >= 0 && pos < nButtonsCount) {
Buttons[pos].dwFlags &= ~(TTBBF_VISIBLE);
- Buttons[pos].dwFlags |= (((ButtonOptData *)tvi.lParam)->show == TRUE ) ? TTBBF_VISIBLE : 0;
+ Buttons[pos].dwFlags |= (((ButtonOptData *)tvi.lParam)->show == TRUE ) ? TTBBF_VISIBLE : 0;
Buttons[pos].arrangedpos = count;
}
@@ -202,41 +200,41 @@ void SetImagesForCurrent (HWND hwndDlg, int curselect) {
int t = IMAGE_BITMAP;
- PostMessage(GetDlgItem(hwndDlg, IDC_BMPUP), STM_SETIMAGE, t, 0);
- PostMessage(GetDlgItem(hwndDlg, IDC_BMPDN), STM_SETIMAGE, t, 0);
+ PostMessage(GetDlgItem(hwndDlg, IDC_BMPUP), STM_SETIMAGE, t, 0);
+ PostMessage(GetDlgItem(hwndDlg, IDC_BMPDN), STM_SETIMAGE, t, 0);
- char *curname = Buttons[curselect].UserDefinedbmUp;
+ TCHAR *curname = Buttons[curselect].UserDefinedbmUp;
if (curname != NULL) {
- if (strstr(curname, ".ico"))
+ if ( _tcsstr(curname, _T(".ico")))
t = IMAGE_ICON;
int st = WS_CHILDWINDOW | SS_NOTIFY | WS_VISIBLE;
- st |= (t == IMAGE_ICON) ? SS_ICON : SS_BITMAP;
+ st |= (t == IMAGE_ICON) ? SS_ICON : SS_BITMAP;
SetWindowLongPtr(GetDlgItem(hwndDlg, IDC_BMPUP), GWL_STYLE, st);
}
else {
- SetWindowLongPtr(GetDlgItem(hwndDlg, IDC_BMPUP), GWL_STYLE, WS_CHILDWINDOW|WS_VISIBLE|SS_NOTIFY|(Buttons[curselect].hbBitmapDown == NULL?SS_ICON:SS_BITMAP));
+ SetWindowLongPtr(GetDlgItem(hwndDlg, IDC_BMPUP), GWL_STYLE, WS_CHILDWINDOW|WS_VISIBLE|SS_NOTIFY|(Buttons[curselect].hbBitmapDown == NULL?SS_ICON:SS_BITMAP));
t = IMAGE_ICON;
}
- PostMessage(GetDlgItem(hwndDlg, IDC_BMPUP), STM_SETIMAGE, t, (Buttons[curselect].hbBitmapUp == NULL) ? (LPARAM)Buttons[curselect].hIconUp : (LPARAM)Buttons[curselect].hbBitmapUp);
+ PostMessage(GetDlgItem(hwndDlg, IDC_BMPUP), STM_SETIMAGE, t, (Buttons[curselect].hbBitmapUp == NULL) ? (LPARAM)Buttons[curselect].hIconUp : (LPARAM)Buttons[curselect].hbBitmapUp);
curname = Buttons[curselect].UserDefinedbmDown;
if (curname != NULL) {
- if (strstr(curname, ".ico"))
+ if ( _tcsstr(curname, _T(".ico")))
t = IMAGE_ICON;
int st = WS_CHILDWINDOW | SS_NOTIFY | WS_VISIBLE;
- st |= (t == IMAGE_ICON) ? SS_ICON : SS_BITMAP;
+ st |= (t == IMAGE_ICON) ? SS_ICON : SS_BITMAP;
SetWindowLongPtr(GetDlgItem(hwndDlg, IDC_BMPDN), GWL_STYLE, st);
}
else {
- SetWindowLongPtr(GetDlgItem(hwndDlg, IDC_BMPDN), GWL_STYLE, WS_CHILDWINDOW|WS_VISIBLE|SS_NOTIFY|(Buttons[curselect].hbBitmapDown == NULL?SS_ICON:SS_BITMAP));
+ SetWindowLongPtr(GetDlgItem(hwndDlg, IDC_BMPDN), GWL_STYLE, WS_CHILDWINDOW|WS_VISIBLE|SS_NOTIFY|(Buttons[curselect].hbBitmapDown == NULL?SS_ICON:SS_BITMAP));
t = IMAGE_ICON;
}
- PostMessage(GetDlgItem(hwndDlg, IDC_BMPDN), STM_SETIMAGE, t, (Buttons[curselect].hbBitmapDown == NULL) ? (LPARAM)Buttons[curselect].hIconDn : (LPARAM)Buttons[curselect].hbBitmapDown);
+ PostMessage(GetDlgItem(hwndDlg, IDC_BMPDN), STM_SETIMAGE, t, (Buttons[curselect].hbBitmapDown == NULL) ? (LPARAM)Buttons[curselect].hIconDn : (LPARAM)Buttons[curselect].hbBitmapDown);
}
-static BOOL CALLBACK ButOrderOpts(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lParam)
+static INT_PTR CALLBACK ButOrderOpts(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lParam)
{
struct OrderData *dat = (struct OrderData*)GetWindowLongPtr(GetDlgItem(hwndDlg, IDC_BUTTONORDERTREE), GWLP_USERDATA);
@@ -257,8 +255,8 @@ static BOOL CALLBACK ButOrderOpts(HWND hwndDlg, UINT msg, WPARAM wParam, LPAR TreeView_SetImageList(GetDlgItem(hwndDlg, IDC_BUTTONORDERTREE), himlCheckBoxes, TVSIL_NORMAL);
}
- PostMessage(GetDlgItem(hwndDlg, IDC_BMPUP), STM_SETIMAGE, IMAGE_BITMAP, 0);
- PostMessage(GetDlgItem(hwndDlg, IDC_BMPDN), STM_SETIMAGE, IMAGE_BITMAP, 0);
+ PostMessage(GetDlgItem(hwndDlg, IDC_BMPUP), STM_SETIMAGE, IMAGE_BITMAP, 0);
+ PostMessage(GetDlgItem(hwndDlg, IDC_BMPDN), STM_SETIMAGE, IMAGE_BITMAP, 0);
SetDlgItemInt(hwndDlg, IDC_BUTTHEIGHT, DBGetContactSettingByte(0, TTB_OPTDIR, "BUTTHEIGHT", 16), FALSE);
SetDlgItemInt(hwndDlg, IDC_BUTTWIDTH, DBGetContactSettingByte(0, TTB_OPTDIR, "BUTTWIDTH", 20), FALSE);
CheckDlgButton(hwndDlg, IDC_USEMIRANDABUTTON, DBGetContactSettingByte(0, TTB_OPTDIR, "UseMirandaButtonClass", UseMirandaButtonClassDefaultValue));
@@ -275,7 +273,7 @@ static BOOL CALLBACK ButOrderOpts(HWND hwndDlg, UINT msg, WPARAM wParam, LPAR EnableWindow(GetDlgItem(hwndDlg, IDC_EPATH), FALSE);
EnableWindow(GetDlgItem(hwndDlg, IDC_DELLBUTTON), FALSE);
- SetDlgItemText(hwndDlg, IDC_IMGDIR, DBGetString(0, TTB_OPTDIR, "ImgDir"));
+ SetDlgItemText(hwndDlg, IDC_IMGDIR, DBGetStringT(0, TTB_OPTDIR, "ImgDir"));
SendMessage(hwndDlg, WM_COMMAND, 0, 0);
OptionshWnd = hwndDlg;
}
@@ -292,40 +290,37 @@ static BOOL CALLBACK ButOrderOpts(HWND hwndDlg, UINT msg, WPARAM wParam, LPAR EnableWindow(GetDlgItem(hwndDlg, IDC_USEFLAT), IsDlgButtonChecked(hwndDlg, IDC_USEMIRANDABUTTON));
- if (HIWORD(wParam) == EN_CHANGE ) {
- SendMessage(GetParent(hwndDlg), PSM_CHANGED, 0, 0);
+ if (HIWORD(wParam) == EN_CHANGE ) {
+ SendMessage(GetParent(hwndDlg), PSM_CHANGED, 0, 0);
break;
}
- if ((HIWORD(wParam) == BN_CLICKED|| HIWORD(wParam) == BN_DBLCLK)) {
+ if ((HIWORD(wParam) == BN_CLICKED|| HIWORD(wParam) == BN_DBLCLK)) {
int ctrlid = LOWORD(wParam);
- SendMessage(GetParent(hwndDlg), PSM_CHANGED, 0, 0);
-
- if (ctrlid == IDC_OPENIMGDIR) {
- char buf[512];
- PCIDLIST_ABSOLUTE res;
+ SendMessage(GetParent(hwndDlg), PSM_CHANGED, 0, 0);
- BROWSEINFO bi;
- memset(&bi, 0, sizeof(bi));
+ if (ctrlid == IDC_OPENIMGDIR) {
+ TCHAR buf[512];
+ BROWSEINFO bi = { 0 };
bi.hwndOwner = hwndDlg;
bi.pszDisplayName = buf;
- bi.lpszTitle = Translate("Select Directory");
+ bi.lpszTitle = TranslateT("Select Directory");
bi.ulFlags = BIF_RETURNONLYFSDIRS;
- res = SHBrowseForFolder(&bi);
+ PCIDLIST_ABSOLUTE res = SHBrowseForFolder(&bi);
if (res != NULL) {
- if (SHGetPathFromIDList(res, buf) == TRUE) {
- SetDlgItemText(hwndDlg, IDC_IMGDIR, (LPCSTR)&buf);
- SendMessage(GetParent(hwndDlg), PSM_CHANGED, 0, 0);
+ if (SHGetPathFromIDList(res, buf) == TRUE) {
+ SetDlgItemText(hwndDlg, IDC_IMGDIR, buf);
+ SendMessage(GetParent(hwndDlg), PSM_CHANGED, 0, 0);
}
}
break;
}
- if (ctrlid == IDC_LBUTTONSET) {
+ if (ctrlid == IDC_LBUTTONSET) {
int curselect;
TVITEM tvi;
tvi.hItem = TreeView_GetSelection(GetDlgItem(hwndDlg, IDC_BUTTONORDERTREE));
- if (tvi.hItem == NULL){break;}
+ if (tvi.hItem == NULL){break;}
tvi.mask = TVIF_PARAM;
TreeView_GetItem(GetDlgItem(hwndDlg, IDC_BUTTONORDERTREE), &tvi);
@@ -333,12 +328,12 @@ static BOOL CALLBACK ButOrderOpts(HWND hwndDlg, UINT msg, WPARAM wParam, LPAR curselect = ((ButtonOptData *)tvi.lParam)->pos;
if (Buttons[curselect].dwFlags & TTBBF_ISLBUTTON) {
LBUTOPT lbo = { 0 };
- char buf[256];
+ TCHAR buf[256];
GetDlgItemText(hwndDlg, IDC_ENAME, buf, 255);
- lbo.name = _strdup(buf);
+ lbo.name = _strdup( _T2A(buf));
GetDlgItemText(hwndDlg, IDC_EPATH, buf, 255);
- lbo.lpath = _strdup(buf);
+ lbo.lpath = _tcsdup(buf);
CallService(TTB_MODIFYLBUTTON, Buttons[curselect].lParamDown, (LPARAM)&lbo);
free(lbo.name);
@@ -347,19 +342,19 @@ static BOOL CALLBACK ButOrderOpts(HWND hwndDlg, UINT msg, WPARAM wParam, LPAR break;
}
- if (ctrlid == IDC_ADDLBUTTON) {
- if (CallService(TTB_ADDLBUTTON, 0, 0) == 0) {
+ if (ctrlid == IDC_ADDLBUTTON) {
+ if (CallService(TTB_ADDLBUTTON, 0, 0) == 0) {
// BuildTree(hwndDlg);
- SendMessage(GetParent(hwndDlg), PSM_CHANGED, 0, 0);
+ SendMessage(GetParent(hwndDlg), PSM_CHANGED, 0, 0);
}
break;
}
- if (ctrlid == IDC_DELLBUTTON) {
+ if (ctrlid == IDC_DELLBUTTON) {
int curselect;
TVITEM tvi;
tvi.hItem = TreeView_GetSelection(GetDlgItem(hwndDlg, IDC_BUTTONORDERTREE));
- if (tvi.hItem == NULL)
+ if (tvi.hItem == NULL)
break;
tvi.mask = TVIF_PARAM;
@@ -371,29 +366,29 @@ static BOOL CALLBACK ButOrderOpts(HWND hwndDlg, UINT msg, WPARAM wParam, LPAR EnableWindow(GetDlgItem(hwndDlg, IDC_ENAME), FALSE);
EnableWindow(GetDlgItem(hwndDlg, IDC_EPATH), FALSE);
BuildTree(hwndDlg);
- SendMessage(GetParent(hwndDlg), PSM_CHANGED, 0, 0);
+ SendMessage(GetParent(hwndDlg), PSM_CHANGED, 0, 0);
}
}
- if (ctrlid == IDC_ADDSEP) {
- if (CallService(TTB_ADDSEPARATOR, 0, 0) == 0) {
+ if (ctrlid == IDC_ADDSEP) {
+ if (CallService(TTB_ADDSEPARATOR, 0, 0) == 0) {
// BuildTree(hwndDlg);
- SendMessage(GetParent(hwndDlg), PSM_CHANGED, 0, 0);
+ SendMessage(GetParent(hwndDlg), PSM_CHANGED, 0, 0);
}
break;
}
- if (ctrlid == IDC_REMOVESEP) {
+ if (ctrlid == IDC_REMOVESEP) {
TVITEM tvi;
memset(&tvi, 0, sizeof(tvi));
tvi.hItem = TreeView_GetSelection(GetDlgItem(hwndDlg, IDC_BUTTONORDERTREE));
- if (tvi.hItem == NULL){break;}
+ if (tvi.hItem == NULL){break;}
//MessageBoxA(0, "GetSelItem", "log", 0);
tvi.mask = TVIF_PARAM;
TreeView_GetItem(GetDlgItem(hwndDlg, IDC_BUTTONORDERTREE), &tvi);
- if (tvi.lParam == 0)
+ if (tvi.lParam == 0)
break;
if ( IsBadCodePtr(( FARPROC )tvi.lParam)) {
@@ -404,17 +399,17 @@ static BOOL CALLBACK ButOrderOpts(HWND hwndDlg, UINT msg, WPARAM wParam, LPAR int curselect = ((ButtonOptData *)tvi.lParam)->pos;
if ( curselect >= 0 && curselect < nButtonsCount ) {
if (Buttons[curselect].dwFlags&TTBBF_ISSEPARATOR) {
- SendMessage(GetParent(hwndDlg), PSM_CHANGED, 0, 0);
+ SendMessage(GetParent(hwndDlg), PSM_CHANGED, 0, 0);
CallService(TTB_REMOVESEPARATOR, Buttons[curselect].lParamDown, 0);
}
}
break;
}
- if (ctrlid == IDC_DEFAULT) {
+ if (ctrlid == IDC_DEFAULT) {
TVITEM tvi;
tvi.hItem = TreeView_GetSelection(GetDlgItem(hwndDlg, IDC_BUTTONORDERTREE));
- if (tvi.hItem == NULL)
+ if (tvi.hItem == NULL)
break;
tvi.mask = TVIF_PARAM;
@@ -431,21 +426,21 @@ static BOOL CALLBACK ButOrderOpts(HWND hwndDlg, UINT msg, WPARAM wParam, LPAR SetImagesForCurrent(hwndDlg, curselect);
ulockbut();
- SendMessage(GetParent(hwndDlg), PSM_CHANGED, 0, 0);
+ SendMessage(GetParent(hwndDlg), PSM_CHANGED, 0, 0);
}
}
- if ((HIWORD(wParam) == STN_CLICKED|| HIWORD(wParam) == STN_DBLCLK)) {
+ if ((HIWORD(wParam) == STN_CLICKED|| HIWORD(wParam) == STN_DBLCLK)) {
int ctrlid = LOWORD(wParam);
- if (ctrlid == IDC_BMPUP||ctrlid == IDC_BMPDN) {
+ if (ctrlid == IDC_BMPUP||ctrlid == IDC_BMPDN) {
TVITEM tvi;
tvi.hItem = TreeView_GetSelection(GetDlgItem(hwndDlg, IDC_BUTTONORDERTREE));
- if (tvi.hItem == NULL)
+ if (tvi.hItem == NULL)
break;
tvi.mask = TVIF_PARAM;
TreeView_GetItem(GetDlgItem(hwndDlg, IDC_BUTTONORDERTREE), &tvi);
- if (tvi.lParam == 0)
+ if (tvi.lParam == 0)
break;
int curselect = ((ButtonOptData *)tvi.lParam)->pos;
@@ -476,23 +471,23 @@ static BOOL CALLBACK ButOrderOpts(HWND hwndDlg, UINT msg, WPARAM wParam, LPAR ofn.Flags = OFN_FILEMUSTEXIST | OFN_HIDEREADONLY;
ofn.nMaxFile = sizeof(filename);
ofn.nMaxFileTitle = MAX_PATH;
- ofn.lpstrDefExt = "bmp";
- ofn.lpstrTitle = (ctrlid == IDC_BMPUP)?Translate("Select Up Bitmap"):Translate("Select Down Bitmap");
+ ofn.lpstrDefExt = _T("bmp");
+ ofn.lpstrTitle = (ctrlid == IDC_BMPUP) ? TranslateT("Select Up Bitmap") : TranslateT("Select Down Bitmap");
if (GetOpenFileName(&ofn)) {
lockbut();
- if (ctrlid == IDC_BMPUP){
+ if (ctrlid == IDC_BMPUP){
if (Buttons[curselect].UserDefinedbmUp != NULL){free(Buttons[curselect].UserDefinedbmUp);}
- Buttons[curselect].UserDefinedbmUp = _strdup(ofn.lpstrFile);
+ Buttons[curselect].UserDefinedbmUp = _tcsdup(ofn.lpstrFile);
}
- if (ctrlid == IDC_BMPDN){
+ if (ctrlid == IDC_BMPDN){
if (Buttons[curselect].UserDefinedbmDown != NULL){free(Buttons[curselect].UserDefinedbmDown);}
- Buttons[curselect].UserDefinedbmDown = _strdup(ofn.lpstrFile);
+ Buttons[curselect].UserDefinedbmDown = _tcsdup(ofn.lpstrFile);
}
applyuserbitmaps(curselect);
SetImagesForCurrent(hwndDlg, curselect);
ulockbut();
- SendMessage(GetParent(hwndDlg), PSM_CHANGED, 0, 0);
+ SendMessage(GetParent(hwndDlg), PSM_CHANGED, 0, 0);
}
}
}
@@ -542,7 +537,7 @@ static BOOL CALLBACK ButOrderOpts(HWND hwndDlg, UINT msg, WPARAM wParam, LPAR tvi.iImage = tvi.iSelectedImage = !tvi.iImage;
((ButtonOptData *)tvi.lParam)->show = tvi.iImage;
TreeView_SetItem(((LPNMHDR)lParam)->hwndFrom, &tvi);
- SendMessage(GetParent(hwndDlg), PSM_CHANGED, 0, 0);
+ SendMessage(GetParent(hwndDlg), PSM_CHANGED, 0, 0);
}
}
}
@@ -554,7 +549,7 @@ static BOOL CALLBACK ButOrderOpts(HWND hwndDlg, UINT msg, WPARAM wParam, LPAR HTREEITEM hti;
hti = TreeView_GetSelection(GetDlgItem(hwndDlg, IDC_BUTTONORDERTREE));
- if (hti == NULL){break;}
+ if (hti == NULL){break;}
tvi.mask = TVIF_HANDLE|TVIF_IMAGE|TVIF_SELECTEDIMAGE|TVIF_PARAM;
tvi.hItem = hti;
TreeView_GetItem(GetDlgItem(hwndDlg, IDC_BUTTONORDERTREE), &tvi);
@@ -565,8 +560,8 @@ static BOOL CALLBACK ButOrderOpts(HWND hwndDlg, UINT msg, WPARAM wParam, LPAR EnableWindow(GetDlgItem(hwndDlg, IDC_BMPDN), FALSE);
SetImagesForCurrent(hwndDlg, ((ButtonOptData *)tvi.lParam)->pos);
- //PostMessage(GetDlgItem(hwndDlg, IDC_BMPUP), STM_SETIMAGE, IMAGE_BITMAP, Buttons[((ButtonOptData *)tvi.lParam)->pos].hbBitmapUp);
- //PostMessage(GetDlgItem(hwndDlg, IDC_BMPDN), STM_SETIMAGE, IMAGE_BITMAP, Buttons[((ButtonOptData *)tvi.lParam)->pos].hbBitmapDown);
+ //PostMessage(GetDlgItem(hwndDlg, IDC_BMPUP), STM_SETIMAGE, IMAGE_BITMAP, Buttons[((ButtonOptData *)tvi.lParam)->pos].hbBitmapUp);
+ //PostMessage(GetDlgItem(hwndDlg, IDC_BMPDN), STM_SETIMAGE, IMAGE_BITMAP, Buttons[((ButtonOptData *)tvi.lParam)->pos].hbBitmapDown);
EnableWindow(GetDlgItem(hwndDlg, IDC_REMOVESEP), FALSE);
if (Buttons[((ButtonOptData *)tvi.lParam)->pos].dwFlags&TTBBF_ISSEPARATOR)
@@ -580,8 +575,8 @@ static BOOL CALLBACK ButOrderOpts(HWND hwndDlg, UINT msg, WPARAM wParam, LPAR EnableWindow(GetDlgItem(hwndDlg, IDC_EPATH), FALSE);
EnableWindow(GetDlgItem(hwndDlg, IDC_DELLBUTTON), FALSE);
EnableWindow(GetDlgItem(hwndDlg, IDC_LBUTTONSET), FALSE);
- {SetDlgItemText(hwndDlg, IDC_ENAME, "");}
- {SetDlgItemText(hwndDlg, IDC_EPATH, "");}
+ SetDlgItemTextA(hwndDlg, IDC_ENAME, "");
+ SetDlgItemTextA(hwndDlg, IDC_EPATH, "");
if (Buttons[((ButtonOptData *)tvi.lParam)->pos].dwFlags & TTBBF_ISLBUTTON) {
LBUTOPT lbo = { 0 };
@@ -592,8 +587,10 @@ static BOOL CALLBACK ButOrderOpts(HWND hwndDlg, UINT msg, WPARAM wParam, LPAR EnableWindow(GetDlgItem(hwndDlg, IDC_DELLBUTTON), TRUE);
EnableWindow(GetDlgItem(hwndDlg, IDC_LBUTTONSET), TRUE);
- if (lbo.name != NULL){SetDlgItemText(hwndDlg, IDC_ENAME, lbo.name);}
- if (lbo.lpath != NULL){SetDlgItemText(hwndDlg, IDC_EPATH, lbo.lpath);}
+ if (lbo.name != NULL)
+ SetDlgItemTextA(hwndDlg, IDC_ENAME, lbo.name);
+ if (lbo.lpath != NULL)
+ SetDlgItemText(hwndDlg, IDC_EPATH, lbo.lpath);
}
}
@@ -643,17 +640,17 @@ static BOOL CALLBACK ButOrderOpts(HWND hwndDlg, UINT msg, WPARAM wParam, LPAR ScreenToClient(GetDlgItem(hwndDlg, IDC_BUTTONORDERTREE), &hti.pt);
hti.pt.y -= TreeView_GetItemHeight(GetDlgItem(hwndDlg, IDC_BUTTONORDERTREE))/2;
TreeView_HitTest(GetDlgItem(hwndDlg, IDC_BUTTONORDERTREE), &hti);
- if (dat->hDragItem == hti.hItem) break;
+ if (dat->hDragItem == hti.hItem) break;
tvi.mask = TVIF_HANDLE|TVIF_PARAM;
tvi.hItem = hti.hItem;
TreeView_GetItem(GetDlgItem(hwndDlg, IDC_BUTTONORDERTREE), &tvi);
if (hti.flags&(TVHT_ONITEM|TVHT_ONITEMRIGHT)) {
TVINSERTSTRUCT tvis;
- char name[128];
+ TCHAR name[128];
tvis.item.mask = TVIF_HANDLE|TVIF_PARAM|TVIF_TEXT|TVIF_IMAGE|TVIF_SELECTEDIMAGE;
tvis.item.stateMask = 0xFFFFFFFF;
tvis.item.pszText = name;
- tvis.item.cchTextMax = sizeof(name);
+ tvis.item.cchTextMax = SIZEOF(name);
tvis.item.hItem = dat->hDragItem;
//
tvis.item.iImage = tvis.item.iSelectedImage = ((ButtonOptData *)tvi.lParam)->show;
@@ -664,7 +661,7 @@ static BOOL CALLBACK ButOrderOpts(HWND hwndDlg, UINT msg, WPARAM wParam, LPAR tvis.hParent = NULL;
tvis.hInsertAfter = hti.hItem;
TreeView_SelectItem(GetDlgItem(hwndDlg, IDC_BUTTONORDERTREE), TreeView_InsertItem(GetDlgItem(hwndDlg, IDC_BUTTONORDERTREE), &tvis));
- SendMessage(GetParent(hwndDlg), PSM_CHANGED, 0, 0);
+ SendMessage(GetParent(hwndDlg), PSM_CHANGED, 0, 0);
SaveTree(hwndDlg);
}
}
@@ -682,7 +679,7 @@ int TTBOptInit(WPARAM wParam, LPARAM lParam) odp.pszGroup = Translate("TopToolBar");
if ( !ServiceExists(MS_BACKGROUNDCONFIG_REGISTER)) {
- odp.pszTemplate = MAKEINTRESOURCE(IDD_OPT_TTBBKG);
+ odp.pszTemplate = MAKEINTRESOURCEA(IDD_OPT_TTBBKG);
odp.pszTitle = Translate("TTBBackground");
odp.pfnDlgProc = DlgProcTTBBkgOpts;
odp.flags = ODPF_BOLDGROUPS;
@@ -693,7 +690,7 @@ int TTBOptInit(WPARAM wParam, LPARAM lParam) odp.cbSize = sizeof(odp);
odp.position = -1000000000;
odp.hInstance = hInst;//GetModuleHandle(NULL);
- odp.pszTemplate = MAKEINTRESOURCE(IDD_OPT_BUTORDER);
+ odp.pszTemplate = MAKEINTRESOURCEA(IDD_OPT_BUTORDER);
odp.pszGroup = Translate("TopToolBar");
odp.pszTitle = Translate("Buttons");
odp.pfnDlgProc = ButOrderOpts;
@@ -702,7 +699,7 @@ int TTBOptInit(WPARAM wParam, LPARAM lParam) return 0;
}
-static BOOL CALLBACK DlgProcTTBBkgOpts(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lParam)
+static INT_PTR CALLBACK DlgProcTTBBkgOpts(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lParam)
{
switch (msg) {
case WM_INITDIALOG:
@@ -715,12 +712,11 @@ static BOOL CALLBACK DlgProcTTBBkgOpts(HWND hwndDlg, UINT msg, WPARAM wParam, SendDlgItemMessage(hwndDlg, IDC_SELCOLOUR, CPM_SETCOLOUR, 0, DBGetContactSettingDword(NULL, TTB_OPTDIR, "SelBkColour", TTBDEFAULT_SELBKCOLOUR));
{
DBVARIANT dbv;
- if (!DBGetContactSetting(NULL, TTB_OPTDIR, "BkBitmap", &dbv)) {
- SetDlgItemText(hwndDlg, IDC_FILENAME, dbv.pszVal);
+ if ( !DBGetContactSetting(NULL, TTB_OPTDIR, "BkBitmap", &dbv)) {
+ SetDlgItemText(hwndDlg, IDC_FILENAME, dbv.ptszVal);
DBFreeVariant(&dbv);
}
- }
- {
+
WORD bmpUse = DBGetContactSettingWord(NULL, TTB_OPTDIR, "BkBmpUse", TTBDEFAULT_BKBMPUSE);
CheckDlgButton(hwndDlg, IDC_STRETCHH, bmpUse&CLB_STRETCHH?BST_CHECKED:BST_UNCHECKED);
CheckDlgButton(hwndDlg, IDC_STRETCHV, bmpUse&CLB_STRETCHV?BST_CHECKED:BST_UNCHECKED);
@@ -728,11 +724,11 @@ static BOOL CALLBACK DlgProcTTBBkgOpts(HWND hwndDlg, UINT msg, WPARAM wParam, CheckDlgButton(hwndDlg, IDC_TILEV, bmpUse&CLBF_TILEV?BST_CHECKED:BST_UNCHECKED);
CheckDlgButton(hwndDlg, IDC_SCROLL, bmpUse&CLBF_SCROLL?BST_CHECKED:BST_UNCHECKED);
CheckDlgButton(hwndDlg, IDC_PROPORTIONAL, bmpUse&CLBF_PROPORTIONAL?BST_CHECKED:BST_UNCHECKED);
- }
- {
+
HRESULT (STDAPICALLTYPE *MySHAutoComplete)(HWND, DWORD);
- MySHAutoComplete = (HRESULT (STDAPICALLTYPE*)(HWND, DWORD))GetProcAddress(GetModuleHandle("shlwapi"), "SHAutoComplete");
- if (MySHAutoComplete) MySHAutoComplete(GetDlgItem(hwndDlg, IDC_FILENAME), 1);
+ MySHAutoComplete = (HRESULT (STDAPICALLTYPE*)(HWND, DWORD))GetProcAddress(GetModuleHandleA("shlwapi"), "SHAutoComplete");
+ if (MySHAutoComplete)
+ MySHAutoComplete(GetDlgItem(hwndDlg, IDC_FILENAME), 1);
}
return TRUE;
@@ -748,7 +744,7 @@ static BOOL CALLBACK DlgProcTTBBkgOpts(HWND hwndDlg, UINT msg, WPARAM wParam, break;
case WM_COMMAND:
- if (LOWORD(wParam) == IDC_BROWSE) {
+ if (LOWORD(wParam) == IDC_BROWSE) {
TCHAR str[MAX_PATH];
OPENFILENAME ofn = {0};
TCHAR filter[512];
@@ -763,18 +759,18 @@ static BOOL CALLBACK DlgProcTTBBkgOpts(HWND hwndDlg, UINT msg, WPARAM wParam, ofn.Flags = OFN_FILEMUSTEXIST | OFN_HIDEREADONLY;
ofn.nMaxFile = sizeof(str);
ofn.nMaxFileTitle = MAX_PATH;
- ofn.lpstrDefExt = "bmp";
+ ofn.lpstrDefExt = _T("bmp");
if (!GetOpenFileName(&ofn))
break;
SetDlgItemText(hwndDlg, IDC_FILENAME, str);
}
- else if (LOWORD(wParam) == IDC_FILENAME && HIWORD(wParam) != EN_CHANGE)
+ else if (LOWORD(wParam) == IDC_FILENAME && HIWORD(wParam) != EN_CHANGE)
break;
- if (LOWORD(wParam) == IDC_BITMAP) SendMessage(hwndDlg, WM_USER+10, 0, 0);
- if (LOWORD(wParam) == IDC_FILENAME && (HIWORD(wParam) != EN_CHANGE || (HWND)lParam != GetFocus())) return 0;
- SendMessage(GetParent(hwndDlg), PSM_CHANGED, 0, 0);
+ if (LOWORD(wParam) == IDC_BITMAP) SendMessage(hwndDlg, WM_USER+10, 0, 0);
+ if (LOWORD(wParam) == IDC_FILENAME && (HIWORD(wParam) != EN_CHANGE || (HWND)lParam != GetFocus())) return 0;
+ SendMessage(GetParent(hwndDlg), PSM_CHANGED, 0, 0);
break;
case WM_NOTIFY:
@@ -785,22 +781,20 @@ static BOOL CALLBACK DlgProcTTBBkgOpts(HWND hwndDlg, UINT msg, WPARAM wParam, DBWriteContactSettingByte(NULL, TTB_OPTDIR, "UseBitmap", (BYTE)IsDlgButtonChecked(hwndDlg, IDC_BITMAP));
{
COLORREF col = SendDlgItemMessage(hwndDlg, IDC_BKGCOLOUR, CPM_GETCOLOUR, 0, 0);
- if (col == TTBDEFAULT_BKCOLOUR)
+ if (col == TTBDEFAULT_BKCOLOUR)
DBDeleteContactSetting(NULL, TTB_OPTDIR, "BkColour");
else
DBWriteContactSettingDword(NULL, TTB_OPTDIR, "BkColour", col);
col = SendDlgItemMessage(hwndDlg, IDC_SELCOLOUR, CPM_GETCOLOUR, 0, 0);
- if (col == TTBDEFAULT_SELBKCOLOUR)
+ if (col == TTBDEFAULT_SELBKCOLOUR)
DBDeleteContactSetting(NULL, TTB_OPTDIR, "SelBkColour");
else
DBWriteContactSettingDword(NULL, TTB_OPTDIR, "SelBkColour", col);
- }
- {
+
TCHAR str[MAX_PATH];
GetDlgItemText(hwndDlg, IDC_FILENAME, str, SIZEOF(str));
- DBWriteContactSettingString(NULL, TTB_OPTDIR, "BkBitmap", str);
- }
- {
+ DBWriteContactSettingTString(NULL, TTB_OPTDIR, "BkBitmap", str);
+
WORD flags = 0;
if (IsDlgButtonChecked(hwndDlg, IDC_STRETCHH)) flags |= CLB_STRETCHH;
if (IsDlgButtonChecked(hwndDlg, IDC_STRETCHV)) flags |= CLB_STRETCHV;
|