diff options
-rw-r--r-- | plugins/KeyboardNotify/res/resources.rc | 40 | ||||
-rw-r--r-- | plugins/KeyboardNotify/src/constants.h | 1 | ||||
-rw-r--r-- | plugins/KeyboardNotify/src/main.cpp | 25 | ||||
-rw-r--r-- | plugins/KeyboardNotify/src/options.cpp | 954 | ||||
-rw-r--r-- | plugins/KeyboardNotify/src/resource.h | 7 | ||||
-rw-r--r-- | plugins/KeyboardNotify/src/stdafx.h | 18 | ||||
-rw-r--r-- | plugins/KeyboardNotify/src/version.h | 16 |
7 files changed, 499 insertions, 562 deletions
diff --git a/plugins/KeyboardNotify/res/resources.rc b/plugins/KeyboardNotify/res/resources.rc index 34ba5aa856..1874b9eda8 100644 --- a/plugins/KeyboardNotify/res/resources.rc +++ b/plugins/KeyboardNotify/res/resources.rc @@ -24,14 +24,6 @@ LANGUAGE LANG_ENGLISH, SUBLANG_ENGLISH_US // Dialog
//
-IDD_OPTIONS DIALOGEX 0, 0, 313, 250
-STYLE DS_SETFONT | DS_FIXEDSYS | WS_CHILD
-EXSTYLE WS_EX_CONTROLPARENT
-FONT 8, "MS Shell Dlg", 0, 0, 0x1
-BEGIN
- CONTROL "",IDC_TABS,"SysTabControl32",0x0,0,0,313,250
-END
-
IDD_PROTO_OPTIONS DIALOGEX 1, 15, 308, 228
STYLE DS_SETFONT | DS_FIXEDSYS | WS_CHILD
EXSTYLE WS_EX_CONTROLPARENT
@@ -49,7 +41,8 @@ BEGIN GROUPBOX "Events to react on",IDC_STATIC,3,4,147,68
CONTROL "Incoming messages",IDC_ONMESSAGE,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,19,16,127,10
CONTROL "Incoming files",IDC_ONFILE,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,19,29,127,10
- CONTROL "Everything else",IDC_ONOTHER,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,19,42,128,10
+ CONTROL "Groupchat messages",IDC_GCMSG,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,19,42,127,10
+ CONTROL "Everything else",IDC_ONOTHER,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,19,55,128,10
GROUPBOX "Message-Event only",IDC_STATIC,3,77,147,57
CONTROL "Blink if message window is open",IDC_IFOPEN,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,7,89,140,10
CONTROL "and not in foreground",IDC_IFNOTTOP,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,19,102,127,10
@@ -76,19 +69,19 @@ BEGIN CONTROL "All other situations",IDC_ACTIVE,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,168,58,117,10
GROUPBOX "Only notify if status is",IDC_STATIC,155,77,147,107
CONTROL "Online",IDC_ONLINE,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,168,88,65,9
- CONTROL "Away",IDC_AWAY,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,168,98,128,9
- CONTROL "Occupied",IDC_OCCUPIED,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,168,118,128,9
- CONTROL "Not available",IDC_NA,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,168,108,128,9
- CONTROL "Do not disturb",IDC_DND,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,168,128,85,9
- CONTROL "Free for chat",IDC_FREECHAT,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,168,138,127,9
- CONTROL "Invisible",IDC_INVISIBLE,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,168,148,128,9
+ CONTROL "Away",IDC_AWAY,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,168,101,128,9
+ CONTROL "Not available",IDC_NA,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,168,114,128,9
+ CONTROL "Occupied",IDC_OCCUPIED,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,168,127,128,9
+ CONTROL "Do not disturb",IDC_DND,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,168,140,85,9
+ CONTROL "Free for chat",IDC_FREECHAT,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,168,153,127,9
+ CONTROL "Invisible",IDC_INVISIBLE,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,168,166,128,9
GROUPBOX "Pending Events",IDC_STATIC,155,189,147,28
LTEXT "Remind me every",IDC_STATIC,168,200,58,9
EDITTEXT IDC_SREMCHECK,226,198,37,13,ES_NUMBER
CONTROL "Spin1",IDC_REMCHECK,"msctls_updown32",UDS_SETBUDDYINT | UDS_ALIGNRIGHT | UDS_ARROWKEYS | UDS_NOTHOUSANDS,252,198,9,13
LTEXT "minutes",IDC_STATIC,266,200,30,9
CONTROL "Offline",IDC_OFFLINE,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,237,88,61,9
- PUSHBUTTON "xStatuses",IDC_SELECTXSTATUS,258,128,40,9
+ PUSHBUTTON "xStatuses",IDC_SELECTXSTATUS,258,140,40,9
END
IDD_EFFECT_OPTIONS DIALOGEX 1, 15, 310, 223
@@ -234,10 +227,6 @@ END #ifdef APSTUDIO_INVOKED
GUIDELINES DESIGNINFO
BEGIN
- IDD_OPTIONS, DIALOG
- BEGIN
- END
-
IDD_PROTO_OPTIONS, DIALOG
BEGIN
RIGHTMARGIN, 304
@@ -327,6 +316,17 @@ END #endif // APSTUDIO_INVOKED
+
+/////////////////////////////////////////////////////////////////////////////
+//
+// AFX_DIALOG_LAYOUT
+//
+
+IDD_BASIC_OPTIONS AFX_DIALOG_LAYOUT
+BEGIN
+ 0
+END
+
#endif // English (United States) resources
/////////////////////////////////////////////////////////////////////////////
diff --git a/plugins/KeyboardNotify/src/constants.h b/plugins/KeyboardNotify/src/constants.h index 175b33d6bc..893ba83f97 100644 --- a/plugins/KeyboardNotify/src/constants.h +++ b/plugins/KeyboardNotify/src/constants.h @@ -47,6 +47,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. // Default settings
#define DEF_SETTING_ONMSG 1 // 1: Yes, 0: No
+#define DEF_SETTING_ONMSGGC 0 // 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
diff --git a/plugins/KeyboardNotify/src/main.cpp b/plugins/KeyboardNotify/src/main.cpp index 230b99e734..df7766cb16 100644 --- a/plugins/KeyboardNotify/src/main.cpp +++ b/plugins/KeyboardNotify/src/main.cpp @@ -46,6 +46,7 @@ POINT lastGlobalMousePos = { 0, 0 }; BYTE bFlashOnMsg;
BYTE bFlashOnFile;
+BYTE bFlashOnGC;
BYTE bFlashOnOther;
BYTE bFullScreenMode;
BYTE bScreenSaverRunning;
@@ -212,7 +213,7 @@ BOOL checkIgnore(MCONTACT hContact, WORD eventType) return !IsIgnored(hContact, eventType);
}
-BOOL checkProtocol(char *szProto)
+BOOL checkProtocol(const char *szProto)
{
if (!szProto)
return FALSE;
@@ -224,7 +225,7 @@ BOOL checkProtocol(char *szProto) return FALSE;
}
-BOOL metaCheckProtocol(char *szProto, MCONTACT hContact, WORD eventType)
+BOOL metaCheckProtocol(const char *szProto, MCONTACT hContact, WORD eventType)
{
MCONTACT hSubContact = NULL;
@@ -340,7 +341,7 @@ BOOL checkMsgTimestamp(MCONTACT hContact, MEVENT hEventCurrent, DWORD timestampC }
-BOOL contactCheckProtocol(char *szProto, MCONTACT hContact, WORD eventType)
+BOOL contactCheckProtocol(const char *szProto, MCONTACT hContact, WORD eventType)
{
if (bMetaProtoEnabled && hContact) {
MCONTACT hMetaContact = (MCONTACT)db_get_dw(hContact, META_PROTO, "Handle", 0);
@@ -352,7 +353,7 @@ BOOL contactCheckProtocol(char *szProto, MCONTACT hContact, WORD eventType) }
-BOOL checkStatus(char *szProto)
+BOOL checkStatus(const char *szProto)
{
if (!szProto)
return checkGlobalStatus();
@@ -361,7 +362,7 @@ BOOL checkStatus(char *szProto) }
-BOOL checkXstatus(char *szProto)
+BOOL checkXstatus(const char *szProto)
{
int status = 0;
@@ -403,6 +404,18 @@ static int PluginMessageEventHook(WPARAM hContact, LPARAM hEvent) return 0;
}
+// monitors group chat events
+static int OnGcEvent(WPARAM, LPARAM lParam)
+{
+ GCHOOK *gc = (GCHOOK *)lParam;
+ if (gc->iType == GC_USER_MESSAGE && bFlashOnGC) {
+ if (SESSION_INFO *si = g_chatApi.SM_FindSession(gc->ptszID, gc->pszModule))
+ if (contactCheckProtocol(gc->pszModule, si->hContact, EVENTTYPE_MESSAGE) && checkNotifyOptions() && checkStatus(gc->pszModule))
+ SetEvent(hFlashEvent);
+ }
+
+ return 0;
+}
// **
// ** Checks for pending events. If it finds any, it pings the FlashThread to keep the LEDs flashing.
@@ -661,6 +674,7 @@ void LoadSettings(void) {
bFlashOnMsg = g_plugin.getByte("onmsg", DEF_SETTING_ONMSG);
bFlashOnFile = g_plugin.getByte("onfile", DEF_SETTING_ONFILE);
+ bFlashOnGC = g_plugin.getByte("ongcmsg", DEF_SETTING_ONMSGGC);
bFlashOnOther = g_plugin.getByte("onother", DEF_SETTING_OTHER);
bFullScreenMode = g_plugin.getByte("fscreenmode", DEF_SETTING_FSCREEN);
bScreenSaverRunning = g_plugin.getByte("ssaverrunning", DEF_SETTING_SSAVER);
@@ -901,6 +915,7 @@ int CMPlugin::Load() OpenKeyboardDevice();
HookEvent(ME_MC_ENABLED, OnMetaChanged);
+ HookEvent(ME_GC_EVENT, OnGcEvent);
HookEvent(ME_DB_EVENT_ADDED, PluginMessageEventHook);
HookEvent(ME_OPT_INITIALISE, InitializeOptions);
HookEvent(ME_SYSTEM_MODULESLOADED, ModulesLoaded);
diff --git a/plugins/KeyboardNotify/src/options.cpp b/plugins/KeyboardNotify/src/options.cpp index 4446fcbbf1..b7d0cf23c9 100644 --- a/plugins/KeyboardNotify/src/options.cpp +++ b/plugins/KeyboardNotify/src/options.cpp @@ -22,9 +22,11 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. void LoadSettings(void); -extern BYTE bFlashOnMsg, bFlashOnFile, bFlashOnOther, bFullScreenMode, bScreenSaverRunning, bWorkstationLocked, bProcessesAreRunning, -bWorkstationActive, bFlashIfMsgOpen, bFlashIfMsgOlder, bFlashUntil, bMirandaOrWindows, bFlashLed[3], bFlashEffect, bSequenceOrder, bFlashSpeed, -bEmulateKeypresses, bOverride, bFlashIfMsgWinNotTop, bTrillianLedsMsg, bTrillianLedsURL, bTrillianLedsFile, bTrillianLedsOther; +extern BYTE + bFlashOnMsg, bFlashOnFile, bFlashOnGC, bFlashOnOther, bFullScreenMode, bScreenSaverRunning, bWorkstationLocked, bProcessesAreRunning, + bWorkstationActive, bFlashIfMsgOpen, bFlashIfMsgOlder, bFlashUntil, bMirandaOrWindows, bFlashLed[3], bFlashEffect, bSequenceOrder, bFlashSpeed, + bEmulateKeypresses, bOverride, bFlashIfMsgWinNotTop, bTrillianLedsMsg, bTrillianLedsURL, bTrillianLedsFile, bTrillianLedsOther; + extern WORD wSecondsOlder, wBlinksNumber, wStatusMap, wReminderCheck, wCustomTheme, wStartDelay; extern PROTOCOL_LIST ProtoList; @@ -47,18 +49,16 @@ static void writeThemeToCombo(const wchar_t *theme, const wchar_t *custom, BOOL wchar_t *str = mir_wstrdup(custom); SendDlgItemMessage(hwndTheme, IDC_THEME, CB_SETITEMDATA, (WPARAM)item, (LPARAM)str); } - else - if (overrideExisting) { - wchar_t *str = (wchar_t *)SendDlgItemMessage(hwndTheme, IDC_THEME, CB_GETITEMDATA, (WPARAM)item, 0); - if (str) - mir_wstrcpy(str, custom); - } + else if (overrideExisting) { + wchar_t *str = (wchar_t *)SendDlgItemMessage(hwndTheme, IDC_THEME, CB_GETITEMDATA, (WPARAM)item, 0); + if (str) + mir_wstrcpy(str, custom); + } } void exportThemes(const wchar_t *filename) { FILE *fExport = _wfopen(filename, L"wt"); - if (!fExport) return; @@ -72,8 +72,7 @@ void exportThemes(const wchar_t *filename) fwprintf(fExport, L"%s\n\n", szTheme); mir_free(szTheme); } - else - fwprintf(fExport, L"0\n\n"); + else fwprintf(fExport, L"0\n\n"); } fwprintf(fExport, TranslateT("\n; End of automatically generated Keyboard Notify Theme file\n")); @@ -118,27 +117,26 @@ static void createProcessListAux(void) { ProcessListAux.count = ProcessList.count; ProcessListAux.szFileName = (wchar_t **)mir_alloc(ProcessListAux.count * sizeof(wchar_t *)); - if (!ProcessListAux.szFileName) - ProcessListAux.count = 0; - else - for (int i = 0; i < ProcessListAux.count; i++) + if (ProcessListAux.szFileName) { + for (int i = 0; i < ProcessListAux.count; i++) { if (!ProcessList.szFileName[i]) ProcessListAux.szFileName[i] = nullptr; - else { + else ProcessListAux.szFileName[i] = mir_wstrdup(ProcessList.szFileName[i]); - } - + } + } + else ProcessListAux.count = 0; } static void destroyProcessListAux(void) { if (ProcessListAux.szFileName == nullptr) return; - for (int i = 0; i < ProcessListAux.count; i++) { - if (ProcessListAux.szFileName[i]) { + + for (int i = 0; i < ProcessListAux.count; i++) + if (ProcessListAux.szFileName[i]) mir_free(ProcessListAux.szFileName[i]); - } - } + mir_free(ProcessListAux.szFileName); ProcessListAux.count = 0; ProcessListAux.szFileName = nullptr; @@ -173,13 +171,11 @@ static void destroyXstatusListAux(void) mir_free(XstatusListAux); XstatusListAux = nullptr; } - } static INT_PTR CALLBACK DlgProcProcesses(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lParam) { switch (msg) { - case WM_INITDIALOG: TranslateDialogDefault(hwndDlg); @@ -226,30 +222,30 @@ static INT_PTR CALLBACK DlgProcProcesses(HWND hwndDlg, UINT msg, WPARAM wParam, } break; case IDC_ADDPGM: - { - wchar_t szFileName[MAX_PATH + 1]; - GetDlgItemText(hwndDlg, IDC_PROGRAMS, szFileName, _countof(szFileName)); - if (!szFileName[0]) - break; - SendDlgItemMessage(hwndDlg, IDC_PROGRAMS, CB_ADDSTRING, 0, (LPARAM)szFileName); - EnableWindow(GetDlgItem(hwndDlg, IDC_ADDPGM), FALSE); - EnableWindow(GetDlgItem(hwndDlg, IDC_DELETEPGM), TRUE); - } - break; + { + wchar_t szFileName[MAX_PATH + 1]; + GetDlgItemText(hwndDlg, IDC_PROGRAMS, szFileName, _countof(szFileName)); + if (!szFileName[0]) + break; + 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: - { - wchar_t szFileName[MAX_PATH + 1]; - GetDlgItemText(hwndDlg, IDC_PROGRAMS, szFileName, _countof(szFileName)); - int 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, L""); - EnableWindow(GetDlgItem(hwndDlg, IDC_DELETEPGM), FALSE); + { + wchar_t szFileName[MAX_PATH + 1]; + GetDlgItemText(hwndDlg, IDC_PROGRAMS, szFileName, _countof(szFileName)); + int 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, L""); + EnableWindow(GetDlgItem(hwndDlg, IDC_DELETEPGM), FALSE); + } + else + SendDlgItemMessage(hwndDlg, IDC_PROGRAMS, CB_SETCURSEL, 0, 0); } - else - SendDlgItemMessage(hwndDlg, IDC_PROGRAMS, CB_SETCURSEL, 0, 0); - } - break; + break; case IDC_OKPGM: destroyProcessListAux(); @@ -279,7 +275,6 @@ static INT_PTR CALLBACK DlgProcProcesses(HWND hwndDlg, UINT msg, WPARAM wParam, static INT_PTR CALLBACK DlgProcXstatusList(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM) { switch (msg) { - case WM_INITDIALOG: TranslateDialogDefault(hwndDlg); { @@ -371,43 +366,43 @@ static INT_PTR CALLBACK DlgProcXstatusList(HWND hwndDlg, UINT msg, WPARAM wParam return TRUE; case WM_DESTROY: - { - // Destroy tree view imagelist since it does not get destroyed automatically (see msdn docs) - HIMAGELIST hImageList = TreeView_GetImageList(GetDlgItem(hwndDlg, IDC_TREE_XSTATUS), TVSIL_STATE); - if (hImageList) { - TreeView_SetImageList(GetDlgItem(hwndDlg, IDC_TREE_XSTATUS), NULL, TVSIL_STATE); - ImageList_Destroy(hImageList); - } - hImageList = TreeView_GetImageList(GetDlgItem(hwndDlg, IDC_TREE_XSTATUS), TVSIL_NORMAL); - if (hImageList) { - TreeView_SetImageList(GetDlgItem(hwndDlg, IDC_TREE_XSTATUS), NULL, TVSIL_NORMAL); - ImageList_Destroy(hImageList); + { + // Destroy tree view imagelist since it does not get destroyed automatically (see msdn docs) + HIMAGELIST hImageList = TreeView_GetImageList(GetDlgItem(hwndDlg, IDC_TREE_XSTATUS), TVSIL_STATE); + if (hImageList) { + TreeView_SetImageList(GetDlgItem(hwndDlg, IDC_TREE_XSTATUS), NULL, TVSIL_STATE); + ImageList_Destroy(hImageList); + } + hImageList = TreeView_GetImageList(GetDlgItem(hwndDlg, IDC_TREE_XSTATUS), TVSIL_NORMAL); + if (hImageList) { + TreeView_SetImageList(GetDlgItem(hwndDlg, IDC_TREE_XSTATUS), NULL, TVSIL_NORMAL); + ImageList_Destroy(hImageList); + } } - } - return TRUE; + return TRUE; case WM_COMMAND: switch (LOWORD(wParam)) { case IDC_OKXST: - { - unsigned int i, j; - HTREEITEM hSectionItem, hItem; - TVITEM tvi = { 0 }; - HWND hwndTree = GetDlgItem(hwndDlg, IDC_TREE_XSTATUS); - - tvi.mask = TVIF_HANDLE | TVIF_PARAM; - for (hSectionItem = TreeView_GetRoot(hwndTree); hSectionItem; hSectionItem = TreeView_GetNextSibling(hwndTree, hSectionItem)) { - tvi.hItem = hSectionItem; - TreeView_GetItem(hwndTree, &tvi); - i = (unsigned int)tvi.lParam; - for (hItem = TreeView_GetChild(hwndTree, hSectionItem); hItem; hItem = TreeView_GetNextSibling(hwndTree, hItem)) { - tvi.hItem = hItem; + { + unsigned int i, j; + HTREEITEM hSectionItem, hItem; + TVITEM tvi = { 0 }; + HWND hwndTree = GetDlgItem(hwndDlg, IDC_TREE_XSTATUS); + + tvi.mask = TVIF_HANDLE | TVIF_PARAM; + for (hSectionItem = TreeView_GetRoot(hwndTree); hSectionItem; hSectionItem = TreeView_GetNextSibling(hwndTree, hSectionItem)) { + tvi.hItem = hSectionItem; TreeView_GetItem(hwndTree, &tvi); - j = (unsigned int)tvi.lParam; - XstatusListAux[i].enabled[j] = (TreeView_GetItemState(hwndTree, hItem, TVIS_STATEIMAGEMASK)&INDEXTOSTATEIMAGEMASK(2)); + i = (unsigned int)tvi.lParam; + for (hItem = TreeView_GetChild(hwndTree, hSectionItem); hItem; hItem = TreeView_GetNextSibling(hwndTree, hItem)) { + tvi.hItem = hItem; + TreeView_GetItem(hwndTree, &tvi); + j = (unsigned int)tvi.lParam; + XstatusListAux[i].enabled[j] = (TreeView_GetItemState(hwndTree, hItem, TVIS_STATEIMAGEMASK) & INDEXTOSTATEIMAGEMASK(2)); + } } - } - } // fallthrough + } // fallthrough case IDC_CANCELXST: EndDialog(hwndDlg, LOWORD(wParam)); @@ -422,7 +417,6 @@ static INT_PTR CALLBACK DlgProcXstatusList(HWND hwndDlg, UINT msg, WPARAM wParam static INT_PTR CALLBACK DlgProcEventLeds(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM) { switch (msg) { - case WM_INITDIALOG: TranslateDialogDefault(hwndDlg); @@ -441,7 +435,6 @@ static INT_PTR CALLBACK DlgProcEventLeds(HWND hwndDlg, UINT msg, WPARAM wParam, 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: @@ -494,7 +487,6 @@ static INT_PTR CALLBACK DlgProcProtoOptions(HWND hwndDlg, UINT msg, WPARAM, LPAR static BOOL initDlg = FALSE; switch (msg) { - case WM_INITDIALOG: initDlg = TRUE; TranslateDialogDefault(hwndDlg); @@ -518,7 +510,7 @@ static INT_PTR CALLBACK DlgProcProtoOptions(HWND hwndDlg, UINT msg, WPARAM, LPAR lvItem.iItem = 0; lvItem.iSubItem = 0; for (int i = 0; i < ProtoList.protoCount; i++) { - int count; PROTOACCOUNT** protos; + int count; PROTOACCOUNT **protos; Proto_EnumAccounts(&count, &protos); if (ProtoList.protoInfo[i].visible) { lvItem.lParam = (LPARAM)ProtoList.protoInfo[i].szProto; @@ -534,47 +526,47 @@ static INT_PTR CALLBACK DlgProcProtoOptions(HWND hwndDlg, UINT msg, WPARAM, LPAR 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 - { - LVITEM lvItem; - HWND hList = GetDlgItem(hwndDlg, IDC_PROTOCOLLIST); - - memset(&lvItem, 0, sizeof(lvItem)); - lvItem.mask = LVIF_PARAM; - lvItem.iSubItem = 0; - for (int i = 0; i < ListView_GetItemCount(hList); i++) { - lvItem.iItem = i; - ListView_GetItem(hList, &lvItem); - g_plugin.setByte((char *)lvItem.lParam, (BYTE)ListView_GetCheckState(hList, lvItem.iItem)); - } - } - - LoadSettings(); + { + //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 + { + LVITEM lvItem; + HWND hList = GetDlgItem(hwndDlg, IDC_PROTOCOLLIST); + + memset(&lvItem, 0, sizeof(lvItem)); + lvItem.mask = LVIF_PARAM; + lvItem.iSubItem = 0; + for (int i = 0; i < ListView_GetItemCount(hList); i++) { + lvItem.iItem = i; + ListView_GetItem(hList, &lvItem); + g_plugin.setByte((char *)lvItem.lParam, (BYTE)ListView_GetCheckState(hList, lvItem.iItem)); + } + } - return TRUE; - } // switch code - 0 - break; - case IDC_PROTOCOLLIST: - switch (((NMHDR*)lParam)->code) { - case LVN_ITEMCHANGED: - { - NMLISTVIEW *nmlv = (NMLISTVIEW *)lParam; + LoadSettings(); - 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 + 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(hwndDlg), PSM_CHANGED, 0, 0); + } + break; + } // switch code - IDC_PROTOCOLLIST + break; + } //switch idFrom + } + break; //End WM_NOTIFY default: break; @@ -598,6 +590,7 @@ static INT_PTR CALLBACK DlgProcBasicOptions(HWND hwndDlg, UINT msg, WPARAM wPara CheckDlgButton(hwndDlg, IDC_ONMESSAGE, bFlashOnMsg ? BST_CHECKED : BST_UNCHECKED); CheckDlgButton(hwndDlg, IDC_ONFILE, bFlashOnFile ? BST_CHECKED : BST_UNCHECKED); + CheckDlgButton(hwndDlg, IDC_GCMSG, bFlashOnGC ? BST_CHECKED : BST_UNCHECKED); CheckDlgButton(hwndDlg, IDC_ONOTHER, bFlashOnOther ? BST_CHECKED : BST_UNCHECKED); CheckDlgButton(hwndDlg, IDC_FSCREEN, bFullScreenMode ? BST_CHECKED : BST_UNCHECKED); @@ -619,7 +612,7 @@ static INT_PTR CALLBACK DlgProcBasicOptions(HWND hwndDlg, UINT msg, WPARAM wPara EnableWindow(GetDlgItem(hwndDlg, IDC_OLDERSPIN), FALSE); } - CheckDlgButton(hwndDlg, IDC_UNTILBLK, bFlashUntil&UNTIL_NBLINKS ? BST_CHECKED : BST_UNCHECKED); + 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)); @@ -627,7 +620,7 @@ static INT_PTR CALLBACK DlgProcBasicOptions(HWND hwndDlg, UINT msg, WPARAM wPara EnableWindow(GetDlgItem(hwndDlg, IDC_SBLINK), FALSE); EnableWindow(GetDlgItem(hwndDlg, IDC_BLINKSPIN), FALSE); } - CheckDlgButton(hwndDlg, IDC_UNTILATTENDED, bFlashUntil&UNTIL_REATTENDED ? BST_CHECKED : BST_UNCHECKED); + CheckDlgButton(hwndDlg, IDC_UNTILATTENDED, bFlashUntil & UNTIL_REATTENDED ? BST_CHECKED : BST_UNCHECKED); for (int 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) @@ -657,7 +650,7 @@ static INT_PTR CALLBACK DlgProcBasicOptions(HWND hwndDlg, UINT msg, WPARAM wPara case WM_VSCROLL: case WM_HSCROLL: - SendMessage(GetParent(GetParent(hwndDlg)), PSM_CHANGED, 0, 0); + SendMessage(GetParent(hwndDlg), PSM_CHANGED, 0, 0); break; case WM_DESTROY: @@ -668,6 +661,7 @@ static INT_PTR CALLBACK DlgProcBasicOptions(HWND hwndDlg, UINT msg, WPARAM wPara case WM_COMMAND: switch (LOWORD(wParam)) { case IDC_ONMESSAGE: + case IDC_GCMSG: case IDC_ONFILE: case IDC_ONOTHER: case IDC_IFOPEN: @@ -696,7 +690,7 @@ static INT_PTR CALLBACK DlgProcBasicOptions(HWND hwndDlg, UINT msg, WPARAM wPara 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); + SendMessage(GetParent(hwndDlg), PSM_CHANGED, 0, 0); return TRUE; case IDC_SOLDER: if (HIWORD(wParam) == EN_CHANGE && !initDlg) { @@ -704,7 +698,7 @@ static INT_PTR CALLBACK DlgProcBasicOptions(HWND hwndDlg, UINT msg, WPARAM wPara 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); + SendMessage(GetParent(hwndDlg), PSM_CHANGED, 0, 0); } return TRUE; case IDC_SBLINK: @@ -713,104 +707,104 @@ static INT_PTR CALLBACK DlgProcBasicOptions(HWND hwndDlg, UINT msg, WPARAM wPara 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); + SendMessage(GetParent(hwndDlg), PSM_CHANGED, 0, 0); } return TRUE; case IDC_ASSIGNPGMS: if (DialogBoxParam(g_plugin.getInst(), MAKEINTRESOURCE(IDD_PROCESSES), hwndDlg, DlgProcProcesses, 0) == IDC_OKPGM) - SendMessage(GetParent(GetParent(hwndDlg)), PSM_CHANGED, 0, 0); + SendMessage(GetParent(hwndDlg), PSM_CHANGED, 0, 0); return TRUE; case IDC_SELECTXSTATUS: if (DialogBoxParam(g_plugin.getInst(), MAKEINTRESOURCE(IDD_XSTATUSES), hwndDlg, DlgProcXstatusList, 0) == IDC_OKXST) - SendMessage(GetParent(GetParent(hwndDlg)), PSM_CHANGED, 0, 0); + SendMessage(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); + SendMessage(GetParent(hwndDlg), PSM_CHANGED, 0, 0); return TRUE; case IDC_MIRORWIN: if (HIWORD(wParam) == CBN_SELCHANGE) - SendMessage(GetParent(GetParent(hwndDlg)), PSM_CHANGED, 0, 0); + SendMessage(GetParent(hwndDlg), PSM_CHANGED, 0, 0); return TRUE; } break; case WM_NOTIFY: - { - 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: - g_plugin.setByte("onmsg", (BYTE)(IsDlgButtonChecked(hwndDlg, IDC_ONMESSAGE) == BST_CHECKED ? 1 : 0)); - g_plugin.setByte("onfile", (BYTE)(IsDlgButtonChecked(hwndDlg, IDC_ONFILE) == BST_CHECKED ? 1 : 0)); - g_plugin.setByte("onother", (BYTE)(IsDlgButtonChecked(hwndDlg, IDC_ONOTHER) == BST_CHECKED ? 1 : 0)); - - g_plugin.setByte("fscreenmode", (BYTE)(IsDlgButtonChecked(hwndDlg, IDC_FSCREEN) == BST_CHECKED ? 1 : 0)); - g_plugin.setByte("ssaverrunning", (BYTE)(IsDlgButtonChecked(hwndDlg, IDC_SSAVER) == BST_CHECKED ? 1 : 0)); - g_plugin.setByte("wstationlocked", (BYTE)(IsDlgButtonChecked(hwndDlg, IDC_LOCKED) == BST_CHECKED ? 1 : 0)); - g_plugin.setByte("procsrunning", (BYTE)(IsDlgButtonChecked(hwndDlg, IDC_PGMS) == BST_CHECKED ? 1 : 0)); - g_plugin.setByte("wstationactive", (BYTE)(IsDlgButtonChecked(hwndDlg, IDC_ACTIVE) == BST_CHECKED ? 1 : 0)); - - g_plugin.setByte("ifmsgopen", (BYTE)(IsDlgButtonChecked(hwndDlg, IDC_IFOPEN) == BST_CHECKED ? 1 : 0)); - g_plugin.setByte("ifmsgnottop", (BYTE)(IsDlgButtonChecked(hwndDlg, IDC_IFNOTTOP) == BST_CHECKED ? 1 : 0)); - g_plugin.setByte("ifmsgolder", (BYTE)(IsDlgButtonChecked(hwndDlg, IDC_IFOLDER) == BST_CHECKED ? 1 : 0)); - g_plugin.setWord("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; - g_plugin.setByte("funtil", untilMap); - g_plugin.setWord("nblinks", (WORD)SendDlgItemMessage(hwndDlg, IDC_BLINKSPIN, UDM_GETPOS, 0, 0)); - g_plugin.setByte("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_OFFLINE) == BST_CHECKED) - statusMap |= MAP_OFFLINE; - g_plugin.setWord("status", statusMap); - - g_plugin.setWord("remcheck", (WORD)SendDlgItemMessage(hwndDlg, IDC_REMCHECK, UDM_GETPOS, 0, 0)); - - int i = 0; - for (int j = 0; j < ProcessListAux.count; j++) - if (ProcessListAux.szFileName[j]) - g_plugin.setWString(fmtDBSettingName("process%d", i++), ProcessListAux.szFileName[j]); - g_plugin.setWord("processcount", (WORD)i); - while (!g_plugin.delSetting(fmtDBSettingName("process%d", i++))); - - if (XstatusListAux) - for (i = 0; i < ProtoList.protoCount; i++) - for (int j = 0; j < (int)XstatusListAux[i].count; j++) - g_plugin.setByte(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 + { + 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: + g_plugin.setByte("onmsg", (BYTE)(IsDlgButtonChecked(hwndDlg, IDC_ONMESSAGE) == BST_CHECKED ? 1 : 0)); + g_plugin.setByte("ongcmsg", (BYTE)(IsDlgButtonChecked(hwndDlg, IDC_GCMSG) == BST_CHECKED ? 1 : 0)); + g_plugin.setByte("onfile", (BYTE)(IsDlgButtonChecked(hwndDlg, IDC_ONFILE) == BST_CHECKED ? 1 : 0)); + g_plugin.setByte("onother", (BYTE)(IsDlgButtonChecked(hwndDlg, IDC_ONOTHER) == BST_CHECKED ? 1 : 0)); + + g_plugin.setByte("fscreenmode", (BYTE)(IsDlgButtonChecked(hwndDlg, IDC_FSCREEN) == BST_CHECKED ? 1 : 0)); + g_plugin.setByte("ssaverrunning", (BYTE)(IsDlgButtonChecked(hwndDlg, IDC_SSAVER) == BST_CHECKED ? 1 : 0)); + g_plugin.setByte("wstationlocked", (BYTE)(IsDlgButtonChecked(hwndDlg, IDC_LOCKED) == BST_CHECKED ? 1 : 0)); + g_plugin.setByte("procsrunning", (BYTE)(IsDlgButtonChecked(hwndDlg, IDC_PGMS) == BST_CHECKED ? 1 : 0)); + g_plugin.setByte("wstationactive", (BYTE)(IsDlgButtonChecked(hwndDlg, IDC_ACTIVE) == BST_CHECKED ? 1 : 0)); + + g_plugin.setByte("ifmsgopen", (BYTE)(IsDlgButtonChecked(hwndDlg, IDC_IFOPEN) == BST_CHECKED ? 1 : 0)); + g_plugin.setByte("ifmsgnottop", (BYTE)(IsDlgButtonChecked(hwndDlg, IDC_IFNOTTOP) == BST_CHECKED ? 1 : 0)); + g_plugin.setByte("ifmsgolder", (BYTE)(IsDlgButtonChecked(hwndDlg, IDC_IFOLDER) == BST_CHECKED ? 1 : 0)); + g_plugin.setWord("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; + g_plugin.setByte("funtil", untilMap); + g_plugin.setWord("nblinks", (WORD)SendDlgItemMessage(hwndDlg, IDC_BLINKSPIN, UDM_GETPOS, 0, 0)); + g_plugin.setByte("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_OFFLINE) == BST_CHECKED) + statusMap |= MAP_OFFLINE; + g_plugin.setWord("status", statusMap); + + g_plugin.setWord("remcheck", (WORD)SendDlgItemMessage(hwndDlg, IDC_REMCHECK, UDM_GETPOS, 0, 0)); + + int i = 0; + for (int j = 0; j < ProcessListAux.count; j++) + if (ProcessListAux.szFileName[j]) + g_plugin.setWString(fmtDBSettingName("process%d", i++), ProcessListAux.szFileName[j]); + g_plugin.setWord("processcount", (WORD)i); + while (!g_plugin.delSetting(fmtDBSettingName("process%d", i++))); + + if (XstatusListAux) + for (i = 0; i < ProtoList.protoCount; i++) + for (int j = 0; j < (int)XstatusListAux[i].count; j++) + g_plugin.setByte(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; @@ -880,7 +874,7 @@ static INT_PTR CALLBACK DlgProcEffectOptions(HWND hwndDlg, UINT msg, WPARAM wPar case WM_VSCROLL: case WM_HSCROLL: - SendMessage(GetParent(GetParent(hwndDlg)), PSM_CHANGED, 0, 0); + SendMessage(GetParent(hwndDlg), PSM_CHANGED, 0, 0); break; case WM_DESTROY: @@ -902,15 +896,15 @@ static INT_PTR CALLBACK DlgProcEffectOptions(HWND hwndDlg, UINT msg, WPARAM wPar 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); + SendMessage(GetParent(hwndDlg), PSM_CHANGED, 0, 0); return TRUE; case IDC_ASSIGNLEDS: if (DialogBoxParam(g_plugin.getInst(), MAKEINTRESOURCE(IDD_EVENTLEDS), hwndDlg, DlgProcEventLeds, 0) == IDC_OK) - SendMessage(GetParent(GetParent(hwndDlg)), PSM_CHANGED, 0, 0); + SendMessage(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); + SendMessage(GetParent(hwndDlg), PSM_CHANGED, 0, 0); return TRUE; case IDC_PREVIEW: previewFlashing(IsDlgButtonChecked(hwndDlg, IDC_PREVIEW) == BST_CHECKED); @@ -918,54 +912,54 @@ static INT_PTR CALLBACK DlgProcEffectOptions(HWND hwndDlg, UINT msg, WPARAM wPar case IDC_SEQORDER: case IDC_SCUSTOM: if (HIWORD(wParam) == CBN_SELCHANGE) - SendMessage(GetParent(GetParent(hwndDlg)), PSM_CHANGED, 0, 0); + SendMessage(GetParent(hwndDlg), PSM_CHANGED, 0, 0); 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: - g_plugin.setByte("fnum", (BYTE)(IsDlgButtonChecked(hwndDlg, IDC_NUM) == BST_CHECKED ? 1 : 0)); - g_plugin.setByte("fcaps", (BYTE)(IsDlgButtonChecked(hwndDlg, IDC_CAPS) == BST_CHECKED ? 1 : 0)); - g_plugin.setByte("fscroll", (BYTE)(IsDlgButtonChecked(hwndDlg, IDC_SCROLL) == BST_CHECKED ? 1 : 0)); - - if (IsDlgButtonChecked(hwndDlg, IDC_INTURN) == BST_CHECKED) - g_plugin.setByte("feffect", FLASH_INTURN); - else if (IsDlgButtonChecked(hwndDlg, IDC_INSEQUENCE) == BST_CHECKED) - g_plugin.setByte("feffect", FLASH_INSEQUENCE); - else if (IsDlgButtonChecked(hwndDlg, IDC_CUSTOM) == BST_CHECKED) - g_plugin.setByte("feffect", FLASH_CUSTOM); - else if (IsDlgButtonChecked(hwndDlg, IDC_TRILLIAN) == BST_CHECKED) - g_plugin.setByte("feffect", FLASH_TRILLIAN); - else - g_plugin.setByte("feffect", FLASH_SAMETIME); - g_plugin.setByte("order", (BYTE)SendDlgItemMessage(hwndDlg, IDC_SEQORDER, CB_GETITEMDATA, (WPARAM)SendDlgItemMessage(hwndDlg, IDC_SEQORDER, CB_GETCURSEL, 0, 0), 0)); - g_plugin.setWord("custom", (WORD)SendDlgItemMessage(hwndDlg, IDC_SCUSTOM, CB_GETITEMDATA, (WPARAM)SendDlgItemMessage(hwndDlg, IDC_SCUSTOM, CB_GETCURSEL, 0, 0), 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: + g_plugin.setByte("fnum", (BYTE)(IsDlgButtonChecked(hwndDlg, IDC_NUM) == BST_CHECKED ? 1 : 0)); + g_plugin.setByte("fcaps", (BYTE)(IsDlgButtonChecked(hwndDlg, IDC_CAPS) == BST_CHECKED ? 1 : 0)); + g_plugin.setByte("fscroll", (BYTE)(IsDlgButtonChecked(hwndDlg, IDC_SCROLL) == BST_CHECKED ? 1 : 0)); + + if (IsDlgButtonChecked(hwndDlg, IDC_INTURN) == BST_CHECKED) + g_plugin.setByte("feffect", FLASH_INTURN); + else if (IsDlgButtonChecked(hwndDlg, IDC_INSEQUENCE) == BST_CHECKED) + g_plugin.setByte("feffect", FLASH_INSEQUENCE); + else if (IsDlgButtonChecked(hwndDlg, IDC_CUSTOM) == BST_CHECKED) + g_plugin.setByte("feffect", FLASH_CUSTOM); + else if (IsDlgButtonChecked(hwndDlg, IDC_TRILLIAN) == BST_CHECKED) + g_plugin.setByte("feffect", FLASH_TRILLIAN); + else + g_plugin.setByte("feffect", FLASH_SAMETIME); + g_plugin.setByte("order", (BYTE)SendDlgItemMessage(hwndDlg, IDC_SEQORDER, CB_GETITEMDATA, (WPARAM)SendDlgItemMessage(hwndDlg, IDC_SEQORDER, CB_GETCURSEL, 0, 0), 0)); + g_plugin.setWord("custom", (WORD)SendDlgItemMessage(hwndDlg, IDC_SCUSTOM, CB_GETITEMDATA, (WPARAM)SendDlgItemMessage(hwndDlg, IDC_SCUSTOM, CB_GETCURSEL, 0, 0), 0)); - g_plugin.setByte("ledsmsg", trillianLedsMsg); - g_plugin.setByte("ledsfile", trillianLedsFile); - g_plugin.setByte("ledsurl", trillianLedsURL); - g_plugin.setByte("ledsother", trillianLedsOther); + g_plugin.setByte("ledsmsg", trillianLedsMsg); + g_plugin.setByte("ledsfile", trillianLedsFile); + g_plugin.setByte("ledsurl", trillianLedsURL); + g_plugin.setByte("ledsother", trillianLedsOther); - g_plugin.setWord("sdelay", (WORD)SendDlgItemMessage(hwndDlg, IDC_DELAYSPIN, UDM_GETPOS, 0, 0)); + g_plugin.setWord("sdelay", (WORD)SendDlgItemMessage(hwndDlg, IDC_DELAYSPIN, UDM_GETPOS, 0, 0)); - g_plugin.setByte("speed", (BYTE)SendDlgItemMessage(hwndDlg, IDC_SPEED, TBM_GETPOS, 0, 0)); + g_plugin.setByte("speed", (BYTE)SendDlgItemMessage(hwndDlg, IDC_SPEED, TBM_GETPOS, 0, 0)); - g_plugin.setByte("keypresses", (BYTE)(IsDlgButtonChecked(hwndDlg, IDC_KEYPRESSES) == BST_CHECKED ? 1 : 0)); + g_plugin.setByte("keypresses", (BYTE)(IsDlgButtonChecked(hwndDlg, IDC_KEYPRESSES) == BST_CHECKED ? 1 : 0)); - LoadSettings(); + LoadSettings(); - return TRUE; - } // switch code - break; - } //switch idFrom - } - break; //End WM_NOTIFY + return TRUE; + } // switch code + break; + } //switch idFrom + } + break; //End WM_NOTIFY default: break; @@ -1019,17 +1013,18 @@ static INT_PTR CALLBACK DlgProcThemeOptions(HWND hwndDlg, UINT msg, WPARAM wPara case IDC_THEME: switch (HIWORD(wParam)) { case CBN_SELENDOK: - case CBN_SELCHANGE: { - wchar_t *str = (wchar_t *)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, L""); - EnableWindow(GetDlgItem(hwndDlg, IDC_ADD), FALSE); - EnableWindow(GetDlgItem(hwndDlg, IDC_UPDATE), FALSE); - EnableWindow(GetDlgItem(hwndDlg, IDC_DELETE), TRUE); - } - break; + case CBN_SELCHANGE: + { + wchar_t *str = (wchar_t *)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, L""); + EnableWindow(GetDlgItem(hwndDlg, IDC_ADD), FALSE); + EnableWindow(GetDlgItem(hwndDlg, IDC_UPDATE), FALSE); + EnableWindow(GetDlgItem(hwndDlg, IDC_DELETE), TRUE); + } + break; case CBN_EDITCHANGE: wchar_t theme[MAX_PATH + 1]; GetDlgItemText(hwndDlg, IDC_THEME, theme, _countof(theme)); @@ -1072,192 +1067,191 @@ static INT_PTR CALLBACK DlgProcThemeOptions(HWND hwndDlg, UINT msg, WPARAM wPara } return TRUE; case IDC_TEST: - { - wchar_t custom[MAX_PATH + 1]; + { + wchar_t custom[MAX_PATH + 1]; - GetDlgItemText(hwndDlg, IDC_CUSTOMSTRING, custom, _countof(custom)); - SetDlgItemText(hwndDlg, IDC_CUSTOMSTRING, normalizeCustomString(custom)); - testSequence(custom); - } - return TRUE; + GetDlgItemText(hwndDlg, IDC_CUSTOMSTRING, custom, _countof(custom)); + SetDlgItemText(hwndDlg, IDC_CUSTOMSTRING, normalizeCustomString(custom)); + testSequence(custom); + } + return TRUE; case IDC_ADD: - { - wchar_t theme[MAX_PATH + 1]; - - GetDlgItemText(hwndDlg, IDC_THEME, theme, _countof(theme)); - if (!theme[0]) - return TRUE; - int item = SendDlgItemMessage(hwndDlg, IDC_THEME, CB_ADDSTRING, 0, (LPARAM)theme); - wchar_t *str = (wchar_t *)mir_alloc((MAX_PATH + 1) * sizeof(wchar_t)); - if (str) { - GetDlgItemText(hwndDlg, IDC_CUSTOMSTRING, str, MAX_PATH); - SetDlgItemText(hwndDlg, IDC_CUSTOMSTRING, normalizeCustomString(str)); + { + wchar_t theme[MAX_PATH + 1]; + + GetDlgItemText(hwndDlg, IDC_THEME, theme, _countof(theme)); + if (!theme[0]) + return TRUE; + int item = SendDlgItemMessage(hwndDlg, IDC_THEME, CB_ADDSTRING, 0, (LPARAM)theme); + wchar_t *str = (wchar_t *)mir_alloc((MAX_PATH + 1) * sizeof(wchar_t)); + 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); } - 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; + SendMessage(GetParent(hwndDlg), PSM_CHANGED, 0, 0); + return TRUE; case IDC_UPDATE: - { - wchar_t theme[MAX_PATH + 1]; + { + wchar_t theme[MAX_PATH + 1]; - GetDlgItemText(hwndDlg, IDC_THEME, theme, _countof(theme)); - int item = SendDlgItemMessage(hwndDlg, IDC_THEME, CB_FINDSTRINGEXACT, -1, (LPARAM)theme); - wchar_t *str = (wchar_t *)SendDlgItemMessage(hwndDlg, IDC_THEME, CB_GETITEMDATA, (WPARAM)item, 0); - if (str) { - GetDlgItemText(hwndDlg, IDC_CUSTOMSTRING, str, MAX_PATH); - SetDlgItemText(hwndDlg, IDC_CUSTOMSTRING, normalizeCustomString(str)); + GetDlgItemText(hwndDlg, IDC_THEME, theme, _countof(theme)); + int item = SendDlgItemMessage(hwndDlg, IDC_THEME, CB_FINDSTRINGEXACT, -1, (LPARAM)theme); + wchar_t *str = (wchar_t *)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); } - EnableWindow(GetDlgItem(hwndDlg, IDC_UPDATE), FALSE); - } - SendMessage(GetParent(GetParent(hwndDlg)), PSM_CHANGED, 0, 0); - return TRUE; + SendMessage(GetParent(hwndDlg), PSM_CHANGED, 0, 0); + return TRUE; case IDC_DELETE: - { - wchar_t theme[MAX_PATH + 1]; + { + wchar_t theme[MAX_PATH + 1]; - GetDlgItemText(hwndDlg, IDC_THEME, theme, _countof(theme)); - int item = SendDlgItemMessage(hwndDlg, IDC_THEME, CB_FINDSTRINGEXACT, -1, (LPARAM)theme); - wchar_t *str = (wchar_t *)SendDlgItemMessage(hwndDlg, IDC_THEME, CB_GETITEMDATA, (WPARAM)item, 0); - if (str) - mir_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, L""); - SetDlgItemText(hwndDlg, IDC_CUSTOMSTRING, L""); - EnableWindow(GetDlgItem(hwndDlg, IDC_DELETE), FALSE); - } - else { - SendDlgItemMessage(hwndDlg, IDC_THEME, CB_SETCURSEL, 0, 0); - str = (wchar_t *)SendDlgItemMessage(hwndDlg, IDC_THEME, CB_GETITEMDATA, 0, 0); + GetDlgItemText(hwndDlg, IDC_THEME, theme, _countof(theme)); + int item = SendDlgItemMessage(hwndDlg, IDC_THEME, CB_FINDSTRINGEXACT, -1, (LPARAM)theme); + wchar_t *str = (wchar_t *)SendDlgItemMessage(hwndDlg, IDC_THEME, CB_GETITEMDATA, (WPARAM)item, 0); if (str) - SetDlgItemText(hwndDlg, IDC_CUSTOMSTRING, str); + mir_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, L""); + SetDlgItemText(hwndDlg, IDC_CUSTOMSTRING, L""); + EnableWindow(GetDlgItem(hwndDlg, IDC_DELETE), FALSE); + } + else { + SendDlgItemMessage(hwndDlg, IDC_THEME, CB_SETCURSEL, 0, 0); + str = (wchar_t *)SendDlgItemMessage(hwndDlg, IDC_THEME, CB_GETITEMDATA, 0, 0); + if (str) + SetDlgItemText(hwndDlg, IDC_CUSTOMSTRING, str); + } + EnableWindow(GetDlgItem(hwndDlg, IDC_UPDATE), FALSE); } - EnableWindow(GetDlgItem(hwndDlg, IDC_UPDATE), FALSE); - } - SendMessage(GetParent(GetParent(hwndDlg)), PSM_CHANGED, 0, 0); - return TRUE; + SendMessage(GetParent(hwndDlg), PSM_CHANGED, 0, 0); + return TRUE; case IDC_EXPORT: - { - wchar_t path[MAX_PATH + 1], filter[MAX_PATH + 1], *pfilter; - OPENFILENAME ofn = { 0 }; - - path[0] = '\0'; - ofn.lStructSize = sizeof(OPENFILENAME); - ofn.hwndOwner = hwndDlg; - ofn.hInstance = nullptr; - mir_wstrcpy(filter, TranslateT("Keyboard Notify Theme")); - mir_wstrcat(filter, L" (*.knt)"); - pfilter = filter + mir_wstrlen(filter) + 1; - mir_wstrcpy(pfilter, L"*.knt"); - pfilter = pfilter + mir_wstrlen(pfilter) + 1; - mir_wstrcpy(pfilter, TranslateT("All Files")); - pfilter = pfilter + mir_wstrlen(pfilter) + 1; - mir_wstrcpy(pfilter, L"*.*"); - pfilter = pfilter + mir_wstrlen(pfilter) + 1; - *pfilter = '\0'; - ofn.lpstrFilter = filter; - ofn.lpstrFile = path; - ofn.Flags = OFN_HIDEREADONLY | OFN_NOCHANGEDIR | OFN_NOREADONLYRETURN | OFN_PATHMUSTEXIST; - ofn.nMaxFile = _countof(path); - ofn.lpstrDefExt = L"knt"; - if (GetSaveFileName(&ofn)) - exportThemes(path); - } - return TRUE; + { + wchar_t path[MAX_PATH + 1], filter[MAX_PATH + 1], *pfilter; + OPENFILENAME ofn = { 0 }; + + path[0] = '\0'; + ofn.lStructSize = sizeof(OPENFILENAME); + ofn.hwndOwner = hwndDlg; + ofn.hInstance = nullptr; + mir_wstrcpy(filter, TranslateT("Keyboard Notify Theme")); + mir_wstrcat(filter, L" (*.knt)"); + pfilter = filter + mir_wstrlen(filter) + 1; + mir_wstrcpy(pfilter, L"*.knt"); + pfilter = pfilter + mir_wstrlen(pfilter) + 1; + mir_wstrcpy(pfilter, TranslateT("All Files")); + pfilter = pfilter + mir_wstrlen(pfilter) + 1; + mir_wstrcpy(pfilter, L"*.*"); + pfilter = pfilter + mir_wstrlen(pfilter) + 1; + *pfilter = '\0'; + ofn.lpstrFilter = filter; + ofn.lpstrFile = path; + ofn.Flags = OFN_HIDEREADONLY | OFN_NOCHANGEDIR | OFN_NOREADONLYRETURN | OFN_PATHMUSTEXIST; + ofn.nMaxFile = _countof(path); + ofn.lpstrDefExt = L"knt"; + if (GetSaveFileName(&ofn)) + exportThemes(path); + } + return TRUE; case IDC_IMPORT: - { - wchar_t path[MAX_PATH + 1], filter[MAX_PATH + 1], *pfilter; - OPENFILENAME ofn = { 0 }; - - path[0] = '\0'; - ofn.lStructSize = sizeof(OPENFILENAME); - ofn.hwndOwner = hwndDlg; - ofn.hInstance = nullptr; - mir_wstrcpy(filter, TranslateT("Keyboard Notify Theme")); - mir_wstrcat(filter, L" (*.knt)"); - pfilter = filter + mir_wstrlen(filter) + 1; - mir_wstrcpy(pfilter, L"*.knt"); - pfilter = pfilter + mir_wstrlen(pfilter) + 1; - mir_wstrcpy(pfilter, TranslateT("All Files")); - pfilter = pfilter + mir_wstrlen(pfilter) + 1; - mir_wstrcpy(pfilter, L"*.*"); - pfilter = pfilter + mir_wstrlen(pfilter) + 1; - *pfilter = '\0'; - ofn.lpstrFilter = filter; - ofn.lpstrFile = path; - ofn.Flags = OFN_FILEMUSTEXIST | OFN_HIDEREADONLY | OFN_NOCHANGEDIR; - ofn.nMaxFile = _countof(path); - ofn.lpstrDefExt = L"knt"; - if (GetOpenFileName(&ofn)) { - importThemes(path, IsDlgButtonChecked(hwndDlg, IDC_OVERRIDE) == BST_CHECKED); - SendMessage(GetParent(GetParent(hwndDlg)), PSM_CHANGED, 0, 0); + { + wchar_t path[MAX_PATH + 1], filter[MAX_PATH + 1], *pfilter; + OPENFILENAME ofn = { 0 }; + + path[0] = '\0'; + ofn.lStructSize = sizeof(OPENFILENAME); + ofn.hwndOwner = hwndDlg; + ofn.hInstance = nullptr; + mir_wstrcpy(filter, TranslateT("Keyboard Notify Theme")); + mir_wstrcat(filter, L" (*.knt)"); + pfilter = filter + mir_wstrlen(filter) + 1; + mir_wstrcpy(pfilter, L"*.knt"); + pfilter = pfilter + mir_wstrlen(pfilter) + 1; + mir_wstrcpy(pfilter, TranslateT("All Files")); + pfilter = pfilter + mir_wstrlen(pfilter) + 1; + mir_wstrcpy(pfilter, L"*.*"); + pfilter = pfilter + mir_wstrlen(pfilter) + 1; + *pfilter = '\0'; + ofn.lpstrFilter = filter; + ofn.lpstrFile = path; + ofn.Flags = OFN_FILEMUSTEXIST | OFN_HIDEREADONLY | OFN_NOCHANGEDIR; + ofn.nMaxFile = _countof(path); + ofn.lpstrDefExt = L"knt"; + if (GetOpenFileName(&ofn)) { + importThemes(path, IsDlgButtonChecked(hwndDlg, IDC_OVERRIDE) == BST_CHECKED); + SendMessage(GetParent(hwndDlg), PSM_CHANGED, 0, 0); + } } - } - return TRUE; + return TRUE; case IDC_OVERRIDE: - SendMessage(GetParent(GetParent(hwndDlg)), PSM_CHANGED, 0, 0); + SendMessage(GetParent(hwndDlg), PSM_CHANGED, 0, 0); return TRUE; } break; case WM_NOTIFY: - { - int count; - wchar_t theme[MAX_PATH + 1], themeAux[MAX_PATH + 1]; - // 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 (szTheme = g_plugin.getWStringA(fmtDBSettingName("theme%d", wCustomTheme))) { - mir_wstrcpy(theme, szTheme); - mir_free(szTheme); - } - 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 (int i = 0; SendDlgItemMessage(hwndEffect, IDC_SCUSTOM, CB_DELETESTRING, 0, (LPARAM)i) != CB_ERR; i++); - - count = SendDlgItemMessage(hwndDlg, IDC_THEME, CB_GETCOUNT, 0, 0); - for (int i = 0; i < count; i++) { - SendDlgItemMessage(hwndDlg, IDC_THEME, CB_GETLBTEXT, (WPARAM)i, (LPARAM)themeAux); - g_plugin.setWString(fmtDBSettingName("theme%d", i), themeAux); - wchar_t *str = (wchar_t *)SendDlgItemMessage(hwndDlg, IDC_THEME, CB_GETITEMDATA, (WPARAM)i, 0); - if (str) - g_plugin.setWString(fmtDBSettingName("custom%d", i), str); + { + int count; + wchar_t theme[MAX_PATH + 1], themeAux[MAX_PATH + 1]; + // 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 (szTheme = g_plugin.getWStringA(fmtDBSettingName("theme%d", wCustomTheme))) { + mir_wstrcpy(theme, szTheme); + mir_free(szTheme); + } else - g_plugin.setWString(fmtDBSettingName("custom%d", i), L""); - - if (!mir_wstrcmp(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 (int i = count; !g_plugin.delSetting(fmtDBSettingName("theme%d", i)); i++) - g_plugin.delSetting(fmtDBSettingName("custom%d", i)); + 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 (int i = 0; SendDlgItemMessage(hwndEffect, IDC_SCUSTOM, CB_DELETESTRING, 0, (LPARAM)i) != CB_ERR; i++); + + count = SendDlgItemMessage(hwndDlg, IDC_THEME, CB_GETCOUNT, 0, 0); + for (int i = 0; i < count; i++) { + SendDlgItemMessage(hwndDlg, IDC_THEME, CB_GETLBTEXT, (WPARAM)i, (LPARAM)themeAux); + g_plugin.setWString(fmtDBSettingName("theme%d", i), themeAux); + wchar_t *str = (wchar_t *)SendDlgItemMessage(hwndDlg, IDC_THEME, CB_GETITEMDATA, (WPARAM)i, 0); + if (str) + g_plugin.setWString(fmtDBSettingName("custom%d", i), str); + else + g_plugin.setWString(fmtDBSettingName("custom%d", i), L""); + + if (!mir_wstrcmp(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 (int i = count; !g_plugin.delSetting(fmtDBSettingName("theme%d", i)); i++) + g_plugin.delSetting(fmtDBSettingName("custom%d", i)); - g_plugin.setWord("custom", wCustomTheme); - // Still updating here the the Flashing tab's controls - SendDlgItemMessage(hwndEffect, IDC_SCUSTOM, CB_SETCURSEL, (WPARAM)wCustomTheme, 0); + g_plugin.setWord("custom", wCustomTheme); + // Still updating here the the Flashing tab's controls + SendDlgItemMessage(hwndEffect, IDC_SCUSTOM, CB_SETCURSEL, (WPARAM)wCustomTheme, 0); - g_plugin.setByte("override", (BYTE)(IsDlgButtonChecked(hwndDlg, IDC_OVERRIDE) == BST_CHECKED ? 1 : 0)); + g_plugin.setByte("override", (BYTE)(IsDlgButtonChecked(hwndDlg, IDC_OVERRIDE) == BST_CHECKED ? 1 : 0)); - return TRUE; - } // switch code - break; - } //switch idFrom - } - break; //End WM_NOTIFY + return TRUE; + } // switch code + break; + } //switch idFrom + } + break; //End WM_NOTIFY case WM_DESTROY: - { int count = SendDlgItemMessage(hwndDlg, IDC_THEME, CB_GETCOUNT, 0, 0); for (int item = 0; item < count; item++) { @@ -1268,102 +1262,6 @@ static INT_PTR CALLBACK DlgProcThemeOptions(HWND hwndDlg, UINT msg, WPARAM wPara break; } - default: - break; - } - - return FALSE; -} - -static INT_PTR CALLBACK DlgProcOptions(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lParam) -{ - switch (msg) { - case WM_INITDIALOG: - { - TCITEM tci; - HWND tc = GetDlgItem(hwndDlg, IDC_TABS); - tci.mask = TCIF_TEXT; - tci.pszText = TranslateT("Accounts"); - 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(g_plugin.getInst(), MAKEINTRESOURCE(IDD_PROTO_OPTIONS), hwndDlg, DlgProcProtoOptions, (LPARAM)NULL); - EnableThemeDialogTexture(hwndProto, ETDT_ENABLETAB); - SetWindowPos(hwndProto, HWND_TOP, 0, 0, 0, 0, SWP_NOMOVE | SWP_NOSIZE); - ShowWindow(hwndProto, SW_SHOW); - hwndBasic = CreateDialogParam(g_plugin.getInst(), MAKEINTRESOURCE(IDD_BASIC_OPTIONS), hwndDlg, DlgProcBasicOptions, (LPARAM)NULL); - EnableThemeDialogTexture(hwndBasic, ETDT_ENABLETAB); - SetWindowPos(hwndBasic, HWND_TOP, 0, 0, 0, 0, SWP_NOMOVE | SWP_NOSIZE); - hwndEffect = CreateDialogParam(g_plugin.getInst(), MAKEINTRESOURCE(IDD_EFFECT_OPTIONS), hwndDlg, DlgProcEffectOptions, (LPARAM)NULL); - EnableThemeDialogTexture(hwndEffect, ETDT_ENABLETAB); - SetWindowPos(hwndEffect, HWND_TOP, 0, 0, 0, 0, SWP_NOMOVE | SWP_NOSIZE); - hwndTheme = CreateDialogParam(g_plugin.getInst(), MAKEINTRESOURCE(IDD_THEME_OPTIONS), hwndDlg, DlgProcThemeOptions, (LPARAM)NULL); - EnableThemeDialogTexture(hwndTheme, ETDT_ENABLETAB); - SetWindowPos(hwndTheme, HWND_TOP, 0, 0, 0, 0, SWP_NOMOVE | SWP_NOSIZE); - hwndIgnore = CreateDialogParam(g_plugin.getInst(), MAKEINTRESOURCE(IDD_IGNORE_OPTIONS), hwndDlg, DlgProcIgnoreOptions, (LPARAM)NULL); - EnableThemeDialogTexture(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; } @@ -1373,11 +1271,33 @@ static INT_PTR CALLBACK DlgProcOptions(HWND hwndDlg, UINT msg, WPARAM wParam, LP int InitializeOptions(WPARAM wParam, LPARAM) { OPTIONSDIALOGPAGE odp = {}; - odp.pszTemplate = MAKEINTRESOURCEA(IDD_OPTIONS); odp.szTitle.a = LPGEN("Keyboard Flash"); odp.szGroup.a = LPGEN("Events"); odp.flags = ODPF_BOLDGROUPS; - odp.pfnDlgProc = DlgProcOptions; + + odp.szTab.a = LPGEN("Accounts"); + odp.pszTemplate = MAKEINTRESOURCEA(IDD_PROTO_OPTIONS); + odp.pfnDlgProc = DlgProcProtoOptions; + g_plugin.addOptions(wParam, &odp); + + odp.szTab.a = LPGEN("Rules"); + odp.pszTemplate = MAKEINTRESOURCEA(IDD_BASIC_OPTIONS); + odp.pfnDlgProc = DlgProcBasicOptions; + g_plugin.addOptions(wParam, &odp); + + odp.szTab.a = LPGEN("Flashing"); + odp.pszTemplate = MAKEINTRESOURCEA(IDD_EFFECT_OPTIONS); + odp.pfnDlgProc = DlgProcEffectOptions; + g_plugin.addOptions(wParam, &odp); + + odp.szTab.a = LPGEN("Themes"); + odp.pszTemplate = MAKEINTRESOURCEA(IDD_THEME_OPTIONS); + odp.pfnDlgProc = DlgProcThemeOptions; + g_plugin.addOptions(wParam, &odp); + + odp.szTab.a = LPGEN("Ignore"); + odp.pszTemplate = MAKEINTRESOURCEA(IDD_IGNORE_OPTIONS); + odp.pfnDlgProc = DlgProcIgnoreOptions; g_plugin.addOptions(wParam, &odp); return 0; } diff --git a/plugins/KeyboardNotify/src/resource.h b/plugins/KeyboardNotify/src/resource.h index d645b050e2..8b0d950616 100644 --- a/plugins/KeyboardNotify/src/resource.h +++ b/plugins/KeyboardNotify/src/resource.h @@ -1,10 +1,9 @@ //{{NO_DEPENDENCIES}}
// Microsoft Visual C++ generated include file.
-// Used by ..\res\resources.rc
+// Used by W:\miranda-ng\plugins\KeyboardNotify\res\resources.rc
//
#define IDC_OTHERICON 1
#define IDD_OPT_KN_ACTION 120
-#define IDD_OPTIONS 150
#define IDD_PROTO_OPTIONS 151
#define IDD_BASIC_OPTIONS 152
#define IDD_EFFECT_OPTIONS 153
@@ -15,6 +14,8 @@ #define IDD_XSTATUSES 158
#define IDC_ONMESSAGE 1000
#define IDC_ONFILE 1001
+#define IDC_ONFILE2 1002
+#define IDC_GCMSG 1002
#define IDC_ONOTHER 1003
#define IDC_IFOPEN 1004
#define IDC_IFNOTTOP 1005
@@ -108,7 +109,7 @@ //
#ifdef APSTUDIO_INVOKED
#ifndef APSTUDIO_READONLY_SYMBOLS
-#define _APS_NEXT_RESOURCE_VALUE 103
+#define _APS_NEXT_RESOURCE_VALUE 104
#define _APS_NEXT_COMMAND_VALUE 40001
#define _APS_NEXT_CONTROL_VALUE 1088
#define _APS_NEXT_SYMED_VALUE 101
diff --git a/plugins/KeyboardNotify/src/stdafx.h b/plugins/KeyboardNotify/src/stdafx.h index f68d0edfae..fa9a0960fe 100644 --- a/plugins/KeyboardNotify/src/stdafx.h +++ b/plugins/KeyboardNotify/src/stdafx.h @@ -29,22 +29,22 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. #include <Uxtheme.h>
#include <newpluginapi.h>
+#include <m_chat_int.h>
+#include <m_clc.h>
+#include <m_clistint.h>
#include <m_contacts.h>
#include <m_database.h>
-#include <m_options.h>
+#include <m_extraicons.h>
#include <m_icolib.h>
-#include <m_clistint.h>
+#include <m_kbdnotify.h>
#include <m_langpack.h>
-#include <m_protosvc.h>
#include <m_message.h>
-#include <m_xstatus.h>
-#include <m_clc.h>
+#include <m_metacontacts.h>
+#include <m_options.h>
+#include <m_protosvc.h>
#include <m_skin.h>
+#include <m_xstatus.h>
#include <win2k.h>
-#include <m_extraicons.h>
-
-#include <m_kbdnotify.h>
-#include <m_metacontacts.h>
#include "flash.h"
#include "ignore.h"
diff --git a/plugins/KeyboardNotify/src/version.h b/plugins/KeyboardNotify/src/version.h index b71d9703b6..ea6937a7de 100644 --- a/plugins/KeyboardNotify/src/version.h +++ b/plugins/KeyboardNotify/src/version.h @@ -1,13 +1,13 @@ -#define __MAJOR_VERSION 1 -#define __MINOR_VERSION 5 -#define __RELEASE_NUM 7 -#define __BUILD_NUM 7 +#define __MAJOR_VERSION 1 +#define __MINOR_VERSION 6 +#define __RELEASE_NUM 0 +#define __BUILD_NUM 1 #include <stdver.h> #define __PLUGIN_NAME "Keyboard notify ext." #define __FILENAME "KeyboardNotify.dll" -#define __DESCRIPTION "Flashes your keyboard LEDs when a message has arrived." -#define __AUTHOR "TioDuke" -#define __AUTHORWEB "https://miranda-ng.org/p/KeyboardNotify/" -#define __COPYRIGHT "© 2002-2003 Martin Öberg, 2004 Std, 2005-2008 TioDuke" +#define __DESCRIPTION "Flashes your keyboard LEDs when a message has arrived." +#define __AUTHOR "TioDuke" +#define __AUTHORWEB "https://miranda-ng.org/p/KeyboardNotify/" +#define __COPYRIGHT "© 2002-2003 Martin Öberg, 2004 Std, 2005-2008 TioDuke" |