New !bang: !RainmeterQuit

This commit is contained in:
Kimmo Pekkola 2009-08-04 09:48:03 +00:00
parent 848cd361e3
commit e73d35e220
4 changed files with 26 additions and 2 deletions

View File

@ -668,6 +668,11 @@ void CMeterWindow::RunBang(BANGCOMMAND bang, const WCHAR* arg)
}
}
break;
case BANG_QUIT:
if (Rainmeter->GetDummyLitestep()) PostQuitMessage(0);
quitModule(Rainmeter->GetInstance());
break;
}
}

View File

@ -96,7 +96,8 @@ enum BANGCOMMAND
BANG_LSHOOK,
BANG_ABOUT,
BANG_MOVEMETER,
BANG_PLUGIN
BANG_PLUGIN,
BANG_QUIT
};
typedef struct

View File

@ -569,6 +569,17 @@ void RainmeterPluginBang(HWND, const char* arg)
BangWithArgs(BANG_PLUGIN, ConvertToWide(arg).c_str(), 1);
}
/*
** RainmeterQuit
**
** Callback for the !RainmeterQuit bang
**
*/
void RainmeterQuit(HWND, const char* arg)
{
BangWithArgs(BANG_QUIT, ConvertToWide(arg).c_str(), 0);
}
// -----------------------------------------------------------------------------------------------
//
// The class starts here
@ -879,6 +890,7 @@ int CRainmeter::Initialize(HWND Parent, HINSTANCE Instance, LPCSTR szPath)
AddBangCommand("!RainmeterResetStats", RainmeterResetStats);
AddBangCommand("!RainmeterMoveMeter", RainmeterMoveMeter);
AddBangCommand("!RainmeterPluginBang", RainmeterPluginBang);
AddBangCommand("!RainmeterQuit", RainmeterQuit);
}
// Create meter windows for active configs
@ -1135,6 +1147,7 @@ void CRainmeter::Quit(HINSTANCE dllInst)
RemoveBangCommand("!RainmeterResetStats");
RemoveBangCommand("!RainmeterMoveMeter");
RemoveBangCommand("!RainmeterPluginBang");
RemoveBangCommand("!RainmeterQuit");
}
}
@ -1289,7 +1302,7 @@ BOOL CRainmeter::ExecuteBang(const std::wstring& bang, const std::wstring& arg,
{
BangWithArgs(BANG_MOVE, arg.c_str(), 2);
}
else if (wcsicmp(bang.c_str(), L"!RainmeterChangeZPos") == 0) // For backwards combatibility
else if (wcsicmp(bang.c_str(), L"!RainmeterChangeZPos") == 0) // For backwards compatibility
{
BangWithArgs(BANG_ZPOS, arg.c_str(), 1);
}
@ -1317,6 +1330,10 @@ BOOL CRainmeter::ExecuteBang(const std::wstring& bang, const std::wstring& arg,
{
// Nothing to do here (this works only with Litestep)
}
else if (wcsicmp(bang.c_str(), L"!RainmeterQuit") == 0)
{
BangWithArgs(BANG_QUIT, arg.c_str(), 0);
}
else if (wcsicmp(bang.c_str(), L"!Execute") == 0)
{
// Special case for multibang execution

View File

@ -69,6 +69,7 @@ void RainmeterAbout(HWND, const char* arg);
void RainmeterResetStats(HWND, const char* arg);
void RainmeterMoveMeter(HWND, const char* arg);
void RainmeterPluginBang(HWND, const char* arg);
void RainmeterQuit(HWND, const char* arg);
void BangWithArgs(BANGCOMMAND bang, const WCHAR* arg, size_t numOfArgs);