diff options
Diffstat (limited to 'plugins')
-rw-r--r-- | plugins/KeyboardNotify/src/options.cpp | 656 | ||||
-rw-r--r-- | plugins/ListeningTo/src/options.cpp | 32 | ||||
-rw-r--r-- | plugins/ListeningTo/src/players/player.cpp | 4 | ||||
-rw-r--r-- | plugins/ListeningTo/src/players/wmp.cpp | 4 | ||||
-rw-r--r-- | plugins/ListeningTo/src/stdafx.h | 2 | ||||
-rw-r--r-- | plugins/MagneticWindows/src/MagneticWindows.cpp | 43 | ||||
-rw-r--r-- | plugins/MagneticWindows/src/Options.cpp | 20 | ||||
-rw-r--r-- | plugins/MagneticWindows/src/stdafx.h | 18 | ||||
-rw-r--r-- | plugins/MenuItemEx/src/main.cpp | 44 | ||||
-rw-r--r-- | plugins/MenuItemEx/src/options.cpp | 5 | ||||
-rw-r--r-- | plugins/MenuItemEx/src/stdafx.h | 9 |
11 files changed, 414 insertions, 423 deletions
diff --git a/plugins/KeyboardNotify/src/options.cpp b/plugins/KeyboardNotify/src/options.cpp index 82518f2420..1d48df4dd0 100644 --- a/plugins/KeyboardNotify/src/options.cpp +++ b/plugins/KeyboardNotify/src/options.cpp @@ -23,8 +23,8 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. void LoadSettings(void); extern BYTE bFlashOnMsg, bFlashOnURL, bFlashOnFile, bFlashOnOther, bFullScreenMode, bScreenSaverRunning, bWorkstationLocked, bProcessesAreRunning, - bWorkstationActive, bFlashIfMsgOpen, bFlashIfMsgOlder, bFlashUntil, bMirandaOrWindows, bFlashLed[3], bFlashEffect, bSequenceOrder, bFlashSpeed, - bEmulateKeypresses, bOverride, bFlashIfMsgWinNotTop, bTrillianLedsMsg, bTrillianLedsURL, bTrillianLedsFile, bTrillianLedsOther; +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; @@ -32,8 +32,8 @@ extern PROCESS_LIST ProcessList; HWND hwndProto, hwndBasic, hwndEffect, hwndTheme, hwndIgnore, hwndCurrentTab; -wchar_t *AttendedName[]={L"Miranda", L"Windows"}; -wchar_t *OrderName[]={LPGENW("left -> right"), LPGENW("right -> left"), LPGENW("left <-> right")}; +wchar_t *AttendedName[] = { L"Miranda", L"Windows" }; +wchar_t *OrderName[] = { LPGENW("left -> right"), LPGENW("right -> left"), LPGENW("left <-> right") }; PROCESS_LIST ProcessListAux; XSTATUS_INFO *XstatusListAux; @@ -534,47 +534,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); - db_set_b(NULL, KEYBDMODULE, (char *)lvItem.lParam, (BYTE)ListView_GetCheckState(hList, lvItem.iItem)); - } - } + { + //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); + db_set_b(NULL, KEYBDMODULE, (char *)lvItem.lParam, (BYTE)ListView_GetCheckState(hList, lvItem.iItem)); + } + } - LoadSettings(); + 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 + 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; @@ -742,86 +742,86 @@ static INT_PTR CALLBACK DlgProcBasicOptions(HWND hwndDlg, UINT msg, WPARAM wPara 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: - db_set_b(NULL, KEYBDMODULE, "onmsg", (BYTE)(IsDlgButtonChecked(hwndDlg, IDC_ONMESSAGE) == BST_CHECKED ? 1 : 0)); - db_set_b(NULL, KEYBDMODULE, "onurl", (BYTE)(IsDlgButtonChecked(hwndDlg, IDC_ONURL) == BST_CHECKED ? 1 : 0)); - db_set_b(NULL, KEYBDMODULE, "onfile", (BYTE)(IsDlgButtonChecked(hwndDlg, IDC_ONFILE) == BST_CHECKED ? 1 : 0)); - db_set_b(NULL, KEYBDMODULE, "onother", (BYTE)(IsDlgButtonChecked(hwndDlg, IDC_ONOTHER) == BST_CHECKED ? 1 : 0)); - - db_set_b(NULL, KEYBDMODULE, "fscreenmode", (BYTE)(IsDlgButtonChecked(hwndDlg, IDC_FSCREEN) == BST_CHECKED ? 1 : 0)); - db_set_b(NULL, KEYBDMODULE, "ssaverrunning", (BYTE)(IsDlgButtonChecked(hwndDlg, IDC_SSAVER) == BST_CHECKED ? 1 : 0)); - db_set_b(NULL, KEYBDMODULE, "wstationlocked", (BYTE)(IsDlgButtonChecked(hwndDlg, IDC_LOCKED) == BST_CHECKED ? 1 : 0)); - db_set_b(NULL, KEYBDMODULE, "procsrunning", (BYTE)(IsDlgButtonChecked(hwndDlg, IDC_PGMS) == BST_CHECKED ? 1 : 0)); - db_set_b(NULL, KEYBDMODULE, "wstationactive", (BYTE)(IsDlgButtonChecked(hwndDlg, IDC_ACTIVE) == BST_CHECKED ? 1 : 0)); - - db_set_b(NULL, KEYBDMODULE, "ifmsgopen", (BYTE)(IsDlgButtonChecked(hwndDlg, IDC_IFOPEN) == BST_CHECKED ? 1 : 0)); - db_set_b(NULL, KEYBDMODULE, "ifmsgnottop", (BYTE)(IsDlgButtonChecked(hwndDlg, IDC_IFNOTTOP) == BST_CHECKED ? 1 : 0)); - db_set_b(NULL, KEYBDMODULE, "ifmsgolder", (BYTE)(IsDlgButtonChecked(hwndDlg, IDC_IFOLDER) == BST_CHECKED ? 1 : 0)); - db_set_w(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; - db_set_b(NULL, KEYBDMODULE, "funtil", untilMap); - db_set_w(NULL, KEYBDMODULE, "nblinks", (WORD)SendDlgItemMessage(hwndDlg, IDC_BLINKSPIN, UDM_GETPOS, 0, 0)); - db_set_b(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; - db_set_w(NULL, KEYBDMODULE, "status", statusMap); - - db_set_w(NULL, KEYBDMODULE, "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]) - db_set_ws(NULL, KEYBDMODULE, fmtDBSettingName("process%d", i++), ProcessListAux.szFileName[j]); - db_set_w(NULL, KEYBDMODULE, "processcount", (WORD)i); - while (!db_unset(NULL, KEYBDMODULE, fmtDBSettingName("process%d", i++))); - - if (XstatusListAux) - for (i = 0; i < ProtoList.protoCount; i++) - for (int j = 0; j < (int)XstatusListAux[i].count; j++) - db_set_b(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 + { + 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: + db_set_b(NULL, KEYBDMODULE, "onmsg", (BYTE)(IsDlgButtonChecked(hwndDlg, IDC_ONMESSAGE) == BST_CHECKED ? 1 : 0)); + db_set_b(NULL, KEYBDMODULE, "onurl", (BYTE)(IsDlgButtonChecked(hwndDlg, IDC_ONURL) == BST_CHECKED ? 1 : 0)); + db_set_b(NULL, KEYBDMODULE, "onfile", (BYTE)(IsDlgButtonChecked(hwndDlg, IDC_ONFILE) == BST_CHECKED ? 1 : 0)); + db_set_b(NULL, KEYBDMODULE, "onother", (BYTE)(IsDlgButtonChecked(hwndDlg, IDC_ONOTHER) == BST_CHECKED ? 1 : 0)); + + db_set_b(NULL, KEYBDMODULE, "fscreenmode", (BYTE)(IsDlgButtonChecked(hwndDlg, IDC_FSCREEN) == BST_CHECKED ? 1 : 0)); + db_set_b(NULL, KEYBDMODULE, "ssaverrunning", (BYTE)(IsDlgButtonChecked(hwndDlg, IDC_SSAVER) == BST_CHECKED ? 1 : 0)); + db_set_b(NULL, KEYBDMODULE, "wstationlocked", (BYTE)(IsDlgButtonChecked(hwndDlg, IDC_LOCKED) == BST_CHECKED ? 1 : 0)); + db_set_b(NULL, KEYBDMODULE, "procsrunning", (BYTE)(IsDlgButtonChecked(hwndDlg, IDC_PGMS) == BST_CHECKED ? 1 : 0)); + db_set_b(NULL, KEYBDMODULE, "wstationactive", (BYTE)(IsDlgButtonChecked(hwndDlg, IDC_ACTIVE) == BST_CHECKED ? 1 : 0)); + + db_set_b(NULL, KEYBDMODULE, "ifmsgopen", (BYTE)(IsDlgButtonChecked(hwndDlg, IDC_IFOPEN) == BST_CHECKED ? 1 : 0)); + db_set_b(NULL, KEYBDMODULE, "ifmsgnottop", (BYTE)(IsDlgButtonChecked(hwndDlg, IDC_IFNOTTOP) == BST_CHECKED ? 1 : 0)); + db_set_b(NULL, KEYBDMODULE, "ifmsgolder", (BYTE)(IsDlgButtonChecked(hwndDlg, IDC_IFOLDER) == BST_CHECKED ? 1 : 0)); + db_set_w(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; + db_set_b(NULL, KEYBDMODULE, "funtil", untilMap); + db_set_w(NULL, KEYBDMODULE, "nblinks", (WORD)SendDlgItemMessage(hwndDlg, IDC_BLINKSPIN, UDM_GETPOS, 0, 0)); + db_set_b(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; + db_set_w(NULL, KEYBDMODULE, "status", statusMap); + + db_set_w(NULL, KEYBDMODULE, "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]) + db_set_ws(NULL, KEYBDMODULE, fmtDBSettingName("process%d", i++), ProcessListAux.szFileName[j]); + db_set_w(NULL, KEYBDMODULE, "processcount", (WORD)i); + while (!db_unset(NULL, KEYBDMODULE, fmtDBSettingName("process%d", i++))); + + if (XstatusListAux) + for (i = 0; i < ProtoList.protoCount; i++) + for (int j = 0; j < (int)XstatusListAux[i].count; j++) + db_set_b(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; @@ -935,48 +935,48 @@ static INT_PTR CALLBACK DlgProcEffectOptions(HWND hwndDlg, UINT msg, WPARAM wPar 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: - db_set_b(NULL, KEYBDMODULE, "fnum", (BYTE)(IsDlgButtonChecked(hwndDlg, IDC_NUM) == BST_CHECKED ? 1 : 0)); - db_set_b(NULL, KEYBDMODULE, "fcaps", (BYTE)(IsDlgButtonChecked(hwndDlg, IDC_CAPS) == BST_CHECKED ? 1 : 0)); - db_set_b(NULL, KEYBDMODULE, "fscroll", (BYTE)(IsDlgButtonChecked(hwndDlg, IDC_SCROLL) == BST_CHECKED ? 1 : 0)); - - if (IsDlgButtonChecked(hwndDlg, IDC_INTURN) == BST_CHECKED) - db_set_b(NULL, KEYBDMODULE, "feffect", FLASH_INTURN); - else if (IsDlgButtonChecked(hwndDlg, IDC_INSEQUENCE) == BST_CHECKED) - db_set_b(NULL, KEYBDMODULE, "feffect", FLASH_INSEQUENCE); - else if (IsDlgButtonChecked(hwndDlg, IDC_CUSTOM) == BST_CHECKED) - db_set_b(NULL, KEYBDMODULE, "feffect", FLASH_CUSTOM); - else if (IsDlgButtonChecked(hwndDlg, IDC_TRILLIAN) == BST_CHECKED) - db_set_b(NULL, KEYBDMODULE, "feffect", FLASH_TRILLIAN); - else - db_set_b(NULL, KEYBDMODULE, "feffect", FLASH_SAMETIME); - db_set_b(NULL, KEYBDMODULE, "order", (BYTE)SendDlgItemMessage(hwndDlg, IDC_SEQORDER, CB_GETITEMDATA, (WPARAM)SendDlgItemMessage(hwndDlg, IDC_SEQORDER, CB_GETCURSEL, 0, 0), 0)); - db_set_w(NULL, KEYBDMODULE, "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: + db_set_b(NULL, KEYBDMODULE, "fnum", (BYTE)(IsDlgButtonChecked(hwndDlg, IDC_NUM) == BST_CHECKED ? 1 : 0)); + db_set_b(NULL, KEYBDMODULE, "fcaps", (BYTE)(IsDlgButtonChecked(hwndDlg, IDC_CAPS) == BST_CHECKED ? 1 : 0)); + db_set_b(NULL, KEYBDMODULE, "fscroll", (BYTE)(IsDlgButtonChecked(hwndDlg, IDC_SCROLL) == BST_CHECKED ? 1 : 0)); + + if (IsDlgButtonChecked(hwndDlg, IDC_INTURN) == BST_CHECKED) + db_set_b(NULL, KEYBDMODULE, "feffect", FLASH_INTURN); + else if (IsDlgButtonChecked(hwndDlg, IDC_INSEQUENCE) == BST_CHECKED) + db_set_b(NULL, KEYBDMODULE, "feffect", FLASH_INSEQUENCE); + else if (IsDlgButtonChecked(hwndDlg, IDC_CUSTOM) == BST_CHECKED) + db_set_b(NULL, KEYBDMODULE, "feffect", FLASH_CUSTOM); + else if (IsDlgButtonChecked(hwndDlg, IDC_TRILLIAN) == BST_CHECKED) + db_set_b(NULL, KEYBDMODULE, "feffect", FLASH_TRILLIAN); + else + db_set_b(NULL, KEYBDMODULE, "feffect", FLASH_SAMETIME); + db_set_b(NULL, KEYBDMODULE, "order", (BYTE)SendDlgItemMessage(hwndDlg, IDC_SEQORDER, CB_GETITEMDATA, (WPARAM)SendDlgItemMessage(hwndDlg, IDC_SEQORDER, CB_GETCURSEL, 0, 0), 0)); + db_set_w(NULL, KEYBDMODULE, "custom", (WORD)SendDlgItemMessage(hwndDlg, IDC_SCUSTOM, CB_GETITEMDATA, (WPARAM)SendDlgItemMessage(hwndDlg, IDC_SCUSTOM, CB_GETCURSEL, 0, 0), 0)); - db_set_b(NULL, KEYBDMODULE, "ledsmsg", trillianLedsMsg); - db_set_b(NULL, KEYBDMODULE, "ledsfile", trillianLedsFile); - db_set_b(NULL, KEYBDMODULE, "ledsurl", trillianLedsURL); - db_set_b(NULL, KEYBDMODULE, "ledsother", trillianLedsOther); + db_set_b(NULL, KEYBDMODULE, "ledsmsg", trillianLedsMsg); + db_set_b(NULL, KEYBDMODULE, "ledsfile", trillianLedsFile); + db_set_b(NULL, KEYBDMODULE, "ledsurl", trillianLedsURL); + db_set_b(NULL, KEYBDMODULE, "ledsother", trillianLedsOther); - db_set_w(NULL, KEYBDMODULE, "sdelay", (WORD)SendDlgItemMessage(hwndDlg, IDC_DELAYSPIN, UDM_GETPOS, 0, 0)); + db_set_w(NULL, KEYBDMODULE, "sdelay", (WORD)SendDlgItemMessage(hwndDlg, IDC_DELAYSPIN, UDM_GETPOS, 0, 0)); - db_set_b(NULL, KEYBDMODULE, "speed", (BYTE)SendDlgItemMessage(hwndDlg, IDC_SPEED, TBM_GETPOS, 0, 0)); + db_set_b(NULL, KEYBDMODULE, "speed", (BYTE)SendDlgItemMessage(hwndDlg, IDC_SPEED, TBM_GETPOS, 0, 0)); - db_set_b(NULL, KEYBDMODULE, "keypresses", (BYTE)(IsDlgButtonChecked(hwndDlg, IDC_KEYPRESSES) == BST_CHECKED ? 1 : 0)); + db_set_b(NULL, KEYBDMODULE, "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; @@ -1040,7 +1040,7 @@ static INT_PTR CALLBACK DlgProcThemeOptions(HWND hwndDlg, UINT msg, WPARAM wPara EnableWindow(GetDlgItem(hwndDlg, IDC_UPDATE), FALSE); EnableWindow(GetDlgItem(hwndDlg, IDC_DELETE), TRUE); } - break; + break; case CBN_EDITCHANGE: wchar_t theme[MAX_PATH + 1]; GetDlgItemText(hwndDlg, IDC_THEME, theme, _countof(theme)); @@ -1083,132 +1083,132 @@ 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)); - } - 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); + { + 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)); } - SendMessage(GetParent(GetParent(hwndDlg)), PSM_CHANGED, 0, 0); - return 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; case IDC_UPDATE: - { - 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)); - } - EnableWindow(GetDlgItem(hwndDlg, IDC_UPDATE), FALSE); + { + 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)); } - SendMessage(GetParent(GetParent(hwndDlg)), PSM_CHANGED, 0, 0); - return TRUE; + EnableWindow(GetDlgItem(hwndDlg, IDC_UPDATE), FALSE); + } + SendMessage(GetParent(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); + 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); 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); - if (str) - SetDlgItemText(hwndDlg, IDC_CUSTOMSTRING, str); - } - EnableWindow(GetDlgItem(hwndDlg, IDC_UPDATE), FALSE); + SetDlgItemText(hwndDlg, IDC_CUSTOMSTRING, str); } - SendMessage(GetParent(GetParent(hwndDlg)), PSM_CHANGED, 0, 0); - return TRUE; + EnableWindow(GetDlgItem(hwndDlg, IDC_UPDATE), FALSE); + } + SendMessage(GetParent(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(GetParent(hwndDlg)), PSM_CHANGED, 0, 0); } - return TRUE; + } + return TRUE; case IDC_OVERRIDE: SendMessage(GetParent(GetParent(hwndDlg)), PSM_CHANGED, 0, 0); return TRUE; @@ -1216,68 +1216,68 @@ static INT_PTR CALLBACK DlgProcThemeOptions(HWND hwndDlg, UINT msg, WPARAM wPara 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 = db_get_wsa(NULL, KEYBDMODULE, fmtDBSettingName("theme%d", wCustomTheme))) { - mir_wstrcpy(theme, szTheme); - mir_free(szTheme); - } + { + 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 = db_get_wsa(NULL, KEYBDMODULE, 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); + db_set_ws(NULL, KEYBDMODULE, fmtDBSettingName("theme%d", i), themeAux); + wchar_t *str = (wchar_t *)SendDlgItemMessage(hwndDlg, IDC_THEME, CB_GETITEMDATA, (WPARAM)i, 0); + if (str) + db_set_ws(NULL, KEYBDMODULE, fmtDBSettingName("custom%d", i), str); 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); - db_set_ws(NULL, KEYBDMODULE, fmtDBSettingName("theme%d", i), themeAux); - wchar_t *str = (wchar_t *)SendDlgItemMessage(hwndDlg, IDC_THEME, CB_GETITEMDATA, (WPARAM)i, 0); - if (str) - db_set_ws(NULL, KEYBDMODULE, fmtDBSettingName("custom%d", i), str); - else - db_set_ws(NULL, KEYBDMODULE, 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; !db_unset(NULL, KEYBDMODULE, fmtDBSettingName("theme%d", i)); i++) - db_unset(NULL, KEYBDMODULE, fmtDBSettingName("custom%d", i)); + db_set_ws(NULL, KEYBDMODULE, fmtDBSettingName("custom%d", i), L""); - db_set_w(NULL, KEYBDMODULE, "custom", wCustomTheme); - // Still updating here the the Flashing tab's controls - SendDlgItemMessage(hwndEffect, IDC_SCUSTOM, CB_SETCURSEL, (WPARAM)wCustomTheme, 0); + if (!mir_wstrcmp(theme, themeAux)) + wCustomTheme = i; - db_set_b(NULL, KEYBDMODULE, "override", (BYTE)(IsDlgButtonChecked(hwndDlg, IDC_OVERRIDE) == BST_CHECKED ? 1 : 0)); + // 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; !db_unset(NULL, KEYBDMODULE, fmtDBSettingName("theme%d", i)); i++) + db_unset(NULL, KEYBDMODULE, fmtDBSettingName("custom%d", i)); - return TRUE; - } // switch code - break; - } //switch idFrom - } - break; //End WM_NOTIFY + db_set_w(NULL, KEYBDMODULE, "custom", wCustomTheme); + // Still updating here the the Flashing tab's controls + SendDlgItemMessage(hwndEffect, IDC_SCUSTOM, CB_SETCURSEL, (WPARAM)wCustomTheme, 0); - case WM_DESTROY: - { - int count = SendDlgItemMessage(hwndDlg, IDC_THEME, CB_GETCOUNT, 0, 0); + db_set_b(NULL, KEYBDMODULE, "override", (BYTE)(IsDlgButtonChecked(hwndDlg, IDC_OVERRIDE) == BST_CHECKED ? 1 : 0)); - for (int item = 0; item < count; item++) { - wchar_t *str = (wchar_t *)SendDlgItemMessage(hwndDlg, IDC_THEME, CB_GETITEMDATA, (WPARAM)item, 0); - if (str) - mir_free(str); - } + 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++) { + wchar_t *str = (wchar_t *)SendDlgItemMessage(hwndDlg, IDC_THEME, CB_GETITEMDATA, (WPARAM)item, 0); + if (str) + mir_free(str); } + break; + } default: break; diff --git a/plugins/ListeningTo/src/options.cpp b/plugins/ListeningTo/src/options.cpp index 549a3a1ef5..3dc64d76ed 100644 --- a/plugins/ListeningTo/src/options.cpp +++ b/plugins/ListeningTo/src/options.cpp @@ -1,4 +1,4 @@ -/*
+/*
Copyright (C) 2006 Ricardo Pescuma Domenecci
This is free software; you can redistribute it and/or
@@ -14,7 +14,7 @@ Library General Public License for more details. You should have received a copy of the GNU Library General Public
License along with this file; see the file license.txt. If
not, write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
-Boston, MA 02111-1307, USA.
+Boston, MA 02111-1307, USA.
*/
#include "stdafx.h"
@@ -192,14 +192,14 @@ static INT_PTR CALLBACK OptionsDlgProc(HWND hwndDlg, UINT msg, WPARAM wParam, LP return TRUE;
case WM_NOTIFY:
- {
- LPNMHDR lpnmhdr = (LPNMHDR)lParam;
- if (lpnmhdr->idFrom == 0 && lpnmhdr->code == PSN_APPLY) {
- RebuildMenu();
- StartTimer();
- }
+ {
+ LPNMHDR lpnmhdr = (LPNMHDR)lParam;
+ if (lpnmhdr->idFrom == 0 && lpnmhdr->code == PSN_APPLY) {
+ RebuildMenu();
+ StartTimer();
}
- break;
+ }
+ break;
case WM_COMMAND:
switch (LOWORD(wParam)) {
@@ -262,14 +262,14 @@ static INT_PTR CALLBACK PlayersDlgProc(HWND hwndDlg, UINT msg, WPARAM wParam, LP break;
case WM_NOTIFY:
- {
- LPNMHDR lpnmhdr = (LPNMHDR)lParam;
- if (lpnmhdr->idFrom == 0 && lpnmhdr->code == PSN_APPLY) {
- EnableDisablePlayers();
- StartTimer();
- }
+ {
+ LPNMHDR lpnmhdr = (LPNMHDR)lParam;
+ if (lpnmhdr->idFrom == 0 && lpnmhdr->code == PSN_APPLY) {
+ EnableDisablePlayers();
+ StartTimer();
}
- break;
+ }
+ break;
}
return ret;
diff --git a/plugins/ListeningTo/src/players/player.cpp b/plugins/ListeningTo/src/players/player.cpp index 23b10f3a8a..a27d5ee82f 100644 --- a/plugins/ListeningTo/src/players/player.cpp +++ b/plugins/ListeningTo/src/players/player.cpp @@ -1,4 +1,4 @@ -/*
+/*
Copyright (C) 2005-2009 Ricardo Pescuma Domenecci
This is free software; you can redistribute it and/or
@@ -14,7 +14,7 @@ Library General Public License for more details. You should have received a copy of the GNU Library General Public
License along with this file; see the file license.txt. If
not, write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
-Boston, MA 02111-1307, USA.
+Boston, MA 02111-1307, USA.
*/
#include "../stdafx.h"
diff --git a/plugins/ListeningTo/src/players/wmp.cpp b/plugins/ListeningTo/src/players/wmp.cpp index 6bc244e742..89f0a3bce1 100644 --- a/plugins/ListeningTo/src/players/wmp.cpp +++ b/plugins/ListeningTo/src/players/wmp.cpp @@ -1,4 +1,4 @@ -/*
+/*
Copyright (C) 2005-2009 Ricardo Pescuma Domenecci
This is free software; you can redistribute it and/or
@@ -14,7 +14,7 @@ Library General Public License for more details. You should have received a copy of the GNU Library General Public
License along with this file; see the file license.txt. If
not, write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
-Boston, MA 02111-1307, USA.
+Boston, MA 02111-1307, USA.
*/
#include "../stdafx.h"
diff --git a/plugins/ListeningTo/src/stdafx.h b/plugins/ListeningTo/src/stdafx.h index 905db9e8e9..cd40ca4da2 100644 --- a/plugins/ListeningTo/src/stdafx.h +++ b/plugins/ListeningTo/src/stdafx.h @@ -120,7 +120,7 @@ static bool IsEmpty(const WCHAR *str) void InitServices();
-void ReplaceTemplate(Buffer<wchar_t> *out, MCONTACT hContact, wchar_t *templ, wchar_t **vars, int numVars); +void ReplaceTemplate(Buffer<wchar_t> *out, MCONTACT hContact, wchar_t *templ, wchar_t **vars, int numVars);
wchar_t* VariablesParseInfo(ARGUMENTSINFO *ai);
wchar_t* VariablesParseType(ARGUMENTSINFO *ai);
diff --git a/plugins/MagneticWindows/src/MagneticWindows.cpp b/plugins/MagneticWindows/src/MagneticWindows.cpp index c7f2d7f986..c244dd19b5 100644 --- a/plugins/MagneticWindows/src/MagneticWindows.cpp +++ b/plugins/MagneticWindows/src/MagneticWindows.cpp @@ -27,10 +27,10 @@ PLUGININFOEX pluginInfo = { __AUTHORWEB, UNICODE_AWARE, // {08C01613-24C8-486F-BDAE-2C3DDCAF9347} - {0x8c01613, 0x24c8, 0x486f, { 0xbd, 0xae, 0x2c, 0x3d, 0xdc, 0xaf, 0x93, 0x47 }} + {0x8c01613, 0x24c8, 0x486f, { 0xbd, 0xae, 0x2c, 0x3d, 0xdc, 0xaf, 0x93, 0x47 }} }; -HINSTANCE hInst; +CMPlugin g_plugin; int hLangpack; CLIST_INTERFACE *pcli; @@ -55,21 +55,21 @@ INT_PTR SnapPluginWindowStop(WPARAM wParam, LPARAM) int PluginMessageWindowEvent(WPARAM, LPARAM lParam) { - MessageWindowEventData *Data = (MessageWindowEventData*) lParam; - + MessageWindowEventData *Data = (MessageWindowEventData*)lParam; + switch (Data->uType) { - case MSG_WINDOW_EVT_OPEN: - { - HWND hWnd = Data->hwndWindow; - HWND hWndParent = GetParent(hWnd); - while ((hWndParent != 0) && (hWndParent != GetDesktopWindow()) && (IsWindowVisible(hWndParent))) { - hWnd = hWndParent; - hWndParent = GetParent(hWnd); - } - - WindowOpen(hWnd); + case MSG_WINDOW_EVT_OPEN: + { + HWND hWnd = Data->hwndWindow; + HWND hWndParent = GetParent(hWnd); + while ((hWndParent != 0) && (hWndParent != GetDesktopWindow()) && (IsWindowVisible(hWndParent))) { + hWnd = hWndParent; + hWndParent = GetParent(hWnd); } - break; + + WindowOpen(hWnd); + } + break; case MSG_WINDOW_EVT_CLOSING: WindowClose(Data->hwndWindow); @@ -114,7 +114,7 @@ extern "C" int __declspec(dllexport) Load() { mir_getLP(&pluginInfo); pcli = Clist_GetInterface(); - + HookEvent(ME_SYSTEM_MODULESLOADED, SnapPluginStart); HookEvent(ME_SYSTEM_PRESHUTDOWN, SnapPluginShutDown); HookEvent(ME_OPT_INITIALISE, InitOptions); @@ -131,14 +131,3 @@ extern "C" int __declspec(dllexport) Unload() { return 0; } - -/////////////////////////////////////////////////////////////////////////////////////////////////// -// DLL MAIN -/////////////////////////////////////////////////////////////////////////////////////////////////// - - -BOOL WINAPI DllMain(HINSTANCE hinstDLL, DWORD, LPVOID) -{ - hInst = hinstDLL; - return TRUE; -} diff --git a/plugins/MagneticWindows/src/Options.cpp b/plugins/MagneticWindows/src/Options.cpp index 2c9de31cf1..650948fda6 100644 --- a/plugins/MagneticWindows/src/Options.cpp +++ b/plugins/MagneticWindows/src/Options.cpp @@ -14,8 +14,8 @@ INT_PTR CALLBACK OptionsDlgProc(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lP case WM_INITDIALOG: TranslateDialogDefault(hwndDlg); - CheckDlgButton(hwndDlg, IDC_CHK_SNAP, Options.DoSnap?BST_CHECKED:BST_UNCHECKED); - SendDlgItemMessage(hwndDlg, IDC_SLIDER_SNAPWIDTH, TBM_SETRANGE, FALSE, MAKELONG(1,32)); + CheckDlgButton(hwndDlg, IDC_CHK_SNAP, Options.DoSnap ? BST_CHECKED : BST_UNCHECKED); + SendDlgItemMessage(hwndDlg, IDC_SLIDER_SNAPWIDTH, TBM_SETRANGE, FALSE, MAKELONG(1, 32)); SendDlgItemMessage(hwndDlg, IDC_SLIDER_SNAPWIDTH, TBM_SETPOS, TRUE, Options.SnapWidth); mir_snwprintf(str, TranslateT("%d pix"), Options.SnapWidth); @@ -24,8 +24,8 @@ INT_PTR CALLBACK OptionsDlgProc(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lP EnableWindow(GetDlgItem(hwndDlg, IDC_SLIDER_SNAPWIDTH), Options.DoSnap); EnableWindow(GetDlgItem(hwndDlg, IDC_TXT_SNAPWIDTH), Options.DoSnap); - CheckDlgButton(hwndDlg, IDC_CHK_SCRIVERWORKAROUND, Options.ScriverWorkAround?BST_CHECKED:BST_UNCHECKED); - break; + CheckDlgButton(hwndDlg, IDC_CHK_SCRIVERWORKAROUND, Options.ScriverWorkAround ? BST_CHECKED : BST_UNCHECKED); + break; case WM_HSCROLL: mir_snwprintf(str, TranslateT("%d pix"), SendDlgItemMessage(hwndDlg, IDC_SLIDER_SNAPWIDTH, TBM_GETPOS, 0, 0)); @@ -34,7 +34,7 @@ INT_PTR CALLBACK OptionsDlgProc(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lP break; case WM_COMMAND: - switch( LOWORD(wParam)) { + switch (LOWORD(wParam)) { case IDC_CHK_SNAP: if (HIWORD(wParam) == BN_CLICKED) { EnableWindow(GetDlgItem(hwndDlg, IDC_SLIDER_SNAPWIDTH), IsDlgButtonChecked(hwndDlg, IDC_CHK_SNAP)); @@ -52,10 +52,10 @@ INT_PTR CALLBACK OptionsDlgProc(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lP break; case WM_NOTIFY: //Here we have pressed either the OK or the APPLY button. - switch(((LPNMHDR)lParam)->idFrom) { + switch (((LPNMHDR)lParam)->idFrom) { case 0: switch (((LPNMHDR)lParam)->code) { - case PSN_RESET: + case PSN_RESET: LoadOptions(); break; @@ -68,8 +68,8 @@ INT_PTR CALLBACK OptionsDlgProc(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lP db_set_b(NULL, MODULE_NAME, "SnapWidth", Options.SnapWidth); db_set_b(NULL, MODULE_NAME, "ScriverWorkAround", Options.ScriverWorkAround); break; - } - } + } + } break; } return 0; @@ -80,7 +80,7 @@ int InitOptions(WPARAM wParam, LPARAM) OPTIONSDIALOGPAGE Opt = { sizeof(Opt) }; Opt.pfnDlgProc = OptionsDlgProc; Opt.pszTemplate = MAKEINTRESOURCEA(IDD_OPT_MAGNETICWINDOWS); - Opt.hInstance = hInst; + Opt.hInstance = g_plugin.getInst(); Opt.szGroup.a = LPGEN("Customize"); Opt.szTitle.a = LPGEN("Magnetic Windows"); Opt.flags = ODPF_BOLDGROUPS; diff --git a/plugins/MagneticWindows/src/stdafx.h b/plugins/MagneticWindows/src/stdafx.h index 2ca9697411..ba6c7229ce 100644 --- a/plugins/MagneticWindows/src/stdafx.h +++ b/plugins/MagneticWindows/src/stdafx.h @@ -2,8 +2,6 @@ #include <commctrl.h> #include <stdio.h> -#define __NO_CMPLUGIN_NEEDED - #include <newpluginapi.h> #include <m_clistint.h> #include <m_message.h> @@ -20,15 +18,21 @@ #include "Version.h" typedef - struct { - int MouseX, MouseY; - bool SnappedX, SnappedY; - } TWorkingVariables; +struct { + int MouseX, MouseY; + bool SnappedX, SnappedY; +} TWorkingVariables; #define MODULE_NAME "MagneticWindows" -extern HINSTANCE hInst; + +struct CMPlugin : public PLUGIN<CMPlugin> +{ + CMPlugin() : + PLUGIN<CMPlugin>(MODULE_NAME) + {} +}; void WindowStart(); bool WindowOpen(HWND); diff --git a/plugins/MenuItemEx/src/main.cpp b/plugins/MenuItemEx/src/main.cpp index 0a14892c56..3448666c87 100644 --- a/plugins/MenuItemEx/src/main.cpp +++ b/plugins/MenuItemEx/src/main.cpp @@ -17,7 +17,6 @@ const int vf_default = VF_VS | VF_HFL | VF_IGN | VF_CID | VF_SHOWID | VF_RECV | VF_STAT | VF_SMNAME | VF_CIDN | VF_CIP;
CLIST_INTERFACE *pcli;
-HINSTANCE hinstance;
HGENMENU hmenuVis, hmenuOff, hmenuHide, hmenuIgnore, hmenuProto, hmenuAdded, hmenuAuthReq;
HGENMENU hmenuCopyID, hmenuRecvFiles, hmenuStatusMsg, hmenuCopyIP, hmenuCopyMirVer;
static HGENMENU hIgnoreItem[9], hProtoItem[MAX_PROTOS];
@@ -25,6 +24,7 @@ HICON hIcons[5]; BOOL bPopupService = FALSE;
PROTOACCOUNT **accs;
int protoCount;
+CMPlugin g_plugin;
int hLangpack;
struct {
@@ -232,7 +232,7 @@ void CopyToClipboard(HWND, LPSTR pszMsg, LPTSTR ptszMsg) if (buf == nullptr)
return;
- HGLOBAL hglbCopy = GlobalAlloc(GMEM_MOVEABLE, (mir_wstrlen(buf) + 1)*sizeof(wchar_t));
+ HGLOBAL hglbCopy = GlobalAlloc(GMEM_MOVEABLE, (mir_wstrlen(buf) + 1) * sizeof(wchar_t));
LPTSTR lptstrCopy = (LPTSTR)GlobalLock(hglbCopy);
mir_wstrcpy(lptstrCopy, buf);
mir_free(buf);
@@ -269,7 +269,7 @@ void GetID(MCONTACT hContact, LPSTR szProto, LPSTR szID, size_t dwIDSize) else if (dbv_uniqueid.type == DBVT_WORD)
mir_snprintf(szID, dwIDSize, "%u", dbv_uniqueid.wVal);
else if (dbv_uniqueid.type == DBVT_BLOB) {
- CMStringA tmp(' ', dbv_uniqueid.cpbVal*2+1);
+ CMStringA tmp(' ', dbv_uniqueid.cpbVal * 2 + 1);
bin2hex(dbv_uniqueid.pbVal, dbv_uniqueid.cpbVal, tmp.GetBuffer());
strncpy_s(szID, dwIDSize, tmp, _TRUNCATE);
}
@@ -291,7 +291,7 @@ int StatusMsgExists(MCONTACT hContact) if (it.flag & 8)
mir_snprintf(par, "%s/%s", module, it.name);
else
- strncpy(par, it.name, _countof(par)-1);
+ strncpy(par, it.name, _countof(par) - 1);
LPSTR msg = db_get_sa(hContact, (it.module) ? it.module : module, par);
if (msg) {
@@ -377,7 +377,7 @@ static INT_PTR CALLBACK AuthReqWndProc(HWND hdlg, UINT msg, WPARAM wparam, LPARA {
static MCONTACT hcontact;
- switch (msg){
+ switch (msg) {
case WM_INITDIALOG:
TranslateDialogDefault(hdlg);
mir_subclassWindow(GetDlgItem(hdlg, IDC_REASON), AuthReqEditSubclassProc);
@@ -393,7 +393,7 @@ static INT_PTR CALLBACK AuthReqWndProc(HWND hdlg, UINT msg, WPARAM wparam, LPARA GetDlgItemText(hdlg, IDC_REASON, tszReason, _countof(tszReason));
ProtoChainSend(hcontact, PSS_AUTHREQUEST, 0, (LPARAM)tszReason);
__fallthrough;
-
+
case IDCANCEL:
DestroyWindow(hdlg);
break;
@@ -412,21 +412,21 @@ static BOOL isProtoOnline(char *szProto) static INT_PTR onSendAuthRequest(WPARAM wparam, LPARAM)
{
- MCONTACT hContact = (MCONTACT) wparam;
+ MCONTACT hContact = (MCONTACT)wparam;
char *szProto = GetContactProto(hContact);
DWORD flags = CallProtoService(szProto, PS_GETCAPS, PFLAGNUM_4, 0);
if (flags&PF4_NOCUSTOMAUTH)
ProtoChainSend(hContact, PSS_AUTHREQUEST, 0, (LPARAM)L"");
else
- CreateDialogParam(hinstance, MAKEINTRESOURCE(IDD_AUTHREQ), pcli->hwndContactList, AuthReqWndProc, (LPARAM)hContact);
+ CreateDialogParam(g_plugin.getInst(), MAKEINTRESOURCE(IDD_AUTHREQ), pcli->hwndContactList, AuthReqWndProc, (LPARAM)hContact);
return 0;
}
static INT_PTR onSendAdded(WPARAM wparam, LPARAM)
{
- MCONTACT hContact = (MCONTACT) wparam;
+ MCONTACT hContact = (MCONTACT)wparam;
ProtoChainSend(hContact, PSS_ADDED, 0, 0);
return 0;
}
@@ -434,7 +434,7 @@ static INT_PTR onSendAdded(WPARAM wparam, LPARAM) // set the invisible-flag in db
static INT_PTR onSetInvis(WPARAM wparam, LPARAM)
{
- MCONTACT hContact = (MCONTACT) wparam;
+ MCONTACT hContact = (MCONTACT)wparam;
ProtoChainSend(hContact, PSS_SETAPPARENTMODE, (db_get_w(hContact, GetContactProto(hContact), "ApparentMode", 0) == ID_STATUS_OFFLINE) ? 0 : ID_STATUS_OFFLINE, 0);
return 0;
}
@@ -442,14 +442,14 @@ static INT_PTR onSetInvis(WPARAM wparam, LPARAM) // set visible-flag in db
static INT_PTR onSetVis(WPARAM wparam, LPARAM)
{
- MCONTACT hContact = (MCONTACT) wparam;
+ MCONTACT hContact = (MCONTACT)wparam;
ProtoChainSend(hContact, PSS_SETAPPARENTMODE, (db_get_w(hContact, GetContactProto(hContact), "ApparentMode", 0) == ID_STATUS_ONLINE) ? 0 : ID_STATUS_ONLINE, 0);
return 0;
}
static INT_PTR onHide(WPARAM wparam, LPARAM)
{
- MCONTACT hContact = (MCONTACT) wparam;
+ MCONTACT hContact = (MCONTACT)wparam;
db_set_b(hContact, "CList", "Hidden", (BYTE)!db_get_b(hContact, "CList", "Hidden", 0));
return 0;
}
@@ -489,7 +489,7 @@ static void ModifyCopyID(MCONTACT hContact, BOOL bShowID, BOOL bTrimID) wchar_t buffer[256];
char szID[256];
GetID(hContact, szProto, (LPSTR)&szID, _countof(szID));
- if (szID[0]) {
+ if (szID[0]) {
if (bShowID) {
if (bTrimID && (mir_strlen(szID) > MAX_IDLEN)) {
szID[MAX_IDLEN - 2] = szID[MAX_IDLEN - 1] = szID[MAX_IDLEN] = '.';
@@ -586,7 +586,7 @@ static INT_PTR onCopyID(WPARAM wparam, LPARAM lparam) mir_snprintf(buffer, "%s: %s", szProto, szID);
}
else
- strncpy(buffer, szID, _countof(buffer)-1);
+ strncpy(buffer, szID, _countof(buffer) - 1);
CopyToClipboard((HWND)lparam, buffer, nullptr);
if (CTRL_IS_PRESSED && bPopupService)
@@ -597,7 +597,7 @@ static INT_PTR onCopyID(WPARAM wparam, LPARAM lparam) static INT_PTR onCopyStatusMsg(WPARAM wparam, LPARAM lparam)
{
- MCONTACT hContact = (MCONTACT) wparam;
+ MCONTACT hContact = (MCONTACT)wparam;
char par[32];
wchar_t buffer[2048];
DWORD flags = db_get_dw(NULL, MODULENAME, "flags", vf_default);
@@ -738,7 +738,7 @@ static HGENMENU AddSubmenuItem(HGENMENU hRoot, wchar_t* name, HICON icon, DWORD mi.hIcolibItem = icon;
mi.flags = CMIF_UNICODE | CMIF_UNMOVABLE | flag;
mi.pszService = service;
-
+
HGENMENU res = Menu_AddContactMenuItem(&mi);
Menu_ConfigureItem(res, MCI_OPT_EXECPARAM, param);
return res;
@@ -776,7 +776,7 @@ static int BuildMenu(WPARAM wparam, LPARAM) BYTE bHidden = db_get_b(hContact, "CList", "Hidden", 0);
if (bHidden)
Menu_ModifyItem(hmenuHide, LPGENW("Show in list"), IcoLib_GetIcon("miex_showil"));
- else
+ else
Menu_ModifyItem(hmenuHide, LPGENW("Hide from list"), IcoLib_GetIcon("miex_hidefl"));
}
@@ -1053,8 +1053,8 @@ extern "C" __declspec(dllexport) int Load(void) mir_getLP(&pluginInfoEx);
pcli = Clist_GetInterface();
- Icon_Register(hinstance, LPGEN("MenuItemEx"), iconList, _countof(iconList));
- Icon_Register(hinstance, LPGEN("MenuItemEx"), overlayIconList, _countof(overlayIconList));
+ Icon_Register(g_plugin.getInst(), LPGEN("MenuItemEx"), iconList, _countof(iconList));
+ Icon_Register(g_plugin.getInst(), LPGEN("MenuItemEx"), overlayIconList, _countof(overlayIconList));
CreateServiceFunction(MS_SETINVIS, onSetInvis);
CreateServiceFunction(MS_SETVIS, onSetVis);
@@ -1085,9 +1085,3 @@ extern "C" __declspec(dllexport) int Unload(void) DestroyIcon(hIcons[4]);
return 0;
}
-
-BOOL WINAPI DllMain(HINSTANCE hinst, DWORD, LPVOID)
-{
- hinstance = hinst;
- return 1;
-}
diff --git a/plugins/MenuItemEx/src/options.cpp b/plugins/MenuItemEx/src/options.cpp index 853fdb40d8..f9505d84dc 100644 --- a/plugins/MenuItemEx/src/options.cpp +++ b/plugins/MenuItemEx/src/options.cpp @@ -1,6 +1,5 @@ #include "stdafx.h"
-extern HINSTANCE hinstance;
extern BOOL bPopupService;
struct {
@@ -62,7 +61,7 @@ INT_PTR CALLBACK OptionsProc(HWND hdlg, UINT msg, WPARAM wparam, LPARAM lparam) return 1;
case WM_NOTIFY:
- switch (((LPNMHDR)lparam)->code){
+ switch (((LPNMHDR)lparam)->code) {
case PSN_APPLY:
DWORD mod_flags = 0;
@@ -99,7 +98,7 @@ int OptionsInit(WPARAM wparam, LPARAM) {
OPTIONSDIALOGPAGE odp = { 0 };
odp.position = 955000000;
- odp.hInstance = hinstance;
+ odp.hInstance = g_plugin.getInst();
odp.pszTemplate = MAKEINTRESOURCEA(IDD_OPTIONS);
odp.szTitle.a = MODULENAME;
odp.pfnDlgProc = OptionsProc;
diff --git a/plugins/MenuItemEx/src/stdafx.h b/plugins/MenuItemEx/src/stdafx.h index 80a4dca30e..4f83841c4e 100644 --- a/plugins/MenuItemEx/src/stdafx.h +++ b/plugins/MenuItemEx/src/stdafx.h @@ -5,8 +5,6 @@ #include <windows.h>
-#define __NO_CMPLUGIN_NEEDED
-
#include <newpluginapi.h>
#include <win2k.h>
#include <m_system.h>
@@ -32,6 +30,13 @@ #define MODULENAME "MenuItemEx"
+struct CMPlugin : public PLUGIN<CMPlugin>
+{
+ CMPlugin() :
+ PLUGIN<CMPlugin>(MODULENAME)
+ {}
+};
+
#define MIIM_STRING 0x00000040
extern PLUGININFOEX pluginInfoEx;
|