summaryrefslogtreecommitdiff
path: root/plugins/BossKeyPlus/src
diff options
context:
space:
mode:
Diffstat (limited to 'plugins/BossKeyPlus/src')
-rw-r--r--plugins/BossKeyPlus/src/BossKey.cpp91
-rw-r--r--plugins/BossKeyPlus/src/Options.cpp40
2 files changed, 56 insertions, 75 deletions
diff --git a/plugins/BossKeyPlus/src/BossKey.cpp b/plugins/BossKeyPlus/src/BossKey.cpp
index 3aa75000d9..370eb8500c 100644
--- a/plugins/BossKeyPlus/src/BossKey.cpp
+++ b/plugins/BossKeyPlus/src/BossKey.cpp
@@ -106,12 +106,10 @@ INT_PTR CALLBACK DlgStdInProc(HWND hDlg, UINT uMsg,WPARAM wParam,LPARAM lParam)
RECT rect;
GetClientRect(hDlg, &rect);
- SetWindowPos(hDlg, 0, 0, 0, rect.right, rect.bottom +
- GetSystemMetrics(SM_CYCAPTION) + GetSystemMetrics(SM_CXSIZEFRAME),
- SWP_FRAMECHANGED | SWP_NOMOVE | SWP_NOZORDER);
+ SetWindowPos(hDlg, 0, 0, 0, rect.right, rect.bottom + GetSystemMetrics(SM_CYCAPTION) + GetSystemMetrics(SM_CXSIZEFRAME), SWP_FRAMECHANGED | SWP_NOMOVE | SWP_NOZORDER);
}
- SendMessage(GetDlgItem(hDlg, IDC_HEADERBAR), WM_SETICON, 0, (LPARAM)hIcon);
- SetWindowText(GetDlgItem(hDlg, IDC_HEADERBAR), TranslateT("Miranda NG is locked.\nEnter password to unlock it."));
+ SendDlgItemMessage(hDlg, IDC_HEADERBAR, WM_SETICON, 0, (LPARAM)hIcon);
+ SetDlgItemText(hDlg, IDC_HEADERBAR, TranslateT("Miranda NG is locked.\nEnter password to unlock it."));
TranslateDialogDefault(hDlg);
oldLangID = 0;
@@ -144,14 +142,14 @@ INT_PTR CALLBACK DlgStdInProc(HWND hDlg, UINT uMsg,WPARAM wParam,LPARAM lParam)
if (passlen == 0)
{
- SetWindowText(GetDlgItem(hDlg, IDC_HEADERBAR), TranslateT("Miranda NG is locked.\nEnter password to unlock it."));
- SendMessage(GetDlgItem(hDlg, IDC_HEADERBAR), WM_NCPAINT, 0, 0);
+ SetDlgItemText(hDlg, IDC_HEADERBAR, TranslateT("Miranda NG is locked.\nEnter password to unlock it."));
+ SendDlgItemMessage(hDlg, IDC_HEADERBAR, WM_NCPAINT, 0, 0);
}
else if (lstrcmpA(password, g_password))
{
- SetWindowText(GetDlgItem(hDlg, IDC_HEADERBAR), TranslateT("Password is not correct!\nPlease, enter correct password."));
- SendMessage(GetDlgItem(hDlg, IDC_HEADERBAR), WM_NCPAINT, 0, 0);
- SetDlgItemTextA(hDlg, IDC_EDIT1, "");
+ SetDlgItemText(hDlg, IDC_HEADERBAR, TranslateT("Password is not correct!\nPlease, enter correct password."));
+ SendDlgItemMessage(hDlg, IDC_HEADERBAR, WM_NCPAINT, 0, 0);
+ SetDlgItemText(hDlg, IDC_EDIT1, _T(""));
}
else EndDialog(hDlg,IDOK);
@@ -181,38 +179,34 @@ INT_PTR CALLBACK DlgStdInProc(HWND hDlg, UINT uMsg,WPARAM wParam,LPARAM lParam)
static void LanguageChanged(HWND hDlg)
{
HKL LangID = GetKeyboardLayout(0);
- char Lang[3] = {0};
if (LangID != oldLangID)
{
+ TCHAR Lang[3] = {0};
oldLangID = LangID;
- GetLocaleInfoA(MAKELCID(((WORD)LangID & 0xffffffff), SORT_DEFAULT), LOCALE_SABBREVLANGNAME, Lang, 2);
+ GetLocaleInfo(MAKELCID(((WORD)LangID & 0xffffffff), SORT_DEFAULT), LOCALE_SABBREVLANGNAME, Lang, 2);
Lang[0] = toupper(Lang[0]);
Lang[1] = tolower(Lang[1]);
- SetDlgItemTextA(hDlg, IDC_LANG, Lang);
+ SetDlgItemText(hDlg, IDC_LANG, Lang);
}
}
-BOOL CALLBACK EnumWindowsProc(HWND hWnd,LPARAM lParam)
+BOOL CALLBACK EnumWindowsProc(HWND hWnd,LPARAM)
{
DWORD dwWndPID;
GetWindowThreadProcessId(hWnd,&dwWndPID);
- if ((g_dwMirandaPID == dwWndPID) && hWnd != g_hDlgPass /* && (GetWindowLongPtr(hWnd,GWLP_HWNDPARENT) == NULL)*/ && (IsWindowVisible(hWnd)))
+ if ((g_dwMirandaPID == dwWndPID) && hWnd != g_hDlgPass && IsWindowVisible(hWnd))
{
- char szTemp[32];
- GetClassNameA(hWnd,szTemp,32);
+ TCHAR szTemp[32];
+ GetClassName(hWnd,szTemp,32);
- if (lstrcmpA(szTemp,"MirandaThumbsWnd") == 0) // hide floating contacts
+ if (lstrcmp(szTemp,_T("MirandaThumbsWnd")) == 0) // hide floating contacts
{
CallService("FloatingContacts/MainHideAllThumbs",0,0);
g_bOldSetting |= OLD_FLTCONT;
}
- else
- if (lstrcmpA(szTemp,"PopupWnd2") == 0 || lstrcmpA(szTemp,"YAPPWinClass") == 0) // destroy opened popups
- SendMessage(hWnd, UM_DESTROYPOPUP,0,0);
-// else
-// if (lstrcmpA(szTemp,"#32770") == 0)
-// SendMessage(hWnd, WM_CLOSE,0,0);
+ else if (lstrcmp(szTemp,_T("PopupWnd2")) == 0 || lstrcmp(szTemp,_T("YAPPWinClass")) == 0) // destroy opened popups
+ PUDeletePopup(hWnd);
else
{
HWND_ITEM *node = new HWND_ITEM;
@@ -228,14 +222,16 @@ BOOL CALLBACK EnumWindowsProc(HWND hWnd,LPARAM lParam)
TCHAR* GetDefStatusMsg(unsigned uStatus, const char* szProto)
{
- TCHAR *ret = (TCHAR *)CallService ( MS_AWAYMSG_GETSTATUSMSGT, (WPARAM)uStatus, (LPARAM)szProto );
- if ( (int)ret == CALLSERVICE_NOTFOUND )
+ INT_PTR res = CallService (MS_AWAYMSG_GETSTATUSMSGT, (WPARAM)uStatus, (LPARAM)szProto );
+ if (res == CALLSERVICE_NOTFOUND )
{
char* tmp = ( char* )CallService(MS_AWAYMSG_GETSTATUSMSG, (WPARAM)uStatus, (LPARAM)szProto );
- ret = mir_a2t( tmp );
+ TCHAR *ret = mir_a2t( tmp );
mir_free( tmp );
+ return ret;
}
- return ret;
+ else
+ return (TCHAR *) res;
}
void SetStatus(const char* szProto, unsigned status, TCHAR *tszAwayMsg)
@@ -381,20 +377,14 @@ LRESULT CALLBACK ListenWndProc(HWND hWnd,UINT uMsg,WPARAM wParam,LPARAM lParam)
{
if (ServiceExists(MS_VARS_FORMATSTRING))
{
- FORMATINFO fi;
- TCHAR *ptszParsed;
-
- ZeroMemory(&fi, sizeof(fi));
- fi.cbSize = sizeof(fi);
- fi.flags = FIF_TCHAR;
- fi.tszFormat = dbVar.ptszVal;
- ptszParsed = (TCHAR*)CallService(MS_VARS_FORMATSTRING, (WPARAM)&fi, 0);
+ TCHAR *ptszParsed = variables_parse(dbVar.ptszVal, 0, 0);
ChangeAllProtoStatuses(uMode, ptszParsed);
if (ptszParsed)
mir_free(ptszParsed);
- }else
+ }
+ else
ChangeAllProtoStatuses(uMode, dbVar.ptszVal);
- db_free(&dbVar);
+ db_free(&dbVar);
}
}
@@ -441,7 +431,7 @@ LRESULT CALLBACK ListenWndProc(HWND hWnd,UINT uMsg,WPARAM wParam,LPARAM lParam)
db_free(&dbVar);
CallService(MS_DB_CRYPT_DECODESTRING, MAXPASSLEN+1, ( LPARAM )g_password );
- int res = DialogBox(g_hInstance,(MAKEINTRESOURCE(IDD_PASSDIALOGNEW)),GetForegroundWindow(),(DLGPROC)DlgStdInProc);
+ int res = DialogBox(g_hInstance,(MAKEINTRESOURCE(IDD_PASSDIALOGNEW)),GetForegroundWindow(), DlgStdInProc);
g_fPassRequested = false;
if(res != IDOK) return 0;
@@ -455,10 +445,10 @@ LRESULT CALLBACK ListenWndProc(HWND hWnd,UINT uMsg,WPARAM wParam,LPARAM lParam)
while (pCurWnd != NULL)
{
HWND_ITEM *pNextWnd = pCurWnd->next;
- char szTemp[32];
- GetClassNameA(pCurWnd->hWnd,szTemp,32);
+ TCHAR szTemp[32];
+ GetClassName(pCurWnd->hWnd,szTemp,32);
- if (IsWindow(pCurWnd->hWnd) && lstrcmpA(szTemp,"SysShadow") != 0) // precaution
+ if (IsWindow(pCurWnd->hWnd) && lstrcmp(szTemp,_T("SysShadow")) != 0) // precaution
{
ShowWindow(pCurWnd->hWnd, SW_SHOW);
}
@@ -497,7 +487,7 @@ LRESULT CALLBACK ListenWndProc(HWND hWnd,UINT uMsg,WPARAM wParam,LPARAM lParam)
return(DefWindowProc(hWnd,uMsg,wParam,lParam));
}
-static int MsgWinOpening(WPARAM wParam, LPARAM lParam) // hiding new message windows
+static int MsgWinOpening(WPARAM, LPARAM) // hiding new message windows
{
if (g_bWindowHidden)
EnumWindows(EnumWindowsProc, 0);
@@ -515,7 +505,7 @@ VOID CALLBACK WinEventProc(HWINEVENTHOOK g_hWinHook, DWORD event, HWND hwnd, LON
}
}
-INT_PTR BossKeyHideMiranda(WPARAM wParam, LPARAM lParam) // for service :)
+INT_PTR BossKeyHideMiranda(WPARAM, LPARAM) // for service :)
{
PostMessage(g_hListenWindow, WM_USER + ((g_bWindowHidden) ? (52) : (40)), 0, 0);
return 0;
@@ -581,7 +571,7 @@ static IconItem iconList[] =
{ LPGEN("Hide Miranda NG"), "hidemim", IDI_DLGPASSWD }
};
-static int GenMenuInit(WPARAM wParam, LPARAM lParam) // Modify menu item text before to show the main menu
+static int GenMenuInit(WPARAM, LPARAM) // Modify menu item text before to show the main menu
{
if (g_hMenuItem) {
TCHAR buf[128] = {0};
@@ -642,7 +632,7 @@ static int ModernToolbarInit(WPARAM, LPARAM) // Modern toolbar support
}
// Tabsrmm toolbar support
-static int TabsrmmButtonPressed(WPARAM wParam, LPARAM lParam)
+static int TabsrmmButtonPressed(WPARAM, LPARAM lParam)
{
CustomButtonClickData *cbcd=(CustomButtonClickData *)lParam;
@@ -652,7 +642,7 @@ static int TabsrmmButtonPressed(WPARAM wParam, LPARAM lParam)
return 0;
}
-static int TabsrmmButtonsInit(WPARAM wParam, LPARAM lParam)
+static int TabsrmmButtonsInit(WPARAM, LPARAM)
{
BBButton bbd = {0};
@@ -693,14 +683,13 @@ static int EnumProtos(WPARAM wParam, LPARAM lParam)
return 0;
}
-int MirandaLoaded(WPARAM wParam,LPARAM lParam)
+int MirandaLoaded(WPARAM,LPARAM)
{
g_wMask = db_get_w(NULL,MOD_NAME,"optsmask",DEFAULTSETTING);
RegisterCoreHotKeys();
- g_hWinHook = SetWinEventHook(EVENT_OBJECT_CREATE, EVENT_OBJECT_SHOW,
- NULL, WinEventProc, GetCurrentProcessId(), 0, 0);
+ g_hWinHook = SetWinEventHook(EVENT_OBJECT_CREATE, EVENT_OBJECT_SHOW, NULL, WinEventProc, GetCurrentProcessId(), 0, 0);
HookEvent(ME_TTB_MODULELOADED, ModernToolbarInit);
HookEvent(ME_OPT_INITIALISE, OptsDlgInit);
@@ -762,7 +751,7 @@ int MirandaLoaded(WPARAM wParam,LPARAM lParam)
tr.tszTokenString = _T("bosskeyname");
tr.parseFunctionT = VariablesBossKey;
- tr.szHelpText = LPGEN("BossKey\tget the BossKey name");
+ tr.szHelpText = LPGEN("BossKey")"\t"LPGEN("get the BossKey name");
CallService(MS_VARS_REGISTERTOKEN, 0, (LPARAM) &tr);
}
diff --git a/plugins/BossKeyPlus/src/Options.cpp b/plugins/BossKeyPlus/src/Options.cpp
index 1a843001b7..bbd9e89a01 100644
--- a/plugins/BossKeyPlus/src/Options.cpp
+++ b/plugins/BossKeyPlus/src/Options.cpp
@@ -56,14 +56,7 @@ INT_PTR CALLBACK MainOptDlg(HWND hwndDlg,UINT msg,WPARAM wParam,LPARAM lParam)
EnableWindow(GetDlgItem(hwndDlg, IDC_MAINOPT_HIDEIFLOCK), SW_HIDE);
// set icon and tooltip for variables help button
-
- if (ServiceExists(MS_VARS_GETSKINITEM)) {
- HICON hIcon = (HICON)CallService(MS_VARS_GETSKINITEM, 0, (LPARAM)VSI_HELPICON);
- if (hIcon != NULL)
- SendMessage(GetDlgItem(hwndDlg, IDC_MAINOPT_VARHELP), BM_SETIMAGE, (WPARAM)IMAGE_ICON, (LPARAM)hIcon);
- SendMessage(GetDlgItem(hwndDlg, IDC_MAINOPT_VARHELP), BUTTONADDTOOLTIP, (WPARAM)TranslateT("Open String Formatting Help"), BATF_TCHAR);
- SendDlgItemMessage(hwndDlg, IDC_MAINOPT_VARHELP, BUTTONSETASFLATBTN, TRUE, 0);
- }
+ variables_skin_helpbutton(hwndDlg, IDC_MAINOPT_VARHELP);
SendDlgItemMessage(hwndDlg,IDC_MAINOPT_PASS,EM_LIMITTEXT,MAXPASSLEN,0); // limit password length
@@ -85,10 +78,8 @@ INT_PTR CALLBACK MainOptDlg(HWND hwndDlg,UINT msg,WPARAM wParam,LPARAM lParam)
CheckDlgButton(hwndDlg,IDC_MAINOPT_USEDEFMSG,(g_wMask & OPT_USEDEFMSG) ? (BST_CHECKED) : (BST_UNCHECKED));
CheckDlgButton(hwndDlg,IDC_MAINOPT_TRAYICON,(g_wMask & OPT_TRAYICON) ? (BST_CHECKED) : (BST_UNCHECKED));
- const TCHAR *STATUS_ARR_TO_NAME[8] = { _T("Offline"), _T("Online"), _T("Away"), _T("NA"), _T("Occupied"), _T("DND"), _T("Free for chat"), _T("Invisible") };
-
- for (BYTE i = 0;i < 8; i++)
- SendDlgItemMessage(hwndDlg,IDC_MAINOPT_CHGSTS,CB_INSERTSTRING,-1,(LPARAM)TranslateTS(STATUS_ARR_TO_NAME[i]));
+ for (int i = ID_STATUS_OFFLINE;i <= ID_STATUS_OUTTOLUNCH; i++)
+ SendDlgItemMessage(hwndDlg, IDC_MAINOPT_CHGSTS, CB_INSERTSTRING, -1, (LPARAM) CallService(MS_CLIST_GETSTATUSMODEDESCRIPTION,i,GSMDF_TCHAR));
SendDlgItemMessage(hwndDlg, IDC_MAINOPT_CHGSTS, CB_SETCURSEL, db_get_b(NULL, MOD_NAME, "stattype", 2), 0);
@@ -284,11 +275,11 @@ INT_PTR CALLBACK AdvOptDlg(HWND hwndDlg,UINT msg,WPARAM wParam,LPARAM lParam)
g_fOptionsOpen = true;
minutes = db_get_b(NULL,MOD_NAME,"time",10);
- char szMinutes[4] = {0};
- _itoa(minutes, szMinutes, 10);
+ TCHAR szMinutes[4] = {0};
+ _itot(minutes, szMinutes, 10);
SendDlgItemMessage(hwndDlg,IDC_MAINOPT_TIME,EM_LIMITTEXT,2,0);
SendDlgItemMessage(hwndDlg, IDC_MAINOPT_SPIN_TIME, UDM_SETRANGE32, (WPARAM)1, (LPARAM)99);
- SetDlgItemTextA(hwndDlg, IDC_MAINOPT_TIME, szMinutes);
+ SetDlgItemText(hwndDlg, IDC_MAINOPT_TIME, szMinutes);
CheckDlgButton(hwndDlg,IDC_MAINOPT_HIDEIFLOCK,(g_wMaskAdv & OPT_HIDEIFLOCK) ? (BST_CHECKED) : (BST_UNCHECKED));
CheckDlgButton(hwndDlg,IDC_MAINOPT_MENUITEM,(g_wMaskAdv & OPT_MENUITEM) ? (BST_CHECKED) : (BST_UNCHECKED));
CheckDlgButton(hwndDlg,IDC_MAINOPT_HIDEIFWINIDLE,(g_wMaskAdv & OPT_HIDEIFWINIDLE) ? (BST_CHECKED) : (BST_UNCHECKED));
@@ -321,9 +312,10 @@ INT_PTR CALLBACK AdvOptDlg(HWND hwndDlg,UINT msg,WPARAM wParam,LPARAM lParam)
} else
if (g_hMenuItem != 0) BossKeyMenuItemUnInit();
- char szMinutes[4] = {0};
- GetDlgItemTextA(hwndDlg,IDC_MAINOPT_TIME,szMinutes,3);
- (atoi(szMinutes) > 0) ? minutes = atoi(szMinutes) : minutes = 1;
+ TCHAR szMinutes[4] = {0};
+ GetDlgItemText(hwndDlg,IDC_MAINOPT_TIME,szMinutes,3);
+ minutes = _ttoi(szMinutes);
+ if(minutes<1) minutes = 1;
db_set_b(NULL,MOD_NAME,"time",minutes);
db_set_w(NULL,MOD_NAME,"optsmaskadv",wMaskAdv);
g_wMaskAdv = wMaskAdv;
@@ -391,7 +383,7 @@ INT_PTR CALLBACK AdvOptDlg(HWND hwndDlg,UINT msg,WPARAM wParam,LPARAM lParam)
return(false);
}
-int OptsDlgInit(WPARAM wParam,LPARAM lParam)
+int OptsDlgInit(WPARAM wParam,LPARAM)
{
OPTIONSDIALOGPAGE optDi;
ZeroMemory(&optDi, sizeof(optDi));
@@ -400,16 +392,16 @@ int OptsDlgInit(WPARAM wParam,LPARAM lParam)
optDi.pfnDlgProc = MainOptDlg;
optDi.pszTemplate = MAKEINTRESOURCEA(IDD_OPTDIALOGMAIN);
optDi.hInstance = g_hInstance;
- optDi.pszTitle = LPGEN("BossKey");
- optDi.pszGroup = LPGEN("Events");
- optDi.pszTab = LPGEN("Main");
- optDi.flags = ODPF_BOLDGROUPS;
+ optDi.ptszTitle = LPGENT("BossKey");
+ optDi.ptszGroup = LPGENT("Events");
+ optDi.ptszTab = LPGENT("Main");
+ optDi.flags = ODPF_BOLDGROUPS|ODPF_TCHAR;
Options_AddPage(wParam, &optDi);
optDi.pfnDlgProc = AdvOptDlg;
optDi.pszTemplate = MAKEINTRESOURCEA(IDD_OPTDIALOGADV);
- optDi.pszTab = LPGEN("Advanced");
+ optDi.ptszTab = LPGENT("Advanced");
Options_AddPage(wParam, &optDi);
return(0);