summaryrefslogtreecommitdiff
path: root/plugins/StatusPlugins
diff options
context:
space:
mode:
Diffstat (limited to 'plugins/StatusPlugins')
-rw-r--r--plugins/StatusPlugins/AdvancedAutoAway/advancedautoaway.cpp216
-rw-r--r--plugins/StatusPlugins/AdvancedAutoAway/advancedautoaway.h72
-rw-r--r--plugins/StatusPlugins/AdvancedAutoAway/main.cpp8
-rw-r--r--plugins/StatusPlugins/AdvancedAutoAway/options.cpp499
-rw-r--r--plugins/StatusPlugins/AdvancedAutoAway/version.h50
-rw-r--r--plugins/StatusPlugins/resource.h2
-rw-r--r--plugins/StatusPlugins/resource.rc39
7 files changed, 437 insertions, 449 deletions
diff --git a/plugins/StatusPlugins/AdvancedAutoAway/advancedautoaway.cpp b/plugins/StatusPlugins/AdvancedAutoAway/advancedautoaway.cpp
index b3010317c5..297ec1d37c 100644
--- a/plugins/StatusPlugins/AdvancedAutoAway/advancedautoaway.cpp
+++ b/plugins/StatusPlugins/AdvancedAutoAway/advancedautoaway.cpp
@@ -37,7 +37,7 @@ int CompareSettings( const TAAAProtoSetting* p1, const TAAAProtoSetting* p2 )
return lstrcmpA( p1->szName, p2->szName );
}
-OBJLIST<TAAAProtoSetting> *autoAwaySettings;
+TAAAProtoSettingList autoAwaySettings(10, CompareSettings);
TAAAProtoSetting::TAAAProtoSetting( PROTOACCOUNT* pa )
{
@@ -99,7 +99,7 @@ extern char *StatusModeToDbSetting(int status,const char *suffix);
/////////////////////////////////////////////////////////////////////////////////////////
// Load from DB
-void LoadOptions( OBJLIST<TAAAProtoSetting>& loadSettings, BOOL override)
+void LoadOptions(TAAAProtoSettingList &loadSettings, BOOL override)
{
// if override is enabled, samesettings will be ignored (for options loading)
int monitorMiranda = FALSE; // use windows hooks?
@@ -138,17 +138,17 @@ void LoadOptions( OBJLIST<TAAAProtoSetting>& loadSettings, BOOL override)
hAutoAwayTimer = SetTimer(NULL,0, db_get_w(NULL, MODULENAME, SETTING_AWAYCHECKTIMEINSECS, 5)*1000,AutoAwayTimer);
}
-int LoadAutoAwaySetting(TAAAProtoSetting& autoAwaySetting, char* protoName)
+int LoadAutoAwaySetting(TAAAProtoSetting &autoAwaySetting, char* protoName)
{
char setting[128];
mir_snprintf(setting, sizeof(setting), "%s_OptionFlags", protoName);
- autoAwaySetting.optionFlags = db_get_b(NULL,MODULENAME,setting,FLAG_LV2ONINACTIVE|FLAG_RESET);
+ autoAwaySetting.optionFlags = db_get_w(NULL, MODULENAME, setting, FLAG_LV2ONINACTIVE | FLAG_RESET);
mir_snprintf(setting, sizeof(setting), "%s_AwayTime", protoName);
- autoAwaySetting.awayTime = db_get_w(NULL,MODULENAME,setting,SETTING_AWAYTIME_DEFAULT);
+ autoAwaySetting.awayTime = db_get_w(NULL, MODULENAME, setting, SETTING_AWAYTIME_DEFAULT);
mir_snprintf(setting, sizeof(setting), "%s_NATime", protoName);
- autoAwaySetting.naTime = db_get_w(NULL,MODULENAME,setting,SETTING_NATIME_DEFAULT);
+ autoAwaySetting.naTime = db_get_w(NULL, MODULENAME, setting, SETTING_NATIME_DEFAULT);
mir_snprintf(setting, sizeof(setting), "%s_StatusFlags", protoName);
- autoAwaySetting.statusFlags = db_get_w(NULL,MODULENAME,setting, StatusModeToProtoFlag(ID_STATUS_ONLINE)|StatusModeToProtoFlag(ID_STATUS_FREECHAT));
+ autoAwaySetting.statusFlags = db_get_w(NULL, MODULENAME, setting, StatusModeToProtoFlag(ID_STATUS_ONLINE) | StatusModeToProtoFlag(ID_STATUS_FREECHAT));
int flags;
if (db_get_b(NULL, MODULENAME, SETTING_SAMESETTINGS, 0))
@@ -165,21 +165,22 @@ int LoadAutoAwaySetting(TAAAProtoSetting& autoAwaySetting, char* protoName)
static int ProcessProtoAck(WPARAM wParam,LPARAM lParam)
{
- ACKDATA *ack = ( ACKDATA* )lParam;
- if ( ack->type != ACKTYPE_STATUS )
- return 0;
- if ( ack->result != ACKRESULT_SUCCESS )
+ ACKDATA *ack = (ACKDATA*)lParam;
+ if (ack->type != ACKTYPE_STATUS || ack->result != ACKRESULT_SUCCESS)
return 0;
+
log_debugA("ProcessProtoAck: ack->szModule: %s", ack->szModule);
- for ( int i=0; i < autoAwaySettings->getCount(); i++ ) {
- log_debugA("chk: %s", (*autoAwaySettings)[i].szName);
- if (!strcmp((*autoAwaySettings)[i].szName, ack->szModule)) {
- log_debugA("ack->szModule: %s (*autoAwaySettings)[i].statusChanged: %d", ack->szModule, (*autoAwaySettings)[i].statusChanged);
- if (!(*autoAwaySettings)[i].statusChanged)
- (*autoAwaySettings)[i].mStatus = TRUE;
-
- (*autoAwaySettings)[i].statusChanged = FALSE;
- } }
+ for (int i = 0; i < autoAwaySettings.getCount(); i++) {
+ TAAAProtoSetting &p = autoAwaySettings[i];
+ log_debugA("chk: %s", p.szName);
+ if (!strcmp(p.szName, ack->szModule)) {
+ log_debugA("ack->szModule: %s p.statusChanged: %d", ack->szModule, p.statusChanged);
+ if (!p.statusChanged)
+ p.mStatus = TRUE;
+
+ p.statusChanged = FALSE;
+ }
+ }
return 0;
}
@@ -189,16 +190,16 @@ static int ProcessProtoAck(WPARAM wParam,LPARAM lParam)
int OnAccChanged(WPARAM wParam,LPARAM lParam)
{
- PROTOACCOUNT* pa = (PROTOACCOUNT*)lParam;
- switch( wParam ) {
+ PROTOACCOUNT *pa = (PROTOACCOUNT*)lParam;
+ switch (wParam) {
case PRAC_ADDED:
- autoAwaySettings->insert( new TAAAProtoSetting(pa));
+ autoAwaySettings.insert(new TAAAProtoSetting(pa));
break;
-
+
case PRAC_REMOVED:
- for (int i=0; i < autoAwaySettings->getCount(); i++) {
- if ( !lstrcmpA( (*autoAwaySettings)[i].szName, pa->szModuleName )) {
- autoAwaySettings->remove( i );
+ for (int i = 0; i < autoAwaySettings.getCount(); i++) {
+ if (!lstrcmpA(autoAwaySettings[i].szName, pa->szModuleName)) {
+ autoAwaySettings.remove(i);
break;
}
}
@@ -208,9 +209,9 @@ int OnAccChanged(WPARAM wParam,LPARAM lParam)
return 0;
}
-static char* status2descr( int status )
+static char* status2descr(int status)
{
- switch( status ) {
+ switch (status) {
case ACTIVE: return "ACTIVE";
case STATUS1_SET: return "STATUS1_SET";
case STATUS2_SET: return "STATUS2_SET";
@@ -228,11 +229,11 @@ static int changeState(TAAAProtoSetting& setting, STATES newState)
setting.oldState = setting.curState;
setting.curState = newState;
- log_debugA("%s state change: %s -> %s", setting.szName,
+ log_debugA("%s state change: %s -> %s", setting.szName,
status2descr(setting.oldState), status2descr(setting.curState));
NotifyEventHooks(hStateChangedEvent, 0, (LPARAM)(AUTOAWAYSETTING*)&setting);
- if ( setting.curState != SET_ORGSTATUS && setting.curState != ACTIVE && setting.statusChanged ) {
+ if (setting.curState != SET_ORGSTATUS && setting.curState != ACTIVE && setting.statusChanged) {
/* change the awaymessage */
if (setting.szMsg != NULL) {
free(setting.szMsg);
@@ -244,59 +245,62 @@ static int changeState(TAAAProtoSetting& setting, STATES newState)
if (!db_get_ts(NULL, MODULENAME, StatusModeToDbSetting(setting.status, SETTING_STATUSMSG), &dbv)) {
setting.szMsg = _tcsdup(dbv.ptszVal);
db_free(&dbv);
- } }
+ }
+ }
}
else if (setting.szMsg != NULL) {
free(setting.szMsg);
setting.szMsg = NULL;
}
-
+
return 0;
}
-static VOID CALLBACK AutoAwayTimer(HWND hwnd,UINT message,UINT_PTR idEvent,DWORD dwTime)
-{
+static VOID CALLBACK AutoAwayTimer(HWND hwnd, UINT message, UINT_PTR idEvent, DWORD dwTime)
+{
int statusChanged = FALSE;
int confirm = FALSE;
- for (int i=0; i < autoAwaySettings->getCount(); i++) {
- TAAAProtoSetting& aas = (*autoAwaySettings)[i];
+ for (int i = 0; i < autoAwaySettings.getCount(); i++) {
+ TAAAProtoSetting& aas = autoAwaySettings[i];
aas.status = ID_STATUS_DISABLED;
- BOOL screenSaver = FALSE, locked = FALSE;
+ BOOL bTrigger = false;
- if ( aas.optionFlags & FLAG_MONITORMIRANDA )
- mouseStationaryTimer = (GetTickCount() - lastMirandaInput)/1000;
+ if (aas.optionFlags & FLAG_MONITORMIRANDA)
+ mouseStationaryTimer = (GetTickCount() - lastMirandaInput) / 1000;
else {
LASTINPUTINFO ii = { sizeof(ii) };
GetLastInputInfo(&ii);
- mouseStationaryTimer = (GetTickCount() - ii.dwTime)/1000;
+ mouseStationaryTimer = (GetTickCount() - ii.dwTime) / 1000;
}
int sts1Time = aas.awayTime * SECS_PER_MINUTE;
int sts2Time = aas.naTime * SECS_PER_MINUTE;
- int sts1setTime = aas.sts1setTimer==0?0:(GetTickCount() - aas.sts1setTimer)/1000;
- int currentMode = CallProtoService(aas.szName,PS_GETSTATUS,0, 0);
- if (aas.optionFlags & FLAG_ONSAVER)
- screenSaver = IsScreenSaverRunning();
+ int sts1setTime = aas.sts1setTimer == 0 ? 0 : (GetTickCount() - aas.sts1setTimer) / 1000;
+ int currentMode = CallProtoService(aas.szName, PS_GETSTATUS, 0, 0);
+ if (aas.optionFlags & FLAG_ONSAVER)
+ bTrigger |= IsScreenSaverRunning();
if (aas.optionFlags & FLAG_ONLOCK)
- locked = IsWorkstationLocked();
-
+ bTrigger |= IsWorkstationLocked();
+ if (aas.optionFlags & FLAG_FULLSCREEN)
+ bTrigger |= IsFullScreen();
+
/* check states */
if (aas.curState == ACTIVE) {
- if ((( mouseStationaryTimer >= sts1Time && (aas.optionFlags & FLAG_ONMOUSE)) || screenSaver || locked ) && currentMode != aas.lv1Status && aas.statusFlags&StatusModeToProtoFlag(currentMode)) {
+ if (((mouseStationaryTimer >= sts1Time && (aas.optionFlags & FLAG_ONMOUSE)) || bTrigger) && currentMode != aas.lv1Status && aas.statusFlags&StatusModeToProtoFlag(currentMode)) {
/* from ACTIVE to STATUS1_SET */
- aas.lastStatus = aas.originalStatusMode = CallProtoService(aas.szName,PS_GETSTATUS,0, 0);
+ aas.lastStatus = aas.originalStatusMode = CallProtoService(aas.szName, PS_GETSTATUS, 0, 0);
aas.status = aas.lv1Status;
aas.sts1setTimer = GetTickCount();
sts1setTime = 0;
aas.statusChanged = statusChanged = TRUE;
changeState(aas, STATUS1_SET);
}
- else if ( mouseStationaryTimer >= sts2Time && currentMode == aas.lv1Status && currentMode != aas.lv2Status && (aas.optionFlags & FLAG_SETNA) && (aas.statusFlags & StatusModeToProtoFlag(currentMode))) {
+ else if (mouseStationaryTimer >= sts2Time && currentMode == aas.lv1Status && currentMode != aas.lv2Status && (aas.optionFlags & FLAG_SETNA) && (aas.statusFlags & StatusModeToProtoFlag(currentMode))) {
/* from ACTIVE to STATUS2_SET */
- aas.lastStatus = aas.originalStatusMode = CallProtoService(aas.szName,PS_GETSTATUS,0, 0);
+ aas.lastStatus = aas.originalStatusMode = CallProtoService(aas.szName, PS_GETSTATUS, 0, 0);
aas.status = aas.lv2Status;
aas.statusChanged = statusChanged = TRUE;
changeState(aas, STATUS2_SET);
@@ -304,86 +308,87 @@ static VOID CALLBACK AutoAwayTimer(HWND hwnd,UINT message,UINT_PTR idEvent,DWORD
}
if (aas.curState == STATUS1_SET) {
- if (( mouseStationaryTimer < sts1Time && !screenSaver && !locked ) && !(aas.optionFlags & FLAG_RESET )) {
+ if ((mouseStationaryTimer < sts1Time && !bTrigger) && !(aas.optionFlags & FLAG_RESET)) {
/* from STATUS1_SET to HIDDEN_ACTIVE */
- changeState(aas, HIDDEN_ACTIVE);
- aas.lastStatus = CallProtoService(aas.szName,PS_GETSTATUS,0, 0);
+ changeState(aas, HIDDEN_ACTIVE);
+ aas.lastStatus = CallProtoService(aas.szName, PS_GETSTATUS, 0, 0);
}
- else if ( ((mouseStationaryTimer < sts1Time) && (!screenSaver) && (!locked)) &&
- ((aas.optionFlags&FLAG_LV2ONINACTIVE) || (!(aas.optionFlags&FLAG_SETNA))) &&
- (aas.optionFlags&FLAG_RESET)) {
+ else if (((mouseStationaryTimer < sts1Time) && !bTrigger) &&
+ ((aas.optionFlags & FLAG_LV2ONINACTIVE) || (!(aas.optionFlags&FLAG_SETNA))) &&
+ (aas.optionFlags & FLAG_RESET)) {
/* from STATUS1_SET to SET_ORGSTATUS */
changeState(aas, SET_ORGSTATUS);
}
- else if (( aas.optionFlags & FLAG_SETNA) && sts1setTime >= sts2Time ) {
+ else if ((aas.optionFlags & FLAG_SETNA) && sts1setTime >= sts2Time) {
/* when set STATUS2, currentMode doesn't have to be in the selected status list (statusFlags) */
/* from STATUS1_SET to STATUS2_SET */
- aas.lastStatus = CallProtoService(aas.szName,PS_GETSTATUS,0, 0);
+ aas.lastStatus = CallProtoService(aas.szName, PS_GETSTATUS, 0, 0);
aas.status = aas.lv2Status;
aas.statusChanged = statusChanged = TRUE;
changeState(aas, STATUS2_SET);
}
}
- if ( aas.curState == STATUS2_SET ) {
- if ( mouseStationaryTimer < sts2Time && !screenSaver && !locked && ( aas.optionFlags & FLAG_RESET )) {
+ if (aas.curState == STATUS2_SET) {
+ if (mouseStationaryTimer < sts2Time && !bTrigger && (aas.optionFlags & FLAG_RESET)) {
/* from STATUS2_SET to SET_ORGSTATUS */
changeState(aas, SET_ORGSTATUS);
}
- else if ( mouseStationaryTimer < sts2Time && !screenSaver && !locked && !( aas.optionFlags & FLAG_RESET )) {
+ else if (mouseStationaryTimer < sts2Time && !bTrigger && !(aas.optionFlags & FLAG_RESET)) {
/* from STATUS2_SET to HIDDEN_ACTIVE */
/* Remember: after status1 is set, and "only on inactive" is NOT set, it implies !reset. */
changeState(aas, HIDDEN_ACTIVE);
- aas.lastStatus = CallProtoService(aas.szName,PS_GETSTATUS,0, 0);
+ aas.lastStatus = CallProtoService(aas.szName, PS_GETSTATUS, 0, 0);
}
}
- if ( aas.curState == HIDDEN_ACTIVE ) {
- if ( aas.mStatus ) {
+ if (aas.curState == HIDDEN_ACTIVE) {
+ if (aas.mStatus) {
/* HIDDEN_ACTIVE to ACTIVE */
//aas.statusChanged = FALSE;
changeState(aas, ACTIVE);
aas.sts1setTimer = 0;
aas.mStatus = FALSE;
}
- else if (( aas.optionFlags & FLAG_SETNA ) && currentMode == aas.lv1Status &&
+ else if ((aas.optionFlags & FLAG_SETNA) && currentMode == aas.lv1Status &&
currentMode != aas.lv2Status && (aas.statusFlags & StatusModeToProtoFlag(currentMode)) &&
- (mouseStationaryTimer >= sts2Time || (sts1setTime >= sts2Time && !(aas.optionFlags & FLAG_LV2ONINACTIVE )))) {
+ (mouseStationaryTimer >= sts2Time || (sts1setTime >= sts2Time && !(aas.optionFlags & FLAG_LV2ONINACTIVE)))) {
/* HIDDEN_ACTIVE to STATUS2_SET */
- aas.lastStatus = aas.originalStatusMode = CallProtoService(aas.szName,PS_GETSTATUS,0, 0);
+ aas.lastStatus = aas.originalStatusMode = CallProtoService(aas.szName, PS_GETSTATUS, 0, 0);
aas.status = aas.lv2Status;
aas.statusChanged = statusChanged = TRUE;
changeState(aas, STATUS2_SET);
}
}
- if ( aas.curState == SET_ORGSTATUS ) {
+ if (aas.curState == SET_ORGSTATUS) {
/* SET_ORGSTATUS to ACTIVE */
- aas.lastStatus = CallProtoService(aas.szName,PS_GETSTATUS,0, 0);
+ aas.lastStatus = CallProtoService(aas.szName, PS_GETSTATUS, 0, 0);
aas.status = aas.originalStatusMode;
- confirm = (aas.optionFlags&FLAG_CONFIRM)?TRUE:confirm;
+ confirm = (aas.optionFlags&FLAG_CONFIRM) ? TRUE : confirm;
aas.statusChanged = statusChanged = TRUE;
changeState(aas, ACTIVE);
aas.sts1setTimer = 0;
}
- (*autoAwaySettings)[i].mStatus = FALSE;
+ autoAwaySettings[i].mStatus = FALSE;
}
- if ( confirm || statusChanged ) {
- OBJLIST<TAAAProtoSetting> ps = *autoAwaySettings;
- for (int i=0; i < ps.getCount(); i++) {
+ if (confirm || statusChanged) {
+ TAAAProtoSettingList ps = autoAwaySettings;
+ for (int i = 0; i < ps.getCount(); i++) {
if (ps[i].szMsg)
ps[i].szMsg = _tcsdup(ps[i].szMsg);
if (ps[i].status == ID_STATUS_DISABLED)
ps[i].szName = "";
}
-
+
if (confirm)
confirmDialog = (HWND)CallService(MS_CS_SHOWCONFIRMDLGEX, (WPARAM)&ps, db_get_w(NULL, MODULENAME, SETTING_CONFIRMDELAY, 5));
else if (statusChanged)
CallService(MS_CS_SETSTATUSEX, (WPARAM)&ps, 0);
-} }
-
+ }
+}
+
/////////////////////////////////////////////////////////////////////////////////////////
// Windows hooks
@@ -391,9 +396,9 @@ static int HookWindowsHooks(int hookMiranda, int hookAll)
{
if (hookMiranda) {
if (monitorKeyboard && hMirandaKeyBoardHook == NULL)
- hMirandaKeyBoardHook = SetWindowsHookEx(WH_KEYBOARD,MirandaKeyBoardHookFunction,NULL,GetCurrentThreadId());
+ hMirandaKeyBoardHook = SetWindowsHookEx(WH_KEYBOARD, MirandaKeyBoardHookFunction, NULL, GetCurrentThreadId());
if (monitorMouse && hMirandaMouseHook == NULL)
- hMirandaMouseHook = SetWindowsHookEx(WH_MOUSE,MirandaMouseHookFunction,NULL,GetCurrentThreadId());
+ hMirandaMouseHook = SetWindowsHookEx(WH_MOUSE, MirandaMouseHookFunction, NULL, GetCurrentThreadId());
}
if (hookAll) {
if (monitorKeyboard && hKeyBoardHook == NULL)
@@ -421,19 +426,19 @@ static LRESULT CALLBACK MirandaMouseHookFunction(int code, WPARAM wParam, LPARAM
if (code >= 0) {
PMOUSEHOOKSTRUCT mouseInfo = (PMOUSEHOOKSTRUCT)lParam;
POINT pt = mouseInfo->pt;
-
+
/* TioDuke's KeyBoardNotifyExt: only update if a Miranda window is focused */
DWORD pid;
GetWindowThreadProcessId(GetForegroundWindow(), &pid);
if (pid != GetCurrentProcessId())
return CallNextHookEx(hMirandaMouseHook, code, wParam, lParam);
- if (pt.x!=lastMousePos.x || pt.y!=lastMousePos.y) {
+ if (pt.x != lastMousePos.x || pt.y != lastMousePos.y) {
lastMousePos = pt;
- lastMirandaInput = GetTickCount();
+ lastMirandaInput = GetTickCount();
}
}
-
+
return CallNextHookEx(hMirandaMouseHook, code, wParam, lParam);
}
@@ -442,12 +447,12 @@ static LRESULT CALLBACK MirandaKeyBoardHookFunction(int code, WPARAM wParam, LPA
if (code >= 0) {
if (ignoreAltCombo) {
if (((GetKeyState(VK_MENU) < 0) || (wParam == VK_MENU)) ||
- ((GetKeyState(VK_TAB) < 0) || (wParam == VK_TAB)) ||
- ((GetKeyState(VK_SHIFT) < 0) || (wParam == VK_SHIFT)) ||
- ((GetKeyState(VK_CONTROL) < 0) || (wParam == VK_CONTROL)) ||
- ((GetKeyState(VK_ESCAPE) < 0) || (wParam == VK_ESCAPE)) ||
- ((GetKeyState(VK_LWIN) < 0) || (wParam == VK_LWIN)) ||
- ((GetKeyState(VK_RWIN) < 0) || (wParam == VK_RWIN)))
+ ((GetKeyState(VK_TAB) < 0) || (wParam == VK_TAB)) ||
+ ((GetKeyState(VK_SHIFT) < 0) || (wParam == VK_SHIFT)) ||
+ ((GetKeyState(VK_CONTROL) < 0) || (wParam == VK_CONTROL)) ||
+ ((GetKeyState(VK_ESCAPE) < 0) || (wParam == VK_ESCAPE)) ||
+ ((GetKeyState(VK_LWIN) < 0) || (wParam == VK_LWIN)) ||
+ ((GetKeyState(VK_RWIN) < 0) || (wParam == VK_RWIN)))
{
return CallNextHookEx(hMirandaKeyBoardHook, code, wParam, lParam);
}
@@ -477,7 +482,7 @@ static LRESULT CALLBACK MirandaKeyBoardHookFunction(int code, WPARAM wParam, LPA
break;
}
}
-
+
return CallNextHookEx(hMirandaKeyBoardHook, code, wParam, lParam);
}
@@ -491,11 +496,12 @@ static LRESULT CALLBACK MouseHookFunction(int code, WPARAM wParam, LPARAM lParam
if ((wParam >= WM_NCLBUTTONDOWN && wParam <= WM_NCXBUTTONDBLCLK && wParam != 0x00AA) || (wParam >= WM_LBUTTONDOWN && wParam <= WM_XBUTTONDBLCLK))
lastInput = GetTickCount();
- if (pt.x!=lastMousePos.x || pt.y!=lastMousePos.y) {
+ if (pt.x != lastMousePos.x || pt.y != lastMousePos.y) {
lastMousePos = pt;
- lastInput = GetTickCount();
- } }
-
+ lastInput = GetTickCount();
+ }
+ }
+
return CallNextHookEx(hMouseHook, code, wParam, lParam);
}
@@ -503,7 +509,7 @@ static LRESULT CALLBACK KeyBoardHookFunction(int code, WPARAM wParam, LPARAM lPa
{
if (code >= 0) {
if (ignoreAltCombo) {
- if ( ((GetKeyState(VK_MENU) < 0) || (wParam == VK_MENU)) ||
+ if (((GetKeyState(VK_MENU) < 0) || (wParam == VK_MENU)) ||
((GetKeyState(VK_TAB) < 0) || (wParam == VK_TAB)) ||
((GetKeyState(VK_SHIFT) < 0) || (wParam == VK_SHIFT)) ||
((GetKeyState(VK_CONTROL) < 0) || (wParam == VK_CONTROL)) ||
@@ -539,14 +545,14 @@ static LRESULT CALLBACK KeyBoardHookFunction(int code, WPARAM wParam, LPARAM lPa
break;
}
}
-
+
return CallNextHookEx(hKeyBoardHook, code, wParam, lParam);
}
/////////////////////////////////////////////////////////////////////////////////////////
// Inits & stuff
-static int AutoAwayShutdown(WPARAM wParam,LPARAM lParam)
+static int AutoAwayShutdown(WPARAM wParam, LPARAM lParam)
{
KillTimer(NULL, hAutoAwayTimer);
@@ -555,8 +561,8 @@ static int AutoAwayShutdown(WPARAM wParam,LPARAM lParam)
#endif
UnhookWindowsHooks();
DestroyHookableEvent(hStateChangedEvent);
-
- autoAwaySettings->destroy();
+
+ autoAwaySettings.destroy();
return 0;
}
@@ -571,18 +577,18 @@ int CSModuleLoaded(WPARAM wParam, LPARAM lParam)
////////////////////////////////////////////////////////////////////////////////////////
- protoList = ( OBJLIST<PROTOCOLSETTINGEX>* )autoAwaySettings;
+ protoList = (OBJLIST<PROTOCOLSETTINGEX>*)&autoAwaySettings;
int count;
PROTOACCOUNT** protos;
ProtoEnumAccounts(&count, &protos);
- for ( int i=0; i < count; i++ )
- if ( IsSuitableProto( protos[i] ))
- autoAwaySettings->insert( new TAAAProtoSetting( protos[i] ));
+ for (int i = 0; i < count; i++)
+ if (IsSuitableProto(protos[i]))
+ autoAwaySettings.insert(new TAAAProtoSetting(protos[i]));
////////////////////////////////////////////////////////////////////////////////////////
- LoadOptions(*autoAwaySettings, FALSE);
+ LoadOptions(autoAwaySettings, FALSE);
return 0;
}
diff --git a/plugins/StatusPlugins/AdvancedAutoAway/advancedautoaway.h b/plugins/StatusPlugins/AdvancedAutoAway/advancedautoaway.h
index 296f0d3c34..4e7ed9ba50 100644
--- a/plugins/StatusPlugins/AdvancedAutoAway/advancedautoaway.h
+++ b/plugins/StatusPlugins/AdvancedAutoAway/advancedautoaway.h
@@ -22,39 +22,40 @@
#include <m_options.h>
#include "version.h"
-#define SETTING_IGNLOCK "IgnoreLockKeys"
-#define SETTING_IGNSYSKEYS "IgnoreSysKeys"
-#define SETTING_IGNALTCOMBO "IgnoreAltCombo"
-#define SETTING_SAMESETTINGS "SameAutoAwaySettings"
-#define SETTING_ALL "ALLPROTOS"
-#define SETTING_MSGCUSTOM "Custom"
-#define SETTING_STATUSMSG "Msg"
-#define SETTING_CONFIRMDELAY "ConfirmTimeout"
-#define MODULENAME "AdvancedAutoAway"
-
-#define SETTING_AWAYTIME_DEFAULT 5
-#define SETTING_NATIME_DEFAULT 20
-#define SETTING_AWAYCHECKTIMEINSECS "CheckInterval"
-
-#define STATUS_RESET 1
-#define STATUS_AUTOAWAY 2
-#define STATUS_AUTONA 3
-
-#define SETTING_MONITORMOUSE "MonitorMouse"
-#define SETTING_MONITORKEYBOARD "MonitorKeyboard"
-
-#define FLAG_ONSAVER 1 // db: set lv1 status on screensaver ?
-#define FLAG_ONMOUSE 2 // db: set after inactivity ?
-#define FLAG_SETNA 4 // db: set NA after xx of away time ?
-#define FLAG_CONFIRM 8 // db: show confirm dialog ?
-#define FLAG_RESET 16 // db: restore status ?
-#define FLAG_LV2ONINACTIVE 32 // db: set lv2 only on inactivity
-#define FLAG_MONITORMIRANDA 64 // db: monitor miranda activity only
-#define FLAG_ONLOCK 128 // db: on work station lock
+#define SETTING_IGNLOCK "IgnoreLockKeys"
+#define SETTING_IGNSYSKEYS "IgnoreSysKeys"
+#define SETTING_IGNALTCOMBO "IgnoreAltCombo"
+#define SETTING_SAMESETTINGS "SameAutoAwaySettings"
+#define SETTING_ALL "ALLPROTOS"
+#define SETTING_MSGCUSTOM "Custom"
+#define SETTING_STATUSMSG "Msg"
+#define SETTING_CONFIRMDELAY "ConfirmTimeout"
+#define MODULENAME "AdvancedAutoAway"
+
+#define SETTING_AWAYTIME_DEFAULT 5
+#define SETTING_NATIME_DEFAULT 20
+#define SETTING_AWAYCHECKTIMEINSECS "CheckInterval"
+
+#define STATUS_RESET 1
+#define STATUS_AUTOAWAY 2
+#define STATUS_AUTONA 3
+
+#define SETTING_MONITORMOUSE "MonitorMouse"
+#define SETTING_MONITORKEYBOARD "MonitorKeyboard"
+
+#define FLAG_ONSAVER 0x0001 // db: set lv1 status on screensaver ?
+#define FLAG_ONMOUSE 0x0002 // db: set after inactivity ?
+#define FLAG_SETNA 0x0004 // db: set NA after xx of away time ?
+#define FLAG_CONFIRM 0x0008 // db: show confirm dialog ?
+#define FLAG_RESET 0x0010 // db: restore status ?
+#define FLAG_LV2ONINACTIVE 0x0020 // db: set lv2 only on inactivity
+#define FLAG_MONITORMIRANDA 0x0040 // db: monitor miranda activity only
+#define FLAG_ONLOCK 0x0080 // db: on work station lock
+#define FLAG_FULLSCREEN 0x0100 // db: on full screen
struct TAAAProtoSetting : public PROTOCOLSETTINGEX, public MZeroedObject
{
- TAAAProtoSetting( PROTOACCOUNT* pa );
+ TAAAProtoSetting(PROTOACCOUNT* pa);
~TAAAProtoSetting();
int originalStatusMode;
@@ -75,17 +76,18 @@ struct TAAAProtoSetting : public PROTOCOLSETTINGEX, public MZeroedObject
struct AAMSGSETTING
{
short useCustom;
- int status;
+ int status;
char* msg;
};
extern HINSTANCE hInst, hCore;
-int CompareSettings( const TAAAProtoSetting* p1, const TAAAProtoSetting* p2 );
+int CompareSettings( const TAAAProtoSetting *p1, const TAAAProtoSetting *p2 );
-extern OBJLIST<TAAAProtoSetting> *autoAwaySettings;
+typedef OBJLIST<TAAAProtoSetting> TAAAProtoSettingList;
+extern TAAAProtoSettingList autoAwaySettings;
-int LoadAutoAwaySetting(TAAAProtoSetting& autoAwaySetting, char* protoName);
-void LoadOptions(OBJLIST<TAAAProtoSetting>& settings, BOOL override);
+int LoadAutoAwaySetting(TAAAProtoSetting &autoAwaySetting, char *protoName);
+void LoadOptions(TAAAProtoSettingList &settings, BOOL override);
#endif
diff --git a/plugins/StatusPlugins/AdvancedAutoAway/main.cpp b/plugins/StatusPlugins/AdvancedAutoAway/main.cpp
index ac41956d2d..92d11fda43 100644
--- a/plugins/StatusPlugins/AdvancedAutoAway/main.cpp
+++ b/plugins/StatusPlugins/AdvancedAutoAway/main.cpp
@@ -24,7 +24,6 @@
#include "advancedautoaway.h"
#include "../resource.h"
-
HINSTANCE hInst, hCore = NULL;
CLIST_INTERFACE *pcli;
@@ -77,11 +76,9 @@ extern "C" __declspec(dllexport) const MUUID MirandaInterfaces[] = { MIID_AUTOAW
extern "C" __declspec(dllexport) int Load(void)
{
- mir_getLP( &pluginInfoEx );
+ mir_getLP(&pluginInfoEx);
mir_getCLI();
- autoAwaySettings = new OBJLIST<TAAAProtoSetting>(10, CompareSettings);
-
InitCommonStatus();
hCSModuleLoadedHook = HookEvent(ME_SYSTEM_MODULESLOADED, CSModuleLoaded);
hStateChangedEvent = CreateHookableEvent(ME_AAA_STATECHANGED);
@@ -93,7 +90,6 @@ extern "C" __declspec(dllexport) int Load(void)
extern "C" __declspec(dllexport) int Unload(void)
{
- DestroyHookableEvent( hStateChangedEvent );
- delete autoAwaySettings;
+ DestroyHookableEvent(hStateChangedEvent);
return 0;
}
diff --git a/plugins/StatusPlugins/AdvancedAutoAway/options.cpp b/plugins/StatusPlugins/AdvancedAutoAway/options.cpp
index ce92e9aaac..b77e1b8036 100644
--- a/plugins/StatusPlugins/AdvancedAutoAway/options.cpp
+++ b/plugins/StatusPlugins/AdvancedAutoAway/options.cpp
@@ -1,27 +1,28 @@
/*
- AdvancedAutoAway Plugin for Miranda-IM (www.miranda-im.org)
- Copyright 2003-2006 P. Boon
-
- This program is free software; you can redistribute it and/or modify
- it under the terms of the GNU General Public License as published by
- the Free Software Foundation; either version 2 of the License, or
- (at your option) any later version.
-
- This program is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- GNU General Public License for more details.
-
- You should have received a copy of the GNU General Public License
- along with this program; if not, write to the Free Software
- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+AdvancedAutoAway Plugin for Miranda-IM (www.miranda-im.org)
+Copyright 2003-2006 P. Boon
+
+This program is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 2 of the License, or
+(at your option) any later version.
+
+This program is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+GNU General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with this program; if not, write to the Free Software
+Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
+
#include "../commonstatus.h"
#include "advancedautoaway.h"
#include "../resource.h"
#include <commctrl.h>
-int LoadAutoAwaySetting(TAAAProtoSetting& autoAwaySetting, char* protoName);
+int LoadAutoAwaySetting(TAAAProtoSetting &autoAwaySetting, char* protoName);
INT_PTR CALLBACK DlgProcAutoAwayMsgOpts(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lParam);
@@ -30,94 +31,103 @@ static BOOL bSettingSame = FALSE;
/////////////////////////////////////////////////////////////////////////////////////////
// Dialog service functions
-static int WriteAutoAwaySetting(TAAAProtoSetting& autoAwaySetting, char* protoName)
+static int WriteAutoAwaySetting(TAAAProtoSetting &autoAwaySetting, char *protoName)
{
char setting[128];
mir_snprintf(setting, sizeof(setting), "%s_OptionFlags", protoName);
- db_set_b(NULL,MODULENAME,setting,(BYTE)autoAwaySetting.optionFlags);
+ db_set_w(NULL, MODULENAME, setting, (WORD)autoAwaySetting.optionFlags);
mir_snprintf(setting, sizeof(setting), "%s_AwayTime", protoName);
- db_set_w(NULL,MODULENAME,setting,(WORD)autoAwaySetting.awayTime);
+ db_set_w(NULL, MODULENAME, setting, (WORD)autoAwaySetting.awayTime);
mir_snprintf(setting, sizeof(setting), "%s_NATime", protoName);
- db_set_w(NULL,MODULENAME,setting,(WORD)autoAwaySetting.naTime);
+ db_set_w(NULL, MODULENAME, setting, (WORD)autoAwaySetting.naTime);
mir_snprintf(setting, sizeof(setting), "%s_StatusFlags", protoName);
- db_set_w(NULL,MODULENAME,setting,(WORD)autoAwaySetting.statusFlags);
+ db_set_w(NULL, MODULENAME, setting, (WORD)autoAwaySetting.statusFlags);
mir_snprintf(setting, sizeof(setting), "%s_Lv1Status", protoName);
- db_set_w(NULL,MODULENAME,setting,(WORD)autoAwaySetting.lv1Status);
+ db_set_w(NULL, MODULENAME, setting, (WORD)autoAwaySetting.lv1Status);
mir_snprintf(setting, sizeof(setting), "%s_Lv2Status", protoName);
- db_set_w(NULL,MODULENAME,setting,(WORD)autoAwaySetting.lv2Status);
+ db_set_w(NULL, MODULENAME, setting, (WORD)autoAwaySetting.lv2Status);
return 0;
}
-static void SetDialogItems(HWND hwndDlg, TAAAProtoSetting* setting)
+static void SetDialogItems(HWND hwndDlg, TAAAProtoSetting *setting)
{
- CheckDlgButton(hwndDlg, IDC_SCREENSAVE, setting->optionFlags&FLAG_ONSAVER ? BST_CHECKED : BST_UNCHECKED);
- CheckDlgButton(hwndDlg, IDC_ONLOCK, setting->optionFlags&FLAG_ONLOCK ? BST_CHECKED : BST_UNCHECKED);
- CheckDlgButton(hwndDlg, IDC_TIMED, setting->optionFlags&FLAG_ONMOUSE ? BST_CHECKED : BST_UNCHECKED);
- CheckDlgButton(hwndDlg, IDC_SETNA, setting->optionFlags&FLAG_SETNA ? BST_CHECKED : BST_UNCHECKED);
- SetDlgItemInt(hwndDlg,IDC_AWAYTIME, setting->awayTime,FALSE);
- SetDlgItemInt(hwndDlg,IDC_NATIME, setting->naTime,FALSE);
- CheckDlgButton(hwndDlg, IDC_CONFIRM, setting->optionFlags&FLAG_CONFIRM ? BST_CHECKED : BST_UNCHECKED);
- CheckDlgButton(hwndDlg, IDC_RESETSTATUS, setting->optionFlags&FLAG_RESET ? BST_CHECKED : BST_UNCHECKED);
- CheckDlgButton(hwndDlg, IDC_MONITORMIRANDA, setting->optionFlags&FLAG_MONITORMIRANDA ? BST_CHECKED : BST_UNCHECKED);
- CheckDlgButton(hwndDlg, IDC_LV2ONINACTIVE, setting->optionFlags&FLAG_LV2ONINACTIVE ? BST_CHECKED : BST_UNCHECKED);
- EnableWindow(GetDlgItem(hwndDlg,IDC_SETNA),IsDlgButtonChecked(hwndDlg,IDC_TIMED));
- EnableWindow(GetDlgItem(hwndDlg,IDC_LV2ONINACTIVE),(IsDlgButtonChecked(hwndDlg,IDC_TIMED)) && (IsDlgButtonChecked(hwndDlg,IDC_SETNA)));
- EnableWindow(GetDlgItem(hwndDlg,IDC_MONITORMIRANDA),IsDlgButtonChecked(hwndDlg,IDC_TIMED));
- EnableWindow(GetDlgItem(hwndDlg,IDC_AWAYTIME),IsDlgButtonChecked(hwndDlg,IDC_TIMED));
- EnableWindow(GetDlgItem(hwndDlg,IDC_LV1AFTERSTR),IsDlgButtonChecked(hwndDlg,IDC_TIMED));
- EnableWindow(GetDlgItem(hwndDlg,IDC_LV1STATUS),IsDlgButtonChecked(hwndDlg,IDC_TIMED)||IsDlgButtonChecked(hwndDlg,IDC_SCREENSAVE));
- EnableWindow(GetDlgItem(hwndDlg,IDC_STATUSLIST),IsDlgButtonChecked(hwndDlg,IDC_TIMED)||IsDlgButtonChecked(hwndDlg,IDC_SCREENSAVE));
- EnableWindow(GetDlgItem(hwndDlg,IDC_RESETSTATUS),(IsDlgButtonChecked(hwndDlg,IDC_TIMED)||IsDlgButtonChecked(hwndDlg,IDC_SCREENSAVE))&&(IsDlgButtonChecked(hwndDlg, IDC_LV2ONINACTIVE)));
- EnableWindow(GetDlgItem(hwndDlg,IDC_CONFIRM),(IsDlgButtonChecked(hwndDlg,IDC_TIMED)||IsDlgButtonChecked(hwndDlg,IDC_SCREENSAVE))&&(IsDlgButtonChecked(hwndDlg, IDC_LV2ONINACTIVE)&&(IsDlgButtonChecked(hwndDlg,IDC_RESETSTATUS))));
- EnableWindow(GetDlgItem(hwndDlg,IDC_NATIME),IsDlgButtonChecked(hwndDlg,IDC_SETNA)&&IsDlgButtonChecked(hwndDlg,IDC_TIMED));
- EnableWindow(GetDlgItem(hwndDlg,IDC_SETNASTR),IsDlgButtonChecked(hwndDlg,IDC_SETNA)&&IsDlgButtonChecked(hwndDlg,IDC_TIMED));
- EnableWindow(GetDlgItem(hwndDlg,IDC_SETNASTR),IsDlgButtonChecked(hwndDlg,IDC_SETNA)&&IsDlgButtonChecked(hwndDlg,IDC_TIMED));
- EnableWindow(GetDlgItem(hwndDlg,IDC_LV2STATUS),IsDlgButtonChecked(hwndDlg,IDC_SETNA)&&IsDlgButtonChecked(hwndDlg,IDC_TIMED));
- EnableWindow(GetDlgItem(hwndDlg,IDC_PROTOCOL), !bSettingSame);//db_get_b(NULL, MODULENAME, SETTING_SAMESETTINGS, FALSE));
+ bool bIsTimed = (setting->optionFlags & FLAG_ONMOUSE) != 0;
+ bool bSetNA = (setting->optionFlags & FLAG_SETNA) != 0;
+ bool bSaver = (setting->optionFlags & FLAG_ONSAVER) != 0;
+ bool bFullScr = (setting->optionFlags & FLAG_FULLSCREEN) != 0;
+
+ CheckDlgButton(hwndDlg, IDC_FULLSCREEN, bFullScr);
+ CheckDlgButton(hwndDlg, IDC_SCREENSAVE, bSaver);
+ CheckDlgButton(hwndDlg, IDC_ONLOCK, (setting->optionFlags & FLAG_ONLOCK) != 0);
+ CheckDlgButton(hwndDlg, IDC_TIMED, bIsTimed);
+ CheckDlgButton(hwndDlg, IDC_SETNA, bSetNA);
+ CheckDlgButton(hwndDlg, IDC_CONFIRM, (setting->optionFlags & FLAG_CONFIRM) != 0);
+ CheckDlgButton(hwndDlg, IDC_RESETSTATUS, (setting->optionFlags & FLAG_RESET) != 0);
+ CheckDlgButton(hwndDlg, IDC_MONITORMIRANDA, (setting->optionFlags & FLAG_MONITORMIRANDA) != 0);
+ CheckDlgButton(hwndDlg, IDC_LV2ONINACTIVE, (setting->optionFlags & FLAG_LV2ONINACTIVE) != 0);
+
+ SetDlgItemInt(hwndDlg, IDC_AWAYTIME, setting->awayTime, FALSE);
+ SetDlgItemInt(hwndDlg, IDC_NATIME, setting->naTime, FALSE);
+
+ EnableWindow(GetDlgItem(hwndDlg, IDC_SETNA), bIsTimed);
+ EnableWindow(GetDlgItem(hwndDlg, IDC_LV2ONINACTIVE), bIsTimed && bSetNA);
+ EnableWindow(GetDlgItem(hwndDlg, IDC_MONITORMIRANDA), bIsTimed);
+ EnableWindow(GetDlgItem(hwndDlg, IDC_AWAYTIME), bIsTimed);
+ EnableWindow(GetDlgItem(hwndDlg, IDC_LV1AFTERSTR), bIsTimed);
+ EnableWindow(GetDlgItem(hwndDlg, IDC_LV1STATUS), bIsTimed || bSaver || bFullScr);
+ EnableWindow(GetDlgItem(hwndDlg, IDC_STATUSLIST), bIsTimed || bSaver || bFullScr);
+ EnableWindow(GetDlgItem(hwndDlg, IDC_RESETSTATUS), (bIsTimed || bSaver || bFullScr) && IsDlgButtonChecked(hwndDlg, IDC_LV2ONINACTIVE));
+ EnableWindow(GetDlgItem(hwndDlg, IDC_CONFIRM), (bIsTimed || bSaver || bFullScr) && IsDlgButtonChecked(hwndDlg, IDC_LV2ONINACTIVE) && IsDlgButtonChecked(hwndDlg, IDC_RESETSTATUS));
+ EnableWindow(GetDlgItem(hwndDlg, IDC_NATIME), bSetNA && bIsTimed);
+ EnableWindow(GetDlgItem(hwndDlg, IDC_SETNASTR), bSetNA && bIsTimed);
+ EnableWindow(GetDlgItem(hwndDlg, IDC_SETNASTR), bSetNA && bIsTimed);
+ EnableWindow(GetDlgItem(hwndDlg, IDC_LV2STATUS), bSetNA && bIsTimed);
+ EnableWindow(GetDlgItem(hwndDlg, IDC_PROTOCOL), !bSettingSame);
}
-static TAAAProtoSetting* GetSetting(HWND hwndDlg, TAAAProtoSetting* sameSetting)
+static TAAAProtoSetting* GetSetting(HWND hwndDlg, TAAAProtoSetting *sameSetting)
{
- if ( bSettingSame )
+ if (bSettingSame)
return sameSetting;
int iItem = SendDlgItemMessage(hwndDlg, IDC_PROTOCOL, CB_GETCURSEL, 0, 0);
- if ( iItem == -1 )
+ if (iItem == -1)
return NULL;
INT_PTR iData = (INT_PTR)SendDlgItemMessage(hwndDlg, IDC_PROTOCOL, CB_GETITEMDATA, iItem, 0);
- return ( iData == -1 ) ? NULL : (TAAAProtoSetting*)iData;
+ return (iData == -1) ? NULL : (TAAAProtoSetting*)iData;
}
-static void SetDialogStatus(HWND hwndDlg, TAAAProtoSetting* sameSetting)
+static void SetDialogStatus(HWND hwndDlg, TAAAProtoSetting *sameSetting)
{
- TAAAProtoSetting* setting = GetSetting(hwndDlg, sameSetting);
- if ( setting ) {
-
- // create columns
- HWND hList = GetDlgItem(hwndDlg,IDC_STATUSLIST);
- ListView_SetExtendedListViewStyleEx(hList, LVS_EX_FULLROWSELECT|LVS_EX_CHECKBOXES, LVS_EX_FULLROWSELECT|LVS_EX_CHECKBOXES);
-
- LVCOLUMN lvCol = { 0 };
- lvCol.mask = LVCF_WIDTH|LVCF_TEXT;
- lvCol.pszText = TranslateT("Status");
- lvCol.cx = 118;
- ListView_InsertColumn(hList, 0, &lvCol);
-
- // get pointer to settings
- SetDialogItems(hwndDlg, setting);
-} }
-
+ TAAAProtoSetting *setting = GetSetting(hwndDlg, sameSetting);
+ if (setting == NULL)
+ return;
+
+ // create columns
+ HWND hList = GetDlgItem(hwndDlg, IDC_STATUSLIST);
+ ListView_SetExtendedListViewStyleEx(hList, LVS_EX_FULLROWSELECT | LVS_EX_CHECKBOXES, LVS_EX_FULLROWSELECT | LVS_EX_CHECKBOXES);
+
+ LVCOLUMN lvCol = { 0 };
+ lvCol.mask = LVCF_WIDTH | LVCF_TEXT;
+ lvCol.pszText = TranslateT("Status");
+ lvCol.cx = 118;
+ ListView_InsertColumn(hList, 0, &lvCol);
+
+ // get pointer to settings
+ SetDialogItems(hwndDlg, setting);
+}
/////////////////////////////////////////////////////////////////////////////////////////
// Rules dialog window procedure
-static OBJLIST<TAAAProtoSetting> *optionSettings;
+static TAAAProtoSettingList optionSettings(10, CompareSettings);
static INT_PTR CALLBACK DlgProcAutoAwayRulesOpts(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lParam)
{
static TAAAProtoSetting* sameSetting;
+ TAAAProtoSetting *setting;
static int init;
switch (msg) {
@@ -126,22 +136,21 @@ static INT_PTR CALLBACK DlgProcAutoAwayRulesOpts(HWND hwndDlg, UINT msg, WPARAM
TranslateDialogDefault(hwndDlg);
// copy the settings
- optionSettings = new OBJLIST<TAAAProtoSetting>(10, CompareSettings);
- *optionSettings = *autoAwaySettings;
+ optionSettings = autoAwaySettings;
- sameSetting = ( TAAAProtoSetting* )malloc(sizeof(TAAAProtoSetting));
+ sameSetting = (TAAAProtoSetting*)malloc(sizeof(TAAAProtoSetting));
LoadAutoAwaySetting(*sameSetting, SETTING_ALL);
// fill list from currentProtoSettings
{
- for ( int i=0; i < optionSettings->getCount(); i++ ) {
- TAAAProtoSetting& p = (*optionSettings)[i];
- int item = SendDlgItemMessage(hwndDlg, IDC_PROTOCOL, CB_ADDSTRING, 0, (LPARAM)p.tszAccName );
- SendDlgItemMessage(hwndDlg, IDC_PROTOCOL, CB_SETITEMDATA, item, (LPARAM)&p );
+ for (int i = 0; i < optionSettings.getCount(); i++) {
+ TAAAProtoSetting &p = optionSettings[i];
+ int item = SendDlgItemMessage(hwndDlg, IDC_PROTOCOL, CB_ADDSTRING, 0, (LPARAM)p.tszAccName);
+ SendDlgItemMessage(hwndDlg, IDC_PROTOCOL, CB_SETITEMDATA, item, (LPARAM)&p);
}
}
// set cursor to first protocol
- SendDlgItemMessage(hwndDlg,IDC_PROTOCOL,CB_SETCURSEL,0,0);
+ SendDlgItemMessage(hwndDlg, IDC_PROTOCOL, CB_SETCURSEL, 0, 0);
// status list
SetDialogStatus(hwndDlg, sameSetting);
@@ -151,154 +160,145 @@ static INT_PTR CALLBACK DlgProcAutoAwayRulesOpts(HWND hwndDlg, UINT msg, WPARAM
break;
case WM_COMMAND:
- if (( HIWORD(wParam) == EN_CHANGE || HIWORD(wParam) == BN_CLICKED ) && (HWND)lParam == GetFocus())
- SendMessage(GetParent(hwndDlg),PSM_CHANGED,0,0);
- {
- TAAAProtoSetting* setting = GetSetting(hwndDlg, sameSetting);
- if ( !setting )
- break;
+ if ((HIWORD(wParam) == EN_CHANGE || HIWORD(wParam) == BN_CLICKED) && (HWND)lParam == GetFocus())
+ SendMessage(GetParent(hwndDlg), PSM_CHANGED, 0, 0);
- switch(LOWORD(wParam)) {
- case IDC_PROTOCOL:
- // status listview
- {
- int i, flags;
- LVITEM lvItem;
- HWND hList=GetDlgItem(hwndDlg,IDC_STATUSLIST);
-
- init = TRUE;
- ListView_DeleteAllItems(hList);
- memset(&lvItem,0,sizeof(lvItem));
- lvItem.mask=LVIF_TEXT|LVIF_PARAM;
- lvItem.cchTextMax = 256;
- lvItem.iItem=0;
- lvItem.iSubItem=0;
- if (!bSettingSame)
- flags = CallProtoService(setting->szName, PS_GETCAPS,PFLAGNUM_2,0)&~CallProtoService(setting->szName, PS_GETCAPS, (WPARAM)PFLAGNUM_5, 0);
- else
- flags = 0;
- for(i=0;i<sizeof(statusModeList)/sizeof(statusModeList[0]);i++) {
- if ((flags&statusModePf2List[i]) || (statusModePf2List[i] == PF2_OFFLINE) || (bSettingSame)) {
- lvItem.pszText = pcli->pfnGetStatusModeDescription(statusModeList[i], 0);
- lvItem.lParam = (LPARAM)statusModePf2List[i];
- ListView_InsertItem(hList,&lvItem);
- ListView_SetCheckState(hList, lvItem.iItem, setting->statusFlags&statusModePf2List[i]?TRUE:FALSE);
- lvItem.iItem++;
- }
+ setting = GetSetting(hwndDlg, sameSetting);
+ if (!setting)
+ break;
+
+ switch (LOWORD(wParam)) {
+ case IDC_PROTOCOL:
+ // status listview
+ init = TRUE;
+ {
+ HWND hList = GetDlgItem(hwndDlg, IDC_STATUSLIST);
+ ListView_DeleteAllItems(hList);
+
+ int flags = 0;
+ if (!bSettingSame)
+ flags = CallProtoService(setting->szName, PS_GETCAPS, PFLAGNUM_2, 0)&~CallProtoService(setting->szName, PS_GETCAPS, (WPARAM)PFLAGNUM_5, 0);
+
+ LVITEM lvItem = { 0 };
+ lvItem.mask = LVIF_TEXT | LVIF_PARAM;
+ lvItem.cchTextMax = 256;
+ lvItem.iItem = 0;
+ lvItem.iSubItem = 0;
+ for (int i = 0; i < SIZEOF(statusModeList); i++) {
+ if ((flags & statusModePf2List[i]) || (statusModePf2List[i] == PF2_OFFLINE) || (bSettingSame)) {
+ lvItem.pszText = pcli->pfnGetStatusModeDescription(statusModeList[i], 0);
+ lvItem.lParam = (LPARAM)statusModePf2List[i];
+ ListView_InsertItem(hList, &lvItem);
+ ListView_SetCheckState(hList, lvItem.iItem, setting->statusFlags & statusModePf2List[i] ? TRUE : FALSE);
+ lvItem.iItem++;
}
- init = FALSE;
}
- // status dropdown boxes
- {
- int i, item;
- int flags;
- if (!bSettingSame)
- flags = CallProtoService(setting->szName, PS_GETCAPS,PFLAGNUM_2,0)&~CallProtoService(setting->szName, PS_GETCAPS, (WPARAM)PFLAGNUM_5, 0);
- else
- flags = 0;
-
- // clear box and add new status, loop status and check if compatible with proto
- SendDlgItemMessage(hwndDlg, IDC_LV1STATUS, CB_RESETCONTENT, 0, 0);
- SendDlgItemMessage(hwndDlg, IDC_LV2STATUS, CB_RESETCONTENT, 0, 0);
- for ( i=0; i < SIZEOF(statusModeList); i++ ) {
- if ( (flags & statusModePf2List[i]) || statusModePf2List[i] == PF2_OFFLINE || bSettingSame ) {
- TCHAR *statusMode = pcli->pfnGetStatusModeDescription(statusModeList[i], 0);
- item = SendDlgItemMessage(hwndDlg, IDC_LV1STATUS, CB_ADDSTRING, 0, (LPARAM)statusMode);
- SendDlgItemMessage(hwndDlg, IDC_LV1STATUS, CB_SETITEMDATA, item, (LPARAM)statusModeList[i]);
- item = SendDlgItemMessage(hwndDlg, IDC_LV2STATUS, CB_ADDSTRING, 0, (LPARAM)statusMode);
- SendDlgItemMessage(hwndDlg, IDC_LV2STATUS, CB_SETITEMDATA, item, (LPARAM)statusModeList[i]);
- if (statusModeList[i] == setting->lv1Status) {
- SendDlgItemMessage(hwndDlg,IDC_LV1STATUS,CB_SETCURSEL,(WPARAM)item,0);
-
- TCHAR setNaStr[256];
- mir_sntprintf( setNaStr, SIZEOF(setNaStr), TranslateT("minutes of %s mode"), statusMode );
- SetDlgItemText( hwndDlg, IDC_SETNASTR, setNaStr );
- }
- if (statusModeList[i] == setting->lv2Status)
- SendDlgItemMessage(hwndDlg,IDC_LV2STATUS,CB_SETCURSEL,(WPARAM)item,0);
+ }
+ init = FALSE;
+ // status dropdown boxes
+ {
+ int flags = 0;
+ if (!bSettingSame)
+ flags = CallProtoService(setting->szName, PS_GETCAPS, PFLAGNUM_2, 0)&~CallProtoService(setting->szName, PS_GETCAPS, (WPARAM)PFLAGNUM_5, 0);
+
+ // clear box and add new status, loop status and check if compatible with proto
+ SendDlgItemMessage(hwndDlg, IDC_LV1STATUS, CB_RESETCONTENT, 0, 0);
+ SendDlgItemMessage(hwndDlg, IDC_LV2STATUS, CB_RESETCONTENT, 0, 0);
+ for (int i=0; i < SIZEOF(statusModeList); i++) {
+ if ((flags & statusModePf2List[i]) || statusModePf2List[i] == PF2_OFFLINE || bSettingSame) {
+ TCHAR *statusMode = pcli->pfnGetStatusModeDescription(statusModeList[i], 0);
+ int item = SendDlgItemMessage(hwndDlg, IDC_LV1STATUS, CB_ADDSTRING, 0, (LPARAM)statusMode);
+ SendDlgItemMessage(hwndDlg, IDC_LV1STATUS, CB_SETITEMDATA, item, (LPARAM)statusModeList[i]);
+ item = SendDlgItemMessage(hwndDlg, IDC_LV2STATUS, CB_ADDSTRING, 0, (LPARAM)statusMode);
+ SendDlgItemMessage(hwndDlg, IDC_LV2STATUS, CB_SETITEMDATA, item, (LPARAM)statusModeList[i]);
+ if (statusModeList[i] == setting->lv1Status) {
+ SendDlgItemMessage(hwndDlg, IDC_LV1STATUS, CB_SETCURSEL, (WPARAM)item, 0);
+ SetDlgItemText(hwndDlg, IDC_SETNASTR, CMString().Format(TranslateT("minutes of %s mode"), statusMode));
}
+ if (statusModeList[i] == setting->lv2Status)
+ SendDlgItemMessage(hwndDlg, IDC_LV2STATUS, CB_SETCURSEL, (WPARAM)item, 0);
}
}
- SetDialogItems(hwndDlg, setting);
- break;
+ }
+ SetDialogItems(hwndDlg, setting);
+ break;
- case IDC_LV1STATUS:
- if (HIWORD(wParam) == CBN_SELCHANGE)
- SendMessage(GetParent(hwndDlg),PSM_CHANGED,0,0);
+ case IDC_LV1STATUS:
+ if (HIWORD(wParam) == CBN_SELCHANGE)
+ SendMessage(GetParent(hwndDlg),PSM_CHANGED,0,0);
- setting->lv1Status = (int)SendDlgItemMessage(hwndDlg, IDC_LV1STATUS, CB_GETITEMDATA, SendDlgItemMessage(hwndDlg, IDC_LV1STATUS, CB_GETCURSEL, 0, 0), 0);
- {
- TCHAR setNaStr[256];
- mir_sntprintf(setNaStr, SIZEOF(setNaStr), TranslateT("minutes of %s mode"), pcli->pfnGetStatusModeDescription(setting->lv1Status, 0));
- SetDlgItemText(hwndDlg, IDC_SETNASTR, setNaStr);
- }
- break;
+ setting->lv1Status = (int)SendDlgItemMessage(hwndDlg, IDC_LV1STATUS, CB_GETITEMDATA, SendDlgItemMessage(hwndDlg, IDC_LV1STATUS, CB_GETCURSEL, 0, 0), 0);
+ SetDlgItemText(hwndDlg, IDC_SETNASTR, CMString().Format(TranslateT("minutes of %s mode"), pcli->pfnGetStatusModeDescription(setting->lv1Status, 0)));
+ break;
- case IDC_LV2STATUS:
- if (HIWORD(wParam) == CBN_SELCHANGE)
- SendMessage(GetParent(hwndDlg),PSM_CHANGED,0,0);
+ case IDC_LV2STATUS:
+ if (HIWORD(wParam) == CBN_SELCHANGE)
+ SendMessage(GetParent(hwndDlg),PSM_CHANGED,0,0);
- setting->lv2Status = (int)SendDlgItemMessage(hwndDlg, IDC_LV2STATUS, CB_GETITEMDATA, SendDlgItemMessage(hwndDlg, IDC_LV2STATUS, CB_GETCURSEL, 0, 0), 0);
- break;
+ setting->lv2Status = (int)SendDlgItemMessage(hwndDlg, IDC_LV2STATUS, CB_GETITEMDATA, SendDlgItemMessage(hwndDlg, IDC_LV2STATUS, CB_GETCURSEL, 0, 0), 0);
+ break;
- case IDC_SCREENSAVE:
- setting->optionFlags^=FLAG_ONSAVER;
- SetDialogItems(hwndDlg, setting);
- break;
+ case IDC_FULLSCREEN:
+ setting->optionFlags ^= FLAG_FULLSCREEN;
+ SetDialogItems(hwndDlg, setting);
+ break;
- case IDC_ONLOCK:
- setting->optionFlags^=FLAG_ONLOCK;
- SetDialogItems(hwndDlg, setting);
- break;
+ case IDC_SCREENSAVE:
+ setting->optionFlags ^= FLAG_ONSAVER;
+ SetDialogItems(hwndDlg, setting);
+ break;
- case IDC_TIMED:
- setting->optionFlags^=FLAG_ONMOUSE;
- SetDialogItems(hwndDlg, setting);
- break;
+ case IDC_ONLOCK:
+ setting->optionFlags ^= FLAG_ONLOCK;
+ SetDialogItems(hwndDlg, setting);
+ break;
- case IDC_SETNA:
- setting->optionFlags^=FLAG_SETNA;
- SetDialogItems(hwndDlg, setting);
- break;
+ case IDC_TIMED:
+ setting->optionFlags ^= FLAG_ONMOUSE;
+ SetDialogItems(hwndDlg, setting);
+ break;
- case IDC_AWAYTIME:
- setting->awayTime = GetDlgItemInt(hwndDlg,IDC_AWAYTIME, NULL, FALSE);
- break;
+ case IDC_SETNA:
+ setting->optionFlags ^= FLAG_SETNA;
+ SetDialogItems(hwndDlg, setting);
+ break;
- case IDC_NATIME:
- setting->naTime = GetDlgItemInt(hwndDlg,IDC_NATIME, NULL, FALSE);
- break;
+ case IDC_AWAYTIME:
+ setting->awayTime = GetDlgItemInt(hwndDlg,IDC_AWAYTIME, NULL, FALSE);
+ break;
- case IDC_LV2ONINACTIVE:
- setting->optionFlags^=FLAG_LV2ONINACTIVE;
- SetDialogItems(hwndDlg, setting);
- break;
+ case IDC_NATIME:
+ setting->naTime = GetDlgItemInt(hwndDlg,IDC_NATIME, NULL, FALSE);
+ break;
- case IDC_CONFIRM:
- setting->optionFlags^=FLAG_CONFIRM;
- SetDialogItems(hwndDlg, setting);
- break;
+ case IDC_LV2ONINACTIVE:
+ setting->optionFlags^=FLAG_LV2ONINACTIVE;
+ SetDialogItems(hwndDlg, setting);
+ break;
- case IDC_RESETSTATUS:
- setting->optionFlags^=FLAG_RESET;
- SetDialogItems(hwndDlg, setting);
- break;
+ case IDC_CONFIRM:
+ setting->optionFlags^=FLAG_CONFIRM;
+ SetDialogItems(hwndDlg, setting);
+ break;
- case IDC_MONITORMIRANDA:
- setting->optionFlags^=FLAG_MONITORMIRANDA;
- SetDialogItems(hwndDlg, setting);
- break;
- }
+ case IDC_RESETSTATUS:
+ setting->optionFlags^=FLAG_RESET;
+ SetDialogItems(hwndDlg, setting);
+ break;
+
+ case IDC_MONITORMIRANDA:
+ setting->optionFlags^=FLAG_MONITORMIRANDA;
+ SetDialogItems(hwndDlg, setting);
break;
}
+ break;
case WM_SHOWWINDOW:
init = TRUE;
- {
- TAAAProtoSetting* setting = GetSetting(hwndDlg, sameSetting);
- if ( setting )
- SetDialogItems(hwndDlg, setting);
- }
+
+ if (setting = GetSetting(hwndDlg, sameSetting))
+ SetDialogItems(hwndDlg, setting);
+
SendMessage(hwndDlg, WM_COMMAND, (WPARAM)IDC_PROTOCOL, (LPARAM)0x11111111);
init = FALSE;
break;
@@ -311,24 +311,21 @@ static INT_PTR CALLBACK DlgProcAutoAwayRulesOpts(HWND hwndDlg, UINT msg, WPARAM
switch(((NMHDR*)lParam)->code) {
case LVN_ITEMCHANGED:
- {
- NMLISTVIEW *nmlv = (NMLISTVIEW *)lParam;
- if (IsWindowVisible(GetDlgItem(hwndDlg,IDC_STATUSLIST)) && ((nmlv->uNewState^nmlv->uOldState)&LVIS_STATEIMAGEMASK)) {
- SendMessage(GetParent(hwndDlg), PSM_CHANGED, 0, 0);
-
- TAAAProtoSetting* setting = GetSetting(hwndDlg, sameSetting);
- if ( setting ) {
- HWND hList=GetDlgItem(hwndDlg,IDC_STATUSLIST);
- LVITEM lvItem = { 0 };
- lvItem.mask = LVIF_PARAM;
- lvItem.iItem = nmlv->iItem;
- ListView_GetItem(hList, &lvItem);
- int pf2Status = lvItem.lParam;
- if (ListView_GetCheckState(hList, lvItem.iItem))
- setting->statusFlags |= pf2Status;
- else
- setting->statusFlags &= ~pf2Status;
- }
+ NMLISTVIEW *nmlv = (NMLISTVIEW*)lParam;
+ if (IsWindowVisible(GetDlgItem(hwndDlg, IDC_STATUSLIST)) && ((nmlv->uNewState ^ nmlv->uOldState) & LVIS_STATEIMAGEMASK)) {
+ SendMessage(GetParent(hwndDlg), PSM_CHANGED, 0, 0);
+
+ if (setting = GetSetting(hwndDlg, sameSetting)) {
+ HWND hList = GetDlgItem(hwndDlg, IDC_STATUSLIST);
+ LVITEM lvItem = { 0 };
+ lvItem.mask = LVIF_PARAM;
+ lvItem.iItem = nmlv->iItem;
+ ListView_GetItem(hList, &lvItem);
+ int pf2Status = lvItem.lParam;
+ if (ListView_GetCheckState(hList, lvItem.iItem))
+ setting->statusFlags |= pf2Status;
+ else
+ setting->statusFlags &= ~pf2Status;
}
}
break;
@@ -341,15 +338,15 @@ static INT_PTR CALLBACK DlgProcAutoAwayRulesOpts(HWND hwndDlg, UINT msg, WPARAM
if (bSettingSame)
WriteAutoAwaySetting(*sameSetting, SETTING_ALL);
else {
- for (int i=0; i < optionSettings->getCount(); i++ )
- WriteAutoAwaySetting((*optionSettings)[i], (*optionSettings)[i].szName);
+ for (int i=0; i < optionSettings.getCount(); i++ )
+ WriteAutoAwaySetting(optionSettings[i], optionSettings[i].szName);
}
- LoadOptions(*autoAwaySettings, FALSE);
+ LoadOptions(autoAwaySettings, FALSE);
}
break;
case WM_DESTROY:
- optionSettings->destroy();
+ optionSettings.destroy();
free(sameSetting);
break;
}
@@ -364,15 +361,15 @@ static INT_PTR CALLBACK DlgProcAutoAwayGeneralOpts(HWND hwndDlg, UINT msg, WPARA
switch (msg) {
case WM_INITDIALOG:
TranslateDialogDefault(hwndDlg);
- CheckDlgButton(hwndDlg, IDC_IGNLOCK, db_get_b(NULL, MODULENAME, SETTING_IGNLOCK, FALSE)?BST_CHECKED:BST_UNCHECKED);
- CheckDlgButton(hwndDlg, IDC_IGNSYSKEYS, db_get_b(NULL, MODULENAME, SETTING_IGNSYSKEYS, FALSE)?BST_CHECKED:BST_UNCHECKED);
- CheckDlgButton(hwndDlg, IDC_IGNALTCOMBO, db_get_b(NULL, MODULENAME, SETTING_IGNALTCOMBO, FALSE)?BST_CHECKED:BST_UNCHECKED);
+ CheckDlgButton(hwndDlg, IDC_IGNLOCK, db_get_b(NULL, MODULENAME, SETTING_IGNLOCK, FALSE) != 0);
+ CheckDlgButton(hwndDlg, IDC_IGNSYSKEYS, db_get_b(NULL, MODULENAME, SETTING_IGNSYSKEYS, FALSE) != 0);
+ CheckDlgButton(hwndDlg, IDC_IGNALTCOMBO, db_get_b(NULL, MODULENAME, SETTING_IGNALTCOMBO, FALSE) != 0);
+ CheckDlgButton(hwndDlg, IDC_MONITORMOUSE, db_get_b(NULL, MODULENAME, SETTING_MONITORMOUSE, TRUE) != 0);
+ CheckDlgButton(hwndDlg, IDC_MONITORKEYBOARD, db_get_b(NULL, MODULENAME, SETTING_MONITORKEYBOARD, TRUE) != 0);
SetDlgItemInt(hwndDlg, IDC_AWAYCHECKTIMEINSECS, db_get_w(NULL, MODULENAME, SETTING_AWAYCHECKTIMEINSECS, 5), FALSE);
SetDlgItemInt(hwndDlg, IDC_CONFIRMDELAY, db_get_w(NULL, MODULENAME, SETTING_CONFIRMDELAY, 5), FALSE);
- CheckDlgButton(hwndDlg, bSettingSame?IDC_SAMESETTINGS:IDC_PERPROTOCOLSETTINGS, BST_CHECKED);
- CheckDlgButton(hwndDlg, IDC_MONITORMOUSE, db_get_b(NULL, MODULENAME, SETTING_MONITORMOUSE, TRUE)?BST_CHECKED:BST_UNCHECKED);
- CheckDlgButton(hwndDlg, IDC_MONITORKEYBOARD, db_get_b(NULL, MODULENAME, SETTING_MONITORKEYBOARD, TRUE)?BST_CHECKED:BST_UNCHECKED);
- ShowWindow(GetDlgItem(hwndDlg, IDC_IDLEWARNING), (db_get_b(NULL, "Idle", "AAEnable", 0)));
+ CheckDlgButton(hwndDlg, bSettingSame ? IDC_SAMESETTINGS : IDC_PERPROTOCOLSETTINGS, BST_CHECKED);
+ ShowWindow(GetDlgItem(hwndDlg, IDC_IDLEWARNING), db_get_b(NULL, "Idle", "AAEnable", 0));
break;
case WM_SHOWWINDOW:
@@ -409,7 +406,7 @@ static INT_PTR CALLBACK DlgProcAutoAwayGeneralOpts(HWND hwndDlg, UINT msg, WPARA
db_set_w(NULL, MODULENAME, SETTING_CONFIRMDELAY, (WORD)GetDlgItemInt(hwndDlg, IDC_CONFIRMDELAY, NULL, FALSE));
db_set_b(NULL, MODULENAME, SETTING_MONITORMOUSE, (BYTE)IsDlgButtonChecked(hwndDlg, IDC_MONITORMOUSE));
db_set_b(NULL, MODULENAME, SETTING_MONITORKEYBOARD, (BYTE)IsDlgButtonChecked(hwndDlg, IDC_MONITORKEYBOARD));
- LoadOptions(*autoAwaySettings, FALSE);
+ LoadOptions(autoAwaySettings, FALSE);
}
break;
}
@@ -423,24 +420,22 @@ static INT_PTR CALLBACK DlgProcAutoAwayTabs(HWND hwndDlg, UINT msg, WPARAM wPara
{
switch(msg) {
case WM_INITDIALOG:
+ TranslateDialogDefault(hwndDlg);
{
- int tabCount;
- HWND hTab, hShow, hPage;
- TCITEM tci;
RECT rcTabs, rcOptions, rcPage;
-
- TranslateDialogDefault(hwndDlg);
bSettingSame = db_get_b(NULL, MODULENAME, SETTING_SAMESETTINGS, FALSE);
+
// set tabs
- tabCount = 0;
- hTab = GetDlgItem(hwndDlg, IDC_TABS);
+ int tabCount = 0;
+ HWND hTab = GetDlgItem(hwndDlg, IDC_TABS);
GetWindowRect(hTab, &rcTabs);
GetWindowRect(hwndDlg, &rcOptions);
- ZeroMemory(&tci, sizeof(TCITEM));
+
// general tab
- tci.mask = TCIF_TEXT|TCIF_PARAM;
+ TCITEM tci = { 0 };
+ tci.mask = TCIF_TEXT | TCIF_PARAM;
tci.pszText = TranslateT("General");
- hPage = CreateDialogParam(hInst, MAKEINTRESOURCE(IDD_OPT_GENAUTOAWAY), hwndDlg, DlgProcAutoAwayGeneralOpts, (LPARAM)GetParent(hwndDlg));
+ HWND hPage = CreateDialogParam(hInst, MAKEINTRESOURCE(IDD_OPT_GENAUTOAWAY), hwndDlg, DlgProcAutoAwayGeneralOpts, (LPARAM)GetParent(hwndDlg));
EnableThemeDialogTexture(hPage, ETDT_ENABLETAB);
tci.lParam = (LPARAM)hPage;
@@ -448,7 +443,8 @@ static INT_PTR CALLBACK DlgProcAutoAwayTabs(HWND hwndDlg, UINT msg, WPARAM wPara
MoveWindow(hPage, (rcTabs.left - rcOptions.left) + ((rcTabs.right-rcTabs.left)-(rcPage.right-rcPage.left))/2, 10 + (rcTabs.top - rcOptions.top) + ((rcTabs.bottom-rcTabs.top)-(rcPage.bottom-rcPage.top))/2, rcPage.right-rcPage.left, rcPage.bottom-rcPage.top, TRUE);
ShowWindow(hPage, SW_HIDE);
TabCtrl_InsertItem(hTab, tabCount++, &tci);
- hShow = hPage;
+ HWND hShow = hPage;
+
// rules tab
tci.mask = TCIF_TEXT|TCIF_PARAM;
tci.pszText = TranslateT("Rules");
@@ -460,6 +456,7 @@ static INT_PTR CALLBACK DlgProcAutoAwayTabs(HWND hwndDlg, UINT msg, WPARAM wPara
MoveWindow(hPage, (rcTabs.left - rcOptions.left) + ((rcTabs.right-rcTabs.left)-(rcPage.right-rcPage.left))/2, 10 + (rcTabs.top - rcOptions.top) + ((rcTabs.bottom-rcTabs.top)-(rcPage.bottom-rcPage.top))/2, rcPage.right-rcPage.left, rcPage.bottom-rcPage.top, TRUE);
ShowWindow(hPage, SW_HIDE);
TabCtrl_InsertItem(hTab, tabCount++, &tci);
+
// messages tab
tci.mask = TCIF_TEXT|TCIF_PARAM;
tci.pszText = TranslateT("Status messages");
@@ -481,7 +478,7 @@ static INT_PTR CALLBACK DlgProcAutoAwayTabs(HWND hwndDlg, UINT msg, WPARAM wPara
break;
case WM_NOTIFY:
- if ( (((NMHDR*)lParam)->idFrom == IDC_TABS)) {
+ if ((((NMHDR*)lParam)->idFrom == IDC_TABS)) {
if (((NMHDR*)lParam)->code == TCN_SELCHANGING) {
TCITEM tci;
@@ -499,15 +496,13 @@ static INT_PTR CALLBACK DlgProcAutoAwayTabs(HWND hwndDlg, UINT msg, WPARAM wPara
}
if (((LPNMHDR)lParam)->code == PSN_APPLY) {
TCITEM tci;
- int i, count;
-
tci.mask = TCIF_PARAM;
- count = TabCtrl_GetItemCount(GetDlgItem(hwndDlg, IDC_TABS));
- for (i=0; i < count; i++ ) {
- TabCtrl_GetItem(GetDlgItem(hwndDlg,IDC_TABS), i, &tci);
+ int count = TabCtrl_GetItemCount(GetDlgItem(hwndDlg, IDC_TABS));
+ for (int i = 0; i < count; i++) {
+ TabCtrl_GetItem(GetDlgItem(hwndDlg, IDC_TABS), i, &tci);
SendMessage((HWND)tci.lParam, WM_NOTIFY, 0, lParam);
- } }
-
+ }
+ }
break;
}
diff --git a/plugins/StatusPlugins/AdvancedAutoAway/version.h b/plugins/StatusPlugins/AdvancedAutoAway/version.h
index 4707c06e9b..b2dd6a1b63 100644
--- a/plugins/StatusPlugins/AdvancedAutoAway/version.h
+++ b/plugins/StatusPlugins/AdvancedAutoAway/version.h
@@ -1,40 +1,22 @@
-// Set the version number here - it will affect the version resource and the version field of the pluginInfo structure
-// (Be careful that you don't have the resource file open when you change this and rebuild, otherwise the changes may not
-// take effect within the version resource)
-// Do not forget to define symbol "_DEBUG" for resource compiler if you use debug configuration (in VisualStudio you can
-// find it under Project properties - Configuration properties - Resource - General - Preprocessor definitions)
-
// plugin version part
-#define __MAJOR_VERSION 0
-#define __MINOR_VERSION 8
-#define __RELEASE_NUM 0
-#define __BUILD_NUM 42
+#define __MAJOR_VERSION 0
+#define __MINOR_VERSION 8
+#define __RELEASE_NUM 1
+#define __BUILD_NUM 0
// stuff that will be used in PluginInfo section and in Version resource
-#define __PLUGIN_NAME "Advanced Auto Away"
-#define __FILENAME "AdvancedAutoAway.dll"
-#define __DESC "An Auto Away module with some more options than the original."
-#define __AUTHOR "P Boon"
-#define __AUTHOREMAIL "unregistered@users.sourceforge.net"
-#define __AUTHORWEB "http://miranda-ng.org/p/AdvancedAutoAway/"
-#define __COPYRIGHT "(c) 2003-08 P. Boon, 2008-11 George Hazan"
+#define __PLUGIN_NAME "Advanced Auto Away"
+#define __FILENAME "AdvancedAutoAway.dll"
+#define __DESC "An Auto Away module with some more options than the original."
+#define __AUTHOR "P Boon"
+#define __AUTHOREMAIL "unregistered@users.sourceforge.net"
+#define __AUTHORWEB "http://miranda-ng.org/p/AdvancedAutoAway/"
+#define __COPYRIGHT "(c) 2003-08 P. Boon, 2008-11 George Hazan"
// other stuff for Version resource
-#define __STRINGIFY_IMPL(x) #x
-#define __STRINGIFY(x) __STRINGIFY_IMPL(x)
+#define __STRINGIFY_IMPL(x) #x
+#define __STRINGIFY(x) __STRINGIFY_IMPL(x)
-#define __FILEVERSION_STRING __MAJOR_VERSION,__MINOR_VERSION,__RELEASE_NUM,__BUILD_NUM
-#define __FILEVERSION_STRING_DOTS __MAJOR_VERSION.__MINOR_VERSION.__RELEASE_NUM.__BUILD_NUM
-#ifdef _UNICODE
-#ifdef __REV_NUM
-#define __VERSION_STRING __STRINGIFY(__FILEVERSION_STRING_DOTS rev. __REV_NUM Unicode)
-#else
-#define __VERSION_STRING __STRINGIFY(__FILEVERSION_STRING_DOTS Unicode)
-#endif
-#else
-#ifdef __REV_NUM
-#define __VERSION_STRING __STRINGIFY(__FILEVERSION_STRING_DOTS rev. __REV_NUM)
-#else
-#define __VERSION_STRING __STRINGIFY(__FILEVERSION_STRING_DOTS)
-#endif
-#endif
+#define __FILEVERSION_STRING __MAJOR_VERSION,__MINOR_VERSION,__RELEASE_NUM,__BUILD_NUM
+#define __FILEVERSION_STRING_DOTS __MAJOR_VERSION.__MINOR_VERSION.__RELEASE_NUM.__BUILD_NUM
+#define __VERSION_STRING __STRINGIFY(__FILEVERSION_STRING_DOTS)
diff --git a/plugins/StatusPlugins/resource.h b/plugins/StatusPlugins/resource.h
index db638a1734..e64104da80 100644
--- a/plugins/StatusPlugins/resource.h
+++ b/plugins/StatusPlugins/resource.h
@@ -150,6 +150,8 @@
#define IDC_AWAYTIME 1147
#define IDC_SETNA 1148
#define IDC_NATIME 1149
+#define IDC_SCREENSAVE2 1150
+#define IDC_FULLSCREEN 1150
#define IDC_RADUSEMIRANDA 1210
#define IDC_RADUSECUSTOM 1212
#define IDC_SETNASTR 1568
diff --git a/plugins/StatusPlugins/resource.rc b/plugins/StatusPlugins/resource.rc
index 06bf95ba66..6a8462e0fb 100644
--- a/plugins/StatusPlugins/resource.rc
+++ b/plugins/StatusPlugins/resource.rc
@@ -94,27 +94,28 @@ STYLE DS_SETFONT | DS_FIXEDSYS | WS_CHILD
EXSTYLE WS_EX_CONTROLPARENT
FONT 8, "MS Shell Dlg", 0, 0, 0x1
BEGIN
- CONTROL "after",IDC_TIMED,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,16,83,32,8
- EDITTEXT IDC_AWAYTIME,51,81,26,12,ES_AUTOHSCROLL
- LTEXT "minutes of inactivity",IDC_LV1AFTERSTR,82,83,87,8
- EDITTEXT IDC_NATIME,51,114,26,12,ES_AUTOHSCROLL
- LTEXT "minutes of level 1 mode",IDC_SETNASTR,82,116,86,8
- CONTROL "Confirm resetting status",IDC_CONFIRM,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,9,181,168,10
LTEXT "Account",IDC_STATIC,9,11,78,8
+ COMBOBOX IDC_PROTOCOL,177,9,100,138,CBS_DROPDOWNLIST | CBS_SORT | WS_VSCROLL | WS_TABSTOP
+ LTEXT "Set",IDC_STATIC,11,41,27,8
COMBOBOX IDC_LV1STATUS,41,39,65,101,CBS_DROPDOWNLIST | WS_VSCROLL | WS_TABSTOP
- COMBOBOX IDC_LV2STATUS,41,97,65,101,CBS_DROPDOWNLIST | WS_VSCROLL | WS_TABSTOP
+ CONTROL "when full-screen mode is active",IDC_FULLSCREEN,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,16,60,152,10
+ CONTROL "when screen saver engages",IDC_SCREENSAVE,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,16,73,152,10
+ CONTROL "when workstation is locked",IDC_ONLOCK,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,16,86,153,10
+ CONTROL "after",IDC_TIMED,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,16,100,32,8
+ EDITTEXT IDC_AWAYTIME,51,98,26,12,ES_AUTOHSCROLL
+ LTEXT "minutes of inactivity",IDC_LV1AFTERSTR,82,100,87,8
+ LTEXT "Set",IDC_STATIC,11,115,27,8
+ COMBOBOX IDC_LV2STATUS,41,113,65,101,CBS_DROPDOWNLIST | WS_VSCROLL | WS_TABSTOP
+ CONTROL "after",IDC_SETNA,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,16,131,32,8
+ EDITTEXT IDC_NATIME,51,129,26,12,ES_AUTOHSCROLL
+ LTEXT "minutes of level 1 mode",IDC_SETNASTR,82,131,86,8
+ CONTROL "only set when inactive",IDC_LV2ONINACTIVE,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,16,143,151,10
+ CONTROL "Monitor Miranda's activity only",IDC_MONITORMIRANDA,
+ "Button",BS_AUTOCHECKBOX | WS_TABSTOP,9,155,168,12
+ CONTROL "Reset status on return",IDC_RESETSTATUS,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,9,168,168,11
+ CONTROL "Confirm resetting status",IDC_CONFIRM,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,9,181,168,10
LTEXT "Only set if current status is",IDC_STATIC,180,42,95,8
CONTROL "",IDC_STATUSLIST,"SysListView32",LVS_REPORT | LVS_SINGLESEL | LVS_SHOWSELALWAYS | LVS_ALIGNLEFT | LVS_NOCOLUMNHEADER | WS_BORDER | WS_TABSTOP,177,55,100,84
- CONTROL "Monitor Miranda's activity only",IDC_MONITORMIRANDA,
- "Button",BS_AUTOCHECKBOX | WS_TABSTOP,9,152,168,10
- CONTROL "Reset status on return",IDC_RESETSTATUS,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,9,166,168,10
- CONTROL "when screen saver engages",IDC_SCREENSAVE,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,16,55,152,10
- LTEXT "Set",IDC_STATIC,11,41,27,8
- CONTROL "after",IDC_SETNA,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,16,116,32,8
- LTEXT "Set",IDC_STATIC,11,100,27,8
- CONTROL "only set when inactive",IDC_LV2ONINACTIVE,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,16,129,151,10
- CONTROL "when workstation is locked",IDC_ONLOCK,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,16,68,153,10
- COMBOBOX IDC_PROTOCOL,177,9,100,138,CBS_DROPDOWNLIST | CBS_SORT | WS_VSCROLL | WS_TABSTOP
END
IDD_CMDLOPTIONS DIALOGEX 0, 0, 315, 82
@@ -374,6 +375,10 @@ BEGIN
BEGIN
END
+ IDD_OPT_AUTOAWAY, DIALOG
+ BEGIN
+ END
+
IDD_OPT_TABS, DIALOG
BEGIN
BOTTOMMARGIN, 248