diff options
-rw-r--r-- | plugins/KeyboardNotify/EnumProc.c | 28 | ||||
-rw-r--r-- | plugins/KeyboardNotify/EnumProc.h | 2 | ||||
-rw-r--r-- | plugins/KeyboardNotify/constants.h | 162 | ||||
-rw-r--r-- | plugins/KeyboardNotify/flash.c | 98 | ||||
-rw-r--r-- | plugins/KeyboardNotify/flash.h | 8 | ||||
-rw-r--r-- | plugins/KeyboardNotify/ignore.c | 4 | ||||
-rw-r--r-- | plugins/KeyboardNotify/keyboard.c | 14 | ||||
-rw-r--r-- | plugins/KeyboardNotify/main.c | 66 | ||||
-rw-r--r-- | plugins/KeyboardNotify/options.c | 2661 | ||||
-rw-r--r-- | plugins/KeyboardNotify/protolist.h | 38 | ||||
-rw-r--r-- | plugins/KeyboardNotify/trigger.c | 2 | ||||
-rw-r--r-- | plugins/KeyboardNotify/utils.c | 8 | ||||
-rw-r--r-- | plugins/KeyboardNotify/utils.h | 2 |
13 files changed, 1546 insertions, 1547 deletions
diff --git a/plugins/KeyboardNotify/EnumProc.c b/plugins/KeyboardNotify/EnumProc.c index df085629eb..d1d2d6f8c5 100644 --- a/plugins/KeyboardNotify/EnumProc.c +++ b/plugins/KeyboardNotify/EnumProc.c @@ -25,9 +25,9 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. #include "EnumProc.h"
-BOOL findFilename(char *);
-char *filename(char *);
-BOOL WINAPI Enum16(DWORD, WORD, WORD, char *, char *, LPARAM);
+BOOL findFilename(TCHAR *);
+TCHAR *filename(TCHAR *);
+BOOL WINAPI Enum16(DWORD, WORD, WORD, TCHAR *, TCHAR *, LPARAM);
// Globals
@@ -102,7 +102,7 @@ BOOL areThereProcessesRunning(void) DWORD dwIndex;
HMODULE hMod;
HANDLE hProcess;
- char szFileName[MAX_PATH+1];
+ TCHAR szFileName[MAX_PATH+1];
if (!ProcessList.count) // Process list is empty
@@ -144,7 +144,7 @@ BOOL areThereProcessesRunning(void) // Loop through each ProcID.
for (dwIndex = 0; dwIndex < dwSize; dwIndex++) {
- char *szFileNameAux;
+ TCHAR *szFileNameAux;
szFileName[0] = '\0';
// Open the process (if we can... security does not permit every process in the system to be opened).
@@ -168,7 +168,7 @@ BOOL areThereProcessesRunning(void) }
// Did we just bump into an NTVDM?
- if (!_stricmp(szFileNameAux, "NTVDM.EXE")) {
+ if (!_wcsicmp(szFileNameAux, L"NTVDM.EXE")) {
BOOL bFound = FALSE;
// Enum the 16-bit stuff.
@@ -195,14 +195,14 @@ BOOL areThereProcessesRunning(void) // While there are processes, keep looping.
for (procentry.dwSize=sizeof(PROCESSENTRY32), bFlag=lpfProcess32First(hSnapShot, &procentry); bFlag; procentry.dwSize=sizeof(PROCESSENTRY32), bFlag=lpfProcess32Next(hSnapShot, &procentry)) {
- char *szFileNameAux = filename(procentry.szExeFile);
+ TCHAR *szFileNameAux = filename(procentry.szExeFile);
// Search szFileName in user-defined list
if (findFilename(szFileNameAux))
return TRUE;
// Did we just bump into an NTVDM?
- if (lpfVDMEnumTaskWOWEx && !_stricmp(szFileNameAux, "NTVDM.EXE")) {
+ if (lpfVDMEnumTaskWOWEx && !_wcsicmp(szFileNameAux, L"NTVDM.EXE")) {
BOOL bFound = FALSE;
// Enum the 16-bit stuff.
@@ -219,7 +219,7 @@ BOOL areThereProcessesRunning(void) }
-BOOL WINAPI Enum16(DWORD dwThreadId, WORD hMod16, WORD hTask16, char *szModName, char *szFileName, LPARAM lpUserDefined)
+BOOL WINAPI Enum16(DWORD dwThreadId, WORD hMod16, WORD hTask16, TCHAR *szModName, TCHAR *szFileName, LPARAM lpUserDefined)
{
BOOL bRet;
BOOL *pbFound = (BOOL *)lpUserDefined;
@@ -231,23 +231,23 @@ BOOL WINAPI Enum16(DWORD dwThreadId, WORD hMod16, WORD hTask16, char *szModName, }
-BOOL findFilename(char *fileName)
+BOOL findFilename(TCHAR *fileName)
{
unsigned int i;
for (i=0; i < ProcessList.count; i++)
- if (ProcessList.szFileName[i] && !_stricmp(ProcessList.szFileName[i], fileName))
+ if (ProcessList.szFileName[i] && !_wcsicmp(ProcessList.szFileName[i], fileName))
return TRUE;
return FALSE;
}
-char *filename(char *fullFileName)
+TCHAR *filename(TCHAR *fullFileName)
{
- char *str;
+ TCHAR *str;
- str = strrchr(fullFileName, '\\');
+ str = wcsrchr(fullFileName, '\\');
if (!str)
return fullFileName;
diff --git a/plugins/KeyboardNotify/EnumProc.h b/plugins/KeyboardNotify/EnumProc.h index f7e6a4283b..09b3cba8d6 100644 --- a/plugins/KeyboardNotify/EnumProc.h +++ b/plugins/KeyboardNotify/EnumProc.h @@ -18,7 +18,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. typedef struct {
unsigned int count;
- char **szFileName;
+ TCHAR **szFileName;
} PROCESS_LIST;
diff --git a/plugins/KeyboardNotify/constants.h b/plugins/KeyboardNotify/constants.h index 2f339d07a6..d50ded6d23 100644 --- a/plugins/KeyboardNotify/constants.h +++ b/plugins/KeyboardNotify/constants.h @@ -1,84 +1,84 @@ -/* - -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. - -*/ - -// Settings values -#define KEYBDMODULE "keybdnotify" -#define FLASH_SAMETIME 0 -#define FLASH_INTURN 1 -#define FLASH_INSEQUENCE 2 -#define FLASH_CUSTOM 3 -#define FLASH_TRILLIAN 4 -#define SEQ_LEFT2RIGHT 0 -#define SEQ_RIGHT2LEFT 1 -#define SEQ_LIKEKIT 2 -#define ACTIVE_MIRANDA 0 -#define ACTIVE_WINDOWS 1 -// Until settings map -#define UNTIL_NBLINKS 1 -#define UNTIL_REATTENDED 2 -#define UNTIL_EVENTSOPEN 4 -#define UNTIL_CONDITIONS 8 - -// Status map -#define MAP_ONLINE 1 -#define MAP_AWAY 2 -#define MAP_NA 4 -#define MAP_OCCUPIED 8 -#define MAP_DND 16 -#define MAP_FREECHAT 32 -#define MAP_INVISIBLE 64 -#define MAP_ONTHEPHONE 128 -#define MAP_OUTTOLUNCH 256 -#define MAP_OFFLINE 512 - -// Default settings -#define DEF_SETTING_ONMSG 1 // 1: Yes, 0: No -#define DEF_SETTING_ONURL 1 // 1: Yes, 0: No -#define DEF_SETTING_ONFILE 1 // 1: Yes, 0: No -#define DEF_SETTING_OTHER 1 // 1: Yes, 0: No -#define DEF_SETTING_FSCREEN 1 // 1: Yes, 0: No -#define DEF_SETTING_SSAVER 1 // 1: Yes, 0: No -#define DEF_SETTING_LOCKED 1 // 1: Yes, 0: No -#define DEF_SETTING_PROCS 0 // 1: Yes, 0: No -#define DEF_SETTING_ACTIVE 1 // 1: Yes, 0: No -#define DEF_SETTING_IFMSGOPEN 1 // 1: Yes, 0: No -#define DEF_SETTING_IFMSGNOTTOP 0 // 1: Yes, 0: No -#define DEF_SETTING_IFMSGOLDER 0 // 1: Yes, 0: No -#define DEF_SETTING_SECSOLDER 10 // Seconds -#define DEF_SETTING_FLASHUNTIL 2 // 1 = After x blinks, 2 = Until Miranda/Windows become active, 4 = Events are opened, 8 = Until end of 'notify when' conditions -#define DEF_SETTING_NBLINKS 4 // Seconds -#define DEF_SETTING_MIRORWIN 0 // 0-1, 0 = Miranda becomes active, 1 = Windows becomes active -#define DEF_SETTING_STATUS 1023 // 1023 = All -#define DEF_SETTING_CHECKTIME 0 // Minutes, 0 = don't check -#define DEF_SETTING_FLASHCAPS 1 // 1: Yes, 0: No -#define DEF_SETTING_FLASHNUM 1 // 1: Yes, 0: No -#define DEF_SETTING_FLASHSCROLL 1 // 1: Yes, 0: No -#define DEF_SETTING_FLASHEFFECT 0 // 0-3, 0 = All together, 1 = In turn, 2 = In sequence, 3 = Custom Theme, 4 = Trillian-like sequences -#define DEF_SETTING_SEQORDER 0 // 0-2, 0 = left to right, 1 = right to left, 2 = left <-> right -#define DEF_SETTING_CUSTOMTHEME 0 // Theme number -#define DEF_SETTING_LEDSMSG 2 // 2: Num Lock -#define DEF_SETTING_LEDSFILE 4 // 2: Caps Lock -#define DEF_SETTING_LEDSURL 1 // 2: Scroll Lock -#define DEF_SETTING_LEDSOTHER 7 // 2: Num Lock + Caps Lock + Scroll Lock -#define DEF_SETTING_STARTDELAY 2 // Seconds -#define DEF_SETTING_FLASHSPEED 3 // 0-5, 0 = really slow, 5 = really fast -#define DEF_SETTING_KEYPRESSES 0 // 1: Yes, 0: No -#define DEF_SETTING_OVERRIDE 0 // 1: Yes, 0: No +/*
+
+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.
+
+*/
+
+// Settings values
+#define KEYBDMODULE "keybdnotify"
+#define FLASH_SAMETIME 0
+#define FLASH_INTURN 1
+#define FLASH_INSEQUENCE 2
+#define FLASH_CUSTOM 3
+#define FLASH_TRILLIAN 4
+#define SEQ_LEFT2RIGHT 0
+#define SEQ_RIGHT2LEFT 1
+#define SEQ_LIKEKIT 2
+#define ACTIVE_MIRANDA 0
+#define ACTIVE_WINDOWS 1
+// Until settings map
+#define UNTIL_NBLINKS 1
+#define UNTIL_REATTENDED 2
+#define UNTIL_EVENTSOPEN 4
+#define UNTIL_CONDITIONS 8
+
+// Status map
+#define MAP_ONLINE 1
+#define MAP_AWAY 2
+#define MAP_NA 4
+#define MAP_OCCUPIED 8
+#define MAP_DND 16
+#define MAP_FREECHAT 32
+#define MAP_INVISIBLE 64
+#define MAP_ONTHEPHONE 128
+#define MAP_OUTTOLUNCH 256
+#define MAP_OFFLINE 512
+
+// Default settings
+#define DEF_SETTING_ONMSG 1 // 1: Yes, 0: No
+#define DEF_SETTING_ONURL 1 // 1: Yes, 0: No
+#define DEF_SETTING_ONFILE 1 // 1: Yes, 0: No
+#define DEF_SETTING_OTHER 1 // 1: Yes, 0: No
+#define DEF_SETTING_FSCREEN 1 // 1: Yes, 0: No
+#define DEF_SETTING_SSAVER 1 // 1: Yes, 0: No
+#define DEF_SETTING_LOCKED 1 // 1: Yes, 0: No
+#define DEF_SETTING_PROCS 0 // 1: Yes, 0: No
+#define DEF_SETTING_ACTIVE 1 // 1: Yes, 0: No
+#define DEF_SETTING_IFMSGOPEN 1 // 1: Yes, 0: No
+#define DEF_SETTING_IFMSGNOTTOP 0 // 1: Yes, 0: No
+#define DEF_SETTING_IFMSGOLDER 0 // 1: Yes, 0: No
+#define DEF_SETTING_SECSOLDER 10 // Seconds
+#define DEF_SETTING_FLASHUNTIL 2 // 1 = After x blinks, 2 = Until Miranda/Windows become active, 4 = Events are opened, 8 = Until end of 'notify when' conditions
+#define DEF_SETTING_NBLINKS 4 // Seconds
+#define DEF_SETTING_MIRORWIN 0 // 0-1, 0 = Miranda becomes active, 1 = Windows becomes active
+#define DEF_SETTING_STATUS 1023 // 1023 = All
+#define DEF_SETTING_CHECKTIME 0 // Minutes, 0 = don't check
+#define DEF_SETTING_FLASHCAPS 1 // 1: Yes, 0: No
+#define DEF_SETTING_FLASHNUM 1 // 1: Yes, 0: No
+#define DEF_SETTING_FLASHSCROLL 1 // 1: Yes, 0: No
+#define DEF_SETTING_FLASHEFFECT 0 // 0-3, 0 = All together, 1 = In turn, 2 = In sequence, 3 = Custom Theme, 4 = Trillian-like sequences
+#define DEF_SETTING_SEQORDER 0 // 0-2, 0 = left to right, 1 = right to left, 2 = left <-> right
+#define DEF_SETTING_CUSTOMTHEME 0 // Theme number
+#define DEF_SETTING_LEDSMSG 2 // 2: Num Lock
+#define DEF_SETTING_LEDSFILE 4 // 2: Caps Lock
+#define DEF_SETTING_LEDSURL 1 // 2: Scroll Lock
+#define DEF_SETTING_LEDSOTHER 7 // 2: Num Lock + Caps Lock + Scroll Lock
+#define DEF_SETTING_STARTDELAY 2 // Seconds
+#define DEF_SETTING_FLASHSPEED 3 // 0-5, 0 = really slow, 5 = really fast
+#define DEF_SETTING_KEYPRESSES 0 // 1: Yes, 0: No
+#define DEF_SETTING_OVERRIDE 0 // 1: Yes, 0: No
#define DEF_SETTING_TESTNUM 2 // Number of sequences to test before stopping
#define DEF_SETTING_TESTSECS 2 // Seconds to test before stopping
#define DEF_SETTING_PROTOCOL 1 // 1: Yes, 0: No
diff --git a/plugins/KeyboardNotify/flash.c b/plugins/KeyboardNotify/flash.c index f2bb647a89..515f39bbb3 100644 --- a/plugins/KeyboardNotify/flash.c +++ b/plugins/KeyboardNotify/flash.c @@ -41,7 +41,7 @@ FLASHING_SEQUENCE *getTrillianSeq(void); void updateTrillianSeq(void);
static void TestThread(FLASHING_SEQUENCE *);
static void PreviewThread(void *);
-FLASHING_SEQUENCE str2FS(char *);
+FLASHING_SEQUENCE str2FS(TCHAR *);
BYTE KbdChar2Byte(char);
void countUnopenEvents(int *, int *, int *, int *);
@@ -104,12 +104,12 @@ FLASHING_SEQUENCE *getCustomSeq(void) static FLASHING_SEQUENCE Custom = {0};
DBVARIANT dbv;
- char customStr[MAX_PATH+1];
+ TCHAR customStr[MAX_PATH+1];
- customStr[0] = '\0';
+ customStr[0] = _T('\0');
if(!DBGetContactSetting(NULL, KEYBDMODULE, fmtDBSettingName("custom%d", wCustomTheme), &dbv)) {
- strcpy(customStr, dbv.pszVal);
+ wcscpy(customStr, dbv.pwszVal);
DBFreeVariant(&dbv);
}
@@ -220,14 +220,14 @@ void updateTrillianSeq(void) }
-void useExternSequence(char *extStr)
+void useExternSequence(TCHAR *extStr)
{
static FLASHING_SEQUENCE Extern = {0};
- char externStr[MAX_PATH+1];
+ TCHAR externStr[MAX_PATH+1];
- strcpy(externStr, extStr);
+ wcscpy(externStr, extStr);
Extern = str2FS(normalizeCustomString(externStr));
@@ -236,103 +236,103 @@ void useExternSequence(char *extStr) }
-char *normalizeCustomString(char *customStr)
+TCHAR *normalizeCustomString(TCHAR *customStr)
{
int len=0, status=0;
BOOL used[4];
- char strAux[MAX_PATH+1], *str;
+ TCHAR strAux[MAX_PATH+1], *str;
- for (strcpy(str=strAux, customStr); *str; str++)
+ for (wcscpy(str=strAux, customStr); *str; str++)
switch (*str) {
- case '[':
+ case _T('['):
if (status == 0) {
status = 1;
customStr[len++] = *str;
used[0] = used [1] = used[2] = used[3] = FALSE;
}
break;
- case ']':
+ case _T(']'):
if (status == 1) {
status = 0;
customStr[len++] = *str;
}
break;
- case '0':
- case '1':
- case '2':
- case '3':
+ case _T('0'):
+ case _T('1'):
+ case _T('2'):
+ case _T('3'):
if (status == 0)
customStr[len++] = *str;
else
- if (!used[*str - '0']) {
+ if (!used[*str - _T('0')]) {
customStr[len++] = *str;
- used[*str - '0'] = TRUE;
+ used[*str - _T('0')] = TRUE;
}
break;
}
if (status == 1)
- customStr[len++] = ']';
- customStr[len] = '\0';
+ customStr[len++] = _T(']');
+ customStr[len] = _T('\0');
return customStr;
}
-char *getCurrentSequenceString(void)
+TCHAR *getCurrentSequenceString(void)
{
- static char CurrentSeqString[MAX_PATH+1];
+ static TCHAR CurrentSeqString[MAX_PATH+1];
unsigned int i;
- char *str;
+ TCHAR *str;
for (i=0, str=CurrentSeqString; i < pFS->size; i++)
switch (pFS->frame[i]) {
case 0:
- *(str++) = '0';
+ *(str++) = _T('0');
break;
case 1:
- *(str++) = '3';
+ *(str++) = _T('3');
break;
case 2:
- *(str++) = '1';
+ *(str++) = _T('1');
break;
case 3:
- *(str++) = '[';
- *(str++) = '1';
- *(str++) = '3';
- *(str++) = ']';
+ *(str++) = _T('[');
+ *(str++) = _T('1');
+ *(str++) = _T('3');
+ *(str++) = _T(']');
break;
case 4:
- *(str++) = '2';
+ *(str++) = _T('2');
break;
case 5:
- *(str++) = '[';
- *(str++) = '2';
- *(str++) = '3';
- *(str++) = ']';
+ *(str++) = _T('[');
+ *(str++) = _T('2');
+ *(str++) = _T('3');
+ *(str++) = _T(']');
break;
case 6:
- *(str++) = '[';
- *(str++) = '1';
- *(str++) = '2';
- *(str++) = ']';
+ *(str++) = _T('[');
+ *(str++) = _T('1');
+ *(str++) = _T('2');
+ *(str++) = _T(']');
break;
case 7:
- *(str++) = '[';
- *(str++) = '1';
- *(str++) = '2';
- *(str++) = '3';
- *(str++) = ']';
+ *(str++) = _T('[');
+ *(str++) = _T('1');
+ *(str++) = _T('2');
+ *(str++) = _T('3');
+ *(str++) = _T(']');
}
- *str = '\0';
+ *str = _T('\0');
return CurrentSeqString;
}
-void testSequence(char *testStr)
+void testSequence(TCHAR *testStr)
{
static FLASHING_SEQUENCE Test = {0};
@@ -405,15 +405,15 @@ static void PreviewThread(void *dummy) }
-FLASHING_SEQUENCE str2FS(char *str)
+FLASHING_SEQUENCE str2FS(TCHAR *str)
{
FLASHING_SEQUENCE Temp = {0};
for (Temp.size=Temp.index=0; *str; str++) {
Temp.size++;
- if (*str == '[') {
+ if (*str == _T('[')) {
Temp.frame[Temp.size - 1] = 0;
- for (str++; *str && *str != ']'; str++)
+ for (str++; *str && *str != _T(']'); str++)
Temp.frame[Temp.size - 1] += KbdChar2Byte(*str) & Leds2Flash;
if (!*str) break;
} else
diff --git a/plugins/KeyboardNotify/flash.h b/plugins/KeyboardNotify/flash.h index 594cb16fd1..f60706fc76 100644 --- a/plugins/KeyboardNotify/flash.h +++ b/plugins/KeyboardNotify/flash.h @@ -19,10 +19,10 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. void RestoreLEDState(void);
BYTE getBlinkingLeds(void);
void setFlashingSequence(void);
-void useExternSequence(char *);
-char *normalizeCustomString(char *);
-char *getCurrentSequenceString(void);
-void testSequence(char *);
+void useExternSequence(TCHAR *);
+TCHAR *normalizeCustomString(TCHAR *);
+TCHAR *getCurrentSequenceString(void);
+void testSequence(TCHAR *);
void previewFlashing(BOOL);
#define LedState(a) (((BYTE)(GetKeyState(a) & 0xffff))!=0)
diff --git a/plugins/KeyboardNotify/ignore.c b/plugins/KeyboardNotify/ignore.c index b9d897b358..ededae2c84 100644 --- a/plugins/KeyboardNotify/ignore.c +++ b/plugins/KeyboardNotify/ignore.c @@ -266,10 +266,10 @@ INT_PTR CALLBACK DlgProcIgnoreOptions(HWND hwndDlg, UINT msg, WPARAM wParam, LPA { CLCINFOITEM cii = {0};
cii.cbSize = sizeof(cii);
cii.flags = CLCIIF_GROUPFONT;
- cii.pszText = Translate("** All contacts **");
+ cii.pszText = TranslateT("** All contacts **");
hItemAll=(HANDLE)SendDlgItemMessage(hwndDlg, IDC_LIST, CLM_ADDINFOITEM, 0, (LPARAM)&cii);
- cii.pszText = Translate("** Unknown contacts **");
+ cii.pszText = TranslateT("** Unknown contacts **");
hItemUnknown=(HANDLE)SendDlgItemMessage(hwndDlg, IDC_LIST,CLM_ADDINFOITEM, 0, (LPARAM)&cii);
InitialiseItem(GetDlgItem(hwndDlg, IDC_LIST), NULL, hItemUnknown, 0xFFFFFFFF);
}
diff --git a/plugins/KeyboardNotify/keyboard.c b/plugins/KeyboardNotify/keyboard.c index 5e7c261c26..cb77a88827 100644 --- a/plugins/KeyboardNotify/keyboard.c +++ b/plugins/KeyboardNotify/keyboard.c @@ -28,7 +28,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. // Globals
extern BOOL bWindowsNT;
-extern BOOL bEmulateKeypresses;
+extern BYTE bEmulateKeypresses;
HANDLE hKbdDev[10] = {INVALID_HANDLE_VALUE, INVALID_HANDLE_VALUE, INVALID_HANDLE_VALUE, INVALID_HANDLE_VALUE, INVALID_HANDLE_VALUE, INVALID_HANDLE_VALUE, INVALID_HANDLE_VALUE, INVALID_HANDLE_VALUE, INVALID_HANDLE_VALUE, INVALID_HANDLE_VALUE};
// Defines
@@ -55,17 +55,17 @@ void outportb(UINT portid, BYTE value) BOOL OpenKeyboardDevice()
{
int i = 0;
- char aux1[MAX_PATH+1], aux2[MAX_PATH+1];
+ TCHAR aux1[MAX_PATH+1], aux2[MAX_PATH+1];
if (!bWindowsNT)
return TRUE;
do {
- mir_snprintf(aux1, sizeof(aux1), "Kbd%d", i);
- mir_snprintf(aux2, sizeof(aux2), "\\Device\\KeyboardClass%d", i);
+ _snwprintf(aux1, sizeof(aux1), _T("Kbd%d"), i);
+ _snwprintf(aux2, sizeof(aux2), _T("\\Device\\KeyboardClass%d"), i);
DefineDosDevice(DDD_RAW_TARGET_PATH, aux1, aux2);
- mir_snprintf(aux1, sizeof(aux1), "\\\\.\\Kbd%d", i);
+ _snwprintf(aux1, sizeof(aux1), _T("\\\\.\\Kbd%d"), i);
hKbdDev[i] = CreateFile(aux1, GENERIC_WRITE, 0, NULL, OPEN_EXISTING, 0, NULL);
} while (hKbdDev[i] != INVALID_HANDLE_VALUE && ++i < MAX_KBDHANDLES);
@@ -102,7 +102,7 @@ BOOL ToggleKeyboardLights(BYTE byte) void CloseKeyboardDevice()
{
int i = 0;
- char aux[MAX_PATH+1];
+ TCHAR aux[MAX_PATH+1];
if (!bWindowsNT)
return;
@@ -111,7 +111,7 @@ void CloseKeyboardDevice() if (hKbdDev[i] != INVALID_HANDLE_VALUE)
CloseHandle(hKbdDev[i]);
- mir_snprintf(aux, sizeof(aux), "Kbd%d", i);
+ _snwprintf(aux, sizeof(aux), _T("Kbd%d"), i);
DefineDosDevice(DDD_REMOVE_DEFINITION, aux, NULL);
} while (hKbdDev[i] != INVALID_HANDLE_VALUE && ++i < MAX_KBDHANDLES);
diff --git a/plugins/KeyboardNotify/main.c b/plugins/KeyboardNotify/main.c index 5de2805280..5c91d200a4 100644 --- a/plugins/KeyboardNotify/main.c +++ b/plugins/KeyboardNotify/main.c @@ -208,8 +208,8 @@ #include <m_message.h>
#include <m_utils.h>
#include <m_icq.h>
-#include "m_metacontacts.h"
-#include "m_updater.h"
+#include <m_metacontacts.h>
+#include <m_updater.h>
#pragma comment(lib, "advapi32.lib")
#define NCONVERS_BLINKID ((HANDLE)123456) //nconvers' random identifier used to flash an icon for "incoming message" on contact list
@@ -254,7 +254,7 @@ UINT hReminderTimer = 0; #pragma data_seg("Shared")
HHOOK hMouseHook = NULL;
HHOOK hKeyBoardHook = NULL;
-BYTE bEmulateKeypresses = FALSE;
+BYTE bEmulateKeypresses = 0;
DWORD dwLastInput = 0;
POINT lastGlobalMousePos = {0, 0};
#pragma data_seg()
@@ -373,7 +373,7 @@ BOOL checkOpenWindow(HANDLE hContact) BOOL IsSaverOnNT4()
{
- HDESK hd = OpenDesktop("screen-saver", 0, FALSE, MAXIMUM_ALLOWED);
+ HDESK hd = OpenDesktop(L"screen-saver", 0, FALSE, MAXIMUM_ALLOWED);
if(hd == NULL)
return GetLastError()==ERROR_ACCESS_DENIED;
@@ -814,7 +814,7 @@ static int StartBlinkService(WPARAM wParam, LPARAM lParam) nExternCount += (unsigned int)wParam;
if (bFlashOnOther && checkNotifyOptions() && checkGlobalStatus() && checkGlobalXstatus()) {
if (lParam)
- useExternSequence((char *)lParam);
+ useExternSequence((TCHAR *)lParam);
SetEvent(hFlashEvent);
}
@@ -842,12 +842,12 @@ static int IsFlashingActiveService(WPARAM wParam, LPARAM lParam) }
-static int NormalizeSequenceService(WPARAM wParam, LPARAM lParam)
+INT_PTR NormalizeSequenceService(WPARAM wParam, LPARAM lParam)
{
- char strAux[MAX_PATH+1], *strIn = (char *)lParam;
+ TCHAR strAux[MAX_PATH+1], *strIn = (TCHAR *)lParam;
- mir_snprintf(strAux, MAX_PATH, "%s", strIn);
- mir_snprintf(strIn, MAX_PATH, "%s", normalizeCustomString(strAux));
+ _snwprintf(strAux, MAX_PATH, _T("%s"), strIn);
+ _snwprintf(strIn, MAX_PATH, _T("%s"), normalizeCustomString(strAux));
return (int)strIn;
}
@@ -880,15 +880,15 @@ void createProcessList(void) count = (unsigned int)DBGetContactSettingWord(NULL, KEYBDMODULE, "processcount", 0);
ProcessList.count = 0;
- ProcessList.szFileName = (char **)malloc(count * sizeof(char *));
+ ProcessList.szFileName = (TCHAR **)malloc(count * sizeof(TCHAR *));
if (ProcessList.szFileName) {
for(i=0; i < count; i++)
if (DBGetContactSetting(NULL, KEYBDMODULE, fmtDBSettingName("process%d", i), &dbv))
ProcessList.szFileName[i] = NULL;
else {
- ProcessList.szFileName[i] = (char *)malloc(strlen(dbv.pszVal) + 1);
+ ProcessList.szFileName[i] = (TCHAR *)malloc(wcslen(dbv.ptszVal) + 1);
if (ProcessList.szFileName[i])
- strcpy(ProcessList.szFileName[i], dbv.pszVal);
+ wcscpy(ProcessList.szFileName[i], dbv.ptszVal);
DBFreeVariant(&dbv);
}
ProcessList.count = count;
@@ -1066,21 +1066,21 @@ void createProtocolList(void) // We use the profile name to create the first part of each event name
// We do so to avoid problems between different instances of the plugin concurrently running
-void createEventPrefix(char *prefixName, size_t maxLen)
+void createEventPrefix(TCHAR *prefixName, size_t maxLen)
{
size_t len;
- char profileName[MAX_PATH+1], *str;
+ TCHAR profileName[MAX_PATH+1], *str;
getAbsoluteProfileName(profileName, MAX_PATH);
- while (str = strchr(profileName, '\\'))
- *str = '/';
- if ((len = strlen(profileName)) <= maxLen)
- strcpy(prefixName, profileName);
+ while (str = wcschr(profileName, _T('\\')))
+ *str = _T('/');
+ if ((len = wcslen(profileName)) <= maxLen)
+ wcscpy(prefixName, profileName);
else {
str = profileName + len - maxLen / 2;
- mir_snprintf(prefixName, maxLen / 2, "%s", profileName);
- strcat(prefixName, str);
+ _snwprintf(prefixName, maxLen / 2, L"%s", profileName);
+ wcscat(prefixName, str);
}
}
@@ -1092,11 +1092,11 @@ void createEventPrefix(char *prefixName, size_t maxLen) static int ModulesLoaded(WPARAM wParam, LPARAM lParam)
{
- char eventPrefix[MAX_PATH+1], eventName[MAX_PATH+1];
+ TCHAR eventPrefix[MAX_PATH+1], eventName[MAX_PATH+1];
LoadProcsLibrary();
if (bWindowsNT && dWinVer >= 5)
- MyGetLastInputInfo = (BOOL (WINAPI *)(PLASTINPUTINFO)) GetProcAddress(GetModuleHandle("user32"), "GetLastInputInfo");
+ MyGetLastInputInfo = (BOOL (WINAPI *)(PLASTINPUTINFO)) GetProcAddress(GetModuleHandle(L"user32"), "GetLastInputInfo");
else
MyGetLastInputInfo = NULL;
@@ -1105,9 +1105,9 @@ static int ModulesLoaded(WPARAM wParam, LPARAM lParam) // Create some synchronisation objects
createEventPrefix(eventPrefix, MAX_PATH - 11);
- mir_snprintf(eventName, sizeof(eventName), "%s/FlashEvent", eventPrefix);
+ _snwprintf(eventName, sizeof(eventName), _T("%s/FlashEvent"), eventPrefix);
hFlashEvent = CreateEvent(NULL, FALSE, FALSE, eventName);
- mir_snprintf(eventName, sizeof(eventName), "%s/ExitEvent", eventPrefix);
+ _snwprintf(eventName, sizeof(eventName), _T("%s/ExitEvent"), eventPrefix);
hExitEvent = CreateEvent(NULL, FALSE, FALSE, eventName);
hThread = CreateThread(NULL, 0, (LPTHREAD_START_ROUTINE)FlashThreadFunction, NULL, 0, &IDThread);
@@ -1382,7 +1382,7 @@ static LRESULT CALLBACK MirandaWndProcHookFunction(int code, WPARAM wParam, LPAR HWND findMessageWindow(HANDLE hContact)
{
HWND hwnd;
- char newtitle[256];
+ TCHAR newtitle[256];
char *szProto, *contactName, *szStatus;
CONTACTINFO ci = {0};
@@ -1390,17 +1390,17 @@ HWND findMessageWindow(HANDLE hContact) contactName = (char *)CallService(MS_CLIST_GETCONTACTDISPLAYNAME, (WPARAM)hContact, 0);
szStatus = (char *)CallService(MS_CLIST_GETSTATUSMODEDESCRIPTION, szProto==NULL?ID_STATUS_OFFLINE:DBGetContactSettingWord(hContact, szProto, "Status", ID_STATUS_OFFLINE), 0);
- mir_snprintf(newtitle, sizeof(newtitle), "%s (%s): %s", contactName, szStatus, Translate("Message Received"));
+ _snwprintf(newtitle, sizeof(newtitle), _T("%s (%s): %s"), contactName, szStatus, TranslateT("Message Received"));
if(hwnd = FindWindow(NULL, newtitle))
return hwnd;
- mir_snprintf(newtitle, sizeof(newtitle), "%s %s", contactName, szStatus);
+ _snwprintf(newtitle, sizeof(newtitle), _T("%s %s"), contactName, szStatus);
if(hwnd = FindWindow(NULL, newtitle))
return hwnd;
- mir_snprintf(newtitle, sizeof(newtitle), "%s (%s): %s", contactName, szStatus, Translate("Message Session"));
+ _snwprintf(newtitle, sizeof(newtitle), _T("%s (%s): %s"), contactName, szStatus, TranslateT("Message Session"));
if(hwnd = FindWindow(NULL, newtitle))
return hwnd;
- mir_snprintf(newtitle, sizeof(newtitle), "%s (%s): %s", contactName, szStatus, Translate("Message Session is typing..."));
+ _snwprintf(newtitle, sizeof(newtitle), _T("%s (%s): %s"), contactName, szStatus, TranslateT("Message Session is typing..."));
if(hwnd = FindWindow(NULL, newtitle))
return hwnd;
// search for the nconvers++ message window that uses the UIN
@@ -1410,16 +1410,16 @@ HWND findMessageWindow(HANDLE hContact) if (!CallService(MS_CONTACT_GETCONTACTINFO, 0, (LPARAM)&ci)) {
switch(ci.type) {
case CNFT_BYTE:
- mir_snprintf(newtitle, sizeof(newtitle), "%s (%d) %s", contactName, ci.bVal, szStatus);
+ _snwprintf(newtitle, sizeof(newtitle), _T("%s (%d) %s"), contactName, ci.bVal, szStatus);
break;
case CNFT_WORD:
- mir_snprintf(newtitle, sizeof(newtitle), "%s (%d) %s", contactName, ci.wVal, szStatus);
+ _snwprintf(newtitle, sizeof(newtitle), _T("%s (%d) %s"), contactName, ci.wVal, szStatus);
break;
case CNFT_DWORD:
- mir_snprintf(newtitle, sizeof(newtitle), "%s (%d) %s", contactName, ci.dVal, szStatus);
+ _snwprintf(newtitle, sizeof(newtitle), _T("%s (%d) %s"), contactName, ci.dVal, szStatus);
break;
case CNFT_ASCIIZ:
- mir_snprintf(newtitle, sizeof(newtitle), "%s (%s) %s", contactName, ci.pszVal, szStatus);
+ _snwprintf(newtitle, sizeof(newtitle), _T("%s (%s) %s"), contactName, ci.pszVal, szStatus);
break;
}
if(hwnd = FindWindow(NULL, newtitle))
diff --git a/plugins/KeyboardNotify/options.c b/plugins/KeyboardNotify/options.c index 57ea559a99..85c63049a4 100644 --- a/plugins/KeyboardNotify/options.c +++ b/plugins/KeyboardNotify/options.c @@ -1,60 +1,60 @@ -/* - -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. - -*/ - +/*
+
+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.
+
+*/
+
#define WIN32_LEAN_AND_MEAN
- -#include <stdio.h> -#include <stdlib.h> -#include <windows.h> -#include <commctrl.h> -#include <commdlg.h> -#include "flash.h" -#include "ignore.h" -#include "resource.h" -#include "constants.h" -#include "protolist.h" -#include "EnumProc.h" +
+#include <stdio.h>
+#include <stdlib.h>
+#include <windows.h>
+#include <commctrl.h>
+#include <commdlg.h>
+#include "flash.h"
+#include "ignore.h"
+#include "resource.h"
+#include "constants.h"
+#include "protolist.h"
+#include "EnumProc.h"
#include "utils.h"
-#include <newpluginapi.h> -#include <m_clc.h> -#include <m_clist.h> -#include <m_database.h> -#include <m_langpack.h> -#include <m_options.h> -#include <m_protosvc.h> -#include <m_protocols.h> +#include <newpluginapi.h>
+#include <m_clc.h>
+#include <m_clist.h>
+#include <m_database.h>
+#include <m_langpack.h>
+#include <m_options.h>
+#include <m_protosvc.h>
+#include <m_protocols.h>
#include <m_icq.h>
- +
#define IDI_BLANK 200
-#ifndef ETDT_ENABLE -#define ETDT_ENABLE 0x00000002 -#endif -#ifndef ETDT_USETABTEXTURE -#define ETDT_USETABTEXTURE 0x00000004 -#endif -#ifndef ETDT_ENABLETAB -#define ETDT_ENABLETAB (ETDT_ENABLE|ETDT_USETABTEXTURE) -#endif - -#ifndef ListView_SetCheckState +#ifndef ETDT_ENABLE
+#define ETDT_ENABLE 0x00000002
+#endif
+#ifndef ETDT_USETABTEXTURE
+#define ETDT_USETABTEXTURE 0x00000004
+#endif
+#ifndef ETDT_ENABLETAB
+#define ETDT_ENABLETAB (ETDT_ENABLE|ETDT_USETABTEXTURE)
+#endif
+
+#ifndef ListView_SetCheckState
#define ListView_SetCheckState(hLv, iItem, bCheck) \
- ListView_SetItemState(hLv, iItem, bCheck ? INDEXTOSTATEIMAGEMASK(2) : INDEXTOSTATEIMAGEMASK(1), LVIS_STATEIMAGEMASK) + ListView_SetItemState(hLv, iItem, bCheck ? INDEXTOSTATEIMAGEMASK(2) : INDEXTOSTATEIMAGEMASK(1), LVIS_STATEIMAGEMASK)
#endif
#ifndef TVS_NOHSCROLL
@@ -78,1224 +78,1223 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. #ifndef TreeView_GetItemState
#define TreeView_GetItemState(hwndTv, hti, mask) \
(UINT)SendMessageA((hwndTv), TVM_GETITEMSTATE, (WPARAM)(hti), (LPARAM)(mask))
-#endif - -void LoadSettings(void); -int InitializeOptions(WPARAM,LPARAM); -INT_PTR CALLBACK DlgProcOptions(HWND, UINT, WPARAM, LPARAM); -INT_PTR CALLBACK DlgProcProtoOptions(HWND, UINT, WPARAM, LPARAM); -INT_PTR CALLBACK DlgProcBasicOptions(HWND, UINT, WPARAM, LPARAM); -INT_PTR CALLBACK DlgProcEffectOptions(HWND, UINT, WPARAM, LPARAM); -INT_PTR CALLBACK DlgProcThemeOptions(HWND, UINT, WPARAM, LPARAM); -INT_PTR CALLBACK DlgProcProcesses(HWND, UINT, WPARAM, LPARAM); +#endif
+
+void LoadSettings(void);
+int InitializeOptions(WPARAM,LPARAM);
+INT_PTR CALLBACK DlgProcOptions(HWND, UINT, WPARAM, LPARAM);
+INT_PTR CALLBACK DlgProcProtoOptions(HWND, UINT, WPARAM, LPARAM);
+INT_PTR CALLBACK DlgProcBasicOptions(HWND, UINT, WPARAM, LPARAM);
+INT_PTR CALLBACK DlgProcEffectOptions(HWND, UINT, WPARAM, LPARAM);
+INT_PTR CALLBACK DlgProcThemeOptions(HWND, UINT, WPARAM, LPARAM);
+INT_PTR CALLBACK DlgProcProcesses(HWND, UINT, WPARAM, LPARAM);
INT_PTR CALLBACK DlgProcEventLeds(HWND, UINT, WPARAM, LPARAM);
-INT_PTR CALLBACK DlgProcXstatusList(HWND, UINT, WPARAM, LPARAM); -void exportThemes(const char *); -void importThemes(const char *, BOOL); -void writeThemeToCombo(const char *, const char *, BOOL); -void createProcessListAux(void); -void destroyProcessListAux(void); +INT_PTR CALLBACK DlgProcXstatusList(HWND, UINT, WPARAM, LPARAM);
+void exportThemes(const TCHAR *);
+void importThemes(const TCHAR *, BOOL);
+void writeThemeToCombo(const TCHAR *, const TCHAR *, BOOL);
+void createProcessListAux(void);
+void destroyProcessListAux(void);
void createXstatusListAux(void);
void destroyXstatusListAux(void);
- - -extern HINSTANCE hInst; -extern double dWinVer; -extern BOOL bWindowsNT; - -extern BYTE bFlashOnMsg; -extern BYTE bFlashOnURL; -extern BYTE bFlashOnFile; -extern BYTE bFlashOnOther; -extern BYTE bFullScreenMode; -extern BYTE bScreenSaverRunning; -extern BYTE bWorkstationLocked; -extern BYTE bProcessesAreRunning; -extern BYTE bWorkstationActive; -extern BYTE bFlashIfMsgOpen; -extern BYTE bFlashIfMsgOlder; -extern WORD wSecondsOlder; -extern BYTE bFlashUntil; -extern WORD wBlinksNumber; -extern BYTE bMirandaOrWindows; -extern WORD wStatusMap; -extern WORD wReminderCheck; -extern BYTE bFlashLed[3]; -extern BYTE bFlashEffect; -extern BYTE bSequenceOrder; -extern WORD wCustomTheme; -extern WORD wStartDelay; -extern BYTE bFlashSpeed; -extern BYTE bEmulateKeypresses; -extern BYTE bOverride; -extern BYTE bFlashIfMsgWinNotTop; -extern BYTE bTrillianLedsMsg; -extern BYTE bTrillianLedsURL; -extern BYTE bTrillianLedsFile; -extern BYTE bTrillianLedsOther; - -extern PROTOCOL_LIST ProtoList; -extern PROCESS_LIST ProcessList; - -HWND hwndProto, hwndBasic, hwndEffect, hwndTheme, hwndIgnore, hwndCurrentTab; - -char *AttendedName[]={"Miranda", "Windows"}; -char *OrderName[]={"left->right", "right->left", "left<->right"}; - -PROCESS_LIST ProcessListAux; +
+
+extern HINSTANCE hInst;
+extern double dWinVer;
+extern BOOL bWindowsNT;
+
+extern BYTE bFlashOnMsg;
+extern BYTE bFlashOnURL;
+extern BYTE bFlashOnFile;
+extern BYTE bFlashOnOther;
+extern BYTE bFullScreenMode;
+extern BYTE bScreenSaverRunning;
+extern BYTE bWorkstationLocked;
+extern BYTE bProcessesAreRunning;
+extern BYTE bWorkstationActive;
+extern BYTE bFlashIfMsgOpen;
+extern BYTE bFlashIfMsgOlder;
+extern WORD wSecondsOlder;
+extern BYTE bFlashUntil;
+extern WORD wBlinksNumber;
+extern BYTE bMirandaOrWindows;
+extern WORD wStatusMap;
+extern WORD wReminderCheck;
+extern BYTE bFlashLed[3];
+extern BYTE bFlashEffect;
+extern BYTE bSequenceOrder;
+extern WORD wCustomTheme;
+extern WORD wStartDelay;
+extern BYTE bFlashSpeed;
+extern BYTE bEmulateKeypresses;
+extern BYTE bOverride;
+extern BYTE bFlashIfMsgWinNotTop;
+extern BYTE bTrillianLedsMsg;
+extern BYTE bTrillianLedsURL;
+extern BYTE bTrillianLedsFile;
+extern BYTE bTrillianLedsOther;
+
+extern PROTOCOL_LIST ProtoList;
+extern PROCESS_LIST ProcessList;
+
+HWND hwndProto, hwndBasic, hwndEffect, hwndTheme, hwndIgnore, hwndCurrentTab;
+
+TCHAR *AttendedName[]={_T("Miranda"), _T("Windows")};
+TCHAR *OrderName[]={_T("left->right"), _T("right->left"), _T("left<->right")};
+
+PROCESS_LIST ProcessListAux;
XSTATUS_INFO *XstatusListAux;
-BYTE trillianLedsMsg, trillianLedsURL, trillianLedsFile, trillianLedsOther; - -static BOOL (WINAPI *pfnEnableThemeDialogTexture)(HANDLE, DWORD) = 0; - - -// ** -// ** Initialize the Miranda options page -// ** -int InitializeOptions(WPARAM wParam,LPARAM lParam) -{ - - OPTIONSDIALOGPAGE odp; - HMODULE hUxTheme = NULL; - - if(bWindowsNT && dWinVer >= 5.01) { - hUxTheme = GetModuleHandle("uxtheme.dll"); - - if(hUxTheme) - pfnEnableThemeDialogTexture = (BOOL (WINAPI *)(HANDLE, DWORD))GetProcAddress(hUxTheme, "EnableThemeDialogTexture"); - } - - ZeroMemory(&odp,sizeof(odp)); - odp.cbSize = sizeof(odp); - odp.position = 0; - odp.hInstance = hInst; - odp.pszTemplate = MAKEINTRESOURCE(IDD_OPTIONS); - odp.pszTitle = Translate("Keyboard Flash"); - odp.pszGroup = Translate("Plugins"); - odp.groupPosition = 910000000; - odp.flags=ODPF_BOLDGROUPS; - odp.pfnDlgProc = DlgProcOptions; - odp.nIDBottomSimpleControl = 0; - CallService(MS_OPT_ADDPAGE,wParam, (LPARAM)&odp); - - return 0; -} - -INT_PTR CALLBACK DlgProcOptions(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lParam) -{ - switch (msg) { - case WM_INITDIALOG: - { - HWND tc; - TCITEM tci; - tc = GetDlgItem(hwndDlg, IDC_TABS); - tci.mask = TCIF_TEXT; - tci.pszText = Translate("Protocols"); - TabCtrl_InsertItem(tc, 0, &tci); - tci.pszText = Translate("Rules"); - TabCtrl_InsertItem(tc, 1, &tci); - tci.pszText = Translate("Flashing"); - TabCtrl_InsertItem(tc, 2, &tci); - tci.pszText = Translate("Themes"); - TabCtrl_InsertItem(tc, 3, &tci); - tci.pszText = Translate("Ignore"); - TabCtrl_InsertItem(tc, 4, &tci); - - hwndProto = CreateDialogParam(hInst, MAKEINTRESOURCE(IDD_PROTO_OPTIONS), hwndDlg, DlgProcProtoOptions, (LPARAM) NULL); - if(hwndProto && pfnEnableThemeDialogTexture) - pfnEnableThemeDialogTexture(hwndProto, ETDT_ENABLETAB); - SetWindowPos(hwndProto, HWND_TOP, 0, 0, 0, 0, SWP_NOMOVE | SWP_NOSIZE); - ShowWindow(hwndProto, SW_SHOW); - hwndBasic = CreateDialogParam(hInst, MAKEINTRESOURCE(IDD_BASIC_OPTIONS), hwndDlg, DlgProcBasicOptions, (LPARAM) NULL); - if(hwndBasic && pfnEnableThemeDialogTexture) - pfnEnableThemeDialogTexture(hwndBasic, ETDT_ENABLETAB); - SetWindowPos(hwndBasic, HWND_TOP, 0, 0, 0, 0, SWP_NOMOVE | SWP_NOSIZE); - hwndEffect = CreateDialogParam(hInst, MAKEINTRESOURCE(IDD_EFFECT_OPTIONS), hwndDlg, DlgProcEffectOptions, (LPARAM) NULL); - if(hwndEffect && pfnEnableThemeDialogTexture) - pfnEnableThemeDialogTexture(hwndEffect, ETDT_ENABLETAB); - SetWindowPos(hwndEffect, HWND_TOP, 0, 0, 0, 0, SWP_NOMOVE | SWP_NOSIZE); - hwndTheme = CreateDialogParam(hInst, MAKEINTRESOURCE(IDD_THEME_OPTIONS), hwndDlg, DlgProcThemeOptions, (LPARAM) NULL); - if(hwndTheme && pfnEnableThemeDialogTexture) - pfnEnableThemeDialogTexture(hwndTheme, ETDT_ENABLETAB); - SetWindowPos(hwndTheme, HWND_TOP, 0, 0, 0, 0, SWP_NOMOVE | SWP_NOSIZE); - hwndIgnore = CreateDialogParam(hInst, MAKEINTRESOURCE(IDD_IGNORE_OPTIONS), hwndDlg, DlgProcIgnoreOptions, (LPARAM) NULL); - if(hwndIgnore && pfnEnableThemeDialogTexture) - pfnEnableThemeDialogTexture(hwndIgnore, ETDT_ENABLETAB); - SetWindowPos(hwndIgnore, HWND_TOP, 0, 0, 0, 0, SWP_NOMOVE | SWP_NOSIZE); - hwndCurrentTab = hwndProto; - return TRUE; - - } - case WM_COMMAND: - break; - case WM_NOTIFY: - { - switch (((LPNMHDR) lParam)->code) { - case TCN_SELCHANGE: - switch (wParam) { - case IDC_TABS: - { - HWND hwnd; - switch (TabCtrl_GetCurSel(GetDlgItem(hwndDlg, IDC_TABS))) { - default: - case 0: - hwnd = hwndProto; - break; - case 1: - hwnd = hwndBasic; - break; - case 2: - hwnd = hwndEffect; - break; - case 3: - hwnd = hwndTheme; - break; - case 4: - hwnd = hwndIgnore; - break; - } - if (hwnd!=hwndCurrentTab) { - ShowWindow(hwnd, SW_SHOW); - ShowWindow(hwndCurrentTab, SW_HIDE); - hwndCurrentTab = hwnd; - } - } - break; - } - break; - case PSN_APPLY: - SendMessage(hwndProto, WM_NOTIFY, wParam, lParam); - SendMessage(hwndBasic, WM_NOTIFY, wParam, lParam); - SendMessage(hwndEffect, WM_NOTIFY, wParam, lParam); - SendMessage(hwndTheme, WM_NOTIFY, wParam, lParam); - SendMessage(hwndIgnore, WM_NOTIFY, wParam, lParam); - return TRUE; - } - } - break; - case WM_DESTROY: - break; - } - return FALSE; -} - - -INT_PTR CALLBACK DlgProcProtoOptions(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lParam) -{ - static BOOL initDlg=FALSE; - - switch (msg) { - - case WM_INITDIALOG: - initDlg=TRUE; - TranslateDialogDefault(hwndDlg); - - // proto list - { - unsigned int i; - LVCOLUMN lvCol; - LVITEM lvItem; - HWND hList = GetDlgItem(hwndDlg, IDC_PROTOCOLLIST); - - // create columns - ListView_SetExtendedListViewStyleEx(hList, LVS_EX_CHECKBOXES, LVS_EX_CHECKBOXES); - memset(&lvCol, 0, sizeof(lvCol)); - lvCol.mask = LVCF_WIDTH|LVCF_TEXT; - lvCol.pszText = Translate("Protocol"); - lvCol.cx = 118; - ListView_InsertColumn(hList, 0, &lvCol); - // fill - memset(&lvItem, 0, sizeof(lvItem)); - lvItem.mask = LVIF_TEXT|LVIF_PARAM; - lvItem.cchTextMax = 256; - lvItem.iItem = 0; - lvItem.iSubItem = 0; - for(i=0; i < ProtoList.protoCount; i++) { - char protoName[MAX_PATH+1]; - - if(ProtoList.protoInfo[i].visible) { - lvItem.lParam = (LPARAM)ProtoList.protoInfo[i].szProto; - CallProtoService(ProtoList.protoInfo[i].szProto, PS_GETNAME, sizeof(protoName), (LPARAM)protoName); - lvItem.pszText = protoName; - ListView_InsertItem(hList, &lvItem); - ListView_SetCheckState(hList, lvItem.iItem, ProtoList.protoInfo[i].enabled); - lvItem.iItem++; - } - } - } - - initDlg=FALSE; - return TRUE; - - case WM_NOTIFY: - { - //Here we have pressed either the OK or the APPLY button. - switch(((LPNMHDR)lParam)->idFrom) { - case 0: - switch (((LPNMHDR)lParam)->code) { - case PSN_APPLY: - // enabled protos - { - int i; - LVITEM lvItem; - HWND hList = GetDlgItem(hwndDlg, IDC_PROTOCOLLIST); - - memset(&lvItem, 0, sizeof(lvItem)); - lvItem.mask = LVIF_PARAM; - lvItem.iSubItem = 0; - for (i=0; i < ListView_GetItemCount(hList); i++) { - lvItem.iItem = i; - ListView_GetItem(hList, &lvItem); - DBWriteContactSettingByte(NULL, KEYBDMODULE, (char *)lvItem.lParam, (BYTE)!!ListView_GetCheckState(hList, lvItem.iItem)); - } - } - - LoadSettings(); - - return TRUE; - } // switch code - 0 - break; - case IDC_PROTOCOLLIST: - switch(((NMHDR*)lParam)->code) { - case LVN_ITEMCHANGED: - { - NMLISTVIEW *nmlv = (NMLISTVIEW *)lParam; - - if (!initDlg && ((nmlv->uNewState ^ nmlv->uOldState) & LVIS_STATEIMAGEMASK)) - SendMessage(GetParent(GetParent(hwndDlg)), PSM_CHANGED, 0, 0); - } - break; - } // switch code - IDC_PROTOCOLLIST - break; - } //switch idFrom - } - break; //End WM_NOTIFY - - default: - break; - } - - return FALSE; -} - -INT_PTR CALLBACK DlgProcBasicOptions(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lParam) -{ - unsigned int i; - static BOOL initDlg=FALSE; - - switch (msg) { - - case WM_INITDIALOG: - initDlg=TRUE; - TranslateDialogDefault(hwndDlg); - - createProcessListAux(); +BYTE trillianLedsMsg, trillianLedsURL, trillianLedsFile, trillianLedsOther;
+
+static BOOL (WINAPI *pfnEnableThemeDialogTexture)(HANDLE, DWORD) = 0;
+
+
+// **
+// ** Initialize the Miranda options page
+// **
+int InitializeOptions(WPARAM wParam,LPARAM lParam)
+{
+
+ OPTIONSDIALOGPAGE odp;
+ HMODULE hUxTheme = NULL;
+
+ if(bWindowsNT && dWinVer >= 5.01) {
+ hUxTheme = GetModuleHandle(L"uxtheme.dll");
+
+ if(hUxTheme)
+ pfnEnableThemeDialogTexture = (BOOL (WINAPI *)(HANDLE, DWORD))GetProcAddress(hUxTheme, "EnableThemeDialogTexture");
+ }
+
+ ZeroMemory(&odp,sizeof(odp));
+ odp.cbSize = sizeof(odp);
+ odp.position = 0;
+ odp.hInstance = hInst;
+ odp.pszTemplate = MAKEINTRESOURCEA(IDD_OPTIONS);
+ odp.pszTitle = "Keyboard Flash";
+ odp.pszGroup = "Plugins";
+ odp.groupPosition = 910000000;
+ odp.flags=ODPF_BOLDGROUPS;
+ odp.pfnDlgProc = DlgProcOptions;
+ odp.nIDBottomSimpleControl = 0;
+ CallService(MS_OPT_ADDPAGE,wParam, (LPARAM)&odp);
+
+ return 0;
+}
+
+INT_PTR CALLBACK DlgProcOptions(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lParam)
+{
+ switch (msg) {
+ case WM_INITDIALOG:
+ {
+ HWND tc;
+ TCITEM tci;
+ tc = GetDlgItem(hwndDlg, IDC_TABS);
+ tci.mask = TCIF_TEXT;
+ tci.pszText = TranslateT("Protocols");
+ TabCtrl_InsertItem(tc, 0, &tci);
+ tci.pszText = TranslateT("Rules");
+ TabCtrl_InsertItem(tc, 1, &tci);
+ tci.pszText = TranslateT("Flashing");
+ TabCtrl_InsertItem(tc, 2, &tci);
+ tci.pszText = TranslateT("Themes");
+ TabCtrl_InsertItem(tc, 3, &tci);
+ tci.pszText = TranslateT("Ignore");
+ TabCtrl_InsertItem(tc, 4, &tci);
+
+ hwndProto = CreateDialogParam(hInst, MAKEINTRESOURCE(IDD_PROTO_OPTIONS), hwndDlg, DlgProcProtoOptions, (LPARAM) NULL);
+ if(hwndProto && pfnEnableThemeDialogTexture)
+ pfnEnableThemeDialogTexture(hwndProto, ETDT_ENABLETAB);
+ SetWindowPos(hwndProto, HWND_TOP, 0, 0, 0, 0, SWP_NOMOVE | SWP_NOSIZE);
+ ShowWindow(hwndProto, SW_SHOW);
+ hwndBasic = CreateDialogParam(hInst, MAKEINTRESOURCE(IDD_BASIC_OPTIONS), hwndDlg, DlgProcBasicOptions, (LPARAM) NULL);
+ if(hwndBasic && pfnEnableThemeDialogTexture)
+ pfnEnableThemeDialogTexture(hwndBasic, ETDT_ENABLETAB);
+ SetWindowPos(hwndBasic, HWND_TOP, 0, 0, 0, 0, SWP_NOMOVE | SWP_NOSIZE);
+ hwndEffect = CreateDialogParam(hInst, MAKEINTRESOURCE(IDD_EFFECT_OPTIONS), hwndDlg, DlgProcEffectOptions, (LPARAM) NULL);
+ if(hwndEffect && pfnEnableThemeDialogTexture)
+ pfnEnableThemeDialogTexture(hwndEffect, ETDT_ENABLETAB);
+ SetWindowPos(hwndEffect, HWND_TOP, 0, 0, 0, 0, SWP_NOMOVE | SWP_NOSIZE);
+ hwndTheme = CreateDialogParam(hInst, MAKEINTRESOURCE(IDD_THEME_OPTIONS), hwndDlg, DlgProcThemeOptions, (LPARAM) NULL);
+ if(hwndTheme && pfnEnableThemeDialogTexture)
+ pfnEnableThemeDialogTexture(hwndTheme, ETDT_ENABLETAB);
+ SetWindowPos(hwndTheme, HWND_TOP, 0, 0, 0, 0, SWP_NOMOVE | SWP_NOSIZE);
+ hwndIgnore = CreateDialogParam(hInst, MAKEINTRESOURCE(IDD_IGNORE_OPTIONS), hwndDlg, DlgProcIgnoreOptions, (LPARAM) NULL);
+ if(hwndIgnore && pfnEnableThemeDialogTexture)
+ pfnEnableThemeDialogTexture(hwndIgnore, ETDT_ENABLETAB);
+ SetWindowPos(hwndIgnore, HWND_TOP, 0, 0, 0, 0, SWP_NOMOVE | SWP_NOSIZE);
+ hwndCurrentTab = hwndProto;
+ return TRUE;
+
+ }
+ case WM_COMMAND:
+ break;
+ case WM_NOTIFY:
+ {
+ switch (((LPNMHDR) lParam)->code) {
+ case TCN_SELCHANGE:
+ switch (wParam) {
+ case IDC_TABS:
+ {
+ HWND hwnd;
+ switch (TabCtrl_GetCurSel(GetDlgItem(hwndDlg, IDC_TABS))) {
+ default:
+ case 0:
+ hwnd = hwndProto;
+ break;
+ case 1:
+ hwnd = hwndBasic;
+ break;
+ case 2:
+ hwnd = hwndEffect;
+ break;
+ case 3:
+ hwnd = hwndTheme;
+ break;
+ case 4:
+ hwnd = hwndIgnore;
+ break;
+ }
+ if (hwnd!=hwndCurrentTab) {
+ ShowWindow(hwnd, SW_SHOW);
+ ShowWindow(hwndCurrentTab, SW_HIDE);
+ hwndCurrentTab = hwnd;
+ }
+ }
+ break;
+ }
+ break;
+ case PSN_APPLY:
+ SendMessage(hwndProto, WM_NOTIFY, wParam, lParam);
+ SendMessage(hwndBasic, WM_NOTIFY, wParam, lParam);
+ SendMessage(hwndEffect, WM_NOTIFY, wParam, lParam);
+ SendMessage(hwndTheme, WM_NOTIFY, wParam, lParam);
+ SendMessage(hwndIgnore, WM_NOTIFY, wParam, lParam);
+ return TRUE;
+ }
+ }
+ break;
+ case WM_DESTROY:
+ break;
+ }
+ return FALSE;
+}
+
+
+INT_PTR CALLBACK DlgProcProtoOptions(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lParam)
+{
+ static BOOL initDlg=FALSE;
+
+ switch (msg) {
+
+ case WM_INITDIALOG:
+ initDlg=TRUE;
+ TranslateDialogDefault(hwndDlg);
+
+ // proto list
+ {
+ unsigned int i;
+ LVCOLUMN lvCol;
+ LVITEM lvItem;
+ HWND hList = GetDlgItem(hwndDlg, IDC_PROTOCOLLIST);
+
+ // create columns
+ ListView_SetExtendedListViewStyleEx(hList, LVS_EX_CHECKBOXES, LVS_EX_CHECKBOXES);
+ memset(&lvCol, 0, sizeof(lvCol));
+ lvCol.mask = LVCF_WIDTH|LVCF_TEXT;
+ lvCol.pszText = TranslateT("Protocol");
+ lvCol.cx = 118;
+ ListView_InsertColumn(hList, 0, &lvCol);
+ // fill
+ memset(&lvItem, 0, sizeof(lvItem));
+ lvItem.mask = LVIF_TEXT|LVIF_PARAM;
+ lvItem.cchTextMax = 256;
+ lvItem.iItem = 0;
+ lvItem.iSubItem = 0;
+ for(i=0; i < ProtoList.protoCount; i++) {
+ int count; PROTOACCOUNT** protos;
+ ProtoEnumAccounts( &count, &protos );
+ if(ProtoList.protoInfo[i].visible) {
+ lvItem.lParam = (LPARAM)ProtoList.protoInfo[i].szProto;
+ lvItem.pszText = protos[i] -> tszAccountName;
+ ListView_InsertItem(hList, &lvItem);
+ ListView_SetCheckState(hList, lvItem.iItem, ProtoList.protoInfo[i].enabled);
+ lvItem.iItem++;
+ }
+ }
+ }
+
+ initDlg=FALSE;
+ return TRUE;
+
+ case WM_NOTIFY:
+ {
+ //Here we have pressed either the OK or the APPLY button.
+ switch(((LPNMHDR)lParam)->idFrom) {
+ case 0:
+ switch (((LPNMHDR)lParam)->code) {
+ case PSN_APPLY:
+ // enabled protos
+ {
+ int i;
+ LVITEM lvItem;
+ HWND hList = GetDlgItem(hwndDlg, IDC_PROTOCOLLIST);
+
+ memset(&lvItem, 0, sizeof(lvItem));
+ lvItem.mask = LVIF_PARAM;
+ lvItem.iSubItem = 0;
+ for (i=0; i < ListView_GetItemCount(hList); i++) {
+ lvItem.iItem = i;
+ ListView_GetItem(hList, &lvItem);
+ DBWriteContactSettingByte(NULL, KEYBDMODULE, (char *)lvItem.lParam, (BYTE)!!ListView_GetCheckState(hList, lvItem.iItem));
+ }
+ }
+
+ LoadSettings();
+
+ return TRUE;
+ } // switch code - 0
+ break;
+ case IDC_PROTOCOLLIST:
+ switch(((NMHDR*)lParam)->code) {
+ case LVN_ITEMCHANGED:
+ {
+ NMLISTVIEW *nmlv = (NMLISTVIEW *)lParam;
+
+ if (!initDlg && ((nmlv->uNewState ^ nmlv->uOldState) & LVIS_STATEIMAGEMASK))
+ SendMessage(GetParent(GetParent(hwndDlg)), PSM_CHANGED, 0, 0);
+ }
+ break;
+ } // switch code - IDC_PROTOCOLLIST
+ break;
+ } //switch idFrom
+ }
+ break; //End WM_NOTIFY
+
+ default:
+ break;
+ }
+
+ return FALSE;
+}
+
+INT_PTR CALLBACK DlgProcBasicOptions(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lParam)
+{
+ unsigned int i;
+ static BOOL initDlg=FALSE;
+
+ switch (msg) {
+
+ case WM_INITDIALOG:
+ initDlg=TRUE;
+ TranslateDialogDefault(hwndDlg);
+
+ createProcessListAux();
createXstatusListAux();
- - CheckDlgButton(hwndDlg, IDC_ONMESSAGE, bFlashOnMsg ? BST_CHECKED:BST_UNCHECKED); - CheckDlgButton(hwndDlg, IDC_ONURL, bFlashOnURL ? BST_CHECKED:BST_UNCHECKED); - CheckDlgButton(hwndDlg, IDC_ONFILE, bFlashOnFile ? BST_CHECKED:BST_UNCHECKED); - CheckDlgButton(hwndDlg, IDC_ONOTHER, bFlashOnOther ? BST_CHECKED:BST_UNCHECKED); - - CheckDlgButton(hwndDlg, IDC_FSCREEN, bFullScreenMode ? BST_CHECKED:BST_UNCHECKED); - CheckDlgButton(hwndDlg, IDC_SSAVER, bScreenSaverRunning ? BST_CHECKED:BST_UNCHECKED); - CheckDlgButton(hwndDlg, IDC_LOCKED, bWorkstationLocked ? BST_CHECKED:BST_UNCHECKED); - if (!bWindowsNT) - EnableWindow(GetDlgItem(hwndDlg, IDC_LOCKED), FALSE); - CheckDlgButton(hwndDlg, IDC_PGMS, bProcessesAreRunning ? BST_CHECKED:BST_UNCHECKED); - CheckDlgButton(hwndDlg, IDC_ACTIVE, bWorkstationActive ? BST_CHECKED:BST_UNCHECKED); - - CheckDlgButton(hwndDlg, IDC_IFOPEN, bFlashIfMsgOpen ? BST_CHECKED:BST_UNCHECKED); - CheckDlgButton(hwndDlg, IDC_IFNOTTOP, bFlashIfMsgWinNotTop ? BST_CHECKED:BST_UNCHECKED); - if (!bFlashIfMsgOpen) - EnableWindow(GetDlgItem(hwndDlg, IDC_IFNOTTOP), FALSE); - CheckDlgButton(hwndDlg, IDC_IFOLDER, bFlashIfMsgOlder ? BST_CHECKED:BST_UNCHECKED); - SendDlgItemMessage(hwndDlg, IDC_OLDERSPIN, UDM_SETBUDDY, (WPARAM)GetDlgItem(hwndDlg, IDC_SOLDER), 0); - SendDlgItemMessage(hwndDlg, IDC_OLDERSPIN, UDM_SETRANGE32, 1, MAKELONG(UD_MAXVAL, 0)); - SendDlgItemMessage(hwndDlg, IDC_OLDERSPIN, UDM_SETPOS, 0, MAKELONG(wSecondsOlder, 0)); - if (!bFlashIfMsgOlder) { - EnableWindow(GetDlgItem(hwndDlg, IDC_SOLDER), FALSE); - EnableWindow(GetDlgItem(hwndDlg, IDC_OLDERSPIN), FALSE); - } - - CheckDlgButton(hwndDlg, IDC_UNTILBLK, bFlashUntil&UNTIL_NBLINKS ? BST_CHECKED:BST_UNCHECKED); - SendDlgItemMessage(hwndDlg, IDC_BLINKSPIN, UDM_SETBUDDY, (WPARAM)GetDlgItem(hwndDlg, IDC_SBLINK), 0); - SendDlgItemMessage(hwndDlg, IDC_BLINKSPIN, UDM_SETRANGE32, 1, MAKELONG(UD_MAXVAL, 0)); - SendDlgItemMessage(hwndDlg, IDC_BLINKSPIN, UDM_SETPOS, 0, MAKELONG(wBlinksNumber, 0)); - if (!(bFlashUntil & UNTIL_NBLINKS)) { - EnableWindow(GetDlgItem(hwndDlg, IDC_SBLINK), FALSE); - EnableWindow(GetDlgItem(hwndDlg, IDC_BLINKSPIN), FALSE); - } - CheckDlgButton(hwndDlg, IDC_UNTILATTENDED, bFlashUntil&UNTIL_REATTENDED ? BST_CHECKED:BST_UNCHECKED); - for (i=0; i < 2; i++) { - int index = SendDlgItemMessage(hwndDlg, IDC_MIRORWIN, CB_INSERTSTRING, (WPARAM)-1, (LPARAM)AttendedName[i]); - if (index != CB_ERR && index != CB_ERRSPACE) - SendDlgItemMessage(hwndDlg, IDC_MIRORWIN, CB_SETITEMDATA, (WPARAM)index, (LPARAM)i); - } - SendDlgItemMessage(hwndDlg, IDC_MIRORWIN, CB_SETCURSEL, (WPARAM)bMirandaOrWindows, 0); - if (!(bFlashUntil & UNTIL_REATTENDED)) - EnableWindow(GetDlgItem(hwndDlg, IDC_MIRORWIN), FALSE); - CheckDlgButton(hwndDlg, IDC_UNTILOPEN, bFlashUntil&UNTIL_EVENTSOPEN ? BST_CHECKED:BST_UNCHECKED); - CheckDlgButton(hwndDlg, IDC_UNTILCOND, bFlashUntil&UNTIL_CONDITIONS ? BST_CHECKED:BST_UNCHECKED); - - CheckDlgButton(hwndDlg, IDC_ONLINE, wStatusMap&MAP_ONLINE ? BST_CHECKED:BST_UNCHECKED); - CheckDlgButton(hwndDlg, IDC_AWAY, wStatusMap&MAP_AWAY ? BST_CHECKED:BST_UNCHECKED); - CheckDlgButton(hwndDlg, IDC_NA, wStatusMap&MAP_NA ? BST_CHECKED:BST_UNCHECKED); - CheckDlgButton(hwndDlg, IDC_OCCUPIED, wStatusMap&MAP_OCCUPIED ? BST_CHECKED:BST_UNCHECKED); - CheckDlgButton(hwndDlg, IDC_DND, wStatusMap&MAP_DND ? BST_CHECKED:BST_UNCHECKED); - CheckDlgButton(hwndDlg, IDC_FREECHAT, wStatusMap&MAP_FREECHAT ? BST_CHECKED:BST_UNCHECKED); - CheckDlgButton(hwndDlg, IDC_INVISIBLE, wStatusMap&MAP_INVISIBLE ? BST_CHECKED:BST_UNCHECKED); - CheckDlgButton(hwndDlg, IDC_ONTHEPHONE, wStatusMap&MAP_ONTHEPHONE ? BST_CHECKED:BST_UNCHECKED); - CheckDlgButton(hwndDlg, IDC_OUTTOLUNCH, wStatusMap&MAP_OUTTOLUNCH ? BST_CHECKED:BST_UNCHECKED); - CheckDlgButton(hwndDlg, IDC_OFFLINE, wStatusMap&MAP_OFFLINE ? BST_CHECKED:BST_UNCHECKED); - - SendDlgItemMessage(hwndDlg, IDC_REMCHECK, UDM_SETBUDDY, (WPARAM)GetDlgItem(hwndDlg, IDC_SREMCHECK), 0); - SendDlgItemMessage(hwndDlg, IDC_REMCHECK, UDM_SETRANGE32, 0, MAKELONG(UD_MAXVAL, 0)); - SendDlgItemMessage(hwndDlg, IDC_REMCHECK, UDM_SETPOS, 0, MAKELONG(wReminderCheck, 0)); - - initDlg=FALSE; - return TRUE; - - case WM_VSCROLL: - case WM_HSCROLL: - SendMessage(GetParent(GetParent(hwndDlg)), PSM_CHANGED, 0, 0); - break; - - case WM_DESTROY: - destroyProcessListAux(); +
+ CheckDlgButton(hwndDlg, IDC_ONMESSAGE, bFlashOnMsg ? BST_CHECKED:BST_UNCHECKED);
+ CheckDlgButton(hwndDlg, IDC_ONURL, bFlashOnURL ? BST_CHECKED:BST_UNCHECKED);
+ CheckDlgButton(hwndDlg, IDC_ONFILE, bFlashOnFile ? BST_CHECKED:BST_UNCHECKED);
+ CheckDlgButton(hwndDlg, IDC_ONOTHER, bFlashOnOther ? BST_CHECKED:BST_UNCHECKED);
+
+ CheckDlgButton(hwndDlg, IDC_FSCREEN, bFullScreenMode ? BST_CHECKED:BST_UNCHECKED);
+ CheckDlgButton(hwndDlg, IDC_SSAVER, bScreenSaverRunning ? BST_CHECKED:BST_UNCHECKED);
+ CheckDlgButton(hwndDlg, IDC_LOCKED, bWorkstationLocked ? BST_CHECKED:BST_UNCHECKED);
+ if (!bWindowsNT)
+ EnableWindow(GetDlgItem(hwndDlg, IDC_LOCKED), FALSE);
+ CheckDlgButton(hwndDlg, IDC_PGMS, bProcessesAreRunning ? BST_CHECKED:BST_UNCHECKED);
+ CheckDlgButton(hwndDlg, IDC_ACTIVE, bWorkstationActive ? BST_CHECKED:BST_UNCHECKED);
+
+ CheckDlgButton(hwndDlg, IDC_IFOPEN, bFlashIfMsgOpen ? BST_CHECKED:BST_UNCHECKED);
+ CheckDlgButton(hwndDlg, IDC_IFNOTTOP, bFlashIfMsgWinNotTop ? BST_CHECKED:BST_UNCHECKED);
+ if (!bFlashIfMsgOpen)
+ EnableWindow(GetDlgItem(hwndDlg, IDC_IFNOTTOP), FALSE);
+ CheckDlgButton(hwndDlg, IDC_IFOLDER, bFlashIfMsgOlder ? BST_CHECKED:BST_UNCHECKED);
+ SendDlgItemMessage(hwndDlg, IDC_OLDERSPIN, UDM_SETBUDDY, (WPARAM)GetDlgItem(hwndDlg, IDC_SOLDER), 0);
+ SendDlgItemMessage(hwndDlg, IDC_OLDERSPIN, UDM_SETRANGE32, 1, MAKELONG(UD_MAXVAL, 0));
+ SendDlgItemMessage(hwndDlg, IDC_OLDERSPIN, UDM_SETPOS, 0, MAKELONG(wSecondsOlder, 0));
+ if (!bFlashIfMsgOlder) {
+ EnableWindow(GetDlgItem(hwndDlg, IDC_SOLDER), FALSE);
+ EnableWindow(GetDlgItem(hwndDlg, IDC_OLDERSPIN), FALSE);
+ }
+
+ CheckDlgButton(hwndDlg, IDC_UNTILBLK, bFlashUntil&UNTIL_NBLINKS ? BST_CHECKED:BST_UNCHECKED);
+ SendDlgItemMessage(hwndDlg, IDC_BLINKSPIN, UDM_SETBUDDY, (WPARAM)GetDlgItem(hwndDlg, IDC_SBLINK), 0);
+ SendDlgItemMessage(hwndDlg, IDC_BLINKSPIN, UDM_SETRANGE32, 1, MAKELONG(UD_MAXVAL, 0));
+ SendDlgItemMessage(hwndDlg, IDC_BLINKSPIN, UDM_SETPOS, 0, MAKELONG(wBlinksNumber, 0));
+ if (!(bFlashUntil & UNTIL_NBLINKS)) {
+ EnableWindow(GetDlgItem(hwndDlg, IDC_SBLINK), FALSE);
+ EnableWindow(GetDlgItem(hwndDlg, IDC_BLINKSPIN), FALSE);
+ }
+ CheckDlgButton(hwndDlg, IDC_UNTILATTENDED, bFlashUntil&UNTIL_REATTENDED ? BST_CHECKED:BST_UNCHECKED);
+ for (i=0; i < 2; i++) {
+ int index = SendDlgItemMessage(hwndDlg, IDC_MIRORWIN, CB_INSERTSTRING, (WPARAM)-1, (LPARAM)AttendedName[i]);
+ if (index != CB_ERR && index != CB_ERRSPACE)
+ SendDlgItemMessage(hwndDlg, IDC_MIRORWIN, CB_SETITEMDATA, (WPARAM)index, (LPARAM)i);
+ }
+ SendDlgItemMessage(hwndDlg, IDC_MIRORWIN, CB_SETCURSEL, (WPARAM)bMirandaOrWindows, 0);
+ if (!(bFlashUntil & UNTIL_REATTENDED))
+ EnableWindow(GetDlgItem(hwndDlg, IDC_MIRORWIN), FALSE);
+ CheckDlgButton(hwndDlg, IDC_UNTILOPEN, bFlashUntil&UNTIL_EVENTSOPEN ? BST_CHECKED:BST_UNCHECKED);
+ CheckDlgButton(hwndDlg, IDC_UNTILCOND, bFlashUntil&UNTIL_CONDITIONS ? BST_CHECKED:BST_UNCHECKED);
+
+ CheckDlgButton(hwndDlg, IDC_ONLINE, wStatusMap&MAP_ONLINE ? BST_CHECKED:BST_UNCHECKED);
+ CheckDlgButton(hwndDlg, IDC_AWAY, wStatusMap&MAP_AWAY ? BST_CHECKED:BST_UNCHECKED);
+ CheckDlgButton(hwndDlg, IDC_NA, wStatusMap&MAP_NA ? BST_CHECKED:BST_UNCHECKED);
+ CheckDlgButton(hwndDlg, IDC_OCCUPIED, wStatusMap&MAP_OCCUPIED ? BST_CHECKED:BST_UNCHECKED);
+ CheckDlgButton(hwndDlg, IDC_DND, wStatusMap&MAP_DND ? BST_CHECKED:BST_UNCHECKED);
+ CheckDlgButton(hwndDlg, IDC_FREECHAT, wStatusMap&MAP_FREECHAT ? BST_CHECKED:BST_UNCHECKED);
+ CheckDlgButton(hwndDlg, IDC_INVISIBLE, wStatusMap&MAP_INVISIBLE ? BST_CHECKED:BST_UNCHECKED);
+ CheckDlgButton(hwndDlg, IDC_ONTHEPHONE, wStatusMap&MAP_ONTHEPHONE ? BST_CHECKED:BST_UNCHECKED);
+ CheckDlgButton(hwndDlg, IDC_OUTTOLUNCH, wStatusMap&MAP_OUTTOLUNCH ? BST_CHECKED:BST_UNCHECKED);
+ CheckDlgButton(hwndDlg, IDC_OFFLINE, wStatusMap&MAP_OFFLINE ? BST_CHECKED:BST_UNCHECKED);
+
+ SendDlgItemMessage(hwndDlg, IDC_REMCHECK, UDM_SETBUDDY, (WPARAM)GetDlgItem(hwndDlg, IDC_SREMCHECK), 0);
+ SendDlgItemMessage(hwndDlg, IDC_REMCHECK, UDM_SETRANGE32, 0, MAKELONG(UD_MAXVAL, 0));
+ SendDlgItemMessage(hwndDlg, IDC_REMCHECK, UDM_SETPOS, 0, MAKELONG(wReminderCheck, 0));
+
+ initDlg=FALSE;
+ return TRUE;
+
+ case WM_VSCROLL:
+ case WM_HSCROLL:
+ SendMessage(GetParent(GetParent(hwndDlg)), PSM_CHANGED, 0, 0);
+ break;
+
+ case WM_DESTROY:
+ destroyProcessListAux();
destroyXstatusListAux();
- break; - - case WM_COMMAND: - switch (LOWORD(wParam)) { - case IDC_ONMESSAGE: - case IDC_ONURL: - case IDC_ONFILE: - case IDC_ONOTHER: - case IDC_IFOPEN: - case IDC_IFNOTTOP: - case IDC_IFOLDER: - case IDC_UNTILBLK: - case IDC_UNTILATTENDED: - case IDC_MIRORWIN: - case IDC_UNTILOPEN: - case IDC_UNTILCOND: - case IDC_FSCREEN: - case IDC_SSAVER: - case IDC_LOCKED: - case IDC_PGMS: - case IDC_ACTIVE: - case IDC_ONLINE: - case IDC_AWAY: - case IDC_NA: - case IDC_OCCUPIED: - case IDC_DND: - case IDC_FREECHAT: - case IDC_INVISIBLE: - case IDC_ONTHEPHONE: - case IDC_OUTTOLUNCH: - case IDC_OFFLINE: - EnableWindow(GetDlgItem(hwndDlg, IDC_IFNOTTOP), IsDlgButtonChecked(hwndDlg, IDC_IFOPEN) == BST_CHECKED); - EnableWindow(GetDlgItem(hwndDlg, IDC_SOLDER), IsDlgButtonChecked(hwndDlg, IDC_IFOLDER) == BST_CHECKED); - EnableWindow(GetDlgItem(hwndDlg, IDC_OLDERSPIN), IsDlgButtonChecked(hwndDlg, IDC_IFOLDER) == BST_CHECKED); - EnableWindow(GetDlgItem(hwndDlg, IDC_SBLINK), IsDlgButtonChecked(hwndDlg, IDC_UNTILBLK) == BST_CHECKED); - EnableWindow(GetDlgItem(hwndDlg, IDC_BLINKSPIN), IsDlgButtonChecked(hwndDlg, IDC_UNTILBLK) == BST_CHECKED); - EnableWindow(GetDlgItem(hwndDlg, IDC_MIRORWIN), IsDlgButtonChecked(hwndDlg, IDC_UNTILATTENDED) == BST_CHECKED); - SendMessage(GetParent(GetParent(hwndDlg)), PSM_CHANGED, 0, 0); - return TRUE; - case IDC_SOLDER: - if(HIWORD(wParam) == EN_CHANGE && !initDlg) { - BOOL translated; - int val = GetDlgItemInt(hwndDlg, IDC_SOLDER, &translated, FALSE); - if (translated && val < 1) - SendDlgItemMessage(hwndDlg, IDC_OLDERSPIN, UDM_SETPOS, 0, MAKELONG(val, 0)); - SendMessage(GetParent(GetParent(hwndDlg)), PSM_CHANGED, 0, 0); - } - return TRUE; - case IDC_SBLINK: - if(HIWORD(wParam) == EN_CHANGE && !initDlg) { - BOOL translated; - int val = GetDlgItemInt(hwndDlg, IDC_SBLINK, &translated, FALSE); - if (translated && val < 1) - SendDlgItemMessage(hwndDlg, IDC_BLINKSPIN, UDM_SETPOS, 0, MAKELONG(val, 0)); - SendMessage(GetParent(GetParent(hwndDlg)), PSM_CHANGED, 0, 0); - } - return TRUE; - case IDC_ASSIGNPGMS: - if (DialogBoxParam(hInst, MAKEINTRESOURCE(IDD_PROCESSES), hwndDlg, DlgProcProcesses, 0) == IDC_OKPGM) - SendMessage(GetParent(GetParent(hwndDlg)), PSM_CHANGED, 0, 0); - return TRUE; + break;
+
+ case WM_COMMAND:
+ switch (LOWORD(wParam)) {
+ case IDC_ONMESSAGE:
+ case IDC_ONURL:
+ case IDC_ONFILE:
+ case IDC_ONOTHER:
+ case IDC_IFOPEN:
+ case IDC_IFNOTTOP:
+ case IDC_IFOLDER:
+ case IDC_UNTILBLK:
+ case IDC_UNTILATTENDED:
+ case IDC_MIRORWIN:
+ case IDC_UNTILOPEN:
+ case IDC_UNTILCOND:
+ case IDC_FSCREEN:
+ case IDC_SSAVER:
+ case IDC_LOCKED:
+ case IDC_PGMS:
+ case IDC_ACTIVE:
+ case IDC_ONLINE:
+ case IDC_AWAY:
+ case IDC_NA:
+ case IDC_OCCUPIED:
+ case IDC_DND:
+ case IDC_FREECHAT:
+ case IDC_INVISIBLE:
+ case IDC_ONTHEPHONE:
+ case IDC_OUTTOLUNCH:
+ case IDC_OFFLINE:
+ EnableWindow(GetDlgItem(hwndDlg, IDC_IFNOTTOP), IsDlgButtonChecked(hwndDlg, IDC_IFOPEN) == BST_CHECKED);
+ EnableWindow(GetDlgItem(hwndDlg, IDC_SOLDER), IsDlgButtonChecked(hwndDlg, IDC_IFOLDER) == BST_CHECKED);
+ EnableWindow(GetDlgItem(hwndDlg, IDC_OLDERSPIN), IsDlgButtonChecked(hwndDlg, IDC_IFOLDER) == BST_CHECKED);
+ EnableWindow(GetDlgItem(hwndDlg, IDC_SBLINK), IsDlgButtonChecked(hwndDlg, IDC_UNTILBLK) == BST_CHECKED);
+ EnableWindow(GetDlgItem(hwndDlg, IDC_BLINKSPIN), IsDlgButtonChecked(hwndDlg, IDC_UNTILBLK) == BST_CHECKED);
+ EnableWindow(GetDlgItem(hwndDlg, IDC_MIRORWIN), IsDlgButtonChecked(hwndDlg, IDC_UNTILATTENDED) == BST_CHECKED);
+ SendMessage(GetParent(GetParent(hwndDlg)), PSM_CHANGED, 0, 0);
+ return TRUE;
+ case IDC_SOLDER:
+ if(HIWORD(wParam) == EN_CHANGE && !initDlg) {
+ BOOL translated;
+ int val = GetDlgItemInt(hwndDlg, IDC_SOLDER, &translated, FALSE);
+ if (translated && val < 1)
+ SendDlgItemMessage(hwndDlg, IDC_OLDERSPIN, UDM_SETPOS, 0, MAKELONG(val, 0));
+ SendMessage(GetParent(GetParent(hwndDlg)), PSM_CHANGED, 0, 0);
+ }
+ return TRUE;
+ case IDC_SBLINK:
+ if(HIWORD(wParam) == EN_CHANGE && !initDlg) {
+ BOOL translated;
+ int val = GetDlgItemInt(hwndDlg, IDC_SBLINK, &translated, FALSE);
+ if (translated && val < 1)
+ SendDlgItemMessage(hwndDlg, IDC_BLINKSPIN, UDM_SETPOS, 0, MAKELONG(val, 0));
+ SendMessage(GetParent(GetParent(hwndDlg)), PSM_CHANGED, 0, 0);
+ }
+ return TRUE;
+ case IDC_ASSIGNPGMS:
+ if (DialogBoxParam(hInst, MAKEINTRESOURCE(IDD_PROCESSES), hwndDlg, DlgProcProcesses, 0) == IDC_OKPGM)
+ SendMessage(GetParent(GetParent(hwndDlg)), PSM_CHANGED, 0, 0);
+ return TRUE;
case IDC_SELECTXSTATUS:
if (DialogBoxParam(hInst, MAKEINTRESOURCE(IDD_XSTATUSES), hwndDlg, DlgProcXstatusList, 0) == IDC_OKXST)
SendMessage(GetParent(GetParent(hwndDlg)), PSM_CHANGED, 0, 0);
return TRUE;
- case IDC_SREMCHECK: - if(HIWORD(wParam) == EN_CHANGE && !initDlg) - SendMessage(GetParent(GetParent(hwndDlg)), PSM_CHANGED, 0, 0); - return TRUE; - } - break; - - case WM_NOTIFY: - { - unsigned int j; - BYTE untilMap = 0; - WORD statusMap = 0; - //Here we have pressed either the OK or the APPLY button. - switch(((LPNMHDR)lParam)->idFrom) { - case 0: - switch (((LPNMHDR)lParam)->code) { - case PSN_APPLY: - DBWriteContactSettingByte(NULL, KEYBDMODULE, "onmsg", (BYTE)(IsDlgButtonChecked(hwndDlg, IDC_ONMESSAGE) == BST_CHECKED ? 1:0)); - DBWriteContactSettingByte(NULL, KEYBDMODULE, "onurl", (BYTE)(IsDlgButtonChecked(hwndDlg, IDC_ONURL) == BST_CHECKED ? 1:0)); - DBWriteContactSettingByte(NULL, KEYBDMODULE, "onfile", (BYTE)(IsDlgButtonChecked(hwndDlg, IDC_ONFILE) == BST_CHECKED ? 1:0)); - DBWriteContactSettingByte(NULL, KEYBDMODULE, "onother", (BYTE)(IsDlgButtonChecked(hwndDlg, IDC_ONOTHER) == BST_CHECKED ? 1:0)); - - DBWriteContactSettingByte(NULL, KEYBDMODULE, "fscreenmode", (BYTE)(IsDlgButtonChecked(hwndDlg, IDC_FSCREEN) == BST_CHECKED ? 1:0)); - DBWriteContactSettingByte(NULL, KEYBDMODULE, "ssaverrunning", (BYTE)(IsDlgButtonChecked(hwndDlg, IDC_SSAVER) == BST_CHECKED ? 1:0)); - DBWriteContactSettingByte(NULL, KEYBDMODULE, "wstationlocked", (BYTE)(IsDlgButtonChecked(hwndDlg, IDC_LOCKED) == BST_CHECKED ? 1:0)); - DBWriteContactSettingByte(NULL, KEYBDMODULE, "procsrunning", (BYTE)(IsDlgButtonChecked(hwndDlg, IDC_PGMS) == BST_CHECKED ? 1:0)); - DBWriteContactSettingByte(NULL, KEYBDMODULE, "wstationactive", (BYTE)(IsDlgButtonChecked(hwndDlg, IDC_ACTIVE) == BST_CHECKED ? 1:0)); - - DBWriteContactSettingByte(NULL, KEYBDMODULE, "ifmsgopen", (BYTE)(IsDlgButtonChecked(hwndDlg, IDC_IFOPEN) == BST_CHECKED ? 1:0)); - DBWriteContactSettingByte(NULL, KEYBDMODULE, "ifmsgnottop", (BYTE)(IsDlgButtonChecked(hwndDlg, IDC_IFNOTTOP) == BST_CHECKED ? 1:0)); - DBWriteContactSettingByte(NULL, KEYBDMODULE, "ifmsgolder", (BYTE)(IsDlgButtonChecked(hwndDlg, IDC_IFOLDER) == BST_CHECKED ? 1:0)); - DBWriteContactSettingWord(NULL, KEYBDMODULE, "secsolder", (WORD)SendDlgItemMessage(hwndDlg, IDC_OLDERSPIN, UDM_GETPOS, 0, 0)); - - if(IsDlgButtonChecked(hwndDlg, IDC_UNTILBLK) == BST_CHECKED) - untilMap |= UNTIL_NBLINKS; - if (IsDlgButtonChecked(hwndDlg, IDC_UNTILATTENDED) == BST_CHECKED) - untilMap |= UNTIL_REATTENDED; - if (IsDlgButtonChecked(hwndDlg, IDC_UNTILOPEN) == BST_CHECKED) - untilMap |= UNTIL_EVENTSOPEN; - if (IsDlgButtonChecked(hwndDlg, IDC_UNTILCOND) == BST_CHECKED) - untilMap |= UNTIL_CONDITIONS; - DBWriteContactSettingByte(NULL, KEYBDMODULE, "funtil", untilMap); - DBWriteContactSettingWord(NULL, KEYBDMODULE, "nblinks", (WORD)SendDlgItemMessage(hwndDlg, IDC_BLINKSPIN, UDM_GETPOS, 0, 0)); - DBWriteContactSettingByte(NULL, KEYBDMODULE, "mirorwin", (BYTE)SendDlgItemMessage(hwndDlg, IDC_MIRORWIN, CB_GETITEMDATA, (WPARAM)SendDlgItemMessage(hwndDlg, IDC_MIRORWIN, CB_GETCURSEL, 0, 0), 0)); - - if(IsDlgButtonChecked(hwndDlg, IDC_ONLINE) == BST_CHECKED) - statusMap |= MAP_ONLINE; - if(IsDlgButtonChecked(hwndDlg, IDC_AWAY) == BST_CHECKED) - statusMap |= MAP_AWAY; - if(IsDlgButtonChecked(hwndDlg, IDC_NA) == BST_CHECKED) - statusMap |= MAP_NA; - if(IsDlgButtonChecked(hwndDlg, IDC_OCCUPIED) == BST_CHECKED) - statusMap |= MAP_OCCUPIED; - if(IsDlgButtonChecked(hwndDlg, IDC_DND) == BST_CHECKED) - statusMap |= MAP_DND; - if(IsDlgButtonChecked(hwndDlg, IDC_FREECHAT) == BST_CHECKED) - statusMap |= MAP_FREECHAT; - if(IsDlgButtonChecked(hwndDlg, IDC_INVISIBLE) == BST_CHECKED) - statusMap |= MAP_INVISIBLE; - if(IsDlgButtonChecked(hwndDlg, IDC_ONTHEPHONE) == BST_CHECKED) - statusMap |= MAP_ONTHEPHONE; - if(IsDlgButtonChecked(hwndDlg, IDC_OUTTOLUNCH) == BST_CHECKED) - statusMap |= MAP_OUTTOLUNCH; - if(IsDlgButtonChecked(hwndDlg, IDC_OFFLINE) == BST_CHECKED) - statusMap |= MAP_OFFLINE; - DBWriteContactSettingWord(NULL, KEYBDMODULE, "status", statusMap); - - DBWriteContactSettingWord(NULL, KEYBDMODULE, "remcheck", (WORD)SendDlgItemMessage(hwndDlg, IDC_REMCHECK, UDM_GETPOS, 0, 0)); - - for (i=0, j=0; j < ProcessListAux.count; j++) - if (ProcessListAux.szFileName[j]) - DBWriteContactSettingString(NULL, KEYBDMODULE, fmtDBSettingName("process%d", i++), ProcessListAux.szFileName[j]); - DBWriteContactSettingWord(NULL, KEYBDMODULE, "processcount", (WORD)i); - while (!DBDeleteContactSetting(NULL, KEYBDMODULE, fmtDBSettingName("process%d", i++))); - + case IDC_SREMCHECK:
+ if(HIWORD(wParam) == EN_CHANGE && !initDlg)
+ SendMessage(GetParent(GetParent(hwndDlg)), PSM_CHANGED, 0, 0);
+ return TRUE;
+ }
+ break;
+
+ case WM_NOTIFY:
+ {
+ unsigned int j;
+ BYTE untilMap = 0;
+ WORD statusMap = 0;
+ //Here we have pressed either the OK or the APPLY button.
+ switch(((LPNMHDR)lParam)->idFrom) {
+ case 0:
+ switch (((LPNMHDR)lParam)->code) {
+ case PSN_APPLY:
+ DBWriteContactSettingByte(NULL, KEYBDMODULE, "onmsg", (BYTE)(IsDlgButtonChecked(hwndDlg, IDC_ONMESSAGE) == BST_CHECKED ? 1:0));
+ DBWriteContactSettingByte(NULL, KEYBDMODULE, "onurl", (BYTE)(IsDlgButtonChecked(hwndDlg, IDC_ONURL) == BST_CHECKED ? 1:0));
+ DBWriteContactSettingByte(NULL, KEYBDMODULE, "onfile", (BYTE)(IsDlgButtonChecked(hwndDlg, IDC_ONFILE) == BST_CHECKED ? 1:0));
+ DBWriteContactSettingByte(NULL, KEYBDMODULE, "onother", (BYTE)(IsDlgButtonChecked(hwndDlg, IDC_ONOTHER) == BST_CHECKED ? 1:0));
+
+ DBWriteContactSettingByte(NULL, KEYBDMODULE, "fscreenmode", (BYTE)(IsDlgButtonChecked(hwndDlg, IDC_FSCREEN) == BST_CHECKED ? 1:0));
+ DBWriteContactSettingByte(NULL, KEYBDMODULE, "ssaverrunning", (BYTE)(IsDlgButtonChecked(hwndDlg, IDC_SSAVER) == BST_CHECKED ? 1:0));
+ DBWriteContactSettingByte(NULL, KEYBDMODULE, "wstationlocked", (BYTE)(IsDlgButtonChecked(hwndDlg, IDC_LOCKED) == BST_CHECKED ? 1:0));
+ DBWriteContactSettingByte(NULL, KEYBDMODULE, "procsrunning", (BYTE)(IsDlgButtonChecked(hwndDlg, IDC_PGMS) == BST_CHECKED ? 1:0));
+ DBWriteContactSettingByte(NULL, KEYBDMODULE, "wstationactive", (BYTE)(IsDlgButtonChecked(hwndDlg, IDC_ACTIVE) == BST_CHECKED ? 1:0));
+
+ DBWriteContactSettingByte(NULL, KEYBDMODULE, "ifmsgopen", (BYTE)(IsDlgButtonChecked(hwndDlg, IDC_IFOPEN) == BST_CHECKED ? 1:0));
+ DBWriteContactSettingByte(NULL, KEYBDMODULE, "ifmsgnottop", (BYTE)(IsDlgButtonChecked(hwndDlg, IDC_IFNOTTOP) == BST_CHECKED ? 1:0));
+ DBWriteContactSettingByte(NULL, KEYBDMODULE, "ifmsgolder", (BYTE)(IsDlgButtonChecked(hwndDlg, IDC_IFOLDER) == BST_CHECKED ? 1:0));
+ DBWriteContactSettingWord(NULL, KEYBDMODULE, "secsolder", (WORD)SendDlgItemMessage(hwndDlg, IDC_OLDERSPIN, UDM_GETPOS, 0, 0));
+
+ if(IsDlgButtonChecked(hwndDlg, IDC_UNTILBLK) == BST_CHECKED)
+ untilMap |= UNTIL_NBLINKS;
+ if (IsDlgButtonChecked(hwndDlg, IDC_UNTILATTENDED) == BST_CHECKED)
+ untilMap |= UNTIL_REATTENDED;
+ if (IsDlgButtonChecked(hwndDlg, IDC_UNTILOPEN) == BST_CHECKED)
+ untilMap |= UNTIL_EVENTSOPEN;
+ if (IsDlgButtonChecked(hwndDlg, IDC_UNTILCOND) == BST_CHECKED)
+ untilMap |= UNTIL_CONDITIONS;
+ DBWriteContactSettingByte(NULL, KEYBDMODULE, "funtil", untilMap);
+ DBWriteContactSettingWord(NULL, KEYBDMODULE, "nblinks", (WORD)SendDlgItemMessage(hwndDlg, IDC_BLINKSPIN, UDM_GETPOS, 0, 0));
+ DBWriteContactSettingByte(NULL, KEYBDMODULE, "mirorwin", (BYTE)SendDlgItemMessage(hwndDlg, IDC_MIRORWIN, CB_GETITEMDATA, (WPARAM)SendDlgItemMessage(hwndDlg, IDC_MIRORWIN, CB_GETCURSEL, 0, 0), 0));
+
+ if(IsDlgButtonChecked(hwndDlg, IDC_ONLINE) == BST_CHECKED)
+ statusMap |= MAP_ONLINE;
+ if(IsDlgButtonChecked(hwndDlg, IDC_AWAY) == BST_CHECKED)
+ statusMap |= MAP_AWAY;
+ if(IsDlgButtonChecked(hwndDlg, IDC_NA) == BST_CHECKED)
+ statusMap |= MAP_NA;
+ if(IsDlgButtonChecked(hwndDlg, IDC_OCCUPIED) == BST_CHECKED)
+ statusMap |= MAP_OCCUPIED;
+ if(IsDlgButtonChecked(hwndDlg, IDC_DND) == BST_CHECKED)
+ statusMap |= MAP_DND;
+ if(IsDlgButtonChecked(hwndDlg, IDC_FREECHAT) == BST_CHECKED)
+ statusMap |= MAP_FREECHAT;
+ if(IsDlgButtonChecked(hwndDlg, IDC_INVISIBLE) == BST_CHECKED)
+ statusMap |= MAP_INVISIBLE;
+ if(IsDlgButtonChecked(hwndDlg, IDC_ONTHEPHONE) == BST_CHECKED)
+ statusMap |= MAP_ONTHEPHONE;
+ if(IsDlgButtonChecked(hwndDlg, IDC_OUTTOLUNCH) == BST_CHECKED)
+ statusMap |= MAP_OUTTOLUNCH;
+ if(IsDlgButtonChecked(hwndDlg, IDC_OFFLINE) == BST_CHECKED)
+ statusMap |= MAP_OFFLINE;
+ DBWriteContactSettingWord(NULL, KEYBDMODULE, "status", statusMap);
+
+ DBWriteContactSettingWord(NULL, KEYBDMODULE, "remcheck", (WORD)SendDlgItemMessage(hwndDlg, IDC_REMCHECK, UDM_GETPOS, 0, 0));
+
+ for (i=0, j=0; j < ProcessListAux.count; j++)
+ if (ProcessListAux.szFileName[j])
+ DBWriteContactSettingWString(NULL, KEYBDMODULE, fmtDBSettingName("process%d", i++), ProcessListAux.szFileName[j]);
+ DBWriteContactSettingWord(NULL, KEYBDMODULE, "processcount", (WORD)i);
+ while (!DBDeleteContactSetting(NULL, KEYBDMODULE, fmtDBSettingName("process%d", i++)));
+
if (XstatusListAux)
for (i=0; i < ProtoList.protoCount; i++)
for(j=0; j < XstatusListAux[i].count; j++)
DBWriteContactSettingByte(NULL, KEYBDMODULE, fmtDBSettingName("%sxstatus%d", ProtoList.protoInfo[i].szProto, j), (BYTE)XstatusListAux[i].enabled[j]);
- LoadSettings(); - - return TRUE; - } // switch code - break; - } //switch idFrom - } - break; //End WM_NOTIFY - - default: - break; - } - - return FALSE; -} - -INT_PTR CALLBACK DlgProcEffectOptions(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lParam) -{ - int i; - DBVARIANT dbv; - static BOOL initDlg=FALSE; - - switch (msg) { - - case WM_INITDIALOG: - initDlg=TRUE; - TranslateDialogDefault(hwndDlg); - - trillianLedsMsg = bTrillianLedsMsg; - trillianLedsURL = bTrillianLedsURL; - trillianLedsFile = bTrillianLedsFile; - trillianLedsOther = bTrillianLedsOther; - - CheckDlgButton(hwndDlg, IDC_NUM, bFlashLed[0] ? BST_CHECKED:BST_UNCHECKED); - CheckDlgButton(hwndDlg, IDC_CAPS, bFlashLed[1] ? BST_CHECKED:BST_UNCHECKED); - CheckDlgButton(hwndDlg, IDC_SCROLL, bFlashLed[2] ? BST_CHECKED:BST_UNCHECKED); - - CheckDlgButton(hwndDlg, IDC_SAMETIME, bFlashEffect == FLASH_SAMETIME ? BST_CHECKED:BST_UNCHECKED); - CheckDlgButton(hwndDlg, IDC_INTURN, bFlashEffect == FLASH_INTURN ? BST_CHECKED:BST_UNCHECKED); - CheckDlgButton(hwndDlg, IDC_INSEQUENCE, bFlashEffect == FLASH_INSEQUENCE ? BST_CHECKED:BST_UNCHECKED); - for (i=0; i < 3; i++) { - int index = SendDlgItemMessage(hwndDlg, IDC_SEQORDER, CB_INSERTSTRING, (WPARAM)-1, (LPARAM)Translate(OrderName[i])); - if (index != CB_ERR && index != CB_ERRSPACE) - SendDlgItemMessage(hwndDlg, IDC_SEQORDER, CB_SETITEMDATA, (WPARAM)index, (LPARAM)i); - } - SendDlgItemMessage(hwndDlg, IDC_SEQORDER, CB_SETCURSEL, (WPARAM)bSequenceOrder, 0); - if (bFlashEffect != FLASH_INSEQUENCE) - EnableWindow(GetDlgItem(hwndDlg, IDC_SEQORDER), FALSE); - CheckDlgButton(hwndDlg, IDC_CUSTOM, bFlashEffect == FLASH_CUSTOM ? BST_CHECKED:BST_UNCHECKED); - for (i=0; !DBGetContactSetting(NULL, KEYBDMODULE, fmtDBSettingName("theme%d", i), &dbv); i++) { - int index = SendDlgItemMessage(hwndDlg, IDC_SCUSTOM, CB_INSERTSTRING, (WPARAM)-1, (LPARAM)dbv.pszVal); - DBFreeVariant(&dbv); - if (index != CB_ERR && index != CB_ERRSPACE) - SendDlgItemMessage(hwndDlg, IDC_SCUSTOM, CB_SETITEMDATA, (WPARAM)index, (LPARAM)i); - } - SendDlgItemMessage(hwndDlg, IDC_SCUSTOM, CB_SETCURSEL, (WPARAM)wCustomTheme, 0); - if (bFlashEffect != FLASH_CUSTOM) - EnableWindow(GetDlgItem(hwndDlg, IDC_SCUSTOM), FALSE); - CheckDlgButton(hwndDlg, IDC_TRILLIAN, bFlashEffect == FLASH_TRILLIAN ? BST_CHECKED:BST_UNCHECKED); - if (bFlashEffect != FLASH_TRILLIAN) - EnableWindow(GetDlgItem(hwndDlg, IDC_ASSIGNLEDS), FALSE); - - SendDlgItemMessage(hwndDlg, IDC_DELAYSPIN, UDM_SETBUDDY, (WPARAM)GetDlgItem(hwndDlg, IDC_SDELAY), 0); - SendDlgItemMessage(hwndDlg, IDC_DELAYSPIN, UDM_SETRANGE32, 0, MAKELONG(UD_MAXVAL, 0)); - SendDlgItemMessage(hwndDlg, IDC_DELAYSPIN, UDM_SETPOS, 0, MAKELONG(wStartDelay, 0)); - - SendDlgItemMessage(hwndDlg, IDC_SPEED, TBM_SETRANGE, FALSE, MAKELONG(0, 5)); - SendDlgItemMessage(hwndDlg, IDC_SPEED, TBM_SETPOS, TRUE, bFlashSpeed); - - CheckDlgButton(hwndDlg, IDC_KEYPRESSES, bEmulateKeypresses ? BST_CHECKED:BST_UNCHECKED); - - initDlg=FALSE; - return TRUE; - - case WM_VSCROLL: - case WM_HSCROLL: - SendMessage(GetParent(GetParent(hwndDlg)), PSM_CHANGED, 0, 0); - break; - - case WM_DESTROY: - previewFlashing(FALSE); - break; - - case WM_COMMAND: - switch (LOWORD(wParam)) { - case IDC_NUM: - case IDC_CAPS: - case IDC_SCROLL: - case IDC_SAMETIME: - case IDC_INTURN: - case IDC_INSEQUENCE: - case IDC_SEQORDER: - case IDC_CUSTOM: - case IDC_TRILLIAN: - case IDC_SCUSTOM: - case IDC_SPEED: - case IDC_KEYPRESSES: - EnableWindow(GetDlgItem(hwndDlg, IDC_SEQORDER), IsDlgButtonChecked(hwndDlg, IDC_INSEQUENCE) == BST_CHECKED); - EnableWindow(GetDlgItem(hwndDlg, IDC_SCUSTOM), IsDlgButtonChecked(hwndDlg, IDC_CUSTOM) == BST_CHECKED); - EnableWindow(GetDlgItem(hwndDlg, IDC_ASSIGNLEDS), IsDlgButtonChecked(hwndDlg, IDC_TRILLIAN) == BST_CHECKED); - SendMessage(GetParent(GetParent(hwndDlg)), PSM_CHANGED, 0, 0); - return TRUE; - case IDC_ASSIGNLEDS: - if (DialogBoxParam(hInst, MAKEINTRESOURCE(IDD_EVENTLEDS), hwndDlg, DlgProcEventLeds, 0) == IDC_OK) - SendMessage(GetParent(GetParent(hwndDlg)), PSM_CHANGED, 0, 0); - return TRUE; - case IDC_SDELAY: - if(HIWORD(wParam) == EN_CHANGE && !initDlg) - SendMessage(GetParent(GetParent(hwndDlg)), PSM_CHANGED, 0, 0); - return TRUE; - case IDC_PREVIEW: - previewFlashing(IsDlgButtonChecked(hwndDlg, IDC_PREVIEW) == BST_CHECKED); - return TRUE; - } - break; - - case WM_NOTIFY: - { - //Here we have pressed either the OK or the APPLY button. - switch(((LPNMHDR)lParam)->idFrom) { - case 0: - switch (((LPNMHDR)lParam)->code) { - case PSN_APPLY: - DBWriteContactSettingByte(NULL, KEYBDMODULE, "fnum", (BYTE)(IsDlgButtonChecked(hwndDlg, IDC_NUM) == BST_CHECKED ? 1:0)); - DBWriteContactSettingByte(NULL, KEYBDMODULE, "fcaps", (BYTE)(IsDlgButtonChecked(hwndDlg, IDC_CAPS) == BST_CHECKED ? 1:0)); - DBWriteContactSettingByte(NULL, KEYBDMODULE, "fscroll", (BYTE)(IsDlgButtonChecked(hwndDlg, IDC_SCROLL) == BST_CHECKED ? 1:0)); - - if(IsDlgButtonChecked(hwndDlg, IDC_INTURN) == BST_CHECKED) - DBWriteContactSettingByte(NULL, KEYBDMODULE, "feffect", FLASH_INTURN); - else - if (IsDlgButtonChecked(hwndDlg, IDC_INSEQUENCE) == BST_CHECKED) - DBWriteContactSettingByte(NULL, KEYBDMODULE, "feffect", FLASH_INSEQUENCE); - else - if (IsDlgButtonChecked(hwndDlg, IDC_CUSTOM) == BST_CHECKED) - DBWriteContactSettingByte(NULL, KEYBDMODULE, "feffect", FLASH_CUSTOM); - else - if (IsDlgButtonChecked(hwndDlg, IDC_TRILLIAN) == BST_CHECKED) - DBWriteContactSettingByte(NULL, KEYBDMODULE, "feffect", FLASH_TRILLIAN); - else - DBWriteContactSettingByte(NULL, KEYBDMODULE, "feffect", FLASH_SAMETIME); - DBWriteContactSettingByte(NULL, KEYBDMODULE, "order", (BYTE)SendDlgItemMessage(hwndDlg, IDC_SEQORDER, CB_GETITEMDATA, (WPARAM)SendDlgItemMessage(hwndDlg, IDC_SEQORDER, CB_GETCURSEL, 0, 0), 0)); - DBWriteContactSettingWord(NULL, KEYBDMODULE, "custom", (WORD)SendDlgItemMessage(hwndDlg, IDC_SCUSTOM, CB_GETITEMDATA, (WPARAM)SendDlgItemMessage(hwndDlg, IDC_SCUSTOM, CB_GETCURSEL, 0, 0), 0)); - - DBWriteContactSettingByte(NULL, KEYBDMODULE, "ledsmsg", trillianLedsMsg); - DBWriteContactSettingByte(NULL, KEYBDMODULE, "ledsfile", trillianLedsFile); - DBWriteContactSettingByte(NULL, KEYBDMODULE, "ledsurl", trillianLedsURL); - DBWriteContactSettingByte(NULL, KEYBDMODULE, "ledsother", trillianLedsOther); - - DBWriteContactSettingWord(NULL, KEYBDMODULE, "sdelay", (WORD)SendDlgItemMessage(hwndDlg, IDC_DELAYSPIN, UDM_GETPOS, 0, 0)); - - DBWriteContactSettingByte(NULL, KEYBDMODULE, "speed", (BYTE)SendDlgItemMessage(hwndDlg, IDC_SPEED, TBM_GETPOS, 0, 0)); - - DBWriteContactSettingByte(NULL, KEYBDMODULE, "keypresses", (BYTE)(IsDlgButtonChecked(hwndDlg, IDC_KEYPRESSES) == BST_CHECKED ? 1:0)); - - LoadSettings(); - - return TRUE; - } // switch code - break; - } //switch idFrom - } - break; //End WM_NOTIFY - - default: - break; - } - - return FALSE; -} - -INT_PTR CALLBACK DlgProcThemeOptions(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lParam) -{ - int i; - char *str; - DBVARIANT dbv; - static BOOL initDlg=FALSE; - - switch (msg) { - - case WM_INITDIALOG: - initDlg=TRUE; - TranslateDialogDefault(hwndDlg); - - SendDlgItemMessage(hwndDlg, IDC_THEME, EM_LIMITTEXT, MAX_PATH, 0); - SendDlgItemMessage(hwndDlg, IDC_CUSTOMSTRING, EM_LIMITTEXT, MAX_PATH, 0); - - for (i=0; !DBGetContactSetting(NULL, KEYBDMODULE, fmtDBSettingName("theme%d", i), &dbv); i++) { - int index = SendDlgItemMessage(hwndDlg, IDC_THEME, CB_INSERTSTRING, (WPARAM)-1, (LPARAM)dbv.pszVal); - DBFreeVariant(&dbv); - if (index != CB_ERR && index != CB_ERRSPACE) { - str = (char *)malloc(MAX_PATH+1); - if (str) - if (DBGetContactSetting(NULL, KEYBDMODULE, fmtDBSettingName("custom%d", i), &dbv)) - str[0] = '\0'; - else { - strcpy(str, dbv.pszVal); - DBFreeVariant(&dbv); - } - SendDlgItemMessage(hwndDlg, IDC_THEME, CB_SETITEMDATA, (WPARAM)index, (LPARAM)str); - } - } - - EnableWindow(GetDlgItem(hwndDlg, IDC_ADD), FALSE); - EnableWindow(GetDlgItem(hwndDlg, IDC_UPDATE), FALSE); - if (SendDlgItemMessage(hwndDlg, IDC_THEME, CB_GETCOUNT, 0, 0) == 0) - EnableWindow(GetDlgItem(hwndDlg, IDC_DELETE), FALSE); - else { - SendDlgItemMessage(hwndDlg, IDC_THEME, CB_SETCURSEL, (WPARAM)wCustomTheme, 0); - str = (char *)SendDlgItemMessage(hwndDlg, IDC_THEME, CB_GETITEMDATA, (WPARAM)wCustomTheme, 0); - if (str) - SetDlgItemText(hwndDlg, IDC_CUSTOMSTRING, str); - } - - CheckDlgButton(hwndDlg, IDC_OVERRIDE, bOverride ? BST_CHECKED:BST_UNCHECKED); - - initDlg=FALSE; - return TRUE; - - case WM_COMMAND: - switch (LOWORD(wParam)) { - case IDC_THEME: - switch (HIWORD(wParam)) { - int item; - char theme[MAX_PATH+1]; - - case CBN_SELENDOK: - case CBN_SELCHANGE: - str = (char *)SendMessage((HWND)lParam, CB_GETITEMDATA, (WPARAM)SendMessage((HWND)lParam, CB_GETCURSEL, 0, 0), 0); - if (str) - SetDlgItemText(hwndDlg, IDC_CUSTOMSTRING, str); - else - SetDlgItemText(hwndDlg, IDC_CUSTOMSTRING, ""); - EnableWindow(GetDlgItem(hwndDlg, IDC_ADD), FALSE); - EnableWindow(GetDlgItem(hwndDlg, IDC_UPDATE), FALSE); - EnableWindow(GetDlgItem(hwndDlg, IDC_DELETE), TRUE); - break; - case CBN_EDITCHANGE: - GetDlgItemText(hwndDlg, IDC_THEME, theme, sizeof(theme)); - if ((item = SendMessage((HWND)lParam, CB_FINDSTRINGEXACT, -1, (LPARAM)theme)) == CB_ERR) { //new theme - SetDlgItemText(hwndDlg, IDC_CUSTOMSTRING, ""); - EnableWindow(GetDlgItem(hwndDlg, IDC_ADD), TRUE); - EnableWindow(GetDlgItem(hwndDlg, IDC_DELETE), FALSE); - } else { - str = (char *)SendMessage((HWND)lParam, CB_GETITEMDATA, (WPARAM)item, 0); - if (str) - SetDlgItemText(hwndDlg, IDC_CUSTOMSTRING, str); - else - SetDlgItemText(hwndDlg, IDC_CUSTOMSTRING, ""); - EnableWindow(GetDlgItem(hwndDlg, IDC_ADD), FALSE); - EnableWindow(GetDlgItem(hwndDlg, IDC_DELETE), TRUE); - } - EnableWindow(GetDlgItem(hwndDlg, IDC_UPDATE), FALSE); - break; - } - return TRUE; - case IDC_CUSTOMSTRING: - if(HIWORD(wParam) == EN_CHANGE) { - int item; - char theme[MAX_PATH+1], customAux[MAX_PATH+1]; - - GetDlgItemText(hwndDlg, IDC_THEME, theme, sizeof(theme)); - if ((item = SendDlgItemMessage(hwndDlg, IDC_THEME, CB_FINDSTRINGEXACT, -1, (LPARAM)theme)) == CB_ERR) - return TRUE; - str = (char *)SendDlgItemMessage(hwndDlg, IDC_THEME, CB_GETITEMDATA, (WPARAM)item, 0); - if (str) { - GetDlgItemText(hwndDlg, IDC_CUSTOMSTRING, customAux, MAX_PATH); - if (strcmp(str, customAux)) - EnableWindow(GetDlgItem(hwndDlg, IDC_UPDATE), TRUE); - else - EnableWindow(GetDlgItem(hwndDlg, IDC_UPDATE), FALSE); - } - } - return TRUE; - case IDC_TEST: - { - char custom[MAX_PATH+1]; - - GetDlgItemText(hwndDlg, IDC_CUSTOMSTRING, custom, MAX_PATH); - SetDlgItemText(hwndDlg, IDC_CUSTOMSTRING, normalizeCustomString(custom)); - testSequence(custom); - } - return TRUE; - case IDC_ADD: - { - int item; - char theme[MAX_PATH+1]; - - GetDlgItemText(hwndDlg, IDC_THEME, theme, sizeof(theme)); - if (!theme[0]) - return TRUE; - item = SendDlgItemMessage(hwndDlg, IDC_THEME, CB_ADDSTRING, 0, (LPARAM)theme); - str = (char *)malloc(MAX_PATH+1); - if (str) { - GetDlgItemText(hwndDlg, IDC_CUSTOMSTRING, str, MAX_PATH); - SetDlgItemText(hwndDlg, IDC_CUSTOMSTRING, normalizeCustomString(str)); - } - SendDlgItemMessage(hwndDlg, IDC_THEME, CB_SETITEMDATA, (WPARAM)item, (LPARAM)str); - EnableWindow(GetDlgItem(hwndDlg, IDC_ADD), FALSE); - EnableWindow(GetDlgItem(hwndDlg, IDC_UPDATE), FALSE); - EnableWindow(GetDlgItem(hwndDlg, IDC_DELETE), TRUE); - } - SendMessage(GetParent(GetParent(hwndDlg)), PSM_CHANGED, 0, 0); - return TRUE; - case IDC_UPDATE: - { - int item; - char theme[MAX_PATH+1]; - - GetDlgItemText(hwndDlg, IDC_THEME, theme, sizeof(theme)); - item = SendDlgItemMessage(hwndDlg, IDC_THEME, CB_FINDSTRINGEXACT, -1, (LPARAM)theme); - str = (char *)SendDlgItemMessage(hwndDlg, IDC_THEME, CB_GETITEMDATA, (WPARAM)item, 0); - if (str) { - GetDlgItemText(hwndDlg, IDC_CUSTOMSTRING, str, MAX_PATH); - SetDlgItemText(hwndDlg, IDC_CUSTOMSTRING, normalizeCustomString(str)); - } - EnableWindow(GetDlgItem(hwndDlg, IDC_UPDATE), FALSE); - } - SendMessage(GetParent(GetParent(hwndDlg)), PSM_CHANGED, 0, 0); - return TRUE; - case IDC_DELETE: - { - int item; - char theme[MAX_PATH+1]; - - GetDlgItemText(hwndDlg, IDC_THEME, theme, sizeof(theme)); - item = SendDlgItemMessage(hwndDlg, IDC_THEME, CB_FINDSTRINGEXACT, -1, (LPARAM)theme); - str = (char *)SendDlgItemMessage(hwndDlg, IDC_THEME, CB_GETITEMDATA, (WPARAM)item, 0); - if (str) - free(str); - SendDlgItemMessage(hwndDlg, IDC_THEME, CB_DELETESTRING, (WPARAM)item, 0); - if (SendDlgItemMessage(hwndDlg, IDC_THEME, CB_GETCOUNT, 0, 0) == 0) { - SetDlgItemText(hwndDlg, IDC_THEME, ""); - SetDlgItemText(hwndDlg, IDC_CUSTOMSTRING, ""); - EnableWindow(GetDlgItem(hwndDlg, IDC_DELETE), FALSE); - } else { - SendDlgItemMessage(hwndDlg, IDC_THEME, CB_SETCURSEL, 0, 0); - str = (char *)SendDlgItemMessage(hwndDlg, IDC_THEME, CB_GETITEMDATA, 0, 0); - if (str) - SetDlgItemText(hwndDlg, IDC_CUSTOMSTRING, str); - } - EnableWindow(GetDlgItem(hwndDlg, IDC_UPDATE), FALSE); - } - SendMessage(GetParent(GetParent(hwndDlg)), PSM_CHANGED, 0, 0); - return TRUE; - case IDC_EXPORT: - { - char path[MAX_PATH+1], filter[MAX_PATH+1], *pfilter; - OPENFILENAME ofn={0}; - - path[0] = '\0'; - ofn.lStructSize = sizeof(OPENFILENAME); - ofn.hwndOwner = hwndDlg; - ofn.hInstance = NULL; - strcpy(filter, Translate("Keyboard Notify Theme")); - strcat(filter, " (*.knt)"); - pfilter = filter + strlen(filter) + 1; - strcpy(pfilter, "*.knt"); - pfilter = pfilter + strlen(pfilter) + 1; - strcpy(pfilter, Translate("All Files")); - pfilter = pfilter + strlen(pfilter) + 1; - strcpy(pfilter, "*.*"); - pfilter = pfilter + strlen(pfilter) + 1; - *pfilter = '\0'; - ofn.lpstrFilter = filter; - ofn.lpstrFile = path; - ofn.Flags = OFN_HIDEREADONLY|OFN_NOCHANGEDIR|OFN_NOREADONLYRETURN|OFN_PATHMUSTEXIST; - ofn.nMaxFile = sizeof(path); - ofn.lpstrDefExt = "knt"; - if(GetSaveFileName(&ofn)) - exportThemes(path); - } - return TRUE; - case IDC_IMPORT: - { - char path[MAX_PATH+1], filter[MAX_PATH+1], *pfilter; - OPENFILENAME ofn={0}; - - path[0] = '\0'; - ofn.lStructSize = sizeof(OPENFILENAME); - ofn.hwndOwner = hwndDlg; - ofn.hInstance = NULL; - strcpy(filter, Translate("Keyboard Notify Theme")); - strcat(filter, " (*.knt)"); - pfilter = filter + strlen(filter) + 1; - strcpy(pfilter, "*.knt"); - pfilter = pfilter + strlen(pfilter) + 1; - strcpy(pfilter, Translate("All Files")); - pfilter = pfilter + strlen(pfilter) + 1; - strcpy(pfilter, "*.*"); - pfilter = pfilter + strlen(pfilter) + 1; - *pfilter = '\0'; - ofn.lpstrFilter = filter; - ofn.lpstrFile = path; - ofn.Flags = OFN_FILEMUSTEXIST|OFN_HIDEREADONLY|OFN_NOCHANGEDIR; - ofn.nMaxFile = sizeof(path); - ofn.lpstrDefExt = "knt"; - if(GetOpenFileName(&ofn)) { - importThemes(path, IsDlgButtonChecked(hwndDlg, IDC_OVERRIDE) == BST_CHECKED); - SendMessage(GetParent(GetParent(hwndDlg)), PSM_CHANGED, 0, 0); - } - } - return TRUE; - case IDC_OVERRIDE: - SendMessage(GetParent(GetParent(hwndDlg)), PSM_CHANGED, 0, 0); - return TRUE; - } - break; - - case WM_NOTIFY: - { - int count; - char theme[MAX_PATH+1], themeAux[MAX_PATH+1], *str; - //Here we have pressed either the OK or the APPLY button. - switch(((LPNMHDR)lParam)->idFrom) { - case 0: - switch (((LPNMHDR)lParam)->code) { - case PSN_APPLY: - if (!DBGetContactSetting(NULL, KEYBDMODULE, fmtDBSettingName("theme%d", wCustomTheme), &dbv)) - strcpy(theme, dbv.pszVal); - else - theme[0] = '\0'; - - // Here we will delete all the items in the theme combo on the Flashing tab: we will load them again later - for (i=0; SendDlgItemMessage(hwndEffect, IDC_SCUSTOM, CB_DELETESTRING, 0, (LPARAM)i) != CB_ERR; i++); - - count = SendDlgItemMessage(hwndDlg, IDC_THEME, CB_GETCOUNT, 0, 0); - for (i=0, wCustomTheme=0; i < count; i++) { - SendDlgItemMessage(hwndDlg, IDC_THEME, CB_GETLBTEXT, (WPARAM)i, (LPARAM)themeAux); - DBWriteContactSettingString(NULL, KEYBDMODULE, fmtDBSettingName("theme%d", i), themeAux); - str = (char *)SendDlgItemMessage(hwndDlg, IDC_THEME, CB_GETITEMDATA, (WPARAM)i, 0); - if (str) - DBWriteContactSettingString(NULL, KEYBDMODULE, fmtDBSettingName("custom%d", i), str); - else - DBWriteContactSettingString(NULL, KEYBDMODULE, fmtDBSettingName("custom%d", i), ""); - - if (!strcmp(theme, themeAux)) - wCustomTheme = i; - - // Here we will update the theme combo on the Flashing tab: horrible but can't imagine a better way right now - SendDlgItemMessage(hwndEffect, IDC_SCUSTOM, CB_INSERTSTRING, (WPARAM)i, (LPARAM)themeAux); - SendDlgItemMessage(hwndEffect, IDC_SCUSTOM, CB_SETITEMDATA, (WPARAM)i, (LPARAM)i); - } - for (i=count; !DBDeleteContactSetting(NULL, KEYBDMODULE, fmtDBSettingName("theme%d", i)); i++) - DBDeleteContactSetting(NULL, KEYBDMODULE, fmtDBSettingName("custom%d", i)); - - DBWriteContactSettingWord(NULL, KEYBDMODULE, "custom", wCustomTheme); - // Still updating here the the Flashing tab's controls - SendDlgItemMessage(hwndEffect, IDC_SCUSTOM, CB_SETCURSEL, (WPARAM)wCustomTheme, 0); - - DBWriteContactSettingByte(NULL, KEYBDMODULE, "override", (BYTE)(IsDlgButtonChecked(hwndDlg, IDC_OVERRIDE) == BST_CHECKED ? 1:0)); - - return TRUE; - } // switch code - break; - } //switch idFrom - } - break; //End WM_NOTIFY - - case WM_DESTROY: - { - int item, count = SendDlgItemMessage(hwndDlg, IDC_THEME, CB_GETCOUNT, 0, 0); - - for (item=0; item < count; item++) { - str = (char *)SendDlgItemMessage(hwndDlg, IDC_THEME, CB_GETITEMDATA, (WPARAM)item, 0); - if (str) - free(str); - } - break; - } - - default: - break; - } - - return FALSE; -} - - -void exportThemes(const char *filename) -{ - int i; - FILE *fExport; - DBVARIANT dbv; - - if (!(fExport = fopen(filename, "wt"))) - return; - - fprintf(fExport, "\n; Automatically generated Keyboard Notify Theme file\n\n\n"); - - for (i=0; !DBGetContactSetting(NULL, KEYBDMODULE, fmtDBSettingName("theme%d", i), &dbv); i++) { - fprintf(fExport, "[%s]\n", dbv.pszVal); - DBFreeVariant(&dbv); - if (DBGetContactSetting(NULL, KEYBDMODULE, fmtDBSettingName("custom%d", i), &dbv)) - fprintf(fExport, "0\n\n"); - else { - fprintf(fExport, "%s\n\n", dbv.pszVal); - DBFreeVariant(&dbv); - } - } - - fprintf(fExport, "\n; End of automatically generated Keyboard Notify Theme file\n"); - - fclose(fExport); -} - - -void importThemes(const char *filename, BOOL overrideExisting) -{ - int i, status=0; - FILE *fImport; - char buffer[MAX_PATH+1], theme[MAX_PATH+1], *str; - - if (!(fImport = fopen(filename, "rt"))) - return; - - while (fgets(buffer, MAX_PATH, fImport) != NULL) { - for (str=buffer; *str && isspace(*str); str++); //ltrim - if (!*str || *str == ';') //empty line or comment - continue; - for (i=strlen(str)-1; isspace(str[i]); str[i--]='\0'); //rtrim - switch (status) { - case 0: - if (i > 1 && str[0] == '[' && str[i] == ']') { - status = 1; - strcpy(theme, str+1); - theme[i-1] = '\0'; - } - break; - case 1: - status = 0; - writeThemeToCombo(theme, normalizeCustomString(str), overrideExisting); - break; - } - } - - fclose(fImport); -} - - -void writeThemeToCombo(const char *theme, const char *custom, BOOL overrideExisting) -{ - int item; - char *str; - - item = SendDlgItemMessage(hwndTheme, IDC_THEME, CB_FINDSTRINGEXACT, -1, (LPARAM)theme); - if (item == CB_ERR) { - item = SendDlgItemMessage(hwndTheme, IDC_THEME, CB_ADDSTRING, 0, (LPARAM)theme); - str = (char *)malloc(MAX_PATH+1); - if (str) - strcpy(str, custom); - SendDlgItemMessage(hwndTheme, IDC_THEME, CB_SETITEMDATA, (WPARAM)item, (LPARAM)str); - } else - if (overrideExisting) { - str = (char *)SendDlgItemMessage(hwndTheme, IDC_THEME, CB_GETITEMDATA, (WPARAM)item, 0); - if (str) - strcpy(str, custom); - } -} - - -INT_PTR CALLBACK DlgProcProcesses(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lParam) -{ - unsigned int i; - - switch (msg) { - - case WM_INITDIALOG: - TranslateDialogDefault(hwndDlg); - - SendDlgItemMessage(hwndDlg, IDC_PROGRAMS, EM_LIMITTEXT, MAX_PATH, 0); - - for (i=0; i < ProcessListAux.count; i++) - if (ProcessListAux.szFileName[i]) { - int index = SendDlgItemMessage(hwndDlg, IDC_PROGRAMS, CB_INSERTSTRING, (WPARAM)-1, (LPARAM)ProcessListAux.szFileName[i]); - if (index != CB_ERR && index != CB_ERRSPACE) - SendDlgItemMessage(hwndDlg, IDC_PROGRAMS, CB_SETITEMDATA, (WPARAM)index, (LPARAM)i); - } - - EnableWindow(GetDlgItem(hwndDlg, IDC_ADDPGM), FALSE); - if (SendDlgItemMessage(hwndDlg, IDC_PROGRAMS, CB_GETCOUNT, 0, 0) == 0) - EnableWindow(GetDlgItem(hwndDlg, IDC_DELETEPGM), FALSE); - else - SendDlgItemMessage(hwndDlg, IDC_PROGRAMS, CB_SETCURSEL, 0, 0); - - return TRUE; - - case WM_COMMAND: - switch (LOWORD(wParam)) { - case IDC_PROGRAMS: - switch (HIWORD(wParam)) { - int item; - char szFileName[MAX_PATH+1]; - - case CBN_SELENDOK: - case CBN_SELCHANGE: - EnableWindow(GetDlgItem(hwndDlg, IDC_ADDPGM), FALSE); - EnableWindow(GetDlgItem(hwndDlg, IDC_DELETEPGM), TRUE); - break; - case CBN_EDITCHANGE: - GetDlgItemText(hwndDlg, IDC_PROGRAMS, szFileName, sizeof(szFileName)); - if ((item = SendMessage((HWND)lParam, CB_FINDSTRINGEXACT, -1, (LPARAM)szFileName)) == CB_ERR) { //new program - EnableWindow(GetDlgItem(hwndDlg, IDC_ADDPGM), TRUE); - EnableWindow(GetDlgItem(hwndDlg, IDC_DELETEPGM), FALSE); - } else { - EnableWindow(GetDlgItem(hwndDlg, IDC_ADDPGM), FALSE); - EnableWindow(GetDlgItem(hwndDlg, IDC_DELETEPGM), TRUE); - } - break; - } - break; - case IDC_ADDPGM: - { - int item; - char szFileName[MAX_PATH+1]; - - GetDlgItemText(hwndDlg, IDC_PROGRAMS, szFileName, sizeof(szFileName)); - if (!szFileName[0]) - break; - item = SendDlgItemMessage(hwndDlg, IDC_PROGRAMS, CB_ADDSTRING, 0, (LPARAM)szFileName); - EnableWindow(GetDlgItem(hwndDlg, IDC_ADDPGM), FALSE); - EnableWindow(GetDlgItem(hwndDlg, IDC_DELETEPGM), TRUE); - } - break; - case IDC_DELETEPGM: - { - int item; - char szFileName[MAX_PATH+1]; - - GetDlgItemText(hwndDlg, IDC_PROGRAMS, szFileName, sizeof(szFileName)); - item = SendDlgItemMessage(hwndDlg, IDC_PROGRAMS, CB_FINDSTRINGEXACT, -1, (LPARAM)szFileName); - SendDlgItemMessage(hwndDlg, IDC_PROGRAMS, CB_DELETESTRING, (WPARAM)item, 0); - if (SendDlgItemMessage(hwndDlg, IDC_PROGRAMS, CB_GETCOUNT, 0, 0) == 0) { - SetDlgItemText(hwndDlg, IDC_PROGRAMS, ""); - EnableWindow(GetDlgItem(hwndDlg, IDC_DELETEPGM), FALSE); - } else - SendDlgItemMessage(hwndDlg, IDC_PROGRAMS, CB_SETCURSEL, 0, 0); - } - break; - case IDC_OKPGM: - destroyProcessListAux(); - - ProcessListAux.count = SendDlgItemMessage(hwndDlg, IDC_PROGRAMS, CB_GETCOUNT, 0, 0); - ProcessListAux.szFileName = (char **)malloc(ProcessListAux.count * sizeof(char *)); - if (!ProcessListAux.szFileName) - ProcessListAux.count = 0; - else - for (i=0; i < ProcessListAux.count; i++) { - char szFileNameAux[MAX_PATH+1]; - - SendDlgItemMessage(hwndDlg, IDC_PROGRAMS, CB_GETLBTEXT, (WPARAM)i, (LPARAM)szFileNameAux); - ProcessListAux.szFileName[i] = (char *)malloc(strlen(szFileNameAux) + 1); - if (ProcessListAux.szFileName[i]) - strcpy(ProcessListAux.szFileName[i], szFileNameAux); - } - - case IDC_CANCELPGM: - EndDialog(hwndDlg, LOWORD(wParam)); - break; - } - break; - } - - return FALSE; -} - - -void createProcessListAux(void) -{ - unsigned int i; - - ProcessListAux.count = ProcessList.count; - ProcessListAux.szFileName = (char **)malloc(ProcessListAux.count * sizeof(char *)); - if (!ProcessListAux.szFileName) - ProcessListAux.count = 0; - else - for (i=0; i < ProcessListAux.count; i++) - if (!ProcessList.szFileName[i]) - ProcessListAux.szFileName[i] = NULL; - else { - ProcessListAux.szFileName[i] = (char *)malloc(strlen(ProcessList.szFileName[i]) + 1); - if (ProcessListAux.szFileName[i]) - strcpy(ProcessListAux.szFileName[i], ProcessList.szFileName[i]); - } - -} - - + LoadSettings();
+
+ return TRUE;
+ } // switch code
+ break;
+ } //switch idFrom
+ }
+ break; //End WM_NOTIFY
+
+ default:
+ break;
+ }
+
+ return FALSE;
+}
+
+INT_PTR CALLBACK DlgProcEffectOptions(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lParam)
+{
+ int i;
+ DBVARIANT dbv;
+ static BOOL initDlg=FALSE;
+
+ switch (msg) {
+
+ case WM_INITDIALOG:
+ initDlg=TRUE;
+ TranslateDialogDefault(hwndDlg);
+
+ trillianLedsMsg = bTrillianLedsMsg;
+ trillianLedsURL = bTrillianLedsURL;
+ trillianLedsFile = bTrillianLedsFile;
+ trillianLedsOther = bTrillianLedsOther;
+
+ CheckDlgButton(hwndDlg, IDC_NUM, bFlashLed[0] ? BST_CHECKED:BST_UNCHECKED);
+ CheckDlgButton(hwndDlg, IDC_CAPS, bFlashLed[1] ? BST_CHECKED:BST_UNCHECKED);
+ CheckDlgButton(hwndDlg, IDC_SCROLL, bFlashLed[2] ? BST_CHECKED:BST_UNCHECKED);
+
+ CheckDlgButton(hwndDlg, IDC_SAMETIME, bFlashEffect == FLASH_SAMETIME ? BST_CHECKED:BST_UNCHECKED);
+ CheckDlgButton(hwndDlg, IDC_INTURN, bFlashEffect == FLASH_INTURN ? BST_CHECKED:BST_UNCHECKED);
+ CheckDlgButton(hwndDlg, IDC_INSEQUENCE, bFlashEffect == FLASH_INSEQUENCE ? BST_CHECKED:BST_UNCHECKED);
+ for (i=0; i < 3; i++) {
+ int index = SendDlgItemMessage(hwndDlg, IDC_SEQORDER, CB_INSERTSTRING, (WPARAM)-1, (LPARAM)(OrderName[i]));
+ if (index != CB_ERR && index != CB_ERRSPACE)
+ SendDlgItemMessage(hwndDlg, IDC_SEQORDER, CB_SETITEMDATA, (WPARAM)index, (LPARAM)i);
+ }
+ SendDlgItemMessage(hwndDlg, IDC_SEQORDER, CB_SETCURSEL, (WPARAM)bSequenceOrder, 0);
+ if (bFlashEffect != FLASH_INSEQUENCE)
+ EnableWindow(GetDlgItem(hwndDlg, IDC_SEQORDER), FALSE);
+ CheckDlgButton(hwndDlg, IDC_CUSTOM, bFlashEffect == FLASH_CUSTOM ? BST_CHECKED:BST_UNCHECKED);
+ for (i=0; !DBGetContactSetting(NULL, KEYBDMODULE, fmtDBSettingName("theme%d", i), &dbv); i++) {
+ int index = SendDlgItemMessage(hwndDlg, IDC_SCUSTOM, CB_INSERTSTRING, (WPARAM)-1, (LPARAM)dbv.ptszVal);
+ DBFreeVariant(&dbv);
+ if (index != CB_ERR && index != CB_ERRSPACE)
+ SendDlgItemMessage(hwndDlg, IDC_SCUSTOM, CB_SETITEMDATA, (WPARAM)index, (LPARAM)i);
+ }
+ SendDlgItemMessage(hwndDlg, IDC_SCUSTOM, CB_SETCURSEL, (WPARAM)wCustomTheme, 0);
+ if (bFlashEffect != FLASH_CUSTOM)
+ EnableWindow(GetDlgItem(hwndDlg, IDC_SCUSTOM), FALSE);
+ CheckDlgButton(hwndDlg, IDC_TRILLIAN, bFlashEffect == FLASH_TRILLIAN ? BST_CHECKED:BST_UNCHECKED);
+ if (bFlashEffect != FLASH_TRILLIAN)
+ EnableWindow(GetDlgItem(hwndDlg, IDC_ASSIGNLEDS), FALSE);
+
+ SendDlgItemMessage(hwndDlg, IDC_DELAYSPIN, UDM_SETBUDDY, (WPARAM)GetDlgItem(hwndDlg, IDC_SDELAY), 0);
+ SendDlgItemMessage(hwndDlg, IDC_DELAYSPIN, UDM_SETRANGE32, 0, MAKELONG(UD_MAXVAL, 0));
+ SendDlgItemMessage(hwndDlg, IDC_DELAYSPIN, UDM_SETPOS, 0, MAKELONG(wStartDelay, 0));
+
+ SendDlgItemMessage(hwndDlg, IDC_SPEED, TBM_SETRANGE, FALSE, MAKELONG(0, 5));
+ SendDlgItemMessage(hwndDlg, IDC_SPEED, TBM_SETPOS, TRUE, bFlashSpeed);
+
+ CheckDlgButton(hwndDlg, IDC_KEYPRESSES, bEmulateKeypresses ? BST_CHECKED:BST_UNCHECKED);
+
+ initDlg=FALSE;
+ return TRUE;
+
+ case WM_VSCROLL:
+ case WM_HSCROLL:
+ SendMessage(GetParent(GetParent(hwndDlg)), PSM_CHANGED, 0, 0);
+ break;
+
+ case WM_DESTROY:
+ previewFlashing(FALSE);
+ break;
+
+ case WM_COMMAND:
+ switch (LOWORD(wParam)) {
+ case IDC_NUM:
+ case IDC_CAPS:
+ case IDC_SCROLL:
+ case IDC_SAMETIME:
+ case IDC_INTURN:
+ case IDC_INSEQUENCE:
+ case IDC_SEQORDER:
+ case IDC_CUSTOM:
+ case IDC_TRILLIAN:
+ case IDC_SCUSTOM:
+ case IDC_SPEED:
+ case IDC_KEYPRESSES:
+ EnableWindow(GetDlgItem(hwndDlg, IDC_SEQORDER), IsDlgButtonChecked(hwndDlg, IDC_INSEQUENCE) == BST_CHECKED);
+ EnableWindow(GetDlgItem(hwndDlg, IDC_SCUSTOM), IsDlgButtonChecked(hwndDlg, IDC_CUSTOM) == BST_CHECKED);
+ EnableWindow(GetDlgItem(hwndDlg, IDC_ASSIGNLEDS), IsDlgButtonChecked(hwndDlg, IDC_TRILLIAN) == BST_CHECKED);
+ SendMessage(GetParent(GetParent(hwndDlg)), PSM_CHANGED, 0, 0);
+ return TRUE;
+ case IDC_ASSIGNLEDS:
+ if (DialogBoxParam(hInst, MAKEINTRESOURCE(IDD_EVENTLEDS), hwndDlg, DlgProcEventLeds, 0) == IDC_OK)
+ SendMessage(GetParent(GetParent(hwndDlg)), PSM_CHANGED, 0, 0);
+ return TRUE;
+ case IDC_SDELAY:
+ if(HIWORD(wParam) == EN_CHANGE && !initDlg)
+ SendMessage(GetParent(GetParent(hwndDlg)), PSM_CHANGED, 0, 0);
+ return TRUE;
+ case IDC_PREVIEW:
+ previewFlashing(IsDlgButtonChecked(hwndDlg, IDC_PREVIEW) == BST_CHECKED);
+ return TRUE;
+ }
+ break;
+
+ case WM_NOTIFY:
+ {
+ //Here we have pressed either the OK or the APPLY button.
+ switch(((LPNMHDR)lParam)->idFrom) {
+ case 0:
+ switch (((LPNMHDR)lParam)->code) {
+ case PSN_APPLY:
+ DBWriteContactSettingByte(NULL, KEYBDMODULE, "fnum", (BYTE)(IsDlgButtonChecked(hwndDlg, IDC_NUM) == BST_CHECKED ? 1:0));
+ DBWriteContactSettingByte(NULL, KEYBDMODULE, "fcaps", (BYTE)(IsDlgButtonChecked(hwndDlg, IDC_CAPS) == BST_CHECKED ? 1:0));
+ DBWriteContactSettingByte(NULL, KEYBDMODULE, "fscroll", (BYTE)(IsDlgButtonChecked(hwndDlg, IDC_SCROLL) == BST_CHECKED ? 1:0));
+
+ if(IsDlgButtonChecked(hwndDlg, IDC_INTURN) == BST_CHECKED)
+ DBWriteContactSettingByte(NULL, KEYBDMODULE, "feffect", FLASH_INTURN);
+ else
+ if (IsDlgButtonChecked(hwndDlg, IDC_INSEQUENCE) == BST_CHECKED)
+ DBWriteContactSettingByte(NULL, KEYBDMODULE, "feffect", FLASH_INSEQUENCE);
+ else
+ if (IsDlgButtonChecked(hwndDlg, IDC_CUSTOM) == BST_CHECKED)
+ DBWriteContactSettingByte(NULL, KEYBDMODULE, "feffect", FLASH_CUSTOM);
+ else
+ if (IsDlgButtonChecked(hwndDlg, IDC_TRILLIAN) == BST_CHECKED)
+ DBWriteContactSettingByte(NULL, KEYBDMODULE, "feffect", FLASH_TRILLIAN);
+ else
+ DBWriteContactSettingByte(NULL, KEYBDMODULE, "feffect", FLASH_SAMETIME);
+ DBWriteContactSettingByte(NULL, KEYBDMODULE, "order", (BYTE)SendDlgItemMessage(hwndDlg, IDC_SEQORDER, CB_GETITEMDATA, (WPARAM)SendDlgItemMessage(hwndDlg, IDC_SEQORDER, CB_GETCURSEL, 0, 0), 0));
+ DBWriteContactSettingWord(NULL, KEYBDMODULE, "custom", (WORD)SendDlgItemMessage(hwndDlg, IDC_SCUSTOM, CB_GETITEMDATA, (WPARAM)SendDlgItemMessage(hwndDlg, IDC_SCUSTOM, CB_GETCURSEL, 0, 0), 0));
+
+ DBWriteContactSettingByte(NULL, KEYBDMODULE, "ledsmsg", trillianLedsMsg);
+ DBWriteContactSettingByte(NULL, KEYBDMODULE, "ledsfile", trillianLedsFile);
+ DBWriteContactSettingByte(NULL, KEYBDMODULE, "ledsurl", trillianLedsURL);
+ DBWriteContactSettingByte(NULL, KEYBDMODULE, "ledsother", trillianLedsOther);
+
+ DBWriteContactSettingWord(NULL, KEYBDMODULE, "sdelay", (WORD)SendDlgItemMessage(hwndDlg, IDC_DELAYSPIN, UDM_GETPOS, 0, 0));
+
+ DBWriteContactSettingByte(NULL, KEYBDMODULE, "speed", (BYTE)SendDlgItemMessage(hwndDlg, IDC_SPEED, TBM_GETPOS, 0, 0));
+
+ DBWriteContactSettingByte(NULL, KEYBDMODULE, "keypresses", (BYTE)(IsDlgButtonChecked(hwndDlg, IDC_KEYPRESSES) == BST_CHECKED ? 1:0));
+
+ LoadSettings();
+
+ return TRUE;
+ } // switch code
+ break;
+ } //switch idFrom
+ }
+ break; //End WM_NOTIFY
+
+ default:
+ break;
+ }
+
+ return FALSE;
+}
+
+INT_PTR CALLBACK DlgProcThemeOptions(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lParam)
+{
+ int i;
+ TCHAR *str;
+ DBVARIANT dbv;
+ static BOOL initDlg=FALSE;
+
+ switch (msg) {
+
+ case WM_INITDIALOG:
+ initDlg=TRUE;
+ TranslateDialogDefault(hwndDlg);
+
+ SendDlgItemMessage(hwndDlg, IDC_THEME, EM_LIMITTEXT, MAX_PATH, 0);
+ SendDlgItemMessage(hwndDlg, IDC_CUSTOMSTRING, EM_LIMITTEXT, MAX_PATH, 0);
+
+ for (i=0; !DBGetContactSetting(NULL, KEYBDMODULE, fmtDBSettingName("theme%d", i), &dbv); i++) {
+ int index = SendDlgItemMessage(hwndDlg, IDC_THEME, CB_INSERTSTRING, (WPARAM)-1, (LPARAM)dbv.pszVal);
+ DBFreeVariant(&dbv);
+ if (index != CB_ERR && index != CB_ERRSPACE) {
+ str = (TCHAR *)malloc(MAX_PATH+1);
+ if (str)
+ if (DBGetContactSetting(NULL, KEYBDMODULE, fmtDBSettingName("custom%d", i), &dbv))
+ str[0] = _T('\0');
+ else {
+ wcscpy(str, dbv.ptszVal);
+ DBFreeVariant(&dbv);
+ }
+ SendDlgItemMessage(hwndDlg, IDC_THEME, CB_SETITEMDATA, (WPARAM)index, (LPARAM)str);
+ }
+ }
+
+ EnableWindow(GetDlgItem(hwndDlg, IDC_ADD), FALSE);
+ EnableWindow(GetDlgItem(hwndDlg, IDC_UPDATE), FALSE);
+ if (SendDlgItemMessage(hwndDlg, IDC_THEME, CB_GETCOUNT, 0, 0) == 0)
+ EnableWindow(GetDlgItem(hwndDlg, IDC_DELETE), FALSE);
+ else {
+ SendDlgItemMessage(hwndDlg, IDC_THEME, CB_SETCURSEL, (WPARAM)wCustomTheme, 0);
+ str = (TCHAR *)SendDlgItemMessage(hwndDlg, IDC_THEME, CB_GETITEMDATA, (WPARAM)wCustomTheme, 0);
+ if (str)
+ SetDlgItemText(hwndDlg, IDC_CUSTOMSTRING, str);
+ }
+
+ CheckDlgButton(hwndDlg, IDC_OVERRIDE, bOverride ? BST_CHECKED:BST_UNCHECKED);
+
+ initDlg=FALSE;
+ return TRUE;
+
+ case WM_COMMAND:
+ switch (LOWORD(wParam)) {
+ case IDC_THEME:
+ switch (HIWORD(wParam)) {
+ int item;
+ TCHAR theme[MAX_PATH+1];
+
+ case CBN_SELENDOK:
+ case CBN_SELCHANGE:
+ str = (TCHAR *)SendMessage((HWND)lParam, CB_GETITEMDATA, (WPARAM)SendMessage((HWND)lParam, CB_GETCURSEL, 0, 0), 0);
+ if (str)
+ SetDlgItemText(hwndDlg, IDC_CUSTOMSTRING, str);
+ else
+ SetDlgItemText(hwndDlg, IDC_CUSTOMSTRING, _T(""));
+ EnableWindow(GetDlgItem(hwndDlg, IDC_ADD), FALSE);
+ EnableWindow(GetDlgItem(hwndDlg, IDC_UPDATE), FALSE);
+ EnableWindow(GetDlgItem(hwndDlg, IDC_DELETE), TRUE);
+ break;
+ case CBN_EDITCHANGE:
+ GetDlgItemText(hwndDlg, IDC_THEME, theme, sizeof(theme));
+ if ((item = SendMessage((HWND)lParam, CB_FINDSTRINGEXACT, -1, (LPARAM)theme)) == CB_ERR) { //new theme
+ SetDlgItemText(hwndDlg, IDC_CUSTOMSTRING, _T(""));
+ EnableWindow(GetDlgItem(hwndDlg, IDC_ADD), TRUE);
+ EnableWindow(GetDlgItem(hwndDlg, IDC_DELETE), FALSE);
+ } else {
+ str = (TCHAR *)SendMessage((HWND)lParam, CB_GETITEMDATA, (WPARAM)item, 0);
+ if (str)
+ SetDlgItemText(hwndDlg, IDC_CUSTOMSTRING, str);
+ else
+ SetDlgItemText(hwndDlg, IDC_CUSTOMSTRING, _T(""));
+ EnableWindow(GetDlgItem(hwndDlg, IDC_ADD), FALSE);
+ EnableWindow(GetDlgItem(hwndDlg, IDC_DELETE), TRUE);
+ }
+ EnableWindow(GetDlgItem(hwndDlg, IDC_UPDATE), FALSE);
+ break;
+ }
+ return TRUE;
+ case IDC_CUSTOMSTRING:
+ if(HIWORD(wParam) == EN_CHANGE) {
+ int item;
+ TCHAR theme[MAX_PATH+1], customAux[MAX_PATH+1];
+
+ GetDlgItemText(hwndDlg, IDC_THEME, theme, sizeof(theme));
+ if ((item = SendDlgItemMessage(hwndDlg, IDC_THEME, CB_FINDSTRINGEXACT, -1, (LPARAM)theme)) == CB_ERR)
+ return TRUE;
+ str = (TCHAR *)SendDlgItemMessage(hwndDlg, IDC_THEME, CB_GETITEMDATA, (WPARAM)item, 0);
+ if (str) {
+ GetDlgItemText(hwndDlg, IDC_CUSTOMSTRING, customAux, MAX_PATH);
+ if (wcscmp(str, customAux))
+ EnableWindow(GetDlgItem(hwndDlg, IDC_UPDATE), TRUE);
+ else
+ EnableWindow(GetDlgItem(hwndDlg, IDC_UPDATE), FALSE);
+ }
+ }
+ return TRUE;
+ case IDC_TEST:
+ {
+ TCHAR custom[MAX_PATH+1];
+
+ GetDlgItemText(hwndDlg, IDC_CUSTOMSTRING, custom, MAX_PATH);
+ SetDlgItemText(hwndDlg, IDC_CUSTOMSTRING, normalizeCustomString(custom));
+ testSequence(custom);
+ }
+ return TRUE;
+ case IDC_ADD:
+ {
+ int item;
+ TCHAR theme[MAX_PATH+1];
+
+ GetDlgItemText(hwndDlg, IDC_THEME, theme, sizeof(theme));
+ if (!theme[0])
+ return TRUE;
+ item = SendDlgItemMessage(hwndDlg, IDC_THEME, CB_ADDSTRING, 0, (LPARAM)theme);
+ str = (TCHAR *)malloc(MAX_PATH+1);
+ if (str) {
+ GetDlgItemText(hwndDlg, IDC_CUSTOMSTRING, str, MAX_PATH);
+ SetDlgItemText(hwndDlg, IDC_CUSTOMSTRING, normalizeCustomString(str));
+ }
+ SendDlgItemMessage(hwndDlg, IDC_THEME, CB_SETITEMDATA, (WPARAM)item, (LPARAM)str);
+ EnableWindow(GetDlgItem(hwndDlg, IDC_ADD), FALSE);
+ EnableWindow(GetDlgItem(hwndDlg, IDC_UPDATE), FALSE);
+ EnableWindow(GetDlgItem(hwndDlg, IDC_DELETE), TRUE);
+ }
+ SendMessage(GetParent(GetParent(hwndDlg)), PSM_CHANGED, 0, 0);
+ return TRUE;
+ case IDC_UPDATE:
+ {
+ int item;
+ TCHAR theme[MAX_PATH+1];
+
+ GetDlgItemText(hwndDlg, IDC_THEME, theme, sizeof(theme));
+ item = SendDlgItemMessage(hwndDlg, IDC_THEME, CB_FINDSTRINGEXACT, -1, (LPARAM)theme);
+ str = (TCHAR *)SendDlgItemMessage(hwndDlg, IDC_THEME, CB_GETITEMDATA, (WPARAM)item, 0);
+ if (str) {
+ GetDlgItemText(hwndDlg, IDC_CUSTOMSTRING, str, MAX_PATH);
+ SetDlgItemText(hwndDlg, IDC_CUSTOMSTRING, normalizeCustomString(str));
+ }
+ EnableWindow(GetDlgItem(hwndDlg, IDC_UPDATE), FALSE);
+ }
+ SendMessage(GetParent(GetParent(hwndDlg)), PSM_CHANGED, 0, 0);
+ return TRUE;
+ case IDC_DELETE:
+ {
+ int item;
+ TCHAR theme[MAX_PATH+1];
+
+ GetDlgItemText(hwndDlg, IDC_THEME, theme, sizeof(theme));
+ item = SendDlgItemMessage(hwndDlg, IDC_THEME, CB_FINDSTRINGEXACT, -1, (LPARAM)theme);
+ str = (TCHAR *)SendDlgItemMessage(hwndDlg, IDC_THEME, CB_GETITEMDATA, (WPARAM)item, 0);
+ if (str)
+ free(str);
+ SendDlgItemMessage(hwndDlg, IDC_THEME, CB_DELETESTRING, (WPARAM)item, 0);
+ if (SendDlgItemMessage(hwndDlg, IDC_THEME, CB_GETCOUNT, 0, 0) == 0) {
+ SetDlgItemText(hwndDlg, IDC_THEME, _T(""));
+ SetDlgItemText(hwndDlg, IDC_CUSTOMSTRING, _T(""));
+ EnableWindow(GetDlgItem(hwndDlg, IDC_DELETE), FALSE);
+ } else {
+ SendDlgItemMessage(hwndDlg, IDC_THEME, CB_SETCURSEL, 0, 0);
+ str = (TCHAR *)SendDlgItemMessage(hwndDlg, IDC_THEME, CB_GETITEMDATA, 0, 0);
+ if (str)
+ SetDlgItemText(hwndDlg, IDC_CUSTOMSTRING, str);
+ }
+ EnableWindow(GetDlgItem(hwndDlg, IDC_UPDATE), FALSE);
+ }
+ SendMessage(GetParent(GetParent(hwndDlg)), PSM_CHANGED, 0, 0);
+ return TRUE;
+ case IDC_EXPORT:
+ {
+ TCHAR path[MAX_PATH+1], filter[MAX_PATH+1], *pfilter;
+ OPENFILENAME ofn={0};
+
+ path[0] = _T('\0');
+ ofn.lStructSize = sizeof(OPENFILENAME);
+ ofn.hwndOwner = hwndDlg;
+ ofn.hInstance = NULL;
+ wcscpy(filter,_T("Keyboard Notify Theme"));
+ wcscat(filter, _T(" (*.knt)"));
+ pfilter = filter + wcslen(filter) + 1;
+ wcscpy(pfilter, _T("*.knt"));
+ pfilter = pfilter + wcslen(pfilter) + 1;
+ wcscpy(pfilter, _T("All Files"));
+ pfilter = pfilter + wcslen(pfilter) + 1;
+ wcscpy(pfilter, _T("*.*"));
+ pfilter = pfilter + wcslen(pfilter) + 1;
+ *pfilter = _T('\0');
+ ofn.lpstrFilter = filter;
+ ofn.lpstrFile = path;
+ ofn.Flags = OFN_HIDEREADONLY|OFN_NOCHANGEDIR|OFN_NOREADONLYRETURN|OFN_PATHMUSTEXIST;
+ ofn.nMaxFile = sizeof(path);
+ ofn.lpstrDefExt = _T("knt");
+ if(GetSaveFileName(&ofn))
+ exportThemes(path);
+ }
+ return TRUE;
+ case IDC_IMPORT:
+ {
+ TCHAR path[MAX_PATH+1], filter[MAX_PATH+1], *pfilter;
+ OPENFILENAME ofn={0};
+
+ path[0] = _T('\0');
+ ofn.lStructSize = sizeof(OPENFILENAME);
+ ofn.hwndOwner = hwndDlg;
+ ofn.hInstance = NULL;
+ wcscpy(filter, _T("Keyboard Notify Theme"));
+ wcscat(filter, _T(" (*.knt)"));
+ pfilter = filter + wcslen(filter) + 1;
+ wcscpy(pfilter, _T("*.knt"));
+ pfilter = pfilter + wcslen(pfilter) + 1;
+ wcscpy(pfilter, _T("All Files"));
+ pfilter = pfilter + wcslen(pfilter) + 1;
+ wcscpy(pfilter, _T("*.*"));
+ pfilter = pfilter + wcslen(pfilter) + 1;
+ *pfilter = _T('\0');
+ ofn.lpstrFilter = filter;
+ ofn.lpstrFile = path;
+ ofn.Flags = OFN_FILEMUSTEXIST|OFN_HIDEREADONLY|OFN_NOCHANGEDIR;
+ ofn.nMaxFile = sizeof(path);
+ ofn.lpstrDefExt = _T("knt");
+ if(GetOpenFileName(&ofn)) {
+ importThemes(path, IsDlgButtonChecked(hwndDlg, IDC_OVERRIDE) == BST_CHECKED);
+ SendMessage(GetParent(GetParent(hwndDlg)), PSM_CHANGED, 0, 0);
+ }
+ }
+ return TRUE;
+ case IDC_OVERRIDE:
+ SendMessage(GetParent(GetParent(hwndDlg)), PSM_CHANGED, 0, 0);
+ return TRUE;
+ }
+ break;
+
+ case WM_NOTIFY:
+ {
+ int count;
+ TCHAR theme[MAX_PATH+1], themeAux[MAX_PATH+1], *str;
+ //Here we have pressed either the OK or the APPLY button.
+ switch(((LPNMHDR)lParam)->idFrom) {
+ case 0:
+ switch (((LPNMHDR)lParam)->code) {
+ case PSN_APPLY:
+ if (!DBGetContactSetting(NULL, KEYBDMODULE, fmtDBSettingName("theme%d", wCustomTheme), &dbv))
+ wcscpy(theme, dbv.ptszVal);
+ else
+ theme[0] = _T('\0');
+
+ // Here we will delete all the items in the theme combo on the Flashing tab: we will load them again later
+ for (i=0; SendDlgItemMessage(hwndEffect, IDC_SCUSTOM, CB_DELETESTRING, 0, (LPARAM)i) != CB_ERR; i++);
+
+ count = SendDlgItemMessage(hwndDlg, IDC_THEME, CB_GETCOUNT, 0, 0);
+ for (i=0, wCustomTheme=0; i < count; i++) {
+ SendDlgItemMessage(hwndDlg, IDC_THEME, CB_GETLBTEXT, (WPARAM)i, (LPARAM)themeAux);
+ DBWriteContactSettingWString(NULL, KEYBDMODULE, fmtDBSettingName("theme%d", i), themeAux);
+ str = (TCHAR *)SendDlgItemMessage(hwndDlg, IDC_THEME, CB_GETITEMDATA, (WPARAM)i, 0);
+ if (str)
+ DBWriteContactSettingWString(NULL, KEYBDMODULE, fmtDBSettingName("custom%d", i), str);
+ else
+ DBWriteContactSettingWString(NULL, KEYBDMODULE, fmtDBSettingName("custom%d", i), _T(""));
+
+ if (!wcscmp(theme, themeAux))
+ wCustomTheme = i;
+
+ // Here we will update the theme combo on the Flashing tab: horrible but can't imagine a better way right now
+ SendDlgItemMessage(hwndEffect, IDC_SCUSTOM, CB_INSERTSTRING, (WPARAM)i, (LPARAM)themeAux);
+ SendDlgItemMessage(hwndEffect, IDC_SCUSTOM, CB_SETITEMDATA, (WPARAM)i, (LPARAM)i);
+ }
+ for (i=count; !DBDeleteContactSetting(NULL, KEYBDMODULE, fmtDBSettingName("theme%d", i)); i++)
+ DBDeleteContactSetting(NULL, KEYBDMODULE, fmtDBSettingName("custom%d", i));
+
+ DBWriteContactSettingWord(NULL, KEYBDMODULE, "custom", wCustomTheme);
+ // Still updating here the the Flashing tab's controls
+ SendDlgItemMessage(hwndEffect, IDC_SCUSTOM, CB_SETCURSEL, (WPARAM)wCustomTheme, 0);
+
+ DBWriteContactSettingByte(NULL, KEYBDMODULE, "override", (BYTE)(IsDlgButtonChecked(hwndDlg, IDC_OVERRIDE) == BST_CHECKED ? 1:0));
+
+ return TRUE;
+ } // switch code
+ break;
+ } //switch idFrom
+ }
+ break; //End WM_NOTIFY
+
+ case WM_DESTROY:
+ {
+ int item, count = SendDlgItemMessage(hwndDlg, IDC_THEME, CB_GETCOUNT, 0, 0);
+
+ for (item=0; item < count; item++) {
+ str = (TCHAR *)SendDlgItemMessage(hwndDlg, IDC_THEME, CB_GETITEMDATA, (WPARAM)item, 0);
+ if (str)
+ free(str);
+ }
+ break;
+ }
+
+ default:
+ break;
+ }
+
+ return FALSE;
+}
+
+
+void exportThemes(const TCHAR *filename)
+{
+ int i;
+ FILE *fExport;
+ DBVARIANT dbv;
+
+ if (!(fExport = _wfopen(filename, _T("wt"))))
+ return;
+
+ fwprintf(fExport, TranslateT("\n; Automatically generated Keyboard Notify Theme file\n\n\n"));
+
+ for (i=0; !DBGetContactSetting(NULL, KEYBDMODULE, fmtDBSettingName("theme%d", i), &dbv); i++) {
+ fwprintf(fExport, _T("[%s]\n"), dbv.ptszVal);
+ DBFreeVariant(&dbv);
+ if (DBGetContactSetting(NULL, KEYBDMODULE, fmtDBSettingName("custom%d", i), &dbv))
+ fwprintf(fExport, _T("0\n\n"));
+ else {
+ fwprintf(fExport, _T("%s\n\n"), dbv.ptszVal);
+ DBFreeVariant(&dbv);
+ }
+ }
+
+ fwprintf(fExport, TranslateT("\n; End of automatically generated Keyboard Notify Theme file\n"));
+
+ fclose(fExport);
+}
+
+
+void importThemes(const TCHAR *filename, BOOL overrideExisting)
+{
+ int i, status=0;
+ FILE *fImport;
+ TCHAR buffer[MAX_PATH+1], theme[MAX_PATH+1], *str;
+
+ if (!(fImport = _wfopen(filename, _T("rt"))))
+ return;
+
+ while (fgetws(buffer, MAX_PATH, fImport) != NULL) {
+ for (str=buffer; *str && isspace(*str); str++); //ltrim
+ if (!*str || *str == ';') //empty line or comment
+ continue;
+ for (i=wcslen(str)-1; isspace(str[i]); str[i--]='\0'); //rtrim
+ switch (status) {
+ case 0:
+ if (i > 1 && str[0] == '[' && str[i] == ']') {
+ status = 1;
+ wcscpy(theme, str+1);
+ theme[i-1] = '\0';
+ }
+ break;
+ case 1:
+ status = 0;
+ writeThemeToCombo(theme, normalizeCustomString(str), overrideExisting);
+ break;
+ }
+ }
+
+ fclose(fImport);
+}
+
+
+void writeThemeToCombo(const TCHAR *theme, const TCHAR *custom, BOOL overrideExisting)
+{
+ int item;
+ TCHAR *str;
+
+ item = SendDlgItemMessage(hwndTheme, IDC_THEME, CB_FINDSTRINGEXACT, -1, (LPARAM)theme);
+ if (item == CB_ERR) {
+ item = SendDlgItemMessage(hwndTheme, IDC_THEME, CB_ADDSTRING, 0, (LPARAM)theme);
+ str = (TCHAR *)malloc(MAX_PATH+1);
+ if (str)
+ wcscpy(str, custom);
+ SendDlgItemMessage(hwndTheme, IDC_THEME, CB_SETITEMDATA, (WPARAM)item, (LPARAM)str);
+ } else
+ if (overrideExisting) {
+ str = (TCHAR *)SendDlgItemMessage(hwndTheme, IDC_THEME, CB_GETITEMDATA, (WPARAM)item, 0);
+ if (str)
+ wcscpy(str, custom);
+ }
+}
+
+
+INT_PTR CALLBACK DlgProcProcesses(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lParam)
+{
+ unsigned int i;
+
+ switch (msg) {
+
+ case WM_INITDIALOG:
+ TranslateDialogDefault(hwndDlg);
+
+ SendDlgItemMessage(hwndDlg, IDC_PROGRAMS, EM_LIMITTEXT, MAX_PATH, 0);
+
+ for (i=0; i < ProcessListAux.count; i++)
+ if (ProcessListAux.szFileName[i]) {
+ int index = SendDlgItemMessage(hwndDlg, IDC_PROGRAMS, CB_INSERTSTRING, (WPARAM)-1, (LPARAM)ProcessListAux.szFileName[i]);
+ if (index != CB_ERR && index != CB_ERRSPACE)
+ SendDlgItemMessage(hwndDlg, IDC_PROGRAMS, CB_SETITEMDATA, (WPARAM)index, (LPARAM)i);
+ }
+
+ EnableWindow(GetDlgItem(hwndDlg, IDC_ADDPGM), FALSE);
+ if (SendDlgItemMessage(hwndDlg, IDC_PROGRAMS, CB_GETCOUNT, 0, 0) == 0)
+ EnableWindow(GetDlgItem(hwndDlg, IDC_DELETEPGM), FALSE);
+ else
+ SendDlgItemMessage(hwndDlg, IDC_PROGRAMS, CB_SETCURSEL, 0, 0);
+
+ return TRUE;
+
+ case WM_COMMAND:
+ switch (LOWORD(wParam)) {
+ case IDC_PROGRAMS:
+ switch (HIWORD(wParam)) {
+ int item;
+ TCHAR szFileName[MAX_PATH+1];
+
+ case CBN_SELENDOK:
+ case CBN_SELCHANGE:
+ EnableWindow(GetDlgItem(hwndDlg, IDC_ADDPGM), FALSE);
+ EnableWindow(GetDlgItem(hwndDlg, IDC_DELETEPGM), TRUE);
+ break;
+ case CBN_EDITCHANGE:
+ GetDlgItemText(hwndDlg, IDC_PROGRAMS, szFileName, sizeof(szFileName));
+ if ((item = SendMessage((HWND)lParam, CB_FINDSTRINGEXACT, -1, (LPARAM)szFileName)) == CB_ERR) { //new program
+ EnableWindow(GetDlgItem(hwndDlg, IDC_ADDPGM), TRUE);
+ EnableWindow(GetDlgItem(hwndDlg, IDC_DELETEPGM), FALSE);
+ } else {
+ EnableWindow(GetDlgItem(hwndDlg, IDC_ADDPGM), FALSE);
+ EnableWindow(GetDlgItem(hwndDlg, IDC_DELETEPGM), TRUE);
+ }
+ break;
+ }
+ break;
+ case IDC_ADDPGM:
+ {
+ int item;
+ TCHAR szFileName[MAX_PATH+1];
+
+ GetDlgItemText(hwndDlg, IDC_PROGRAMS, szFileName, sizeof(szFileName));
+ if (!szFileName[0])
+ break;
+ item = SendDlgItemMessage(hwndDlg, IDC_PROGRAMS, CB_ADDSTRING, 0, (LPARAM)szFileName);
+ EnableWindow(GetDlgItem(hwndDlg, IDC_ADDPGM), FALSE);
+ EnableWindow(GetDlgItem(hwndDlg, IDC_DELETEPGM), TRUE);
+ }
+ break;
+ case IDC_DELETEPGM:
+ {
+ int item;
+ TCHAR szFileName[MAX_PATH+1];
+
+ GetDlgItemText(hwndDlg, IDC_PROGRAMS, szFileName, sizeof(szFileName));
+ item = SendDlgItemMessage(hwndDlg, IDC_PROGRAMS, CB_FINDSTRINGEXACT, -1, (LPARAM)szFileName);
+ SendDlgItemMessage(hwndDlg, IDC_PROGRAMS, CB_DELETESTRING, (WPARAM)item, 0);
+ if (SendDlgItemMessage(hwndDlg, IDC_PROGRAMS, CB_GETCOUNT, 0, 0) == 0) {
+ SetDlgItemText(hwndDlg, IDC_PROGRAMS, _T(""));
+ EnableWindow(GetDlgItem(hwndDlg, IDC_DELETEPGM), FALSE);
+ } else
+ SendDlgItemMessage(hwndDlg, IDC_PROGRAMS, CB_SETCURSEL, 0, 0);
+ }
+ break;
+ case IDC_OKPGM:
+ destroyProcessListAux();
+
+ ProcessListAux.count = SendDlgItemMessage(hwndDlg, IDC_PROGRAMS, CB_GETCOUNT, 0, 0);
+ ProcessListAux.szFileName = (TCHAR **)malloc(ProcessListAux.count * sizeof(TCHAR *));
+ if (!ProcessListAux.szFileName)
+ ProcessListAux.count = 0;
+ else
+ for (i=0; i < ProcessListAux.count; i++) {
+ TCHAR szFileNameAux[MAX_PATH+1];
+
+ SendDlgItemMessage(hwndDlg, IDC_PROGRAMS, CB_GETLBTEXT, (WPARAM)i, (LPARAM)szFileNameAux);
+ ProcessListAux.szFileName[i] = (TCHAR *)malloc(wcslen(szFileNameAux) + 1);
+ if (ProcessListAux.szFileName[i])
+ wcscpy(ProcessListAux.szFileName[i], szFileNameAux);
+ }
+
+ case IDC_CANCELPGM:
+ EndDialog(hwndDlg, LOWORD(wParam));
+ break;
+ }
+ break;
+ }
+
+ return FALSE;
+}
+
+
+void createProcessListAux(void)
+{
+ unsigned int i;
+
+ ProcessListAux.count = ProcessList.count;
+ ProcessListAux.szFileName = (TCHAR **)malloc(ProcessListAux.count * sizeof(char *));
+ if (!ProcessListAux.szFileName)
+ ProcessListAux.count = 0;
+ else
+ for (i=0; i < ProcessListAux.count; i++)
+ if (!ProcessList.szFileName[i])
+ ProcessListAux.szFileName[i] = NULL;
+ else {
+ ProcessListAux.szFileName[i] = (TCHAR *)malloc(wcslen(ProcessList.szFileName[i]) + 1);
+ if (ProcessListAux.szFileName[i])
+ wcscpy(ProcessListAux.szFileName[i], ProcessList.szFileName[i]);
+ }
+
+}
+
+
void destroyProcessListAux(void)
{
unsigned int i;
@@ -1312,75 +1311,75 @@ void destroyProcessListAux(void) }
-INT_PTR CALLBACK DlgProcEventLeds(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lParam) -{ - switch (msg) { - - case WM_INITDIALOG: - TranslateDialogDefault(hwndDlg); - - CheckDlgButton(hwndDlg, IDC_MSGLEDNUM, trillianLedsMsg&2 ? BST_CHECKED:BST_UNCHECKED); - CheckDlgButton(hwndDlg, IDC_MSGLEDCAPS, trillianLedsMsg&4 ? BST_CHECKED:BST_UNCHECKED); - CheckDlgButton(hwndDlg, IDC_MSGLEDSCROLL, trillianLedsMsg&1 ? BST_CHECKED:BST_UNCHECKED); - - CheckDlgButton(hwndDlg, IDC_FILELEDNUM, trillianLedsFile&2 ? BST_CHECKED:BST_UNCHECKED); - CheckDlgButton(hwndDlg, IDC_FILELEDCAPS, trillianLedsFile&4 ? BST_CHECKED:BST_UNCHECKED); - CheckDlgButton(hwndDlg, IDC_FILELEDSCROLL, trillianLedsFile&1 ? BST_CHECKED:BST_UNCHECKED); - - CheckDlgButton(hwndDlg, IDC_URLLEDNUM, trillianLedsURL&2 ? BST_CHECKED:BST_UNCHECKED); - CheckDlgButton(hwndDlg, IDC_URLLEDCAPS, trillianLedsURL&4 ? BST_CHECKED:BST_UNCHECKED); - CheckDlgButton(hwndDlg, IDC_URLLEDSCROLL, trillianLedsURL&1 ? BST_CHECKED:BST_UNCHECKED); - - CheckDlgButton(hwndDlg, IDC_OTHERLEDNUM, trillianLedsOther&2 ? BST_CHECKED:BST_UNCHECKED); - CheckDlgButton(hwndDlg, IDC_OTHERLEDCAPS, trillianLedsOther&4 ? BST_CHECKED:BST_UNCHECKED); - CheckDlgButton(hwndDlg, IDC_OTHERLEDSCROLL, trillianLedsOther&1 ? BST_CHECKED:BST_UNCHECKED); - - return TRUE; - - case WM_COMMAND: - switch (LOWORD(wParam)) { - case IDC_OK: - trillianLedsMsg = 0; - if(IsDlgButtonChecked(hwndDlg, IDC_MSGLEDNUM) == BST_CHECKED) - trillianLedsMsg |= 2; - if(IsDlgButtonChecked(hwndDlg, IDC_MSGLEDCAPS) == BST_CHECKED) - trillianLedsMsg |= 4; - if(IsDlgButtonChecked(hwndDlg, IDC_MSGLEDSCROLL) == BST_CHECKED) - trillianLedsMsg |= 1; - - trillianLedsFile = 0; - if(IsDlgButtonChecked(hwndDlg, IDC_FILELEDNUM) == BST_CHECKED) - trillianLedsFile |= 2; - if(IsDlgButtonChecked(hwndDlg, IDC_FILELEDCAPS) == BST_CHECKED) - trillianLedsFile |= 4; - if(IsDlgButtonChecked(hwndDlg, IDC_FILELEDSCROLL) == BST_CHECKED) - trillianLedsFile |= 1; - - trillianLedsURL = 0; - if(IsDlgButtonChecked(hwndDlg, IDC_URLLEDNUM) == BST_CHECKED) - trillianLedsURL |= 2; - if(IsDlgButtonChecked(hwndDlg, IDC_URLLEDCAPS) == BST_CHECKED) - trillianLedsURL |= 4; - if(IsDlgButtonChecked(hwndDlg, IDC_URLLEDSCROLL) == BST_CHECKED) - trillianLedsURL |= 1; - - trillianLedsOther = 0; - if(IsDlgButtonChecked(hwndDlg, IDC_OTHERLEDNUM) == BST_CHECKED) - trillianLedsOther |= 2; - if(IsDlgButtonChecked(hwndDlg, IDC_OTHERLEDCAPS) == BST_CHECKED) - trillianLedsOther |= 4; - if(IsDlgButtonChecked(hwndDlg, IDC_OTHERLEDSCROLL) == BST_CHECKED) - trillianLedsOther |= 1; - - case IDC_CANCEL: - EndDialog(hwndDlg, LOWORD(wParam)); - break; - } - break; - } - - return FALSE; -} +INT_PTR CALLBACK DlgProcEventLeds(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lParam)
+{
+ switch (msg) {
+
+ case WM_INITDIALOG:
+ TranslateDialogDefault(hwndDlg);
+
+ CheckDlgButton(hwndDlg, IDC_MSGLEDNUM, trillianLedsMsg&2 ? BST_CHECKED:BST_UNCHECKED);
+ CheckDlgButton(hwndDlg, IDC_MSGLEDCAPS, trillianLedsMsg&4 ? BST_CHECKED:BST_UNCHECKED);
+ CheckDlgButton(hwndDlg, IDC_MSGLEDSCROLL, trillianLedsMsg&1 ? BST_CHECKED:BST_UNCHECKED);
+
+ CheckDlgButton(hwndDlg, IDC_FILELEDNUM, trillianLedsFile&2 ? BST_CHECKED:BST_UNCHECKED);
+ CheckDlgButton(hwndDlg, IDC_FILELEDCAPS, trillianLedsFile&4 ? BST_CHECKED:BST_UNCHECKED);
+ CheckDlgButton(hwndDlg, IDC_FILELEDSCROLL, trillianLedsFile&1 ? BST_CHECKED:BST_UNCHECKED);
+
+ CheckDlgButton(hwndDlg, IDC_URLLEDNUM, trillianLedsURL&2 ? BST_CHECKED:BST_UNCHECKED);
+ CheckDlgButton(hwndDlg, IDC_URLLEDCAPS, trillianLedsURL&4 ? BST_CHECKED:BST_UNCHECKED);
+ CheckDlgButton(hwndDlg, IDC_URLLEDSCROLL, trillianLedsURL&1 ? BST_CHECKED:BST_UNCHECKED);
+
+ CheckDlgButton(hwndDlg, IDC_OTHERLEDNUM, trillianLedsOther&2 ? BST_CHECKED:BST_UNCHECKED);
+ CheckDlgButton(hwndDlg, IDC_OTHERLEDCAPS, trillianLedsOther&4 ? BST_CHECKED:BST_UNCHECKED);
+ CheckDlgButton(hwndDlg, IDC_OTHERLEDSCROLL, trillianLedsOther&1 ? BST_CHECKED:BST_UNCHECKED);
+
+ return TRUE;
+
+ case WM_COMMAND:
+ switch (LOWORD(wParam)) {
+ case IDC_OK:
+ trillianLedsMsg = 0;
+ if(IsDlgButtonChecked(hwndDlg, IDC_MSGLEDNUM) == BST_CHECKED)
+ trillianLedsMsg |= 2;
+ if(IsDlgButtonChecked(hwndDlg, IDC_MSGLEDCAPS) == BST_CHECKED)
+ trillianLedsMsg |= 4;
+ if(IsDlgButtonChecked(hwndDlg, IDC_MSGLEDSCROLL) == BST_CHECKED)
+ trillianLedsMsg |= 1;
+
+ trillianLedsFile = 0;
+ if(IsDlgButtonChecked(hwndDlg, IDC_FILELEDNUM) == BST_CHECKED)
+ trillianLedsFile |= 2;
+ if(IsDlgButtonChecked(hwndDlg, IDC_FILELEDCAPS) == BST_CHECKED)
+ trillianLedsFile |= 4;
+ if(IsDlgButtonChecked(hwndDlg, IDC_FILELEDSCROLL) == BST_CHECKED)
+ trillianLedsFile |= 1;
+
+ trillianLedsURL = 0;
+ if(IsDlgButtonChecked(hwndDlg, IDC_URLLEDNUM) == BST_CHECKED)
+ trillianLedsURL |= 2;
+ if(IsDlgButtonChecked(hwndDlg, IDC_URLLEDCAPS) == BST_CHECKED)
+ trillianLedsURL |= 4;
+ if(IsDlgButtonChecked(hwndDlg, IDC_URLLEDSCROLL) == BST_CHECKED)
+ trillianLedsURL |= 1;
+
+ trillianLedsOther = 0;
+ if(IsDlgButtonChecked(hwndDlg, IDC_OTHERLEDNUM) == BST_CHECKED)
+ trillianLedsOther |= 2;
+ if(IsDlgButtonChecked(hwndDlg, IDC_OTHERLEDCAPS) == BST_CHECKED)
+ trillianLedsOther |= 4;
+ if(IsDlgButtonChecked(hwndDlg, IDC_OTHERLEDSCROLL) == BST_CHECKED)
+ trillianLedsOther |= 1;
+
+ case IDC_CANCEL:
+ EndDialog(hwndDlg, LOWORD(wParam));
+ break;
+ }
+ break;
+ }
+
+ return FALSE;
+}
void createXstatusListAux(void)
@@ -1461,14 +1460,14 @@ INT_PTR CALLBACK DlgProcXstatusList(HWND hwndDlg, UINT msg, WPARAM wParam, LPARA for (i=0; i < ProtoList.protoCount; i++)
if (ProtoList.protoInfo[i].enabled && XstatusListAux[i].count) {
HTREEITEM hParent;
- char szProtoName[MAXMODULELABELLENGTH];
- CallProtoService(ProtoList.protoInfo[i].szProto, PS_GETNAME, sizeof(szProtoName), (LPARAM)szProtoName);
+ int count; PROTOACCOUNT** protos;
+ ProtoEnumAccounts( &count, &protos );
tvis.hParent = NULL;
tvis.hInsertAfter = TVI_LAST;
tvis.item.mask = TVIF_TEXT|TVIF_PARAM|TVIF_STATE|TVIF_IMAGE|TVIF_SELECTEDIMAGE;
- tvis.item.pszText = szProtoName;
+ tvis.item.pszText = protos[i] -> tszAccountName;
tvis.item.lParam = (LPARAM)i;
tvis.item.stateMask = TVIS_BOLD|TVIS_EXPANDED;
tvis.item.state = TVIS_BOLD|TVIS_EXPANDED;
@@ -1476,17 +1475,17 @@ INT_PTR CALLBACK DlgProcXstatusList(HWND hwndDlg, UINT msg, WPARAM wParam, LPARA if (hIconAux) DestroyIcon(hIconAux);
hParent = TreeView_InsertItem(hwndTree, &tvis);
for(j=0; j < XstatusListAux[i].count; j++) {
- char szDefaultName[1024];
+ TCHAR szDefaultName[1024];
ICQ_CUSTOM_STATUS xstatus={0};
tvis.hParent = hParent;
tvis.item.mask = TVIF_TEXT|TVIF_PARAM|TVIF_IMAGE|TVIF_SELECTEDIMAGE;
- if (!j)
- tvis.item.pszText = Translate("None");
+ if (!j){
+ tvis.item.pszText = TranslateT("None"); }
else {
xstatus.cbSize = sizeof(ICQ_CUSTOM_STATUS);
- xstatus.flags = CSSF_MASK_NAME|CSSF_DEFAULT_NAME;
- xstatus.pszName = szDefaultName;
+ xstatus.flags = CSSF_MASK_NAME|CSSF_DEFAULT_NAME|CSSF_UNICODE;
+ xstatus.ptszName = szDefaultName;
xstatus.wParam = &j;
CallProtoService(ProtoList.protoInfo[i].szProto, PS_ICQ_GETCUSTOMSTATUSEX, 0, (LPARAM)&xstatus);
tvis.item.pszText = szDefaultName;
diff --git a/plugins/KeyboardNotify/protolist.h b/plugins/KeyboardNotify/protolist.h index 9c71ae65ce..f48f64d126 100644 --- a/plugins/KeyboardNotify/protolist.h +++ b/plugins/KeyboardNotify/protolist.h @@ -1,19 +1,19 @@ -/* - -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. - +/*
+
+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.
+
*/
typedef struct {
@@ -29,6 +29,6 @@ typedef struct { } PROTOCOL_INFO;
typedef struct {
- unsigned int protoCount; - PROTOCOL_INFO *protoInfo; -} PROTOCOL_LIST; + unsigned int protoCount;
+ PROTOCOL_INFO *protoInfo;
+} PROTOCOL_LIST;
diff --git a/plugins/KeyboardNotify/trigger.c b/plugins/KeyboardNotify/trigger.c index e8b155e4e8..2f07230696 100644 --- a/plugins/KeyboardNotify/trigger.c +++ b/plugins/KeyboardNotify/trigger.c @@ -167,7 +167,7 @@ int RegisterAction() ar.actionFunction = TriggerStartBlinkFunction;
ar.hInstance = hInst;
ar.pfnDlgProc = DlgProcOptsActionKbdNotify;
- ar.pszTemplate = MAKEINTRESOURCE(IDD_OPT_KN_ACTION);
+ ar.pszTemplate = MAKEINTRESOURCEA(IDD_OPT_KN_ACTION);
ar.flags = ARF_FUNCTION;
return CallService(MS_TRIGGER_REGISTERACTION, 0, (LPARAM)&ar);
}
diff --git a/plugins/KeyboardNotify/utils.c b/plugins/KeyboardNotify/utils.c index 1307fbe570..9c710ba217 100644 --- a/plugins/KeyboardNotify/utils.c +++ b/plugins/KeyboardNotify/utils.c @@ -39,14 +39,14 @@ char *fmtDBSettingName(const char *fmt, ...) }
-char *getAbsoluteProfileName(char *absoluteProfileName, size_t maxLen)
+TCHAR *getAbsoluteProfileName(TCHAR *absoluteProfileName, size_t maxLen)
{
- char profilePath[MAX_PATH+1], profileName[MAX_PATH+1];
+ TCHAR profilePath[MAX_PATH+1], profileName[MAX_PATH+1];
- profilePath[0] = profileName[0] = '\0';
+ profilePath[0] = profileName[0] = L'\0';
CallService(MS_DB_GETPROFILEPATH, MAX_PATH, (LPARAM)profilePath);
CallService(MS_DB_GETPROFILENAME, MAX_PATH, (LPARAM)profileName);
- mir_snprintf(absoluteProfileName, maxLen, "%s\\%s", profilePath, profileName);
+ _snwprintf(absoluteProfileName, maxLen, L"%s\\%s", profilePath, profileName);
return absoluteProfileName;
}
diff --git a/plugins/KeyboardNotify/utils.h b/plugins/KeyboardNotify/utils.h index fe3a2664bb..66917754ed 100644 --- a/plugins/KeyboardNotify/utils.h +++ b/plugins/KeyboardNotify/utils.h @@ -17,4 +17,4 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
char *fmtDBSettingName(const char *, ...);
-char *getAbsoluteProfileName(char *, size_t);
+TCHAR *getAbsoluteProfileName(TCHAR *, size_t);
|