summaryrefslogtreecommitdiff
path: root/plugins/AutoShutdown
diff options
context:
space:
mode:
authorGeorge Hazan <george.hazan@gmail.com>2012-11-02 14:11:01 +0000
committerGeorge Hazan <george.hazan@gmail.com>2012-11-02 14:11:01 +0000
commit75b1ff75c42644eb36552762652e4b0c9ff071bc (patch)
tree238f026ef373d30a395846f38c302a81961b14ac /plugins/AutoShutdown
parent2caba72d51b09368801f23dd8951d589ab4dc809 (diff)
final switch to the typed icolib api
git-svn-id: http://svn.miranda-ng.org/main/trunk@2152 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c
Diffstat (limited to 'plugins/AutoShutdown')
-rw-r--r--plugins/AutoShutdown/src/frame.cpp14
-rw-r--r--plugins/AutoShutdown/src/settingsdlg.cpp10
-rw-r--r--plugins/AutoShutdown/src/shutdownsvc.cpp10
-rw-r--r--plugins/AutoShutdown/src/utils.cpp20
-rw-r--r--plugins/AutoShutdown/src/utils.h2
5 files changed, 22 insertions, 34 deletions
diff --git a/plugins/AutoShutdown/src/frame.cpp b/plugins/AutoShutdown/src/frame.cpp
index 425edb3831..33f0d53260 100644
--- a/plugins/AutoShutdown/src/frame.cpp
+++ b/plugins/AutoShutdown/src/frame.cpp
@@ -234,8 +234,8 @@ static LRESULT CALLBACK FrameWndProc(HWND hwndFrame,UINT msg,WPARAM wParam,LPARA
UnhookEvent(dat->hHookIconsChanged);
/* other childs are destroyed automatically */
if(dat->hwndToolTip!=NULL) DestroyWindow(dat->hwndToolTip);
- hIcon=(HICON)SendMessage(dat->hwndIcon,STM_SETIMAGE,IMAGE_ICON,(LPARAM)NULL);
- IcoLib_ReleaseIcon(hIcon); /* does NULL check */
+ hIcon=(HICON)SendMessage(dat->hwndIcon,STM_SETIMAGE,IMAGE_ICON,0);
+ Skin_ReleaseIcon(hIcon); /* does NULL check */
break;
}
case WM_NCDESTROY:
@@ -281,9 +281,9 @@ static LRESULT CALLBACK FrameWndProc(HWND hwndFrame,UINT msg,WPARAM wParam,LPARA
}
case M_REFRESH_ICONS:
if(dat->hwndIcon!=NULL)
- IcoLib_ReleaseIcon((HICON)SendMessage(dat->hwndIcon,STM_SETIMAGE,IMAGE_ICON,(LPARAM)IcoLib_GetIcon("AutoShutdown_Header")));
+ Skin_ReleaseIcon((HICON)SendMessage(dat->hwndIcon,STM_SETIMAGE,IMAGE_ICON,(LPARAM)Skin_GetIcon("AutoShutdown_Header")));
if(hFrame) /* refresh frame title icon */
- IcoLib_ReleaseIcon(SetFrameTitleIcon(hFrame,IcoLib_GetIcon("AutoShutdown_Active")));
+ Skin_ReleaseIcon(SetFrameTitleIcon(hFrame,Skin_GetIcon("AutoShutdown_Active")));
return 0;
case M_REFRESH_FONTS:
{ LOGFONT lf;
@@ -343,7 +343,7 @@ static LRESULT CALLBACK FrameWndProc(HWND hwndFrame,UINT msg,WPARAM wParam,LPARA
}
dat->flags&=~FWPDF_COUNTDOWNINVALID;
/* commctl 4.70+, Win95: 1-100 will work fine (wrap around) */
- SendMessage(dat->hwndProgress,PBM_SETRANGE32,(WPARAM)0,(LPARAM)dat->countdown);
+ SendMessage(dat->hwndProgress,PBM_SETRANGE32,0,(LPARAM)dat->countdown);
return 0;
case WM_TIMER:
if(dat==NULL) return 0;
@@ -537,7 +537,7 @@ void ShowCountdownFrame(WORD fTimeFlags)
CLISTFrame clf;
ZeroMemory(&clf,sizeof(clf));
clf.cbSize=sizeof(clf);
- clf.hIcon=IcoLib_GetIcon("AutoShutdown_Active"); /* CListFrames does not make a copy */
+ clf.hIcon=Skin_GetIcon("AutoShutdown_Active"); /* CListFrames does not make a copy */
clf.align=alBottom;
clf.height=GetSystemMetrics(SM_CYICON);
clf.Flags=F_VISIBLE|F_SHOWTBTIP|F_NOBORDER|F_SKINNED;
@@ -570,7 +570,7 @@ void CloseCountdownFrame(void)
if(hwndCountdownFrame!=NULL) {
SendMessage(hwndCountdownFrame,M_CLOSE_COUNTDOWN,0,0);
if(hFrame) {
- IcoLib_ReleaseIcon(SetFrameTitleIcon(hFrame,NULL));
+ Skin_ReleaseIcon(SetFrameTitleIcon(hFrame,NULL));
/* HACKS TO FIX CLUIFrames:
* workaround #6: MS_CLIST_FRAMES_REMOVEFRAME does not finish with
* destroy cycle (clist_modern, clist_nicer crashes) */
diff --git a/plugins/AutoShutdown/src/settingsdlg.cpp b/plugins/AutoShutdown/src/settingsdlg.cpp
index aa7ed6678a..2131c768aa 100644
--- a/plugins/AutoShutdown/src/settingsdlg.cpp
+++ b/plugins/AutoShutdown/src/settingsdlg.cpp
@@ -71,7 +71,7 @@ static INT_PTR CALLBACK SettingsDlgProc(HWND hwndDlg,UINT msg,WPARAM wParam,LPAR
hwndSettingsDlg=hwndDlg;
TranslateDialogDefault(hwndDlg);
locale=CallService(MS_LANGPACK_GETLOCALE,0,0);
- SendDlgItemMessage(hwndDlg,IDC_ICON_HEADER,STM_SETIMAGE,IMAGE_ICON,(LPARAM)IcoLib_GetIcon("AutoShutdown_Header"));
+ SendDlgItemMessage(hwndDlg,IDC_ICON_HEADER,STM_SETIMAGE,IMAGE_ICON,(LPARAM)Skin_GetIcon("AutoShutdown_Header"));
{ HFONT hBoldFont;
LOGFONT lf;
if(GetObject((HFONT)SendDlgItemMessage(hwndDlg,IDC_TEXT_HEADER,WM_GETFONT,0,0),sizeof(lf),&lf)) {
@@ -191,10 +191,10 @@ static INT_PTR CALLBACK SettingsDlgProc(HWND hwndDlg,UINT msg,WPARAM wParam,LPAR
CallService(MS_AUTOREPLACER_REMWINHANDLE,0,(LPARAM)GetDlgItem(hwndDlg,IDC_EDIT_MESSAGE));
Utils_SaveWindowPosition(hwndDlg,NULL,"AutoShutdown","SettingsDlg_");
MagneticWindows_RemoveWindow(hwndDlg);
- hIcon=(HICON)SendDlgItemMessage(hwndDlg,IDC_ICON_HEADER,STM_SETIMAGE,IMAGE_ICON,(LPARAM)NULL);
- IcoLib_ReleaseIcon(hIcon); /* does NULL check */
+ hIcon=(HICON)SendDlgItemMessage(hwndDlg,IDC_ICON_HEADER,STM_SETIMAGE,IMAGE_ICON,0);
+ Skin_ReleaseIcon(hIcon); /* does NULL check */
hFont=(HFONT)SendDlgItemMessage(hwndDlg,IDC_TEXT_HEADER,WM_GETFONT,0,0);
- SendDlgItemMessage(hwndDlg,IDC_TEXT_HEADER,WM_SETFONT,(WPARAM)NULL,FALSE); /* no return value */
+ SendDlgItemMessage(hwndDlg,IDC_TEXT_HEADER,WM_SETFONT,0,FALSE); /* no return value */
if(hFont!=NULL) DeleteObject(hFont);
hwndSettingsDlg=NULL;
return TRUE;
@@ -463,7 +463,7 @@ void SetShutdownMenuItem(BOOL fActive)
}
else hTrayMenuItem = Menu_AddTrayMenuItem(&cmi);
- IcoLib_ReleaseIcon(cmi.hIcon);
+ Skin_ReleaseIcon(cmi.hIcon);
}
static INT_PTR MenuItemCommand(WPARAM wParam,LPARAM lParam)
diff --git a/plugins/AutoShutdown/src/shutdownsvc.cpp b/plugins/AutoShutdown/src/shutdownsvc.cpp
index 3c33d39653..c8f524e874 100644
--- a/plugins/AutoShutdown/src/shutdownsvc.cpp
+++ b/plugins/AutoShutdown/src/shutdownsvc.cpp
@@ -169,7 +169,7 @@ static DWORD ShutdownNow(BYTE shutdownType)
break;
case SDSDT_SETMIRANDAOFFLINE:
/* set global status mode to offline (is remembered by Miranda on exit) */
- CallService(MS_CLIST_SETSTATUSMODE,(WPARAM)ID_STATUS_OFFLINE,(LPARAM)NULL);
+ CallService(MS_CLIST_SETSTATUSMODE,(WPARAM)ID_STATUS_OFFLINE,0);
break;
case SDSDT_STANDBY:
case SDSDT_HIBERNATE:
@@ -368,7 +368,7 @@ static INT_PTR CALLBACK ShutdownDlgProc(HWND hwndDlg,UINT msg,WPARAM wParam,LPAR
if(lParam==SDSDT_SHUTDOWN || lParam==SDSDT_REBOOT || lParam==SDSDT_LOGOFF)
ShowWindow(GetDlgItem(hwndDlg,IDC_TEXT_UNSAVEDWARNING),SW_SHOW);
- SendDlgItemMessage(hwndDlg,IDC_ICON_HEADER,STM_SETIMAGE,IMAGE_ICON,(LPARAM)IcoLib_GetIcon("AutoShutdown_Header"));
+ SendDlgItemMessage(hwndDlg,IDC_ICON_HEADER,STM_SETIMAGE,IMAGE_ICON,(LPARAM)Skin_GetIcon("AutoShutdown_Header"));
{ HFONT hBoldFont;
LOGFONT lf;
if(GetObject((HFONT)SendDlgItemMessage(hwndDlg,IDC_TEXT_HEADER,WM_GETFONT,0,0),sizeof(lf),&lf)) {
@@ -404,10 +404,10 @@ static INT_PTR CALLBACK ShutdownDlgProc(HWND hwndDlg,UINT msg,WPARAM wParam,LPAR
/* reallow foreground window changes (WinMe/2000+) */
if(pfnLockSetForegroundWindow) pfnLockSetForegroundWindow(LSFW_UNLOCK);
Utils_SaveWindowPosition(hwndDlg,NULL,"AutoShutdown","ConfirmDlg_");
- hIcon=(HICON)SendDlgItemMessage(hwndDlg,IDC_ICON_HEADER,STM_SETIMAGE,IMAGE_ICON,(LPARAM)NULL);
- IcoLib_ReleaseIcon(hIcon); /* does NULL check */
+ hIcon=(HICON)SendDlgItemMessage(hwndDlg,IDC_ICON_HEADER,STM_SETIMAGE,IMAGE_ICON,0);
+ Skin_ReleaseIcon(hIcon); /* does NULL check */
hFont=(HFONT)SendDlgItemMessage(hwndDlg,IDC_TEXT_HEADER,WM_GETFONT,0,0);
- SendDlgItemMessage(hwndDlg,IDC_TEXT_HEADER,WM_SETFONT,(WPARAM)NULL,FALSE); /* no return value */
+ SendDlgItemMessage(hwndDlg,IDC_TEXT_HEADER,WM_SETFONT,0,FALSE); /* no return value */
if(hFont!=NULL) DeleteObject(hFont);
return TRUE;
}
diff --git a/plugins/AutoShutdown/src/utils.cpp b/plugins/AutoShutdown/src/utils.cpp
index c0128f80d6..c6dd625531 100644
--- a/plugins/AutoShutdown/src/utils.cpp
+++ b/plugins/AutoShutdown/src/utils.cpp
@@ -116,7 +116,7 @@ char* GetWinErrorDescription(DWORD dwLastError)
char *buf=NULL;
DWORD flags=FORMAT_MESSAGE_ALLOCATE_BUFFER|FORMAT_MESSAGE_FROM_SYSTEM;
if(!FormatMessageA(flags,NULL,dwLastError,LANGIDFROMLCID((LCID)CallService(MS_LANGPACK_GETLOCALE,0,0)),(char*)&buf,0,NULL))
- if(GetLastError()==ERROR_RESOURCE_LANG_NOT_FOUND)
+ if(GetLastError()==ERROR_RESOURCE_LANG_NOT_FOUND)
FormatMessageA(flags,NULL,dwLastError,0,(char*)&buf,0,NULL);
return buf;
}
@@ -155,11 +155,11 @@ BOOL TimeStampToSystemTime(time_t timestamp,SYSTEMTIME *st)
return TRUE;
}
-BOOL GetFormatedCountdown(TCHAR *pszOut,int nSize,time_t countdown)
+BOOL GetFormatedCountdown(TCHAR *pszOut,int nSize,time_t countdown)
{
static BOOL fInited=FALSE;
static int (WINAPI *pfnStrFromTimeInterval)(TCHAR*,UINT,DWORD,int);
- static int (WINAPI *pfnGetDurationFormat)(LCID,DWORD,const SYSTEMTIME*,double,WCHAR*,WCHAR*,int);
+ static int (WINAPI *pfnGetDurationFormat)(LCID,DWORD,const SYSTEMTIME*,double,WCHAR*,WCHAR*,int);
/* Init */
if(!fInited) {
*(PROC*)&pfnGetDurationFormat=GetProcAddress(GetModuleHandleA("KERNEL32"),"GetDurationFormat");
@@ -185,7 +185,7 @@ BOOL GetFormatedCountdown(TCHAR *pszOut,int nSize,time_t countdown)
return FALSE;
}
-BOOL GetFormatedDateTime(TCHAR *pszOut,int nSize,time_t timestamp,BOOL fShowDateEvenToday)
+BOOL GetFormatedDateTime(TCHAR *pszOut,int nSize,time_t timestamp,BOOL fShowDateEvenToday)
{
SYSTEMTIME st,stNow;
LCID locale;
@@ -250,7 +250,7 @@ int FontService_RegisterColor(const char *pszDbModule,const char *pszDbName,cons
ColourIDT cid;
ZeroMemory(&cid,sizeof(cid));
cid.cbSize=sizeof(cid);
- cid.defcolour=clrDefault;
+ cid.defcolour=clrDefault;
lstrcpynA(cid.dbSettingsGroup,pszDbModule,sizeof(cid.dbSettingsGroup)); /* buffer safe */
lstrcpynA(cid.setting,pszDbName,sizeof(cid.setting)); /* buffer safe */
lstrcpyn(cid.group,pszSection,SIZEOF(cid.group)); /* buffer safe */
@@ -291,16 +291,6 @@ HANDLE IcoLib_AddIconRes(const char *pszDbName,const TCHAR *pszSection,const TCH
return Skin_AddIcon(&sid);
}
-HICON IcoLib_GetIcon(const char *pszDbName)
-{
- return (HICON)CallService(MS_SKIN2_GETICON,0,(LPARAM)pszDbName);
-}
-
-int IcoLib_ReleaseIcon(HICON hIcon)
-{
- return CallService(MS_SKIN2_RELEASEICON,(WPARAM)hIcon,0);
-}
-
int SkinAddNewSoundBundled(const char *pszDbName,const char *pszSection,const char *pszDesc,const char *pszSubDir,const char *pszDefaultFile)
{
SKINSOUNDDESCEX ssd;
diff --git a/plugins/AutoShutdown/src/utils.h b/plugins/AutoShutdown/src/utils.h
index d70dd980d7..189906e57a 100644
--- a/plugins/AutoShutdown/src/utils.h
+++ b/plugins/AutoShutdown/src/utils.h
@@ -42,7 +42,5 @@ int FontService_GetColor(const TCHAR *pszSection,const TCHAR *pszDescription,COL
/* Skin */
HANDLE IcoLib_AddIconRes(const char *pszDbName,const TCHAR *pszSection,const TCHAR *pszDesc,HINSTANCE hInst,WORD idRes,BOOL fLarge);
-HICON IcoLib_GetIcon(const char *pszDbName);
-int IcoLib_ReleaseIcon(HICON hIcon);
int SkinAddNewSoundBundled(const char *pszDbName,const char *pszSection,const char *pszDesc,const char *pszSubDir,const char *pszDefaultFile);
void AddHotkey();