diff options
author | George Hazan <george.hazan@gmail.com> | 2015-08-27 15:15:33 +0000 |
---|---|---|
committer | George Hazan <george.hazan@gmail.com> | 2015-08-27 15:15:33 +0000 |
commit | d6eee2018898f2442883a0aa77ad095b75572cfb (patch) | |
tree | 8fbfe32690b9b32e5d47b1958a02f6f6a5fbf000 /plugins/wbOSD | |
parent | 2d37d969153b5fad810984182f747755c1cbc616 (diff) |
fix for 64-bit issues & warnings
git-svn-id: http://svn.miranda-ng.org/main/trunk@15043 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c
Diffstat (limited to 'plugins/wbOSD')
-rw-r--r-- | plugins/wbOSD/src/events.cpp | 4 | ||||
-rw-r--r-- | plugins/wbOSD/src/main.cpp | 6 | ||||
-rw-r--r-- | plugins/wbOSD/src/options.cpp | 604 | ||||
-rw-r--r-- | plugins/wbOSD/src/stdafx.h | 4 | ||||
-rw-r--r-- | plugins/wbOSD/src/wbOSD.cpp | 243 |
5 files changed, 431 insertions, 430 deletions
diff --git a/plugins/wbOSD/src/events.cpp b/plugins/wbOSD/src/events.cpp index 6a516beff6..98f227bf41 100644 --- a/plugins/wbOSD/src/events.cpp +++ b/plugins/wbOSD/src/events.cpp @@ -27,7 +27,7 @@ LRESULT ShowOSD(TCHAR *str, int timeout, COLORREF color, MCONTACT user) {
logmsg("ShowOSD");
- if (!hwnd)
+ if (!g_hWnd)
return 0;
if (timeout==0)
@@ -40,7 +40,7 @@ LRESULT ShowOSD(TCHAR *str, int timeout, COLORREF color, MCONTACT user) om.param=(unsigned int)user;
om.callback=showmsgwnd;
- return SendMessage(hwnd, WM_USER+4, (WPARAM)&om, 0);
+ return SendMessage(g_hWnd, WM_USER+4, (WPARAM)&om, 0);
}
int ProtoAck(WPARAM,LPARAM lparam)
diff --git a/plugins/wbOSD/src/main.cpp b/plugins/wbOSD/src/main.cpp index 1184e615ed..570cbe6de5 100644 --- a/plugins/wbOSD/src/main.cpp +++ b/plugins/wbOSD/src/main.cpp @@ -11,11 +11,11 @@ Distributed under GNU's GPL 2 or later HINSTANCE hI;
-HWND hwnd=0;
+HWND g_hWnd = 0;
HANDLE hservosda;
int hLangpack = 0;
CLIST_INTERFACE *pcli;
-HANDLE hHookedNewEvent, hHookedInit, hProtoAck, hContactSettingChanged, hHookContactStatusChanged, hContactStatusChanged, hpluginShutDown;
+HANDLE hHookedInit, hProtoAck, hContactSettingChanged, hHookContactStatusChanged, hContactStatusChanged;
void logmsg2(char *str);
int MainInit(WPARAM,LPARAM);
@@ -58,11 +58,9 @@ extern "C" __declspec(dllexport) int Load() extern "C" __declspec(dllexport) int Unload()
{
logmsg("Unload");
- UnhookEvent(hpluginShutDown);
UnhookEvent(hProtoAck);
UnhookEvent(hContactSettingChanged);
UnhookEvent(hContactStatusChanged);
- UnhookEvent(hHookedNewEvent);
UnhookEvent(hHookedInit);
DestroyServiceFunction(hservosda);
diff --git a/plugins/wbOSD/src/options.cpp b/plugins/wbOSD/src/options.cpp index 911f0da024..6f9dd76a48 100644 --- a/plugins/wbOSD/src/options.cpp +++ b/plugins/wbOSD/src/options.cpp @@ -11,38 +11,38 @@ Distributed under GNU's GPL 2 or later COLORREF pencustcolors[16];
-const static osdmsg defstr={_T(""), 0, RGB(0, 0, 0), 0, 0};
+const static osdmsg defstr = { _T(""), 0, RGB(0, 0, 0), 0, 0 };
-void FillCheckBoxTree(HWND hwndTree,DWORD style)
+void FillCheckBoxTree(HWND hwndTree, DWORD style)
{
logmsg("FillCheckBoxTree");
- TVINSERTSTRUCT tvis = {0};
+ TVINSERTSTRUCT tvis = { 0 };
tvis.hParent = NULL;
tvis.hInsertAfter = TVI_LAST;
- tvis.item.mask = TVIF_PARAM|TVIF_TEXT|TVIF_STATE;
- for ( WORD status = ID_STATUS_OFFLINE; status <=ID_STATUS_OUTTOLUNCH; status++ ) {
+ tvis.item.mask = TVIF_PARAM | TVIF_TEXT | TVIF_STATE;
+ for (WORD status = ID_STATUS_OFFLINE; status <= ID_STATUS_OUTTOLUNCH; status++) {
tvis.item.lParam = status - ID_STATUS_OFFLINE;
tvis.item.pszText = pcli->pfnGetStatusModeDescription(status, 0);
tvis.item.stateMask = TVIS_STATEIMAGEMASK;
- tvis.item.state = INDEXTOSTATEIMAGEMASK(( style & ( 1 << tvis.item.lParam )) != 0 ? 2 : 1 );
- TreeView_InsertItem( hwndTree, &tvis );
+ tvis.item.state = INDEXTOSTATEIMAGEMASK((style & (1 << tvis.item.lParam)) != 0 ? 2 : 1);
+ TreeView_InsertItem(hwndTree, &tvis);
}
}
DWORD MakeCheckBoxTreeFlags(HWND hwndTree)
{
- DWORD flags=0;
+ DWORD flags = 0;
logmsg("MakeCheckBoxTreeFlags");
- TVITEM tvi = {0};
- tvi.mask=TVIF_HANDLE|TVIF_PARAM|TVIF_STATE;
- tvi.hItem=TreeView_GetRoot(hwndTree);
- while(tvi.hItem) {
- TreeView_GetItem(hwndTree,&tvi);
- if(((tvi.state&TVIS_STATEIMAGEMASK)>>12==2)) flags|=1<<tvi.lParam;
- tvi.hItem=TreeView_GetNextSibling(hwndTree,tvi.hItem);
+ TVITEM tvi = { 0 };
+ tvi.mask = TVIF_HANDLE | TVIF_PARAM | TVIF_STATE;
+ tvi.hItem = TreeView_GetRoot(hwndTree);
+ while (tvi.hItem) {
+ TreeView_GetItem(hwndTree, &tvi);
+ if (((tvi.state&TVIS_STATEIMAGEMASK) >> 12 == 2)) flags |= 1 << tvi.lParam;
+ tvi.hItem = TreeView_GetNextSibling(hwndTree, tvi.hItem);
}
return flags;
}
@@ -51,23 +51,23 @@ int selectColor(HWND hwnd, COLORREF *clr) {
logmsg("SelectColor");
- CHOOSECOLOR cc = {0};
+ CHOOSECOLOR cc = { 0 };
cc.lStructSize = sizeof(cc);
cc.hwndOwner = hwnd;
cc.hInstance = (HWND)hI;
cc.rgbResult = *clr;
cc.lpCustColors = pencustcolors;
- cc.Flags = CC_FULLOPEN|CC_RGBINIT;
+ cc.Flags = CC_FULLOPEN | CC_RGBINIT;
if (!ChooseColor(&cc))
return 1;
-
- *clr=cc.rgbResult;
+
+ *clr = cc.rgbResult;
return 0;
}
int selectFont(HWND hDlg, LOGFONT *lf)
{
- COLORREF color=RGB(0, 0, 0);
+ COLORREF color = RGB(0, 0, 0);
logmsg("SelectFont");
@@ -82,19 +82,19 @@ int selectFont(HWND hDlg, LOGFONT *lf) cf.rgbColors = 0;
cf.Flags = CF_INITTOLOGFONTSTRUCT | CF_EFFECTS | CF_BOTH | CF_FORCEFONTEXIST;
cf.nFontType = 0;
- cf.rgbColors=color;
-
+ cf.rgbColors = color;
+
if (!ChooseFont(&cf)) {
if (cf.hDC)
DeleteDC(cf.hDC);
-
+
ReleaseDC(hDlg, hDC);
return 1;
}
-
+
if (cf.hDC)
DeleteDC(cf.hDC);
-
+
ReleaseDC(hDlg, hDC);
return 0;
}
@@ -103,53 +103,53 @@ void loadDBSettings(plgsettings *ps) {
logmsg("loadDBSettings");
- ps->align=db_get_b(NULL,THIS_MODULE, "align", DEFAULT_ALIGN);
- ps->salign=db_get_b(NULL,THIS_MODULE, "salign", DEFAULT_SALIGN);
- ps->altShadow=db_get_b(NULL,THIS_MODULE, "altShadow", DEFAULT_ALTSHADOW);
- ps->transparent=db_get_b(NULL,THIS_MODULE, "transparent", DEFAULT_TRANPARENT);
- ps->showShadow=db_get_b(NULL,THIS_MODULE, "showShadow", DEFAULT_SHOWSHADOW);
- ps->messages=db_get_b(NULL,THIS_MODULE, "messages", DEFAULT_ANNOUNCEMESSAGES);
- ps->a_user=db_get_b(NULL,THIS_MODULE, "a_user", DEFAULT_ANNOUNCESTATUS);
- ps->distance=db_get_b(NULL,THIS_MODULE, "distance", DEFAULT_DISTANCE);
- ps->winx=db_get_dw(NULL,THIS_MODULE, "winx", DEFAULT_WINX);
- ps->winy=db_get_dw(NULL,THIS_MODULE, "winy", DEFAULT_WINY);
- ps->winxpos=db_get_dw(NULL,THIS_MODULE, "winxpos", DEFAULT_WINXPOS);
- ps->winypos=db_get_dw(NULL,THIS_MODULE, "winypos", DEFAULT_WINYPOS);
- ps->alpha=db_get_b(NULL,THIS_MODULE, "alpha", DEFAULT_ALPHA);
- ps->showmystatus=db_get_b(NULL,THIS_MODULE, "showMyStatus", DEFAULT_SHOWMYSTATUS);
- ps->timeout=db_get_dw(NULL,THIS_MODULE, "timeout", DEFAULT_TIMEOUT);
- ps->clr_msg=db_get_dw(NULL,THIS_MODULE, "clr_msg", DEFAULT_CLRMSG);
- ps->clr_status=db_get_dw(NULL,THIS_MODULE, "clr_status", DEFAULT_CLRSTATUS);
- ps->clr_shadow=db_get_dw(NULL,THIS_MODULE, "clr_shadow", DEFAULT_CLRSHADOW);
- ps->bkclr=db_get_dw(NULL,THIS_MODULE, "bkclr", DEFAULT_BKCLR);
-
- ps->showMsgWindow=db_get_b(NULL,THIS_MODULE, "showMessageWindow", DEFAULT_SHOWMSGWIN);
- ps->showWhen=db_get_dw(NULL,THIS_MODULE,"showWhen", DEFAULT_SHOWWHEN);
-
+ ps->align = db_get_b(NULL, THIS_MODULE, "align", DEFAULT_ALIGN);
+ ps->salign = db_get_b(NULL, THIS_MODULE, "salign", DEFAULT_SALIGN);
+ ps->altShadow = db_get_b(NULL, THIS_MODULE, "altShadow", DEFAULT_ALTSHADOW);
+ ps->transparent = db_get_b(NULL, THIS_MODULE, "transparent", DEFAULT_TRANPARENT);
+ ps->showShadow = db_get_b(NULL, THIS_MODULE, "showShadow", DEFAULT_SHOWSHADOW);
+ ps->messages = db_get_b(NULL, THIS_MODULE, "messages", DEFAULT_ANNOUNCEMESSAGES);
+ ps->a_user = db_get_b(NULL, THIS_MODULE, "a_user", DEFAULT_ANNOUNCESTATUS);
+ ps->distance = db_get_b(NULL, THIS_MODULE, "distance", DEFAULT_DISTANCE);
+ ps->winx = db_get_dw(NULL, THIS_MODULE, "winx", DEFAULT_WINX);
+ ps->winy = db_get_dw(NULL, THIS_MODULE, "winy", DEFAULT_WINY);
+ ps->winxpos = db_get_dw(NULL, THIS_MODULE, "winxpos", DEFAULT_WINXPOS);
+ ps->winypos = db_get_dw(NULL, THIS_MODULE, "winypos", DEFAULT_WINYPOS);
+ ps->alpha = db_get_b(NULL, THIS_MODULE, "alpha", DEFAULT_ALPHA);
+ ps->showmystatus = db_get_b(NULL, THIS_MODULE, "showMyStatus", DEFAULT_SHOWMYSTATUS);
+ ps->timeout = db_get_dw(NULL, THIS_MODULE, "timeout", DEFAULT_TIMEOUT);
+ ps->clr_msg = db_get_dw(NULL, THIS_MODULE, "clr_msg", DEFAULT_CLRMSG);
+ ps->clr_status = db_get_dw(NULL, THIS_MODULE, "clr_status", DEFAULT_CLRSTATUS);
+ ps->clr_shadow = db_get_dw(NULL, THIS_MODULE, "clr_shadow", DEFAULT_CLRSHADOW);
+ ps->bkclr = db_get_dw(NULL, THIS_MODULE, "bkclr", DEFAULT_BKCLR);
+
+ ps->showMsgWindow = db_get_b(NULL, THIS_MODULE, "showMessageWindow", DEFAULT_SHOWMSGWIN);
+ ps->showWhen = db_get_dw(NULL, THIS_MODULE, "showWhen", DEFAULT_SHOWWHEN);
+
DBVARIANT dbv;
- if (!db_get_ts( NULL, THIS_MODULE, "message_format", &dbv )) {
+ if (!db_get_ts(NULL, THIS_MODULE, "message_format", &dbv)) {
mir_tstrcpy(ps->msgformat, dbv.ptszVal);
db_free(&dbv);
}
else mir_tstrcpy(ps->msgformat, DEFAULT_MESSAGEFORMAT);
- ps->announce=db_get_dw(NULL,THIS_MODULE,"announce", DEFAULT_ANNOUNCE);
-
- ps->lf.lfHeight=db_get_dw(NULL,THIS_MODULE, "fntHeight", DEFAULT_FNT_HEIGHT);
- ps->lf.lfWidth=db_get_dw(NULL,THIS_MODULE, "fntWidth", DEFAULT_FNT_WIDTH);
- ps->lf.lfEscapement=db_get_dw(NULL,THIS_MODULE, "fntEscapement", DEFAULT_FNT_ESCAPEMENT);
- ps->lf.lfOrientation=db_get_dw(NULL,THIS_MODULE, "fntOrientation", DEFAULT_FNT_ORIENTATION);
- ps->lf.lfWeight=db_get_dw(NULL,THIS_MODULE, "fntWeight", DEFAULT_FNT_WEIGHT);
- ps->lf.lfItalic=db_get_b(NULL,THIS_MODULE, "fntItalic", DEFAULT_FNT_ITALIC);
- ps->lf.lfUnderline=db_get_b(NULL,THIS_MODULE, "fntUnderline", DEFAULT_FNT_UNDERLINE);
- ps->lf.lfStrikeOut=db_get_b(NULL,THIS_MODULE, "fntStrikeout", DEFAULT_FNT_STRIKEOUT);
- ps->lf.lfCharSet=db_get_b(NULL,THIS_MODULE, "fntCharSet", DEFAULT_FNT_CHARSET);
- ps->lf.lfOutPrecision=db_get_b(NULL,THIS_MODULE, "fntOutPrecision", DEFAULT_FNT_OUTPRECISION);
- ps->lf.lfClipPrecision=db_get_b(NULL,THIS_MODULE, "fntClipPrecision", DEFAULT_FNT_CLIPRECISION);
- ps->lf.lfQuality=db_get_b(NULL,THIS_MODULE, "fntQuality", DEFAULT_FNT_QUALITY);
- ps->lf.lfPitchAndFamily=db_get_b(NULL,THIS_MODULE, "fntPitchAndFamily", DEFAULT_FNT_PITCHANDFAM);
-
- if(!db_get_ts(NULL,THIS_MODULE,"fntFaceName",&dbv)) {
+ ps->announce = db_get_dw(NULL, THIS_MODULE, "announce", DEFAULT_ANNOUNCE);
+
+ ps->lf.lfHeight = db_get_dw(NULL, THIS_MODULE, "fntHeight", DEFAULT_FNT_HEIGHT);
+ ps->lf.lfWidth = db_get_dw(NULL, THIS_MODULE, "fntWidth", DEFAULT_FNT_WIDTH);
+ ps->lf.lfEscapement = db_get_dw(NULL, THIS_MODULE, "fntEscapement", DEFAULT_FNT_ESCAPEMENT);
+ ps->lf.lfOrientation = db_get_dw(NULL, THIS_MODULE, "fntOrientation", DEFAULT_FNT_ORIENTATION);
+ ps->lf.lfWeight = db_get_dw(NULL, THIS_MODULE, "fntWeight", DEFAULT_FNT_WEIGHT);
+ ps->lf.lfItalic = db_get_b(NULL, THIS_MODULE, "fntItalic", DEFAULT_FNT_ITALIC);
+ ps->lf.lfUnderline = db_get_b(NULL, THIS_MODULE, "fntUnderline", DEFAULT_FNT_UNDERLINE);
+ ps->lf.lfStrikeOut = db_get_b(NULL, THIS_MODULE, "fntStrikeout", DEFAULT_FNT_STRIKEOUT);
+ ps->lf.lfCharSet = db_get_b(NULL, THIS_MODULE, "fntCharSet", DEFAULT_FNT_CHARSET);
+ ps->lf.lfOutPrecision = db_get_b(NULL, THIS_MODULE, "fntOutPrecision", DEFAULT_FNT_OUTPRECISION);
+ ps->lf.lfClipPrecision = db_get_b(NULL, THIS_MODULE, "fntClipPrecision", DEFAULT_FNT_CLIPRECISION);
+ ps->lf.lfQuality = db_get_b(NULL, THIS_MODULE, "fntQuality", DEFAULT_FNT_QUALITY);
+ ps->lf.lfPitchAndFamily = db_get_b(NULL, THIS_MODULE, "fntPitchAndFamily", DEFAULT_FNT_PITCHANDFAM);
+
+ if (!db_get_ts(NULL, THIS_MODULE, "fntFaceName", &dbv)) {
mir_tstrcpy(ps->lf.lfFaceName, dbv.ptszVal);
db_free(&dbv);
}
@@ -161,259 +161,263 @@ void saveDBSettings(plgsettings *ps) {
logmsg("saveDBSettings");
- db_set_b(NULL,THIS_MODULE,"showShadow", ps->showShadow);
- db_set_b(NULL,THIS_MODULE,"altShadow",ps->altShadow);
- db_set_b(NULL,THIS_MODULE,"distance",ps->distance);
-
- db_set_dw(NULL,THIS_MODULE,"winx",ps->winx);
- db_set_dw(NULL,THIS_MODULE,"winy",ps->winy);
- db_set_dw(NULL,THIS_MODULE,"winxpos", ps->winxpos);
- db_set_dw(NULL,THIS_MODULE,"winypos", ps->winypos);
-
- db_set_b(NULL,THIS_MODULE,"alpha",ps->alpha);
- db_set_dw(NULL,THIS_MODULE,"timeout", ps->timeout);
-
- db_set_b(NULL,THIS_MODULE,"transparent",ps->transparent);
- db_set_b(NULL,THIS_MODULE,"messages",ps->messages);
- db_set_b(NULL,THIS_MODULE,"a_user",ps->a_user);
- db_set_ts(NULL,THIS_MODULE, "message_format", ps->msgformat);
-
- db_set_b(NULL,THIS_MODULE,"align",ps->align);
- db_set_b(NULL,THIS_MODULE,"salign",ps->salign);
-
- db_set_b(NULL,THIS_MODULE,"showMyStatus",ps->showmystatus);
-
- db_set_dw(NULL,THIS_MODULE,"clr_msg", ps->clr_msg);
- db_set_dw(NULL,THIS_MODULE,"clr_shadow", ps->clr_shadow);
- db_set_dw(NULL,THIS_MODULE,"clr_status", ps->clr_status);
- db_set_dw(NULL,THIS_MODULE,"bkclr", ps->bkclr);
-
- db_set_dw(NULL,THIS_MODULE, "fntHeight", ps->lf.lfHeight);
- db_set_dw(NULL,THIS_MODULE, "fntWidth", ps->lf.lfWidth);
- db_set_dw(NULL,THIS_MODULE, "fntEscapement", ps->lf.lfEscapement);
- db_set_dw(NULL,THIS_MODULE, "fntOrientation", ps->lf.lfOrientation);
- db_set_dw(NULL,THIS_MODULE, "fntWeight", ps->lf.lfWeight);
- db_set_b(NULL,THIS_MODULE, "fntItalic", ps->lf.lfItalic);
- db_set_b(NULL,THIS_MODULE, "fntUnderline", ps->lf.lfUnderline);
- db_set_b(NULL,THIS_MODULE, "fntStrikeout", ps->lf.lfStrikeOut);
- db_set_b(NULL,THIS_MODULE, "fntCharSet", ps->lf.lfCharSet);
- db_set_b(NULL,THIS_MODULE, "fntOutPrecision", ps->lf.lfOutPrecision);
- db_set_b(NULL,THIS_MODULE, "fntClipPrecision", ps->lf.lfClipPrecision);
- db_set_b(NULL,THIS_MODULE, "fntQuality", ps->lf.lfQuality);
- db_set_b(NULL,THIS_MODULE, "fntPitchAndFamily", ps->lf.lfPitchAndFamily);
- db_set_ts(NULL,THIS_MODULE, "fntFaceName", ps->lf.lfFaceName);
-
- db_set_dw(NULL,THIS_MODULE,"announce", ps->announce);
-
- db_set_b(NULL,THIS_MODULE, "showMessageWindow", ps->showMsgWindow);
- db_set_dw(NULL,THIS_MODULE,"showWhen", ps->showWhen);
+ db_set_b(NULL, THIS_MODULE, "showShadow", ps->showShadow);
+ db_set_b(NULL, THIS_MODULE, "altShadow", ps->altShadow);
+ db_set_b(NULL, THIS_MODULE, "distance", ps->distance);
+
+ db_set_dw(NULL, THIS_MODULE, "winx", ps->winx);
+ db_set_dw(NULL, THIS_MODULE, "winy", ps->winy);
+ db_set_dw(NULL, THIS_MODULE, "winxpos", ps->winxpos);
+ db_set_dw(NULL, THIS_MODULE, "winypos", ps->winypos);
+
+ db_set_b(NULL, THIS_MODULE, "alpha", ps->alpha);
+ db_set_dw(NULL, THIS_MODULE, "timeout", ps->timeout);
+
+ db_set_b(NULL, THIS_MODULE, "transparent", ps->transparent);
+ db_set_b(NULL, THIS_MODULE, "messages", ps->messages);
+ db_set_b(NULL, THIS_MODULE, "a_user", ps->a_user);
+ db_set_ts(NULL, THIS_MODULE, "message_format", ps->msgformat);
+
+ db_set_b(NULL, THIS_MODULE, "align", ps->align);
+ db_set_b(NULL, THIS_MODULE, "salign", ps->salign);
+
+ db_set_b(NULL, THIS_MODULE, "showMyStatus", ps->showmystatus);
+
+ db_set_dw(NULL, THIS_MODULE, "clr_msg", ps->clr_msg);
+ db_set_dw(NULL, THIS_MODULE, "clr_shadow", ps->clr_shadow);
+ db_set_dw(NULL, THIS_MODULE, "clr_status", ps->clr_status);
+ db_set_dw(NULL, THIS_MODULE, "bkclr", ps->bkclr);
+
+ db_set_dw(NULL, THIS_MODULE, "fntHeight", ps->lf.lfHeight);
+ db_set_dw(NULL, THIS_MODULE, "fntWidth", ps->lf.lfWidth);
+ db_set_dw(NULL, THIS_MODULE, "fntEscapement", ps->lf.lfEscapement);
+ db_set_dw(NULL, THIS_MODULE, "fntOrientation", ps->lf.lfOrientation);
+ db_set_dw(NULL, THIS_MODULE, "fntWeight", ps->lf.lfWeight);
+ db_set_b(NULL, THIS_MODULE, "fntItalic", ps->lf.lfItalic);
+ db_set_b(NULL, THIS_MODULE, "fntUnderline", ps->lf.lfUnderline);
+ db_set_b(NULL, THIS_MODULE, "fntStrikeout", ps->lf.lfStrikeOut);
+ db_set_b(NULL, THIS_MODULE, "fntCharSet", ps->lf.lfCharSet);
+ db_set_b(NULL, THIS_MODULE, "fntOutPrecision", ps->lf.lfOutPrecision);
+ db_set_b(NULL, THIS_MODULE, "fntClipPrecision", ps->lf.lfClipPrecision);
+ db_set_b(NULL, THIS_MODULE, "fntQuality", ps->lf.lfQuality);
+ db_set_b(NULL, THIS_MODULE, "fntPitchAndFamily", ps->lf.lfPitchAndFamily);
+ db_set_ts(NULL, THIS_MODULE, "fntFaceName", ps->lf.lfFaceName);
+
+ db_set_dw(NULL, THIS_MODULE, "announce", ps->announce);
+
+ db_set_b(NULL, THIS_MODULE, "showMessageWindow", ps->showMsgWindow);
+ db_set_dw(NULL, THIS_MODULE, "showWhen", ps->showWhen);
}
-INT_PTR CALLBACK OptDlgProc(HWND hDlg,UINT msg,WPARAM wparam,LPARAM lparam)
+INT_PTR CALLBACK OptDlgProc(HWND hDlg, UINT msg, WPARAM wparam, LPARAM lparam)
{
RECT rect;
plgsettings *ps; //0: current; 1: original
logmsg("OptDlgProc");
- switch(msg){
- case WM_INITDIALOG:
- logmsg("OptDlgProc::INITDIALOG");
- TranslateDialogDefault(hDlg);
-
- ps=(plgsettings*)malloc(sizeof(plgsettings)*2);
- loadDBSettings(&ps[0]);
- ps[1]=ps[0];
- SetWindowLongPtr(hDlg, GWLP_USERDATA, (LONG_PTR)ps);
- SetWindowLongPtr(hwnd, GWL_STYLE, WS_POPUP | WS_SIZEBOX);
- SetWindowPos(hwnd, 0, 0, 0, 0, 0, SWP_NOZORDER|SWP_NOSIZE|SWP_NOMOVE|SWP_NOACTIVATE|SWP_FRAMECHANGED);
-
- SetWindowLongPtr(GetDlgItem(hDlg,IDC_TREE1),GWL_STYLE,GetWindowLongPtr(GetDlgItem(hDlg,IDC_TREE1),GWL_STYLE)|TVS_NOHSCROLL|TVS_CHECKBOXES);
- SetWindowLongPtr(GetDlgItem(hDlg,IDC_TREE2),GWL_STYLE,GetWindowLongPtr(GetDlgItem(hDlg,IDC_TREE1),GWL_STYLE)|TVS_NOHSCROLL|TVS_CHECKBOXES);
-
- CheckDlgButton(hDlg, IDC_RADIO1+ps->align-1, BST_CHECKED);
- CheckDlgButton(hDlg, IDC_RADIO10+9-ps->salign, BST_CHECKED);
- CheckDlgButton(hDlg, IDC_CHECK1, ps->altShadow ? BST_CHECKED : BST_UNCHECKED);
- CheckDlgButton(hDlg, IDC_CHECK2, ps->showMsgWindow ? BST_CHECKED : BST_UNCHECKED);
- CheckDlgButton(hDlg, IDC_CHECK3, ps->transparent ? BST_CHECKED : BST_UNCHECKED);
- CheckDlgButton(hDlg, IDC_CHECK4, ps->showShadow ? BST_CHECKED : BST_UNCHECKED);
- CheckDlgButton(hDlg, IDC_CHECK5, ps->messages ? BST_CHECKED : BST_UNCHECKED);
-
- SetDlgItemText(hDlg, IDC_EDIT2, ps->msgformat);
-
- CheckDlgButton(hDlg, IDC_CHECK6, ps->a_user ? BST_CHECKED : BST_UNCHECKED);
- CheckDlgButton(hDlg, IDC_CHECK7, ps->showmystatus ? BST_CHECKED : BST_UNCHECKED);
- SetDlgItemInt(hDlg, IDC_EDIT1, ps->distance, 0);
-
- SendDlgItemMessage(hDlg, IDC_SLIDER1, TBM_SETRANGE, 0, MAKELONG(0, 255));
- SendDlgItemMessage(hDlg, IDC_SLIDER1, TBM_SETPOS, TRUE, (LPARAM)ps->alpha);
-
- {
- TCHAR buf[20];
- mir_sntprintf(buf, _T("%d %%"), ps->alpha*100/255);
- SetDlgItemText(hDlg, IDC_ALPHATXT, buf);
- }
-
- SetDlgItemInt(hDlg, IDC_EDIT5, ps->timeout, 0);
- FillCheckBoxTree(GetDlgItem(hDlg, IDC_TREE1), ps->announce);
- FillCheckBoxTree(GetDlgItem(hDlg, IDC_TREE2), ps->showWhen);
+ switch (msg) {
+ case WM_INITDIALOG:
+ logmsg("OptDlgProc::INITDIALOG");
+ TranslateDialogDefault(hDlg);
+
+ ps = (plgsettings*)malloc(sizeof(plgsettings) * 2);
+ loadDBSettings(&ps[0]);
+ ps[1] = ps[0];
+ SetWindowLongPtr(hDlg, GWLP_USERDATA, (LONG_PTR)ps);
+ SetWindowLongPtr(g_hWnd, GWL_STYLE, WS_POPUP | WS_SIZEBOX);
+ SetWindowPos(g_hWnd, 0, 0, 0, 0, 0, SWP_NOZORDER | SWP_NOSIZE | SWP_NOMOVE | SWP_NOACTIVATE | SWP_FRAMECHANGED);
+
+ SetWindowLongPtr(GetDlgItem(hDlg, IDC_TREE1), GWL_STYLE, GetWindowLongPtr(GetDlgItem(hDlg, IDC_TREE1), GWL_STYLE) | TVS_NOHSCROLL | TVS_CHECKBOXES);
+ SetWindowLongPtr(GetDlgItem(hDlg, IDC_TREE2), GWL_STYLE, GetWindowLongPtr(GetDlgItem(hDlg, IDC_TREE1), GWL_STYLE) | TVS_NOHSCROLL | TVS_CHECKBOXES);
+
+ CheckDlgButton(hDlg, IDC_RADIO1 + ps->align - 1, BST_CHECKED);
+ CheckDlgButton(hDlg, IDC_RADIO10 + 9 - ps->salign, BST_CHECKED);
+ CheckDlgButton(hDlg, IDC_CHECK1, ps->altShadow ? BST_CHECKED : BST_UNCHECKED);
+ CheckDlgButton(hDlg, IDC_CHECK2, ps->showMsgWindow ? BST_CHECKED : BST_UNCHECKED);
+ CheckDlgButton(hDlg, IDC_CHECK3, ps->transparent ? BST_CHECKED : BST_UNCHECKED);
+ CheckDlgButton(hDlg, IDC_CHECK4, ps->showShadow ? BST_CHECKED : BST_UNCHECKED);
+ CheckDlgButton(hDlg, IDC_CHECK5, ps->messages ? BST_CHECKED : BST_UNCHECKED);
+
+ SetDlgItemText(hDlg, IDC_EDIT2, ps->msgformat);
+
+ CheckDlgButton(hDlg, IDC_CHECK6, ps->a_user ? BST_CHECKED : BST_UNCHECKED);
+ CheckDlgButton(hDlg, IDC_CHECK7, ps->showmystatus ? BST_CHECKED : BST_UNCHECKED);
+ SetDlgItemInt(hDlg, IDC_EDIT1, ps->distance, 0);
+
+ SendDlgItemMessage(hDlg, IDC_SLIDER1, TBM_SETRANGE, 0, MAKELONG(0, 255));
+ SendDlgItemMessage(hDlg, IDC_SLIDER1, TBM_SETPOS, TRUE, (LPARAM)ps->alpha);
+
+ {
+ TCHAR buf[20];
+ mir_sntprintf(buf, _T("%d %%"), ps->alpha * 100 / 255);
+ SetDlgItemText(hDlg, IDC_ALPHATXT, buf);
+ }
+
+ SetDlgItemInt(hDlg, IDC_EDIT5, ps->timeout, 0);
+ FillCheckBoxTree(GetDlgItem(hDlg, IDC_TREE1), ps->announce);
+ FillCheckBoxTree(GetDlgItem(hDlg, IDC_TREE2), ps->showWhen);
+ return 0;
+
+ case WM_HSCROLL:
+ if (LOWORD(wparam) == SB_ENDSCROLL || LOWORD(wparam) == SB_THUMBPOSITION || LOWORD(wparam) == SB_ENDSCROLL)
return 0;
-
- case WM_HSCROLL:
- if (LOWORD(wparam)==SB_ENDSCROLL||LOWORD(wparam)==SB_THUMBPOSITION||LOWORD(wparam)==SB_ENDSCROLL)
- return 0;
- ps=(plgsettings*)GetWindowLongPtr(hDlg, GWLP_USERDATA);
- ps->alpha=SendDlgItemMessage(hDlg, IDC_SLIDER1, TBM_GETPOS, 0, 0);
- {
- TCHAR buf[20];
- mir_sntprintf(buf, _T("%d %%"), ps->alpha*100/255);
- SetDlgItemText(hDlg, IDC_ALPHATXT, buf);
- }
- goto xxx;
- case WM_DESTROY:
- logmsg("OptDlgProc::DESTROY");
- ps=(plgsettings*)GetWindowLongPtr(hDlg, GWLP_USERDATA);
- ps[0]=ps[1];
- saveDBSettings(&ps[0]);
-
- SetWindowLongPtr(hwnd, GWL_STYLE, WS_POPUP);
- SetWindowPos(hwnd, 0, 0, 0, 0, 0, SWP_NOZORDER|SWP_NOSIZE|SWP_NOMOVE|SWP_NOACTIVATE|SWP_FRAMECHANGED);
-
- SetWindowPos(hwnd, 0, ps->winxpos, ps->winypos, ps->winx, ps->winy, SWP_NOZORDER|SWP_NOACTIVATE);
- SetLayeredWindowAttributes(hwnd, ps->bkclr, ps->alpha, (ps->transparent?LWA_COLORKEY:0)|LWA_ALPHA);
-
- free((void*)GetWindowLongPtr(hDlg, GWLP_USERDATA));
+ ps = (plgsettings*)GetWindowLongPtr(hDlg, GWLP_USERDATA);
+ ps->alpha = SendDlgItemMessage(hDlg, IDC_SLIDER1, TBM_GETPOS, 0, 0);
+ {
+ TCHAR buf[20];
+ mir_sntprintf(buf, _T("%d %%"), ps->alpha * 100 / 255);
+ SetDlgItemText(hDlg, IDC_ALPHATXT, buf);
+ }
+ goto xxx;
+ case WM_DESTROY:
+ logmsg("OptDlgProc::DESTROY");
+ ps = (plgsettings*)GetWindowLongPtr(hDlg, GWLP_USERDATA);
+ ps[0] = ps[1];
+ saveDBSettings(&ps[0]);
+
+ SetWindowLongPtr(g_hWnd, GWL_STYLE, WS_POPUP);
+ SetWindowPos(g_hWnd, 0, 0, 0, 0, 0, SWP_NOZORDER | SWP_NOSIZE | SWP_NOMOVE | SWP_NOACTIVATE | SWP_FRAMECHANGED);
+
+ SetWindowPos(g_hWnd, 0, ps->winxpos, ps->winypos, ps->winx, ps->winy, SWP_NOZORDER | SWP_NOACTIVATE);
+ SetLayeredWindowAttributes(g_hWnd, ps->bkclr, ps->alpha, (ps->transparent ? LWA_COLORKEY : 0) | LWA_ALPHA);
+
+ free((void*)GetWindowLongPtr(hDlg, GWLP_USERDATA));
+ return 0;
+ case WM_COMMAND:
+ logmsg("OptDlgProc::COMMAND");
+ ps = (plgsettings*)GetWindowLongPtr(hDlg, GWLP_USERDATA);
+ switch (LOWORD(wparam)) {
+ case IDC_BUTTON7:
+ MessageBox(hDlg, TranslateT("Variables:\n %n : Nick\n %m : Message\n %l : New line"), TranslateT("Help"), MB_ICONINFORMATION | MB_OK);
return 0;
- case WM_COMMAND:
- logmsg("OptDlgProc::COMMAND");
- ps=(plgsettings*)GetWindowLongPtr(hDlg, GWLP_USERDATA);
- switch (LOWORD(wparam)) {
- case IDC_BUTTON7:
- MessageBox(hDlg, TranslateT("Variables:\n %n : Nick\n %m : Message\n %l : New line"), TranslateT("Help"), MB_ICONINFORMATION|MB_OK);
- return 0;
- case IDC_BUTTON5:
- SendMessage(hwnd, WM_USER+1, (WPARAM)TranslateT("Miranda NG is great and this is a long message."), 0);
- break;
- case IDC_BUTTON1:
- selectFont(hDlg, &(ps->lf));
- break;
- case IDC_BUTTON2:
- selectColor(hDlg, &ps->clr_status);
- break;
- case IDC_BUTTON6:
- selectColor(hDlg, &ps->clr_msg);
- break;
- case IDC_BUTTON3:
- selectColor(hDlg, &ps->clr_shadow);
- break;
- case IDC_BUTTON4:
- selectColor(hDlg, &ps->bkclr);
- break;
- case IDC_CHECK4:
- ps->showShadow=IsDlgButtonChecked(hDlg, IDC_CHECK4);
- break;
- case IDC_CHECK1:
- ps->altShadow=IsDlgButtonChecked(hDlg, IDC_CHECK1);
- break;
- case IDC_CHECK2:
- ps->showMsgWindow=IsDlgButtonChecked(hDlg, IDC_CHECK2);
- case IDC_EDIT1:
- ps->distance=GetDlgItemInt(hDlg, IDC_EDIT1, 0, 0);
- break;
- case IDC_EDIT5:
- ps->timeout=GetDlgItemInt(hDlg, IDC_EDIT5, 0, 0);
- break;
- case IDC_CHECK3:
- ps->transparent=IsDlgButtonChecked(hDlg, IDC_CHECK3);
- break;
- case IDC_CHECK5:
- ps->messages=IsDlgButtonChecked(hDlg, IDC_CHECK5);
- break;
- case IDC_CHECK6:
- ps->a_user=IsDlgButtonChecked(hDlg, IDC_CHECK6);
- break;
- case IDC_CHECK7:
- ps->showmystatus=IsDlgButtonChecked(hDlg, IDC_CHECK7);
- break;
- case IDC_RADIO1:
- case IDC_RADIO2:
- case IDC_RADIO3:
- case IDC_RADIO4:
- case IDC_RADIO5:
- case IDC_RADIO6:
- case IDC_RADIO7:
- case IDC_RADIO8:
- case IDC_RADIO9:
- if (IsDlgButtonChecked(hDlg, LOWORD(wparam)))
- ps->align=LOWORD(wparam)-IDC_RADIO1+1;
- break;
- case IDC_RADIO10:
- case IDC_RADIO11:
- case IDC_RADIO12:
- case IDC_RADIO13:
- case IDC_RADIO14:
- case IDC_RADIO15:
- case IDC_RADIO16:
- case IDC_RADIO17:
- case IDC_RADIO18:
- if (IsDlgButtonChecked(hDlg, LOWORD(wparam)))
- ps->salign=10-(LOWORD(wparam)-IDC_RADIO10+1);
- break;
- }
+ case IDC_BUTTON5:
+ SendMessage(g_hWnd, WM_USER + 1, (WPARAM)TranslateT("Miranda NG is great and this is a long message."), 0);
+ break;
+ case IDC_BUTTON1:
+ selectFont(hDlg, &(ps->lf));
+ break;
+ case IDC_BUTTON2:
+ selectColor(hDlg, &ps->clr_status);
+ break;
+ case IDC_BUTTON6:
+ selectColor(hDlg, &ps->clr_msg);
+ break;
+ case IDC_BUTTON3:
+ selectColor(hDlg, &ps->clr_shadow);
+ break;
+ case IDC_BUTTON4:
+ selectColor(hDlg, &ps->bkclr);
+ break;
+ case IDC_CHECK4:
+ ps->showShadow = IsDlgButtonChecked(hDlg, IDC_CHECK4);
+ break;
+ case IDC_CHECK1:
+ ps->altShadow = IsDlgButtonChecked(hDlg, IDC_CHECK1);
+ break;
+ case IDC_CHECK2:
+ ps->showMsgWindow = IsDlgButtonChecked(hDlg, IDC_CHECK2);
+ case IDC_EDIT1:
+ ps->distance = GetDlgItemInt(hDlg, IDC_EDIT1, 0, 0);
+ break;
+ case IDC_EDIT5:
+ ps->timeout = GetDlgItemInt(hDlg, IDC_EDIT5, 0, 0);
+ break;
+ case IDC_CHECK3:
+ ps->transparent = IsDlgButtonChecked(hDlg, IDC_CHECK3);
+ break;
+ case IDC_CHECK5:
+ ps->messages = IsDlgButtonChecked(hDlg, IDC_CHECK5);
+ break;
+ case IDC_CHECK6:
+ ps->a_user = IsDlgButtonChecked(hDlg, IDC_CHECK6);
+ break;
+ case IDC_CHECK7:
+ ps->showmystatus = IsDlgButtonChecked(hDlg, IDC_CHECK7);
+ break;
+ case IDC_RADIO1:
+ case IDC_RADIO2:
+ case IDC_RADIO3:
+ case IDC_RADIO4:
+ case IDC_RADIO5:
+ case IDC_RADIO6:
+ case IDC_RADIO7:
+ case IDC_RADIO8:
+ case IDC_RADIO9:
+ if (IsDlgButtonChecked(hDlg, LOWORD(wparam)))
+ ps->align = LOWORD(wparam) - IDC_RADIO1 + 1;
+ break;
+ case IDC_RADIO10:
+ case IDC_RADIO11:
+ case IDC_RADIO12:
+ case IDC_RADIO13:
+ case IDC_RADIO14:
+ case IDC_RADIO15:
+ case IDC_RADIO16:
+ case IDC_RADIO17:
+ case IDC_RADIO18:
+ if (IsDlgButtonChecked(hDlg, LOWORD(wparam)))
+ ps->salign = 10 - (LOWORD(wparam) - IDC_RADIO10 + 1);
+ break;
+ }
xxx:
- saveDBSettings(ps);
- SetWindowPos(hwnd, 0, 0, 0, ps->winx, ps->winy, SWP_NOMOVE|SWP_NOZORDER|SWP_NOACTIVATE);
- SetLayeredWindowAttributes(hwnd, db_get_dw(NULL,THIS_MODULE, "bkclr", DEFAULT_BKCLR), db_get_b(NULL,THIS_MODULE, "alpha", DEFAULT_ALPHA), (db_get_b(NULL,THIS_MODULE, "transparent", DEFAULT_TRANPARENT)?LWA_COLORKEY:0)|LWA_ALPHA);
- InvalidateRect(hwnd, 0, TRUE);
- SendMessage(GetParent(hDlg),PSM_CHANGED,0,0);
-
- return 0;
+ saveDBSettings(ps);
+ SetWindowPos(g_hWnd, 0, 0, 0, ps->winx, ps->winy, SWP_NOMOVE | SWP_NOZORDER | SWP_NOACTIVATE);
+ SetLayeredWindowAttributes(g_hWnd,
+ db_get_dw(NULL, THIS_MODULE, "bkclr", DEFAULT_BKCLR),
+ db_get_b(NULL, THIS_MODULE, "alpha", DEFAULT_ALPHA),
+ (db_get_b(NULL, THIS_MODULE, "transparent", DEFAULT_TRANPARENT) ? LWA_COLORKEY : 0) | LWA_ALPHA);
+ InvalidateRect(g_hWnd, 0, TRUE);
+ SendMessage(GetParent(hDlg), PSM_CHANGED, 0, 0);
+
+ return 0;
+
+ case WM_NOTIFY:
+ logmsg("OptDlgProc::NOTIFY");
+ switch (((LPNMHDR)lparam)->code) {
+ case TVN_SETDISPINFO:
+ case NM_CLICK:
+ case NM_RETURN:
+ case TVN_SELCHANGED:
+ if (((LPNMHDR)lparam)->idFrom == IDC_TREE1)
+ SendMessage(GetParent(hDlg), PSM_CHANGED, 0, 0);
+ break;
+
+ case PSN_APPLY:
+ ps = (plgsettings*)GetWindowLongPtr(hDlg, GWLP_USERDATA);
+
+ GetWindowRect(g_hWnd, &rect);
+ ps->winx = rect.right - rect.left;
+ ps->winy = rect.bottom - rect.top;
+ ps->winxpos = rect.left;
+ ps->winypos = rect.top;
+ ps->announce = MakeCheckBoxTreeFlags(GetDlgItem(hDlg, IDC_TREE1));
+ ps->showWhen = MakeCheckBoxTreeFlags(GetDlgItem(hDlg, IDC_TREE2));
+ GetDlgItemText(hDlg, IDC_EDIT2, ps->msgformat, 255);
+ ps[1] = ps[0]; //apply current settings at closing
- case WM_NOTIFY:
- logmsg("OptDlgProc::NOTIFY");
- switch(((LPNMHDR)lparam)->code){
- case TVN_SETDISPINFO:
- case NM_CLICK:
- case NM_RETURN:
- case TVN_SELCHANGED:
- if (((LPNMHDR)lparam)->idFrom==IDC_TREE1)
- SendMessage(GetParent(hDlg),PSM_CHANGED,0,0);
- break;
- case PSN_APPLY:
- ps=(plgsettings*)GetWindowLongPtr(hDlg, GWLP_USERDATA);
-
- GetWindowRect(hwnd, &rect);
- ps->winx=rect.right-rect.left;
- ps->winy=rect.bottom-rect.top;
- ps->winxpos=rect.left;
- ps->winypos=rect.top;
- ps->announce=MakeCheckBoxTreeFlags(GetDlgItem(hDlg, IDC_TREE1));
- ps->showWhen=MakeCheckBoxTreeFlags(GetDlgItem(hDlg, IDC_TREE2));
- GetDlgItemText(hDlg, IDC_EDIT2, ps->msgformat, 255);
- ps[1]=ps[0]; //apply current settings at closing
-
- saveDBSettings(ps);
- SetLayeredWindowAttributes(hwnd, db_get_dw(NULL,THIS_MODULE, "bkclr", DEFAULT_BKCLR), db_get_b(NULL,THIS_MODULE, "alpha", DEFAULT_ALPHA), (db_get_b(NULL,THIS_MODULE, "transparent", DEFAULT_TRANPARENT)?LWA_COLORKEY:0)|LWA_ALPHA);
- InvalidateRect(hwnd, 0, TRUE);
- break;
- }
+ saveDBSettings(ps);
+ SetLayeredWindowAttributes(g_hWnd, db_get_dw(NULL, THIS_MODULE, "bkclr", DEFAULT_BKCLR), db_get_b(NULL, THIS_MODULE, "alpha", DEFAULT_ALPHA), (db_get_b(NULL, THIS_MODULE, "transparent", DEFAULT_TRANPARENT) ? LWA_COLORKEY : 0) | LWA_ALPHA);
+ InvalidateRect(g_hWnd, 0, TRUE);
break;
+ }
+ break;
}
return 0;
}
-int OptionsInit(WPARAM wparam,LPARAM)
+int OptionsInit(WPARAM wparam, LPARAM)
{
OPTIONSDIALOGPAGE odp = { 0 };
- odp.position=150000000;
- odp.groupPosition=950000000;
- odp.hInstance=hI;
- odp.pszTemplate=MAKEINTRESOURCEA(IDD_DIALOG1);
- odp.ptszGroup=LPGENT("Plugins");
- odp.ptszTitle=LPGENT("OSD");
- odp.pfnDlgProc=OptDlgProc;
- odp.flags=ODPF_BOLDGROUPS|ODPF_TCHAR;
- Options_AddPage(wparam,&odp);
+ odp.position = 150000000;
+ odp.groupPosition = 950000000;
+ odp.hInstance = hI;
+ odp.pszTemplate = MAKEINTRESOURCEA(IDD_DIALOG1);
+ odp.ptszGroup = LPGENT("Plugins");
+ odp.ptszTitle = LPGENT("OSD");
+ odp.pfnDlgProc = OptDlgProc;
+ odp.flags = ODPF_BOLDGROUPS | ODPF_TCHAR;
+ Options_AddPage(wparam, &odp);
return 0;
}
diff --git a/plugins/wbOSD/src/stdafx.h b/plugins/wbOSD/src/stdafx.h index 7d82633948..aca31800a0 100644 --- a/plugins/wbOSD/src/stdafx.h +++ b/plugins/wbOSD/src/stdafx.h @@ -112,6 +112,6 @@ int OptionsInit(WPARAM wparam,LPARAM lparam); void loadDBSettings(plgsettings *ps);
extern HINSTANCE hI;
-extern HWND hwnd;
+extern HWND g_hWnd;
extern HANDLE hservosda;
-extern HANDLE hHookedNewEvent, hHookedInit, hProtoAck, hContactSettingChanged, hHookContactStatusChanged, hContactStatusChanged, hpluginShutDown;
\ No newline at end of file +extern HANDLE hHookedInit, hProtoAck, hContactSettingChanged, hHookContactStatusChanged, hContactStatusChanged;
\ No newline at end of file diff --git a/plugins/wbOSD/src/wbOSD.cpp b/plugins/wbOSD/src/wbOSD.cpp index c7a7983a4d..0a9e341244 100644 --- a/plugins/wbOSD/src/wbOSD.cpp +++ b/plugins/wbOSD/src/wbOSD.cpp @@ -9,106 +9,106 @@ Distributed under GNU's GPL 2 or later #include "stdafx.h"
-TCHAR szClassName[] = _T("wbOSD");
-const static osdmsg defstr={_T(""), 0, RGB(0, 0, 0), 0, 0};
+TCHAR szClassName[] = _T("wbOSD");
+const static osdmsg defstr = { _T(""), 0, RGB(0, 0, 0), 0, 0 };
int DrawMe(HWND hwnd, TCHAR *string, COLORREF color)
{
logmsg("DrawMe");
- if (!string) string=_T("bullshit");
-
+ if (!string) string = _T("bullshit");
+
plgsettings plgs;
loadDBSettings(&plgs);
- HFONT fh=CreateFontIndirect(&(plgs.lf));
-
+ HFONT fh = CreateFontIndirect(&(plgs.lf));
+
PAINTSTRUCT ps;
- HDC hdc=BeginPaint(hwnd, &ps);
+ HDC hdc = BeginPaint(hwnd, &ps);
SetBkMode(hdc, TRANSPARENT);
RECT rect;
GetClientRect(hwnd, &rect);
- HBRUSH bkb=CreateSolidBrush(plgs.bkclr);
+ HBRUSH bkb = CreateSolidBrush(plgs.bkclr);
FillRect(hdc, &rect, bkb);
DeleteObject(bkb);
- HGDIOBJ oo=SelectObject(hdc, fh);
+ HGDIOBJ oo = SelectObject(hdc, fh);
- UINT talign=0;
+ UINT talign = 0;
RECT rect2 = rect;
- DrawText(hdc, string, -1, &rect2, DT_WORDBREAK|DT_CALCRECT);
+ DrawText(hdc, string, -1, &rect2, DT_WORDBREAK | DT_CALCRECT);
- if (plgs.align<=3)
- rect.top=0;
- else if (plgs.align<=6)
- rect.top=(rect.bottom-rect2.bottom)/2;
- else if (plgs.align<=9)
- rect.top=rect.bottom-rect2.bottom;
+ if (plgs.align <= 3)
+ rect.top = 0;
+ else if (plgs.align <= 6)
+ rect.top = (rect.bottom - rect2.bottom) / 2;
+ else if (plgs.align <= 9)
+ rect.top = rect.bottom - rect2.bottom;
- if (((plgs.align-1)%3)==0)
- rect.left=0;
- else if (((plgs.align-2)%3)==0)
- rect.left=(rect.right-rect2.right)/2;
- else if (((plgs.align-3)%3)==0)
- rect.left=rect.right-rect2.right;
+ if (((plgs.align - 1) % 3) == 0)
+ rect.left = 0;
+ else if (((plgs.align - 2) % 3) == 0)
+ rect.left = (rect.right - rect2.right) / 2;
+ else if (((plgs.align - 3) % 3) == 0)
+ rect.left = rect.right - rect2.right;
- rect.bottom=rect.top+rect2.bottom;
- rect.right=rect.left+rect2.right;
+ rect.bottom = rect.top + rect2.bottom;
+ rect.right = rect.left + rect2.right;
//draw shadow
if (plgs.showShadow) {
int sxo, syo;
logmsg("DrawMe::showShadow");
- if (plgs.salign<=3)
- syo=-plgs.distance;
- else if (plgs.salign<=6)
- syo=0;
- else if (plgs.salign<=9)
- syo=plgs.distance;
+ if (plgs.salign <= 3)
+ syo = -plgs.distance;
+ else if (plgs.salign <= 6)
+ syo = 0;
+ else if (plgs.salign <= 9)
+ syo = plgs.distance;
else
- syo=0;
-
- if (((plgs.salign-1)%3)==0)
- sxo=-plgs.distance;
- else if (((plgs.salign-2)%3)==0)
- sxo=0;
- else if (((plgs.salign-3)%3)==0)
- sxo=plgs.distance;
+ syo = 0;
+
+ if (((plgs.salign - 1) % 3) == 0)
+ sxo = -plgs.distance;
+ else if (((plgs.salign - 2) % 3) == 0)
+ sxo = 0;
+ else if (((plgs.salign - 3) % 3) == 0)
+ sxo = plgs.distance;
else
- sxo=0;
+ sxo = 0;
SetTextColor(hdc, plgs.clr_shadow);
- if (plgs.altShadow==0) {
- rect2=rect;
+ if (plgs.altShadow == 0) {
+ rect2 = rect;
OffsetRect(&rect, sxo, syo);
- DrawText(hdc, string, -1, &rect2, DT_WORDBREAK|talign);
+ DrawText(hdc, string, -1, &rect2, DT_WORDBREAK | talign);
}
else {
rect2 = rect;
rect2.left += plgs.distance;
- DrawText(hdc, string, -1, &rect2, DT_WORDBREAK|talign);
+ DrawText(hdc, string, -1, &rect2, DT_WORDBREAK | talign);
rect2 = rect;
rect2.left -= plgs.distance;
- DrawText(hdc, string, -1, &rect2, DT_WORDBREAK|talign);
+ DrawText(hdc, string, -1, &rect2, DT_WORDBREAK | talign);
rect2 = rect;
rect2.top -= plgs.distance;
- DrawText(hdc, string, -1, &rect2, DT_WORDBREAK|talign);
+ DrawText(hdc, string, -1, &rect2, DT_WORDBREAK | talign);
rect2 = rect;
rect2.top += plgs.distance;
- DrawText(hdc, string, -1, &rect2, DT_WORDBREAK|talign);
+ DrawText(hdc, string, -1, &rect2, DT_WORDBREAK | talign);
- OffsetRect(&rect, sxo/2, syo/2);
+ OffsetRect(&rect, sxo / 2, syo / 2);
}
}
//draw text
SetTextColor(hdc, color);
DrawText(hdc, string, -1, &rect, DT_WORDBREAK);
-
+
SelectObject(hdc, oo);
DeleteObject(fh);
EndPaint(hwnd, &ps);
@@ -116,9 +116,9 @@ int DrawMe(HWND hwnd, TCHAR *string, COLORREF color) return 0;
}
-LRESULT CALLBACK WindowProcedure (HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam)
+LRESULT CALLBACK WindowProcedure(HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam)
{
- osdmsg* ms;
+ osdmsg *ms;
switch (message) {
case WM_CREATE:
@@ -133,10 +133,10 @@ LRESULT CALLBACK WindowProcedure (HWND hwnd, UINT message, WPARAM wParam, LPARAM case WM_PAINT:
logmsg("WindowProcedure::PAINT");
- ms=(osdmsg*)GetWindowLongPtr(hwnd, GWLP_USERDATA);
+ ms = (osdmsg*)GetWindowLongPtr(hwnd, GWLP_USERDATA);
if (ms)
return DrawMe(hwnd, ms->text, ms->color);
-
+
PAINTSTRUCT ps;
BeginPaint(hwnd, &ps);
EndPaint(hwnd, &ps);
@@ -146,109 +146,109 @@ LRESULT CALLBACK WindowProcedure (HWND hwnd, UINT message, WPARAM wParam, LPARAM logmsg("WindowProcedure::NCRBUTTONDOWN");
ms = (osdmsg*)GetWindowLongPtr(hwnd, GWLP_USERDATA);
- if ( ms ) {
- if ( ms->callback) ms->callback(ms->param);
- SendMessage(hwnd, WM_USER+3, 0, 0);
+ if (ms) {
+ if (ms->callback) ms->callback(ms->param);
+ SendMessage(hwnd, WM_USER + 3, 0, 0);
}
return 0;
case WM_TIMER:
logmsg("WindowProcedure::TIMER");
- SendMessage(hwnd, WM_USER+3, wParam, 0);
+ SendMessage(hwnd, WM_USER + 3, wParam, 0);
return 0;
- case WM_USER+1: //draw text ((char *)string, (int) timeout
+ case WM_USER + 1: //draw text ((char *)string, (int) timeout
logmsg("WindowProcedure::USER+1");
- ms=(osdmsg*)mir_alloc(sizeof(osdmsg));
- ms->text = mir_tstrdup((TCHAR *)wParam );
- if ( lParam == 0 )
- lParam = db_get_dw( NULL,THIS_MODULE, "timeout", DEFAULT_TIMEOUT );
+ ms = (osdmsg*)mir_alloc(sizeof(osdmsg));
+ ms->text = mir_tstrdup((TCHAR *)wParam);
+ if (lParam == 0)
+ lParam = db_get_dw(NULL, THIS_MODULE, "timeout", DEFAULT_TIMEOUT);
ms->timeout = lParam;
ms->callback = 0;
- ms->color = db_get_dw(NULL,THIS_MODULE, "clr_msg", DEFAULT_CLRMSG);
+ ms->color = db_get_dw(NULL, THIS_MODULE, "clr_msg", DEFAULT_CLRMSG);
ms->param = 0;
- SendMessage(hwnd, WM_USER+4, (WPARAM)ms, 0);
+ SendMessage(hwnd, WM_USER + 4, (WPARAM)ms, 0);
mir_free(ms->text);
mir_free(ms);
return 0;
- case WM_USER+2: //show
+ case WM_USER + 2: //show
logmsg("WindowProcedure::USER+2");
- SetWindowPos(hwnd, HWND_TOPMOST, 0, 0, 0, 0, SWP_NOMOVE|SWP_NOSIZE|SWP_SHOWWINDOW|SWP_NOACTIVATE);
+ SetWindowPos(hwnd, HWND_TOPMOST, 0, 0, 0, 0, SWP_NOMOVE | SWP_NOSIZE | SWP_SHOWWINDOW | SWP_NOACTIVATE);
return 0;
- case WM_USER+3: //hide
- ms = ( osdmsg* )GetWindowLongPtr(hwnd, GWLP_USERDATA);
+ case WM_USER + 3: //hide
+ ms = (osdmsg*)GetWindowLongPtr(hwnd, GWLP_USERDATA);
logmsg("WindowProcedure::USER+3");
- if ( !ms )
+ if (!ms)
return 0;
logmsg("WindowProcedure::USER+3/om");
- KillTimer(hwnd, (UINT)ms);
+ KillTimer(hwnd, (UINT_PTR)ms);
mir_free(ms->text);
mir_free(ms);
SetWindowLongPtr(hwnd, GWLP_USERDATA, 0);
ShowWindow(hwnd, SW_HIDE);
return 0;
- case WM_USER+4:
+ case WM_USER + 4:
logmsg("WindowProcedure::USER+4");
ms = (osdmsg*)GetWindowLongPtr(hwnd, GWLP_USERDATA);
- if ( ms != 0 ) {
+ if (ms != 0) {
logmsg("WindowProcedure::USER+4/old");
- KillTimer(hwnd, (UINT)ms);
+ KillTimer(hwnd, (UINT_PTR)ms);
mir_free(ms->text);
mir_free(ms);
SetWindowLongPtr(hwnd, GWLP_USERDATA, 0);
}
- ms =(osdmsg*)mir_alloc(sizeof(osdmsg));
+ ms = (osdmsg*)mir_alloc(sizeof(osdmsg));
memcpy(ms, (osdmsg*)wParam, sizeof(osdmsg));
- ms->text = mir_tstrdup( ms->text );
+ ms->text = mir_tstrdup(ms->text);
SetWindowLongPtr(hwnd, GWLP_USERDATA, (LONG_PTR)ms);
- SetTimer(hwnd, (UINT)ms, (int)ms->timeout, 0);
+ SetTimer(hwnd, (UINT_PTR)ms, (UINT)ms->timeout, 0);
InvalidateRect(hwnd, 0, TRUE);
- SendMessage(hwnd, WM_USER+2, 0, 0);
+ SendMessage(hwnd, WM_USER + 2, 0, 0);
return 0;
case WM_NCHITTEST:
{
RECT rect;
GetWindowRect(hwnd, &rect);
-
+
logmsg("WindowProcedure::NCHITTEST");
- if (LOWORD(lParam)>=(rect.left+5) && LOWORD(lParam)<=(rect.right-5) &&
- HIWORD(lParam)>=(rect.top+5) && HIWORD(lParam)<=(rect.bottom-5))
+ if (LOWORD(lParam) >= (rect.left + 5) && LOWORD(lParam) <= (rect.right - 5) &&
+ HIWORD(lParam) >= (rect.top + 5) && HIWORD(lParam) <= (rect.bottom - 5))
return HTCAPTION;
- return DefWindowProc (hwnd, message, wParam, lParam);
+ return DefWindowProc(hwnd, message, wParam, lParam);
}
- //here will be the doubleclick => open-message-window solution ;-)
- //case WM_NCLBUTTONDBLCLK:
- // CallService(MS_MSG_SENDMESSAGE, wparam,(LPARAM)&odp);
- // return 0;
+ //here will be the doubleclick => open-message-window solution ;-)
+ //case WM_NCLBUTTONDBLCLK:
+ // CallService(MS_MSG_SENDMESSAGE, wparam,(LPARAM)&odp);
+ // return 0;
default:
- return DefWindowProc (hwnd, message, wParam, lParam);
+ return DefWindowProc(hwnd, message, wParam, lParam);
}
}
INT_PTR OSDAnnounce(WPARAM wParam, LPARAM lParam)
{
logmsg("OSDAnnounce");
- return SendMessage(hwnd, WM_USER+1, wParam, lParam);
+ return SendMessage(g_hWnd, WM_USER + 1, wParam, lParam);
}
int pluginShutDown(WPARAM, LPARAM)
{
logmsg("pluginShutDown");
- if (hwnd) {
+ if (g_hWnd) {
logmsg("pluginShutDown/hwnd");
- SendMessage(hwnd, WM_USER+3, 0, 0);
- DestroyWindow(hwnd);
- hwnd=0;
+ SendMessage(g_hWnd, WM_USER + 3, 0, 0);
+ DestroyWindow(g_hWnd);
+ g_hWnd = NULL;
}
return 0;
}
@@ -256,54 +256,53 @@ int pluginShutDown(WPARAM, LPARAM) int MainInit(WPARAM, LPARAM)
{
logmsg("MainInit");
- HookEvent(ME_OPT_INITIALISE,OptionsInit);
-
+ HookEvent(ME_OPT_INITIALISE, OptionsInit);
+
WNDCLASSEX wincl;
- wincl.hInstance = hI;
- wincl.lpszClassName = szClassName;
- wincl.lpfnWndProc = WindowProcedure;
- wincl.style = CS_DBLCLKS;
- wincl.cbSize = sizeof (WNDCLASSEX);
-
- wincl.hIcon = LoadIcon (NULL, IDI_APPLICATION);
- wincl.hIconSm = LoadIcon (NULL, IDI_APPLICATION);
- wincl.hCursor = LoadCursor (NULL, IDC_ARROW);
+ wincl.hInstance = hI;
+ wincl.lpszClassName = szClassName;
+ wincl.lpfnWndProc = WindowProcedure;
+ wincl.style = CS_DBLCLKS;
+ wincl.cbSize = sizeof(WNDCLASSEX);
+
+ wincl.hIcon = LoadIcon(NULL, IDI_APPLICATION);
+ wincl.hIconSm = LoadIcon(NULL, IDI_APPLICATION);
+ wincl.hCursor = LoadCursor(NULL, IDC_ARROW);
wincl.lpszMenuName = NULL;
wincl.cbClsExtra = 0;
wincl.cbWndExtra = 0;
- wincl.hbrBackground = 0;
+ wincl.hbrBackground = 0;
- if ( !RegisterClassEx( &wincl ))
+ if (!RegisterClassEx(&wincl))
return 0;
- hwnd = CreateWindowEx(WS_EX_LAYERED | WS_EX_TOOLWINDOW, szClassName, _T("WannaBeOSD"),
+ g_hWnd = CreateWindowEx(WS_EX_LAYERED | WS_EX_TOOLWINDOW, szClassName, _T("WannaBeOSD"),
WS_POPUP,
- db_get_dw(NULL,THIS_MODULE, "winxpos", DEFAULT_WINXPOS),
- db_get_dw(NULL,THIS_MODULE, "winypos", DEFAULT_WINYPOS),
- db_get_dw(NULL,THIS_MODULE, "winx", DEFAULT_WINX),
- db_get_dw(NULL,THIS_MODULE, "winy", DEFAULT_WINY),
+ db_get_dw(NULL, THIS_MODULE, "winxpos", DEFAULT_WINXPOS),
+ db_get_dw(NULL, THIS_MODULE, "winypos", DEFAULT_WINYPOS),
+ db_get_dw(NULL, THIS_MODULE, "winx", DEFAULT_WINX),
+ db_get_dw(NULL, THIS_MODULE, "winy", DEFAULT_WINY),
HWND_DESKTOP, NULL, hI, NULL);
- SetWindowLongPtr(hwnd, GWLP_USERDATA, 0);
+ SetWindowLongPtr(g_hWnd, GWLP_USERDATA, 0);
+
+ SetLayeredWindowAttributes(g_hWnd, db_get_dw(NULL, THIS_MODULE, "bkclr", DEFAULT_BKCLR), db_get_b(NULL, THIS_MODULE, "alpha", DEFAULT_ALPHA), (db_get_b(NULL, THIS_MODULE, "transparent", DEFAULT_TRANPARENT) ? LWA_COLORKEY : 0) | LWA_ALPHA);
- SetLayeredWindowAttributes(hwnd, db_get_dw(NULL,THIS_MODULE, "bkclr", DEFAULT_BKCLR), db_get_b(NULL,THIS_MODULE, "alpha", DEFAULT_ALPHA), (db_get_b(NULL,THIS_MODULE, "transparent", DEFAULT_TRANPARENT)?LWA_COLORKEY:0)|LWA_ALPHA);
+ hservosda = CreateServiceFunction("OSD/Announce", OSDAnnounce);
+
+ HookEvent(ME_DB_EVENT_ADDED, HookedNewEvent);
- hservosda=CreateServiceFunction("OSD/Announce", OSDAnnounce);
-
- hHookedNewEvent = HookEvent(ME_DB_EVENT_ADDED, HookedNewEvent);
-
// try to create ME_STATUSCHANGE_CONTACTSTATUSCHANGED event... I hope it fails when newstatusnotify or equal creates it before ;-)
-
- hContactStatusChanged = HookEvent(ME_STATUSCHANGE_CONTACTSTATUSCHANGED,ContactStatusChanged);
+
+ hContactStatusChanged = HookEvent(ME_STATUSCHANGE_CONTACTSTATUSCHANGED, ContactStatusChanged);
if (!hContactStatusChanged) {
hHookContactStatusChanged = CreateHookableEvent(ME_STATUSCHANGE_CONTACTSTATUSCHANGED);
- hContactSettingChanged = HookEvent(ME_DB_CONTACT_SETTINGCHANGED,ContactSettingChanged);
+ hContactSettingChanged = HookEvent(ME_DB_CONTACT_SETTINGCHANGED, ContactSettingChanged);
- hContactStatusChanged = HookEvent(ME_STATUSCHANGE_CONTACTSTATUSCHANGED,ContactStatusChanged);
+ hContactStatusChanged = HookEvent(ME_STATUSCHANGE_CONTACTSTATUSCHANGED, ContactStatusChanged);
}
- hProtoAck=HookEvent(ME_PROTO_ACK,ProtoAck);
-
- hpluginShutDown=HookEvent(ME_SYSTEM_SHUTDOWN,pluginShutDown);
+ hProtoAck = HookEvent(ME_PROTO_ACK, ProtoAck);
+ HookEvent(ME_SYSTEM_SHUTDOWN, pluginShutDown);
return 0;
}
|