From 3d2778a48e83fc02e5a2f8e13f4ec596cc1305c2 Mon Sep 17 00:00:00 2001 From: Kirill Volinsky Date: Sat, 23 Jun 2012 14:56:59 +0000 Subject: QuickMessages: plusified git-svn-id: http://svn.miranda-ng.org/main/trunk@562 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c --- plugins/QuickMessages/Utils.cpp | 38 +++++++-------- plugins/QuickMessages/main.cpp | 55 ++++++++++------------ plugins/QuickMessages/options.cpp | 24 +++++----- plugins/QuickMessages/quickmessages.h | 2 +- plugins/QuickMessages/quickmessages_10.vcxproj | 6 +-- .../QuickMessages/quickmessages_10.vcxproj.filters | 6 +-- 6 files changed, 62 insertions(+), 69 deletions(-) (limited to 'plugins/QuickMessages') diff --git a/plugins/QuickMessages/Utils.cpp b/plugins/QuickMessages/Utils.cpp index 8b80502064..01b020228c 100644 --- a/plugins/QuickMessages/Utils.cpp +++ b/plugins/QuickMessages/Utils.cpp @@ -257,7 +257,7 @@ DWORD BalanceButtons(int buttonsWas,int buttonsNow) bb.bbbFlags=BBBF_ISIMBUTTON|BBBF_ISCHATBUTTON|BBBF_ISLSIDEBUTTON; bb.dwButtonID=buttonsWas++; bb.dwDefPos=300+buttonsWas; - bb.hIcon=(HANDLE)AddIcon(hIcon, iconname, iconname); + bb.hIcon = (HANDLE)AddIcon(hIcon, iconname, iconname); CallService(MS_BB_ADDBUTTON, 0, (LPARAM)&bb); } } @@ -279,7 +279,7 @@ void InitButtonsList() DBWriteContactSettingByte(NULL, PLGNAME,"ButtonsCount", (BYTE)g_iButtonsCount); break;} - ld=mir_alloc(sizeof(ListData)); + ld = (ListData *)mir_alloc(sizeof(ListData)); ButtonsList[i]=ld; ld->sl=li.List_Create(0,1); ld->ptszQValue=ld->ptszOPQValue=getMenuEntry(i,0,2); @@ -295,7 +295,7 @@ void InitButtonsList() if (!(pszEntry=getMenuEntry(i,j,0))) break; - bd=mir_alloc(sizeof(ButtonData)); + bd = (ButtonData *)mir_alloc(sizeof(ButtonData)); memset(bd,0,sizeof(ButtonData)); bd->dwPos=bd->dwOPPos=j; @@ -305,7 +305,7 @@ void InitButtonsList() bd->bInQMenu=bd->bOpInQMenu=getEntryByte(i,j,0); bd->bIsServName=bd->bIsOpServName=getEntryByte(i,j,2); if(bd->bInQMenu){ - QuickData* qd=mir_alloc(sizeof(QuickData)); + QuickData* qd = (QuickData *)mir_alloc(sizeof(QuickData)); qd->dwPos=k++; qd->ptszValue=bd->pszValue; qd->ptszValueName=bd->pszName; @@ -366,7 +366,7 @@ TCHAR* getMenuEntry(int buttonnum,int entrynum,BYTE mode) int AddIcon(HICON icon, char *name, char *description) - { +{ SKINICONDESC sid = {0}; sid.cbSize = sizeof(SKINICONDESC); sid.pszSection = "Quick Messages"; @@ -375,8 +375,8 @@ int AddIcon(HICON icon, char *name, char *description) sid.pszName = name; sid.hDefaultIcon = icon; - return Skin_AddIcon( &sid); - } + return (int)Skin_AddIcon(&sid); +} int RegisterCustomButton(WPARAM wParam,LPARAM lParam) { @@ -425,13 +425,13 @@ TCHAR* ParseString(HANDLE hContact,TCHAR* ptszQValIn,TCHAR* ptszText,TCHAR* ptsz { case 't':{ TCHAR* p=NULL; - p=realloc(tempQValue, (QVSize+TextSize+1)*sizeof(TCHAR)); + p = (TCHAR *)realloc(tempQValue, (QVSize + TextSize+1)*sizeof(TCHAR)); if(p){ int test=0; i=iOffset; tempQValue=ptszQValue=p; - tempPointer=memmove(ptszQValue+i+TextSize,ptszQValue+i+2,(QVSize-i-1)*sizeof(TCHAR)); + tempPointer = (TCHAR *)memmove(ptszQValue + i + TextSize, ptszQValue + i + 2, (QVSize - i - 1)*sizeof(TCHAR)); if(TextSize) memcpy(ptszQValue+i, ptszText, TextSize*sizeof(TCHAR)); @@ -450,12 +450,12 @@ TCHAR* ParseString(HANDLE hContact,TCHAR* ptszQValIn,TCHAR* ptszText,TCHAR* ptsz case 'c':{ TCHAR* p=NULL; - p=realloc(tempQValue, (QVSize+ClipSize+1)*sizeof(TCHAR)); + p = (TCHAR *)realloc(tempQValue, (QVSize + ClipSize + 1)*sizeof(TCHAR)); if(p){ i=iOffset; tempQValue=ptszQValue=p; - tempPointer=memmove(ptszQValue+i+ClipSize,ptszQValue+i+2,(QVSize-i-1)*sizeof(TCHAR)); + tempPointer = (TCHAR *)memmove(ptszQValue + i + ClipSize, ptszQValue + i + 2, (QVSize - i - 1)*sizeof(TCHAR)); if(ClipSize) memcpy(ptszQValue+i, ptszClip, ClipSize*sizeof(TCHAR)); QVSize+=(ClipSize-2); @@ -479,12 +479,12 @@ TCHAR* ParseString(HANDLE hContact,TCHAR* ptszQValIn,TCHAR* ptszText,TCHAR* ptsz NameLenght=(int)_tcslen(ptszName); - p=realloc(tempQValue, (QVSize+NameLenght+1)*sizeof(TCHAR)); + p = (TCHAR *)realloc(tempQValue, (QVSize + NameLenght + 1)*sizeof(TCHAR)); if(p){ i=iOffset; tempQValue=ptszQValue=p; - tempPointer=memmove(ptszQValue+i+NameLenght,ptszQValue+i+2,(QVSize-i-1)*sizeof(TCHAR)); + tempPointer = (TCHAR *)memmove(ptszQValue + i + NameLenght, ptszQValue + i + 2, (QVSize - i - 1)*sizeof(TCHAR)); if(NameLenght) memcpy(ptszQValue+i, ptszName, NameLenght*sizeof(TCHAR)); QVSize+=(NameLenght-2); @@ -507,12 +507,12 @@ TCHAR* ParseString(HANDLE hContact,TCHAR* ptszQValIn,TCHAR* ptszText,TCHAR* ptsz ptszName=(TCHAR *)CallService(MS_CLIST_GETCONTACTDISPLAYNAME, (WPARAM)hContact, GCDNF_TCHAR); NameLenght=(int)_tcslen(ptszName); - p=realloc(tempQValue, (QVSize+NameLenght+1)*sizeof(TCHAR)); + p = (TCHAR *)realloc(tempQValue, (QVSize + NameLenght + 1)*sizeof(TCHAR)); if(p){ i=iOffset; tempQValue=ptszQValue=p; - tempPointer=memmove(ptszQValue+i+NameLenght,ptszQValue+i+2,(QVSize-i-1)*sizeof(TCHAR)); + tempPointer = (TCHAR *)memmove(ptszQValue + i + NameLenght, ptszQValue + i + 2, (QVSize - i - 1)*sizeof(TCHAR)); if(NameLenght)memcpy(ptszQValue+i, ptszName, NameLenght*sizeof(TCHAR)); QVSize+=(NameLenght-2); @@ -544,12 +544,12 @@ TCHAR* ParseString(HANDLE hContact,TCHAR* ptszQValIn,TCHAR* ptszText,TCHAR* ptsz NameLenght=(int)_tcslen(ci.pszVal); ptszName=ci.pszVal; } - p=realloc(tempQValue, (QVSize+NameLenght+1)*sizeof(TCHAR)); + p = (TCHAR *)realloc(tempQValue, (QVSize + NameLenght + 1)*sizeof(TCHAR)); if(p){ i=iOffset; tempQValue=ptszQValue=p; - tempPointer=memmove(ptszQValue+i+NameLenght,ptszQValue+i+2,(QVSize-i-1)*sizeof(TCHAR)); + tempPointer = (TCHAR *)memmove(ptszQValue + i + NameLenght, ptszQValue + i + 2, (QVSize - i - 1)*sizeof(TCHAR)); if(NameLenght)memcpy(ptszQValue+i, ptszName, NameLenght*sizeof(TCHAR)); QVSize+=(NameLenght-2); @@ -581,12 +581,12 @@ TCHAR* ParseString(HANDLE hContact,TCHAR* ptszQValIn,TCHAR* ptszText,TCHAR* ptsz NameLenght=(int)_tcslen(ci.pszVal); ptszName=ci.pszVal; } - p=realloc(tempQValue, (QVSize+NameLenght+1)*sizeof(TCHAR)); + p = (TCHAR *)realloc(tempQValue, (QVSize + NameLenght + 1)*sizeof(TCHAR)); if(p){ i=iOffset; tempQValue=ptszQValue=p; - tempPointer=memmove(ptszQValue+i+NameLenght,ptszQValue+i+2,(QVSize-i-1)*sizeof(TCHAR)); + tempPointer = (TCHAR *)memmove(ptszQValue + i + NameLenght, ptszQValue + i + 2, (QVSize - i - 1)*sizeof(TCHAR)); if(NameLenght)memcpy(ptszQValue+i, ptszName, NameLenght*sizeof(TCHAR)); QVSize+=(NameLenght-2); diff --git a/plugins/QuickMessages/main.cpp b/plugins/QuickMessages/main.cpp index ea51b49eda..a4c6684b10 100644 --- a/plugins/QuickMessages/main.cpp +++ b/plugins/QuickMessages/main.cpp @@ -24,7 +24,8 @@ HINSTANCE hinstance; WNDPROC mainProc; HANDLE hEventCBButtonPressed, hEventCBInit,hEventInputMenu, hEventDbOptionsInit, hEventDbPluginsLoaded, -hEventDbPreShutdown, hIcon ; +hEventDbPreShutdown; +HICON hIcon; int g_iButtonsCount=0; int g_bShutDown=0; @@ -51,12 +52,11 @@ PLUGININFOEX pluginInfo = { UNICODE_AWARE, 0, // {37ED754B-6CF9-40ed-9EB6-0FEF8E822475} - { 0x37ed754b, 0x6cf9, 0x40ed, { 0x9e, 0xb6, 0xf, 0xef, 0x8e, 0x82, 0x24, 0x75 } } - }; - + { 0x37ed754b, 0x6cf9, 0x40ed, { 0x9e, 0xb6, 0xf, 0xef, 0x8e, 0x82, 0x24, 0x75 } } +}; int PreShutdown(WPARAM wparam,LPARAM lparam) - { +{ g_bShutDown=1; DestructButtonsList(); @@ -68,9 +68,10 @@ int PreShutdown(WPARAM wparam,LPARAM lparam) UnhookEvent(hEventDbPreShutdown); return 0; - } +} + static int InputMenuPopup(WPARAM wParam,LPARAM lParam) - { +{ HMENU hSubMenu=NULL; int i=0; MessageWindowPopupData * mwpd = (MessageWindowPopupData *)lParam; @@ -127,7 +128,7 @@ static int InputMenuPopup(WPARAM wParam,LPARAM lParam) if(textlenght) { - pszText=mir_alloc((textlenght+10)*sizeof(TCHAR)); + pszText = (TCHAR *)mir_alloc((textlenght+10)*sizeof(TCHAR)); ZeroMemory(pszText,(textlenght+10)*sizeof(TCHAR)); SendMessage(mwpd->hwnd,EM_GETSELTEXT, 0, (LPARAM)pszText); } @@ -151,10 +152,10 @@ static int InputMenuPopup(WPARAM wParam,LPARAM lParam) return 1; } return 0; - } +} static int CustomButtonPressed(WPARAM wParam,LPARAM lParam) - { +{ CustomButtonClickData *cbcd=(CustomButtonClickData *)lParam; CHARRANGE cr; @@ -211,7 +212,7 @@ static int CustomButtonPressed(WPARAM wParam,LPARAM lParam) textlenght=cr.cpMax-cr.cpMin; if(textlenght) { - pszText=mir_alloc((textlenght+10)*sizeof(TCHAR)); + pszText = (TCHAR *)mir_alloc((textlenght+10)*sizeof(TCHAR)); ZeroMemory(pszText,(textlenght+10)*sizeof(TCHAR)); SendMessage(hEdit,EM_GETSELTEXT, 0, (LPARAM)pszText); } @@ -312,11 +313,11 @@ static int CustomButtonPressed(WPARAM wParam,LPARAM lParam) if(pszText) mir_free(pszText); if(pszCBText) mir_free(pszCBText); return 1; - } +} static int PluginInit(WPARAM wparam,LPARAM lparam) - { +{ g_bStartup=1; hEventDbOptionsInit=HookEvent(ME_OPT_INITIALISE,OptionsInit); hEventCBButtonPressed=HookEvent(ME_MSG_BUTTONPRESSED,CustomButtonPressed); @@ -352,32 +353,26 @@ static int PluginInit(WPARAM wparam,LPARAM lparam) g_bStartup=0; return 0; - } - - -// {651EAD6E-00C6-47e4-94A3-C63789ED89F9} -static const MUUID interfaces[] = {{ 0x651ead6e, 0xc6, 0x47e4, { 0x94, 0xa3, 0xc6, 0x37, 0x89, 0xed, 0x89, 0xf9 } }, MIID_LAST}; -const __declspec(dllexport) MUUID* MirandaPluginInterfaces(void){ - return interfaces;} +} -__declspec(dllexport) PLUGININFOEX* MirandaPluginInfoEx(DWORD mirandaVersion) +extern "C" __declspec(dllexport) PLUGININFOEX* MirandaPluginInfoEx(DWORD mirandaVersion) { return &pluginInfo; } -__declspec(dllexport)int Unload(void) - { +extern "C" __declspec(dllexport) int Unload(void) +{ return 0; - } +} -BOOL WINAPI DllMain(HINSTANCE hinst,DWORD fdwReason,LPVOID lpvReserved) - { +BOOL WINAPI DllMain(HINSTANCE hinst, DWORD fdwReason, LPVOID lpvReserved) +{ hinstance=hinst; return 1; - } +} -int __declspec(dllexport)Load(PLUGINLINK *link) - { +extern "C" __declspec(dllexport) int Load(PLUGINLINK *link) +{ pluginLink=link; mir_getMMI(&mmi); @@ -387,4 +382,4 @@ int __declspec(dllexport)Load(PLUGINLINK *link) hEventDbPluginsLoaded=HookEvent(ME_SYSTEM_MODULESLOADED,PluginInit); hEventDbPreShutdown=HookEvent(ME_SYSTEM_PRESHUTDOWN,PreShutdown); return 0; - } +} \ No newline at end of file diff --git a/plugins/QuickMessages/options.cpp b/plugins/QuickMessages/options.cpp index 9cb1a10cf7..ab369abfd0 100644 --- a/plugins/QuickMessages/options.cpp +++ b/plugins/QuickMessages/options.cpp @@ -19,18 +19,16 @@ along with this program. If not, see . #include "quickmessages.h" -static BOOL bOptionsInit; - int g_iOPButtonsCount; -BOOL bNeedRestart=FALSE; -BOOL drag=FALSE,bOptionsInit=TRUE; -HANDLE hDragItem=NULL; -HANDLE hButtonsList=NULL; -HANDLE hMenuTree=NULL; -HWND hwndEdit=NULL; -WNDPROC oldEditProc=0, oldBNameProc=0, oldMNameProc=0; +BOOL bNeedRestart = FALSE; +BOOL drag = FALSE, bOptionsInit = TRUE; +HTREEITEM hDragItem = NULL; +HWND hButtonsList = NULL; +HWND hMenuTree = NULL; +HWND hwndEdit = NULL; +WNDPROC oldEditProc = 0, oldBNameProc = 0, oldMNameProc = 0; -HWND g_opHdlg=NULL,g_varhelpDlg=NULL; +HWND g_opHdlg = NULL, g_varhelpDlg = NULL; INT_PTR CALLBACK HelpDlgProc(HWND hdlg,UINT msg,WPARAM wparam,LPARAM lparam) { @@ -317,7 +315,7 @@ void SaveMenuTree(HWND hdlg) } if(bd->bInQMenu) { - QuickData* qd=mir_alloc(sizeof(QuickData)); + QuickData* qd = (QuickData *)mir_alloc(sizeof(QuickData)); qd->dwPos=k++; qd->fEntryType=bd->fEntryType; qd->bIsService=bd->bIsServName; @@ -1002,7 +1000,7 @@ INT_PTR CALLBACK OptionsProc(HWND hdlg,UINT msg,WPARAM wparam,LPARAM lparam) break; } - ld=mir_alloc(sizeof(ListData)); + ld = (ListData *)mir_alloc(sizeof(ListData)); ButtonsList[g_iOPButtonsCount++]=ld; ld->sl=li.List_Create(0,1); @@ -1061,7 +1059,7 @@ INT_PTR CALLBACK OptionsProc(HWND hdlg,UINT msg,WPARAM wparam,LPARAM lparam) if (!TreeView_GetCount(hButtonsList)) break; if (!(tvi.hItem=TreeView_GetSelection(hButtonsList))) break; - bd=mir_alloc(sizeof(ButtonData)); + bd = (ButtonData *)mir_alloc(sizeof(ButtonData)); memset(bd,0,sizeof(ButtonData)); GetWindowText(GetDlgItem(hdlg,IDC_MENUNAME),namebuff,MAX_PATH); diff --git a/plugins/QuickMessages/quickmessages.h b/plugins/QuickMessages/quickmessages.h index c5e9d851a3..51f5f247d5 100644 --- a/plugins/QuickMessages/quickmessages.h +++ b/plugins/QuickMessages/quickmessages.h @@ -51,7 +51,7 @@ along with this program. If not, see . extern struct LIST_INTERFACE li; extern HINSTANCE hinstance; -extern HANDLE hIcon; +extern HICON hIcon; extern ListData* ButtonsList[100]; extern SortedList* QuickList; extern BOOL g_bRClickAuto; diff --git a/plugins/QuickMessages/quickmessages_10.vcxproj b/plugins/QuickMessages/quickmessages_10.vcxproj index 91df7a68fd..367b35b522 100644 --- a/plugins/QuickMessages/quickmessages_10.vcxproj +++ b/plugins/QuickMessages/quickmessages_10.vcxproj @@ -161,9 +161,9 @@ - - - + + + diff --git a/plugins/QuickMessages/quickmessages_10.vcxproj.filters b/plugins/QuickMessages/quickmessages_10.vcxproj.filters index 84fcdd9229..45104938f6 100644 --- a/plugins/QuickMessages/quickmessages_10.vcxproj.filters +++ b/plugins/QuickMessages/quickmessages_10.vcxproj.filters @@ -15,13 +15,13 @@ - + Source Files - + Source Files - + Source Files -- cgit v1.2.3