summaryrefslogtreecommitdiff
path: root/plugins/AutoShutdown
diff options
context:
space:
mode:
authorTobias Weimer <wishmaster51@googlemail.com>2013-08-22 21:58:50 +0000
committerTobias Weimer <wishmaster51@googlemail.com>2013-08-22 21:58:50 +0000
commitae983ffa444902e6354e68317c97fdcbc781afe6 (patch)
tree820ba440f18583fdafd34bfbd9651c5648c88a26 /plugins/AutoShutdown
parent3fe0183127f71140708186188f14994562f9dd0b (diff)
AutoShutdown:
- fixed TopToolbar Button (fixes #439) - redesigned options dialog git-svn-id: http://svn.miranda-ng.org/main/trunk@5789 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c
Diffstat (limited to 'plugins/AutoShutdown')
-rw-r--r--plugins/AutoShutdown/res/resource.rc182
-rw-r--r--plugins/AutoShutdown/shutdown_10.vcxproj5
-rw-r--r--plugins/AutoShutdown/shutdown_10.vcxproj.filters11
-rw-r--r--plugins/AutoShutdown/src/frame.cpp22
-rw-r--r--plugins/AutoShutdown/src/main.cpp7
-rw-r--r--plugins/AutoShutdown/src/resource.h4
-rw-r--r--plugins/AutoShutdown/src/settingsdlg.cpp86
-rw-r--r--plugins/AutoShutdown/src/settingsdlg.h5
-rw-r--r--plugins/AutoShutdown/src/shutdownsvc.cpp33
-rw-r--r--plugins/AutoShutdown/src/watcher.cpp31
-rw-r--r--plugins/AutoShutdown/src/watcher.h1
11 files changed, 182 insertions, 205 deletions
diff --git a/plugins/AutoShutdown/res/resource.rc b/plugins/AutoShutdown/res/resource.rc
index 5cf11affb7..14d7d2ee0c 100644
--- a/plugins/AutoShutdown/res/resource.rc
+++ b/plugins/AutoShutdown/res/resource.rc
@@ -1,4 +1,4 @@
-//Microsoft Developer Studio generated resource script.
+// Microsoft Visual C++ generated resource script.
//
#include "..\src\resource.h"
@@ -13,13 +13,11 @@
#undef APSTUDIO_READONLY_SYMBOLS
/////////////////////////////////////////////////////////////////////////////
-// Englisch (GB) resources
+// English (United Kingdom) resources
#if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_ENG)
-#ifdef _WIN32
LANGUAGE LANG_ENGLISH, SUBLANG_ENGLISH_UK
#pragma code_page(1252)
-#endif //_WIN32
#ifdef APSTUDIO_INVOKED
/////////////////////////////////////////////////////////////////////////////
@@ -27,18 +25,18 @@ LANGUAGE LANG_ENGLISH, SUBLANG_ENGLISH_UK
// TEXTINCLUDE
//
-1 TEXTINCLUDE
+1 TEXTINCLUDE
BEGIN
"..\\src\\resource.h\0"
END
-2 TEXTINCLUDE
+2 TEXTINCLUDE
BEGIN
"#include <winres.h>\r\n"
"\0"
END
-3 TEXTINCLUDE
+3 TEXTINCLUDE
BEGIN
"\r\n"
"\0"
@@ -52,107 +50,68 @@ END
// Dialog
//
-IDD_OPT_SHUTDOWN DIALOGEX 0, 0, 201, 190
-STYLE DS_FIXEDSYS | WS_CHILD
+IDD_OPT_SHUTDOWN DIALOGEX 0, 0, 308, 182
+STYLE DS_SETFONT | DS_FIXEDSYS | WS_CHILD
EXSTYLE WS_EX_CONTROLPARENT
-FONT 8, "MS Shell Dlg"
+FONT 8, "MS Shell Dlg", 0, 0, 0x1
BEGIN
- GROUPBOX "Shutdown",IDC_STATIC,3,1,196,45
- CONTROL "&Show confirmation dialog before shutdown",
- IDC_CHECK_SHOWCONFIRMDLG,"Button",BS_AUTOCHECKBOX |
- WS_GROUP | WS_TABSTOP,12,14,182,10
- LTEXT "&Countdown starts at:",IDC_TEXT_COUNTDOWNSTARTS,24,29,
- 79,8
- EDITTEXT IDC_EDIT_CONFIRMDLGCOUNTDOWN,109,27,32,12,ES_AUTOHSCROLL |
- ES_NUMBER
- CONTROL "",IDC_SPIN_CONFIRMDLGCOUNTDOWN,"msctls_updown32",
- UDS_SETBUDDYINT | UDS_ALIGNRIGHT | UDS_AUTOBUDDY |
- UDS_ARROWKEYS | UDS_NOTHOUSANDS | UDS_HOTTRACK |
- WS_TABSTOP,137,27,9,11
- LTEXT "seconds",IDC_TEXT_SECONDS,146,29,48,8,NOT WS_GROUP
- GROUPBOX "Shutdown Events",IDC_STATIC,3,51,196,66,WS_GROUP
- CONTROL "&Activate automatic shutdown with the same settings again if Miranda NG was closed with automatic shutdown enabled",
- IDC_CHECK_REMEMBERONRESTART,"Button",BS_AUTOCHECKBOX |
- BS_TOP | BS_MULTILINE | WS_TABSTOP,12,64,182,27
- CONTROL "&Ignore hidden or temporary contacts when watching for all contacts being offline",
- IDC_CHECK_SMARTOFFLINECHECK,"Button",BS_AUTOCHECKBOX |
- BS_TOP | BS_MULTILINE | WS_TABSTOP,12,93,182,20
- GROUPBOX "Critical Shutdown Events",IDC_STATIC,3,123,196,66
- LTEXT "Automatically shutdown the computer and turn the power off when one of the following occurs:",
- IDC_STATIC,12,135,182,18,SS_NOPREFIX
- CONTROL "&Thunderstorm warning is issued (Weather)",
- IDC_CHECK_WEATHER,"Button",BS_AUTOCHECKBOX | BS_TOP |
- WS_DISABLED | WS_TABSTOP,12,157,182,11
+ GROUPBOX "Shutdown",IDC_STATIC,3,1,289,45
+ CONTROL "&Show confirmation dialog before shutdown",IDC_CHECK_SHOWCONFIRMDLG,
+ "Button",BS_AUTOCHECKBOX | WS_GROUP | WS_TABSTOP,12,14,273,10
+ RTEXT "&Countdown starts at:",IDC_TEXT_COUNTDOWNSTARTS,24,29,160,8
+ EDITTEXT IDC_EDIT_CONFIRMDLGCOUNTDOWN,191,27,32,12,ES_AUTOHSCROLL | ES_NUMBER
+ CONTROL "",IDC_SPIN_CONFIRMDLGCOUNTDOWN,"msctls_updown32",UDS_SETBUDDYINT | UDS_ALIGNRIGHT | UDS_AUTOBUDDY | UDS_ARROWKEYS | UDS_NOTHOUSANDS | UDS_HOTTRACK | WS_TABSTOP,222,27,11,11
+ LTEXT "seconds",IDC_TEXT_SECONDS,237,29,48,8,NOT WS_GROUP
+ GROUPBOX "Shutdown Events",IDC_STATIC,3,51,289,60,WS_GROUP
+ CONTROL "&Activate automatic shutdown with the same settings again if Miranda NG was closed with automatic shutdown enabled",IDC_CHECK_REMEMBERONRESTART,
+ "Button",BS_AUTOCHECKBOX | BS_TOP | BS_MULTILINE | WS_TABSTOP,12,64,273,19
+ CONTROL "&Ignore hidden or temporary contacts when watching for all contacts being offline",IDC_CHECK_SMARTOFFLINECHECK,
+ "Button",BS_AUTOCHECKBOX | BS_TOP | BS_MULTILINE | WS_TABSTOP,12,88,273,19
+ GROUPBOX "Critical Shutdown Events",IDC_STATIC,3,116,289,62
+ LTEXT "Automatically shutdown the computer and turn the power off when one of the following occurs:",IDC_STATIC,12,128,273,18,SS_NOPREFIX
+ CONTROL "&Thunderstorm warning is issued (Weather)",IDC_CHECK_WEATHER,
+ "Button",BS_AUTOCHECKBOX | BS_TOP | WS_DISABLED | WS_TABSTOP,12,150,273,11
CONTROL "&Harddrive overheats (HDD Info)",IDC_CHECK_HDDOVERHEAT,
- "Button",BS_AUTOCHECKBOX | WS_DISABLED | WS_TABSTOP,12,
- 172,182,10
+ "Button",BS_AUTOCHECKBOX | WS_DISABLED | WS_TABSTOP,12,163,273,10
END
IDD_SETTINGS DIALOGEX 0, 0, 239, 286
-STYLE DS_MODALFRAME | DS_SETFOREGROUND | DS_FIXEDSYS | DS_CENTER |
- WS_VISIBLE | WS_CAPTION | WS_SYSMENU
+STYLE DS_SETFONT | DS_MODALFRAME | DS_SETFOREGROUND | DS_FIXEDSYS | DS_CENTER | WS_VISIBLE | WS_CAPTION | WS_SYSMENU
CAPTION "Automatic Shutdown"
-FONT 8, "MS Shell Dlg"
+FONT 8, "MS Shell Dlg", 0, 0, 0x1
BEGIN
LTEXT "",IDC_RECT_HEADER,0,0,243,25,NOT WS_GROUP
- ICON "",IDC_ICON_HEADER,7,3,20,20,SS_CENTERIMAGE | WS_GROUP,
- WS_EX_TRANSPARENT
- LTEXT "Automatic Shutdown",IDC_TEXT_HEADER,34,4,201,8,
- SS_NOPREFIX,WS_EX_TRANSPARENT
- LTEXT "Select the automatic shutdown event",
- IDC_TEXT_HEADERDESC,43,12,192,8,SS_NOPREFIX,
- WS_EX_TRANSPARENT
+ ICON "",IDC_ICON_HEADER,7,3,20,20,SS_CENTERIMAGE | WS_GROUP,WS_EX_TRANSPARENT
+ LTEXT "Automatic Shutdown",IDC_TEXT_HEADER,34,4,201,8,SS_NOPREFIX,WS_EX_TRANSPARENT
+ LTEXT "Select the automatic shutdown event",IDC_TEXT_HEADERDESC,43,12,192,8,SS_NOPREFIX,WS_EX_TRANSPARENT
CONTROL "",IDC_STATIC,"Static",SS_ETCHEDHORZ,0,25,243,1
CONTROL "Shutdown at &specific time",IDC_CHECK_SPECIFICTIME,
- "Button",BS_AUTOCHECKBOX | WS_GROUP | WS_TABSTOP,13,35,
- 212,10
- CONTROL "Shutdown a&t:",IDC_RADIO_STTIME,"Button",
- BS_AUTORADIOBUTTON | WS_TABSTOP,25,49,68,8
- CONTROL "",IDC_TIME_TIMESTAMP,"SysDateTimePick32",DTS_UPDOWN |
- WS_TABSTOP | 0x8,95,47,62,13
- CONTROL "",IDC_DATE_TIMESTAMP,"SysDateTimePick32",WS_TABSTOP,159,
- 47,66,13
- CONTROL "Shutdown i&n:",IDC_RADIO_STCOUNTDOWN,"Button",
- BS_AUTORADIOBUTTON | WS_TABSTOP,25,64,68,8
- EDITTEXT IDC_EDIT_COUNTDOWN,95,62,62,13,ES_AUTOHSCROLL |
- ES_NUMBER
- CONTROL "",IDC_SPIN_COUNTDOWN,"msctls_updown32",UDS_WRAP |
- UDS_SETBUDDYINT | UDS_ALIGNRIGHT | UDS_AUTOBUDDY |
- UDS_ARROWKEYS | UDS_NOTHOUSANDS | UDS_HOTTRACK,146,62,12,
- 14
- COMBOBOX IDC_COMBO_COUNTDOWNUNIT,159,62,66,114,CBS_DROPDOWNLIST |
- WS_VSCROLL | WS_TABSTOP
- CONTROL "Shutdown when a &message is received containing the following text:",
- IDC_CHECK_MESSAGE,"Button",BS_AUTOCHECKBOX | BS_TOP |
- BS_MULTILINE | WS_GROUP | WS_TABSTOP,13,78,211,18
- EDITTEXT IDC_EDIT_MESSAGE,25,96,199,21,ES_MULTILINE |
- ES_AUTOVSCROLL | ES_WANTRETURN | WS_VSCROLL
+ "Button",BS_AUTOCHECKBOX | WS_GROUP | WS_TABSTOP,13,35,212,10
+ CONTROL "Shutdown a&t:",IDC_RADIO_STTIME,"Button",BS_AUTORADIOBUTTON | WS_TABSTOP,25,49,68,8
+ CONTROL "",IDC_TIME_TIMESTAMP,"SysDateTimePick32",DTS_UPDOWN | WS_TABSTOP | 0x8,95,47,62,13
+ CONTROL "",IDC_DATE_TIMESTAMP,"SysDateTimePick32",WS_TABSTOP,159,47,66,13
+ CONTROL "Shutdown i&n:",IDC_RADIO_STCOUNTDOWN,"Button",BS_AUTORADIOBUTTON | WS_TABSTOP,25,64,68,8
+ EDITTEXT IDC_EDIT_COUNTDOWN,95,62,62,13,ES_AUTOHSCROLL | ES_NUMBER
+ CONTROL "",IDC_SPIN_COUNTDOWN,"msctls_updown32",UDS_WRAP | UDS_SETBUDDYINT | UDS_ALIGNRIGHT | UDS_AUTOBUDDY | UDS_ARROWKEYS | UDS_NOTHOUSANDS | UDS_HOTTRACK,146,62,12,14
+ COMBOBOX IDC_COMBO_COUNTDOWNUNIT,159,62,66,114,CBS_DROPDOWNLIST | WS_VSCROLL | WS_TABSTOP
+ CONTROL "Shutdown when a &message is received containing the following text:",IDC_CHECK_MESSAGE,
+ "Button",BS_AUTOCHECKBOX | BS_TOP | BS_MULTILINE | WS_GROUP | WS_TABSTOP,13,78,211,18
+ EDITTEXT IDC_EDIT_MESSAGE,25,96,199,21,ES_MULTILINE | ES_AUTOVSCROLL | ES_WANTRETURN | WS_VSCROLL
CONTROL "Shutdown when Miranda NG becomes &idle",IDC_CHECK_IDLE,
- "Button",BS_AUTOCHECKBOX | BS_TOP | BS_MULTILINE |
- WS_GROUP | WS_TABSTOP,13,123,164,9
- CONTROL "Configure",IDC_URL_IDLE,"Hyperlink",WS_TABSTOP,179,124,
- 46,9
- CONTROL "Shutdown when &prozessor usage drops below:",
- IDC_CHECK_CPUUSAGE,"Button",BS_AUTOCHECKBOX | BS_TOP |
- BS_MULTILINE | WS_GROUP | WS_TABSTOP,13,139,159,22
- EDITTEXT IDC_EDIT_CPUUSAGE,179,140,32,13,ES_AUTOHSCROLL |
- ES_NUMBER
- CONTROL "",IDC_SPIN_CPUUSAGE,"msctls_updown32",UDS_SETBUDDYINT |
- UDS_ALIGNRIGHT | UDS_AUTOBUDDY | UDS_ARROWKEYS |
- UDS_NOTHOUSANDS | UDS_HOTTRACK,205,140,11,14
- LTEXT "%",IDC_TEXT_PERCENT,215,140,15,13,SS_NOPREFIX |
- SS_CENTERIMAGE | NOT WS_GROUP
- LTEXT "(current: 0%)",IDC_TEXT_CURRENTCPU,179,154,60,8,
- SS_NOPREFIX | NOT WS_GROUP
- CONTROL "Shutdown when all contacts are &offline",
- IDC_CHECK_STATUS,"Button",BS_AUTOCHECKBOX | BS_TOP |
- WS_GROUP | WS_TABSTOP,13,162,211,9
- CONTROL "Shutdown when all &file transfers are finished",
- IDC_CHECK_FILETRANSFER,"Button",BS_AUTOCHECKBOX | BS_TOP |
- WS_GROUP | WS_TABSTOP,13,177,211,10
+ "Button",BS_AUTOCHECKBOX | BS_TOP | BS_MULTILINE | WS_GROUP | WS_TABSTOP,13,123,164,9
+ CONTROL "Configure",IDC_URL_IDLE,"Hyperlink",WS_TABSTOP,179,124,46,9
+ CONTROL "Shutdown when &prozessor usage drops below:",IDC_CHECK_CPUUSAGE,
+ "Button",BS_AUTOCHECKBOX | BS_TOP | BS_MULTILINE | WS_GROUP | WS_TABSTOP,13,139,159,22
+ EDITTEXT IDC_EDIT_CPUUSAGE,179,140,32,13,ES_AUTOHSCROLL | ES_NUMBER
+ CONTROL "",IDC_SPIN_CPUUSAGE,"msctls_updown32",UDS_SETBUDDYINT | UDS_ALIGNRIGHT | UDS_AUTOBUDDY | UDS_ARROWKEYS | UDS_NOTHOUSANDS | UDS_HOTTRACK,205,140,11,14
+ LTEXT "%",IDC_TEXT_PERCENT,215,140,15,13,SS_NOPREFIX | SS_CENTERIMAGE | NOT WS_GROUP
+ LTEXT "(current: 0%)",IDC_TEXT_CURRENTCPU,179,154,60,8,SS_NOPREFIX | NOT WS_GROUP
+ CONTROL "Shutdown when all contacts are &offline",IDC_CHECK_STATUS,
+ "Button",BS_AUTOCHECKBOX | BS_TOP | WS_GROUP | WS_TABSTOP,13,162,211,9
+ CONTROL "Shutdown when all &file transfers are finished",IDC_CHECK_FILETRANSFER,
+ "Button",BS_AUTOCHECKBOX | BS_TOP | WS_GROUP | WS_TABSTOP,13,177,211,10
LTEXT "&Action:",IDC_STATIC,15,199,209,8
- COMBOBOX IDC_COMBO_SHUTDOWNTYPE,14,209,210,103,CBS_DROPDOWNLIST |
- WS_VSCROLL | WS_TABSTOP
+ COMBOBOX IDC_COMBO_SHUTDOWNTYPE,14,209,210,103,CBS_DROPDOWNLIST | WS_VSCROLL | WS_TABSTOP
LTEXT "",IDC_TEXT_SHUTDOWNTYPE,15,225,208,25,NOT WS_GROUP
CONTROL "",IDC_STATIC,"Static",SS_ETCHEDHORZ,0,258,245,1
DEFPUSHBUTTON "OK",IDOK,123,266,50,14,WS_GROUP
@@ -160,22 +119,15 @@ BEGIN
END
IDD_SHUTDOWNNOW DIALOGEX 0, 0, 204, 98
-STYLE DS_MODALFRAME | DS_NOIDLEMSG | DS_SETFOREGROUND | DS_FIXEDSYS |
- DS_NOFAILCREATE | DS_CENTER | WS_POPUP | WS_VISIBLE | WS_CAPTION |
- WS_SYSMENU
+STYLE DS_SETFONT | DS_MODALFRAME | DS_NOIDLEMSG | DS_SETFOREGROUND | DS_FIXEDSYS | DS_NOFAILCREATE | DS_CENTER | WS_POPUP | WS_VISIBLE | WS_CAPTION | WS_SYSMENU
EXSTYLE WS_EX_TOPMOST
CAPTION "Automatic Shutdown"
-FONT 8, "MS Shell Dlg"
+FONT 8, "MS Shell Dlg", 0, 0, 0x1
BEGIN
- ICON "",IDC_ICON_HEADER,6,7,20,20,SS_CENTERIMAGE | WS_GROUP,
- WS_EX_TRANSPARENT
- LTEXT "",IDC_TEXT_HEADER,34,8,162,18,SS_NOPREFIX | NOT
- WS_GROUP
- LTEXT "Unsaved data in open applications except Miranda NG might get lost.",
- IDC_TEXT_UNSAVEDWARNING,33,31,161,17,SS_NOPREFIX | NOT
- WS_VISIBLE
- LTEXT "Please click ""Cancel"" if you would like to abort the process.",
- IDC_STATIC,33,49,161,17,SS_NOPREFIX
+ ICON "",IDC_ICON_HEADER,6,7,20,20,SS_CENTERIMAGE | WS_GROUP,WS_EX_TRANSPARENT
+ LTEXT "",IDC_TEXT_HEADER,34,8,162,18,SS_NOPREFIX | NOT WS_GROUP
+ LTEXT "Unsaved data in open applications except Miranda NG might get lost.",IDC_TEXT_UNSAVEDWARNING,33,31,161,17,SS_NOPREFIX | NOT WS_VISIBLE
+ LTEXT "Please click ""Cancel"" if you would like to abort the process.",IDC_STATIC,33,49,161,17,SS_NOPREFIX
PUSHBUTTON "&Now!",IDC_BUTTON_SHUTDOWNNOW,32,75,67,14,WS_GROUP
DEFPUSHBUTTON "Cancel",IDCANCEL,103,75,68,14
END
@@ -191,10 +143,11 @@ GUIDELINES DESIGNINFO
BEGIN
IDD_OPT_SHUTDOWN, DIALOG
BEGIN
+ RIGHTMARGIN, 299
VERTGUIDE, 3
VERTGUIDE, 12
- VERTGUIDE, 194
- VERTGUIDE, 199
+ VERTGUIDE, 285
+ VERTGUIDE, 292
HORZGUIDE, 27
HORZGUIDE, 39
END
@@ -231,10 +184,10 @@ END
// Icon with lowest ID value placed first to ensure application icon
// remains consistent on all systems.
-IDI_ACTIVE ICON "active.ico"
-IDI_HEADER ICON "header.ico"
-IDI_INACTIVE ICON "inactive.ico"
-#endif // Englisch (GB) resources
+IDI_ACTIVE ICON "active.ico"
+IDI_HEADER ICON "header.ico"
+IDI_INACTIVE ICON "inactive.ico"
+#endif // English (United Kingdom) resources
/////////////////////////////////////////////////////////////////////////////
@@ -245,6 +198,7 @@ IDI_INACTIVE ICON "inactive.ico"
// Generated from the TEXTINCLUDE 3 resource.
//
+
/////////////////////////////////////////////////////////////////////////////
#endif // not APSTUDIO_INVOKED
diff --git a/plugins/AutoShutdown/shutdown_10.vcxproj b/plugins/AutoShutdown/shutdown_10.vcxproj
index 13be234c5e..6a1772d787 100644
--- a/plugins/AutoShutdown/shutdown_10.vcxproj
+++ b/plugins/AutoShutdown/shutdown_10.vcxproj
@@ -220,6 +220,11 @@
<ResourceCompile Include="res\resource.rc" />
<ResourceCompile Include="res\version.rc" />
</ItemGroup>
+ <ItemGroup>
+ <None Include="res\active.ico" />
+ <None Include="res\header.ico" />
+ <None Include="res\inactive.ico" />
+ </ItemGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
<ImportGroup Label="ExtensionTargets">
</ImportGroup>
diff --git a/plugins/AutoShutdown/shutdown_10.vcxproj.filters b/plugins/AutoShutdown/shutdown_10.vcxproj.filters
index 645304991a..ed72cb55b5 100644
--- a/plugins/AutoShutdown/shutdown_10.vcxproj.filters
+++ b/plugins/AutoShutdown/shutdown_10.vcxproj.filters
@@ -83,4 +83,15 @@
<Filter>Resource Files</Filter>
</ResourceCompile>
</ItemGroup>
+ <ItemGroup>
+ <None Include="res\active.ico">
+ <Filter>Resource Files</Filter>
+ </None>
+ <None Include="res\header.ico">
+ <Filter>Resource Files</Filter>
+ </None>
+ <None Include="res\inactive.ico">
+ <Filter>Resource Files</Filter>
+ </None>
+ </ItemGroup>
</Project> \ No newline at end of file
diff --git a/plugins/AutoShutdown/src/frame.cpp b/plugins/AutoShutdown/src/frame.cpp
index 20662698a5..30c356812e 100644
--- a/plugins/AutoShutdown/src/frame.cpp
+++ b/plugins/AutoShutdown/src/frame.cpp
@@ -227,15 +227,14 @@ static LRESULT CALLBACK FrameWndProc(HWND hwndFrame,UINT msg,WPARAM wParam,LPARA
return 0;
}
case WM_DESTROY:
- { HICON hIcon;
+ {
if(dat==NULL) return 0;
UnhookEvent(dat->hHookColorsChanged);
UnhookEvent(dat->hHookFontsChanged);
UnhookEvent(dat->hHookIconsChanged);
/* other childs are destroyed automatically */
if(dat->hwndToolTip!=NULL) DestroyWindow(dat->hwndToolTip);
- hIcon=(HICON)SendMessage(dat->hwndIcon,STM_SETIMAGE,IMAGE_ICON,0);
- Skin_ReleaseIcon(hIcon); /* does NULL check */
+ HICON hIcon=(HICON)SendMessage(dat->hwndIcon,STM_SETIMAGE,IMAGE_ICON,0);
break;
}
case WM_NCDESTROY:
@@ -246,14 +245,14 @@ static LRESULT CALLBACK FrameWndProc(HWND hwndFrame,UINT msg,WPARAM wParam,LPARA
SetWindowLongPtr(hwndFrame, GWLP_USERDATA, (LONG)NULL);
break;
case WM_SIZE:
- { RECT rc;
+ {
+ RECT rc;
LONG width,height;
- HDWP hdwp;
UINT defflg=SWP_NOZORDER|SWP_NOOWNERZORDER|SWP_NOACTIVATE;
SetRect(&rc,0,0,LOWORD(lParam),HIWORD(lParam)); /* width,height */
/* workaround: reduce flickering of frame in clist */
InvalidateRect(hwndFrame,&rc,FALSE);
- hdwp=BeginDeferWindowPos(3);
+ HDWP hdwp=BeginDeferWindowPos(3);
/* progress */
width=rc.right-GetSystemMetrics(SM_CXICON)-10;
height=rc.bottom-(GetSystemMetrics(SM_CYICON)/2)-5;
@@ -267,7 +266,8 @@ static LRESULT CALLBACK FrameWndProc(HWND hwndFrame,UINT msg,WPARAM wParam,LPARA
return 0;
}
case M_REFRESH_COLORS:
- { COLORREF clrBar;
+ {
+ COLORREF clrBar;
if(FontService_GetColor(_T("Automatic Shutdown"),_T("Progress Bar"),&clrBar))
clrBar=GetDefaultColor(FRAMEELEMENT_BAR);
if(FontService_GetColor(_T("Automatic Shutdown"),_T("Background"),&dat->clrBackground))
@@ -280,13 +280,10 @@ static LRESULT CALLBACK FrameWndProc(HWND hwndFrame,UINT msg,WPARAM wParam,LPARA
return 0;
}
case M_REFRESH_ICONS:
- if(dat->hwndIcon!=NULL)
- Skin_ReleaseIcon((HICON)SendMessage(dat->hwndIcon,STM_SETIMAGE,IMAGE_ICON,(LPARAM)Skin_GetIcon("AutoShutdown_Header")));
- if(hFrame) /* refresh frame title icon */
- Skin_ReleaseIcon(SetFrameTitleIcon(hFrame,Skin_GetIcon("AutoShutdown_Active")));
return 0;
case M_REFRESH_FONTS:
- { LOGFONT lf;
+ {
+ LOGFONT lf;
if(!FontService_GetFont(_T("Automatic Shutdown"),_T("Countdown on Frame"),&dat->clrText,&lf)) {
if(dat->hFont!=NULL) DeleteObject(dat->hFont);
dat->hFont=CreateFontIndirect(&lf);
@@ -568,7 +565,6 @@ void CloseCountdownFrame(void)
if(hwndCountdownFrame!=NULL) {
SendMessage(hwndCountdownFrame,M_CLOSE_COUNTDOWN,0,0);
if(hFrame) {
- 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/main.cpp b/plugins/AutoShutdown/src/main.cpp
index da5450c630..636fc3e0fd 100644
--- a/plugins/AutoShutdown/src/main.cpp
+++ b/plugins/AutoShutdown/src/main.cpp
@@ -50,10 +50,15 @@ BOOL WINAPI DllMain(HINSTANCE hinstDLL, DWORD fdwReason, VOID *pReserved)
return TRUE;
}
-static int ShutdownModulesLoaded(WPARAM wParam,LPARAM lParam)
+static int ShutdownModulesLoaded(WPARAM,LPARAM)
{
if ( ServiceExists("DBEditorpp/RegisterSingleModule"))
CallService("DBEditorpp/RegisterSingleModule",(WPARAM)"AutoShutdown",0);
+
+ /* Toolbar Item */
+ HookEvent(ME_TTB_MODULELOADED,ToolbarLoaded); /* no service to check for */
+
+ WatcherModulesLoaded();
return 0;
}
diff --git a/plugins/AutoShutdown/src/resource.h b/plugins/AutoShutdown/src/resource.h
index 4d8370f00a..f379eb3aab 100644
--- a/plugins/AutoShutdown/src/resource.h
+++ b/plugins/AutoShutdown/src/resource.h
@@ -1,6 +1,6 @@
//{{NO_DEPENDENCIES}}
-// Microsoft Developer Studio generated include file.
-// Used by resource.rc
+// Microsoft Visual C++ generated include file.
+// Used by ..\res\resource.rc
//
#define IDI_ACTIVE 101
#define IDI_INACTIVE 102
diff --git a/plugins/AutoShutdown/src/settingsdlg.cpp b/plugins/AutoShutdown/src/settingsdlg.cpp
index 601922f0ec..6e527eac22 100644
--- a/plugins/AutoShutdown/src/settingsdlg.cpp
+++ b/plugins/AutoShutdown/src/settingsdlg.cpp
@@ -28,6 +28,9 @@ static HANDLE hServiceShowDlg;
static HWND hwndSettingsDlg;
extern HINSTANCE hInst;
+const DWORD unitValues[]={1,60,60*60,60*60*24,60*60*24*7,60*60*24*31};
+const TCHAR *unitNames[]={LPGENT("Second(s)"), LPGENT("Minute(s)"), LPGENT("Hour(s)"), LPGENT("Day(s)"), LPGENT("Week(s)"), LPGENT("Month(s)")};
+
/************************* Dialog *************************************/
static void EnableDlgItem(HWND hwndDlg,int idCtrl,BOOL fEnable)
@@ -39,23 +42,23 @@ static void EnableDlgItem(HWND hwndDlg,int idCtrl,BOOL fEnable)
static BOOL CALLBACK DisplayCpuUsageProc(BYTE nCpuUsage,LPARAM lParam)
{
- TCHAR str[64];
/* dialog closed? */
if(!IsWindow((HWND)lParam)) return FALSE; /* stop poll thread */
+ TCHAR str[64];
mir_sntprintf(str,SIZEOF(str),TranslateT("(current: %u%%)"),nCpuUsage);
SetWindowText((HWND)lParam,str);
return TRUE;
}
-static BOOL AnyProtoHasCaps(DWORD caps1)
+static bool AnyProtoHasCaps(DWORD caps1)
{
- int nProtoCount,i;
+ int nProtoCount;
PROTOACCOUNT **protos;
if(!ProtoEnumAccounts(&nProtoCount, &protos))
- for(i=0;i<nProtoCount;++i)
+ for(int i=0;i<nProtoCount;++i)
if(CallProtoService(protos[i]->szModuleName,PS_GETCAPS,(WPARAM)PFLAGNUM_1,0)&caps1)
- return TRUE; /* CALLSERVICE_NOTFOUND also handled gracefully */
- return FALSE;
+ return true; /* CALLSERVICE_NOTFOUND also handled gracefully */
+ return false;
}
#define M_ENABLE_SUBCTLS (WM_APP+111)
@@ -82,8 +85,7 @@ static INT_PTR CALLBACK SettingsDlgProc(HWND hwndDlg,UINT msg,WPARAM wParam,LPAR
}
/* read-in watcher flags */
{
- WORD watcherType;
- watcherType=db_get_w(NULL,"AutoShutdown","WatcherFlags",SETTING_WATCHERFLAGS_DEFAULT);
+ WORD watcherType=db_get_w(NULL,"AutoShutdown","WatcherFlags",SETTING_WATCHERFLAGS_DEFAULT);
CheckRadioButton(hwndDlg,IDC_RADIO_STTIME,IDC_RADIO_STCOUNTDOWN,(watcherType&SDWTF_ST_TIME)?IDC_RADIO_STTIME:IDC_RADIO_STCOUNTDOWN);
CheckDlgButton(hwndDlg,IDC_CHECK_SPECIFICTIME,(watcherType&SDWTF_SPECIFICTIME)!=0);
CheckDlgButton(hwndDlg,IDC_CHECK_MESSAGE,(watcherType&SDWTF_MESSAGE)!=0);
@@ -102,8 +104,7 @@ static INT_PTR CALLBACK SettingsDlgProc(HWND hwndDlg,UINT msg,WPARAM wParam,LPAR
SendMessage(hwndDlg,M_CHECK_DATETIME,0,0);
}
{
- DWORD setting;
- setting=db_get_dw(NULL,"AutoShutdown","Countdown",SETTING_COUNTDOWN_DEFAULT);
+ DWORD setting=db_get_dw(NULL,"AutoShutdown","Countdown",SETTING_COUNTDOWN_DEFAULT);
if(setting<1) setting=SETTING_COUNTDOWN_DEFAULT;
SendDlgItemMessage(hwndDlg,IDC_SPIN_COUNTDOWN,UDM_SETRANGE,0,MAKELPARAM(UD_MAXVAL,1));
SendDlgItemMessage(hwndDlg,IDC_EDIT_COUNTDOWN,EM_SETLIMITTEXT,(WPARAM)10,0);
@@ -111,18 +112,12 @@ static INT_PTR CALLBACK SettingsDlgProc(HWND hwndDlg,UINT msg,WPARAM wParam,LPAR
SetDlgItemInt(hwndDlg,IDC_EDIT_COUNTDOWN,setting,FALSE);
}
{
- HWND hwndCombo;
- DWORD lastUnit;
- int i,index;
- const DWORD unitValues[]={1,60,60*60,60*60*24,60*60*24*7,60*60*24*31};
- const TCHAR *unitNames[]={TranslateT("Second(s)"), TranslateT("Minute(s)"), TranslateT("Hour(s)"),
- TranslateT("Day(s)"), TranslateT("Week(s)"), TranslateT("Month(s)")};
- hwndCombo=GetDlgItem(hwndDlg,IDC_COMBO_COUNTDOWNUNIT);
- lastUnit=db_get_dw(NULL,"AutoShutdown","CountdownUnit",SETTING_COUNTDOWNUNIT_DEFAULT);
+ HWND hwndCombo=GetDlgItem(hwndDlg,IDC_COMBO_COUNTDOWNUNIT);
+ DWORD lastUnit=db_get_dw(NULL,"AutoShutdown","CountdownUnit",SETTING_COUNTDOWNUNIT_DEFAULT);
SendMessage(hwndCombo,CB_SETLOCALE,(WPARAM)locale,0); /* sort order */
SendMessage(hwndCombo,CB_INITSTORAGE,SIZEOF(unitNames),SIZEOF(unitNames)*16); /* approx. */
- for(i=0;i<SIZEOF(unitNames);++i) {
- index=SendMessage(hwndCombo,CB_ADDSTRING,0,(LPARAM)TranslateTS(unitNames[i]));
+ for(int i=0;i<SIZEOF(unitNames);++i) {
+ int index=SendMessage(hwndCombo,CB_ADDSTRING,0,(LPARAM)TranslateTS(unitNames[i]));
if(index!=LB_ERR) {
SendMessage(hwndCombo,CB_SETITEMDATA,index,(LPARAM)unitValues[i]);
if(i==0 || unitValues[i]==lastUnit) SendMessage(hwndCombo,CB_SETCURSEL,index,0);
@@ -140,8 +135,7 @@ static INT_PTR CALLBACK SettingsDlgProc(HWND hwndDlg,UINT msg,WPARAM wParam,LPAR
}
/* cpuusage threshold */
{
- BYTE setting;
- setting=DBGetContactSettingRangedByte(NULL,"AutoShutdown","CpuUsageThreshold",SETTING_CPUUSAGETHRESHOLD_DEFAULT,1,100);
+ BYTE setting=DBGetContactSettingRangedByte(NULL,"AutoShutdown","CpuUsageThreshold",SETTING_CPUUSAGETHRESHOLD_DEFAULT,1,100);
SendDlgItemMessage(hwndDlg,IDC_SPIN_CPUUSAGE,UDM_SETRANGE,0,MAKELPARAM(100,1));
SendDlgItemMessage(hwndDlg,IDC_EDIT_CPUUSAGE,EM_SETLIMITTEXT,(WPARAM)3,0);
SendDlgItemMessage(hwndDlg,IDC_SPIN_CPUUSAGE,UDM_SETPOS,0,MAKELPARAM(setting,0));
@@ -191,7 +185,6 @@ 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_");
HICON hIcon=(HICON)SendDlgItemMessage(hwndDlg,IDC_ICON_HEADER,STM_SETIMAGE,IMAGE_ICON,0);
- Skin_ReleaseIcon(hIcon); /* does NULL check */
HFONT hFont=(HFONT)SendDlgItemMessage(hwndDlg,IDC_TEXT_HEADER,WM_GETFONT,0,0);
SendDlgItemMessage(hwndDlg,IDC_TEXT_HEADER,WM_SETFONT,0,FALSE); /* no return value */
if(hFont!=NULL) DeleteObject(hFont);
@@ -323,8 +316,7 @@ static INT_PTR CALLBACK SettingsDlgProc(HWND hwndDlg,UINT msg,WPARAM wParam,LPAR
case IDC_EDIT_CPUUSAGE:
if(HIWORD(wParam)==EN_KILLFOCUS) {
- WORD val;
- val=(WORD)GetDlgItemInt(hwndDlg,IDC_EDIT_CPUUSAGE,NULL,FALSE);
+ WORD val=(WORD)GetDlgItemInt(hwndDlg,IDC_EDIT_CPUUSAGE,NULL,FALSE);
if(val<1) val=1;
else if(val>100) val=100;
SendDlgItemMessage(hwndDlg,IDC_SPIN_CPUUSAGE,UDM_SETPOS,0,MAKELPARAM(val,0));
@@ -392,9 +384,13 @@ static INT_PTR CALLBACK SettingsDlgProc(HWND hwndDlg,UINT msg,WPARAM wParam,LPAR
db_set_w(NULL,"AutoShutdown","WatcherFlags",watcherType);
ServiceStartWatcher(0,watcherType);
}
+ DestroyWindow(hwndDlg);
+ return TRUE;
/* fall through */
case IDCANCEL: /* WM_CLOSE */
DestroyWindow(hwndDlg);
+ SetShutdownToolbarButton(false);
+ SetShutdownMenuItem(false);
return TRUE;
}
break;
@@ -418,39 +414,45 @@ static INT_PTR ServiceShowSettingsDialog(WPARAM wParam,LPARAM lParam)
static HANDLE hToolbarButton;
-static int ToolbarLoaded(WPARAM wParam,LPARAM lParam)
+int ToolbarLoaded(WPARAM,LPARAM)
{
TTBButton ttb = { sizeof(ttb) };
- ttb.hIconHandleUp = iconList[1].hIcolib;
- ttb.hIconHandleDn = iconList[2].hIcolib;
+ ttb.hIconHandleUp = iconList[2].hIcolib;
+ ttb.hIconHandleDn = iconList[1].hIcolib;
ttb.pszService = "AutoShutdown/MenuCommand";
- ttb.dwFlags = TTBBF_VISIBLE | TTBBF_SHOWTOOLTIP;
+ ttb.dwFlags = TTBBF_VISIBLE | TTBBF_SHOWTOOLTIP | TTBBF_ASPUSHBUTTON;
ttb.name = LPGEN("Start/Stop automatic shutdown");
- ttb.pszTooltipUp = LPGEN("Stop automatic shutdown");
- ttb.pszTooltipDn = LPGEN("Start automatic shutdown");
+ ttb.pszTooltipUp = LPGEN("Start automatic shutdown");
+ ttb.pszTooltipDn = LPGEN("Stop automatic shutdown");
hToolbarButton = TopToolbar_AddButton(&ttb);
return 0;
}
-void SetShutdownToolbarButton(BOOL fActive)
+void SetShutdownToolbarButton(bool fActive)
{
- if(hToolbarButton) {
+ if(hToolbarButton)
CallService(MS_TTB_SETBUTTONSTATE, (WPARAM)hToolbarButton,fActive?TTBST_PUSHED:TTBST_RELEASED);
- CallService(MS_TTB_SETBUTTONOPTIONS,MAKEWPARAM(TTBO_TIPNAME,hToolbarButton),(LPARAM)(fActive?Translate("Stop automatic shutdown"):Translate("Start automatic shutdown")));
- }
}
/************************* Menu Item **********************************/
static HGENMENU hMainMenuItem,hTrayMenuItem;
-void SetShutdownMenuItem(BOOL fActive)
+void SetShutdownMenuItem(bool fActive)
{
/* main menu */
CLISTMENUITEM mi = { sizeof(mi) };
mi.position = 2001090000;
- mi.icolibItem = fActive ? iconList[1].hIcolib : iconList[2].hIcolib;
- mi.ptszName = fActive ? LPGENT("Stop automatic &shutdown") : LPGENT("Automatic &shutdown..."); /* autotranslated */
+ if(fActive)
+ {
+ mi.icolibItem = iconList[1].hIcolib;
+ mi.ptszName = LPGENT("Stop automatic &shutdown");
+ }
+ else
+ {
+ mi.icolibItem = iconList[2].hIcolib;
+ mi.ptszName = LPGENT("Automatic &shutdown...");
+ }
mi.pszService = "AutoShutdown/MenuCommand";
mi.flags = CMIF_TCHAR;
if (hMainMenuItem != NULL) {
@@ -466,11 +468,9 @@ void SetShutdownMenuItem(BOOL fActive)
Menu_ModifyItem(hTrayMenuItem, &mi);
}
else hTrayMenuItem = Menu_AddTrayMenuItem(&mi);
-
- Skin_ReleaseIcon(mi.hIcon);
}
-static INT_PTR MenuItemCommand(WPARAM wParam,LPARAM lParam)
+static INT_PTR MenuItemCommand(WPARAM,LPARAM)
{
/* toggle between StopWatcher and ShowSettingsDdialog */
if(ServiceIsWatcherEnabled(0,0))
@@ -487,9 +487,7 @@ void InitSettingsDlg(void)
/* Menu Item */
hServiceMenuCommand = CreateServiceFunction("AutoShutdown/MenuCommand", MenuItemCommand);
hMainMenuItem=hTrayMenuItem=NULL;
- SetShutdownMenuItem(FALSE);
- /* Toolbar Item */
- HookEvent(ME_TTB_MODULELOADED,ToolbarLoaded); /* no service to check for */
+ SetShutdownMenuItem(false);
/* Hotkey */
AddHotkey();
/* Services */
diff --git a/plugins/AutoShutdown/src/settingsdlg.h b/plugins/AutoShutdown/src/settingsdlg.h
index 2f7bf8ea84..87f9e6a9f9 100644
--- a/plugins/AutoShutdown/src/settingsdlg.h
+++ b/plugins/AutoShutdown/src/settingsdlg.h
@@ -20,11 +20,12 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/
/* Menu Item */
-void SetShutdownMenuItem(BOOL fActive);
+void SetShutdownMenuItem(bool fActive);
/* Toolbar Button */
-void SetShutdownToolbarButton(BOOL fActive);
+void SetShutdownToolbarButton(bool fActive);
/* Misc */
void InitSettingsDlg(void);
void UninitSettingsDlg(void);
+int ToolbarLoaded(WPARAM,LPARAM);
diff --git a/plugins/AutoShutdown/src/shutdownsvc.cpp b/plugins/AutoShutdown/src/shutdownsvc.cpp
index b5e57da955..a2d9f97078 100644
--- a/plugins/AutoShutdown/src/shutdownsvc.cpp
+++ b/plugins/AutoShutdown/src/shutdownsvc.cpp
@@ -30,6 +30,17 @@ static HANDLE hServiceShutdown,hServiceIsTypeEnabled,hServiceGetTypeDesc;
/************************* Utils **************************************/
+TCHAR *desc[]={LPGENT("Miranda NG is going to be automatically closed in %u second(s)."),
+ LPGENT("All Miranda NG protocols are going to be set to offline in %u second(s)."),
+ LPGENT("You will be logged off automatically in %u second(s)."),
+ LPGENT("The computer will automatically be restarted in %u second(s)."),
+ LPGENT("The computer will automatically be set to standby mode in %u second(s)."),
+ LPGENT("The computer will automatically be set to hibernate mode in %u second(s)."),
+ LPGENT("The workstation will automatically get locked in %u second(s)."),
+ LPGENT("All dialup connections will be closed in %u second(s)."),
+ LPGENT("The computer will automatically be shut down in %u second(s).")};
+
+
static BOOL WinNT_SetPrivilege(TCHAR *pszPrivName,BOOL bEnable)
{
BOOL bReturn=FALSE;
@@ -397,16 +408,14 @@ static INT_PTR CALLBACK ShutdownDlgProc(HWND hwndDlg,UINT msg,WPARAM wParam,LPAR
SendMessage(hwndDlg,WM_NEXTDLGCTL,(WPARAM)GetDlgItem(hwndDlg,IDCANCEL),TRUE);
return FALSE; /* focus set on cancel */
case WM_DESTROY:
- { HFONT hFont;
- HICON hIcon;
+ {
hwndShutdownDlg=NULL;
ShowWindow(hwndDlg,SW_HIDE);
/* 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,0);
- Skin_ReleaseIcon(hIcon); /* does NULL check */
- hFont=(HFONT)SendDlgItemMessage(hwndDlg,IDC_TEXT_HEADER,WM_GETFONT,0,0);
+ HICON hIcon=(HICON)SendDlgItemMessage(hwndDlg,IDC_ICON_HEADER,STM_SETIMAGE,IMAGE_ICON,0);
+ HFONT hFont=(HFONT)SendDlgItemMessage(hwndDlg,IDC_TEXT_HEADER,WM_GETFONT,0,0);
SendDlgItemMessage(hwndDlg,IDC_TEXT_HEADER,WM_SETFONT,0,FALSE); /* no return value */
if(hFont!=NULL) DeleteObject(hFont);
return TRUE;
@@ -439,16 +448,8 @@ static INT_PTR CALLBACK ShutdownDlgProc(HWND hwndDlg,UINT msg,WPARAM wParam,LPAR
PostMessage(hwndDlg,M_UPDATE_COUNTDOWN,0,countdown);
return TRUE;
case M_UPDATE_COUNTDOWN: /* lParam=(WORD)countdown */
- { TCHAR szText[256];
- TCHAR *desc[]={LPGENT("Miranda NG is going to be automatically closed in %u second(s)."),
- LPGENT("All Miranda NG protocols are going to be set to offline in %u second(s)."),
- LPGENT("You will be logged off automatically in %u second(s)."),
- LPGENT("The computer will automatically be restarted in %u second(s)."),
- LPGENT("The computer will automatically be set to standby mode in %u second(s)."),
- LPGENT("The computer will automatically be set to hibernate mode in %u second(s)."),
- LPGENT("The workstation will automatically get locked in %u second(s)."),
- LPGENT("All dialup connections will be closed in %u second(s)."),
- LPGENT("The computer will automatically be shut down in %u second(s).")};
+ {
+ TCHAR szText[256];
mir_sntprintf(szText,SIZEOF(szText),TranslateTS(desc[shutdownType-1]),lParam);
SetDlgItemText(hwndDlg,IDC_TEXT_HEADER,szText);
/* countdown finished */
@@ -509,7 +510,7 @@ INT_PTR ServiceShutdown(WPARAM wParam,LPARAM lParam)
return 0;
}
-INT_PTR ServiceIsTypeEnabled(WPARAM wParam,LPARAM lParam)
+INT_PTR ServiceIsTypeEnabled(WPARAM wParam,LPARAM)
{
return IsShutdownTypeEnabled((BYTE)wParam); /* does shutdownType range check */
}
diff --git a/plugins/AutoShutdown/src/watcher.cpp b/plugins/AutoShutdown/src/watcher.cpp
index a9d3ebb6d8..b4d9d89a05 100644
--- a/plugins/AutoShutdown/src/watcher.cpp
+++ b/plugins/AutoShutdown/src/watcher.cpp
@@ -166,7 +166,7 @@ static int ProtoAck(WPARAM wParam,LPARAM lParam)
/************************* Idle Shutdown ******************************/
-static int IdleChanged(WPARAM wParam,LPARAM lParam)
+static int IdleChanged(WPARAM,LPARAM lParam)
{
if(currentWatcherType&SDWTF_IDLE && lParam&IDF_ISIDLE)
ShutdownAndStopWatcher();
@@ -258,11 +258,19 @@ static int HddOverheat(WPARAM wParam,LPARAM lParam)
INT_PTR ServiceStartWatcher(WPARAM wParam,LPARAM lParam)
{
/* passing watcherType as lParam is only to be used internally, undocumented */
- if(lParam==0) lParam=(LPARAM)db_get_w(NULL,"AutoShutdown","WatcherFlags",0);
+ if(lParam==0)
+ lParam=(LPARAM)db_get_w(NULL,"AutoShutdown","WatcherFlags",0);
- if(!(lParam&SDWTF_MASK)) return 1; /* invalid flags or empty? */
- if(lParam&SDWTF_SPECIFICTIME && !(lParam&SDWTF_ST_MASK)) return 2; /* no specific time choice? */
- if(currentWatcherType==(WORD)lParam) return 3;
+ /* invalid flags or empty? */
+ if(!(lParam&SDWTF_MASK))
+ return 1;
+
+ /* no specific time choice? */
+ if(lParam&SDWTF_SPECIFICTIME && !(lParam&SDWTF_ST_MASK))
+ return 2;
+
+ if(currentWatcherType==(WORD)lParam)
+ return 3;
if(currentWatcherType!=0) {
/* Time Shutdown */
@@ -270,8 +278,8 @@ INT_PTR ServiceStartWatcher(WPARAM wParam,LPARAM lParam)
/* Cpu Shutdown */
idCpuUsageThread=0;
}
- SetShutdownMenuItem(TRUE);
- SetShutdownToolbarButton(TRUE);
+ SetShutdownMenuItem(true);
+ SetShutdownToolbarButton(true);
currentWatcherType=(WORD)lParam;
NotifyEventHooks(hEventWatcherChanged,TRUE,0);
@@ -290,7 +298,7 @@ INT_PTR ServiceStartWatcher(WPARAM wParam,LPARAM lParam)
return 0;
}
-INT_PTR ServiceStopWatcher(WPARAM wParam,LPARAM lParam)
+INT_PTR ServiceStopWatcher(WPARAM,LPARAM)
{
if(currentWatcherType==0) return 1;
@@ -307,14 +315,14 @@ INT_PTR ServiceStopWatcher(WPARAM wParam,LPARAM lParam)
return 0;
}
-INT_PTR ServiceIsWatcherEnabled(WPARAM wParam,LPARAM lParam)
+INT_PTR ServiceIsWatcherEnabled(WPARAM,LPARAM)
{
return currentWatcherType!=0;
}
/************************* Misc ***********************************/
-static int WatcherModulesLoaded(WPARAM wParam,LPARAM lParam)
+void WatcherModulesLoaded(void)
{
/* Weather Shutdown */
if(ServiceExists(MS_WEATHER_UPDATE))
@@ -328,7 +336,6 @@ static int WatcherModulesLoaded(WPARAM wParam,LPARAM lParam)
db_set_b(NULL,"AutoShutdown","RememberOnRestart",1);
ServiceStartWatcher(0,0); /* after modules loaded */
}
- return 0;
}
void InitWatcher(void)
@@ -354,8 +361,6 @@ void InitWatcher(void)
hServiceStartWatcher = CreateServiceFunction(MS_AUTOSHUTDOWN_STARTWATCHER, ServiceStartWatcher);
hServiceStopWatcher = CreateServiceFunction(MS_AUTOSHUTDOWN_STOPWATCHER, ServiceStopWatcher);
hServiceIsEnabled = CreateServiceFunction(MS_AUTOSHUTDOWN_ISWATCHERENABLED, ServiceIsWatcherEnabled);
- /* Misc */
- hHookModulesLoaded=HookEvent(ME_SYSTEM_MODULESLOADED,WatcherModulesLoaded);
}
void UninitWatcher(void)
diff --git a/plugins/AutoShutdown/src/watcher.h b/plugins/AutoShutdown/src/watcher.h
index 962378b811..157fc93bd1 100644
--- a/plugins/AutoShutdown/src/watcher.h
+++ b/plugins/AutoShutdown/src/watcher.h
@@ -27,3 +27,4 @@ INT_PTR ServiceIsWatcherEnabled(WPARAM wParam,LPARAM lParam);
/* Misc */
void InitWatcher(void);
void UninitWatcher(void);
+void WatcherModulesLoaded(void);